@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
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-pre.32](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.31...v5.0.0-pre.32) (2022-10-26)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **cli:** Ensure code injection points are not code style dependent ([#2832](https://github.com/feathersjs/feathers/issues/2832)) ([0776e26](https://github.com/feathersjs/feathers/commit/0776e26bfe4c1df9d2786499941bd3faba1715c0))
11
+ - **cli:** Only generate authentication setup when selected ([#2823](https://github.com/feathersjs/feathers/issues/2823)) ([7d219d9](https://github.com/feathersjs/feathers/commit/7d219d9c5269267b50f3ce99a5653d645f9927c1))
12
+ - **docs:** Review transport API docs and update Express middleware setup ([#2811](https://github.com/feathersjs/feathers/issues/2811)) ([1b97f14](https://github.com/feathersjs/feathers/commit/1b97f14d474f5613482f259eeaa585c24fcfab43))
13
+ - **transports:** Add remaining middleware for generated apps to Koa and Express ([#2796](https://github.com/feathersjs/feathers/issues/2796)) ([0d5781a](https://github.com/feathersjs/feathers/commit/0d5781a5c72a0cbb2ec8211bfa099f0aefe115a2))
14
+
15
+ ### Features
16
+
17
+ - **cli:** Add authentication client to generated client ([#2801](https://github.com/feathersjs/feathers/issues/2801)) ([bd59f91](https://github.com/feathersjs/feathers/commit/bd59f91b45a01c2eea0c4386e567f4de5aa6ad99))
18
+
19
+ # [5.0.0-pre.31](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.30...v5.0.0-pre.31) (2022-10-12)
20
+
21
+ ### Features
22
+
23
+ - **cli:** Generate full client test suite and improve typed client ([#2788](https://github.com/feathersjs/feathers/issues/2788)) ([57119b6](https://github.com/feathersjs/feathers/commit/57119b6bb2797f7297cf054268a248c093ecd538))
24
+ - **cli:** Improve generated schema definitions ([#2783](https://github.com/feathersjs/feathers/issues/2783)) ([474a9fd](https://github.com/feathersjs/feathers/commit/474a9fda2107e9bcf357746320a8e00cda8182b6))
25
+
6
26
  # [5.0.0-pre.30](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.29...v5.0.0-pre.30) (2022-10-07)
7
27
 
8
28
  ### Bug Fixes
package/lib/app/index.js CHANGED
@@ -120,12 +120,12 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
120
120
  }))
121
121
  .then((0, pinion_1.install)(({ transports, framework, dependencyVersions, dependencies, schema }) => {
122
122
  const hasSocketio = transports.includes('websockets');
123
- dependencies.push('@feathersjs/feathers', '@feathersjs/errors', '@feathersjs/schema', '@feathersjs/configuration', '@feathersjs/transport-commons', '@feathersjs/authentication', 'winston');
123
+ dependencies.push('@feathersjs/feathers', '@feathersjs/errors', '@feathersjs/schema', '@feathersjs/configuration', '@feathersjs/transport-commons', '@feathersjs/authentication', '@feathersjs/authentication-client', 'winston');
124
124
  if (hasSocketio) {
125
125
  dependencies.push('@feathersjs/socketio');
126
126
  }
127
127
  if (framework === 'koa') {
128
- dependencies.push('@feathersjs/koa', 'koa-static');
128
+ dependencies.push('@feathersjs/koa');
129
129
  }
130
130
  if (framework === 'express') {
131
131
  dependencies.push('@feathersjs/express', 'compression');
@@ -135,10 +135,10 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
135
135
  }
136
136
  return (0, commons_1.addVersions)(dependencies, dependencyVersions);
137
137
  }, false, ctx.packager))
138
- .then((0, pinion_1.install)(({ language, framework, devDependencies, dependencyVersions }) => {
139
- devDependencies.push('nodemon', 'axios', 'mocha', 'cross-env', 'prettier', '@feathersjs/cli');
138
+ .then((0, pinion_1.install)(({ language, devDependencies, dependencyVersions }) => {
139
+ devDependencies.push('nodemon', 'axios', 'mocha', 'cross-env', 'prettier', '@feathersjs/cli', '@feathersjs/rest-client');
140
140
  if (language === 'ts') {
141
- devDependencies.push('@types/mocha', framework === 'koa' ? '@types/koa-static' : '@types/compression', '@types/node', 'nodemon', 'ts-node', 'typescript', 'shx');
141
+ devDependencies.push('@types/mocha', '@types/node', 'nodemon', 'ts-node', 'typescript', 'shx');
142
142
  }
143
143
  return (0, commons_1.addVersions)(devDependencies, dependencyVersions);
144
144
  }, true, ctx.packager));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA0B;AAC1B,kDAAyB;AACzB,+CAS2B;AAC3B,wCAAqG;AACrG,sDAAyG;AACzG,8CAA6F;AAiCtF,MAAM,QAAQ,GAAG,CAAC,GAA0B,EAAE,EAAE,CACrD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CAAC,IAAA,+BAAqB,GAAE,CAAC;KAC7B,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACd,GAAG,GAAG;IACN,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,EAAE;CACpB,CAAC,CAAC;KACF,IAAI,CACH,IAAA,eAAM,EAA6C,CAAC,GAAG,EAAE,EAAE,CAAC;IAC1D;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,8CAA8C;QACvD,IAAI,EAAE,CAAC,GAAG,CAAC,QAAQ;QACnB,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE;YACnC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE;SACpC;KACF;IACD;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI;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ACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,yBAAyB,CAC1B,CAAA;IAED,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;KAC/F;IAED,OAAO,IAAA,qBAAW,EAAC,eAAe,EAAE,kBAAkB,CAAC,CAAA;AACzD,CAAC,EACD,IAAI,EACJ,GAAG,CAAC,QAAQ,CACb,CACF,CAAA;AAnLQ,QAAA,QAAQ,YAmLhB"}
package/lib/app/index.ts CHANGED
@@ -176,6 +176,7 @@ export const generate = (ctx: AppGeneratorArguments) =>
176
176
  '@feathersjs/configuration',
177
177
  '@feathersjs/transport-commons',
178
178
  '@feathersjs/authentication',
179
+ '@feathersjs/authentication-client',
179
180
  'winston'
180
181
  )
181
182
 
@@ -184,7 +185,7 @@ export const generate = (ctx: AppGeneratorArguments) =>
184
185
  }
185
186
 
186
187
  if (framework === 'koa') {
187
- dependencies.push('@feathersjs/koa', 'koa-static')
188
+ dependencies.push('@feathersjs/koa')
188
189
  }
189
190
 
190
191
  if (framework === 'express') {
@@ -203,19 +204,19 @@ export const generate = (ctx: AppGeneratorArguments) =>
203
204
  )
204
205
  .then(
205
206
  install<AppGeneratorContext>(
206
- ({ language, framework, devDependencies, dependencyVersions }) => {
207
- devDependencies.push('nodemon', 'axios', 'mocha', 'cross-env', 'prettier', '@feathersjs/cli')
207
+ ({ language, devDependencies, dependencyVersions }) => {
208
+ devDependencies.push(
209
+ 'nodemon',
210
+ 'axios',
211
+ 'mocha',
212
+ 'cross-env',
213
+ 'prettier',
214
+ '@feathersjs/cli',
215
+ '@feathersjs/rest-client'
216
+ )
208
217
 
209
218
  if (language === 'ts') {
210
- devDependencies.push(
211
- '@types/mocha',
212
- framework === 'koa' ? '@types/koa-static' : '@types/compression',
213
- '@types/node',
214
- 'nodemon',
215
- 'ts-node',
216
- 'typescript',
217
- 'shx'
218
- )
219
+ devDependencies.push('@types/mocha', '@types/node', 'nodemon', 'ts-node', 'typescript', 'shx')
219
220
  }
220
221
 
221
222
  return addVersions(devDependencies, dependencyVersions)
@@ -3,10 +3,11 @@ 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 tsKoaApp = ({ transports }) => /* ts */ `import serveStatic from 'koa-static'
7
- import { feathers } from '@feathersjs/feathers'
6
+ const tsKoaApp = ({ transports }) => /* ts */ `import { feathers } from '@feathersjs/feathers'
8
7
  import configuration from '@feathersjs/configuration'
9
- import { koa, rest, bodyParser, errorHandler, parseAuthentication, cors } from '@feathersjs/koa'
8
+ import {
9
+ koa, rest, bodyParser, errorHandler, parseAuthentication, cors, serveStatic
10
+ } from '@feathersjs/koa'
10
11
  ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
11
12
 
12
13
  import type { Application } from './declarations'
@@ -56,11 +57,9 @@ app.hooks({
56
57
 
57
58
  export { app }
58
59
  `;
59
- const tsExpressApp = ({ transports }) => /* ts */ `import compress from 'compression'
60
-
61
- import { feathers } from '@feathersjs/feathers'
60
+ const tsExpressApp = ({ transports }) => /* ts */ `import { feathers } from '@feathersjs/feathers'
62
61
  import express, {
63
- rest, json, urlencoded, cors,
62
+ rest, json, urlencoded, cors, compression,
64
63
  serveStatic, notFound, errorHandler
65
64
  } from '@feathersjs/express'
66
65
  import configuration from '@feathersjs/configuration'
@@ -77,7 +76,7 @@ const app: Application = express(feathers())
77
76
  // Load app configuration
78
77
  app.configure(configuration(configurationValidator))
79
78
  app.use(cors())
80
- app.use(compress())
79
+ app.use(compression())
81
80
  app.use(json())
82
81
  app.use(urlencoded({ extended: true }))
83
82
  // Host the public folder
@@ -1 +1 @@
1
- {"version":3,"file":"app.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/app.tpl.ts"],"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} from '../../commons'
3
3
  import { AppGeneratorContext } from '../index'
4
4
 
5
- const tsKoaApp = ({ transports }: AppGeneratorContext) => /* ts */ `import serveStatic from 'koa-static'
6
- import { feathers } from '@feathersjs/feathers'
5
+ const tsKoaApp = ({
6
+ transports
7
+ }: AppGeneratorContext) => /* ts */ `import { feathers } from '@feathersjs/feathers'
7
8
  import configuration from '@feathersjs/configuration'
8
- import { koa, rest, bodyParser, errorHandler, parseAuthentication, cors } from '@feathersjs/koa'
9
+ import {
10
+ koa, rest, bodyParser, errorHandler, parseAuthentication, cors, serveStatic
11
+ } from '@feathersjs/koa'
9
12
  ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
10
13
 
11
14
  import type { Application } from './declarations'
@@ -58,11 +61,11 @@ app.hooks({
58
61
  export { app }
59
62
  `
60
63
 
61
- const tsExpressApp = ({ transports }: AppGeneratorContext) => /* ts */ `import compress from 'compression'
62
-
63
- import { feathers } from '@feathersjs/feathers'
64
+ const tsExpressApp = ({
65
+ transports
66
+ }: AppGeneratorContext) => /* ts */ `import { feathers } from '@feathersjs/feathers'
64
67
  import express, {
65
- rest, json, urlencoded, cors,
68
+ rest, json, urlencoded, cors, compression,
66
69
  serveStatic, notFound, errorHandler
67
70
  } from '@feathersjs/express'
68
71
  import configuration from '@feathersjs/configuration'
@@ -79,7 +82,7 @@ const app: Application = express(feathers())
79
82
  // Load app configuration
80
83
  app.configure(configuration(configurationValidator))
81
84
  app.use(cors())
82
- app.use(compress())
85
+ app.use(compression())
83
86
  app.use(json())
84
87
  app.use(urlencoded({ extended: true }))
85
88
  // Host the public folder
@@ -3,7 +3,8 @@ 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 = ({ language }) => /* ts */ `import '@feathersjs/transport-commons'
6
+ const template = ({ language }) => /* ts */ `import type { RealTimeConnection, Params } from '@feathersjs/feathers'
7
+ import '@feathersjs/transport-commons'
7
8
  import type { Application, HookContext } from './declarations'
8
9
  import { logger } from './logger'
9
10
 
@@ -20,53 +21,26 @@ export const channels = (app: Application) => {
20
21
  app.channel('anonymous').join(connection)
21
22
  })
22
23
 
23
- app.on('login', (authResult: any, { connection }: any) => {
24
+ app.on('login', (authResult: any, { connection }: Params) => {
24
25
  // connection can be undefined if there is no
25
26
  // real-time connection, e.g. when logging in via REST
26
27
  if(connection) {
27
- // Obtain the logged in user
28
- // const user = authResult.user
29
-
30
28
  // The connection is no longer anonymous, remove it
31
29
  app.channel('anonymous').leave(connection)
32
30
 
33
31
  // Add it to the authenticated user channel
34
32
  app.channel('authenticated').join(connection)
35
-
36
- // Channels can be named anything and joined on any condition
37
-
38
- // E.g. to send real-time events only to admins use
39
- // if(user.isAdmin) { app.channel('admins').join(connection) }
40
-
41
- // If the user has joined e.g. chat rooms
42
- // if(Array.isArray(user.rooms)) user.rooms.forEach(room => app.channel(\`rooms/\${room.id}\`).join(connection))
43
-
44
- // Easily organize users by email and userid for things like messaging
45
- // app.channel(\`emails/\${user.email}\`).join(connection)
46
- // app.channel(\`userIds/\${user.id}\`).join(connection)
47
33
  }
48
34
  })
49
35
 
50
36
  // eslint-disable-next-line no-unused-vars
51
- app.publish((data: any, hook: HookContext) => {
37
+ app.publish((data: any, context: HookContext) => {
52
38
  // Here you can add event publishers to channels set up in \`channels.js\`
53
39
  // To publish only for a specific event use \`app.publish(eventname, () => {})\`
54
40
 
55
41
  // e.g. to publish all service events to all authenticated users use
56
42
  return app.channel('authenticated')
57
43
  })
58
-
59
- // Here you can also add service specific event publishers
60
- // e.g. the publish the \`users\` service \`created\` event to the \`admins\` channel
61
- // app.service('users').publish('created', () => app.channel('admins'))
62
-
63
- // With the userid and email organization from above you can easily select involved users
64
- // app.service('messages').publish(() => {
65
- // return [
66
- // app.channel(\`userIds/\${data.createdBy}\`),
67
- // app.channel(\`emails/\${data.recipientEmail}\`)
68
- // ]
69
- // })
70
44
  }
71
45
  `;
72
46
  const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'channels')));
@@ -1 +1 @@
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,EAAE,QAAQ,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;kFAUiB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDzF,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
+ {"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"}
@@ -2,7 +2,10 @@ import { generator, toFile } from '@feathershq/pinion'
2
2
  import { renderSource } from '../../commons'
3
3
  import { AppGeneratorContext } from '../index'
4
4
 
5
- const template = ({ language }: AppGeneratorContext) => /* ts */ `import '@feathersjs/transport-commons'
5
+ const template = ({
6
+ language
7
+ }: AppGeneratorContext) => /* ts */ `import type { RealTimeConnection, Params } from '@feathersjs/feathers'
8
+ import '@feathersjs/transport-commons'
6
9
  import type { Application, HookContext } from './declarations'
7
10
  import { logger } from './logger'
8
11
 
@@ -19,53 +22,26 @@ export const channels = (app: Application) => {
19
22
  app.channel('anonymous').join(connection)
20
23
  })
21
24
 
22
- app.on('login', (authResult: any, { connection }: any) => {
25
+ app.on('login', (authResult: any, { connection }: Params) => {
23
26
  // connection can be undefined if there is no
24
27
  // real-time connection, e.g. when logging in via REST
25
28
  if(connection) {
26
- // Obtain the logged in user
27
- // const user = authResult.user
28
-
29
29
  // The connection is no longer anonymous, remove it
30
30
  app.channel('anonymous').leave(connection)
31
31
 
32
32
  // Add it to the authenticated user channel
33
33
  app.channel('authenticated').join(connection)
34
-
35
- // Channels can be named anything and joined on any condition
36
-
37
- // E.g. to send real-time events only to admins use
38
- // if(user.isAdmin) { app.channel('admins').join(connection) }
39
-
40
- // If the user has joined e.g. chat rooms
41
- // if(Array.isArray(user.rooms)) user.rooms.forEach(room => app.channel(\`rooms/\${room.id}\`).join(connection))
42
-
43
- // Easily organize users by email and userid for things like messaging
44
- // app.channel(\`emails/\${user.email}\`).join(connection)
45
- // app.channel(\`userIds/\${user.id}\`).join(connection)
46
34
  }
47
35
  })
48
36
 
49
37
  // eslint-disable-next-line no-unused-vars
50
- app.publish((data: any, hook: HookContext) => {
38
+ app.publish((data: any, context: HookContext) => {
51
39
  // Here you can add event publishers to channels set up in \`channels.js\`
52
40
  // To publish only for a specific event use \`app.publish(eventname, () => {})\`
53
41
 
54
42
  // e.g. to publish all service events to all authenticated users use
55
43
  return app.channel('authenticated')
56
44
  })
57
-
58
- // Here you can also add service specific event publishers
59
- // e.g. the publish the \`users\` service \`created\` event to the \`admins\` channel
60
- // app.service('users').publish('created', () => app.channel('admins'))
61
-
62
- // With the userid and email organization from above you can easily select involved users
63
- // app.service('messages').publish(() => {
64
- // return [
65
- // app.channel(\`userIds/\${data.createdBy}\`),
66
- // app.channel(\`emails/\${data.recipientEmail}\`)
67
- // ]
68
- // })
69
45
  }
70
46
  `
71
47
 
@@ -0,0 +1,2 @@
1
+ import { AppGeneratorContext } from '../index';
2
+ export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -0,0 +1,27 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,26 @@
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')))
@@ -3,17 +3,31 @@ 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 = ({}) => /* ts */ `import { feathers } from '@feathersjs/feathers'
7
- import type { Paginated, ClientService, TransportConnection, Params } from '@feathersjs/feathers'
6
+ const template = ({ name, language }) => /* ts */ `import { feathers } from '@feathersjs/feathers'
7
+ import type { TransportConnection, Params } from '@feathersjs/feathers'
8
+ import authenticationClient from '@feathersjs/authentication-client'
9
+ import type { AuthenticationClientOptions } from '@feathersjs/authentication-client'
8
10
 
9
11
  export interface ServiceTypes {
10
12
  //
11
13
  }
12
14
 
13
- export const createClient = <Configuration = any> (connection: TransportConnection<ServiceTypes>) => {
15
+ /**
16
+ * Returns a ${language === 'ts' ? 'typed' : ''} client for the ${name} app.
17
+ *
18
+ * @param connection The REST or Socket.io Feathers client connection
19
+ * @param authenticationOptions Additional settings for the authentication client
20
+ * @see https://dove.feathersjs.com/api/client.html
21
+ * @returns The Feathers client application
22
+ */
23
+ export const createClient = <Configuration = any> (
24
+ connection: TransportConnection<ServiceTypes>,
25
+ authenticationOptions: Partial<AuthenticationClientOptions> = {}
26
+ ) => {
14
27
  const client = feathers<ServiceTypes, Configuration>()
15
28
 
16
29
  client.configure(connection)
30
+ client.configure(authenticationClient(authenticationOptions))
17
31
 
18
32
  return client
19
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;CActD,CAAA;AAEM,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAwB,EAAE,EAAE,CACzD,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,QAAQ,CAAC,CACxD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
1
+ {"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,IAAI,EACJ,QAAQ,EACY,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;eAUrB,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,mBAAmB,IAAI;;;;;;;;;;;;;;;;;;CAkBrE,CAAA;AAEM,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAwB,EAAE,EAAE,CACzD,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,QAAQ,CAAC,CACxD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -2,17 +2,34 @@ import { generator, toFile } from '@feathershq/pinion'
2
2
  import { renderSource } from '../../commons'
3
3
  import { AppGeneratorContext } from '../index'
4
4
 
5
- const template = ({}: AppGeneratorContext) => /* ts */ `import { feathers } from '@feathersjs/feathers'
6
- import type { Paginated, ClientService, TransportConnection, Params } from '@feathersjs/feathers'
5
+ const template = ({
6
+ name,
7
+ language
8
+ }: AppGeneratorContext) => /* ts */ `import { feathers } from '@feathersjs/feathers'
9
+ import type { TransportConnection, Params } from '@feathersjs/feathers'
10
+ import authenticationClient from '@feathersjs/authentication-client'
11
+ import type { AuthenticationClientOptions } from '@feathersjs/authentication-client'
7
12
 
8
13
  export interface ServiceTypes {
9
14
  //
10
15
  }
11
16
 
12
- export const createClient = <Configuration = any> (connection: TransportConnection<ServiceTypes>) => {
17
+ /**
18
+ * Returns a ${language === 'ts' ? 'typed' : ''} client for the ${name} app.
19
+ *
20
+ * @param connection The REST or Socket.io Feathers client connection
21
+ * @param authenticationOptions Additional settings for the authentication client
22
+ * @see https://dove.feathersjs.com/api/client.html
23
+ * @returns The Feathers client application
24
+ */
25
+ export const createClient = <Configuration = any> (
26
+ connection: TransportConnection<ServiceTypes>,
27
+ authenticationOptions: Partial<AuthenticationClientOptions> = {}
28
+ ) => {
13
29
  const client = feathers<ServiceTypes, Configuration>()
14
30
 
15
31
  client.configure(connection)
32
+ client.configure(authenticationClient(authenticationOptions))
16
33
 
17
34
  return client
18
35
  }
@@ -8,9 +8,12 @@ import { ApplicationConfiguration } from './schemas/configuration'
8
8
 
9
9
  export { NextFunction }
10
10
 
11
+ // The types for app.get(name) and app.set(name)
12
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
11
13
  export interface Configuration extends ApplicationConfiguration {}
12
14
 
13
15
  // A mapping of service names to types. Will be extended in service files.
16
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
14
17
  export interface ServiceTypes {}
15
18
 
16
19
  // The application instance type that will be used everywhere else
@@ -1 +1 @@
1
- {"version":3,"file":"declarations.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/declarations.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4E;AAG5E,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACW,EAAE,EAAE,CAAC,QAAQ,CAAC;kEAC8B,SAAS;;;;;;;;;;;;;;;CAe1E,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,aAAI,EACF,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,EACnC,IAAA,uBAAc,EACZ,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,CACjE,CACF,CACF,CAAA;AATU,QAAA,QAAQ,YASlB"}
1
+ {"version":3,"file":"declarations.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/declarations.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4E;AAG5E,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACW,EAAE,EAAE,CAAC,QAAQ,CAAC;kEAC8B,SAAS;;;;;;;;;;;;;;;;;;CAkB1E,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,aAAI,EACF,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,EACnC,IAAA,uBAAc,EACZ,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,CACjE,CACF,CACF,CAAA;AATU,QAAA,QAAQ,YASlB"}
@@ -9,9 +9,12 @@ import { ApplicationConfiguration } from './schemas/configuration'
9
9
 
10
10
  export { NextFunction }
11
11
 
12
+ // The types for app.get(name) and app.set(name)
13
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
12
14
  export interface Configuration extends ApplicationConfiguration {}
13
15
 
14
16
  // A mapping of service names to types. Will be extended in service files.
17
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
15
18
  export interface ServiceTypes {}
16
19
 
17
20
  // The application instance type that will be used everywhere else
@@ -22,8 +22,14 @@ export const logger = createLogger({
22
22
  export const logErrorHook = async (context: HookContext, next: NextFunction) => {
23
23
  try {
24
24
  await next()
25
- } catch (error) {
26
- logger.error(error)
25
+ } catch (error: any) {
26
+ logger.error(error.stack)
27
+
28
+ // Log validation errors
29
+ if (error.errors) {
30
+ logger.error(error.errors)
31
+ }
32
+
27
33
  throw error
28
34
  }
29
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"logger.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/logger.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GACZ,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAwBvC,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,QAAQ,CAAC,CACxD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
1
+ {"version":3,"file":"logger.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/logger.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GACZ,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BvC,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,QAAQ,CAAC,CACxD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -22,8 +22,14 @@ export const logger = createLogger({
22
22
  export const logErrorHook = async (context: HookContext, next: NextFunction) => {
23
23
  try {
24
24
  await next()
25
- } catch (error) {
26
- logger.error(error)
25
+ } catch (error: any) {
26
+ logger.error(error.stack)
27
+
28
+ // Log validation errors
29
+ if (error.errors) {
30
+ logger.error(error.errors)
31
+ }
32
+
27
33
  throw error
28
34
  }
29
35
  }
@@ -29,7 +29,7 @@ export const queryValidator = addFormats(new Ajv({
29
29
  coerceTypes: true
30
30
  }), formats)
31
31
  `;
32
- const configurationJsonTemplate = ({}) => /* ts */ `import { defaultAppSettings, jsonSchema } from '@feathersjs/schema'
32
+ const configurationJsonTemplate = ({}) => /* ts */ `import { defaultAppSettings, getValidator } from '@feathersjs/schema'
33
33
  import type { FromSchema } from '@feathersjs/schema'
34
34
 
35
35
  import { dataValidator } from './validators'
@@ -46,12 +46,11 @@ export const configurationSchema = {
46
46
  }
47
47
  } as const
48
48
 
49
- export const configurationValidator = jsonSchema.getValidator(configurationSchema, dataValidator)
49
+ export const configurationValidator = getValidator(configurationSchema, dataValidator)
50
50
 
51
51
  export type ApplicationConfiguration = FromSchema<typeof configurationSchema>
52
52
  `;
53
- const configurationTypeboxTemplate = ({}) => /* ts */ `import { jsonSchema } from '@feathersjs/schema'
54
- import { Type, defaultAppConfiguration } from '@feathersjs/typebox'
53
+ const configurationTypeboxTemplate = ({}) => /* ts */ `import { Type, getValidator, defaultAppConfiguration } from '@feathersjs/typebox'
55
54
  import type { Static } from '@feathersjs/typebox'
56
55
 
57
56
  import { dataValidator } from './validators'
@@ -67,7 +66,7 @@ export const configurationSchema = Type.Intersect([
67
66
 
68
67
  export type ApplicationConfiguration = Static<typeof configurationSchema>
69
68
 
70
- export const configurationValidator = jsonSchema.getValidator(configurationSchema, dataValidator)
69
+ export const configurationValidator = getValidator(configurationSchema, dataValidator)
71
70
  `;
72
71
  const generate = (ctx) => (0, pinion_1.generator)(ctx)
73
72
  .then((0, commons_1.renderSource)(async (ctx) => ctx.schema === 'typebox' ? configurationTypeboxTemplate(ctx) : configurationJsonTemplate(ctx), (0, pinion_1.toFile)(({ lib }) => lib, 'schemas', 'configuration')))
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/schemas.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,iBAAiB,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlC,CAAA;AAED,MAAM,yBAAyB,GAC7B,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;CAoBvC,CAAA;AAED,MAAM,4BAA4B,GAChC,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;CAkBvC,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CACH,IAAA,sBAAY,EACV,KAAK,EAAE,GAAG,EAAE,EAAE,CACZ,GAAG,CAAC,MAAM,KAAK,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