@vendure/core 2.0.0-next.17 → 2.0.0-next.18
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/dist/api/config/generate-permissions.js +29 -29
- package/dist/api/config/generate-resolvers.d.ts +3 -0
- package/dist/api/resolvers/admin/collection.resolver.d.ts +4 -1
- package/dist/api/resolvers/admin/collection.resolver.js +39 -0
- package/dist/api/resolvers/admin/collection.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/facet.resolver.d.ts +5 -1
- package/dist/api/resolvers/admin/facet.resolver.js +39 -1
- package/dist/api/resolvers/admin/facet.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/product.resolver.d.ts +4 -1
- package/dist/api/resolvers/admin/product.resolver.js +40 -0
- package/dist/api/resolvers/admin/product.resolver.js.map +1 -1
- package/dist/api/schema/admin-api/collection.api.graphql +19 -0
- package/dist/api/schema/admin-api/facet.api.graphql +30 -0
- package/dist/api/schema/admin-api/product.api.graphql +9 -0
- package/dist/common/error/generated-graphql-admin-errors.d.ts +16 -0
- package/dist/common/error/generated-graphql-admin-errors.js +19 -2
- package/dist/common/error/generated-graphql-admin-errors.js.map +1 -1
- package/dist/config/order/changed-price-handling-strategy.d.ts +2 -1
- package/dist/config/order/order-item-price-calculation-strategy.d.ts +2 -1
- package/dist/config/promotion/promotion-action.d.ts +48 -0
- package/dist/config/promotion/promotion-action.js +18 -2
- package/dist/config/promotion/promotion-action.js.map +1 -1
- package/dist/entity/order/order.entity.js +5 -3
- package/dist/entity/order/order.entity.js.map +1 -1
- package/dist/entity/promotion/promotion.entity.d.ts +2 -0
- package/dist/entity/promotion/promotion.entity.js +12 -0
- package/dist/entity/promotion/promotion.entity.js.map +1 -1
- package/dist/i18n/messages/en.json +4 -1
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js +4 -4
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js +5 -5
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js +4 -4
- package/dist/service/helpers/order-calculator/order-calculator.d.ts +1 -0
- package/dist/service/helpers/order-calculator/order-calculator.js +11 -0
- package/dist/service/helpers/order-calculator/order-calculator.js.map +1 -1
- package/dist/service/helpers/order-modifier/order-modifier.js +6 -16
- package/dist/service/helpers/order-modifier/order-modifier.js.map +1 -1
- package/dist/service/helpers/order-state-machine/order-state-machine.js +0 -1
- package/dist/service/helpers/order-state-machine/order-state-machine.js.map +1 -1
- package/dist/service/services/collection.service.d.ts +14 -2
- package/dist/service/services/collection.service.js +59 -2
- package/dist/service/services/collection.service.js.map +1 -1
- package/dist/service/services/facet-value.service.d.ts +1 -1
- package/dist/service/services/facet-value.service.js +21 -7
- package/dist/service/services/facet-value.service.js.map +1 -1
- package/dist/service/services/facet.service.d.ts +15 -2
- package/dist/service/services/facet.service.js +80 -3
- package/dist/service/services/facet.service.js.map +1 -1
- package/dist/service/services/order-testing.service.js +1 -1
- package/dist/service/services/order-testing.service.js.map +1 -1
- package/dist/service/services/order.service.js +6 -13
- package/dist/service/services/order.service.js.map +1 -1
- package/dist/service/services/promotion.service.d.ts +5 -0
- package/dist/service/services/promotion.service.js +38 -0
- package/dist/service/services/promotion.service.js.map +1 -1
- package/dist/service/services/role.service.d.ts +5 -0
- package/dist/service/services/role.service.js +13 -1
- package/dist/service/services/role.service.js.map +1 -1
- package/package.json +3 -3
|
@@ -4,35 +4,35 @@ exports.generatePermissionEnum = void 0;
|
|
|
4
4
|
const stitch_1 = require("@graphql-tools/stitch");
|
|
5
5
|
const graphql_1 = require("graphql");
|
|
6
6
|
const constants_1 = require("../../common/constants");
|
|
7
|
-
const PERMISSION_DESCRIPTION = `@description
|
|
8
|
-
Permissions for administrators and customers. Used to control access to
|
|
9
|
-
GraphQL resolvers via the {@link Allow} decorator.
|
|
10
|
-
|
|
11
|
-
## Understanding Permission.Owner
|
|
12
|
-
|
|
13
|
-
\`Permission.Owner\` is a special permission which is used in some Vendure resolvers to indicate that that resolver should only
|
|
14
|
-
be accessible to the "owner" of that resource.
|
|
15
|
-
|
|
16
|
-
For example, the Shop API \`activeCustomer\` query resolver should only return the Customer object for the "owner" of that Customer, i.e.
|
|
17
|
-
based on the activeUserId of the current session. As a result, the resolver code looks like this:
|
|
18
|
-
|
|
19
|
-
@example
|
|
20
|
-
\`\`\`TypeScript
|
|
21
|
-
\\@Query()
|
|
22
|
-
\\@Allow(Permission.Owner)
|
|
23
|
-
async activeCustomer(\\@Ctx() ctx: RequestContext): Promise<Customer | undefined> {
|
|
24
|
-
const userId = ctx.activeUserId;
|
|
25
|
-
if (userId) {
|
|
26
|
-
return this.customerService.findOneByUserId(ctx, userId);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
\`\`\`
|
|
30
|
-
|
|
31
|
-
Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally
|
|
32
|
-
nor statically encoded at build-time, any resolvers using \`Permission.Owner\` **must** include logic to enforce that only the owner
|
|
33
|
-
of the resource has access. If not, then it is the equivalent of using \`Permission.Public\`.
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
const PERMISSION_DESCRIPTION = `@description
|
|
8
|
+
Permissions for administrators and customers. Used to control access to
|
|
9
|
+
GraphQL resolvers via the {@link Allow} decorator.
|
|
10
|
+
|
|
11
|
+
## Understanding Permission.Owner
|
|
12
|
+
|
|
13
|
+
\`Permission.Owner\` is a special permission which is used in some Vendure resolvers to indicate that that resolver should only
|
|
14
|
+
be accessible to the "owner" of that resource.
|
|
15
|
+
|
|
16
|
+
For example, the Shop API \`activeCustomer\` query resolver should only return the Customer object for the "owner" of that Customer, i.e.
|
|
17
|
+
based on the activeUserId of the current session. As a result, the resolver code looks like this:
|
|
18
|
+
|
|
19
|
+
@example
|
|
20
|
+
\`\`\`TypeScript
|
|
21
|
+
\\@Query()
|
|
22
|
+
\\@Allow(Permission.Owner)
|
|
23
|
+
async activeCustomer(\\@Ctx() ctx: RequestContext): Promise<Customer | undefined> {
|
|
24
|
+
const userId = ctx.activeUserId;
|
|
25
|
+
if (userId) {
|
|
26
|
+
return this.customerService.findOneByUserId(ctx, userId);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
\`\`\`
|
|
30
|
+
|
|
31
|
+
Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally
|
|
32
|
+
nor statically encoded at build-time, any resolvers using \`Permission.Owner\` **must** include logic to enforce that only the owner
|
|
33
|
+
of the resource has access. If not, then it is the equivalent of using \`Permission.Public\`.
|
|
34
|
+
|
|
35
|
+
|
|
36
36
|
@docsCategory common`;
|
|
37
37
|
/**
|
|
38
38
|
* Generates the `Permission` GraphQL enum based on the default & custom permission definitions.
|
|
@@ -45,6 +45,9 @@ export declare function generateResolvers(configService: ConfigService, customFi
|
|
|
45
45
|
RefundOrderResult: {
|
|
46
46
|
__resolveType(value: any): any;
|
|
47
47
|
};
|
|
48
|
+
RemoveFacetFromChannelResult: {
|
|
49
|
+
__resolveType(value: any): any;
|
|
50
|
+
};
|
|
48
51
|
RemoveOptionGroupFromProductResult: {
|
|
49
52
|
__resolveType(value: any): any;
|
|
50
53
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigurableOperationDefinition, DeletionResponse, MutationCreateCollectionArgs, MutationDeleteCollectionArgs, MutationMoveCollectionArgs, MutationUpdateCollectionArgs, QueryCollectionArgs, QueryCollectionsArgs, QueryPreviewCollectionVariantsArgs } from '@vendure/common/lib/generated-types';
|
|
1
|
+
import { ConfigurableOperationDefinition, DeletionResponse, MutationAssignCollectionsToChannelArgs, MutationCreateCollectionArgs, MutationDeleteCollectionArgs, MutationDeleteCollectionsArgs, MutationMoveCollectionArgs, MutationRemoveCollectionsFromChannelArgs, MutationUpdateCollectionArgs, QueryCollectionArgs, QueryCollectionsArgs, QueryPreviewCollectionVariantsArgs } from '@vendure/common/lib/generated-types';
|
|
2
2
|
import { PaginatedList } from '@vendure/common/lib/shared-types';
|
|
3
3
|
import { Translated } from '../../../common/types/locale-types';
|
|
4
4
|
import { Collection } from '../../../entity/collection/collection.entity';
|
|
@@ -20,8 +20,11 @@ export declare class CollectionResolver {
|
|
|
20
20
|
updateCollection(ctx: RequestContext, args: MutationUpdateCollectionArgs): Promise<Translated<Collection>>;
|
|
21
21
|
moveCollection(ctx: RequestContext, args: MutationMoveCollectionArgs): Promise<Translated<Collection>>;
|
|
22
22
|
deleteCollection(ctx: RequestContext, args: MutationDeleteCollectionArgs): Promise<DeletionResponse>;
|
|
23
|
+
deleteCollections(ctx: RequestContext, args: MutationDeleteCollectionsArgs): Promise<DeletionResponse[]>;
|
|
23
24
|
/**
|
|
24
25
|
* Encodes any entity IDs used in the filter arguments.
|
|
25
26
|
*/
|
|
26
27
|
private encodeFilters;
|
|
28
|
+
assignCollectionsToChannel(ctx: RequestContext, args: MutationAssignCollectionsToChannelArgs): Promise<Array<Translated<Collection>>>;
|
|
29
|
+
removeCollectionsFromChannel(ctx: RequestContext, args: MutationRemoveCollectionsFromChannelArgs): Promise<Array<Translated<Collection>>>;
|
|
27
30
|
}
|
|
@@ -87,6 +87,15 @@ let CollectionResolver = class CollectionResolver {
|
|
|
87
87
|
async deleteCollection(ctx, args) {
|
|
88
88
|
return this.collectionService.delete(ctx, args.id);
|
|
89
89
|
}
|
|
90
|
+
async deleteCollections(ctx, args) {
|
|
91
|
+
return Promise.all(args.ids.map(id => this.collectionService.delete(ctx, id)));
|
|
92
|
+
}
|
|
93
|
+
async assignCollectionsToChannel(ctx, args) {
|
|
94
|
+
return await this.collectionService.assignCollectionsToChannel(ctx, args.input);
|
|
95
|
+
}
|
|
96
|
+
async removeCollectionsFromChannel(ctx, args) {
|
|
97
|
+
return await this.collectionService.removeCollectionsFromChannel(ctx, args.input);
|
|
98
|
+
}
|
|
90
99
|
};
|
|
91
100
|
__decorate([
|
|
92
101
|
(0, graphql_1.Query)(),
|
|
@@ -172,6 +181,36 @@ __decorate([
|
|
|
172
181
|
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
173
182
|
__metadata("design:returntype", Promise)
|
|
174
183
|
], CollectionResolver.prototype, "deleteCollection", null);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
186
|
+
(0, graphql_1.Mutation)(),
|
|
187
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.DeleteCatalog, generated_types_1.Permission.DeleteCollection),
|
|
188
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
189
|
+
__param(1, (0, graphql_1.Args)()),
|
|
190
|
+
__metadata("design:type", Function),
|
|
191
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
192
|
+
__metadata("design:returntype", Promise)
|
|
193
|
+
], CollectionResolver.prototype, "deleteCollections", null);
|
|
194
|
+
__decorate([
|
|
195
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
196
|
+
(0, graphql_1.Mutation)(),
|
|
197
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.CreateCatalog, generated_types_1.Permission.CreateCollection),
|
|
198
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
199
|
+
__param(1, (0, graphql_1.Args)()),
|
|
200
|
+
__metadata("design:type", Function),
|
|
201
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
202
|
+
__metadata("design:returntype", Promise)
|
|
203
|
+
], CollectionResolver.prototype, "assignCollectionsToChannel", null);
|
|
204
|
+
__decorate([
|
|
205
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
206
|
+
(0, graphql_1.Mutation)(),
|
|
207
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.DeleteCatalog, generated_types_1.Permission.DeleteCollection),
|
|
208
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
209
|
+
__param(1, (0, graphql_1.Args)()),
|
|
210
|
+
__metadata("design:type", Function),
|
|
211
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
212
|
+
__metadata("design:returntype", Promise)
|
|
213
|
+
], CollectionResolver.prototype, "removeCollectionsFromChannel", null);
|
|
175
214
|
CollectionResolver = __decorate([
|
|
176
215
|
(0, graphql_1.Resolver)(),
|
|
177
216
|
__metadata("design:paramtypes", [collection_service_1.CollectionService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/admin/collection.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"collection.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/admin/collection.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,yEAc6C;AAG7C,yDAA8D;AAE9D,iFAA6E;AAC7E,oFAA0E;AAC1E,qFAAiF;AACjF,uFAAkF;AAClF,4FAAuF;AACvF,kEAA8D;AAC9D,sEAAyD;AACzD,8EAAgF;AAChF,0FAAiE;AACjE,kFAAqE;AAGrE,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAC3B,YACY,iBAAoC,EACpC,iBAAoC,EACpC,0BAAsD;QAFtD,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,+BAA0B,GAA1B,0BAA0B,CAA4B;QAqHlE;;WAEG;QACK,kBAAa,GAAG,CAAmC,UAAa,EAAK,EAAE;YAC3E,IAAI,UAAU,EAAE;gBACZ,IAAI,CAAC,0BAA0B,CAAC,8BAA8B,CAC1D,oCAAgB,EAChB,UAAU,CAAC,OAAO,CACrB,CAAC;aACL;YACD,OAAO,UAAU,CAAC;QACtB,CAAC,CAAC;IA/HC,CAAC;IAIJ,KAAK,CAAC,iBAAiB,CACZ,GAAmB,EAClB,IAA0B;QAElC,OAAO,IAAI,CAAC,iBAAiB,CAAC,mBA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,4BAAU,CAAC,gBAAgB,CAAC;IAExD,WAAA,IAAA,+BAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAI,GAAE,CAAA;;qCADK,gCAAc;;0DAI7B;AAKD;IAHC,IAAA,mCAAW,GAAE;IACb,IAAA,kBAAQ,GAAE;IACV,IAAA,uBAAK,EAAC,4BAAU,CAAC,aAAa,EAAE,4BAAU,CAAC,gBAAgB,CAAC;IAExD,WAAA,IAAA,+BAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAI,GAAE,CAAA;;qCADK,gCAAc;;2DAI7B;AAkBD;IAHC,IAAA,mCAAW,GAAE;IACb,IAAA,kBAAQ,GAAE;IACV,IAAA,uBAAK,EAAC,4BAAU,CAAC,aAAa,EAAE,4BAAU,CAAC,gBAAgB,CAAC;IAExD,WAAA,IAAA,+BAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAI,GAAE,CAAA;;qCADK,gCAAc;;oEAI7B;AAKD;IAHC,IAAA,mCAAW,GAAE;IACb,IAAA,kBAAQ,GAAE;IACV,IAAA,uBAAK,EAAC,4BAAU,CAAC,aAAa,EAAE,4BAAU,CAAC,gBAAgB,CAAC;IAExD,WAAA,IAAA,+BAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAI,GAAE,CAAA;;qCADK,gCAAc;;sEAI7B;AAxJQ,kBAAkB;IAD9B,IAAA,kBAAQ,GAAE;qCAGwB,sCAAiB;QACjB,uCAAiB;QACR,yDAA0B;GAJzD,kBAAkB,CAyJ9B;AAzJY,gDAAkB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DeletionResponse, MutationCreateFacetArgs, MutationCreateFacetValuesArgs, MutationDeleteFacetArgs, MutationDeleteFacetValuesArgs, MutationUpdateFacetArgs, MutationUpdateFacetValuesArgs, QueryFacetArgs, QueryFacetsArgs } from '@vendure/common/lib/generated-types';
|
|
1
|
+
import { DeletionResponse, MutationAssignFacetsToChannelArgs, MutationCreateFacetArgs, MutationCreateFacetValuesArgs, MutationDeleteFacetArgs, MutationDeleteFacetsArgs, MutationDeleteFacetValuesArgs, MutationRemoveFacetsFromChannelArgs, MutationUpdateFacetArgs, MutationUpdateFacetValuesArgs, QueryFacetArgs, QueryFacetsArgs, RemoveFacetFromChannelResult } from '@vendure/common/lib/generated-types';
|
|
2
2
|
import { PaginatedList } from '@vendure/common/lib/shared-types';
|
|
3
|
+
import { ErrorResultUnion } from '../../../common/index';
|
|
3
4
|
import { Translated } from '../../../common/types/locale-types';
|
|
4
5
|
import { ConfigService } from '../../../config/config.service';
|
|
5
6
|
import { FacetValue } from '../../../entity/facet-value/facet-value.entity';
|
|
@@ -18,7 +19,10 @@ export declare class FacetResolver {
|
|
|
18
19
|
createFacet(ctx: RequestContext, args: MutationCreateFacetArgs): Promise<Translated<Facet>>;
|
|
19
20
|
updateFacet(ctx: RequestContext, args: MutationUpdateFacetArgs): Promise<Translated<Facet>>;
|
|
20
21
|
deleteFacet(ctx: RequestContext, args: MutationDeleteFacetArgs): Promise<DeletionResponse>;
|
|
22
|
+
deleteFacets(ctx: RequestContext, args: MutationDeleteFacetsArgs): Promise<DeletionResponse[]>;
|
|
21
23
|
createFacetValues(ctx: RequestContext, args: MutationCreateFacetValuesArgs): Promise<Array<Translated<FacetValue>>>;
|
|
22
24
|
updateFacetValues(ctx: RequestContext, args: MutationUpdateFacetValuesArgs): Promise<Array<Translated<FacetValue>>>;
|
|
23
25
|
deleteFacetValues(ctx: RequestContext, args: MutationDeleteFacetValuesArgs): Promise<DeletionResponse[]>;
|
|
26
|
+
assignFacetsToChannel(ctx: RequestContext, args: MutationAssignFacetsToChannelArgs): Promise<Facet[]>;
|
|
27
|
+
removeFacetsFromChannel(ctx: RequestContext, args: MutationRemoveFacetsFromChannelArgs): Promise<Array<ErrorResultUnion<RemoveFacetFromChannelResult, Facet>>>;
|
|
24
28
|
}
|
|
@@ -55,6 +55,9 @@ let FacetResolver = class FacetResolver {
|
|
|
55
55
|
async deleteFacet(ctx, args) {
|
|
56
56
|
return this.facetService.delete(ctx, args.id, args.force || false);
|
|
57
57
|
}
|
|
58
|
+
async deleteFacets(ctx, args) {
|
|
59
|
+
return Promise.all(args.ids.map(id => this.facetService.delete(ctx, id, args.force || false)));
|
|
60
|
+
}
|
|
58
61
|
async createFacetValues(ctx, args) {
|
|
59
62
|
const { input } = args;
|
|
60
63
|
const facetId = input[0].facetId;
|
|
@@ -74,13 +77,18 @@ let FacetResolver = class FacetResolver {
|
|
|
74
77
|
return Promise.all(input.map(facetValue => this.facetValueService.update(ctx, facetValue)));
|
|
75
78
|
}
|
|
76
79
|
async deleteFacetValues(ctx, args) {
|
|
77
|
-
// return Promise.all(args.ids.map(id => this.facetValueService.delete(ctx, id, args.force || false)));
|
|
78
80
|
const results = [];
|
|
79
81
|
for (const id of args.ids) {
|
|
80
82
|
results.push(await this.facetValueService.delete(ctx, id, args.force || false));
|
|
81
83
|
}
|
|
82
84
|
return results;
|
|
83
85
|
}
|
|
86
|
+
async assignFacetsToChannel(ctx, args) {
|
|
87
|
+
return await this.facetService.assignFacetsToChannel(ctx, args.input);
|
|
88
|
+
}
|
|
89
|
+
async removeFacetsFromChannel(ctx, args) {
|
|
90
|
+
return await this.facetService.removeFacetsFromChannel(ctx, args.input);
|
|
91
|
+
}
|
|
84
92
|
};
|
|
85
93
|
__decorate([
|
|
86
94
|
(0, graphql_1.Query)(),
|
|
@@ -132,6 +140,16 @@ __decorate([
|
|
|
132
140
|
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
133
141
|
__metadata("design:returntype", Promise)
|
|
134
142
|
], FacetResolver.prototype, "deleteFacet", null);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
145
|
+
(0, graphql_1.Mutation)(),
|
|
146
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.DeleteCatalog, generated_types_1.Permission.DeleteFacet),
|
|
147
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
148
|
+
__param(1, (0, graphql_1.Args)()),
|
|
149
|
+
__metadata("design:type", Function),
|
|
150
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
151
|
+
__metadata("design:returntype", Promise)
|
|
152
|
+
], FacetResolver.prototype, "deleteFacets", null);
|
|
135
153
|
__decorate([
|
|
136
154
|
(0, transaction_decorator_1.Transaction)(),
|
|
137
155
|
(0, graphql_1.Mutation)(),
|
|
@@ -162,6 +180,26 @@ __decorate([
|
|
|
162
180
|
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
163
181
|
__metadata("design:returntype", Promise)
|
|
164
182
|
], FacetResolver.prototype, "deleteFacetValues", null);
|
|
183
|
+
__decorate([
|
|
184
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
185
|
+
(0, graphql_1.Mutation)(),
|
|
186
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.CreateCatalog, generated_types_1.Permission.CreateFacet),
|
|
187
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
188
|
+
__param(1, (0, graphql_1.Args)()),
|
|
189
|
+
__metadata("design:type", Function),
|
|
190
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
191
|
+
__metadata("design:returntype", Promise)
|
|
192
|
+
], FacetResolver.prototype, "assignFacetsToChannel", null);
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
195
|
+
(0, graphql_1.Mutation)(),
|
|
196
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.DeleteCatalog, generated_types_1.Permission.DeleteFacet),
|
|
197
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
198
|
+
__param(1, (0, graphql_1.Args)()),
|
|
199
|
+
__metadata("design:type", Function),
|
|
200
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
201
|
+
__metadata("design:returntype", Promise)
|
|
202
|
+
], FacetResolver.prototype, "removeFacetsFromChannel", null);
|
|
165
203
|
FacetResolver = __decorate([
|
|
166
204
|
(0, graphql_1.Resolver)('Facet'),
|
|
167
205
|
__metadata("design:paramtypes", [facet_service_1.FacetService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/admin/facet.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"facet.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/admin/facet.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,yEAe6C;AAG7C,yDAAmE;AAGnE,mEAA+D;AAE/D,qEAA2D;AAC3D,uFAAkF;AAClF,2EAAuE;AACvE,kEAA8D;AAC9D,sEAAyD;AACzD,8EAAgF;AAChF,0FAAiE;AACjE,kFAAqE;AAGrE,IAAa,aAAa,GAA1B,MAAa,aAAa;IACtB,YACY,YAA0B,EAC1B,iBAAoC,EACpC,aAA4B;QAF5B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,kBAAa,GAAb,aAAa,CAAe;IACrC,CAAC;IAIJ,MAAM,CACK,GAAmB,EAClB,IAAqB,EACX,SAA+B;QAEjD,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,IAAI,SAAS,EAAE,SAAS,CAAC,CAAC;IAChF,CAAC;IAID,KAAK,CAAC,KAAK,CACA,GAAmB,EAClB,IAAoB,EACV,SAA+B;QAEjD,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IAC9D,CAAC;IAKD,KAAK,CAAC,WAAW,CACN,GAAmB,EAClB,IAA6B;QAErC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,C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AAC,aAAa,EAAE,4BAAU,CAAC,WAAW,CAAC;IAEnD,WAAA,IAAA,+BAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAI,GAAE,CAAA;;qCADK,gCAAc;;0DAI7B;AAKD;IAHC,IAAA,mCAAW,GAAE;IACb,IAAA,kBAAQ,GAAE;IACV,IAAA,uBAAK,EAAC,4BAAU,CAAC,aAAa,EAAE,4BAAU,CAAC,WAAW,CAAC;IAEnD,WAAA,IAAA,+BAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAI,GAAE,CAAA;;qCADK,gCAAc;;4DAI7B;AA7IQ,aAAa;IADzB,IAAA,kBAAQ,EAAC,OAAO,CAAC;qCAGY,4BAAY;QACP,uCAAiB;QACrB,8BAAa;GAJ/B,aAAa,CA8IzB;AA9IY,sCAAa"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeletionResponse, MutationAddOptionGroupToProductArgs, MutationAssignProductsToChannelArgs, MutationAssignProductVariantsToChannelArgs, MutationCreateProductArgs, MutationCreateProductVariantsArgs, MutationDeleteProductArgs, MutationDeleteProductVariantArgs, MutationRemoveOptionGroupFromProductArgs, MutationRemoveProductsFromChannelArgs, MutationRemoveProductVariantsFromChannelArgs, MutationUpdateProductArgs, MutationUpdateProductVariantsArgs, QueryProductArgs, QueryProductsArgs, QueryProductVariantArgs, QueryProductVariantsArgs, RemoveOptionGroupFromProductResult } from '@vendure/common/lib/generated-types';
|
|
1
|
+
import { DeletionResponse, MutationAddOptionGroupToProductArgs, MutationAssignProductsToChannelArgs, MutationAssignProductVariantsToChannelArgs, MutationCreateProductArgs, MutationCreateProductVariantsArgs, MutationDeleteProductArgs, MutationDeleteProductsArgs, MutationDeleteProductVariantArgs, MutationDeleteProductVariantsArgs, MutationRemoveOptionGroupFromProductArgs, MutationRemoveProductsFromChannelArgs, MutationRemoveProductVariantsFromChannelArgs, MutationUpdateProductArgs, MutationUpdateProductsArgs, MutationUpdateProductVariantsArgs, QueryProductArgs, QueryProductsArgs, QueryProductVariantArgs, QueryProductVariantsArgs, RemoveOptionGroupFromProductResult } from '@vendure/common/lib/generated-types';
|
|
2
2
|
import { PaginatedList } from '@vendure/common/lib/shared-types';
|
|
3
3
|
import { ErrorResultUnion } from '../../../common/error/error-result';
|
|
4
4
|
import { Translated } from '../../../common/types/locale-types';
|
|
@@ -20,12 +20,15 @@ export declare class ProductResolver {
|
|
|
20
20
|
productVariant(ctx: RequestContext, args: QueryProductVariantArgs): Promise<Translated<ProductVariant> | undefined>;
|
|
21
21
|
createProduct(ctx: RequestContext, args: MutationCreateProductArgs): Promise<Translated<Product>>;
|
|
22
22
|
updateProduct(ctx: RequestContext, args: MutationUpdateProductArgs): Promise<Translated<Product>>;
|
|
23
|
+
updateProducts(ctx: RequestContext, args: MutationUpdateProductsArgs): Promise<Array<Translated<Product>>>;
|
|
23
24
|
deleteProduct(ctx: RequestContext, args: MutationDeleteProductArgs): Promise<DeletionResponse>;
|
|
25
|
+
deleteProducts(ctx: RequestContext, args: MutationDeleteProductsArgs): Promise<DeletionResponse[]>;
|
|
24
26
|
addOptionGroupToProduct(ctx: RequestContext, args: MutationAddOptionGroupToProductArgs): Promise<Translated<Product>>;
|
|
25
27
|
removeOptionGroupFromProduct(ctx: RequestContext, args: MutationRemoveOptionGroupFromProductArgs): Promise<ErrorResultUnion<RemoveOptionGroupFromProductResult, Translated<Product>>>;
|
|
26
28
|
createProductVariants(ctx: RequestContext, args: MutationCreateProductVariantsArgs): Promise<Array<Translated<ProductVariant>>>;
|
|
27
29
|
updateProductVariants(ctx: RequestContext, args: MutationUpdateProductVariantsArgs): Promise<Array<Translated<ProductVariant>>>;
|
|
28
30
|
deleteProductVariant(ctx: RequestContext, args: MutationDeleteProductVariantArgs): Promise<DeletionResponse>;
|
|
31
|
+
deleteProductVariants(ctx: RequestContext, args: MutationDeleteProductVariantsArgs): Promise<DeletionResponse[]>;
|
|
29
32
|
assignProductsToChannel(ctx: RequestContext, args: MutationAssignProductsToChannelArgs): Promise<Array<Translated<Product>>>;
|
|
30
33
|
removeProductsFromChannel(ctx: RequestContext, args: MutationRemoveProductsFromChannelArgs): Promise<Array<Translated<Product>>>;
|
|
31
34
|
assignProductVariantsToChannel(ctx: RequestContext, args: MutationAssignProductVariantsToChannelArgs): Promise<Array<Translated<ProductVariant>>>;
|
|
@@ -67,9 +67,16 @@ let ProductResolver = class ProductResolver {
|
|
|
67
67
|
const { input } = args;
|
|
68
68
|
return await this.productService.update(ctx, input);
|
|
69
69
|
}
|
|
70
|
+
async updateProducts(ctx, args) {
|
|
71
|
+
const { input } = args;
|
|
72
|
+
return await Promise.all(args.input.map(i => this.productService.update(ctx, i)));
|
|
73
|
+
}
|
|
70
74
|
async deleteProduct(ctx, args) {
|
|
71
75
|
return this.productService.softDelete(ctx, args.id);
|
|
72
76
|
}
|
|
77
|
+
async deleteProducts(ctx, args) {
|
|
78
|
+
return Promise.all(args.ids.map(id => this.productService.softDelete(ctx, id)));
|
|
79
|
+
}
|
|
73
80
|
async addOptionGroupToProduct(ctx, args) {
|
|
74
81
|
const { productId, optionGroupId } = args;
|
|
75
82
|
return this.productService.addOptionGroupToProduct(ctx, productId, optionGroupId);
|
|
@@ -89,6 +96,9 @@ let ProductResolver = class ProductResolver {
|
|
|
89
96
|
async deleteProductVariant(ctx, args) {
|
|
90
97
|
return this.productVariantService.softDelete(ctx, args.id);
|
|
91
98
|
}
|
|
99
|
+
async deleteProductVariants(ctx, args) {
|
|
100
|
+
return Promise.all(args.ids.map(id => this.productVariantService.softDelete(ctx, id)));
|
|
101
|
+
}
|
|
92
102
|
async assignProductsToChannel(ctx, args) {
|
|
93
103
|
return this.productService.assignProductsToChannel(ctx, args.input);
|
|
94
104
|
}
|
|
@@ -161,6 +171,16 @@ __decorate([
|
|
|
161
171
|
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
162
172
|
__metadata("design:returntype", Promise)
|
|
163
173
|
], ProductResolver.prototype, "updateProduct", null);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
176
|
+
(0, graphql_1.Mutation)(),
|
|
177
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.UpdateCatalog, generated_types_1.Permission.UpdateProduct),
|
|
178
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
179
|
+
__param(1, (0, graphql_1.Args)()),
|
|
180
|
+
__metadata("design:type", Function),
|
|
181
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
182
|
+
__metadata("design:returntype", Promise)
|
|
183
|
+
], ProductResolver.prototype, "updateProducts", null);
|
|
164
184
|
__decorate([
|
|
165
185
|
(0, transaction_decorator_1.Transaction)(),
|
|
166
186
|
(0, graphql_1.Mutation)(),
|
|
@@ -171,6 +191,16 @@ __decorate([
|
|
|
171
191
|
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
172
192
|
__metadata("design:returntype", Promise)
|
|
173
193
|
], ProductResolver.prototype, "deleteProduct", null);
|
|
194
|
+
__decorate([
|
|
195
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
196
|
+
(0, graphql_1.Mutation)(),
|
|
197
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.DeleteCatalog, generated_types_1.Permission.DeleteProduct),
|
|
198
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
199
|
+
__param(1, (0, graphql_1.Args)()),
|
|
200
|
+
__metadata("design:type", Function),
|
|
201
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
202
|
+
__metadata("design:returntype", Promise)
|
|
203
|
+
], ProductResolver.prototype, "deleteProducts", null);
|
|
174
204
|
__decorate([
|
|
175
205
|
(0, transaction_decorator_1.Transaction)(),
|
|
176
206
|
(0, graphql_1.Mutation)(),
|
|
@@ -221,6 +251,16 @@ __decorate([
|
|
|
221
251
|
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
222
252
|
__metadata("design:returntype", Promise)
|
|
223
253
|
], ProductResolver.prototype, "deleteProductVariant", null);
|
|
254
|
+
__decorate([
|
|
255
|
+
(0, transaction_decorator_1.Transaction)(),
|
|
256
|
+
(0, graphql_1.Mutation)(),
|
|
257
|
+
(0, allow_decorator_1.Allow)(generated_types_1.Permission.DeleteCatalog, generated_types_1.Permission.DeleteProduct),
|
|
258
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
259
|
+
__param(1, (0, graphql_1.Args)()),
|
|
260
|
+
__metadata("design:type", Function),
|
|
261
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, Object]),
|
|
262
|
+
__metadata("design:returntype", Promise)
|
|
263
|
+
], ProductResolver.prototype, "deleteProductVariants", null);
|
|
224
264
|
__decorate([
|
|
225
265
|
(0, transaction_decorator_1.Transaction)(),
|
|
226
266
|
(0, graphql_1.Mutation)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/admin/product.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"product.resolver.js","sourceRoot":"","sources":["../../../../src/api/resolvers/admin/product.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAkE;AAClE,yEAuB6C;AAI7C,yDAA8D;AAE9D,mGAAwF;AACxF,2EAAiE;AACjE,uFAAkF;AAClF,+FAA0F;AAC1F,+EAA2E;AAC3E,kEAA8D;AAC9D,sEAAyD;AACzD,8EAAgF;AAChF,0FAAiE;AACjE,kFAAqE;AAGrE,IAAa,eAAe,GAA5B,MAAa,eAAe;IACxB,YACY,cAA8B,EAC9B,qBAA4C,EAC5C,iBAAoC;QAFpC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,sBAAiB,GAAjB,iBAAiB,CAAmB;IAC7C,CAAC;IAIJ,KAAK,CAAC,QAAQ,CACH,GAAmB,EAClB,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IAAA,kBAAQ,GAAE;IACV,IAAA,uBAAK,EAAC,4BAAU,CAAC,aAAa,EAAE,4BAAU,CAAC,aAAa,CAAC;IAErD,WAAA,IAAA,+BAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAI,GAAE,CAAA;;qCADK,gCAAc;;uEAI7B;AA5NQ,eAAe;IAD3B,IAAA,kBAAQ,GAAE;qCAGqB,gCAAc;QACP,+CAAqB;QACzB,uCAAiB;GAJvC,eAAe,CA6N3B;AA7NY,0CAAe"}
|
|
@@ -17,8 +17,17 @@ type Mutation {
|
|
|
17
17
|
"Delete a Collection and all of its descendants"
|
|
18
18
|
deleteCollection(id: ID!): DeletionResponse!
|
|
19
19
|
|
|
20
|
+
"Delete multiple Collections and all of their descendants"
|
|
21
|
+
deleteCollections(ids: [ID!]!): [DeletionResponse!]!
|
|
22
|
+
|
|
20
23
|
"Move a Collection to a different parent or index"
|
|
21
24
|
moveCollection(input: MoveCollectionInput!): Collection!
|
|
25
|
+
|
|
26
|
+
"Assigns Collections to the specified Channel"
|
|
27
|
+
assignCollectionsToChannel(input: AssignCollectionsToChannelInput!): [Collection!]!
|
|
28
|
+
|
|
29
|
+
"Removes Collections from the specified Channel"
|
|
30
|
+
removeCollectionsFromChannel(input: RemoveCollectionsFromChannelInput!): [Collection!]!
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
# generated by generateListOptions function
|
|
@@ -71,3 +80,13 @@ input UpdateCollectionInput {
|
|
|
71
80
|
filters: [ConfigurableOperationInput!]
|
|
72
81
|
translations: [UpdateCollectionTranslationInput!]
|
|
73
82
|
}
|
|
83
|
+
|
|
84
|
+
input AssignCollectionsToChannelInput {
|
|
85
|
+
collectionIds: [ID!]!
|
|
86
|
+
channelId: ID!
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
input RemoveCollectionsFromChannelInput {
|
|
90
|
+
collectionIds: [ID!]!
|
|
91
|
+
channelId: ID!
|
|
92
|
+
}
|
|
@@ -13,6 +13,9 @@ type Mutation {
|
|
|
13
13
|
"Delete an existing Facet"
|
|
14
14
|
deleteFacet(id: ID!, force: Boolean): DeletionResponse!
|
|
15
15
|
|
|
16
|
+
"Delete multiple existing Facets"
|
|
17
|
+
deleteFacets(ids: [ID!]!, force: Boolean): [DeletionResponse!]!
|
|
18
|
+
|
|
16
19
|
"Create one or more FacetValues"
|
|
17
20
|
createFacetValues(input: [CreateFacetValueInput!]!): [FacetValue!]!
|
|
18
21
|
|
|
@@ -21,6 +24,12 @@ type Mutation {
|
|
|
21
24
|
|
|
22
25
|
"Delete one or more FacetValues"
|
|
23
26
|
deleteFacetValues(ids: [ID!]!, force: Boolean): [DeletionResponse!]!
|
|
27
|
+
|
|
28
|
+
"Assigns Facets to the specified Channel"
|
|
29
|
+
assignFacetsToChannel(input: AssignFacetsToChannelInput!): [Facet!]!
|
|
30
|
+
|
|
31
|
+
"Removes Facets from the specified Channel"
|
|
32
|
+
removeFacetsFromChannel(input: RemoveFacetsFromChannelInput!): [RemoveFacetFromChannelResult!]!
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
# generated by generateListOptions function
|
|
@@ -67,3 +76,24 @@ input UpdateFacetValueInput {
|
|
|
67
76
|
code: String
|
|
68
77
|
translations: [FacetValueTranslationInput!]
|
|
69
78
|
}
|
|
79
|
+
|
|
80
|
+
input AssignFacetsToChannelInput {
|
|
81
|
+
facetIds: [ID!]!
|
|
82
|
+
channelId: ID!
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
input RemoveFacetsFromChannelInput {
|
|
86
|
+
facetIds: [ID!]!
|
|
87
|
+
channelId: ID!
|
|
88
|
+
force: Boolean
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type FacetInUseError implements ErrorResult {
|
|
92
|
+
errorCode: ErrorCode!
|
|
93
|
+
message: String!
|
|
94
|
+
facetCode: String!
|
|
95
|
+
productCount: Int!
|
|
96
|
+
variantCount: Int!
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
union RemoveFacetFromChannelResult = Facet | FacetInUseError
|
|
@@ -16,9 +16,15 @@ type Mutation {
|
|
|
16
16
|
"Update an existing Product"
|
|
17
17
|
updateProduct(input: UpdateProductInput!): Product!
|
|
18
18
|
|
|
19
|
+
"Update multiple existing Products"
|
|
20
|
+
updateProducts(input: [UpdateProductInput!]!): [Product!]!
|
|
21
|
+
|
|
19
22
|
"Delete a Product"
|
|
20
23
|
deleteProduct(id: ID!): DeletionResponse!
|
|
21
24
|
|
|
25
|
+
"Delete multiple Products"
|
|
26
|
+
deleteProducts(ids: [ID!]!): [DeletionResponse!]!
|
|
27
|
+
|
|
22
28
|
"Add an OptionGroup to a Product"
|
|
23
29
|
addOptionGroupToProduct(productId: ID!, optionGroupId: ID!): Product!
|
|
24
30
|
|
|
@@ -34,6 +40,9 @@ type Mutation {
|
|
|
34
40
|
"Delete a ProductVariant"
|
|
35
41
|
deleteProductVariant(id: ID!): DeletionResponse!
|
|
36
42
|
|
|
43
|
+
"Delete multiple ProductVariants"
|
|
44
|
+
deleteProductVariants(ids: [ID!]!): [DeletionResponse!]!
|
|
45
|
+
|
|
37
46
|
"Assigns all ProductVariants of Product to the specified Channel"
|
|
38
47
|
assignProductsToChannel(input: AssignProductsToChannelInput!): [Product!]!
|
|
39
48
|
|
|
@@ -102,6 +102,19 @@ export declare class EmptyOrderLineSelectionError extends ErrorResult {
|
|
|
102
102
|
readonly message = "EMPTY_ORDER_LINE_SELECTION_ERROR";
|
|
103
103
|
constructor();
|
|
104
104
|
}
|
|
105
|
+
export declare class FacetInUseError extends ErrorResult {
|
|
106
|
+
readonly __typename = "FacetInUseError";
|
|
107
|
+
readonly errorCode: any;
|
|
108
|
+
readonly message = "FACET_IN_USE_ERROR";
|
|
109
|
+
readonly facetCode: Scalars['String'];
|
|
110
|
+
readonly productCount: Scalars['Int'];
|
|
111
|
+
readonly variantCount: Scalars['Int'];
|
|
112
|
+
constructor(input: {
|
|
113
|
+
facetCode: Scalars['String'];
|
|
114
|
+
productCount: Scalars['Int'];
|
|
115
|
+
variantCount: Scalars['Int'];
|
|
116
|
+
});
|
|
117
|
+
}
|
|
105
118
|
export declare class FulfillmentStateTransitionError extends ErrorResult {
|
|
106
119
|
readonly __typename = "FulfillmentStateTransitionError";
|
|
107
120
|
readonly errorCode: any;
|
|
@@ -366,6 +379,9 @@ export declare const adminErrorOperationTypeResolvers: {
|
|
|
366
379
|
RefundOrderResult: {
|
|
367
380
|
__resolveType(value: any): any;
|
|
368
381
|
};
|
|
382
|
+
RemoveFacetFromChannelResult: {
|
|
383
|
+
__resolveType(value: any): any;
|
|
384
|
+
};
|
|
369
385
|
RemoveOptionGroupFromProductResult: {
|
|
370
386
|
__resolveType(value: any): any;
|
|
371
387
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// tslint:disable
|
|
3
3
|
/** This file was generated by the graphql-errors-plugin, which is part of the "codegen" npm script. */
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.adminErrorOperationTypeResolvers = exports.SettlePaymentError = exports.RefundStateTransitionError = exports.RefundPaymentIdMissingError = exports.RefundOrderStateError = exports.QuantityTooGreatError = exports.ProductOptionInUseError = exports.PaymentStateTransitionError = exports.PaymentOrderMismatchError = exports.PaymentMethodMissingError = exports.OrderStateTransitionError = exports.OrderModificationStateError = exports.OrderLimitError = exports.NothingToRefundError = exports.NoChangesSpecifiedError = exports.NegativeQuantityError = exports.NativeAuthStrategyError = exports.MultipleOrderError = exports.MissingConditionsError = exports.MimeTypeError = exports.ManualPaymentStateError = exports.LanguageNotAvailableError = exports.ItemsAlreadyFulfilledError = exports.InvalidFulfillmentHandlerError = exports.InvalidCredentialsError = exports.InsufficientStockOnHandError = exports.InsufficientStockError = exports.FulfillmentStateTransitionError = exports.EmptyOrderLineSelectionError = exports.EmailAddressConflictError = exports.CreateFulfillmentError = exports.CouponCodeLimitError = exports.CouponCodeInvalidError = exports.CouponCodeExpiredError = exports.ChannelDefaultLanguageError = exports.CancelPaymentError = exports.CancelActiveOrderError = exports.AlreadyRefundedError = exports.ErrorResult = void 0;
|
|
5
|
+
exports.adminErrorOperationTypeResolvers = exports.SettlePaymentError = exports.RefundStateTransitionError = exports.RefundPaymentIdMissingError = exports.RefundOrderStateError = exports.QuantityTooGreatError = exports.ProductOptionInUseError = exports.PaymentStateTransitionError = exports.PaymentOrderMismatchError = exports.PaymentMethodMissingError = exports.OrderStateTransitionError = exports.OrderModificationStateError = exports.OrderLimitError = exports.NothingToRefundError = exports.NoChangesSpecifiedError = exports.NegativeQuantityError = exports.NativeAuthStrategyError = exports.MultipleOrderError = exports.MissingConditionsError = exports.MimeTypeError = exports.ManualPaymentStateError = exports.LanguageNotAvailableError = exports.ItemsAlreadyFulfilledError = exports.InvalidFulfillmentHandlerError = exports.InvalidCredentialsError = exports.InsufficientStockOnHandError = exports.InsufficientStockError = exports.FulfillmentStateTransitionError = exports.FacetInUseError = exports.EmptyOrderLineSelectionError = exports.EmailAddressConflictError = exports.CreateFulfillmentError = exports.CouponCodeLimitError = exports.CouponCodeInvalidError = exports.CouponCodeExpiredError = exports.ChannelDefaultLanguageError = exports.CancelPaymentError = exports.CancelActiveOrderError = exports.AlreadyRefundedError = exports.ErrorResult = void 0;
|
|
6
6
|
class ErrorResult {
|
|
7
7
|
}
|
|
8
8
|
exports.ErrorResult = ErrorResult;
|
|
@@ -106,6 +106,18 @@ class EmptyOrderLineSelectionError extends ErrorResult {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
exports.EmptyOrderLineSelectionError = EmptyOrderLineSelectionError;
|
|
109
|
+
class FacetInUseError extends ErrorResult {
|
|
110
|
+
constructor(input) {
|
|
111
|
+
super();
|
|
112
|
+
this.__typename = 'FacetInUseError';
|
|
113
|
+
this.errorCode = 'FACET_IN_USE_ERROR';
|
|
114
|
+
this.message = 'FACET_IN_USE_ERROR';
|
|
115
|
+
this.facetCode = input.facetCode;
|
|
116
|
+
this.productCount = input.productCount;
|
|
117
|
+
this.variantCount = input.variantCount;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.FacetInUseError = FacetInUseError;
|
|
109
121
|
class FulfillmentStateTransitionError extends ErrorResult {
|
|
110
122
|
constructor(input) {
|
|
111
123
|
super();
|
|
@@ -375,7 +387,7 @@ class SettlePaymentError extends ErrorResult {
|
|
|
375
387
|
}
|
|
376
388
|
}
|
|
377
389
|
exports.SettlePaymentError = SettlePaymentError;
|
|
378
|
-
const errorTypeNames = new Set(['AlreadyRefundedError', 'CancelActiveOrderError', 'CancelPaymentError', 'ChannelDefaultLanguageError', 'CouponCodeExpiredError', 'CouponCodeInvalidError', 'CouponCodeLimitError', 'CreateFulfillmentError', 'EmailAddressConflictError', 'EmptyOrderLineSelectionError', 'FulfillmentStateTransitionError', 'InsufficientStockError', 'InsufficientStockOnHandError', 'InvalidCredentialsError', 'InvalidFulfillmentHandlerError', 'ItemsAlreadyFulfilledError', 'LanguageNotAvailableError', 'ManualPaymentStateError', 'MimeTypeError', 'MissingConditionsError', 'MultipleOrderError', 'NativeAuthStrategyError', 'NegativeQuantityError', 'NoChangesSpecifiedError', 'NothingToRefundError', 'OrderLimitError', 'OrderModificationStateError', 'OrderStateTransitionError', 'PaymentMethodMissingError', 'PaymentOrderMismatchError', 'PaymentStateTransitionError', 'ProductOptionInUseError', 'QuantityTooGreatError', 'RefundOrderStateError', 'RefundPaymentIdMissingError', 'RefundStateTransitionError', 'SettlePaymentError']);
|
|
390
|
+
const errorTypeNames = new Set(['AlreadyRefundedError', 'CancelActiveOrderError', 'CancelPaymentError', 'ChannelDefaultLanguageError', 'CouponCodeExpiredError', 'CouponCodeInvalidError', 'CouponCodeLimitError', 'CreateFulfillmentError', 'EmailAddressConflictError', 'EmptyOrderLineSelectionError', 'FacetInUseError', 'FulfillmentStateTransitionError', 'InsufficientStockError', 'InsufficientStockOnHandError', 'InvalidCredentialsError', 'InvalidFulfillmentHandlerError', 'ItemsAlreadyFulfilledError', 'LanguageNotAvailableError', 'ManualPaymentStateError', 'MimeTypeError', 'MissingConditionsError', 'MultipleOrderError', 'NativeAuthStrategyError', 'NegativeQuantityError', 'NoChangesSpecifiedError', 'NothingToRefundError', 'OrderLimitError', 'OrderModificationStateError', 'OrderStateTransitionError', 'PaymentMethodMissingError', 'PaymentOrderMismatchError', 'PaymentStateTransitionError', 'ProductOptionInUseError', 'QuantityTooGreatError', 'RefundOrderStateError', 'RefundPaymentIdMissingError', 'RefundStateTransitionError', 'SettlePaymentError']);
|
|
379
391
|
function isGraphQLError(input) {
|
|
380
392
|
return input instanceof ErrorResult || errorTypeNames.has(input.__typename);
|
|
381
393
|
}
|
|
@@ -440,6 +452,11 @@ exports.adminErrorOperationTypeResolvers = {
|
|
|
440
452
|
return isGraphQLError(value) ? value.__typename : 'Refund';
|
|
441
453
|
},
|
|
442
454
|
},
|
|
455
|
+
RemoveFacetFromChannelResult: {
|
|
456
|
+
__resolveType(value) {
|
|
457
|
+
return isGraphQLError(value) ? value.__typename : 'Facet';
|
|
458
|
+
},
|
|
459
|
+
},
|
|
443
460
|
RemoveOptionGroupFromProductResult: {
|
|
444
461
|
__resolveType(value) {
|
|
445
462
|
return isGraphQLError(value) ? value.__typename : 'Product';
|