@feathersjs/cli 5.0.0-pre.31 → 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.
- package/CHANGELOG.md +13 -0
- package/lib/app/index.js +5 -5
- package/lib/app/index.js.map +1 -1
- package/lib/app/index.ts +5 -13
- package/lib/app/templates/app.tpl.js +7 -8
- package/lib/app/templates/app.tpl.js.map +1 -1
- package/lib/app/templates/app.tpl.ts +11 -8
- package/lib/app/templates/channels.tpl.js +4 -30
- package/lib/app/templates/channels.tpl.js.map +1 -1
- package/lib/app/templates/channels.tpl.ts +6 -30
- package/lib/app/templates/client.tpl.js +16 -2
- package/lib/app/templates/client.tpl.js.map +1 -1
- package/lib/app/templates/client.tpl.ts +19 -2
- package/lib/app/templates/declarations.tpl.js +3 -0
- package/lib/app/templates/declarations.tpl.js.map +1 -1
- package/lib/app/templates/declarations.tpl.ts +3 -0
- package/lib/authentication/index.d.ts +2 -0
- package/lib/authentication/index.js +5 -1
- package/lib/authentication/index.js.map +1 -1
- package/lib/authentication/index.ts +5 -0
- package/lib/authentication/templates/authentication.tpl.js +5 -4
- package/lib/authentication/templates/authentication.tpl.js.map +1 -1
- package/lib/authentication/templates/authentication.tpl.ts +5 -5
- package/lib/authentication/templates/client.test.tpl.js +5 -10
- package/lib/authentication/templates/client.test.tpl.js.map +1 -1
- package/lib/authentication/templates/client.test.tpl.ts +7 -14
- package/lib/authentication/templates/client.tpl.js +1 -1
- package/lib/authentication/templates/client.tpl.ts +1 -1
- package/lib/authentication/templates/schema.json.tpl.js +4 -3
- package/lib/authentication/templates/schema.json.tpl.js.map +1 -1
- package/lib/authentication/templates/schema.json.tpl.ts +4 -4
- package/lib/authentication/templates/schema.typebox.tpl.js +3 -2
- package/lib/authentication/templates/schema.typebox.tpl.js.map +1 -1
- package/lib/authentication/templates/schema.typebox.tpl.ts +3 -3
- package/lib/service/templates/client.tpl.js +6 -6
- package/lib/service/templates/client.tpl.js.map +1 -1
- package/lib/service/templates/client.tpl.ts +7 -14
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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
|
+
|
|
6
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)
|
|
7
20
|
|
|
8
21
|
### Features
|
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'
|
|
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,
|
|
139
|
-
devDependencies.push('nodemon', 'axios', 'mocha', 'cross-env', 'prettier', '@feathersjs/cli', '@feathersjs/rest-client'
|
|
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',
|
|
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));
|
package/lib/app/index.js.map
CHANGED
|
@@ -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;QACf,OAAO,EAAE,uCAAuC;QAChD,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,UAAG,CAAC,CAAC,GAAG,EAAE;QACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,IAAI,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;gBACjC,OAAO,wDAAwD,CAAA;aAChE;YAED,OAAO,IAAI,CAAA;QACb,CAAC;KACF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AClB,SAAS,EACT,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'
|
|
188
|
+
dependencies.push('@feathersjs/koa')
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
if (framework === 'express') {
|
|
@@ -203,7 +204,7 @@ export const generate = (ctx: AppGeneratorArguments) =>
|
|
|
203
204
|
)
|
|
204
205
|
.then(
|
|
205
206
|
install<AppGeneratorContext>(
|
|
206
|
-
({ language,
|
|
207
|
+
({ language, devDependencies, dependencyVersions }) => {
|
|
207
208
|
devDependencies.push(
|
|
208
209
|
'nodemon',
|
|
209
210
|
'axios',
|
|
@@ -211,20 +212,11 @@ export const generate = (ctx: AppGeneratorArguments) =>
|
|
|
211
212
|
'cross-env',
|
|
212
213
|
'prettier',
|
|
213
214
|
'@feathersjs/cli',
|
|
214
|
-
'@feathersjs/rest-client'
|
|
215
|
-
'@feathersjs/authentication-client'
|
|
215
|
+
'@feathersjs/rest-client'
|
|
216
216
|
)
|
|
217
217
|
|
|
218
218
|
if (language === 'ts') {
|
|
219
|
-
devDependencies.push(
|
|
220
|
-
'@types/mocha',
|
|
221
|
-
framework === 'koa' ? '@types/koa-static' : '@types/compression',
|
|
222
|
-
'@types/node',
|
|
223
|
-
'nodemon',
|
|
224
|
-
'ts-node',
|
|
225
|
-
'typescript',
|
|
226
|
-
'shx'
|
|
227
|
-
)
|
|
219
|
+
devDependencies.push('@types/mocha', '@types/node', 'nodemon', 'ts-node', 'typescript', 'shx')
|
|
228
220
|
}
|
|
229
221
|
|
|
230
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
|
|
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 {
|
|
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
|
|
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(
|
|
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"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,
|
|
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"}
|
|
@@ -2,10 +2,13 @@ import { generator, toFile } from '@feathershq/pinion'
|
|
|
2
2
|
import { renderSource } from '../../commons'
|
|
3
3
|
import { AppGeneratorContext } from '../index'
|
|
4
4
|
|
|
5
|
-
const tsKoaApp = ({
|
|
6
|
-
|
|
5
|
+
const tsKoaApp = ({
|
|
6
|
+
transports
|
|
7
|
+
}: AppGeneratorContext) => /* ts */ `import { feathers } from '@feathersjs/feathers'
|
|
7
8
|
import configuration from '@feathersjs/configuration'
|
|
8
|
-
import {
|
|
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 = ({
|
|
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(
|
|
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/
|
|
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 }:
|
|
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,
|
|
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,
|
|
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 = ({
|
|
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 }:
|
|
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,
|
|
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
|
|
|
@@ -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'
|
|
6
|
+
const template = ({ name, language }) => /* ts */ `import { feathers } from '@feathersjs/feathers'
|
|
7
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
|
-
|
|
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,
|
|
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 = ({
|
|
5
|
+
const template = ({
|
|
6
|
+
name,
|
|
7
|
+
language
|
|
8
|
+
}: AppGeneratorContext) => /* ts */ `import { feathers } from '@feathersjs/feathers'
|
|
6
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
|
-
|
|
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
|
|
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
|
|
@@ -7,6 +7,8 @@ export interface AuthenticationGeneratorContext extends ServiceGeneratorContext
|
|
|
7
7
|
dependencies: string[];
|
|
8
8
|
}
|
|
9
9
|
export declare type AuthenticationGeneratorArguments = FeathersBaseContext & Partial<Pick<AuthenticationGeneratorContext, 'service' | 'authStrategies' | 'entity' | 'path'>>;
|
|
10
|
+
export declare const localTemplate: (authStrategies: string[], content: string) => string;
|
|
11
|
+
export declare const oauthTemplate: (authStrategies: string[], content: string) => string;
|
|
10
12
|
export declare const prompts: (ctx: AuthenticationGeneratorArguments) => ({
|
|
11
13
|
type: string;
|
|
12
14
|
name: string;
|
|
@@ -3,11 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generate = exports.prompts = void 0;
|
|
6
|
+
exports.generate = exports.prompts = exports.oauthTemplate = exports.localTemplate = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const pinion_1 = require("@feathershq/pinion");
|
|
9
9
|
const commons_1 = require("../commons");
|
|
10
10
|
const index_1 = require("../service/index");
|
|
11
|
+
const localTemplate = (authStrategies, content) => authStrategies.includes('local') ? content : '';
|
|
12
|
+
exports.localTemplate = localTemplate;
|
|
13
|
+
const oauthTemplate = (authStrategies, content) => authStrategies.filter((s) => s !== 'local').length > 0 ? content : '';
|
|
14
|
+
exports.oauthTemplate = oauthTemplate;
|
|
11
15
|
const prompts = (ctx) => [
|
|
12
16
|
{
|
|
13
17
|
type: 'checkbox',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authentication/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,+CAA8E;AAC9E,wCAMmB;AACnB,4CAAwF;AAYjF,MAAM,OAAO,GAAG,CAAC,GAAqC,EAAE,EAAE,CAAC;IAChE;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,CAAC,GAAG,CAAC,cAAc;QACzB,OAAO,EAAE,kDAAkD;QAC3D,MAAM,EAAE,eAAK,CAAC,IAAI,CAAC,wDAAwD,CAAC;QAC5E,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,kBAAkB;gBACxB,KAAK,EAAE,OAAO;gBACd,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AG,CAAC,YAAY,EAAE,GAAG,YAAY,CAAC;SACrD,CAAA;KACF;IAED,OAAO,IAAA,gBAAO,EACZ,IAAA,qBAAW,EAAC,YAAY,EAAE,GAAG,CAAC,kBAAkB,CAAC,EACjD,KAAK,EACL,GAAG,CAAC,QAAQ,CAAC,QAAQ,CACtB,CAAC,GAAG,CAAC,CAAA;AACR,CAAC,CAAC,CAAA;AAxCO,QAAA,QAAQ,YAwCf"}
|
|
@@ -19,6 +19,11 @@ export interface AuthenticationGeneratorContext extends ServiceGeneratorContext
|
|
|
19
19
|
export type AuthenticationGeneratorArguments = FeathersBaseContext &
|
|
20
20
|
Partial<Pick<AuthenticationGeneratorContext, 'service' | 'authStrategies' | 'entity' | 'path'>>
|
|
21
21
|
|
|
22
|
+
export const localTemplate = (authStrategies: string[], content: string) =>
|
|
23
|
+
authStrategies.includes('local') ? content : ''
|
|
24
|
+
export const oauthTemplate = (authStrategies: string[], content: string) =>
|
|
25
|
+
authStrategies.filter((s) => s !== 'local').length > 0 ? content : ''
|
|
26
|
+
|
|
22
27
|
export const prompts = (ctx: AuthenticationGeneratorArguments) => [
|
|
23
28
|
{
|
|
24
29
|
type: 'checkbox',
|
|
@@ -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 index_1 = require("../index");
|
|
6
7
|
const template = ({ authStrategies }) => /* ts */ `import { AuthenticationService, JWTStrategy } from '@feathersjs/authentication'
|
|
7
|
-
import { LocalStrategy } from '@feathersjs/authentication-local'
|
|
8
|
-
import { OAuthStrategy } from '@feathersjs/authentication-oauth'
|
|
9
|
-
|
|
8
|
+
${(0, index_1.localTemplate)(authStrategies, `import { LocalStrategy } from '@feathersjs/authentication-local'`)}
|
|
9
|
+
${(0, index_1.oauthTemplate)(authStrategies, `import { oauth, OAuthStrategy } from '@feathersjs/authentication-oauth'`)}
|
|
10
|
+
|
|
10
11
|
import type { Application } from './declarations'
|
|
11
12
|
|
|
12
13
|
declare module './declarations' {
|
|
@@ -24,7 +25,7 @@ export const authentication = (app: Application) => {
|
|
|
24
25
|
.join('\n')}
|
|
25
26
|
|
|
26
27
|
app.use('authentication', authentication)
|
|
27
|
-
app.configure(oauth())
|
|
28
|
+
${(0, index_1.oauthTemplate)(authStrategies, `app.configure(oauth())`)}
|
|
28
29
|
}
|
|
29
30
|
`;
|
|
30
31
|
const importTemplate = "import { authentication } from './authentication'";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/authentication.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA8D;AAC9D,2CAA0D;
|
|
1
|
+
{"version":3,"file":"authentication.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/authentication.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA8D;AAC9D,2CAA0D;AAC1D,oCAAuF;AAEvF,MAAM,QAAQ,GAAG,CAAC,EAChB,cAAc,EACiB,EAAE,EAAE,CAAC,QAAQ,CAAC;EAC7C,IAAA,qBAAa,EAAC,cAAc,EAAE,kEAAkE,CAAC;EACjG,IAAA,qBAAa,EAAC,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,IAAA,qBAAa,EAAC,cAAc,EAAE,wBAAwB,CAAC;;CAE1D,CAAA;AAED,MAAM,cAAc,GAAG,mDAAmD,CAAA;AAC1E,MAAM,iBAAiB,GAAG,+BAA+B,CAAA;AACzD,MAAM,SAAS,GAAG,IAAA,eAAM,EAAiC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;AAE5E,MAAM,QAAQ,GAAG,CAAC,GAAmC,EAAE,EAAE,CAC9D,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CACH,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAiC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAC3E,CACF;KACA,IAAI,CAAC,IAAA,sBAAY,EAAC,cAAc,EAAE,IAAA,eAAM,EAAC,0BAA0B,CAAC,EAAE,SAAS,CAAC,CAAC;KACjF,IAAI,CAAC,IAAA,sBAAY,EAAC,iBAAiB,EAAE,IAAA,eAAM,EAAC,yBAAyB,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA;AAT3E,QAAA,QAAQ,YASmE"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { generator, before, toFile } from '@feathershq/pinion'
|
|
2
2
|
import { injectSource, renderSource } from '../../commons'
|
|
3
|
-
import { AuthenticationGeneratorContext } from '../index'
|
|
3
|
+
import { AuthenticationGeneratorContext, localTemplate, oauthTemplate } from '../index'
|
|
4
4
|
|
|
5
5
|
const template = ({
|
|
6
6
|
authStrategies
|
|
7
7
|
}: AuthenticationGeneratorContext) => /* ts */ `import { AuthenticationService, JWTStrategy } from '@feathersjs/authentication'
|
|
8
|
-
import { LocalStrategy } from '@feathersjs/authentication-local'
|
|
9
|
-
import { OAuthStrategy } from '@feathersjs/authentication-oauth'
|
|
10
|
-
|
|
8
|
+
${localTemplate(authStrategies, `import { LocalStrategy } from '@feathersjs/authentication-local'`)}
|
|
9
|
+
${oauthTemplate(authStrategies, `import { oauth, OAuthStrategy } from '@feathersjs/authentication-oauth'`)}
|
|
10
|
+
|
|
11
11
|
import type { Application } from './declarations'
|
|
12
12
|
|
|
13
13
|
declare module './declarations' {
|
|
@@ -30,7 +30,7 @@ export const authentication = (app: Application) => {
|
|
|
30
30
|
.join('\n')}
|
|
31
31
|
|
|
32
32
|
app.use('authentication', authentication)
|
|
33
|
-
app.configure(oauth())
|
|
33
|
+
${oauthTemplate(authStrategies, `app.configure(oauth())`)}
|
|
34
34
|
}
|
|
35
35
|
`
|
|
36
36
|
|
|
@@ -3,24 +3,21 @@ 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 index_1 = require("../index");
|
|
6
7
|
const template = ({ authStrategies, upperName, type, lib }) => /* ts */ `import assert from 'assert'
|
|
7
8
|
import axios from 'axios'
|
|
8
9
|
|
|
9
10
|
import rest from '@feathersjs/rest-client'
|
|
10
|
-
${
|
|
11
|
-
? `import authenticationClient from '@feathersjs/authentication-client'`
|
|
12
|
-
: ''}
|
|
11
|
+
${(0, index_1.localTemplate)(authStrategies, `import authenticationClient from '@feathersjs/authentication-client'`)}
|
|
13
12
|
import { app } from '../${lib}/app'
|
|
14
13
|
import { createClient } from '../${lib}/client'
|
|
15
|
-
${
|
|
14
|
+
${(0, index_1.localTemplate)(authStrategies, `import type { ${upperName}Data } from '../${lib}/client'`)}
|
|
16
15
|
|
|
17
16
|
const port = app.get('port')
|
|
18
17
|
const appUrl = \`http://\${app.get('host')}:\${port}\`
|
|
19
18
|
|
|
20
19
|
describe('application client tests', () => {
|
|
21
20
|
const client = createClient(rest(appUrl).axios(axios))
|
|
22
|
-
|
|
23
|
-
client.configure(authenticationClient())
|
|
24
21
|
|
|
25
22
|
before(async () => {
|
|
26
23
|
await app.listen(port)
|
|
@@ -34,8 +31,7 @@ describe('application client tests', () => {
|
|
|
34
31
|
assert.ok(client)
|
|
35
32
|
})
|
|
36
33
|
|
|
37
|
-
${
|
|
38
|
-
? `
|
|
34
|
+
${(0, index_1.localTemplate)(authStrategies, `
|
|
39
35
|
it('creates and authenticates a user with email and password', async () => {
|
|
40
36
|
const userData: ${upperName}Data = {
|
|
41
37
|
email: 'someone@example.com',
|
|
@@ -57,8 +53,7 @@ describe('application client tests', () => {
|
|
|
57
53
|
|
|
58
54
|
// Remove the test user on the server
|
|
59
55
|
await app.service('users').remove(user.${type === 'mongodb' ? '_id' : 'id'})
|
|
60
|
-
})`
|
|
61
|
-
: ''}
|
|
56
|
+
})`)}
|
|
62
57
|
})
|
|
63
58
|
`;
|
|
64
59
|
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ test }) => test, 'client.test'), { force: true }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.test.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/client.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;
|
|
1
|
+
{"version":3,"file":"client.test.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/client.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAC5C,oCAAwE;AAExE,MAAM,QAAQ,GAAG,CAAC,EAChB,cAAc,EACd,SAAS,EACT,IAAI,EACJ,GAAG,EAC4B,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;EAI7C,IAAA,qBAAa,EAAC,cAAc,EAAE,sEAAsE,CAAC;0BAC7E,GAAG;mCACM,GAAG;EACpC,IAAA,qBAAa,EAAC,cAAc,EAAE,iBAAiB,SAAS,mBAAmB,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;IAoBvF,IAAA,qBAAa,EACb,cAAc,EACd;;sBAEkB,SAAS;;;;;;;;;;;;;;;;;;;6CAmBc,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;KACzE,CACF;;CAEF,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,aAAa,CAAC,EACzE,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CACF,CAAA;AAPU,QAAA,QAAQ,YAOlB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generator, toFile } from '@feathershq/pinion'
|
|
2
2
|
import { renderSource } from '../../commons'
|
|
3
|
-
import { AuthenticationGeneratorContext } from '../index'
|
|
3
|
+
import { AuthenticationGeneratorContext, localTemplate } from '../index'
|
|
4
4
|
|
|
5
5
|
const template = ({
|
|
6
6
|
authStrategies,
|
|
@@ -11,22 +11,16 @@ const template = ({
|
|
|
11
11
|
import axios from 'axios'
|
|
12
12
|
|
|
13
13
|
import rest from '@feathersjs/rest-client'
|
|
14
|
-
${
|
|
15
|
-
authStrategies.includes('local')
|
|
16
|
-
? `import authenticationClient from '@feathersjs/authentication-client'`
|
|
17
|
-
: ''
|
|
18
|
-
}
|
|
14
|
+
${localTemplate(authStrategies, `import authenticationClient from '@feathersjs/authentication-client'`)}
|
|
19
15
|
import { app } from '../${lib}/app'
|
|
20
16
|
import { createClient } from '../${lib}/client'
|
|
21
|
-
${authStrategies
|
|
17
|
+
${localTemplate(authStrategies, `import type { ${upperName}Data } from '../${lib}/client'`)}
|
|
22
18
|
|
|
23
19
|
const port = app.get('port')
|
|
24
20
|
const appUrl = \`http://\${app.get('host')}:\${port}\`
|
|
25
21
|
|
|
26
22
|
describe('application client tests', () => {
|
|
27
23
|
const client = createClient(rest(appUrl).axios(axios))
|
|
28
|
-
|
|
29
|
-
client.configure(authenticationClient())
|
|
30
24
|
|
|
31
25
|
before(async () => {
|
|
32
26
|
await app.listen(port)
|
|
@@ -40,9 +34,9 @@ describe('application client tests', () => {
|
|
|
40
34
|
assert.ok(client)
|
|
41
35
|
})
|
|
42
36
|
|
|
43
|
-
${
|
|
44
|
-
authStrategies
|
|
45
|
-
|
|
37
|
+
${localTemplate(
|
|
38
|
+
authStrategies,
|
|
39
|
+
`
|
|
46
40
|
it('creates and authenticates a user with email and password', async () => {
|
|
47
41
|
const userData: ${upperName}Data = {
|
|
48
42
|
email: 'someone@example.com',
|
|
@@ -65,8 +59,7 @@ describe('application client tests', () => {
|
|
|
65
59
|
// Remove the test user on the server
|
|
66
60
|
await app.service('users').remove(user.${type === 'mongodb' ? '_id' : 'id'})
|
|
67
61
|
})`
|
|
68
|
-
|
|
69
|
-
}
|
|
62
|
+
)}
|
|
70
63
|
})
|
|
71
64
|
`
|
|
72
65
|
|
|
@@ -8,7 +8,7 @@ const importTemplate = /* ts */ `import type { AuthenticationService } from '@fe
|
|
|
8
8
|
const declarationTemplate = ` authentication: Pick<AuthenticationService, 'create' | 'remove'>`;
|
|
9
9
|
const toClientFile = (0, pinion_1.toFile)(({ lib }) => [lib, 'client']);
|
|
10
10
|
const generate = async (ctx) => (0, pinion_1.generator)(ctx)
|
|
11
|
-
.then((0, commons_1.injectSource)(importTemplate, (0, pinion_1.after)(
|
|
11
|
+
.then((0, commons_1.injectSource)(importTemplate, (0, pinion_1.after)('import authenticationClient'), toClientFile))
|
|
12
12
|
.then((0, pinion_1.when)(({ language }) => language === 'ts', (0, commons_1.injectSource)(declarationTemplate, (0, pinion_1.after)('export interface ServiceTypes'), toClientFile)));
|
|
13
13
|
exports.generate = generate;
|
|
14
14
|
//# sourceMappingURL=client.tpl.js.map
|
|
@@ -10,7 +10,7 @@ const toClientFile = toFile<ServiceGeneratorContext>(({ lib }) => [lib, 'client'
|
|
|
10
10
|
|
|
11
11
|
export const generate = async (ctx: ServiceGeneratorContext) =>
|
|
12
12
|
generator(ctx)
|
|
13
|
-
.then(injectSource(importTemplate, after(
|
|
13
|
+
.then(injectSource(importTemplate, after('import authenticationClient'), toClientFile))
|
|
14
14
|
.then(
|
|
15
15
|
when(
|
|
16
16
|
({ language }) => language === 'ts',
|
|
@@ -3,9 +3,10 @@ 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 index_1 = require("../index");
|
|
6
7
|
const template = ({ camelName, upperName, authStrategies, type, relative }) => /* ts */ `import { resolve, querySyntax, getValidator, getDataValidator } from '@feathersjs/schema'
|
|
7
8
|
import type { FromSchema } from '@feathersjs/schema'
|
|
8
|
-
${
|
|
9
|
+
${(0, index_1.localTemplate)(authStrategies, `import { passwordHash } from '@feathersjs/authentication-local'`)}
|
|
9
10
|
|
|
10
11
|
import type { HookContext } from '${relative}/declarations'
|
|
11
12
|
import { dataValidator, queryValidator } from '${relative}/schemas/validators'
|
|
@@ -15,7 +16,7 @@ export const ${camelName}Schema = {
|
|
|
15
16
|
$id: '${upperName}',
|
|
16
17
|
type: 'object',
|
|
17
18
|
additionalProperties: false,
|
|
18
|
-
required: [ '${type === 'mongodb' ? '_id' : 'id'}'${
|
|
19
|
+
required: [ '${type === 'mongodb' ? '_id' : 'id'}'${(0, index_1.localTemplate)(authStrategies, ", 'email'")} ],
|
|
19
20
|
properties: {
|
|
20
21
|
${type === 'mongodb' ? '_id' : 'id'}: {
|
|
21
22
|
type: '${type === 'mongodb' ? 'string' : 'number'}'
|
|
@@ -47,7 +48,7 @@ export type ${upperName}Data = FromSchema<typeof ${camelName}DataSchema>
|
|
|
47
48
|
export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
|
|
48
49
|
export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
|
|
49
50
|
properties: {
|
|
50
|
-
${
|
|
51
|
+
${(0, index_1.localTemplate)(authStrategies, `password: passwordHash({ strategy: 'local' })`)}
|
|
51
52
|
}
|
|
52
53
|
})
|
|
53
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.json.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/schema.json.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,2CAA4C;
|
|
1
|
+
{"version":3,"file":"schema.json.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/schema.json.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,2CAA4C;AAC5C,oCAAwE;AAExE,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACT,SAAS,EACT,cAAc,EACd,IAAI,EACJ,QAAQ,EACuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;EAE7C,IAAA,qBAAa,EAAC,cAAc,EAAE,iEAAiE,CAAC;;oCAE9D,QAAQ;iDACK,QAAQ;;;eAG1C,SAAS;UACd,SAAS;;;iBAGF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,IAAA,qBAAa,EAAC,cAAc,EAAE,WAAW,CAAC;;MAE1F,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;eACxB,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;;MAEjD,cAAc;KACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,KAAK,OAAO;IACd,CAAC,CAAC;iCACqB;IACvB,CAAC,CAAC,OAAO,IAAI,wBAAwB,CACxC;KACA,IAAI,CAAC,KAAK,CAAC;;;cAGJ,SAAS,wBAAwB,SAAS;eACzC,SAAS,sBAAsB,SAAS;;;;;eAKxC,SAAS;UACd,SAAS;;;;;SAKV,SAAS;;;cAGJ,SAAS,4BAA4B,SAAS;eAC7C,SAAS,oCAAoC,SAAS;eACtD,SAAS,0BAA0B,SAAS;;MAErD,IAAA,qBAAa,EAAC,cAAc,EAAE,+CAA+C,CAAC;;;;eAIrE,SAAS,8BAA8B,SAAS;;;;;;;;eAQhD,SAAS;UACd,SAAS;;;;qBAIE,SAAS;;;cAGhB,SAAS,6BAA6B,SAAS;eAC9C,SAAS,iCAAiC,SAAS;eACnD,SAAS,2BAA2B,SAAS;;;MAGtD,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;;qCAEF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;;;;;;;CAOrE,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAmC,EAAE,EAAE,CAC9D,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,aAAI,EACF,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,EACjC,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAkC,EAAE,EAAE,CAAC;IACpE,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,SAAS;CACrB,CAAC,EACF,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CACF,CACF,CAAA;AAfU,QAAA,QAAQ,YAelB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generator, toFile, when } from '@feathershq/pinion'
|
|
2
2
|
import { renderSource } from '../../commons'
|
|
3
|
-
import { AuthenticationGeneratorContext } from '../index'
|
|
3
|
+
import { AuthenticationGeneratorContext, localTemplate } from '../index'
|
|
4
4
|
|
|
5
5
|
const template = ({
|
|
6
6
|
camelName,
|
|
@@ -10,7 +10,7 @@ const template = ({
|
|
|
10
10
|
relative
|
|
11
11
|
}: AuthenticationGeneratorContext) => /* ts */ `import { resolve, querySyntax, getValidator, getDataValidator } from '@feathersjs/schema'
|
|
12
12
|
import type { FromSchema } from '@feathersjs/schema'
|
|
13
|
-
${authStrategies
|
|
13
|
+
${localTemplate(authStrategies, `import { passwordHash } from '@feathersjs/authentication-local'`)}
|
|
14
14
|
|
|
15
15
|
import type { HookContext } from '${relative}/declarations'
|
|
16
16
|
import { dataValidator, queryValidator } from '${relative}/schemas/validators'
|
|
@@ -20,7 +20,7 @@ export const ${camelName}Schema = {
|
|
|
20
20
|
$id: '${upperName}',
|
|
21
21
|
type: 'object',
|
|
22
22
|
additionalProperties: false,
|
|
23
|
-
required: [ '${type === 'mongodb' ? '_id' : 'id'}'${authStrategies
|
|
23
|
+
required: [ '${type === 'mongodb' ? '_id' : 'id'}'${localTemplate(authStrategies, ", 'email'")} ],
|
|
24
24
|
properties: {
|
|
25
25
|
${type === 'mongodb' ? '_id' : 'id'}: {
|
|
26
26
|
type: '${type === 'mongodb' ? 'string' : 'number'}'
|
|
@@ -54,7 +54,7 @@ export type ${upperName}Data = FromSchema<typeof ${camelName}DataSchema>
|
|
|
54
54
|
export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
|
|
55
55
|
export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
|
|
56
56
|
properties: {
|
|
57
|
-
${authStrategies
|
|
57
|
+
${localTemplate(authStrategies, `password: passwordHash({ strategy: 'local' })`)}
|
|
58
58
|
}
|
|
59
59
|
})
|
|
60
60
|
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generate = exports.template = void 0;
|
|
4
4
|
const pinion_1 = require("@feathershq/pinion");
|
|
5
5
|
const commons_1 = require("../../commons");
|
|
6
|
+
const index_1 = require("../index");
|
|
6
7
|
const template = ({ camelName, upperName, authStrategies, type, relative }) => /* ts */ `import { resolve } from '@feathersjs/schema'
|
|
7
8
|
import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/typebox'
|
|
8
9
|
import type { Static } from '@feathersjs/typebox'
|
|
9
|
-
${
|
|
10
|
+
${(0, index_1.localTemplate)(authStrategies, `import { passwordHash } from '@feathersjs/authentication-local'`)}
|
|
10
11
|
|
|
11
12
|
import type { HookContext } from '${relative}/declarations'
|
|
12
13
|
import { dataValidator, queryValidator } from '${relative}/schemas/validators'
|
|
@@ -43,7 +44,7 @@ export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
|
|
|
43
44
|
export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
|
|
44
45
|
export const ${camelName}DataResolver = resolve<${upperName}, HookContext>({
|
|
45
46
|
properties: {
|
|
46
|
-
${
|
|
47
|
+
${(0, index_1.localTemplate)(authStrategies, `password: passwordHash({ strategy: 'local' })`)}
|
|
47
48
|
}
|
|
48
49
|
})
|
|
49
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.typebox.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/schema.typebox.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,2CAA4C;
|
|
1
|
+
{"version":3,"file":"schema.typebox.tpl.js","sourceRoot":"","sources":["../../../src/authentication/templates/schema.typebox.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,2CAA4C;AAC5C,oCAAwE;AAEjE,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,SAAS,EACT,cAAc,EACd,IAAI,EACJ,QAAQ,EACuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;EAG7C,IAAA,qBAAa,EAAC,cAAc,EAAE,iEAAiE,CAAC;;oCAE9D,QAAQ;iDACK,QAAQ;;;eAG1C,SAAS;IACpB,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,mBAAmB;IAC/D,cAAc;KACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,KAAK,OAAO;IACd,CAAC,CAAC;yCAC+B;IACjC,CAAC,CAAC,OAAO,IAAI,kCAAkC,CAClD;KACA,IAAI,CAAC,KAAK,CAAC;YACJ,SAAS;cACP,SAAS,oBAAoB,SAAS;eACrC,SAAS,sBAAsB,SAAS;;;;eAIxC,SAAS,8BAA8B,SAAS;;;;;;;;eAQhD,SAAS,0BAA0B,SAAS;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AE,EAAE,CAAC;IACpE,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,SAAS;CACrB,CAAC,EACF,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CACF,CACF,CAAA;AAfU,QAAA,QAAQ,YAelB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generator, toFile, when } from '@feathershq/pinion'
|
|
2
2
|
import { renderSource } from '../../commons'
|
|
3
|
-
import { AuthenticationGeneratorContext } from '../index'
|
|
3
|
+
import { AuthenticationGeneratorContext, localTemplate } from '../index'
|
|
4
4
|
|
|
5
5
|
export const template = ({
|
|
6
6
|
camelName,
|
|
@@ -11,7 +11,7 @@ export const template = ({
|
|
|
11
11
|
}: AuthenticationGeneratorContext) => /* ts */ `import { resolve } from '@feathersjs/schema'
|
|
12
12
|
import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/typebox'
|
|
13
13
|
import type { Static } from '@feathersjs/typebox'
|
|
14
|
-
${authStrategies
|
|
14
|
+
${localTemplate(authStrategies, `import { passwordHash } from '@feathersjs/authentication-local'`)}
|
|
15
15
|
|
|
16
16
|
import type { HookContext } from '${relative}/declarations'
|
|
17
17
|
import { dataValidator, queryValidator } from '${relative}/schemas/validators'
|
|
@@ -50,7 +50,7 @@ export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
|
|
|
50
50
|
export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
|
|
51
51
|
export const ${camelName}DataResolver = resolve<${upperName}, HookContext>({
|
|
52
52
|
properties: {
|
|
53
|
-
${authStrategies
|
|
53
|
+
${localTemplate(authStrategies, `password: passwordHash({ strategy: 'local' })`)}
|
|
54
54
|
}
|
|
55
55
|
})
|
|
56
56
|
|
|
@@ -15,17 +15,17 @@ export type {
|
|
|
15
15
|
${upperName}Query
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
|
-
const methodsTemplate = ({ camelName, upperName, className, type }) => `
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const methodsTemplate = ({ camelName, upperName, className, type }) => `
|
|
19
|
+
const ${camelName}ServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove'] as const
|
|
20
|
+
type ${upperName}ClientService = Pick<${className}${type !== 'custom' ? `<Params<${upperName}Query>>` : ''}, typeof ${camelName}ServiceMethods[number]>`;
|
|
21
21
|
const declarationTemplate = ({ path, upperName }) => ` '${path}': ${upperName}ClientService`;
|
|
22
22
|
const registrationTemplate = ({ camelName, path }) => ` client.use('${path}', connection.service('${path}'), {
|
|
23
23
|
methods: ${camelName}ServiceMethods
|
|
24
24
|
})`;
|
|
25
25
|
const toClientFile = (0, pinion_1.toFile)(({ lib }) => [lib, 'client']);
|
|
26
26
|
const generate = async (ctx) => (0, pinion_1.generator)(ctx)
|
|
27
|
-
.then((0, commons_1.injectSource)(registrationTemplate, (0, pinion_1.before)('return client'),
|
|
28
|
-
.then((0, pinion_1.when)((ctx) => ctx.language === 'js', (0, commons_1.injectSource)(methodsTemplate, (0, pinion_1.
|
|
29
|
-
.then((0, pinion_1.when)((ctx) => ctx.language === 'ts', (0, commons_1.injectSource)(
|
|
27
|
+
.then((0, commons_1.injectSource)(registrationTemplate, (0, pinion_1.before)('return client'), toClientFile))
|
|
28
|
+
.then((0, pinion_1.when)((ctx) => ctx.language === 'js', (0, commons_1.injectSource)(methodsTemplate, (0, pinion_1.after)('import authenticationClient'), toClientFile)))
|
|
29
|
+
.then((0, pinion_1.when)((ctx) => ctx.language === 'ts', (0, commons_1.injectSource)(importTemplate, (0, pinion_1.after)('import authenticationClient'), toClientFile), (0, commons_1.injectSource)(methodsTemplate, (0, pinion_1.before)('\nexport interface ServiceTypes'), toClientFile), (0, commons_1.injectSource)(declarationTemplate, (0, pinion_1.after)('export interface ServiceTypes'), toClientFile)));
|
|
30
30
|
exports.generate = generate;
|
|
31
31
|
//# sourceMappingURL=client.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/client.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA2E;AAC3E,2CAA4C;AAG5C,MAAM,cAAc,GAAG,CAAC,EACtB,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACe,EAAE,EAAE,CAAC,QAAQ,CAAC;IACpC,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;qBACQ,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ;;IAE7C,SAAS;IACT,SAAS;IACT,SAAS;;CAEZ,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAA2B,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/client.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA2E;AAC3E,2CAA4C;AAG5C,MAAM,cAAc,GAAG,CAAC,EACtB,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACe,EAAE,EAAE,CAAC,QAAQ,CAAC;IACpC,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;qBACQ,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ;;IAE7C,SAAS;IACT,SAAS;IACT,SAAS;;CAEZ,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAA2B,EAAE,EAAE,CAAC;QACxF,SAAS;OACV,SAAS,wBAAwB,SAAS,GAC/C,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,SAAS,SAAS,CAAC,CAAC,CAAC,EACtD,YAAY,SAAS,yBAAyB,CAAA;AAE9C,MAAM,mBAAmB,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAA2B,EAAE,EAAE,CAC3E,MAAM,IAAI,MAAM,SAAS,eAAe,CAAA;AAE1C,MAAM,oBAAoB,GAAG,CAAC,EAC5B,SAAS,EACT,IAAI,EACoB,EAAE,EAAE,CAAC,iBAAiB,IAAI,0BAA0B,IAAI;aACrE,SAAS;GACnB,CAAA;AAEH,MAAM,YAAY,GAAG,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE3E,MAAM,QAAQ,GAAG,KAAK,EAAE,GAA4B,EAAE,EAAE,CAC7D,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CAAC,IAAA,sBAAY,EAAC,oBAAoB,EAAE,IAAA,eAAM,EAAC,eAAe,CAAC,EAAE,YAAY,CAAC,CAAC;KAC/E,IAAI,CACH,IAAA,aAAI,EACF,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,EAC9B,IAAA,sBAAY,EAAC,eAAe,EAAE,IAAA,cAAK,EAAC,6BAA6B,CAAC,EAAE,YAAY,CAAC,CAClF,CACF;KACA,IAAI,CACH,IAAA,aAAI,EACF,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,EAC9B,IAAA,sBAAY,EAAC,cAAc,EAAE,IAAA,cAAK,EAAC,6BAA6B,CAAC,EAAE,YAAY,CAAC,EAChF,IAAA,sBAAY,EAAC,eAAe,EAAE,IAAA,eAAM,EAAC,iCAAiC,CAAC,EAAE,YAAY,CAAC,EACtF,IAAA,sBAAY,EAAC,mBAAmB,EAAE,IAAA,cAAK,EAAC,+BAA+B,CAAC,EAAE,YAAY,CAAC,CACxF,CACF,CAAA;AAhBQ,QAAA,QAAQ,YAgBhB"}
|
|
@@ -20,12 +20,11 @@ export type {
|
|
|
20
20
|
}
|
|
21
21
|
`
|
|
22
22
|
|
|
23
|
-
const methodsTemplate = ({ camelName, upperName, className, type }: ServiceGeneratorContext) =>
|
|
24
|
-
|
|
23
|
+
const methodsTemplate = ({ camelName, upperName, className, type }: ServiceGeneratorContext) => `
|
|
24
|
+
const ${camelName}ServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove'] as const
|
|
25
25
|
type ${upperName}ClientService = Pick<${className}${
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
`
|
|
26
|
+
type !== 'custom' ? `<Params<${upperName}Query>>` : ''
|
|
27
|
+
}, typeof ${camelName}ServiceMethods[number]>`
|
|
29
28
|
|
|
30
29
|
const declarationTemplate = ({ path, upperName }: ServiceGeneratorContext) =>
|
|
31
30
|
` '${path}': ${upperName}ClientService`
|
|
@@ -41,24 +40,18 @@ const toClientFile = toFile<ServiceGeneratorContext>(({ lib }) => [lib, 'client'
|
|
|
41
40
|
|
|
42
41
|
export const generate = async (ctx: ServiceGeneratorContext) =>
|
|
43
42
|
generator(ctx)
|
|
44
|
-
.then(
|
|
45
|
-
injectSource(
|
|
46
|
-
registrationTemplate,
|
|
47
|
-
before('return client'),
|
|
48
|
-
toFile<ServiceGeneratorContext>(({ lib }) => [lib, 'client'])
|
|
49
|
-
)
|
|
50
|
-
)
|
|
43
|
+
.then(injectSource(registrationTemplate, before('return client'), toClientFile))
|
|
51
44
|
.then(
|
|
52
45
|
when(
|
|
53
46
|
(ctx) => ctx.language === 'js',
|
|
54
|
-
injectSource(methodsTemplate,
|
|
47
|
+
injectSource(methodsTemplate, after('import authenticationClient'), toClientFile)
|
|
55
48
|
)
|
|
56
49
|
)
|
|
57
50
|
.then(
|
|
58
51
|
when(
|
|
59
52
|
(ctx) => ctx.language === 'ts',
|
|
53
|
+
injectSource(importTemplate, after('import authenticationClient'), toClientFile),
|
|
60
54
|
injectSource(methodsTemplate, before('\nexport interface ServiceTypes'), toClientFile),
|
|
61
|
-
injectSource(importTemplate, after("from '@feathersjs/feathers'"), toClientFile),
|
|
62
55
|
injectSource(declarationTemplate, after('export interface ServiceTypes'), toClientFile)
|
|
63
56
|
)
|
|
64
57
|
)
|
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.
|
|
4
|
+
"version": "5.0.0-pre.32",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"bin": {
|
|
@@ -58,22 +58,22 @@
|
|
|
58
58
|
"prettier": "^2.7.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@feathersjs/authentication": "^5.0.0-pre.
|
|
62
|
-
"@feathersjs/authentication-client": "^5.0.0-pre.
|
|
63
|
-
"@feathersjs/authentication-local": "^5.0.0-pre.
|
|
64
|
-
"@feathersjs/authentication-oauth": "^5.0.0-pre.
|
|
65
|
-
"@feathersjs/configuration": "^5.0.0-pre.
|
|
66
|
-
"@feathersjs/errors": "^5.0.0-pre.
|
|
67
|
-
"@feathersjs/express": "^5.0.0-pre.
|
|
68
|
-
"@feathersjs/feathers": "^5.0.0-pre.
|
|
69
|
-
"@feathersjs/knex": "^5.0.0-pre.
|
|
70
|
-
"@feathersjs/koa": "^5.0.0-pre.
|
|
71
|
-
"@feathersjs/mongodb": "^5.0.0-pre.
|
|
72
|
-
"@feathersjs/rest-client": "^5.0.0-pre.
|
|
73
|
-
"@feathersjs/schema": "^5.0.0-pre.
|
|
74
|
-
"@feathersjs/socketio": "^5.0.0-pre.
|
|
75
|
-
"@feathersjs/transport-commons": "^5.0.0-pre.
|
|
76
|
-
"@feathersjs/typebox": "^5.0.0-pre.
|
|
61
|
+
"@feathersjs/authentication": "^5.0.0-pre.32",
|
|
62
|
+
"@feathersjs/authentication-client": "^5.0.0-pre.32",
|
|
63
|
+
"@feathersjs/authentication-local": "^5.0.0-pre.32",
|
|
64
|
+
"@feathersjs/authentication-oauth": "^5.0.0-pre.32",
|
|
65
|
+
"@feathersjs/configuration": "^5.0.0-pre.32",
|
|
66
|
+
"@feathersjs/errors": "^5.0.0-pre.32",
|
|
67
|
+
"@feathersjs/express": "^5.0.0-pre.32",
|
|
68
|
+
"@feathersjs/feathers": "^5.0.0-pre.32",
|
|
69
|
+
"@feathersjs/knex": "^5.0.0-pre.32",
|
|
70
|
+
"@feathersjs/koa": "^5.0.0-pre.32",
|
|
71
|
+
"@feathersjs/mongodb": "^5.0.0-pre.32",
|
|
72
|
+
"@feathersjs/rest-client": "^5.0.0-pre.32",
|
|
73
|
+
"@feathersjs/schema": "^5.0.0-pre.32",
|
|
74
|
+
"@feathersjs/socketio": "^5.0.0-pre.32",
|
|
75
|
+
"@feathersjs/transport-commons": "^5.0.0-pre.32",
|
|
76
|
+
"@feathersjs/typebox": "^5.0.0-pre.32",
|
|
77
77
|
"@types/mocha": "^10.0.0",
|
|
78
78
|
"@types/node": "^18.8.2",
|
|
79
79
|
"@types/prettier": "^2.7.1",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"type-fest": "^3.0.0",
|
|
85
85
|
"typescript": "^4.8.4"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "b405e205fc6d9fbd42b42c7a3f30ea4bf33d121d"
|
|
88
88
|
}
|