@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,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,48 +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
-
11
- const port = app.get('port')
12
- const appUrl = \`http://\${app.get('host')}:\${port}\`
13
-
14
- describe('Feathers application tests', () => {
15
- let server: Server
16
-
17
- before(async () => {
18
- server = await app.listen(port)
19
- })
20
-
21
- after(async () => {
22
- await app.teardown()
23
- })
24
-
25
- it('starts and shows the index page', async () => {
26
- const { data } = await axios.get<string>(appUrl)
27
-
28
- assert.ok(data.indexOf('<html lang="en">') !== -1)
29
- })
30
-
31
- it('shows a 404 JSON error', async () => {
32
- try {
33
- await axios.get(\`\${appUrl}/path/to/nowhere\`, {
34
- responseType: 'json'
35
- })
36
- assert.fail('should never get here')
37
- } catch (error: any) {
38
- const { response } = error
39
- assert.strictEqual(response?.status, 404)
40
- assert.strictEqual(response?.data?.code, 404)
41
- assert.strictEqual(response?.data?.name, 'NotFound')
42
- }
43
- })
44
- })
45
- `;
46
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)('test', 'app.test')));
47
- exports.generate = generate;
48
- //# 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,EAAE,GAAG,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;0BAGlC,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,47 +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
-
10
- const port = app.get('port')
11
- const appUrl = \`http://\${app.get('host')}:\${port}\`
12
-
13
- describe('Feathers application tests', () => {
14
- let server: Server
15
-
16
- before(async () => {
17
- server = await app.listen(port)
18
- })
19
-
20
- after(async () => {
21
- await app.teardown()
22
- })
23
-
24
- it('starts and shows the index page', async () => {
25
- const { data } = await axios.get<string>(appUrl)
26
-
27
- assert.ok(data.indexOf('<html lang="en">') !== -1)
28
- })
29
-
30
- it('shows a 404 JSON error', async () => {
31
- try {
32
- await axios.get(\`\${appUrl}/path/to/nowhere\`, {
33
- responseType: 'json'
34
- })
35
- assert.fail('should never get here')
36
- } catch (error: any) {
37
- const { response } = error
38
- assert.strictEqual(response?.status, 404)
39
- assert.strictEqual(response?.data?.code, 404)
40
- assert.strictEqual(response?.data?.name, 'NotFound')
41
- }
42
- })
43
- })
44
- `
45
-
46
- export const generate = (ctx: AppGeneratorContext) =>
47
- 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,121 +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 */ `import { feathers } from '@feathersjs/feathers'
7
- import configuration from '@feathersjs/configuration'
8
- import {
9
- koa, rest, bodyParser, errorHandler, parseAuthentication, cors, serveStatic
10
- } from '@feathersjs/koa'
11
- ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
12
-
13
- import type { Application } from './declarations'
14
- import { configurationValidator } from './schemas/configuration'
15
- import { logErrorHook } from './logger'
16
- import { services } from './services/index'
17
- import { channels } from './channels'
18
-
19
- const app: Application = koa(feathers())
20
-
21
- // Load our app configuration (see config/ folder)
22
- app.configure(configuration(configurationValidator))
23
-
24
- // Set up Koa middleware
25
- app.use(cors())
26
- app.use(serveStatic(app.get('public')))
27
- app.use(errorHandler())
28
- app.use(parseAuthentication())
29
- app.use(bodyParser())
30
-
31
- // Configure services and transports
32
- app.configure(rest())
33
- ${transports.includes('websockets')
34
- ? `app.configure(socketio({
35
- cors: {
36
- origin: app.get('origins')
37
- }
38
- }))`
39
- : ''}
40
- app.configure(services)
41
- app.configure(channels)
42
-
43
- // Register hooks that run on all service methods
44
- app.hooks({
45
- around: {
46
- all: [ logErrorHook ]
47
- },
48
- before: {},
49
- after: {},
50
- error: {}
51
- })
52
- // Register application setup and teardown hooks here
53
- app.hooks({
54
- setup: [],
55
- teardown: []
56
- })
57
-
58
- export { app }
59
- `;
60
- const tsExpressApp = ({ transports }) => /* ts */ `import { feathers } from '@feathersjs/feathers'
61
- import express, {
62
- rest, json, urlencoded, cors, compression,
63
- serveStatic, notFound, errorHandler
64
- } from '@feathersjs/express'
65
- import configuration from '@feathersjs/configuration'
66
- ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
67
-
68
- import type { Application } from './declarations'
69
- import { configurationValidator } from './schemas/configuration'
70
- import { logger, logErrorHook } from './logger'
71
- import { services } from './services/index'
72
- import { channels } from './channels'
73
-
74
- const app: Application = express(feathers())
75
-
76
- // Load app configuration
77
- app.configure(configuration(configurationValidator))
78
- app.use(cors())
79
- app.use(compression())
80
- app.use(json())
81
- app.use(urlencoded({ extended: true }))
82
- // Host the public folder
83
- app.use('/', serveStatic(app.get('public')))
84
-
85
- // Configure services and real-time functionality
86
- app.configure(rest())
87
- ${transports.includes('websockets')
88
- ? `app.configure(socketio({
89
- cors: {
90
- origin: app.get('origins')
91
- }
92
- }))`
93
- : ''}
94
- app.configure(services)
95
- app.configure(channels)
96
-
97
- // Configure a middleware for 404s and the error handler
98
- app.use(notFound())
99
- app.use(errorHandler({ logger }))
100
-
101
- // Register hooks that run on all service methods
102
- app.hooks({
103
- around: {
104
- all: [ logErrorHook ]
105
- },
106
- before: {},
107
- after: {},
108
- error: {}
109
- })
110
- // Register application setup and teardown hooks here
111
- app.hooks({
112
- setup: [],
113
- teardown: []
114
- })
115
-
116
- export { app }
117
- `;
118
- const template = (ctx) => ctx.framework === 'express' ? tsExpressApp(ctx) : tsKoaApp(ctx);
119
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'app')));
120
- exports.generate = generate;
121
- //# 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;;;;;EAKlC,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;;;;;;EAMlC,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,136 +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 */ `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 './schemas/configuration'
16
- import { logErrorHook } from './logger'
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
- ${
35
- transports.includes('websockets')
36
- ? `app.configure(socketio({
37
- cors: {
38
- origin: app.get('origins')
39
- }
40
- }))`
41
- : ''
42
- }
43
- app.configure(services)
44
- app.configure(channels)
45
-
46
- // Register hooks that run on all service methods
47
- app.hooks({
48
- around: {
49
- all: [ logErrorHook ]
50
- },
51
- before: {},
52
- after: {},
53
- error: {}
54
- })
55
- // Register application setup and teardown hooks here
56
- app.hooks({
57
- setup: [],
58
- teardown: []
59
- })
60
-
61
- export { app }
62
- `
63
-
64
- const tsExpressApp = ({
65
- transports
66
- }: AppGeneratorContext) => /* ts */ `import { feathers } from '@feathersjs/feathers'
67
- import express, {
68
- rest, json, urlencoded, cors, compression,
69
- serveStatic, notFound, errorHandler
70
- } from '@feathersjs/express'
71
- import configuration from '@feathersjs/configuration'
72
- ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
73
-
74
- import type { Application } from './declarations'
75
- import { configurationValidator } from './schemas/configuration'
76
- import { logger, logErrorHook } from './logger'
77
- import { services } from './services/index'
78
- import { channels } from './channels'
79
-
80
- const app: Application = express(feathers())
81
-
82
- // Load app configuration
83
- app.configure(configuration(configurationValidator))
84
- app.use(cors())
85
- app.use(compression())
86
- app.use(json())
87
- app.use(urlencoded({ extended: true }))
88
- // Host the public folder
89
- app.use('/', serveStatic(app.get('public')))
90
-
91
- // Configure services and real-time functionality
92
- app.configure(rest())
93
- ${
94
- transports.includes('websockets')
95
- ? `app.configure(socketio({
96
- cors: {
97
- origin: app.get('origins')
98
- }
99
- }))`
100
- : ''
101
- }
102
- app.configure(services)
103
- app.configure(channels)
104
-
105
- // Configure a middleware for 404s and the error handler
106
- app.use(notFound())
107
- app.use(errorHandler({ logger }))
108
-
109
- // Register hooks that run on all service methods
110
- app.hooks({
111
- around: {
112
- all: [ logErrorHook ]
113
- },
114
- before: {},
115
- after: {},
116
- error: {}
117
- })
118
- // Register application setup and teardown hooks here
119
- app.hooks({
120
- setup: [],
121
- teardown: []
122
- })
123
-
124
- export { app }
125
- `
126
-
127
- const template = (ctx: AppGeneratorContext) =>
128
- ctx.framework === 'express' ? tsExpressApp(ctx) : tsKoaApp(ctx)
129
-
130
- export const generate = (ctx: AppGeneratorContext) =>
131
- generator(ctx).then(
132
- renderSource(
133
- template,
134
- toFile<AppGeneratorContext>(({ lib }) => lib, 'app')
135
- )
136
- )
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,48 +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 */ `import type { RealTimeConnection, Params } from '@feathersjs/feathers'
7
- import '@feathersjs/transport-commons'
8
- import type { Application, HookContext } from './declarations'
9
- import { logger } from './logger'
10
-
11
- export const channels = (app: Application) => {
12
- if(typeof app.channel !== 'function') {
13
- // If no real-time functionality has been configured just return
14
- return
15
- }
16
-
17
- logger.warn('Publishing all events to all authenticated users. See \`channels.${language}\` and https://docs.feathersjs.com/api/channels.html for more information.')
18
-
19
- app.on('connection', (connection: any) => {
20
- // On a new real-time connection, add it to the anonymous channel
21
- app.channel('anonymous').join(connection)
22
- })
23
-
24
- app.on('login', (authResult: any, { connection }: Params) => {
25
- // connection can be undefined if there is no
26
- // real-time connection, e.g. when logging in via REST
27
- if(connection) {
28
- // The connection is no longer anonymous, remove it
29
- app.channel('anonymous').leave(connection)
30
-
31
- // Add it to the authenticated user channel
32
- app.channel('authenticated').join(connection)
33
- }
34
- })
35
-
36
- // eslint-disable-next-line no-unused-vars
37
- app.publish((data: any, context: HookContext) => {
38
- // Here you can add event publishers to channels set up in \`channels.js\`
39
- // To publish only for a specific event use \`app.publish(eventname, () => {})\`
40
-
41
- // e.g. to publish all service events to all authenticated users use
42
- return app.channel('authenticated')
43
- })
44
- }
45
- `;
46
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'channels')));
47
- exports.generate = generate;
48
- //# 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;;;;;;;;;;;kFAW8C,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,54 +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 */ `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
-
48
- export const generate = (ctx: AppGeneratorContext) =>
49
- generator(ctx).then(
50
- renderSource(
51
- template,
52
- toFile<AppGeneratorContext>(({ lib }) => lib, 'channels')
53
- )
54
- )
@@ -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>;