@labdigital/commercetools-mock 2.15.0 → 2.16.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/README.md +9 -9
- package/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/repositories/customer.ts +13 -0
- package/src/repositories/shopping-list.ts +2 -1
- package/src/services/customer.test.ts +40 -0
- package/src/services/shopping-list.test.ts +18 -1
package/README.md
CHANGED
|
@@ -79,7 +79,15 @@ describe('A module', () => {
|
|
|
79
79
|
|
|
80
80
|
## Contributing
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
This codebases use [@changesets](https://github.com/changesets/changesets) for release and version management
|
|
83
|
+
|
|
84
|
+
- Create a feature branch with new features / fixes (see [Adding a new service](#adding-a-service))
|
|
85
|
+
- When your code changes are complete, add a changeset file to your feature branch using `pnpm changeset`
|
|
86
|
+
- Create a PR to request your changes to be merged to main
|
|
87
|
+
- After your PR is merged, GitHub actions will create a release PR or add your changeset to an existing release PR
|
|
88
|
+
- When the release is ready merge the release branch. A new version will be released
|
|
89
|
+
|
|
90
|
+
### Adding a new service {#adding-a-service}
|
|
83
91
|
|
|
84
92
|
Implement the following:
|
|
85
93
|
|
|
@@ -88,11 +96,3 @@ Implement the following:
|
|
|
88
96
|
- Add new service to src/ctMock.ts ctMock.\_services
|
|
89
97
|
- Add new service to src/storage.ts InMemoryStorage
|
|
90
98
|
- Adjust src/types.ts RepositoryMap and possibly serviceTypes
|
|
91
|
-
|
|
92
|
-
### Releasing
|
|
93
|
-
|
|
94
|
-
This codebases use [@changesets](https://github.com/changesets/changesets) for release and version management
|
|
95
|
-
|
|
96
|
-
- Create a new changeset using `pnpm changeset`
|
|
97
|
-
- Push the changes to the `main` branch.
|
|
98
|
-
- GitHub actions will create a release PR. When the release is ready merge the release branch
|
package/dist/index.cjs
CHANGED
|
@@ -3287,6 +3287,14 @@ var CustomerRepository = class extends AbstractResourceRepository {
|
|
|
3287
3287
|
throw new Error("Resource has no custom field");
|
|
3288
3288
|
}
|
|
3289
3289
|
resource.custom.fields[name] = value;
|
|
3290
|
+
},
|
|
3291
|
+
setCustomerNumber: (_context, resource, { customerNumber }) => {
|
|
3292
|
+
if (resource.customerNumber) {
|
|
3293
|
+
throw new Error(
|
|
3294
|
+
"A Customer number already exists and cannot be set again."
|
|
3295
|
+
);
|
|
3296
|
+
}
|
|
3297
|
+
resource.customerNumber = customerNumber;
|
|
3290
3298
|
}
|
|
3291
3299
|
};
|
|
3292
3300
|
};
|
|
@@ -6282,7 +6290,7 @@ var ShoppingListRepository = class extends AbstractResourceRepository {
|
|
|
6282
6290
|
this._storage
|
|
6283
6291
|
)
|
|
6284
6292
|
};
|
|
6285
|
-
if (variantId) {
|
|
6293
|
+
if (productId && variantId) {
|
|
6286
6294
|
return lineItem;
|
|
6287
6295
|
}
|
|
6288
6296
|
if (sku) {
|
|
@@ -6301,6 +6309,7 @@ var ShoppingListRepository = class extends AbstractResourceRepository {
|
|
|
6301
6309
|
];
|
|
6302
6310
|
const variantId2 = allVariants.find((e) => e.sku === sku)?.id;
|
|
6303
6311
|
lineItem.variantId = variantId2;
|
|
6312
|
+
lineItem.productId = product.id;
|
|
6304
6313
|
return lineItem;
|
|
6305
6314
|
}
|
|
6306
6315
|
if (productId) {
|