@feathersjs/generators 5.0.14 → 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.
- package/CHANGELOG.md +6 -0
- package/lib/app/index.d.ts +19 -27
- package/lib/app/index.js +25 -30
- package/lib/app/index.js.map +1 -1
- package/lib/app/index.ts +17 -8
- package/lib/app/templates/app.test.tpl.d.ts +5 -2
- package/lib/app/templates/app.test.tpl.js +3 -7
- package/lib/app/templates/app.test.tpl.js.map +1 -1
- package/lib/app/templates/app.test.tpl.ts +4 -4
- package/lib/app/templates/app.tpl.d.ts +1 -1
- package/lib/app/templates/app.tpl.js +3 -7
- package/lib/app/templates/app.tpl.js.map +1 -1
- package/lib/app/templates/app.tpl.ts +4 -4
- package/lib/app/templates/channels.tpl.d.ts +1 -1
- package/lib/app/templates/channels.tpl.js +3 -7
- package/lib/app/templates/channels.tpl.js.map +1 -1
- package/lib/app/templates/channels.tpl.ts +4 -4
- package/lib/app/templates/client.test.tpl.d.ts +1 -1
- package/lib/app/templates/client.test.tpl.js +3 -7
- package/lib/app/templates/client.test.tpl.js.map +1 -1
- package/lib/app/templates/client.test.tpl.ts +4 -4
- package/lib/app/templates/client.tpl.d.ts +1 -1
- package/lib/app/templates/client.tpl.js +3 -7
- package/lib/app/templates/client.tpl.js.map +1 -1
- package/lib/app/templates/client.tpl.ts +4 -4
- package/lib/app/templates/configuration.tpl.d.ts +1 -1
- package/lib/app/templates/configuration.tpl.js +7 -11
- package/lib/app/templates/configuration.tpl.js.map +1 -1
- package/lib/app/templates/configuration.tpl.ts +4 -4
- package/lib/app/templates/declarations.tpl.d.ts +1 -1
- package/lib/app/templates/declarations.tpl.js +2 -6
- package/lib/app/templates/declarations.tpl.js.map +1 -1
- package/lib/app/templates/declarations.tpl.ts +3 -3
- package/lib/app/templates/index.html.tpl.d.ts +5 -2
- package/lib/app/templates/index.html.tpl.js +2 -6
- package/lib/app/templates/index.html.tpl.js.map +1 -1
- package/lib/app/templates/index.html.tpl.ts +3 -3
- package/lib/app/templates/index.tpl.d.ts +1 -1
- package/lib/app/templates/index.tpl.js +3 -7
- package/lib/app/templates/index.tpl.js.map +1 -1
- package/lib/app/templates/index.tpl.ts +4 -4
- package/lib/app/templates/logger.tpl.d.ts +1 -1
- package/lib/app/templates/logger.tpl.js +6 -10
- package/lib/app/templates/logger.tpl.js.map +1 -1
- package/lib/app/templates/logger.tpl.ts +4 -4
- package/lib/app/templates/package.json.tpl.d.ts +5 -2
- package/lib/app/templates/package.json.tpl.js +2 -6
- package/lib/app/templates/package.json.tpl.js.map +1 -1
- package/lib/app/templates/package.json.tpl.ts +3 -3
- package/lib/app/templates/prettierrc.tpl.d.ts +1 -1
- package/lib/app/templates/prettierrc.tpl.js +5 -9
- package/lib/app/templates/prettierrc.tpl.js.map +1 -1
- package/lib/app/templates/prettierrc.tpl.ts +4 -4
- package/lib/app/templates/readme.md.tpl.d.ts +5 -2
- package/lib/app/templates/readme.md.tpl.js +2 -6
- package/lib/app/templates/readme.md.tpl.js.map +1 -1
- package/lib/app/templates/readme.md.tpl.ts +3 -3
- package/lib/app/templates/services.tpl.d.ts +1 -1
- package/lib/app/templates/services.tpl.js +3 -7
- package/lib/app/templates/services.tpl.js.map +1 -1
- package/lib/app/templates/services.tpl.ts +4 -4
- package/lib/app/templates/tsconfig.json.tpl.d.ts +1 -1
- package/lib/app/templates/tsconfig.json.tpl.js +3 -7
- package/lib/app/templates/tsconfig.json.tpl.js.map +1 -1
- package/lib/app/templates/tsconfig.json.tpl.ts +3 -3
- package/lib/app/templates/validators.tpl.d.ts +1 -1
- package/lib/app/templates/validators.tpl.js +3 -7
- package/lib/app/templates/validators.tpl.js.map +1 -1
- package/lib/app/templates/validators.tpl.ts +4 -4
- package/lib/authentication/index.d.ts +10 -10
- package/lib/authentication/index.js +16 -19
- package/lib/authentication/index.js.map +1 -1
- package/lib/authentication/index.ts +65 -56
- package/lib/authentication/templates/authentication.tpl.d.ts +1 -1
- package/lib/authentication/templates/authentication.tpl.js +11 -15
- 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.d.ts +1 -1
- package/lib/authentication/templates/client.test.tpl.js +7 -11
- package/lib/authentication/templates/client.test.tpl.js.map +1 -1
- package/lib/authentication/templates/client.test.tpl.ts +5 -5
- package/lib/authentication/templates/config.tpl.d.ts +1 -1
- package/lib/authentication/templates/config.tpl.js +8 -15
- package/lib/authentication/templates/config.tpl.js.map +1 -1
- package/lib/authentication/templates/config.tpl.ts +3 -3
- package/lib/authentication/templates/declarations.tpl.d.ts +1 -1
- package/lib/authentication/templates/declarations.tpl.js +5 -9
- package/lib/authentication/templates/declarations.tpl.js.map +1 -1
- package/lib/authentication/templates/declarations.tpl.ts +3 -3
- package/lib/commons.d.ts +10 -2
- package/lib/commons.js +43 -76
- package/lib/commons.js.map +1 -1
- package/lib/commons.ts +22 -4
- package/lib/connection/index.d.ts +1 -1
- package/lib/connection/index.js +24 -30
- package/lib/connection/index.js.map +1 -1
- package/lib/connection/index.ts +10 -4
- package/lib/connection/templates/knex.tpl.d.ts +1 -1
- package/lib/connection/templates/knex.tpl.js +13 -20
- package/lib/connection/templates/knex.tpl.js.map +1 -1
- package/lib/connection/templates/knex.tpl.ts +4 -4
- package/lib/connection/templates/mongodb.tpl.d.ts +1 -1
- package/lib/connection/templates/mongodb.tpl.js +10 -14
- package/lib/connection/templates/mongodb.tpl.js.map +1 -1
- package/lib/connection/templates/mongodb.tpl.ts +4 -4
- package/lib/hook/index.d.ts +6 -6
- package/lib/hook/index.js +13 -17
- package/lib/hook/index.js.map +1 -1
- package/lib/hook/index.ts +7 -3
- package/lib/hook/templates/hook.tpl.d.ts +1 -1
- package/lib/hook/templates/hook.tpl.js +3 -7
- package/lib/hook/templates/hook.tpl.js.map +1 -1
- package/lib/hook/templates/hook.tpl.ts +4 -4
- package/lib/index.d.ts +7 -7
- package/lib/index.js +7 -36
- package/lib/index.js.map +1 -1
- package/lib/index.ts +7 -7
- package/lib/service/index.d.ts +1 -1
- package/lib/service/index.js +27 -31
- package/lib/service/index.js.map +1 -1
- package/lib/service/index.ts +94 -92
- package/lib/service/templates/client.tpl.d.ts +1 -1
- package/lib/service/templates/client.tpl.js +4 -8
- package/lib/service/templates/client.tpl.js.map +1 -1
- package/lib/service/templates/client.tpl.ts +4 -4
- package/lib/service/templates/schema.json.tpl.d.ts +1 -1
- package/lib/service/templates/schema.json.tpl.js +10 -14
- package/lib/service/templates/schema.json.tpl.js.map +1 -1
- package/lib/service/templates/schema.json.tpl.ts +4 -4
- package/lib/service/templates/schema.typebox.tpl.d.ts +1 -1
- package/lib/service/templates/schema.typebox.tpl.js +8 -12
- package/lib/service/templates/schema.typebox.tpl.js.map +1 -1
- package/lib/service/templates/schema.typebox.tpl.ts +4 -4
- package/lib/service/templates/service.tpl.d.ts +1 -1
- package/lib/service/templates/service.tpl.js +9 -14
- package/lib/service/templates/service.tpl.js.map +1 -1
- package/lib/service/templates/service.tpl.ts +4 -4
- package/lib/service/templates/shared.tpl.d.ts +1 -1
- package/lib/service/templates/shared.tpl.js +3 -7
- package/lib/service/templates/shared.tpl.js.map +1 -1
- package/lib/service/templates/shared.tpl.ts +4 -4
- package/lib/service/templates/test.tpl.d.ts +1 -1
- package/lib/service/templates/test.tpl.js +3 -7
- package/lib/service/templates/test.tpl.js.map +1 -1
- package/lib/service/templates/test.tpl.ts +4 -4
- package/lib/service/type/custom.tpl.d.ts +1 -1
- package/lib/service/type/custom.tpl.js +4 -9
- package/lib/service/type/custom.tpl.js.map +1 -1
- package/lib/service/type/custom.tpl.ts +4 -4
- package/lib/service/type/knex.tpl.d.ts +1 -1
- package/lib/service/type/knex.tpl.js +6 -11
- package/lib/service/type/knex.tpl.js.map +1 -1
- package/lib/service/type/knex.tpl.ts +4 -4
- package/lib/service/type/mongodb.tpl.d.ts +1 -1
- package/lib/service/type/mongodb.tpl.js +4 -9
- package/lib/service/type/mongodb.tpl.js.map +1 -1
- package/lib/service/type/mongodb.tpl.ts +4 -4
- package/package.json +30 -29
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
1
|
+
import { ServiceGeneratorContext } from '../index.js';
|
|
2
2
|
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.generate = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
1
|
+
import { toFile, after, before, when } from '@featherscloud/pinion';
|
|
2
|
+
import { fileExists, injectSource } from '../../commons.js';
|
|
6
3
|
const importTemplate = ({ upperName, folder, fileName, camelName }) => /* ts */ `
|
|
7
4
|
import { ${camelName}Client } from './services/${folder.join('/')}/${fileName}.shared'
|
|
8
5
|
export type {
|
|
@@ -13,7 +10,6 @@ export type {
|
|
|
13
10
|
} from './services/${folder.join('/')}/${fileName}.shared'
|
|
14
11
|
`;
|
|
15
12
|
const registrationTemplate = ({ camelName }) => ` client.configure(${camelName}Client)`;
|
|
16
|
-
const toClientFile =
|
|
17
|
-
const generate = async (ctx) =>
|
|
18
|
-
exports.generate = generate;
|
|
13
|
+
const toClientFile = toFile(({ lib }) => [lib, 'client']);
|
|
14
|
+
export const generate = async (ctx) => Promise.resolve(ctx).then(when(({ lib, language }) => fileExists(lib, `client.${language}`), injectSource(registrationTemplate, before('return client'), toClientFile), injectSource(importTemplate, after(({ language }) => language === 'ts' ? 'import type { AuthenticationClientOptions }' : 'import authenticationClient'), toClientFile)));
|
|
19
15
|
//# sourceMappingURL=client.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/client.tpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.tpl.js","sourceRoot":"","sources":["../../../src/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-1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fileExists, injectSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
1
|
+
import { toFile, after, before, when } from '@featherscloud/pinion'
|
|
2
|
+
import { fileExists, injectSource } from '../../commons.js'
|
|
3
|
+
import { ServiceGeneratorContext } from '../index.js'
|
|
4
4
|
|
|
5
5
|
const importTemplate = ({ upperName, folder, fileName, camelName }: ServiceGeneratorContext) => /* ts */ `
|
|
6
6
|
import { ${camelName}Client } from './services/${folder.join('/')}/${fileName}.shared'
|
|
@@ -18,7 +18,7 @@ const registrationTemplate = ({ camelName }: ServiceGeneratorContext) =>
|
|
|
18
18
|
const toClientFile = toFile<ServiceGeneratorContext>(({ lib }) => [lib, 'client'])
|
|
19
19
|
|
|
20
20
|
export const generate = async (ctx: ServiceGeneratorContext) =>
|
|
21
|
-
|
|
21
|
+
Promise.resolve(ctx).then(
|
|
22
22
|
when<ServiceGeneratorContext>(
|
|
23
23
|
({ lib, language }) => fileExists(lib, `client.${language}`),
|
|
24
24
|
injectSource(registrationTemplate, before('return client'), toClientFile),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
1
|
+
import { ServiceGeneratorContext } from '../index.js';
|
|
2
2
|
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.generate = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
1
|
+
import { toFile, when } from '@featherscloud/pinion';
|
|
2
|
+
import { fileExists, localTemplate, renderSource } from '../../commons.js';
|
|
6
3
|
const authFieldsTemplate = (authStrategies) => authStrategies
|
|
7
4
|
.map((name) => name === 'local'
|
|
8
5
|
? ` email: { type: 'string' },
|
|
@@ -15,10 +12,10 @@ import { resolve, getValidator, querySyntax } from '@feathersjs/schema'${type ==
|
|
|
15
12
|
import { ObjectIdSchema } from '@feathersjs/schema'`
|
|
16
13
|
: ''}
|
|
17
14
|
import type { FromSchema } from '@feathersjs/schema'
|
|
18
|
-
${
|
|
15
|
+
${localTemplate(authStrategies, `import { passwordHash } from '@feathersjs/authentication-local'`)}
|
|
19
16
|
|
|
20
17
|
import type { HookContext } from '${relative}/declarations'
|
|
21
|
-
import { dataValidator, queryValidator } from '${relative}/${
|
|
18
|
+
import { dataValidator, queryValidator } from '${relative}/${fileExists(cwd, lib, 'schemas') ? 'schemas/' : '' // This is for legacy backwards compatibility
|
|
22
19
|
}validators'
|
|
23
20
|
import type { ${upperName}Service } from './${fileName}.class'
|
|
24
21
|
|
|
@@ -27,7 +24,7 @@ export const ${camelName}Schema = {
|
|
|
27
24
|
$id: '${upperName}',
|
|
28
25
|
type: 'object',
|
|
29
26
|
additionalProperties: false,
|
|
30
|
-
required: [ '${type === 'mongodb' ? '_id' : 'id'}', ${
|
|
27
|
+
required: [ '${type === 'mongodb' ? '_id' : 'id'}', ${localTemplate(authStrategies, `'email'`, `'text'`)} ],
|
|
31
28
|
properties: {
|
|
32
29
|
${type === 'mongodb' ? `_id: ObjectIdSchema(),` : `id: { type: 'number' },`}
|
|
33
30
|
${isEntityService
|
|
@@ -41,7 +38,7 @@ export const ${camelName}Validator = getValidator(${camelName}Schema, dataValida
|
|
|
41
38
|
export const ${camelName}Resolver = resolve<${upperName}, HookContext<${upperName}Service>>({})
|
|
42
39
|
|
|
43
40
|
export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext<${upperName}Service>>({
|
|
44
|
-
${
|
|
41
|
+
${localTemplate(authStrategies, `// The password should never be visible externally
|
|
45
42
|
password: async () => undefined`)}
|
|
46
43
|
})
|
|
47
44
|
|
|
@@ -50,7 +47,7 @@ export const ${camelName}DataSchema = {
|
|
|
50
47
|
$id: '${upperName}Data',
|
|
51
48
|
type: 'object',
|
|
52
49
|
additionalProperties: false,
|
|
53
|
-
required: [ ${
|
|
50
|
+
required: [ ${localTemplate(authStrategies, `'email'`, `'text'`)} ],
|
|
54
51
|
properties: {
|
|
55
52
|
...${camelName}Schema.properties
|
|
56
53
|
}
|
|
@@ -58,7 +55,7 @@ export const ${camelName}DataSchema = {
|
|
|
58
55
|
export type ${upperName}Data = FromSchema<typeof ${camelName}DataSchema>
|
|
59
56
|
export const ${camelName}DataValidator = getValidator(${camelName}DataSchema, dataValidator)
|
|
60
57
|
export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext<${upperName}Service>>({
|
|
61
|
-
${
|
|
58
|
+
${localTemplate(authStrategies, `password: passwordHash({ strategy: 'local' })`)}
|
|
62
59
|
})
|
|
63
60
|
|
|
64
61
|
// Schema for updating existing data
|
|
@@ -74,7 +71,7 @@ export const ${camelName}PatchSchema = {
|
|
|
74
71
|
export type ${upperName}Patch = FromSchema<typeof ${camelName}PatchSchema>
|
|
75
72
|
export const ${camelName}PatchValidator = getValidator(${camelName}PatchSchema, dataValidator)
|
|
76
73
|
export const ${camelName}PatchResolver = resolve<${upperName}Patch, HookContext<${upperName}Service>>({
|
|
77
|
-
${
|
|
74
|
+
${localTemplate(authStrategies, `password: passwordHash({ strategy: 'local' })`)}
|
|
78
75
|
})
|
|
79
76
|
|
|
80
77
|
// Schema for allowed query properties
|
|
@@ -102,11 +99,10 @@ export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext<
|
|
|
102
99
|
: ''}
|
|
103
100
|
})
|
|
104
101
|
`;
|
|
105
|
-
const generate = (ctx) =>
|
|
102
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(when(({ schema }) => schema === 'json', renderSource(template, toFile(({ lib, folder, fileName }) => [
|
|
106
103
|
lib,
|
|
107
104
|
'services',
|
|
108
105
|
...folder,
|
|
109
106
|
`${fileName}.schema`
|
|
110
107
|
]))));
|
|
111
|
-
exports.generate = generate;
|
|
112
108
|
//# sourceMappingURL=schema.json.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.json.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/schema.json.tpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.json.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/schema.json.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAG1E,MAAM,kBAAkB,GAAG,CAAC,cAAwB,EAAE,EAAE,CACtD,cAAc;KACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,KAAK,OAAO;IACd,CAAC,CAAC;iCACuB;IACzB,CAAC,CAAC,OAAO,IAAI,wBAAwB,CACxC;KACA,IAAI,CAAC,KAAK,CAAC,CAAA;AAEhB,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,eAAe,EACf,IAAI,EACJ,GAAG,EACH,GAAG,EACqB,EAAE,EAAE,CAAC,QAAQ,CAAC;yEAEtC,IAAI,KAAK,SAAS;IAChB,CAAC,CAAC;oDAC8C;IAChD,CAAC,CAAC,EACN;;EAEE,aAAa,CAAC,cAAc,EAAE,iEAAiE,CAAC;;oCAE9D,QAAQ;iDACK,QAAQ,IACvD,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,6CAA6C;AACjG;gBACgB,SAAS,qBAAqB,QAAQ;;;eAGvC,SAAS;UACd,SAAS;;;iBAGF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,aAAa,CAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC;;MAEpG,IAAI,KAAK,SAAS,CAAC,CAAC,CAA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AC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,EACjC,YAAY,CACV,QAAQ,EACR,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAA2B,EAAE,EAAE,CAAC;IAC7D,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,SAAS;CACrB,CAAC,CACH,CACF,CACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fileExists, localTemplate, renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
1
|
+
import { toFile, when } from '@featherscloud/pinion'
|
|
2
|
+
import { fileExists, localTemplate, renderSource } from '../../commons.js'
|
|
3
|
+
import { ServiceGeneratorContext } from '../index.js'
|
|
4
4
|
|
|
5
5
|
const authFieldsTemplate = (authStrategies: string[]) =>
|
|
6
6
|
authStrategies
|
|
@@ -127,7 +127,7 @@ export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext<
|
|
|
127
127
|
`
|
|
128
128
|
|
|
129
129
|
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
130
|
-
|
|
130
|
+
Promise.resolve(ctx).then(
|
|
131
131
|
when<ServiceGeneratorContext>(
|
|
132
132
|
({ schema }) => schema === 'json',
|
|
133
133
|
renderSource(
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
1
|
+
import { ServiceGeneratorContext } from '../index.js';
|
|
2
2
|
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.generate = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
1
|
+
import { toFile, when } from '@featherscloud/pinion';
|
|
2
|
+
import { fileExists, localTemplate, renderSource } from '../../commons.js';
|
|
6
3
|
const authFieldsTemplate = (authStrategies) => authStrategies
|
|
7
4
|
.map((name) => name === 'local'
|
|
8
5
|
? ` email: Type.String(),
|
|
@@ -16,10 +13,10 @@ import { Type, getValidator, querySyntax } from '@feathersjs/typebox'${type ===
|
|
|
16
13
|
import { ObjectIdSchema } from '@feathersjs/typebox'`
|
|
17
14
|
: ''}
|
|
18
15
|
import type { Static } from '@feathersjs/typebox'
|
|
19
|
-
${
|
|
16
|
+
${localTemplate(authStrategies, `import { passwordHash } from '@feathersjs/authentication-local'`)}
|
|
20
17
|
|
|
21
18
|
import type { HookContext } from '${relative}/declarations'
|
|
22
|
-
import { dataValidator, queryValidator } from '${relative}/${
|
|
19
|
+
import { dataValidator, queryValidator } from '${relative}/${fileExists(cwd, lib, 'schemas') ? 'schemas/' : '' // This is for legacy backwards compatibility
|
|
23
20
|
}validators'
|
|
24
21
|
import type { ${upperName}Service } from './${fileName}.class'
|
|
25
22
|
|
|
@@ -33,7 +30,7 @@ export const ${camelName}Validator = getValidator(${camelName}Schema, dataValida
|
|
|
33
30
|
export const ${camelName}Resolver = resolve<${upperName}, HookContext<${upperName}Service>>({})
|
|
34
31
|
|
|
35
32
|
export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext<${upperName}Service>>({
|
|
36
|
-
${
|
|
33
|
+
${localTemplate(authStrategies, `// The password should never be visible externally
|
|
37
34
|
password: async () => undefined`)}
|
|
38
35
|
})
|
|
39
36
|
|
|
@@ -48,7 +45,7 @@ export const ${camelName}DataSchema = Type.Pick(${camelName}Schema, [
|
|
|
48
45
|
export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
|
|
49
46
|
export const ${camelName}DataValidator = getValidator(${camelName}DataSchema, dataValidator)
|
|
50
47
|
export const ${camelName}DataResolver = resolve<${upperName}, HookContext<${upperName}Service>>({
|
|
51
|
-
${
|
|
48
|
+
${localTemplate(authStrategies, `password: passwordHash({ strategy: 'local' })`)}
|
|
52
49
|
})
|
|
53
50
|
|
|
54
51
|
// Schema for updating existing entries
|
|
@@ -58,7 +55,7 @@ export const ${camelName}PatchSchema = Type.Partial(${camelName}Schema, {
|
|
|
58
55
|
export type ${upperName}Patch = Static<typeof ${camelName}PatchSchema>
|
|
59
56
|
export const ${camelName}PatchValidator = getValidator(${camelName}PatchSchema, dataValidator)
|
|
60
57
|
export const ${camelName}PatchResolver = resolve<${upperName}, HookContext<${upperName}Service>>({
|
|
61
|
-
${
|
|
58
|
+
${localTemplate(authStrategies, `password: passwordHash({ strategy: 'local' })`)}
|
|
62
59
|
})
|
|
63
60
|
|
|
64
61
|
// Schema for allowed query properties
|
|
@@ -88,11 +85,10 @@ export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext<
|
|
|
88
85
|
: ''}
|
|
89
86
|
})
|
|
90
87
|
`;
|
|
91
|
-
const generate = (ctx) =>
|
|
88
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(when(({ schema }) => schema === 'typebox', renderSource(template, toFile(({ lib, folder, fileName }) => [
|
|
92
89
|
lib,
|
|
93
90
|
'services',
|
|
94
91
|
...folder,
|
|
95
92
|
`${fileName}.schema`
|
|
96
93
|
]))));
|
|
97
|
-
exports.generate = generate;
|
|
98
94
|
//# sourceMappingURL=schema.typebox.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.typebox.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/schema.typebox.tpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.typebox.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/schema.typebox.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAG1E,MAAM,kBAAkB,GAAG,CAAC,cAAwB,EAAE,EAAE,CACtD,cAAc;KACX,GAAG,CAAC,CAAC,IAAI,EAA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,YAAY,CACV,QAAQ,EACR,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAA2B,EAAE,EAAE,CAAC;IAC7D,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,SAAS;CACrB,CAAC,CACH,CACF,CACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fileExists, localTemplate, renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
1
|
+
import { toFile, when } from '@featherscloud/pinion'
|
|
2
|
+
import { fileExists, localTemplate, renderSource } from '../../commons.js'
|
|
3
|
+
import { ServiceGeneratorContext } from '../index.js'
|
|
4
4
|
|
|
5
5
|
const authFieldsTemplate = (authStrategies: string[]) =>
|
|
6
6
|
authStrategies
|
|
@@ -115,7 +115,7 @@ export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext<
|
|
|
115
115
|
`
|
|
116
116
|
|
|
117
117
|
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
118
|
-
|
|
118
|
+
Promise.resolve(ctx).then(
|
|
119
119
|
when<ServiceGeneratorContext>(
|
|
120
120
|
({ schema }) => schema === 'typebox',
|
|
121
121
|
renderSource(
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
1
|
+
import { ServiceGeneratorContext } from '../index.js';
|
|
2
2
|
export declare const template: ({ camelName, authentication, isEntityService, path, lib, language, className, relative, schema, fileName }: ServiceGeneratorContext) => string;
|
|
3
3
|
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
6
|
-
const template = ({ camelName, authentication, isEntityService, path, lib, language, className, relative, schema, fileName }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.html
|
|
1
|
+
import { toFile, after, prepend } from '@featherscloud/pinion';
|
|
2
|
+
import { fileExists, injectSource, renderSource } from '../../commons.js';
|
|
3
|
+
export const template = ({ camelName, authentication, isEntityService, path, lib, language, className, relative, schema, fileName }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.html
|
|
7
4
|
${authentication || isEntityService ? `import { authenticate } from '@feathersjs/authentication'` : ''}
|
|
8
5
|
${schema
|
|
9
6
|
? `
|
|
@@ -24,7 +21,7 @@ import {
|
|
|
24
21
|
|
|
25
22
|
import type { Application } from '${relative}/declarations'
|
|
26
23
|
import { ${className}, getOptions } from './${fileName}.class'
|
|
27
|
-
${
|
|
24
|
+
${fileExists(lib, `client.${language}`)
|
|
28
25
|
? `import { ${camelName}Path, ${camelName}Methods } from './${fileName}.shared'`
|
|
29
26
|
: `
|
|
30
27
|
export const ${camelName}Path = '${path}'
|
|
@@ -102,16 +99,14 @@ declare module '${relative}/declarations' {
|
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
`;
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
.then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, fileName, folder }) => [
|
|
102
|
+
const toServiceIndex = toFile(({ lib }) => [lib, 'services', `index`]);
|
|
103
|
+
export const generate = (ctx) => Promise.resolve(ctx)
|
|
104
|
+
.then(renderSource(template, toFile(({ lib, fileName, folder }) => [
|
|
109
105
|
lib,
|
|
110
106
|
'services',
|
|
111
107
|
...folder,
|
|
112
108
|
`${fileName}`
|
|
113
109
|
])))
|
|
114
|
-
.then(
|
|
115
|
-
.then(
|
|
116
|
-
exports.generate = generate;
|
|
110
|
+
.then(injectSource(({ camelName, folder, fileName }) => `import { ${camelName} } from './${folder.join('/')}/${fileName}'`, prepend(), toServiceIndex))
|
|
111
|
+
.then(injectSource(({ camelName }) => ` app.configure(${camelName})`, after('export const services'), toServiceIndex));
|
|
117
112
|
//# sourceMappingURL=service.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/service.tpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/service.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGzE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,cAAc,EACd,eAAe,EACf,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;EACtC,cAAc,IAAI,eAAe,CAAC,CAAC,CAAC,2DAA2D,CAAC,CAAC,CAAC,EAAE;EAEpG,MAAM;IACJ,CAAC,CAAC;;;;IAIF,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;YACD,QAAQ;CACnB;IACG,CAAC,CAAC,EACN;;oCAEoC,QAAQ;WACjC,SAAS,0BAA0B,QAAQ;EAEpD,UAAU,CAAC,GAAG,EAAE,UAAU,QAAQ,EAAE,CAAC;IACnC,CAAC,CAAC,YAAY,SAAS,SAAS,SAAS,qBAAqB,QAAQ,UAAU;IAChF,CAAC,CAAC;eACS,SAAS,WAAW,IAAI;eACxB,SAAS,iEACxB;;mBAEmB,QAAQ;EACzB,MAAM,CAAC,CAAC,CAAC,oBAAoB,QAAQ,UAAU,CAAC,CAAC,CAAC,EAAE;;;eAGvC,SAAS;;YAEZ,SAAS,aAAa,SAAS;;eAE5B,SAAS;;;;;gBAKR,SAAS;;cAGjB,cAAc;I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,EAAE,CAAC,mBAAmB,SAAS,GAAG,EAClD,KAAK,CAAC,uBAAuB,CAAC,EAC9B,cAAc,CACf,CACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fileExists, injectSource, renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
1
|
+
import { toFile, after, prepend } from '@featherscloud/pinion'
|
|
2
|
+
import { fileExists, injectSource, renderSource } from '../../commons.js'
|
|
3
|
+
import { ServiceGeneratorContext } from '../index.js'
|
|
4
4
|
|
|
5
5
|
export const template = ({
|
|
6
6
|
camelName,
|
|
@@ -132,7 +132,7 @@ declare module '${relative}/declarations' {
|
|
|
132
132
|
const toServiceIndex = toFile(({ lib }: ServiceGeneratorContext) => [lib, 'services', `index`])
|
|
133
133
|
|
|
134
134
|
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
135
|
-
|
|
135
|
+
Promise.resolve(ctx)
|
|
136
136
|
.then(
|
|
137
137
|
renderSource(
|
|
138
138
|
template,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
1
|
+
import { ServiceGeneratorContext } from '../index.js';
|
|
2
2
|
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.generate = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
1
|
+
import { toFile, when } from '@featherscloud/pinion';
|
|
2
|
+
import { fileExists, renderSource } from '../../commons.js';
|
|
6
3
|
const sharedTemplate = ({ camelName, upperName, className, fileName, relative, path }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.shared.html
|
|
7
4
|
import type { Params } from '@feathersjs/feathers'
|
|
8
5
|
import type { ClientApplication } from '${relative}/client'
|
|
@@ -40,11 +37,10 @@ declare module '${relative}/client' {
|
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
`;
|
|
43
|
-
const generate = async (ctx) =>
|
|
40
|
+
export const generate = async (ctx) => Promise.resolve(ctx).then(when(({ lib, language }) => fileExists(lib, `client.${language}`), renderSource(sharedTemplate, toFile(({ lib, folder, fileName }) => [
|
|
44
41
|
lib,
|
|
45
42
|
'services',
|
|
46
43
|
...folder,
|
|
47
44
|
`${fileName}.shared`
|
|
48
45
|
]))));
|
|
49
|
-
exports.generate = generate;
|
|
50
46
|
//# sourceMappingURL=shared.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/shared.tpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/shared.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAG3D,MAAM,cAAc,GAAG,CAAC,EACtB,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,IAAI,EACoB,EAAE,EAAE,CAAC,QAAQ,CAAC;;0CAEE,QAAQ;;IAE9C,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;YACD,QAAQ;;gBAEJ,SAAS,KAAK,SAAS,SAAS,SAAS,UAAU,SAAS;;cAE9D,SAAS;IACnB,SAAS,WAAW,SAAS;WACtB,SAAS;;;eAGL,SAAS,WAAW,IAAI;;eAExB,SAAS;;eAET,SAAS;;;eAGT,SAAS,4BAA4B,SAAS;eAC9C,SAAS;;;;;kBAKN,QAAQ;;OAEnB,SAAS,UAAU,SAAS;;;CAGlC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,GAA4B,EAAE,EAAE,CAC7D,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,cAAc,EACd,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAA2B,EAAE,EAAE,CAAC;IAC7D,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,SAAS;CACrB,CAAC,CACH,CACF,CACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fileExists, renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
1
|
+
import { toFile, when } from '@featherscloud/pinion'
|
|
2
|
+
import { fileExists, renderSource } from '../../commons.js'
|
|
3
|
+
import { ServiceGeneratorContext } from '../index.js'
|
|
4
4
|
|
|
5
5
|
const sharedTemplate = ({
|
|
6
6
|
camelName,
|
|
@@ -48,7 +48,7 @@ declare module '${relative}/client' {
|
|
|
48
48
|
`
|
|
49
49
|
|
|
50
50
|
export const generate = async (ctx: ServiceGeneratorContext) =>
|
|
51
|
-
|
|
51
|
+
Promise.resolve(ctx).then(
|
|
52
52
|
when<ServiceGeneratorContext>(
|
|
53
53
|
({ lib, language }) => fileExists(lib, `client.${language}`),
|
|
54
54
|
renderSource(
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
1
|
+
import { ServiceGeneratorContext } from '../index.js';
|
|
2
2
|
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.generate = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
1
|
+
import { toFile } from '@featherscloud/pinion';
|
|
2
|
+
import { renderSource } from '../../commons.js';
|
|
6
3
|
const template = ({ relative, lib, path }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.test.html
|
|
7
4
|
import assert from 'assert'
|
|
8
5
|
import { app } from '../${relative}/${lib}/app'
|
|
@@ -15,11 +12,10 @@ describe('${path} service', () => {
|
|
|
15
12
|
})
|
|
16
13
|
})
|
|
17
14
|
`;
|
|
18
|
-
const generate = (ctx) =>
|
|
15
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(renderSource(template, toFile(({ test, folder, fileName }) => [
|
|
19
16
|
test,
|
|
20
17
|
'services',
|
|
21
18
|
...folder,
|
|
22
19
|
`${fileName}.test`
|
|
23
20
|
])));
|
|
24
|
-
exports.generate = generate;
|
|
25
21
|
//# sourceMappingURL=test.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/test.tpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/test.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAG/C,MAAM,QAAQ,GAAG,CAAC,EAChB,QAAQ,EACR,GAAG,EACH,IAAI,EACoB,EAAE,EAAE,CAAC,QAAQ,CAAC;;0BAEd,QAAQ,IAAI,GAAG;;YAE7B,IAAI;;mCAEmB,IAAI;;;;;CAKtC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CACvB,YAAY,CACV,QAAQ,EACR,MAAM,CAA0B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC9D,IAAI;IACJ,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,OAAO;CACnB,CAAC,CACH,CACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
1
|
+
import { toFile } from '@featherscloud/pinion'
|
|
2
|
+
import { renderSource } from '../../commons.js'
|
|
3
|
+
import { ServiceGeneratorContext } from '../index.js'
|
|
4
4
|
|
|
5
5
|
const template = ({
|
|
6
6
|
relative,
|
|
@@ -20,7 +20,7 @@ describe('${path} service', () => {
|
|
|
20
20
|
`
|
|
21
21
|
|
|
22
22
|
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
23
|
-
|
|
23
|
+
Promise.resolve(ctx).then(
|
|
24
24
|
renderSource(
|
|
25
25
|
template,
|
|
26
26
|
toFile<ServiceGeneratorContext>(({ test, folder, fileName }) => [
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
1
|
+
import { ServiceGeneratorContext } from '../index.js';
|
|
2
2
|
export declare const template: ({ className, upperName, schema, fileName, relative }: ServiceGeneratorContext) => string;
|
|
3
3
|
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
6
|
-
const template = ({ className, upperName, schema, fileName, relative }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.class.html#custom-services
|
|
1
|
+
import { toFile } from '@featherscloud/pinion';
|
|
2
|
+
import { renderSource } from '../../commons.js';
|
|
3
|
+
export const template = ({ className, upperName, schema, fileName, relative }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.class.html#custom-services
|
|
7
4
|
import type { Id, NullableId, Params, ServiceInterface } from '@feathersjs/feathers'
|
|
8
5
|
|
|
9
6
|
import type { Application } from '${relative}/declarations'
|
|
@@ -90,12 +87,10 @@ export const getOptions = (app: Application) => {
|
|
|
90
87
|
return { app }
|
|
91
88
|
}
|
|
92
89
|
`;
|
|
93
|
-
|
|
94
|
-
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
|
|
90
|
+
export const generate = (ctx) => Promise.resolve(ctx).then(renderSource(template, toFile(({ lib, folder, fileName }) => [
|
|
95
91
|
lib,
|
|
96
92
|
'services',
|
|
97
93
|
...folder,
|
|
98
94
|
`${fileName}.class`
|
|
99
95
|
])));
|
|
100
|
-
exports.generate = generate;
|
|
101
96
|
//# sourceMappingURL=custom.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.tpl.js","sourceRoot":"","sources":["../../../src/service/type/custom.tpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"custom.tpl.js","sourceRoot":"","sources":["../../../src/service/type/custom.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAG/C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;oCAGJ,QAAQ;EAE1C,MAAM;IACJ,CAAC,CAAC;IACF,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;YACD,QAAQ;CACnB;IACG,CAAC,CAAC;OACC,SAAS;OACT,SAAS;OACT,SAAS;OACT,SAAS;CAEhB;;gBAEgB,SAAS,KAAK,SAAS,SAAS,SAAS,UAAU,SAAS;;mBAEzD,SAAS;;;;mBAIT,SAAS,yBAAyB,SAAS;;;;;eAK/C,SAAS,0BAA0B,SAAS,YAAY,SAAS;kCAC9C,SAAS,KAAK,SAAS,wBAAwB,SAAS;iCACzD,SAAS;;;kDAGQ,SAAS;;;;yDAIF,SAAS;;;;;;;wBAO1C,SAAS,0CAA0C,SAAS;wBAC5D,SAAS,4CAA4C,SAAS;wBAC9D,SAAS,QAAQ,SAAS,4CAA4C,SAAS,IAAI,SAAS;;;;;;;;;;;;wCAY5E,SAAS,2CAA2C,SAAS;;;;;;;uCAO9D,SAAS,4CAA4C,SAAS;;;;;;;;oEAQjC,SAAS;;;;;;;;;;;CAW5E,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CACvB,YAAY,CACV,QAAQ,EACR,MAAM,CAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC7D,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,QAAQ;CACpB,CAAC,CACH,CACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
1
|
+
import { toFile } from '@featherscloud/pinion'
|
|
2
|
+
import { renderSource } from '../../commons.js'
|
|
3
|
+
import { ServiceGeneratorContext } from '../index.js'
|
|
4
4
|
|
|
5
5
|
export const template = ({
|
|
6
6
|
className,
|
|
@@ -99,7 +99,7 @@ export const getOptions = (app: Application) => {
|
|
|
99
99
|
`
|
|
100
100
|
|
|
101
101
|
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
102
|
-
|
|
102
|
+
Promise.resolve(ctx).then(
|
|
103
103
|
renderSource(
|
|
104
104
|
template,
|
|
105
105
|
toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
1
|
+
import { ServiceGeneratorContext } from '../index.js';
|
|
2
2
|
export declare const template: ({ className, upperName, feathers, schema, fileName, relative }: ServiceGeneratorContext) => string;
|
|
3
3
|
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.generate = exports.template = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
1
|
+
import { toFile } from '@featherscloud/pinion';
|
|
2
|
+
import { renderSource, yyyymmddhhmmss } from '../../commons.js';
|
|
6
3
|
const migrationTemplate = ({ kebabPath, authStrategies, isEntityService }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/knexfile.html
|
|
7
4
|
import type { Knex } from 'knex'
|
|
8
5
|
|
|
@@ -27,7 +24,7 @@ export async function down(knex: Knex): Promise<void> {
|
|
|
27
24
|
await knex.schema.dropTable('${kebabPath}')
|
|
28
25
|
}
|
|
29
26
|
`;
|
|
30
|
-
const template = ({ className, upperName, feathers, schema, fileName, relative }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.class.html#database-services
|
|
27
|
+
export const template = ({ className, upperName, feathers, schema, fileName, relative }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.class.html#database-services
|
|
31
28
|
import type { Params } from '@feathersjs/feathers'
|
|
32
29
|
import { KnexService } from '@feathersjs/knex'
|
|
33
30
|
import type { KnexAdapterParams, KnexAdapterOptions } from '@feathersjs/knex'
|
|
@@ -66,14 +63,12 @@ export const getOptions = (app: Application): KnexAdapterOptions => {
|
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
65
|
`;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
|
|
66
|
+
export const generate = (ctx) => Promise.resolve(ctx)
|
|
67
|
+
.then(renderSource(template, toFile(({ lib, folder, fileName }) => [
|
|
72
68
|
lib,
|
|
73
69
|
'services',
|
|
74
70
|
...folder,
|
|
75
71
|
`${fileName}.class`
|
|
76
72
|
])))
|
|
77
|
-
.then(
|
|
78
|
-
exports.generate = generate;
|
|
73
|
+
.then(renderSource(migrationTemplate, toFile('migrations', ({ kebabName }) => `${yyyymmddhhmmss()}_${kebabName}`)));
|
|
79
74
|
//# sourceMappingURL=knex.tpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knex.tpl.js","sourceRoot":"","sources":["../../../src/service/type/knex.tpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"knex.tpl.js","sourceRoot":"","sources":["../../../src/service/type/knex.tpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAG/D,MAAM,iBAAiB,GAAG,CAAC,EACzB,SAAS,EACT,cAAc,EACd,eAAe,EACS,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;mCAIL,SAAS;;MAGtC,eAAe;IACb,CAAC,CAAC,cAAc;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,KAAK,OAAO;QACd,CAAC,CAAC;;6BAEW;QACb,CAAC,CAAC;oBACE,IAAI,MAAM,CACjB;SACA,IAAI,CAAC,IAAI,CAAC;IACf,CAAC,CAAC;yBAEN;;;;;iCAK6B,SAAS;;CAEzC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;oCAKJ,QAAQ;EAE1C,MAAM;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