@vendure/cli 3.1.8 → 3.2.1
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/LICENSE.md +42 -42
- package/dist/cli.js +26 -16
- package/dist/cli.js.map +1 -1
- package/dist/commands/add/add.js +1 -2
- package/dist/commands/add/add.js.map +1 -1
- package/dist/commands/add/api-extension/templates/api-extensions.template.ts +3 -3
- package/dist/commands/add/api-extension/templates/crud-resolver.template.ts +109 -109
- package/dist/commands/add/api-extension/templates/simple-resolver.template.ts +31 -31
- package/dist/commands/add/codegen/add-codegen.js +6 -6
- package/dist/commands/add/codegen/templates/codegen.template.ts +17 -17
- package/dist/commands/add/entity/add-entity.js +2 -2
- package/dist/commands/add/entity/add-entity.js.map +1 -1
- package/dist/commands/add/entity/codemods/add-entity-to-plugin/add-entity-to-plugin.js +1 -2
- package/dist/commands/add/entity/codemods/add-entity-to-plugin/add-entity-to-plugin.js.map +1 -1
- package/dist/commands/add/entity/templates/entity-translation.template.ts +29 -29
- package/dist/commands/add/entity/templates/entity.template.ts +31 -31
- package/dist/commands/add/job-queue/add-job-queue.js +36 -36
- package/dist/commands/add/plugin/create-new-plugin.js +20 -10
- package/dist/commands/add/plugin/create-new-plugin.js.map +1 -1
- package/dist/commands/add/plugin/templates/constants.template.ts +2 -2
- package/dist/commands/add/plugin/templates/plugin.template.ts +25 -25
- package/dist/commands/add/plugin/templates/types.template.ts +7 -7
- package/dist/commands/add/service/add-service.js +21 -21
- package/dist/commands/add/service/templates/basic-service.template.ts +13 -13
- package/dist/commands/add/service/templates/entity-service.template.ts +146 -146
- package/dist/commands/add/ui-extensions/codemods/add-ui-extension-static-prop/add-ui-extension-static-prop.js +6 -7
- package/dist/commands/add/ui-extensions/codemods/add-ui-extension-static-prop/add-ui-extension-static-prop.js.map +1 -1
- package/dist/commands/add/ui-extensions/codemods/update-admin-ui-plugin-init/update-admin-ui-plugin-init.js +7 -8
- package/dist/commands/add/ui-extensions/codemods/update-admin-ui-plugin-init/update-admin-ui-plugin-init.js.map +1 -1
- package/dist/commands/add/ui-extensions/templates/providers.template.ts +3 -3
- package/dist/commands/add/ui-extensions/templates/routes.template.ts +3 -3
- package/dist/commands/migrate/load-vendure-config-file.js +18 -9
- package/dist/commands/migrate/load-vendure-config-file.js.map +1 -1
- package/dist/commands/migrate/migrate.js +1 -2
- package/dist/commands/migrate/migrate.js.map +1 -1
- package/dist/shared/shared-prompts.js +6 -7
- package/dist/shared/shared-prompts.js.map +1 -1
- package/dist/shared/vendure-plugin-ref.js +3 -3
- package/dist/utilities/ast-utils.js +7 -8
- package/dist/utilities/ast-utils.js.map +1 -1
- package/dist/utilities/utils.js +2 -3
- package/dist/utilities/utils.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { LanguageCode } from '@vendure/common/lib/generated-types';
|
|
2
|
-
import { DeepPartial } from '@vendure/common/lib/shared-types';
|
|
3
|
-
import { HasCustomFields, Translation, VendureEntity } from '@vendure/core';
|
|
4
|
-
import { Column, Entity, Index, ManyToOne } from 'typeorm';
|
|
5
|
-
|
|
6
|
-
import { ScaffoldEntity } from './entity.template';
|
|
7
|
-
|
|
8
|
-
export class ScaffoldEntityCustomFieldsTranslation {}
|
|
9
|
-
|
|
10
|
-
@Entity()
|
|
11
|
-
export class ScaffoldTranslation
|
|
12
|
-
extends VendureEntity
|
|
13
|
-
implements Translation<ScaffoldEntity>, HasCustomFields
|
|
14
|
-
{
|
|
15
|
-
constructor(input?: DeepPartial<Translation<ScaffoldTranslation>>) {
|
|
16
|
-
super(input);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Column('varchar') languageCode: LanguageCode;
|
|
20
|
-
|
|
21
|
-
@Column() localizedName: string;
|
|
22
|
-
|
|
23
|
-
@Index()
|
|
24
|
-
@ManyToOne(type => ScaffoldEntity, base => base.translations, { onDelete: 'CASCADE' })
|
|
25
|
-
base: ScaffoldEntity;
|
|
26
|
-
|
|
27
|
-
@Column(type => ScaffoldEntityCustomFieldsTranslation)
|
|
28
|
-
customFields: ScaffoldEntityCustomFieldsTranslation;
|
|
29
|
-
}
|
|
1
|
+
import { LanguageCode } from '@vendure/common/lib/generated-types';
|
|
2
|
+
import { DeepPartial } from '@vendure/common/lib/shared-types';
|
|
3
|
+
import { HasCustomFields, Translation, VendureEntity } from '@vendure/core';
|
|
4
|
+
import { Column, Entity, Index, ManyToOne } from 'typeorm';
|
|
5
|
+
|
|
6
|
+
import { ScaffoldEntity } from './entity.template';
|
|
7
|
+
|
|
8
|
+
export class ScaffoldEntityCustomFieldsTranslation {}
|
|
9
|
+
|
|
10
|
+
@Entity()
|
|
11
|
+
export class ScaffoldTranslation
|
|
12
|
+
extends VendureEntity
|
|
13
|
+
implements Translation<ScaffoldEntity>, HasCustomFields
|
|
14
|
+
{
|
|
15
|
+
constructor(input?: DeepPartial<Translation<ScaffoldTranslation>>) {
|
|
16
|
+
super(input);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Column('varchar') languageCode: LanguageCode;
|
|
20
|
+
|
|
21
|
+
@Column() localizedName: string;
|
|
22
|
+
|
|
23
|
+
@Index()
|
|
24
|
+
@ManyToOne(type => ScaffoldEntity, base => base.translations, { onDelete: 'CASCADE' })
|
|
25
|
+
base: ScaffoldEntity;
|
|
26
|
+
|
|
27
|
+
@Column(type => ScaffoldEntityCustomFieldsTranslation)
|
|
28
|
+
customFields: ScaffoldEntityCustomFieldsTranslation;
|
|
29
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DeepPartial,
|
|
3
|
-
HasCustomFields,
|
|
4
|
-
LocaleString,
|
|
5
|
-
Translatable,
|
|
6
|
-
Translation,
|
|
7
|
-
VendureEntity,
|
|
8
|
-
} from '@vendure/core';
|
|
9
|
-
import { Column, Entity, OneToMany } from 'typeorm';
|
|
10
|
-
|
|
11
|
-
import { ScaffoldTranslation } from './entity-translation.template';
|
|
12
|
-
|
|
13
|
-
export class ScaffoldEntityCustomFields {}
|
|
14
|
-
|
|
15
|
-
@Entity()
|
|
16
|
-
export class ScaffoldEntity extends VendureEntity implements Translatable, HasCustomFields {
|
|
17
|
-
constructor(input?: DeepPartial<ScaffoldEntity>) {
|
|
18
|
-
super(input);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Column()
|
|
22
|
-
code: string;
|
|
23
|
-
|
|
24
|
-
@Column(type => ScaffoldEntityCustomFields)
|
|
25
|
-
customFields: ScaffoldEntityCustomFields;
|
|
26
|
-
|
|
27
|
-
localizedName: LocaleString;
|
|
28
|
-
|
|
29
|
-
@OneToMany(type => ScaffoldTranslation, translation => translation.base, { eager: true })
|
|
30
|
-
translations: Array<Translation<ScaffoldEntity>>;
|
|
31
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
DeepPartial,
|
|
3
|
+
HasCustomFields,
|
|
4
|
+
LocaleString,
|
|
5
|
+
Translatable,
|
|
6
|
+
Translation,
|
|
7
|
+
VendureEntity,
|
|
8
|
+
} from '@vendure/core';
|
|
9
|
+
import { Column, Entity, OneToMany } from 'typeorm';
|
|
10
|
+
|
|
11
|
+
import { ScaffoldTranslation } from './entity-translation.template';
|
|
12
|
+
|
|
13
|
+
export class ScaffoldEntityCustomFields {}
|
|
14
|
+
|
|
15
|
+
@Entity()
|
|
16
|
+
export class ScaffoldEntity extends VendureEntity implements Translatable, HasCustomFields {
|
|
17
|
+
constructor(input?: DeepPartial<ScaffoldEntity>) {
|
|
18
|
+
super(input);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Column()
|
|
22
|
+
code: string;
|
|
23
|
+
|
|
24
|
+
@Column(type => ScaffoldEntityCustomFields)
|
|
25
|
+
customFields: ScaffoldEntityCustomFields;
|
|
26
|
+
|
|
27
|
+
localizedName: LocaleString;
|
|
28
|
+
|
|
29
|
+
@OneToMany(type => ScaffoldTranslation, translation => translation.base, { eager: true })
|
|
30
|
+
translations: Array<Translation<ScaffoldEntity>>;
|
|
31
|
+
}
|
|
@@ -73,39 +73,39 @@ async function addJobQueue(options) {
|
|
|
73
73
|
if (ts_morph_1.Node.isBlock(body)) {
|
|
74
74
|
body.addStatements(writer => {
|
|
75
75
|
writer
|
|
76
|
-
.write(`this.${jobQueuePropertyName} = await this.jobQueueService.createQueue({
|
|
77
|
-
name: '${jobQueueName}',
|
|
78
|
-
process: async job => {
|
|
79
|
-
// Deserialize the RequestContext from the job data
|
|
80
|
-
const ctx = RequestContext.deserialize(job.data.ctx);
|
|
81
|
-
// The "someArg" property is passed in when the job is triggered
|
|
82
|
-
const someArg = job.data.someArg;
|
|
83
|
-
|
|
84
|
-
// Inside the \`process\` function we define how each job
|
|
85
|
-
// in the queue will be processed.
|
|
86
|
-
// Let's simulate some long-running task
|
|
87
|
-
const totalItems = 10;
|
|
88
|
-
for (let i = 0; i < totalItems; i++) {
|
|
89
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
90
|
-
|
|
91
|
-
// You can optionally respond to the job being cancelled
|
|
92
|
-
// during processing. This can be useful for very long-running
|
|
93
|
-
// tasks which can be cancelled by the user.
|
|
94
|
-
if (job.state === JobState.CANCELLED) {
|
|
95
|
-
throw new Error('Job was cancelled');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Progress can be reported as a percentage like this
|
|
99
|
-
job.setProgress(Math.floor(i / totalItems * 100));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// The value returned from the \`process\` function is stored
|
|
103
|
-
// as the "result" field of the job
|
|
104
|
-
return {
|
|
105
|
-
processedCount: totalItems,
|
|
106
|
-
message: \`Successfully processed \${totalItems} items\`,
|
|
107
|
-
};
|
|
108
|
-
},
|
|
76
|
+
.write(`this.${jobQueuePropertyName} = await this.jobQueueService.createQueue({
|
|
77
|
+
name: '${jobQueueName}',
|
|
78
|
+
process: async job => {
|
|
79
|
+
// Deserialize the RequestContext from the job data
|
|
80
|
+
const ctx = RequestContext.deserialize(job.data.ctx);
|
|
81
|
+
// The "someArg" property is passed in when the job is triggered
|
|
82
|
+
const someArg = job.data.someArg;
|
|
83
|
+
|
|
84
|
+
// Inside the \`process\` function we define how each job
|
|
85
|
+
// in the queue will be processed.
|
|
86
|
+
// Let's simulate some long-running task
|
|
87
|
+
const totalItems = 10;
|
|
88
|
+
for (let i = 0; i < totalItems; i++) {
|
|
89
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
90
|
+
|
|
91
|
+
// You can optionally respond to the job being cancelled
|
|
92
|
+
// during processing. This can be useful for very long-running
|
|
93
|
+
// tasks which can be cancelled by the user.
|
|
94
|
+
if (job.state === JobState.CANCELLED) {
|
|
95
|
+
throw new Error('Job was cancelled');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Progress can be reported as a percentage like this
|
|
99
|
+
job.setProgress(Math.floor(i / totalItems * 100));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// The value returned from the \`process\` function is stored
|
|
103
|
+
// as the "result" field of the job
|
|
104
|
+
return {
|
|
105
|
+
processedCount: totalItems,
|
|
106
|
+
message: \`Successfully processed \${totalItems} items\`,
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
109
|
})`)
|
|
110
110
|
.newLine();
|
|
111
111
|
}).forEach(s => s.formatText());
|
|
@@ -116,9 +116,9 @@ async function addJobQueue(options) {
|
|
|
116
116
|
scope: ts_morph_1.Scope.Public,
|
|
117
117
|
parameters: [{ name: 'ctx', type: 'RequestContext' }],
|
|
118
118
|
statements: writer => {
|
|
119
|
-
writer.write(`return this.${jobQueuePropertyName}.add({
|
|
120
|
-
ctx: ctx.serialize(),
|
|
121
|
-
someArg: 'foo',
|
|
119
|
+
writer.write(`return this.${jobQueuePropertyName}.add({
|
|
120
|
+
ctx: ctx.serialize(),
|
|
121
|
+
someArg: 'foo',
|
|
122
122
|
})`);
|
|
123
123
|
},
|
|
124
124
|
})
|
|
@@ -15,18 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
39
|
+
exports.createNewPluginCommand = void 0;
|
|
40
|
+
exports.createNewPlugin = createNewPlugin;
|
|
41
|
+
exports.generatePlugin = generatePlugin;
|
|
30
42
|
const prompts_1 = require("@clack/prompts");
|
|
31
43
|
const change_case_1 = require("change-case");
|
|
32
44
|
const fs = __importStar(require("fs-extra"));
|
|
@@ -148,7 +160,6 @@ async function createNewPlugin() {
|
|
|
148
160
|
modifiedSourceFiles: [],
|
|
149
161
|
};
|
|
150
162
|
}
|
|
151
|
-
exports.createNewPlugin = createNewPlugin;
|
|
152
163
|
async function generatePlugin(project, options) {
|
|
153
164
|
var _a, _b, _c, _d;
|
|
154
165
|
const nameWithoutPlugin = options.name.replace(/-?plugin$/i, '');
|
|
@@ -178,7 +189,6 @@ async function generatePlugin(project, options) {
|
|
|
178
189
|
plugin: new vendure_plugin_ref_1.VendurePluginRef(pluginClass),
|
|
179
190
|
};
|
|
180
191
|
}
|
|
181
|
-
exports.generatePlugin = generatePlugin;
|
|
182
192
|
function findExistingPluginsDir(project) {
|
|
183
193
|
const pluginClasses = (0, ast_utils_1.getPluginClasses)(project);
|
|
184
194
|
if (pluginClasses.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-new-plugin.js","sourceRoot":"","sources":["../../../../src/commands/add/plugin/create-new-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-new-plugin.js","sourceRoot":"","sources":["../../../../src/commands/add/plugin/create-new-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,0CAwGC;AAED,wCAsDC;AA9LD,4CAAqF;AACrF,6CAAkE;AAClE,6CAA+B;AAC/B,gDAAwB;AAGxB,6DAA8E;AAC9E,mEAAgE;AAChE,2EAAsE;AACtE,2EAAsE;AACtE,4DAA8F;AAC9F,oDAAiE;AACjE,0EAA4E;AAC5E,wDAA2D;AAC3D,qDAAwD;AACxD,8DAAgE;AAChE,wDAA2D;AAC3D,0EAA4E;AAI/D,QAAA,sBAAsB,GAAG,IAAI,wBAAU,CAAC;IACjD,EAAE,EAAE,mBAAmB;IACvB,QAAQ,EAAE,QAAQ;IAClB,WAAW,EAAE,6BAA6B;IAC1C,GAAG,EAAE,eAAe;CACvB,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAE5C,KAAK,UAAU,eAAe;IACjC,MAAM,OAAO,GAA0B,EAAE,IAAI,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAS,CAAC;IAChG,IAAA,eAAK,EAAC,8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AC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAGjF,MAAM,UAAU,GAAa,EAAE,CAAC;IAGhC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;QAEjC,MAAM,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE9C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC;QACpF,IAAI,QAAQ,EAAE,CAAC;YAEX,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YAEJ,MAAM;QACV,CAAC;IACL,CAAC;IAGD,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const TEMPLATE_PLUGIN_OPTIONS = Symbol('TEMPLATE_PLUGIN_OPTIONS');
|
|
2
|
-
export const loggerCtx = 'TemplatePlugin';
|
|
1
|
+
export const TEMPLATE_PLUGIN_OPTIONS = Symbol('TEMPLATE_PLUGIN_OPTIONS');
|
|
2
|
+
export const loggerCtx = 'TemplatePlugin';
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { PluginCommonModule, Type, VendurePlugin } from '@vendure/core';
|
|
2
|
-
|
|
3
|
-
import { TEMPLATE_PLUGIN_OPTIONS } from './constants.template';
|
|
4
|
-
import { PluginInitOptions } from './types.template';
|
|
5
|
-
|
|
6
|
-
@VendurePlugin({
|
|
7
|
-
imports: [PluginCommonModule],
|
|
8
|
-
providers: [{ provide: TEMPLATE_PLUGIN_OPTIONS, useFactory: () => TemplatePlugin.options }],
|
|
9
|
-
configuration: config => {
|
|
10
|
-
// Plugin-specific configuration
|
|
11
|
-
// such as custom fields, custom permissions,
|
|
12
|
-
// strategies etc. can be configured here by
|
|
13
|
-
// modifying the `config` object.
|
|
14
|
-
return config;
|
|
15
|
-
},
|
|
16
|
-
compatibility: '^3.0.0',
|
|
17
|
-
})
|
|
18
|
-
export class TemplatePlugin {
|
|
19
|
-
static options: PluginInitOptions;
|
|
20
|
-
|
|
21
|
-
static init(options: PluginInitOptions): Type<TemplatePlugin> {
|
|
22
|
-
this.options = options;
|
|
23
|
-
return TemplatePlugin;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
import { PluginCommonModule, Type, VendurePlugin } from '@vendure/core';
|
|
2
|
+
|
|
3
|
+
import { TEMPLATE_PLUGIN_OPTIONS } from './constants.template';
|
|
4
|
+
import { PluginInitOptions } from './types.template';
|
|
5
|
+
|
|
6
|
+
@VendurePlugin({
|
|
7
|
+
imports: [PluginCommonModule],
|
|
8
|
+
providers: [{ provide: TEMPLATE_PLUGIN_OPTIONS, useFactory: () => TemplatePlugin.options }],
|
|
9
|
+
configuration: config => {
|
|
10
|
+
// Plugin-specific configuration
|
|
11
|
+
// such as custom fields, custom permissions,
|
|
12
|
+
// strategies etc. can be configured here by
|
|
13
|
+
// modifying the `config` object.
|
|
14
|
+
return config;
|
|
15
|
+
},
|
|
16
|
+
compatibility: '^3.0.0',
|
|
17
|
+
})
|
|
18
|
+
export class TemplatePlugin {
|
|
19
|
+
static options: PluginInitOptions;
|
|
20
|
+
|
|
21
|
+
static init(options: PluginInitOptions): Type<TemplatePlugin> {
|
|
22
|
+
this.options = options;
|
|
23
|
+
return TemplatePlugin;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* The plugin can be configured using the following options:
|
|
4
|
-
*/
|
|
5
|
-
export interface PluginInitOptions {
|
|
6
|
-
exampleOption?: string;
|
|
7
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* The plugin can be configured using the following options:
|
|
4
|
+
*/
|
|
5
|
+
export interface PluginInitOptions {
|
|
6
|
+
exampleOption?: string;
|
|
7
|
+
}
|
|
@@ -180,11 +180,11 @@ function customizeFindOneMethod(serviceClassDeclaration, entityRef) {
|
|
|
180
180
|
const findOneMethod = serviceClassDeclaration.getMethod('findOne');
|
|
181
181
|
findOneMethod
|
|
182
182
|
.setBodyText(writer => {
|
|
183
|
-
writer.write(` return this.connection
|
|
184
|
-
.getRepository(ctx, ${entityRef.name})
|
|
185
|
-
.findOne({
|
|
186
|
-
where: { id },
|
|
187
|
-
relations,
|
|
183
|
+
writer.write(` return this.connection
|
|
184
|
+
.getRepository(ctx, ${entityRef.name})
|
|
185
|
+
.findOne({
|
|
186
|
+
where: { id },
|
|
187
|
+
relations,
|
|
188
188
|
})`);
|
|
189
189
|
if (entityRef.isTranslatable()) {
|
|
190
190
|
writer.write(`.then(entity => entity && this.translator.translate(entity, ctx));`);
|
|
@@ -233,14 +233,14 @@ function customizeCreateMethod(serviceClassDeclaration, entityRef) {
|
|
|
233
233
|
.setBodyText(writer => {
|
|
234
234
|
var _a;
|
|
235
235
|
if (entityRef.isTranslatable()) {
|
|
236
|
-
writer.write(`const newEntity = await this.translatableSaver.create({
|
|
237
|
-
ctx,
|
|
238
|
-
input,
|
|
239
|
-
entityType: ${entityRef.name},
|
|
240
|
-
translationType: ${(_a = entityRef.getTranslationClass()) === null || _a === void 0 ? void 0 : _a.getName()},
|
|
241
|
-
beforeSave: async f => {
|
|
242
|
-
// Any pre-save logic can go here
|
|
243
|
-
},
|
|
236
|
+
writer.write(`const newEntity = await this.translatableSaver.create({
|
|
237
|
+
ctx,
|
|
238
|
+
input,
|
|
239
|
+
entityType: ${entityRef.name},
|
|
240
|
+
translationType: ${(_a = entityRef.getTranslationClass()) === null || _a === void 0 ? void 0 : _a.getName()},
|
|
241
|
+
beforeSave: async f => {
|
|
242
|
+
// Any pre-save logic can go here
|
|
243
|
+
},
|
|
244
244
|
});`);
|
|
245
245
|
}
|
|
246
246
|
else {
|
|
@@ -262,14 +262,14 @@ function customizeUpdateMethod(serviceClassDeclaration, entityRef) {
|
|
|
262
262
|
.setBodyText(writer => {
|
|
263
263
|
var _a;
|
|
264
264
|
if (entityRef.isTranslatable()) {
|
|
265
|
-
writer.write(`const updatedEntity = await this.translatableSaver.update({
|
|
266
|
-
ctx,
|
|
267
|
-
input,
|
|
268
|
-
entityType: ${entityRef.name},
|
|
269
|
-
translationType: ${(_a = entityRef.getTranslationClass()) === null || _a === void 0 ? void 0 : _a.getName()},
|
|
270
|
-
beforeSave: async f => {
|
|
271
|
-
// Any pre-save logic can go here
|
|
272
|
-
},
|
|
265
|
+
writer.write(`const updatedEntity = await this.translatableSaver.update({
|
|
266
|
+
ctx,
|
|
267
|
+
input,
|
|
268
|
+
entityType: ${entityRef.name},
|
|
269
|
+
translationType: ${(_a = entityRef.getTranslationClass()) === null || _a === void 0 ? void 0 : _a.getName()},
|
|
270
|
+
beforeSave: async f => {
|
|
271
|
+
// Any pre-save logic can go here
|
|
272
|
+
},
|
|
273
273
|
});`);
|
|
274
274
|
}
|
|
275
275
|
else {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { ID, Product, RequestContext, TransactionalConnection } from '@vendure/core';
|
|
3
|
-
|
|
4
|
-
@Injectable()
|
|
5
|
-
export class BasicServiceTemplate {
|
|
6
|
-
constructor(private connection: TransactionalConnection) {}
|
|
7
|
-
|
|
8
|
-
async exampleMethod(ctx: RequestContext, id: ID) {
|
|
9
|
-
// Add your method logic here
|
|
10
|
-
const result = await this.connection.getRepository(ctx, Product).findOne({ where: { id } });
|
|
11
|
-
return result;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { ID, Product, RequestContext, TransactionalConnection } from '@vendure/core';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class BasicServiceTemplate {
|
|
6
|
+
constructor(private connection: TransactionalConnection) {}
|
|
7
|
+
|
|
8
|
+
async exampleMethod(ctx: RequestContext, id: ID) {
|
|
9
|
+
// Add your method logic here
|
|
10
|
+
const result = await this.connection.getRepository(ctx, Product).findOne({ where: { id } });
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
}
|