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

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 (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/app/index.js +1 -1
  3. package/lib/app/index.js.map +1 -1
  4. package/lib/app/index.ts +10 -1
  5. package/lib/app/templates/client.test.tpl.d.ts +2 -0
  6. package/lib/app/templates/client.test.tpl.js +27 -0
  7. package/lib/app/templates/client.test.tpl.js.map +1 -0
  8. package/lib/app/templates/client.test.tpl.ts +26 -0
  9. package/lib/app/templates/client.tpl.js +1 -1
  10. package/lib/app/templates/client.tpl.ts +1 -1
  11. package/lib/app/templates/logger.tpl.js +8 -2
  12. package/lib/app/templates/logger.tpl.js.map +1 -1
  13. package/lib/app/templates/logger.tpl.ts +8 -2
  14. package/lib/app/templates/schemas.tpl.js +4 -5
  15. package/lib/app/templates/schemas.tpl.js.map +1 -1
  16. package/lib/app/templates/schemas.tpl.ts +4 -5
  17. package/lib/authentication/index.d.ts +1 -0
  18. package/lib/authentication/templates/{test.tpl.d.ts → client.test.tpl.d.ts} +0 -0
  19. package/lib/authentication/templates/client.test.tpl.js +66 -0
  20. package/lib/authentication/templates/client.test.tpl.js.map +1 -0
  21. package/lib/authentication/templates/client.test.tpl.ts +80 -0
  22. package/lib/authentication/templates/client.tpl.d.ts +2 -0
  23. package/lib/authentication/templates/client.tpl.js +14 -0
  24. package/lib/authentication/templates/client.tpl.js.map +1 -0
  25. package/lib/authentication/templates/client.tpl.ts +19 -0
  26. package/lib/authentication/templates/declarations.tpl.js +1 -1
  27. package/lib/authentication/templates/declarations.tpl.ts +1 -1
  28. package/lib/authentication/templates/knex.tpl.js +3 -3
  29. package/lib/authentication/templates/knex.tpl.ts +3 -3
  30. package/lib/authentication/templates/schema.json.tpl.js +24 -24
  31. package/lib/authentication/templates/schema.json.tpl.js.map +1 -1
  32. package/lib/authentication/templates/schema.json.tpl.ts +24 -24
  33. package/lib/authentication/templates/schema.typebox.tpl.js +24 -26
  34. package/lib/authentication/templates/schema.typebox.tpl.js.map +1 -1
  35. package/lib/authentication/templates/schema.typebox.tpl.ts +26 -26
  36. package/lib/service/index.d.ts +5 -63
  37. package/lib/service/index.js +74 -75
  38. package/lib/service/index.js.map +1 -1
  39. package/lib/service/index.ts +10 -4
  40. package/lib/service/templates/client.tpl.js +14 -19
  41. package/lib/service/templates/client.tpl.js.map +1 -1
  42. package/lib/service/templates/client.tpl.ts +32 -21
  43. package/lib/service/templates/schema.json.tpl.js +24 -22
  44. package/lib/service/templates/schema.json.tpl.js.map +1 -1
  45. package/lib/service/templates/schema.json.tpl.ts +24 -22
  46. package/lib/service/templates/schema.typebox.tpl.js +22 -25
  47. package/lib/service/templates/schema.typebox.tpl.js.map +1 -1
  48. package/lib/service/templates/schema.typebox.tpl.ts +22 -25
  49. package/lib/service/type/knex.tpl.d.ts +1 -1
  50. package/lib/service/type/knex.tpl.js +10 -8
  51. package/lib/service/type/knex.tpl.js.map +1 -1
  52. package/lib/service/type/knex.tpl.ts +10 -9
  53. package/lib/service/type/mongodb.tpl.d.ts +1 -1
  54. package/lib/service/type/mongodb.tpl.js +7 -5
  55. package/lib/service/type/mongodb.tpl.js.map +1 -1
  56. package/lib/service/type/mongodb.tpl.ts +8 -6
  57. package/package.json +18 -16
  58. package/lib/authentication/templates/test.tpl.js +0 -43
  59. package/lib/authentication/templates/test.tpl.js.map +0 -1
  60. package/lib/authentication/templates/test.tpl.ts +0 -53
@@ -1 +1 @@
1
- {"version":3,"file":"mongodb.tpl.js","sourceRoot":"","sources":["../../../src/service/type/mongodb.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAGrC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,SAAS,EACT,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;oCAGJ,QAA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AC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,gBAAQ,EACR,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC7D,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,QAAQ;CACpB,CAAC,CACH,CACF,CAAA;AAXU,QAAA,QAAQ,YAWlB"}
@@ -5,12 +5,13 @@ import { ServiceGeneratorContext } from '../index'
5
5
  export const template = ({
6
6
  className,
7
7
  upperName,
8
- kebabName,
9
8
  schema,
10
9
  fileName,
10
+ kebabPath,
11
11
  relative
12
- }: ServiceGeneratorContext) => /* ts */ `import { MongoDBService } from \'@feathersjs/mongodb\'
13
- import type { MongoDBAdapterParams } from \'@feathersjs/mongodb\'
12
+ }: ServiceGeneratorContext) => /* ts */ `import type { Params } from '@feathersjs/feathers'
13
+ import { MongoDBService } from \'@feathersjs/mongodb\'
14
+ import type { MongoDBAdapterParams, MongoDBAdapterOptions } from \'@feathersjs/mongodb\'
14
15
 
15
16
  import type { Application } from '${relative}/declarations'
16
17
  ${
@@ -32,13 +33,14 @@ export interface ${upperName}Params extends MongoDBAdapterParams<${upperName}Que
32
33
  }
33
34
 
34
35
  // By default calls the standard MongoDB adapter service methods but can be customized with your own functionality.
35
- export class ${className} extends MongoDBService<${upperName}, ${upperName}Data, ${upperName}Params> {
36
+ export class ${className}<ServiceParams extends Params = ${upperName}Params>
37
+ extends MongoDBService<${upperName}, ${upperName}Data, ServiceParams> {
36
38
  }
37
39
 
38
- export const getOptions = (app: Application) => {
40
+ export const getOptions = (app: Application): MongoDBAdapterOptions => {
39
41
  return {
40
42
  paginate: app.get('paginate'),
41
- Model: app.get('mongodbClient').then(db => db.collection('${kebabName}'))
43
+ Model: app.get('mongodbClient').then(db => db.collection('${kebabPath}'))
42
44
  }
43
45
  }
44
46
  `
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@feathersjs/cli",
3
3
  "description": "The command line interface for creating Feathers applications",
4
- "version": "5.0.0-pre.30",
4
+ "version": "5.0.0-pre.31",
5
5
  "homepage": "https://feathersjs.com",
6
6
  "main": "lib/",
7
7
  "bin": {
@@ -58,20 +58,22 @@
58
58
  "prettier": "^2.7.1"
59
59
  },
60
60
  "devDependencies": {
61
- "@feathersjs/authentication": "^5.0.0-pre.30",
62
- "@feathersjs/authentication-local": "^5.0.0-pre.30",
63
- "@feathersjs/authentication-oauth": "^5.0.0-pre.30",
64
- "@feathersjs/configuration": "^5.0.0-pre.30",
65
- "@feathersjs/errors": "^5.0.0-pre.30",
66
- "@feathersjs/express": "^5.0.0-pre.30",
67
- "@feathersjs/feathers": "^5.0.0-pre.30",
68
- "@feathersjs/knex": "^5.0.0-pre.30",
69
- "@feathersjs/koa": "^5.0.0-pre.30",
70
- "@feathersjs/mongodb": "^5.0.0-pre.30",
71
- "@feathersjs/schema": "^5.0.0-pre.30",
72
- "@feathersjs/socketio": "^5.0.0-pre.30",
73
- "@feathersjs/transport-commons": "^5.0.0-pre.30",
74
- "@feathersjs/typebox": "^5.0.0-pre.30",
61
+ "@feathersjs/authentication": "^5.0.0-pre.31",
62
+ "@feathersjs/authentication-client": "^5.0.0-pre.31",
63
+ "@feathersjs/authentication-local": "^5.0.0-pre.31",
64
+ "@feathersjs/authentication-oauth": "^5.0.0-pre.31",
65
+ "@feathersjs/configuration": "^5.0.0-pre.31",
66
+ "@feathersjs/errors": "^5.0.0-pre.31",
67
+ "@feathersjs/express": "^5.0.0-pre.31",
68
+ "@feathersjs/feathers": "^5.0.0-pre.31",
69
+ "@feathersjs/knex": "^5.0.0-pre.31",
70
+ "@feathersjs/koa": "^5.0.0-pre.31",
71
+ "@feathersjs/mongodb": "^5.0.0-pre.31",
72
+ "@feathersjs/rest-client": "^5.0.0-pre.31",
73
+ "@feathersjs/schema": "^5.0.0-pre.31",
74
+ "@feathersjs/socketio": "^5.0.0-pre.31",
75
+ "@feathersjs/transport-commons": "^5.0.0-pre.31",
76
+ "@feathersjs/typebox": "^5.0.0-pre.31",
75
77
  "@types/mocha": "^10.0.0",
76
78
  "@types/node": "^18.8.2",
77
79
  "@types/prettier": "^2.7.1",
@@ -82,5 +84,5 @@
82
84
  "type-fest": "^3.0.0",
83
85
  "typescript": "^4.8.4"
84
86
  },
85
- "gitHead": "b535c91197f4b997520e0a0e608793eeba791931"
87
+ "gitHead": "4500dbeb8cea566678cf88b3313a88efd93a2ed9"
86
88
  }
@@ -1,43 +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 = ({ authStrategies, path, lib }) => /* ts */ `import assert from 'assert';
7
- import { app } from '../${lib}/app';
8
-
9
- describe('authentication', () => {
10
- ${authStrategies.includes('local')
11
- ? `
12
- const userInfo = {
13
- email: 'someone@example.com',
14
- password: 'supersecret'
15
- }
16
-
17
- before(async () => {
18
- try {
19
- await app.service('${path}').create(userInfo)
20
- } catch (error) {
21
- // Do nothing, it just means the user already exists and can be tested
22
- }
23
- });
24
-
25
- it('authenticates user and creates accessToken', async () => {
26
- const { user, accessToken } = await app.service('authentication').create({
27
- strategy: 'local',
28
- ...userInfo
29
- }, {})
30
-
31
- assert.ok(accessToken, 'Created access token for user')
32
- assert.ok(user, 'Includes user in authentication data')
33
- })`
34
- : ''}
35
-
36
- it('registered the authentication service', () => {
37
- assert.ok(app.service('authentication'))
38
- })
39
- })
40
- `;
41
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ test }) => test, 'authentication.test')));
42
- exports.generate = generate;
43
- //# sourceMappingURL=test.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,cAAc,EACd,IAAI,EACJ,GAAG,EAC4B,EAAE,EAAE,CAAC,QAAQ,CAAC;0BACrB,GAAG;;;IAIzB,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC9B,CAAC,CAAC;;;;;;;;2BAQmB,IAAI;;;;;;;;;;;;;;KAc1B;IACC,CAAC,CAAC,EACN;;;;;;CAMD,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAmC,EAAE,EAAE,CAC9D,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAiC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAClF,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -1,53 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AuthenticationGeneratorContext } from '../index'
4
-
5
- const template = ({
6
- authStrategies,
7
- path,
8
- lib
9
- }: AuthenticationGeneratorContext) => /* ts */ `import assert from 'assert';
10
- import { app } from '../${lib}/app';
11
-
12
- describe('authentication', () => {
13
- ${
14
- authStrategies.includes('local')
15
- ? `
16
- const userInfo = {
17
- email: 'someone@example.com',
18
- password: 'supersecret'
19
- }
20
-
21
- before(async () => {
22
- try {
23
- await app.service('${path}').create(userInfo)
24
- } catch (error) {
25
- // Do nothing, it just means the user already exists and can be tested
26
- }
27
- });
28
-
29
- it('authenticates user and creates accessToken', async () => {
30
- const { user, accessToken } = await app.service('authentication').create({
31
- strategy: 'local',
32
- ...userInfo
33
- }, {})
34
-
35
- assert.ok(accessToken, 'Created access token for user')
36
- assert.ok(user, 'Includes user in authentication data')
37
- })`
38
- : ''
39
- }
40
-
41
- it('registered the authentication service', () => {
42
- assert.ok(app.service('authentication'))
43
- })
44
- })
45
- `
46
-
47
- export const generate = (ctx: AuthenticationGeneratorContext) =>
48
- generator(ctx).then(
49
- renderSource(
50
- template,
51
- toFile<AuthenticationGeneratorContext>(({ test }) => test, 'authentication.test')
52
- )
53
- )