@feathersjs/generators 5.0.13 → 5.0.15

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 (158) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/lib/app/index.d.ts +19 -27
  3. package/lib/app/index.js +25 -30
  4. package/lib/app/index.js.map +1 -1
  5. package/lib/app/index.ts +17 -8
  6. package/lib/app/templates/app.test.tpl.d.ts +5 -2
  7. package/lib/app/templates/app.test.tpl.js +3 -7
  8. package/lib/app/templates/app.test.tpl.js.map +1 -1
  9. package/lib/app/templates/app.test.tpl.ts +4 -4
  10. package/lib/app/templates/app.tpl.d.ts +1 -1
  11. package/lib/app/templates/app.tpl.js +3 -7
  12. package/lib/app/templates/app.tpl.js.map +1 -1
  13. package/lib/app/templates/app.tpl.ts +4 -4
  14. package/lib/app/templates/channels.tpl.d.ts +1 -1
  15. package/lib/app/templates/channels.tpl.js +3 -7
  16. package/lib/app/templates/channels.tpl.js.map +1 -1
  17. package/lib/app/templates/channels.tpl.ts +4 -4
  18. package/lib/app/templates/client.test.tpl.d.ts +1 -1
  19. package/lib/app/templates/client.test.tpl.js +3 -7
  20. package/lib/app/templates/client.test.tpl.js.map +1 -1
  21. package/lib/app/templates/client.test.tpl.ts +4 -4
  22. package/lib/app/templates/client.tpl.d.ts +1 -1
  23. package/lib/app/templates/client.tpl.js +3 -7
  24. package/lib/app/templates/client.tpl.js.map +1 -1
  25. package/lib/app/templates/client.tpl.ts +4 -4
  26. package/lib/app/templates/configuration.tpl.d.ts +1 -1
  27. package/lib/app/templates/configuration.tpl.js +7 -11
  28. package/lib/app/templates/configuration.tpl.js.map +1 -1
  29. package/lib/app/templates/configuration.tpl.ts +4 -4
  30. package/lib/app/templates/declarations.tpl.d.ts +1 -1
  31. package/lib/app/templates/declarations.tpl.js +2 -6
  32. package/lib/app/templates/declarations.tpl.js.map +1 -1
  33. package/lib/app/templates/declarations.tpl.ts +3 -3
  34. package/lib/app/templates/index.html.tpl.d.ts +5 -2
  35. package/lib/app/templates/index.html.tpl.js +2 -6
  36. package/lib/app/templates/index.html.tpl.js.map +1 -1
  37. package/lib/app/templates/index.html.tpl.ts +3 -3
  38. package/lib/app/templates/index.tpl.d.ts +1 -1
  39. package/lib/app/templates/index.tpl.js +3 -7
  40. package/lib/app/templates/index.tpl.js.map +1 -1
  41. package/lib/app/templates/index.tpl.ts +4 -4
  42. package/lib/app/templates/logger.tpl.d.ts +1 -1
  43. package/lib/app/templates/logger.tpl.js +6 -10
  44. package/lib/app/templates/logger.tpl.js.map +1 -1
  45. package/lib/app/templates/logger.tpl.ts +4 -4
  46. package/lib/app/templates/package.json.tpl.d.ts +5 -2
  47. package/lib/app/templates/package.json.tpl.js +2 -6
  48. package/lib/app/templates/package.json.tpl.js.map +1 -1
  49. package/lib/app/templates/package.json.tpl.ts +3 -3
  50. package/lib/app/templates/prettierrc.tpl.d.ts +1 -1
  51. package/lib/app/templates/prettierrc.tpl.js +5 -9
  52. package/lib/app/templates/prettierrc.tpl.js.map +1 -1
  53. package/lib/app/templates/prettierrc.tpl.ts +4 -4
  54. package/lib/app/templates/readme.md.tpl.d.ts +5 -2
  55. package/lib/app/templates/readme.md.tpl.js +2 -6
  56. package/lib/app/templates/readme.md.tpl.js.map +1 -1
  57. package/lib/app/templates/readme.md.tpl.ts +3 -3
  58. package/lib/app/templates/services.tpl.d.ts +1 -1
  59. package/lib/app/templates/services.tpl.js +3 -7
  60. package/lib/app/templates/services.tpl.js.map +1 -1
  61. package/lib/app/templates/services.tpl.ts +4 -4
  62. package/lib/app/templates/tsconfig.json.tpl.d.ts +1 -1
  63. package/lib/app/templates/tsconfig.json.tpl.js +3 -7
  64. package/lib/app/templates/tsconfig.json.tpl.js.map +1 -1
  65. package/lib/app/templates/tsconfig.json.tpl.ts +3 -3
  66. package/lib/app/templates/validators.tpl.d.ts +1 -1
  67. package/lib/app/templates/validators.tpl.js +3 -7
  68. package/lib/app/templates/validators.tpl.js.map +1 -1
  69. package/lib/app/templates/validators.tpl.ts +4 -4
  70. package/lib/authentication/index.d.ts +10 -10
  71. package/lib/authentication/index.js +16 -19
  72. package/lib/authentication/index.js.map +1 -1
  73. package/lib/authentication/index.ts +65 -56
  74. package/lib/authentication/templates/authentication.tpl.d.ts +1 -1
  75. package/lib/authentication/templates/authentication.tpl.js +11 -15
  76. package/lib/authentication/templates/authentication.tpl.js.map +1 -1
  77. package/lib/authentication/templates/authentication.tpl.ts +5 -5
  78. package/lib/authentication/templates/client.test.tpl.d.ts +1 -1
  79. package/lib/authentication/templates/client.test.tpl.js +7 -11
  80. package/lib/authentication/templates/client.test.tpl.js.map +1 -1
  81. package/lib/authentication/templates/client.test.tpl.ts +5 -5
  82. package/lib/authentication/templates/config.tpl.d.ts +1 -1
  83. package/lib/authentication/templates/config.tpl.js +8 -15
  84. package/lib/authentication/templates/config.tpl.js.map +1 -1
  85. package/lib/authentication/templates/config.tpl.ts +3 -3
  86. package/lib/authentication/templates/declarations.tpl.d.ts +1 -1
  87. package/lib/authentication/templates/declarations.tpl.js +5 -9
  88. package/lib/authentication/templates/declarations.tpl.js.map +1 -1
  89. package/lib/authentication/templates/declarations.tpl.ts +3 -3
  90. package/lib/commons.d.ts +10 -2
  91. package/lib/commons.js +43 -76
  92. package/lib/commons.js.map +1 -1
  93. package/lib/commons.ts +22 -4
  94. package/lib/connection/index.d.ts +1 -1
  95. package/lib/connection/index.js +24 -30
  96. package/lib/connection/index.js.map +1 -1
  97. package/lib/connection/index.ts +10 -4
  98. package/lib/connection/templates/knex.tpl.d.ts +1 -1
  99. package/lib/connection/templates/knex.tpl.js +13 -20
  100. package/lib/connection/templates/knex.tpl.js.map +1 -1
  101. package/lib/connection/templates/knex.tpl.ts +4 -4
  102. package/lib/connection/templates/mongodb.tpl.d.ts +1 -1
  103. package/lib/connection/templates/mongodb.tpl.js +10 -14
  104. package/lib/connection/templates/mongodb.tpl.js.map +1 -1
  105. package/lib/connection/templates/mongodb.tpl.ts +4 -4
  106. package/lib/hook/index.d.ts +6 -6
  107. package/lib/hook/index.js +13 -17
  108. package/lib/hook/index.js.map +1 -1
  109. package/lib/hook/index.ts +7 -3
  110. package/lib/hook/templates/hook.tpl.d.ts +1 -1
  111. package/lib/hook/templates/hook.tpl.js +3 -7
  112. package/lib/hook/templates/hook.tpl.js.map +1 -1
  113. package/lib/hook/templates/hook.tpl.ts +4 -4
  114. package/lib/index.d.ts +7 -7
  115. package/lib/index.js +7 -36
  116. package/lib/index.js.map +1 -1
  117. package/lib/index.ts +7 -7
  118. package/lib/service/index.d.ts +1 -1
  119. package/lib/service/index.js +27 -31
  120. package/lib/service/index.js.map +1 -1
  121. package/lib/service/index.ts +94 -92
  122. package/lib/service/templates/client.tpl.d.ts +1 -1
  123. package/lib/service/templates/client.tpl.js +4 -8
  124. package/lib/service/templates/client.tpl.js.map +1 -1
  125. package/lib/service/templates/client.tpl.ts +4 -4
  126. package/lib/service/templates/schema.json.tpl.d.ts +1 -1
  127. package/lib/service/templates/schema.json.tpl.js +10 -14
  128. package/lib/service/templates/schema.json.tpl.js.map +1 -1
  129. package/lib/service/templates/schema.json.tpl.ts +4 -4
  130. package/lib/service/templates/schema.typebox.tpl.d.ts +1 -1
  131. package/lib/service/templates/schema.typebox.tpl.js +8 -12
  132. package/lib/service/templates/schema.typebox.tpl.js.map +1 -1
  133. package/lib/service/templates/schema.typebox.tpl.ts +4 -4
  134. package/lib/service/templates/service.tpl.d.ts +1 -1
  135. package/lib/service/templates/service.tpl.js +9 -14
  136. package/lib/service/templates/service.tpl.js.map +1 -1
  137. package/lib/service/templates/service.tpl.ts +4 -4
  138. package/lib/service/templates/shared.tpl.d.ts +1 -1
  139. package/lib/service/templates/shared.tpl.js +3 -7
  140. package/lib/service/templates/shared.tpl.js.map +1 -1
  141. package/lib/service/templates/shared.tpl.ts +4 -4
  142. package/lib/service/templates/test.tpl.d.ts +1 -1
  143. package/lib/service/templates/test.tpl.js +3 -7
  144. package/lib/service/templates/test.tpl.js.map +1 -1
  145. package/lib/service/templates/test.tpl.ts +4 -4
  146. package/lib/service/type/custom.tpl.d.ts +1 -1
  147. package/lib/service/type/custom.tpl.js +4 -9
  148. package/lib/service/type/custom.tpl.js.map +1 -1
  149. package/lib/service/type/custom.tpl.ts +4 -4
  150. package/lib/service/type/knex.tpl.d.ts +1 -1
  151. package/lib/service/type/knex.tpl.js +6 -11
  152. package/lib/service/type/knex.tpl.js.map +1 -1
  153. package/lib/service/type/knex.tpl.ts +4 -4
  154. package/lib/service/type/mongodb.tpl.d.ts +1 -1
  155. package/lib/service/type/mongodb.tpl.js +4 -9
  156. package/lib/service/type/mongodb.tpl.js.map +1 -1
  157. package/lib/service/type/mongodb.tpl.ts +4 -4
  158. package/package.json +31 -30
