@unchainedshop/core-bookmarks 4.8.29 → 5.0.0-alpha.10
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 +8 -48
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -13,62 +13,22 @@ npm install @unchainedshop/core-bookmarks
|
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
import { configureBookmarksModule } from '@unchainedshop/core-bookmarks';
|
|
16
|
+
The platform initializes this module as `platform.unchainedAPI.modules.bookmarks`.
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
```typescript
|
|
19
|
+
const { bookmarks } = platform.unchainedAPI.modules;
|
|
20
20
|
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-bookmarks",
|
|
3
3
|
"description": "User bookmark and wishlist module for the Unchained Engine",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0-alpha.10",
|
|
5
|
+
"files": [
|
|
6
|
+
"lib"
|
|
7
|
+
],
|
|
5
8
|
"main": "lib/bookmarks-index.js",
|
|
6
9
|
"types": "lib/bookmarks-index.d.ts",
|
|
7
10
|
"type": "module",
|
|
@@ -35,11 +38,11 @@
|
|
|
35
38
|
},
|
|
36
39
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
37
40
|
"dependencies": {
|
|
38
|
-
"@unchainedshop/events": "^
|
|
39
|
-
"@unchainedshop/mongodb": "^
|
|
41
|
+
"@unchainedshop/events": "^5.0.0-alpha.10",
|
|
42
|
+
"@unchainedshop/mongodb": "^5.0.0-alpha.10"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"@types/node": "^26.2.0",
|
|
43
|
-
"typescript": "^
|
|
46
|
+
"typescript": "^6.0.3"
|
|
44
47
|
}
|
|
45
48
|
}
|