@vendure/core 2.1.1 → 2.1.3
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/api-internal-modules.d.ts +2 -2
- package/dist/api/common/configurable-operation-codec.js +1 -2
- package/dist/api/common/configurable-operation-codec.js.map +1 -1
- package/dist/api/resolvers/admin/order.resolver.d.ts +1 -1
- package/dist/common/finite-state-machine/validate-transition-definition.js +19 -2
- package/dist/common/finite-state-machine/validate-transition-definition.js.map +1 -1
- package/dist/common/utils.d.ts +8 -0
- package/dist/common/utils.js +13 -2
- package/dist/common/utils.js.map +1 -1
- package/dist/config/catalog/default-product-variant-price-selection-strategy.d.ts +1 -1
- package/dist/config/catalog/default-product-variant-price-selection-strategy.js +1 -1
- package/dist/config/catalog/default-product-variant-price-selection-strategy.js.map +1 -1
- package/dist/config/promotion/index.d.ts +53 -53
- package/dist/connection/connection.module.d.ts +1 -1
- package/dist/i18n/messages/en.json +1 -0
- package/dist/plugin/default-search-plugin/index.d.ts +1 -0
- package/dist/plugin/default-search-plugin/index.js +1 -0
- package/dist/plugin/default-search-plugin/index.js.map +1 -1
- package/dist/plugin/default-search-plugin/indexer/mutable-request-context.d.ts +2 -0
- package/dist/plugin/default-search-plugin/indexer/mutable-request-context.js +4 -0
- package/dist/plugin/default-search-plugin/indexer/mutable-request-context.js.map +1 -1
- package/dist/service/helpers/fulfillment-state-machine/fulfillment-state-machine.d.ts +1 -3
- package/dist/service/helpers/fulfillment-state-machine/fulfillment-state-machine.js +8 -5
- package/dist/service/helpers/fulfillment-state-machine/fulfillment-state-machine.js.map +1 -1
- package/dist/service/helpers/order-modifier/order-modifier.d.ts +1 -1
- package/dist/service/helpers/order-state-machine/order-state-machine.d.ts +1 -3
- package/dist/service/helpers/order-state-machine/order-state-machine.js +8 -6
- package/dist/service/helpers/order-state-machine/order-state-machine.js.map +1 -1
- package/dist/service/helpers/payment-state-machine/payment-state-machine.js +6 -1
- package/dist/service/helpers/payment-state-machine/payment-state-machine.js.map +1 -1
- package/dist/service/helpers/request-context/request-context.service.js +8 -2
- package/dist/service/helpers/request-context/request-context.service.js.map +1 -1
- package/dist/service/services/channel.service.js +37 -5
- package/dist/service/services/channel.service.js.map +1 -1
- package/dist/service/services/collection.service.js +12 -2
- package/dist/service/services/collection.service.js.map +1 -1
- package/dist/service/services/order.service.js +9 -2
- package/dist/service/services/order.service.js.map +1 -1
- package/dist/service/services/product-variant.service.js +3 -3
- package/dist/service/services/product-variant.service.js.map +1 -1
- package/dist/service/services/user.service.js +13 -7
- package/dist/service/services/user.service.js.map +1 -1
- package/package.json +4 -4
|
@@ -26,8 +26,8 @@ import { ShippingMethodEntityResolver } from './resolvers/entity/shipping-method
|
|
|
26
26
|
import { TaxRateEntityResolver } from './resolvers/entity/tax-rate-entity.resolver';
|
|
27
27
|
import { UserEntityResolver } from './resolvers/entity/user-entity.resolver';
|
|
28
28
|
import { ZoneEntityResolver } from './resolvers/entity/zone-entity.resolver';
|
|
29
|
-
export declare const entityResolvers: (typeof AssetEntityResolver | typeof ChannelEntityResolver | typeof CollectionEntityResolver | typeof CountryEntityResolver | typeof CustomerEntityResolver | typeof CustomerGroupEntityResolver | typeof FacetEntityResolver | typeof FacetValueEntityResolver | typeof FulfillmentEntityResolver | typeof FulfillmentLineEntityResolver | typeof OrderEntityResolver | typeof OrderLineEntityResolver | typeof PaymentEntityResolver | typeof ProductEntityResolver | typeof ProductOptionEntityResolver | typeof ProductOptionGroupEntityResolver | typeof ProductVariantEntityResolver | typeof RefundEntityResolver | typeof RefundLineEntityResolver | typeof RoleEntityResolver | typeof ShippingLineEntityResolver | typeof
|
|
30
|
-
export declare const adminEntityResolvers: (typeof AdministratorEntityResolver | typeof CustomerAdminEntityResolver | typeof
|
|
29
|
+
export declare const entityResolvers: (typeof AssetEntityResolver | typeof ChannelEntityResolver | typeof CollectionEntityResolver | typeof CountryEntityResolver | typeof CustomerEntityResolver | typeof CustomerGroupEntityResolver | typeof FacetEntityResolver | typeof FacetValueEntityResolver | typeof FulfillmentEntityResolver | typeof FulfillmentLineEntityResolver | typeof OrderEntityResolver | typeof OrderLineEntityResolver | typeof PaymentEntityResolver | typeof ProductEntityResolver | typeof ProductOptionEntityResolver | typeof ProductOptionGroupEntityResolver | typeof ProductVariantEntityResolver | typeof RefundEntityResolver | typeof RefundLineEntityResolver | typeof RoleEntityResolver | typeof ShippingLineEntityResolver | typeof ShippingMethodEntityResolver | typeof TaxRateEntityResolver | typeof UserEntityResolver | typeof ZoneEntityResolver)[];
|
|
30
|
+
export declare const adminEntityResolvers: (typeof AdministratorEntityResolver | typeof CustomerAdminEntityResolver | typeof FulfillmentAdminEntityResolver | typeof JobEntityResolver | typeof OrderAdminEntityResolver | typeof PaymentAdminEntityResolver | typeof PaymentMethodEntityResolver | typeof ProductAdminEntityResolver | typeof ProductVariantAdminEntityResolver)[];
|
|
31
31
|
/**
|
|
32
32
|
* The internal module containing some shared providers used by more than
|
|
33
33
|
* one API module.
|
|
@@ -42,8 +42,7 @@ let ConfigurableOperationCodec = class ConfigurableOperationCodec {
|
|
|
42
42
|
arg.value = JSON.stringify(decodedIds);
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
|
|
46
|
-
arg.value = JSON.stringify(decodedId);
|
|
45
|
+
arg.value = this.idCodecService.decode(arg.value);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurable-operation-codec.js","sourceRoot":"","sources":["../../../src/api/common/configurable-operation-codec.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAK5C,sDAAgE;AAChE,yCAMsB;AACtB,8EAA0E;AAC1E,gEAA4D;AAC5D,gHAA0G;AAC1G,wFAAmF;AAEnF,yDAAoD;AAG7C,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACnC,YAAoB,aAA4B,EAAU,cAA8B;QAApE,kBAAa,GAAb,aAAa,CAAe;QAAU,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAE5F;;OAEG;IACH,8BAA8B,CAC1B,OAA4C,EAC5C,KAAmC;QAEnC,MAAM,aAAa,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAC3D,KAAK,MAAM,cAAc,IAAI,KAAK,EAAE;YAChC,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,CAAC,CAAC;YACpE,IAAI,CAAC,GAAG,EAAE;gBACN,SAAS;aACZ;YACD,KAAK,MAAM,GAAG,IAAI,cAAc,CAAC,SAAS,EAAE;gBACxC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAClC,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE;oBAC7C,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE;wBACtB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAa,CAAC;wBAC9C,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;wBACjE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;qBAC1C;yBAAM;wBACH,
|
|
1
|
+
{"version":3,"file":"configurable-operation-codec.js","sourceRoot":"","sources":["../../../src/api/common/configurable-operation-codec.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAK5C,sDAAgE;AAChE,yCAMsB;AACtB,8EAA0E;AAC1E,gEAA4D;AAC5D,gHAA0G;AAC1G,wFAAmF;AAEnF,yDAAoD;AAG7C,IAAM,0BAA0B,GAAhC,MAAM,0B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AC/D,KAAK,6CAAoB;gBACrB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,qBAAqB,CAAC;YACnE,KAAK,oEAA+B;gBAChC,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,gCAAgC,IAAI,EAAE,CAAC;YACpF,KAAK,4BAAmB,CAAC;YACzB,KAAK,6BAAoB;gBACrB,OAAO,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,gBAAgB,IAAI,EAAE,CAAC;YACtE,KAAK,2BAAkB;gBACnB,OAAO,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,mBAAmB,IAAI,EAAE,CAAC;YACzE,KAAK,mCAA0B;gBAC3B,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,2BAA2B,IAAI,EAAE,CAAC;YAChF,KAAK,2BAAkB;gBACnB,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,mBAAmB,IAAI,EAAE,CAAC;YACxE;gBACI,MAAM,IAAI,4BAAmB,CAAC,iDAAiD,EAAE;oBAC7E,IAAI,EAAE,OAAO,CAAC,IAAI;iBACrB,CAAC,CAAC;SACV;IACL,CAAC;CACJ,CAAA;AArFY,0BAA0B;IADtC,IAAA,mBAAU,GAAE;qCAE0B,8BAAa,EAA0B,iCAAc;GAD/E,0BAA0B,CAqFtC;AArFY,gEAA0B"}
|
|
@@ -26,7 +26,7 @@ export declare class OrderResolver {
|
|
|
26
26
|
deleteOrderNote(ctx: RequestContext, args: MutationDeleteOrderNoteArgs): Promise<import("@vendure/common/lib/generated-types").DeletionResponse>;
|
|
27
27
|
setOrderCustomFields(ctx: RequestContext, args: MutationSetOrderCustomFieldsArgs): Promise<Order>;
|
|
28
28
|
transitionOrderToState(ctx: RequestContext, args: MutationTransitionOrderToStateArgs): Promise<Order | import("../../../common/error/generated-graphql-shop-errors").OrderStateTransitionError>;
|
|
29
|
-
transitionFulfillmentToState(ctx: RequestContext, args: MutationTransitionFulfillmentToStateArgs): Promise<
|
|
29
|
+
transitionFulfillmentToState(ctx: RequestContext, args: MutationTransitionFulfillmentToStateArgs): Promise<import("../../../index").FulfillmentStateTransitionError | Fulfillment>;
|
|
30
30
|
transitionPaymentToState(ctx: RequestContext, args: MutationTransitionPaymentToStateArgs): Promise<ErrorResultUnion<TransitionPaymentToStateResult, Payment>>;
|
|
31
31
|
modifyOrder(ctx: RequestContext, args: MutationModifyOrderArgs): Promise<ErrorResultUnion<import("@vendure/common/lib/generated-types").ModifyOrderResult, Order, any>>;
|
|
32
32
|
addManualPaymentToOrder(ctx: RequestContext, args: MutationAddManualPaymentToOrderArgs): Promise<ErrorResultUnion<import("@vendure/common/lib/generated-types").AddManualPaymentToOrderResult, Order, any>>;
|
|
@@ -6,6 +6,12 @@ exports.validateTransitionDefinition = void 0;
|
|
|
6
6
|
* that all states are reachable from the given initial state.
|
|
7
7
|
*/
|
|
8
8
|
function validateTransitionDefinition(transitions, initialState) {
|
|
9
|
+
if (!transitions[initialState]) {
|
|
10
|
+
return {
|
|
11
|
+
valid: false,
|
|
12
|
+
error: `The initial state "${initialState}" is not defined`,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
9
15
|
const states = Object.keys(transitions);
|
|
10
16
|
const result = states.reduce((res, state) => {
|
|
11
17
|
return Object.assign(Object.assign({}, res), { [state]: { reachable: false } });
|
|
@@ -13,7 +19,7 @@ function validateTransitionDefinition(transitions, initialState) {
|
|
|
13
19
|
// walk the state graph starting with the initialState and
|
|
14
20
|
// check whether all states are reachable.
|
|
15
21
|
function allStatesReached() {
|
|
16
|
-
return Object.values(result).every(
|
|
22
|
+
return Object.values(result).every(r => r.reachable);
|
|
17
23
|
}
|
|
18
24
|
function walkGraph(state) {
|
|
19
25
|
const candidates = transitions[state].to;
|
|
@@ -22,12 +28,23 @@ function validateTransitionDefinition(transitions, initialState) {
|
|
|
22
28
|
return true;
|
|
23
29
|
}
|
|
24
30
|
for (const candidate of candidates) {
|
|
31
|
+
if (result[candidate] === undefined) {
|
|
32
|
+
throw new Error(`The state "${state}" has a transition to an unknown state "${candidate}"`);
|
|
33
|
+
}
|
|
25
34
|
if (!result[candidate].reachable) {
|
|
26
35
|
walkGraph(candidate);
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
|
-
|
|
39
|
+
try {
|
|
40
|
+
walkGraph(initialState);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
return {
|
|
44
|
+
valid: false,
|
|
45
|
+
error: e.message,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
31
48
|
if (!allStatesReached()) {
|
|
32
49
|
return {
|
|
33
50
|
valid: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-transition-definition.js","sourceRoot":"","sources":["../../../src/common/finite-state-machine/validate-transition-definition.ts"],"names":[],"mappings":";;;AAIA;;;GAGG;AACH,SAAgB,4BAA4B,CACxC,WAA2B,EAC3B,YAAe;IAEf,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAQ,CAAC;IAC/C,MAAM,MAAM,GAAuC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5E,uCACO,GAAG,KACN,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,IAC/B;IACN,CAAC,EAAE,EAAS,CAAC,CAAC;IAEd,0DAA0D;IAC1D,0CAA0C;IAC1C,SAAS,gBAAgB;QACrB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"validate-transition-definition.js","sourceRoot":"","sources":["../../../src/common/finite-state-machine/validate-transition-definition.ts"],"names":[],"mappings":";;;AAIA;;;GAGG;AACH,SAAgB,4BAA4B,CACxC,WAA2B,EAC3B,YAAe;IAEf,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE;QAC5B,OAAO;YACH,KAAK,EA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B,EAAE,EAAE;QACrB,OAAO;YACH,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,yCAAyC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;iBACjE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAE,CAAsB,CAAC,SAAS,CAAC;iBACtD,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;iBACf,IAAI,CAAC,IAAI,CAAC,EAAE;SACpB,CAAC;KACL;SAAM;QACH,OAAO;YACH,KAAK,EAAE,IAAI;SACd,CAAC;KACL;AACL,CAAC;AA5DD,oEA4DC"}
|
package/dist/common/utils.d.ts
CHANGED
|
@@ -37,6 +37,14 @@ export declare function getAssetType(mimeType: string): AssetType;
|
|
|
37
37
|
* upper/lower case. See more discussion here: https://ux.stackexchange.com/a/16849
|
|
38
38
|
*/
|
|
39
39
|
export declare function normalizeEmailAddress(input: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* This is a "good enough" check for whether the input is an email address.
|
|
42
|
+
* From https://stackoverflow.com/a/32686261
|
|
43
|
+
* It is used to determine whether to apply normalization (lower-casing)
|
|
44
|
+
* when comparing identifiers in user lookups. This allows case-sensitive
|
|
45
|
+
* identifiers for other authentication methods.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isEmailAddressLike(input: string): boolean;
|
|
40
48
|
/**
|
|
41
49
|
* Converts a value that may be wrapped into a Promise or Observable into a Promise-wrapped
|
|
42
50
|
* value.
|
package/dist/common/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertRelationPaths = exports.asyncObservable = exports.awaitPromiseOrObservable = exports.normalizeEmailAddress = exports.getAssetType = exports.idsAreEqual = exports.assertFound = exports.foundIn = exports.not = void 0;
|
|
3
|
+
exports.convertRelationPaths = exports.asyncObservable = exports.awaitPromiseOrObservable = exports.isEmailAddressLike = exports.normalizeEmailAddress = exports.getAssetType = exports.idsAreEqual = exports.assertFound = exports.foundIn = exports.not = void 0;
|
|
4
4
|
const generated_types_1 = require("@vendure/common/lib/generated-types");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
6
|
/**
|
|
@@ -62,9 +62,20 @@ exports.getAssetType = getAssetType;
|
|
|
62
62
|
* upper/lower case. See more discussion here: https://ux.stackexchange.com/a/16849
|
|
63
63
|
*/
|
|
64
64
|
function normalizeEmailAddress(input) {
|
|
65
|
-
return input.trim().toLowerCase();
|
|
65
|
+
return isEmailAddressLike(input) ? input.trim().toLowerCase() : input.trim();
|
|
66
66
|
}
|
|
67
67
|
exports.normalizeEmailAddress = normalizeEmailAddress;
|
|
68
|
+
/**
|
|
69
|
+
* This is a "good enough" check for whether the input is an email address.
|
|
70
|
+
* From https://stackoverflow.com/a/32686261
|
|
71
|
+
* It is used to determine whether to apply normalization (lower-casing)
|
|
72
|
+
* when comparing identifiers in user lookups. This allows case-sensitive
|
|
73
|
+
* identifiers for other authentication methods.
|
|
74
|
+
*/
|
|
75
|
+
function isEmailAddressLike(input) {
|
|
76
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(input.trim());
|
|
77
|
+
}
|
|
78
|
+
exports.isEmailAddressLike = isEmailAddressLike;
|
|
68
79
|
/**
|
|
69
80
|
* Converts a value that may be wrapped into a Promise or Observable into a Promise-wrapped
|
|
70
81
|
* value.
|
package/dist/common/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":";;;AAAA,yEAAgE;AAEhE,+BAA2D;AAM3D;;GAEG;AACH,SAAgB,GAAG,CAAC,SAAsC;IACtD,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;AACnD,CAAC;AAFD,kBAE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CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC3C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;aACvD;YACD,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;SAC3B;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAlBD,oDAkBC"}
|
|
@@ -12,5 +12,5 @@ import { ProductVariantPriceSelectionStrategy } from './product-variant-price-se
|
|
|
12
12
|
* @since 2.0.0
|
|
13
13
|
*/
|
|
14
14
|
export declare class DefaultProductVariantPriceSelectionStrategy implements ProductVariantPriceSelectionStrategy {
|
|
15
|
-
selectPrice(ctx: RequestContext, prices: ProductVariantPrice[]): ProductVariantPrice;
|
|
15
|
+
selectPrice(ctx: RequestContext, prices: ProductVariantPrice[]): ProductVariantPrice | undefined;
|
|
16
16
|
}
|
|
@@ -16,7 +16,7 @@ class DefaultProductVariantPriceSelectionStrategy {
|
|
|
16
16
|
selectPrice(ctx, prices) {
|
|
17
17
|
const pricesInChannel = prices.filter(p => (0, utils_1.idsAreEqual)(p.channelId, ctx.channelId));
|
|
18
18
|
const priceInCurrency = pricesInChannel.find(p => p.currencyCode === ctx.currencyCode);
|
|
19
|
-
return priceInCurrency
|
|
19
|
+
return priceInCurrency;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.DefaultProductVariantPriceSelectionStrategy = DefaultProductVariantPriceSelectionStrategy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-product-variant-price-selection-strategy.js","sourceRoot":"","sources":["../../../src/config/catalog/default-product-variant-price-selection-strategy.ts"],"names":[],"mappings":";;;AACA,8CAAiD;AAKjD;;;;;;;;;GASG;AACH,MAAa,2CAA2C;IACpD,WAAW,CAAC,GAAmB,EAAE,MAA6B;QAC1D,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,mBAAW,EAAC,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;QACpF,MAAM,eAAe,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,GAAG,CAAC,YAAY,CAAC,CAAC;QACvF,OAAO,eAAe,
|
|
1
|
+
{"version":3,"file":"default-product-variant-price-selection-strategy.js","sourceRoot":"","sources":["../../../src/config/catalog/default-product-variant-price-selection-strategy.ts"],"names":[],"mappings":";;;AACA,8CAAiD;AAKjD;;;;;;;;;GASG;AACH,MAAa,2CAA2C;IACpD,WAAW,CAAC,GAAmB,EAAE,MAA6B;QAC1D,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,mBAAW,EAAC,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;QACpF,MAAM,eAAe,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,GAAG,CAAC,YAAY,CAAC,CAAC;QACvF,OAAO,eAAe,CAAC;IAC3B,CAAC;CACJ;AAND,kGAMC"}
|
|
@@ -12,22 +12,42 @@ export * from './conditions/contains-products-condition';
|
|
|
12
12
|
export * from './conditions/customer-group-condition';
|
|
13
13
|
export * from './conditions/buy-x-get-y-free-condition';
|
|
14
14
|
export * from './utils/facet-value-checker';
|
|
15
|
-
export declare const defaultPromotionActions: (import("./promotion-action").
|
|
16
|
-
|
|
15
|
+
export declare const defaultPromotionActions: (import("./promotion-action").PromotionItemAction<{}, import("./promotion-condition").PromotionCondition<{
|
|
16
|
+
amountX: {
|
|
17
17
|
type: "int";
|
|
18
|
+
defaultValue: number;
|
|
19
|
+
};
|
|
20
|
+
variantIdsX: {
|
|
21
|
+
type: "ID";
|
|
22
|
+
list: true;
|
|
18
23
|
ui: {
|
|
19
24
|
component: string;
|
|
20
25
|
};
|
|
26
|
+
label: {
|
|
27
|
+
languageCode: import("@vendure/common/lib/generated-types").LanguageCode.en;
|
|
28
|
+
value: string;
|
|
29
|
+
}[];
|
|
21
30
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
amountY: {
|
|
32
|
+
type: "int";
|
|
33
|
+
defaultValue: number;
|
|
34
|
+
};
|
|
35
|
+
variantIdsY: {
|
|
36
|
+
type: "ID";
|
|
37
|
+
list: true;
|
|
25
38
|
ui: {
|
|
26
39
|
component: string;
|
|
27
|
-
suffix: string;
|
|
28
40
|
};
|
|
41
|
+
label: {
|
|
42
|
+
languageCode: import("@vendure/common/lib/generated-types").LanguageCode.en;
|
|
43
|
+
value: string;
|
|
44
|
+
}[];
|
|
29
45
|
};
|
|
30
|
-
},
|
|
46
|
+
}, "buy_x_get_y_free", false | {
|
|
47
|
+
freeItemsPerLine: {
|
|
48
|
+
[lineId: string]: number;
|
|
49
|
+
};
|
|
50
|
+
}>[]> | import("./promotion-action").PromotionItemAction<{
|
|
31
51
|
discount: {
|
|
32
52
|
type: "float";
|
|
33
53
|
ui: {
|
|
@@ -42,6 +62,21 @@ export declare const defaultPromotionActions: (import("./promotion-action").Prom
|
|
|
42
62
|
component: string;
|
|
43
63
|
};
|
|
44
64
|
};
|
|
65
|
+
}, []> | import("./promotion-action").PromotionShippingAction<{}, []> | import("./promotion-action").PromotionOrderAction<{
|
|
66
|
+
discount: {
|
|
67
|
+
type: "int";
|
|
68
|
+
ui: {
|
|
69
|
+
component: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}, []> | import("./promotion-action").PromotionOrderAction<{
|
|
73
|
+
discount: {
|
|
74
|
+
type: "float";
|
|
75
|
+
ui: {
|
|
76
|
+
component: string;
|
|
77
|
+
suffix: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
45
80
|
}, []> | import("./promotion-action").PromotionItemAction<{
|
|
46
81
|
discount: {
|
|
47
82
|
type: "float";
|
|
@@ -61,7 +96,8 @@ export declare const defaultPromotionActions: (import("./promotion-action").Prom
|
|
|
61
96
|
value: string;
|
|
62
97
|
}[];
|
|
63
98
|
};
|
|
64
|
-
}, []>
|
|
99
|
+
}, []>)[];
|
|
100
|
+
export declare const defaultPromotionConditions: (import("./promotion-condition").PromotionCondition<{
|
|
65
101
|
amountX: {
|
|
66
102
|
type: "int";
|
|
67
103
|
defaultValue: number;
|
|
@@ -96,32 +132,7 @@ export declare const defaultPromotionActions: (import("./promotion-action").Prom
|
|
|
96
132
|
freeItemsPerLine: {
|
|
97
133
|
[lineId: string]: number;
|
|
98
134
|
};
|
|
99
|
-
}>
|
|
100
|
-
export declare const defaultPromotionConditions: (import("./promotion-condition").PromotionCondition<{
|
|
101
|
-
amount: {
|
|
102
|
-
type: "int";
|
|
103
|
-
defaultValue: number;
|
|
104
|
-
ui: {
|
|
105
|
-
component: string;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
taxInclusive: {
|
|
109
|
-
type: "boolean";
|
|
110
|
-
defaultValue: false;
|
|
111
|
-
};
|
|
112
|
-
}, "minimum_order_amount", boolean> | import("./promotion-condition").PromotionCondition<{
|
|
113
|
-
minimum: {
|
|
114
|
-
type: "int";
|
|
115
|
-
defaultValue: number;
|
|
116
|
-
};
|
|
117
|
-
facets: {
|
|
118
|
-
type: "ID";
|
|
119
|
-
list: true;
|
|
120
|
-
ui: {
|
|
121
|
-
component: string;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
}, "at_least_n_with_facets", boolean> | import("./promotion-condition").PromotionCondition<{
|
|
135
|
+
}> | import("./promotion-condition").PromotionCondition<{
|
|
125
136
|
minimum: {
|
|
126
137
|
type: "int";
|
|
127
138
|
defaultValue: number;
|
|
@@ -149,38 +160,27 @@ export declare const defaultPromotionConditions: (import("./promotion-condition"
|
|
|
149
160
|
}[];
|
|
150
161
|
};
|
|
151
162
|
}, "customer_group", boolean> | import("./promotion-condition").PromotionCondition<{
|
|
152
|
-
|
|
163
|
+
minimum: {
|
|
153
164
|
type: "int";
|
|
154
165
|
defaultValue: number;
|
|
155
166
|
};
|
|
156
|
-
|
|
167
|
+
facets: {
|
|
157
168
|
type: "ID";
|
|
158
169
|
list: true;
|
|
159
170
|
ui: {
|
|
160
171
|
component: string;
|
|
161
172
|
};
|
|
162
|
-
label: {
|
|
163
|
-
languageCode: import("@vendure/common/lib/generated-types").LanguageCode.en;
|
|
164
|
-
value: string;
|
|
165
|
-
}[];
|
|
166
173
|
};
|
|
167
|
-
|
|
174
|
+
}, "at_least_n_with_facets", boolean> | import("./promotion-condition").PromotionCondition<{
|
|
175
|
+
amount: {
|
|
168
176
|
type: "int";
|
|
169
177
|
defaultValue: number;
|
|
170
|
-
};
|
|
171
|
-
variantIdsY: {
|
|
172
|
-
type: "ID";
|
|
173
|
-
list: true;
|
|
174
178
|
ui: {
|
|
175
179
|
component: string;
|
|
176
180
|
};
|
|
177
|
-
label: {
|
|
178
|
-
languageCode: import("@vendure/common/lib/generated-types").LanguageCode.en;
|
|
179
|
-
value: string;
|
|
180
|
-
}[];
|
|
181
181
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
taxInclusive: {
|
|
183
|
+
type: "boolean";
|
|
184
|
+
defaultValue: false;
|
|
185
185
|
};
|
|
186
|
-
}>)[];
|
|
186
|
+
}, "minimum_order_amount", boolean>)[];
|
|
@@ -3,5 +3,5 @@ import { DataSourceOptions } from 'typeorm';
|
|
|
3
3
|
export declare class ConnectionModule {
|
|
4
4
|
static forRoot(): DynamicModule;
|
|
5
5
|
static forPlugin(): DynamicModule;
|
|
6
|
-
static getTypeOrmLogger(dbConnectionOptions: DataSourceOptions): "debug" | "advanced-console" | "simple-console" | "file"
|
|
6
|
+
static getTypeOrmLogger(dbConnectionOptions: DataSourceOptions): import("typeorm").Logger | "debug" | "advanced-console" | "simple-console" | "file";
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"error": {
|
|
3
3
|
"active-user-does-not-have-sufficient-permissions": "Active user does not have sufficient permissions",
|
|
4
|
+
"available-currency-codes-must-include-default": "availableCurrencyCodes must include the defaultCurrencyCode ({ defaultCurrencyCode })",
|
|
4
5
|
"cannot-delete-role": "The role \"{ roleCode }\" cannot be deleted",
|
|
5
6
|
"cannot-delete-sole-superadmin": "The sole SuperAdmin cannot be deleted",
|
|
6
7
|
"cannot-locate-customer-for-user": "Cannot locate a Customer for the user",
|
|
@@ -9,3 +9,4 @@ export * from './search-strategy/postgres-search-strategy';
|
|
|
9
9
|
export * from './search-strategy/sqlite-search-strategy';
|
|
10
10
|
export * from './search-strategy/search-strategy';
|
|
11
11
|
export * from './search-strategy/search-strategy-common';
|
|
12
|
+
export * from './indexer/mutable-request-context';
|
|
@@ -25,4 +25,5 @@ __exportStar(require("./search-strategy/postgres-search-strategy"), exports);
|
|
|
25
25
|
__exportStar(require("./search-strategy/sqlite-search-strategy"), exports);
|
|
26
26
|
__exportStar(require("./search-strategy/search-strategy"), exports);
|
|
27
27
|
__exportStar(require("./search-strategy/search-strategy-common"), exports);
|
|
28
|
+
__exportStar(require("./indexer/mutable-request-context"), exports);
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/default-search-plugin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0DAAwC;AACxC,4EAA0D;AAC1D,8EAA4D;AAC5D,gFAA8D;AAC9D,0EAAwD;AACxD,0EAAwD;AACxD,6EAA2D;AAC3D,2EAAyD;AACzD,oEAAkD;AAClD,2EAAyD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/default-search-plugin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0DAAwC;AACxC,4EAA0D;AAC1D,8EAA4D;AAC5D,gFAA8D;AAC9D,0EAAwD;AACxD,0EAAwD;AACxD,6EAA2D;AAC3D,2EAAyD;AACzD,oEAAkD;AAClD,2EAAyD;AACzD,oEAAkD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CurrencyCode } from '@vendure/common/lib/generated-types';
|
|
1
2
|
import { ID } from '@vendure/common/lib/shared-types';
|
|
2
3
|
import { RequestContext, SerializedRequestContext } from '../../../api/common/request-context';
|
|
3
4
|
import { Channel } from '../../../entity/channel/channel.entity';
|
|
@@ -14,5 +15,6 @@ export declare class MutableRequestContext extends RequestContext {
|
|
|
14
15
|
setChannel(channel: Channel): void;
|
|
15
16
|
get channel(): Channel;
|
|
16
17
|
get channelId(): ID;
|
|
18
|
+
get currencyCode(): CurrencyCode;
|
|
17
19
|
static deserialize(ctxObject: SerializedRequestContext): MutableRequestContext;
|
|
18
20
|
}
|
|
@@ -25,6 +25,10 @@ class MutableRequestContext extends request_context_1.RequestContext {
|
|
|
25
25
|
var _a, _b;
|
|
26
26
|
return (_b = (_a = this.mutatedChannel) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : super.channelId;
|
|
27
27
|
}
|
|
28
|
+
get currencyCode() {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
return (_b = (_a = this.mutatedChannel) === null || _a === void 0 ? void 0 : _a.defaultCurrencyCode) !== null && _b !== void 0 ? _b : super.currencyCode;
|
|
31
|
+
}
|
|
28
32
|
static deserialize(ctxObject) {
|
|
29
33
|
var _a;
|
|
30
34
|
return new MutableRequestContext({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutable-request-context.js","sourceRoot":"","sources":["../../../../src/plugin/default-search-plugin/indexer/mutable-request-context.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"mutable-request-context.js","sourceRoot":"","sources":["../../../../src/plugin/default-search-plugin/indexer/mutable-request-context.ts"],"names":[],"mappings":";;;AAGA,yEAA+F;AAC/F,2EAAiE;AAEjE;;;;;;GAMG;AACH,MAAa,qBAAsB,SAAQ,gCAAc;IACrD,YAAY,OAAwD;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAGD,UAAU,CAAC,OAAgB;QACvB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAClC,CAAC;IAED,IAAI,OAAO;;QACP,OAAO,MAAA,IAAI,CAAC,cAAc,mCAAI,KAAK,CAAC,OAAO,CAAC;IAChD,CAAC;IAED,IAAI,SAAS;;QACT,OAAO,MAAA,MAAA,IAAI,CAAC,cAAc,0CAAE,EAAE,mCAAI,KAAK,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,IAAI,YAAY;;QACZ,OAAO,MAAA,MAAA,IAAI,CAAC,cAAc,0CAAE,mBAAmB,mCAAI,KAAK,CAAC,YAAY,CAAC;IAC1E,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,SAAmC;;QAClD,OAAO,IAAI,qBAAqB,CAAC;YAC7B,GAAG,EAAE,SAAS,CAAC,IAAI;YACnB,OAAO,EAAE,SAAS,CAAC,QAAQ;YAC3B,OAAO,EAAE,IAAI,wBAAO,CAAC,SAAS,CAAC,QAAQ,CAAC;YACxC,OAAO,kCACA,SAAS,CAAC,QAAQ,KACrB,OAAO,EAAE,CAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,OAAO,KAAI,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,GAC/E;YACD,YAAY,EAAE,SAAS,CAAC,aAAa;YACrC,YAAY,EAAE,SAAS,CAAC,aAAa;YACrC,qBAAqB,EAAE,SAAS,CAAC,sBAAsB;SAC1D,CAAC,CAAC;IACP,CAAC;CACJ;AApCD,sDAoCC"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { RequestContext } from '../../../api/common/request-context';
|
|
2
2
|
import { StateMachineConfig } from '../../../common/finite-state-machine/types';
|
|
3
3
|
import { ConfigService } from '../../../config/config.service';
|
|
4
|
-
import { TransactionalConnection } from '../../../connection/index';
|
|
5
4
|
import { Fulfillment } from '../../../entity/fulfillment/fulfillment.entity';
|
|
6
5
|
import { Order } from '../../../entity/order/order.entity';
|
|
7
6
|
import { FulfillmentState, FulfillmentTransitionData } from './fulfillment-state';
|
|
8
7
|
export declare class FulfillmentStateMachine {
|
|
9
8
|
private configService;
|
|
10
|
-
private connection;
|
|
11
9
|
readonly config: StateMachineConfig<FulfillmentState, FulfillmentTransitionData>;
|
|
12
10
|
private readonly initialState;
|
|
13
|
-
constructor(configService: ConfigService
|
|
11
|
+
constructor(configService: ConfigService);
|
|
14
12
|
getInitialState(): FulfillmentState;
|
|
15
13
|
canTransition(currentState: FulfillmentState, newState: FulfillmentState): boolean;
|
|
16
14
|
getNextStates(fulfillment: Fulfillment): readonly FulfillmentState[];
|
|
@@ -17,11 +17,10 @@ const merge_transition_definitions_1 = require("../../../common/finite-state-mac
|
|
|
17
17
|
const validate_transition_definition_1 = require("../../../common/finite-state-machine/validate-transition-definition");
|
|
18
18
|
const utils_1 = require("../../../common/utils");
|
|
19
19
|
const config_service_1 = require("../../../config/config.service");
|
|
20
|
-
const
|
|
20
|
+
const vendure_logger_1 = require("../../../config/logger/vendure-logger");
|
|
21
21
|
let FulfillmentStateMachine = class FulfillmentStateMachine {
|
|
22
|
-
constructor(configService
|
|
22
|
+
constructor(configService) {
|
|
23
23
|
this.configService = configService;
|
|
24
|
-
this.connection = connection;
|
|
25
24
|
this.initialState = 'Created';
|
|
26
25
|
this.config = this.initConfig();
|
|
27
26
|
}
|
|
@@ -47,7 +46,11 @@ let FulfillmentStateMachine = class FulfillmentStateMachine {
|
|
|
47
46
|
const customProcesses = (_a = this.configService.shippingOptions.customFulfillmentProcess) !== null && _a !== void 0 ? _a : [];
|
|
48
47
|
const processes = [...customProcesses, ...((_b = this.configService.shippingOptions.process) !== null && _b !== void 0 ? _b : [])];
|
|
49
48
|
const allTransitions = processes.reduce((transitions, process) => (0, merge_transition_definitions_1.mergeTransitionDefinitions)(transitions, process.transitions), {});
|
|
50
|
-
const validationResult = (0, validate_transition_definition_1.validateTransitionDefinition)(allTransitions,
|
|
49
|
+
const validationResult = (0, validate_transition_definition_1.validateTransitionDefinition)(allTransitions, this.initialState);
|
|
50
|
+
if (!validationResult.valid && validationResult.error) {
|
|
51
|
+
vendure_logger_1.Logger.error(`The fulfillment process has an invalid configuration:`);
|
|
52
|
+
throw new Error(validationResult.error);
|
|
53
|
+
}
|
|
51
54
|
return {
|
|
52
55
|
transitions: allTransitions,
|
|
53
56
|
onTransitionStart: async (fromState, toState, data) => {
|
|
@@ -83,7 +86,7 @@ let FulfillmentStateMachine = class FulfillmentStateMachine {
|
|
|
83
86
|
};
|
|
84
87
|
FulfillmentStateMachine = __decorate([
|
|
85
88
|
(0, common_1.Injectable)(),
|
|
86
|
-
__metadata("design:paramtypes", [config_service_1.ConfigService
|
|
89
|
+
__metadata("design:paramtypes", [config_service_1.ConfigService])
|
|
87
90
|
], FulfillmentStateMachine);
|
|
88
91
|
exports.FulfillmentStateMachine = FulfillmentStateMachine;
|
|
89
92
|
//# sourceMappingURL=fulfillment-state-machine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fulfillment-state-machine.js","sourceRoot":"","sources":["../../../../src/service/helpers/fulfillment-state-machine/fulfillment-state-machine.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,yDAAqE;AACrE,oGAAgF;AAChF,oHAA+G;AAE/G,wHAAmH;AACnH,iDAAiE;AACjE,mEAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"fulfillment-state-machine.js","sourceRoot":"","sources":["../../../../src/service/helpers/fulfillment-state-machine/fulfillment-state-machine.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,yDAAqE;AACrE,oGAAgF;AAChF,oH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E,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;qBACrF;iBACJ;YACL,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;gBAC3C,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE;oBAC7B,IAAI,OAAO,OAAO,CAAC,iBAAiB,KAAK,UAAU,EAAE;wBACjD,MAAM,IAAA,gCAAwB,EAC1B,OAAO,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CACzD,CAAC;qBACL;iBACJ;gBACD,MAAM,IAAI,8BAAqB,CAAC,OAAO,IAAI,6CAA6C,EAAE;oBACtF,SAAS;oBACT,OAAO;iBACV,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAA;AApFY,uBAAuB;IADnC,IAAA,mBAAU,GAAE;qCAK0B,8BAAa;GAJvC,uBAAuB,CAoFnC;AApFY,0DAAuB"}
|
|
@@ -77,7 +77,7 @@ export declare class OrderModifier {
|
|
|
77
77
|
* `quantity` argument if insufficient stock was available.
|
|
78
78
|
*/
|
|
79
79
|
updateOrderLineQuantity(ctx: RequestContext, orderLine: OrderLine, quantity: number, order: Order): Promise<OrderLine>;
|
|
80
|
-
cancelOrderByOrderLines(ctx: RequestContext, input: CancelOrderInput, lineInputs: OrderLineInput[]): Promise<boolean |
|
|
80
|
+
cancelOrderByOrderLines(ctx: RequestContext, input: CancelOrderInput, lineInputs: OrderLineInput[]): Promise<boolean | CancelActiveOrderError | EmptyOrderLineSelectionError | MultipleOrderError | QuantityTooGreatError>;
|
|
81
81
|
modifyOrder(ctx: RequestContext, input: ModifyOrderInput, order: Order): Promise<JustErrorResults<ModifyOrderResult> | {
|
|
82
82
|
order: Order;
|
|
83
83
|
modification: OrderModification;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { RequestContext } from '../../../api/common/request-context';
|
|
2
2
|
import { StateMachineConfig } from '../../../common/finite-state-machine/types';
|
|
3
3
|
import { ConfigService } from '../../../config/config.service';
|
|
4
|
-
import { TransactionalConnection } from '../../../connection/transactional-connection';
|
|
5
4
|
import { Order } from '../../../entity/order/order.entity';
|
|
6
5
|
import { OrderState, OrderTransitionData } from './order-state';
|
|
7
6
|
export declare class OrderStateMachine {
|
|
8
7
|
private configService;
|
|
9
|
-
private connection;
|
|
10
8
|
readonly config: StateMachineConfig<OrderState, OrderTransitionData>;
|
|
11
9
|
private readonly initialState;
|
|
12
|
-
constructor(configService: ConfigService
|
|
10
|
+
constructor(configService: ConfigService);
|
|
13
11
|
getInitialState(): OrderState;
|
|
14
12
|
canTransition(currentState: OrderState, newState: OrderState): boolean;
|
|
15
13
|
getNextStates(order: Order): readonly OrderState[];
|
|
@@ -17,11 +17,10 @@ const merge_transition_definitions_1 = require("../../../common/finite-state-mac
|
|
|
17
17
|
const validate_transition_definition_1 = require("../../../common/finite-state-machine/validate-transition-definition");
|
|
18
18
|
const utils_1 = require("../../../common/utils");
|
|
19
19
|
const config_service_1 = require("../../../config/config.service");
|
|
20
|
-
const
|
|
20
|
+
const vendure_logger_1 = require("../../../config/logger/vendure-logger");
|
|
21
21
|
let OrderStateMachine = class OrderStateMachine {
|
|
22
|
-
constructor(configService
|
|
22
|
+
constructor(configService) {
|
|
23
23
|
this.configService = configService;
|
|
24
|
-
this.connection = connection;
|
|
25
24
|
this.initialState = 'Created';
|
|
26
25
|
this.config = this.initConfig();
|
|
27
26
|
}
|
|
@@ -44,9 +43,12 @@ let OrderStateMachine = class OrderStateMachine {
|
|
|
44
43
|
initConfig() {
|
|
45
44
|
var _a;
|
|
46
45
|
const orderProcesses = (_a = this.configService.orderOptions.process) !== null && _a !== void 0 ? _a : [];
|
|
47
|
-
const emptyProcess = { transitions: {} };
|
|
48
46
|
const allTransitions = orderProcesses.reduce((transitions, process) => (0, merge_transition_definitions_1.mergeTransitionDefinitions)(transitions, process.transitions), {});
|
|
49
|
-
const validationResult = (0, validate_transition_definition_1.validateTransitionDefinition)(allTransitions,
|
|
47
|
+
const validationResult = (0, validate_transition_definition_1.validateTransitionDefinition)(allTransitions, this.initialState);
|
|
48
|
+
if (!validationResult.valid && validationResult.error) {
|
|
49
|
+
vendure_logger_1.Logger.error(`The order process has an invalid configuration:`);
|
|
50
|
+
throw new Error(validationResult.error);
|
|
51
|
+
}
|
|
50
52
|
return {
|
|
51
53
|
transitions: allTransitions,
|
|
52
54
|
onTransitionStart: async (fromState, toState, data) => {
|
|
@@ -82,7 +84,7 @@ let OrderStateMachine = class OrderStateMachine {
|
|
|
82
84
|
};
|
|
83
85
|
OrderStateMachine = __decorate([
|
|
84
86
|
(0, common_1.Injectable)(),
|
|
85
|
-
__metadata("design:paramtypes", [config_service_1.ConfigService
|
|
87
|
+
__metadata("design:paramtypes", [config_service_1.ConfigService])
|
|
86
88
|
], OrderStateMachine);
|
|
87
89
|
exports.OrderStateMachine = OrderStateMachine;
|
|
88
90
|
//# sourceMappingURL=order-state-machine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-state-machine.js","sourceRoot":"","sources":["../../../../src/service/helpers/order-state-machine/order-state-machine.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,yDAAqE;AACrE,oGAAgF;AAChF,oHAA+G;AAE/G,wHAAmH;AACnH,iDAAiE;AACjE,mEAA+D;
|
|
1
|
+
{"version":3,"file":"order-state-machine.js","sourceRoot":"","sources":["../../../../src/service/helpers/order-state-machine/order-state-machine.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,yDAAqE;AACrE,oGAAgF;AAChF,oHAA+G;AAE/G,wHAAmH;AACnH,iDAAiE;AACjE,mEAA+D;AAC/D,0EAA+D;AAMxD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAI1B,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAF/B,iBAAY,GAAe,SAAS,CAAC;QAGlD,IAAI,CAAC,MAA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yCAAyC,EAAE;oBAClF,SAAS;oBACT,OAAO;iBACV,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAA;AA9EY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAK0B,8BAAa;GAJvC,iBAAiB,CA8E7B;AA9EY,8CAAiB"}
|
|
@@ -17,6 +17,7 @@ const merge_transition_definitions_1 = require("../../../common/finite-state-mac
|
|
|
17
17
|
const validate_transition_definition_1 = require("../../../common/finite-state-machine/validate-transition-definition");
|
|
18
18
|
const utils_1 = require("../../../common/utils");
|
|
19
19
|
const config_service_1 = require("../../../config/config.service");
|
|
20
|
+
const vendure_logger_1 = require("../../../config/logger/vendure-logger");
|
|
20
21
|
let PaymentStateMachine = class PaymentStateMachine {
|
|
21
22
|
constructor(configService) {
|
|
22
23
|
this.configService = configService;
|
|
@@ -45,7 +46,11 @@ let PaymentStateMachine = class PaymentStateMachine {
|
|
|
45
46
|
const customProcesses = (_a = this.configService.paymentOptions.customPaymentProcess) !== null && _a !== void 0 ? _a : [];
|
|
46
47
|
const processes = [...customProcesses, ...((_b = this.configService.paymentOptions.process) !== null && _b !== void 0 ? _b : [])];
|
|
47
48
|
const allTransitions = processes.reduce((transitions, process) => (0, merge_transition_definitions_1.mergeTransitionDefinitions)(transitions, process.transitions), {});
|
|
48
|
-
(0, validate_transition_definition_1.validateTransitionDefinition)(allTransitions, this.initialState);
|
|
49
|
+
const validationResult = (0, validate_transition_definition_1.validateTransitionDefinition)(allTransitions, this.initialState);
|
|
50
|
+
if (!validationResult.valid && validationResult.error) {
|
|
51
|
+
vendure_logger_1.Logger.error(`The payment process has an invalid configuration:`);
|
|
52
|
+
throw new Error(validationResult.error);
|
|
53
|
+
}
|
|
49
54
|
return {
|
|
50
55
|
transitions: allTransitions,
|
|
51
56
|
onTransitionStart: async (fromState, toState, data) => {
|