@@ -1,23 +1,20 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generate = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const pinion_1 = require("@feathershq/pinion");
9
- const commons_1 = require("../commons");
10
- const index_1 = require("../service/index");
11
- const generate = (ctx) => (0, pinion_1.generator)(ctx)
12
- .then((0, commons_1.initializeBaseContext)())
13
- .then((0, commons_1.checkPreconditions)())
14
- .then((0, pinion_1.prompt)((ctx) => [
1
+ import chalk from 'chalk';
2
+ import { dirname } from 'path';
3
+ import { runGenerators, prompt } from '@featherscloud/pinion';
4
+ import { addVersions, checkPreconditions, initializeBaseContext, install } from '../commons.js';
5
+ import { generate as serviceGenerator } from '../service/index.js';
6
+ // Set __dirname in es module
7
+ const __dirname = dirname(new URL(import.meta.url).pathname);
8
+ export const generate = (ctx) => Promise.resolve(ctx)
9
+ .then(initializeBaseContext())
10
+ .then(checkPreconditions())
11
+ .then(prompt((ctx) => [
15
12
  {
16
13
  type: 'checkbox',
17
14
  name: 'authStrategies',
18
15
  when: !ctx.authStrategies,
19
16
  message: 'Which authentication methods do you want to use?',
20
- suffix: chalk_1.default.grey(' Other methods and providers can be added at any time.'),
17
+ suffix: chalk.grey(' Other methods and providers can be added at any time.'),
21
18
  choices: [
22
19
  {
23
20
  name: 'Email + Password',
@@ -62,7 +59,7 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
62
59
  }
63
60
  ]))
64
61
  .then(async (ctx) => {
65
- const serviceContext = await (0, index_1.generate)({
62
+ const serviceContext = await serviceGenerator({
66
63
  ...ctx,
67
64
  name: ctx.service,
68
65
  isEntityService: true
@@ -73,7 +70,8 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
73
70
  ...serviceContext
74
71
  };
75
72
  })
76
- .then((0, pinion_1.runGenerators)(__dirname, 'templates'))
73
+ .then(runGenerators(__dirname, 'templates'))
74
+ .then((ctx) => ctx)
77
75
  .then((ctx) => {
78
76
  const dependencies = [];
79
77
  dependencies.push('@feathersjs/authentication-oauth');
@@ -86,7 +84,6 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
86
84
  dependencies: [...ctx.dependencies, ...dependencies]
87
85
  };
88
86
  }
89
- return (0, pinion_1.install)((0, commons_1.addVersions)(dependencies, ctx.dependencyVersions), false, ctx.feathers.packager)(ctx);
87
+ return install(addVersions(dependencies, ctx.dependencyVersions), false, ctx.feathers.packager)(ctx);
90
88
  });
91
- exports.generate = generate;
92
89
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authentication/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,+CAA8E;AAC9E,wCAAwG;AACxG,4CAAwF;AAYjF,MAAM,QAAQ,GAAG,CAAC,GAAqC,EAAE,EAAE,CAChE,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CAAC,IAAA,+BAAqB,GAAE,CAAC;KAC7B,IAAI,CAAC,IAAA,4BAAkB,GAAE,CAAC;KAC1B,IAAI,CACH,IAAA,eAAM,EACJ,CAAC,GAAq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AC5C,GAAG,GAAG;QACN,IAAI,EAAE,GAAG,CAAC,OAAO;QACjB,eAAe,EAAE,IAAI;KACtB,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,GAAG;QACN,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,GAAG,cAAc;KAClB,CAAA;AACH,CAAC,CAAC;KACD,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;KAC3C,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAqC,CAAC;KACpD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;IACZ,MAAM,YAAY,GAAa,EAAE,CAAA;IAEjC,YAAY,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAA;IAErD,IAAI,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,YAAY,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAA;IACvD,CAAC;IAED,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;QACrB,OAAO;YACL,GAAG,GAAG;YACN,YAAY,EAAE,CAAC,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,YAAY,CAAC;SACrD,CAAA;IACH,CAAC;IAED,OAAO,OAAO,CACZ,WAAW,CAAC,YAAY,EAAE,GAAG,CAAC,kBAAkB,CAAC,EACjD,KAAK,EACL,GAAG,CAAC,QAAQ,CAAC,QAAQ,CACtB,CAAC,GAAG,CAAC,CAAA;AACR,CAAC,CAAC,CAAA"}
@@ -1,7 +1,17 @@
1
1
  import chalk from 'chalk'
2
- import { generator, runGenerators, prompt, install } from '@feathershq/pinion'
3
- import { addVersions, checkPreconditions, FeathersBaseContext, initializeBaseContext } from '../commons'
4
- import { generate as serviceGenerator, ServiceGeneratorContext } from '../service/index'
2
+ import { dirname } from 'path'
3
+ import { runGenerators, prompt } from '@featherscloud/pinion'
4
+ import {
5
+ addVersions,
6
+ checkPreconditions,
7
+ FeathersBaseContext,
8
+ initializeBaseContext,
9
+ install
10
+ } from '../commons.js'
11
+ import { generate as serviceGenerator, ServiceGeneratorContext } from '../service/index.js'
12
+
13
+ // Set __dirname in es module
14
+ const __dirname = dirname(new URL(import.meta.url).pathname)
5
15
 
6
16
  export interface AuthenticationGeneratorContext extends ServiceGeneratorContext {
7
17
  service: string
@@ -14,62 +24,60 @@ export type AuthenticationGeneratorArguments = FeathersBaseContext &
14
24
  Partial<Pick<AuthenticationGeneratorContext, 'service' | 'authStrategies' | 'path' | 'schema' | 'type'>>
15
25
 
16
26
  export const generate = (ctx: AuthenticationGeneratorArguments) =>
17
- generator(ctx)
27
+ Promise.resolve(ctx)
18
28
  .then(initializeBaseContext())
19
29
  .then(checkPreconditions())
20
30
  .then(
21
- prompt<AuthenticationGeneratorArguments, AuthenticationGeneratorContext>(
22
- (ctx: AuthenticationGeneratorArguments) => [
23
- {
24
- type: 'checkbox',
25
- name: 'authStrategies',
26
- when: !ctx.authStrategies,
27
- message: 'Which authentication methods do you want to use?',
28
- suffix: chalk.grey(' Other methods and providers can be added at any time.'),
29
- choices: [
30
- {
31
- name: 'Email + Password',
32
- value: 'local',
33
- checked: true
34
- },
35
- {
36
- name: 'Google',
37
- value: 'google'
38
- },
39
- {
40
- name: 'Facebook',
41
- value: 'facebook'
42
- },
43
- {
44
- name: 'Twitter',
45
- value: 'twitter'
46
- },
47
- {
48
- name: 'GitHub',
49
- value: 'github'
50
- },
51
- {
52
- name: 'Auth0',
53
- value: 'auth0'
54
- }
55
- ]
56
- },
57
- {
58
- name: 'service',
59
- type: 'input',
60
- when: !ctx.service,
61
- message: 'What is your authentication service name?',
62
- default: 'user'
63
- },
64
- {
65
- name: 'path',
66
- type: 'input',
67
- when: !ctx.path,
68
- message: 'What path should the service be registered on?',
69
- default: 'users'
70
- }
71
- ]
72
- )
31
+ prompt((ctx: AuthenticationGeneratorArguments) => [
32
+ {
33
+ type: 'checkbox',
34
+ name: 'authStrategies',
35
+ when: !ctx.authStrategies,
36
+ message: 'Which authentication methods do you want to use?',
37
+ suffix: chalk.grey(' Other methods and providers can be added at any time.'),
38
+ choices: [
39
+ {
40
+ name: 'Email + Password',
41
+ value: 'local',
42
+ checked: true
43
+ },
44
+ {
45
+ name: 'Google',
46
+ value: 'google'
47
+ },
48
+ {
49
+ name: 'Facebook',
50
+ value: 'facebook'
51
+ },
52
+ {
53
+ name: 'Twitter',
54
+ value: 'twitter'
55
+ },
56
+ {
57
+ name: 'GitHub',
58
+ value: 'github'
59
+ },
60
+ {
61
+ name: 'Auth0',
62
+ value: 'auth0'
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ name: 'service',
68
+ type: 'input',
69
+ when: !ctx.service,
70
+ message: 'What is your authentication service name?',
71
+ default: 'user'
72
+ },
73
+ {
74
+ name: 'path',
75
+ type: 'input',
76
+ when: !ctx.path,
77
+ message: 'What path should the service be registered on?',
78
+ default: 'users'
79
+ }
80
+ ])
73
81
  )
74
82
  .then(async (ctx) => {
75
83
  const serviceContext = await serviceGenerator({
@@ -85,6 +93,7 @@ export const generate = (ctx: AuthenticationGeneratorArguments) =>
85
93
  }
86
94
  })
87
95
  .then(runGenerators(__dirname, 'templates'))
96
+ .then((ctx) => ctx as AuthenticationGeneratorContext)
88
97
  .then((ctx) => {
89
98
  const dependencies: string[] = []
90
99
 
@@ -1,2 +1,2 @@
1
- import { AuthenticationGeneratorContext } from '../index';
1
+ import { AuthenticationGeneratorContext } from '../index.js';
2
2
  export declare const generate: (ctx: AuthenticationGeneratorContext) => Promise<AuthenticationGeneratorContext>;
@@ -1,13 +1,10 @@
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 commons_2 = require("../../commons");
1
+ import { before, toFile } from '@featherscloud/pinion';
2
+ import { injectSource, renderSource } from '../../commons.js';
3
+ import { localTemplate, oauthTemplate } from '../../commons.js';
7
4
  const template = ({ authStrategies }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/authentication.html
8
5
  import { AuthenticationService, JWTStrategy } from '@feathersjs/authentication'
9
- ${(0, commons_2.localTemplate)(authStrategies, `import { LocalStrategy } from '@feathersjs/authentication-local'`)}
10
- ${(0, commons_2.oauthTemplate)(authStrategies, `import { oauth, OAuthStrategy } from '@feathersjs/authentication-oauth'`)}
6
+ ${localTemplate(authStrategies, `import { LocalStrategy } from '@feathersjs/authentication-local'`)}
7
+ ${oauthTemplate(authStrategies, `import { oauth, OAuthStrategy } from '@feathersjs/authentication-oauth'`)}
11
8
 
12
9
  import type { Application } from './declarations'
13
10
 
@@ -26,15 +23,14 @@ export const authentication = (app: Application) => {
26
23
  .join('\n')}
27
24
 
28
25
  app.use('authentication', authentication)
29
- ${(0, commons_2.oauthTemplate)(authStrategies, `app.configure(oauth())`)}
26
+ ${oauthTemplate(authStrategies, `app.configure(oauth())`)}
30
27
  }
31
28
  `;
32
29
  const importTemplate = "import { authentication } from './authentication'";
33
30
  const configureTemplate = 'app.configure(authentication)';
34
- const toAppFile = (0, pinion_1.toFile)(({ lib }) => [lib, 'app']);
35
- const generate = (ctx) => (0, pinion_1.generator)(ctx)
36
- .then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'authentication')))
37
- .then((0, commons_1.injectSource)(importTemplate, (0, pinion_1.before)('import { services } from'), toAppFile))
38
- .then((0, commons_1.injectSource)(configureTemplate, (0, pinion_1.before)('app.configure(services)'), toAppFile));
39
- exports.generate = generate;
31
+ const toAppFile = toFile(({ lib }) => [lib, 'app']);
32
+ export const generate = (ctx) => Promise.resolve(ctx)
33
+ .then(renderSource(template, toFile(({ lib }) => lib, 'authentication')))
34
+ .then(injectSource(importTemplate, before('import { services } from'), toAppFile))
35
+ .then(injectSource(configureTemplate, before('app.configure(services)'), toAppFile));
40
36
  //# sourceMappingURL=authentication.tpl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.tpl.js","sourceRoot":"","sources":["../../../src/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"}
1
+ {"version":3,"file":"authentication.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/authentication.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE7D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAE/D,MAAM,QAAQ,GAAG,CAAC,EAChB,cAAc,EACiB,EAAE,EAAE,CAAC,QAAQ,CAAC;;EAE7C,aAAa,CAAC,cAAc,EAAE,kEAAkE,CAAC;EACjG,aAAa,CAAC,cAAc,EAAE,yEAAyE,CAAC;;;;;;;;;;;;;;IActG,cAAc;KACb,GAAG,CACF,CAAC,QAAQ,EAAE,EAAE,CACX,8BAA8B,QAAQ,MACpC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBACjD,GAAG,CACN;KACA,IAAI,CAAC,IAAI,CAAC;;;IAGX,aAAa,CAAC,cAAc,EAAE,wBAAwB,CAAC;;CAE1D,CAAA;AAED,MAAM,cAAc,GAAG,mDAAmD,CAAA;AAC1E,MAAM,iBAAiB,GAAG,+BAA+B,CAAA;AACzD,MAAM,SAAS,GAAG,MAAM,CAAiC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;AAEnF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAmC,EAAE,EAAE,CAC9D,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;KACjB,IAAI,CACH,YAAY,CACV,QAAQ,EACR,MAAM,CAAiC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAC3E,CACF;KACA,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,0BAA0B,CAAC,EAAE,SAAS,CAAC,CAAC;KACjF,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,yBAAyB,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA"}
@@ -1,7 +1,7 @@
1
- import { generator, before, toFile } from '@feathershq/pinion'
2
- import { injectSource, renderSource } from '../../commons'
3
- import { AuthenticationGeneratorContext } from '../index'
4
- import { localTemplate, oauthTemplate } from '../../commons'
1
+ import { before, toFile } from '@featherscloud/pinion'
2
+ import { injectSource, renderSource } from '../../commons.js'
3
+ import { AuthenticationGeneratorContext } from '../index.js'
4
+ import { localTemplate, oauthTemplate } from '../../commons.js'
5
5
 
6
6
  const template = ({
7
7
  authStrategies
@@ -41,7 +41,7 @@ const configureTemplate = 'app.configure(authentication)'
41
41
  const toAppFile = toFile<AuthenticationGeneratorContext>(({ lib }) => [lib, 'app'])
42
42
 
43
43
  export const generate = (ctx: AuthenticationGeneratorContext) =>
44
- generator(ctx)
44
+ Promise.resolve(ctx)
45
45
  .then(
46
46
  renderSource(
47
47
  template,
@@ -1,2 +1,2 @@
1
- import { AuthenticationGeneratorContext } from '../index';
1
+ import { AuthenticationGeneratorContext } from '../index.js';
2
2
  export declare const generate: (ctx: AuthenticationGeneratorContext) => Promise<AuthenticationGeneratorContext>;
@@ -1,18 +1,15 @@
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 commons_2 = require("../../commons");
1
+ import { toFile, when } from '@featherscloud/pinion';
2
+ import { fileExists, renderSource } from '../../commons.js';
3
+ import { localTemplate } from '../../commons.js';
7
4
  const template = ({ authStrategies, upperName, type, lib }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/client.test.html
8
5
  import assert from 'assert'
9
6
  import axios from 'axios'
10
7
 
11
8
  import rest from '@feathersjs/rest-client'
12
- ${(0, commons_2.localTemplate)(authStrategies, `import authenticationClient from '@feathersjs/authentication-client'`)}
9
+ ${localTemplate(authStrategies, `import authenticationClient from '@feathersjs/authentication-client'`)}
13
10
  import { app } from '../${lib}/app'
14
11
  import { createClient } from '../${lib}/client'
15
- ${(0, commons_2.localTemplate)(authStrategies, `import type { ${upperName}Data } from '../${lib}/client'`)}
12
+ ${localTemplate(authStrategies, `import type { ${upperName}Data } from '../${lib}/client'`)}
16
13
 
17
14
  const port = app.get('port')
18
15
  const appUrl = \`http://\${app.get('host')}:\${port}\`
@@ -32,7 +29,7 @@ describe('application client tests', () => {
32
29
  assert.ok(client)
33
30
  })
34
31
 
35
- ${(0, commons_2.localTemplate)(authStrategies, `
32
+ ${localTemplate(authStrategies, `
36
33
  it('creates and authenticates a user with email and password', async () => {
37
34
  const userData: ${upperName}Data = {
38
35
  email: 'someone@example.com',
@@ -57,6 +54,5 @@ describe('application client tests', () => {
57
54
  })`)}
58
55
  })
59
56
  `;
60
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.when)(({ lib, language }) => (0, commons_1.fileExists)(lib, `client.${language}`), (0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ test }) => test, 'client.test'), { force: true })));
61
- exports.generate = generate;
57
+ export const generate = (ctx) => Promise.resolve(ctx).then(when(({ lib, language }) => fileExists(lib, `client.${language}`), renderSource(template, toFile(({ test }) => test, 'client.test'), { force: true })));
62
58
  //# sourceMappingURL=client.test.tpl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.test.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/client.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,2CAAwD;AAExD,2CAA6C;AAE7C,MAAM,QAAQ,GAAG,CAAC,EAChB,cAAc,EACd,SAAS,EACT,IAAI,EACJ,GAAG,EAC4B,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;EAK7C,IAAA,uBAAa,EAAC,cAAc,EAAE,sEAAsE,CAAC;0BAC7E,GAAG;mCACM,GAAG;EACpC,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AU,CAAC;;;;;;;;;;;;;;;;;;;;IAoBvF,aAAa,CACb,cAAc,EACd;;sBAEkB,SAAS;;;;;;;;;;;;;;;;;;;6CAmBc,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;KACzE,CACF;;CAEF,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAmC,EAAE,EAAE,CAC9D,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CACvB,IAAI,CACF,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,QAAQ,EAAE,CAAC,EAC5D,YAAY,CACV,QAAQ,EACR,MAAM,CAAiC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,EACzE,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CACF,CACF,CAAA"}
@@ -1,7 +1,7 @@
1
- import { generator, toFile, when } from '@feathershq/pinion'
2
- import { fileExists, renderSource } from '../../commons'
3
- import { AuthenticationGeneratorContext } from '../index'
4
- import { localTemplate } from '../../commons'
1
+ import { toFile, when } from '@featherscloud/pinion'
2
+ import { fileExists, renderSource } from '../../commons.js'
3
+ import { AuthenticationGeneratorContext } from '../index.js'
4
+ import { localTemplate } from '../../commons.js'
5
5
 
6
6
  const template = ({
7
7
  authStrategies,
@@ -66,7 +66,7 @@ describe('application client tests', () => {
66
66
  `
67
67
 
68
68
  export const generate = (ctx: AuthenticationGeneratorContext) =>
69
- generator(ctx).then(
69
+ Promise.resolve(ctx).then(
70
70
  when<AuthenticationGeneratorContext>(
71
71
  ({ lib, language }) => fileExists(lib, `client.${language}`),
72
72
  renderSource(
@@ -1,2 +1,2 @@
1
- import { AuthenticationGeneratorContext } from '../index';
1
+ import { AuthenticationGeneratorContext } from '../index.js';
2
2
  export declare const generate: (ctx: AuthenticationGeneratorContext) => Promise<AuthenticationGeneratorContext>;
@@ -1,17 +1,11 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generate = void 0;
7
- const crypto_1 = __importDefault(require("crypto"));
8
- const pinion_1 = require("@feathershq/pinion");
9
- const generate = (ctx) => (0, pinion_1.generator)(ctx)
10
- .then((0, pinion_1.mergeJSON)(({ authStrategies }) => {
1
+ import crypto from 'crypto';
2
+ import { toFile, mergeJSON } from '@featherscloud/pinion';
3
+ export const generate = (ctx) => Promise.resolve(ctx)
4
+ .then(mergeJSON(({ authStrategies }) => {
11
5
  const authentication = {
12
6
  entity: ctx.entity,
13
7
  service: ctx.path,
14
- secret: crypto_1.default.randomBytes(24).toString('base64'),
8
+ secret: crypto.randomBytes(24).toString('base64'),
15
9
  authStrategies: ['jwt'],
16
10
  jwtOptions: {
17
11
  header: {
@@ -40,11 +34,10 @@ const generate = (ctx) => (0, pinion_1.generator)(ctx)
40
34
  }, {});
41
35
  }
42
36
  return { authentication };
43
- }, (0, pinion_1.toFile)('config', 'default.json')))
44
- .then((0, pinion_1.mergeJSON)({
37
+ }, toFile('config', 'default.json')))
38
+ .then(mergeJSON({
45
39
  authentication: {
46
40
  secret: 'FEATHERS_SECRET'
47
41
  }
48
- }, (0, pinion_1.toFile)('config', 'custom-environment-variables.json')));
49
- exports.generate = generate;
42
+ }, toFile('config', 'custom-environment-variables.json')));
50
43
  //# sourceMappingURL=config.tpl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/config.tpl.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAC3B,+CAAiE;AAG1D,MAAM,QAAQ,GAAG,CAAC,GAAmC,EAAE,EAAE,CAC9D,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CACH,IAAA,kBAAS,EACP,CAAC,EAAE,c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,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC5D,KAAK,CAAC,IAAI,CAAC,GAAG;gBACZ,GAAG,EAAE,aAAa;gBAClB,MAAM,EAAE,iBAAiB;aAC1B,CAAA;YAED,OAAO,KAAK,CAAA;QACd,CAAC,EAAE,EAAS,CAAC,CAAA;IACf,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,CAAA;AAC3B,CAAC,EACD,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,CACjC,CACF;KACA,IAAI,CACH,SAAS,CACP;IACE,cAAc,EAAE;QACd,MAAM,EAAE,iBAAiB;KAC1B;CACF,EACD,MAAM,CAAC,QAAQ,EAAE,mCAAmC,CAAC,CACtD,CACF,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import crypto from 'crypto'
2
- import { generator, toFile, mergeJSON } from '@feathershq/pinion'
3
- import { AuthenticationGeneratorContext } from '../index'
2
+ import { toFile, mergeJSON } from '@featherscloud/pinion'
3
+ import { AuthenticationGeneratorContext } from '../index.js'
4
4
 
5
5
  export const generate = (ctx: AuthenticationGeneratorContext) =>
6
- generator(ctx)
6
+ Promise.resolve(ctx)
7
7
  .then(
8
8
  mergeJSON<AuthenticationGeneratorContext>(
9
9
  ({ authStrategies }) => {
@@ -1,2 +1,2 @@
1
- import { AuthenticationGeneratorContext } from '../index';
1
+ import { AuthenticationGeneratorContext } from '../index.js';
2
2
  export declare const generate: (ctx: AuthenticationGeneratorContext) => Promise<AuthenticationGeneratorContext>;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = void 0;
4
- const pinion_1 = require("@feathershq/pinion");
1
+ import { inject, before, toFile, when, append } from '@featherscloud/pinion';
5
2
  const importTemplate = ({ upperName, folder, fileName }) => /* ts */ `import { ${upperName} } from './services/${folder.join('/')}/${fileName}'
6
3
  `;
7
4
  const paramsTemplate = ({ entity, upperName }) => /* ts */ `// Add the ${entity} as an optional property to all params
@@ -11,9 +8,8 @@ declare module '@feathersjs/feathers' {
11
8
  }
12
9
  }
13
10
  `;
14
- const toDeclarationFile = (0, pinion_1.toFile)(({ lib }) => lib, 'declarations.ts');
15
- const generate = (ctx) => (0, pinion_1.generator)(ctx)
16
- .then((0, pinion_1.when)((ctx) => ctx.language === 'ts', (0, pinion_1.inject)(importTemplate, (0, pinion_1.before)(/export \{ NextFunction \}|export type \{ NextFunction \}/), toDeclarationFile)))
17
- .then((0, pinion_1.when)((ctx) => ctx.language === 'ts', (0, pinion_1.inject)(paramsTemplate, (0, pinion_1.append)(), toDeclarationFile)));
18
- exports.generate = generate;
11
+ const toDeclarationFile = toFile(({ lib }) => lib, 'declarations.ts');
12
+ export const generate = (ctx) => Promise.resolve(ctx)
13
+ .then(when((ctx) => ctx.language === 'ts', inject(importTemplate, before(/export \{ NextFunction \}|export type \{ NextFunction \}/), toDeclarationFile)))
14
+ .then(when((ctx) => ctx.language === 'ts', inject(paramsTemplate, append(), toDeclarationFile)));
19
15
  //# sourceMappingURL=declarations.tpl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"declarations.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/declarations.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAoF;AAGpF,MAAM,cAAc,GAAG,CAAC,EACtB,SAAS,EACT,MAAM,EACN,QAAQ,EACuB,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,SAAS,uBAAuB,MAAM,CAAC,IAAI,CACpG,GAAG,CACJ,IAAI,QAAQ;CACZ,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,EACtB,MAAM,EACN,SAAS,EACsB,EAAE,EAAE,CAAC,QAAQ,CAAC,cAAc,MAAM;;;MAG7D,MAAM,MAAM,SAAS;;;CAG1B,CAAA;AAED,MAAM,iBAAiB,GAAG,IAAA,eAAM,EAAiC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAA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GAAG,CAAC;KACjB,IAAI,CACH,IAAI,CACF,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,EAC9B,MAAM,CACJ,cAAc,EACd,MAAM,CAAC,0DAA0D,CAAC,EAClE,iBAAiB,CAClB,CACF,CACF;KACA,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
- import { generator, inject, before, toFile, when, append } from '@feathershq/pinion'
2
- import { AuthenticationGeneratorContext } from '../index'
1
+ import { inject, before, toFile, when, append } from '@featherscloud/pinion'
2
+ import { AuthenticationGeneratorContext } from '../index.js'
3
3
 
4
4
  const importTemplate = ({
5
5
  upperName,
@@ -24,7 +24,7 @@ declare module '@feathersjs/feathers' {
24
24
  const toDeclarationFile = toFile<AuthenticationGeneratorContext>(({ lib }) => lib, 'declarations.ts')
25
25
 
26
26
  export const generate = (ctx: AuthenticationGeneratorContext) =>
27
- generator(ctx)
27
+ Promise.resolve(ctx)
28
28
  .then(
29
29
  when(
30
30
  (ctx) => ctx.language === 'ts',
package/lib/commons.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PackageJson } from 'type-fest';
2
- import { Callable, PinionContext, Location } from '@feathershq/pinion';
3
- import * as ts from 'typescript';
2
+ import { Callable, PinionContext, Location } from '@featherscloud/pinion';
3
+ import ts from 'typescript';
4
4
  import { Options as PrettierOptions } from 'prettier';
5
5
  export declare const version: any;
6
6
  export type DependencyVersions = {
@@ -90,10 +90,15 @@ export declare const addVersions: (dependencies: string[], versions: DependencyV
90
90
  * @returns The updated context
91
91
  */
92
92
  export declare const initializeBaseContext: () => <C extends FeathersBaseContext>(ctx: C) => Promise<Awaited<C> & {
93
+ pkg: import("@featherscloud/pinion").JSONData;
94
+ } & {
93
95
  lib: string;
94
96
  test: string;
95
97
  language: "ts" | "js";
96
98
  feathers: FeathersAppInfo;
99
+ dependencyVersions: {
100
+ '@feathersjs/cli': any;
101
+ };
97
102
  }>;
98
103
  /**
99
104
  * Checks if the current context contains a valid generated application. This is necesary for most
@@ -130,6 +135,9 @@ export declare const renderSource: <C extends PinionContext & {
130
135
  }>(template: Callable<string, C>, target: Callable<string, C>, options?: {
131
136
  force: boolean;
132
137
  }) => (ctx: C) => Promise<C>;
138
+ export declare const install: <C extends PinionContext & {
139
+ language: 'js' | 'ts';
140
+ }>(dependencies: Callable<string[], C>, dev: Callable<boolean, C>, packager: Callable<string, C>) => (ctx: C) => Promise<C>;
133
141
  /**
134
142
  * Inject a source template as the language set in the context.
135
143
  *