@unchainedshop/core-bookmarks 5.0.0-alpha.5 → 5.0.0-alpha.8

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.
Files changed (2) hide show
  1. package/README.md +8 -48
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -13,62 +13,22 @@ npm install @unchainedshop/core-bookmarks
13
13
 
14
14
  ## Usage
15
15
 
16
- ```typescript
17
- import { configureBookmarksModule } from '@unchainedshop/core-bookmarks';
16
+ The platform initializes this module as `platform.unchainedAPI.modules.bookmarks`.
18
17
 
19
- const bookmarksModule = await configureBookmarksModule({ db });
18
+ ```typescript
19
+ const { bookmarks } = platform.unchainedAPI.modules;
20
20
 
21
- // Create a bookmark
22
- const bookmarkId = await bookmarksModule.create({
21
+ const bookmarkId = await bookmarks.create({
23
22
  userId: 'user-123',
24
23
  productId: 'product-456',
25
24
  });
26
-
27
- // Find bookmarks by user
28
- const bookmarks = await bookmarksModule.findBookmarksByUserId('user-123');
25
+ const bookmark = await bookmarks.findBookmarkById(bookmarkId);
26
+ const wishlist = await bookmarks.findBookmarksByUserId('user-123');
29
27
  ```
30
28
 
31
- ## API Overview
32
-
33
- ### Module Configuration
34
-
35
- | Export | Description |
36
- |--------|-------------|
37
- | `configureBookmarksModule` | Configure and return the bookmarks module |
38
-
39
- ### Queries
40
-
41
- | Method | Description |
42
- |--------|-------------|
43
- | `findBookmarkById` | Find a bookmark by its ID |
44
- | `findBookmarksByUserId` | Find all bookmarks for a user |
45
- | `findBookmarks` | Find bookmarks with custom query |
46
-
47
- ### Mutations
48
-
49
- | Method | Description |
50
- |--------|-------------|
51
- | `create` | Create a new bookmark |
52
- | `update` | Update an existing bookmark |
53
- | `delete` | Delete a bookmark |
54
- | `deleteByUserId` | Delete all bookmarks for a user |
55
- | `deleteByProductId` | Delete all bookmarks for a product |
56
- | `replaceUserId` | Transfer bookmarks between users |
57
-
58
- ### Types
59
-
60
- | Export | Description |
61
- |--------|-------------|
62
- | `Bookmark` | Bookmark document type |
63
- | `BookmarksModule` | Module interface type |
64
-
65
- ## Events
29
+ `create` returns the bookmark ID. `replaceUserId` supports transferring bookmarks during guest-to-user conversion.
66
30
 
67
- | Event | Description |
68
- |-------|-------------|
69
- | `BOOKMARK_CREATE` | Emitted when a bookmark is created |
70
- | `BOOKMARK_UPDATE` | Emitted when a bookmark is updated |
71
- | `BOOKMARK_REMOVE` | Emitted when a bookmark is removed |
31
+ See the [module guide](https://docs.unchained.shop/platform-configuration/modules/bookmarks), [public exports](src/bookmarks-index.ts), and [module implementation](src/module/configureBookmarksModule.ts) for the API and events.
72
32
 
73
33
  ## License
74
34
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-bookmarks",
3
3
  "description": "User bookmark and wishlist module for the Unchained Engine",
4
- "version": "5.0.0-alpha.5",
4
+ "version": "5.0.0-alpha.8",
5
5
  "main": "lib/bookmarks-index.js",
6
6
  "types": "lib/bookmarks-index.d.ts",
7
7
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "homepage": "https://github.com/unchainedshop/unchained#readme",
37
37
  "dependencies": {
38
- "@unchainedshop/events": "^5.0.0-alpha.5",
39
- "@unchainedshop/mongodb": "^5.0.0-alpha.5"
38
+ "@unchainedshop/events": "^5.0.0-alpha.8",
39
+ "@unchainedshop/mongodb": "^5.0.0-alpha.8"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^26.2.0",