@unchainedshop/core-currencies 5.0.0-alpha.5 → 5.0.0-alpha.7
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 -49
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,60 +13,19 @@ npm install @unchainedshop/core-currencies
|
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
import { configureCurrenciesModule } from '@unchainedshop/core-currencies';
|
|
18
|
-
|
|
19
|
-
const currenciesModule = await configureCurrenciesModule({ db });
|
|
16
|
+
The platform initializes this module as `platform.unchainedAPI.modules.currencies`.
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
isoCode: 'CHF',
|
|
24
|
-
});
|
|
18
|
+
```typescript
|
|
19
|
+
const { currencies } = platform.unchainedAPI.modules;
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
const
|
|
21
|
+
const currencyId = await currencies.create({ isoCode: 'CHF', isActive: true });
|
|
22
|
+
const currency = await currencies.findCurrency({ currencyId });
|
|
23
|
+
const activeCurrencies = await currencies.findCurrencies({ includeInactive: false });
|
|
28
24
|
```
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Module Configuration
|
|
33
|
-
|
|
34
|
-
| Export | Description |
|
|
35
|
-
|--------|-------------|
|
|
36
|
-
| `configureCurrenciesModule` | Configure and return the currencies module |
|
|
37
|
-
|
|
38
|
-
### Queries
|
|
39
|
-
|
|
40
|
-
| Method | Description |
|
|
41
|
-
|--------|-------------|
|
|
42
|
-
| `findCurrency` | Find currency by ID or ISO code |
|
|
43
|
-
| `findCurrencies` | Find currencies with filtering, sorting, and pagination |
|
|
44
|
-
| `count` | Count currencies matching query |
|
|
45
|
-
| `currencyExists` | Check if a currency exists |
|
|
46
|
-
|
|
47
|
-
### Mutations
|
|
48
|
-
|
|
49
|
-
| Method | Description |
|
|
50
|
-
|--------|-------------|
|
|
51
|
-
| `create` | Create a new currency |
|
|
52
|
-
| `update` | Update an existing currency |
|
|
53
|
-
| `delete` | Soft delete a currency |
|
|
54
|
-
|
|
55
|
-
### Types
|
|
56
|
-
|
|
57
|
-
| Export | Description |
|
|
58
|
-
|--------|-------------|
|
|
59
|
-
| `Currency` | Currency document type |
|
|
60
|
-
| `CurrencyQuery` | Query parameters type |
|
|
61
|
-
| `CurrenciesModule` | Module interface type |
|
|
62
|
-
|
|
63
|
-
## Events
|
|
26
|
+
`create` returns a currency ID. Monetary amounts use integer minor units; use the currency's decimal precision when converting amounts for display.
|
|
64
27
|
|
|
65
|
-
|
|
66
|
-
|-------|-------------|
|
|
67
|
-
| `CURRENCY_CREATE` | Emitted when a currency is created |
|
|
68
|
-
| `CURRENCY_UPDATE` | Emitted when a currency is updated |
|
|
69
|
-
| `CURRENCY_REMOVE` | Emitted when a currency is removed |
|
|
28
|
+
See the [module guide](https://docs.unchained.shop/platform-configuration/modules/currencies), [public exports](src/currencies-index.ts), and [module implementation](src/module/configureCurrenciesModule.ts) for the API and events.
|
|
70
29
|
|
|
71
30
|
## License
|
|
72
31
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-currencies",
|
|
3
3
|
"description": "Currency management module for the Unchained Engine",
|
|
4
|
-
"version": "5.0.0-alpha.
|
|
4
|
+
"version": "5.0.0-alpha.7",
|
|
5
5
|
"main": "lib/currencies-index.js",
|
|
6
6
|
"types": "lib/currencies-index.d.ts",
|
|
7
7
|
"type": "module",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@unchainedshop/events": "^5.0.0-alpha.
|
|
39
|
-
"@unchainedshop/mongodb": "^5.0.0-alpha.
|
|
40
|
-
"@unchainedshop/utils": "^5.0.0-alpha.
|
|
38
|
+
"@unchainedshop/events": "^5.0.0-alpha.7",
|
|
39
|
+
"@unchainedshop/mongodb": "^5.0.0-alpha.7",
|
|
40
|
+
"@unchainedshop/utils": "^5.0.0-alpha.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^26.2.0",
|