@labdigital/commercetools-mock 2.42.0 → 2.42.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/dist/index.cjs +33 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/repositories/associate-role.ts +17 -0
- package/src/repositories/business-unit.ts +17 -0
- package/src/repositories/product-selection.ts +18 -0
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
AssociateRoleDraft,
|
|
6
6
|
AssociateRoleRemovePermissionAction,
|
|
7
7
|
AssociateRoleSetCustomFieldAction,
|
|
8
|
+
AssociateRoleSetCustomTypeAction,
|
|
8
9
|
AssociateRoleSetNameAction,
|
|
9
10
|
AssociateRoleSetPermissionsAction,
|
|
10
11
|
AssociateRoleUpdateAction,
|
|
@@ -107,6 +108,22 @@ class AssociateRoleUpdateHandler
|
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
|
|
111
|
+
setCustomType(
|
|
112
|
+
context: RepositoryContext,
|
|
113
|
+
resource: Writable<AssociateRole>,
|
|
114
|
+
{ type, fields }: AssociateRoleSetCustomTypeAction,
|
|
115
|
+
) {
|
|
116
|
+
if (type) {
|
|
117
|
+
resource.custom = createCustomFields(
|
|
118
|
+
{ type, fields },
|
|
119
|
+
context.projectKey,
|
|
120
|
+
this._storage,
|
|
121
|
+
);
|
|
122
|
+
} else {
|
|
123
|
+
resource.custom = undefined;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
110
127
|
setName(
|
|
111
128
|
context: RepositoryContext,
|
|
112
129
|
resource: Writable<AssociateRole>,
|
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
BusinessUnitChangeApprovalRuleModeAction,
|
|
3
3
|
BusinessUnitChangeAssociateModeAction,
|
|
4
4
|
BusinessUnitChangeStatusAction,
|
|
5
|
+
BusinessUnitSetCustomTypeAction,
|
|
5
6
|
BusinessUnitUpdateAction,
|
|
6
7
|
CompanyDraft,
|
|
7
8
|
DivisionDraft,
|
|
@@ -260,6 +261,22 @@ class BusinessUnitUpdateHandler
|
|
|
260
261
|
resource.contactEmail = contactEmail;
|
|
261
262
|
}
|
|
262
263
|
|
|
264
|
+
setCustomType(
|
|
265
|
+
context: RepositoryContext,
|
|
266
|
+
resource: Writable<BusinessUnit>,
|
|
267
|
+
{ type, fields }: BusinessUnitSetCustomTypeAction,
|
|
268
|
+
) {
|
|
269
|
+
if (type) {
|
|
270
|
+
resource.custom = createCustomFields(
|
|
271
|
+
{ type, fields },
|
|
272
|
+
context.projectKey,
|
|
273
|
+
this._storage,
|
|
274
|
+
);
|
|
275
|
+
} else {
|
|
276
|
+
resource.custom = undefined;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
263
280
|
setStoreMode(
|
|
264
281
|
context: RepositoryContext,
|
|
265
282
|
resource: Writable<BusinessUnit>,
|
|
@@ -2,8 +2,10 @@ import type {
|
|
|
2
2
|
ProductSelection,
|
|
3
3
|
ProductSelectionChangeNameAction,
|
|
4
4
|
ProductSelectionDraft,
|
|
5
|
+
ProductSelectionSetCustomTypeAction,
|
|
5
6
|
ProductSelectionUpdateAction,
|
|
6
7
|
} from "@commercetools/platform-sdk";
|
|
8
|
+
import { createCustomFields } from "~src/repositories/helpers";
|
|
7
9
|
import { getBaseResourceProperties } from "../helpers";
|
|
8
10
|
import type { AbstractStorage } from "../storage/abstract";
|
|
9
11
|
import type { Writable } from "../types";
|
|
@@ -45,4 +47,20 @@ class ProductSelectionUpdateHandler
|
|
|
45
47
|
) {
|
|
46
48
|
resource.name = name;
|
|
47
49
|
}
|
|
50
|
+
|
|
51
|
+
setCustomType(
|
|
52
|
+
context: RepositoryContext,
|
|
53
|
+
resource: Writable<ProductSelection>,
|
|
54
|
+
{ type, fields }: ProductSelectionSetCustomTypeAction,
|
|
55
|
+
) {
|
|
56
|
+
if (type) {
|
|
57
|
+
resource.custom = createCustomFields(
|
|
58
|
+
{ type, fields },
|
|
59
|
+
context.projectKey,
|
|
60
|
+
this._storage,
|
|
61
|
+
);
|
|
62
|
+
} else {
|
|
63
|
+
resource.custom = undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
48
66
|
}
|