@dotdev/harmony-sdk 1.0.7 → 1.1.0
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 +105 -52
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -1,37 +1,26 @@
|
|
|
1
|
-
# Harmony
|
|
1
|
+
# Harmony SDK
|
|
2
2
|
|
|
3
|
-
Harmony
|
|
3
|
+
Harmony SDK is a TypeScript library for interacting with the Harmony API. It provides a set of modules to perform various operations such as authentication, stock lookup, stock level lookup, point of sale operations, carrier management, diary management, and gift voucher handling.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Table of Contents
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- [
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Development](#development)
|
|
10
|
+
- [Implemented Endpoints](#implemented-endpoints)
|
|
10
11
|
|
|
11
|
-
## Installation
|
|
12
|
+
## Installation
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
To install the Harmony SDK, use the following command:
|
|
14
15
|
|
|
15
16
|
```bash
|
|
16
|
-
|
|
17
|
-
cd [your monorepo directory]
|
|
18
|
-
pnpm install
|
|
17
|
+
npm install @dotdev/harmony-sdk
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
To build the SDK locally, run the following command:
|
|
24
|
-
|
|
25
|
-
1. Navigate to the SDK directory
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
cd packages/harmony-sdk
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
2. Run the build command - This will generate compiled JavaScript files and type declaration files in the `dist` directory.
|
|
20
|
+
or if you're using pnpm:
|
|
32
21
|
|
|
33
22
|
```bash
|
|
34
|
-
pnpm
|
|
23
|
+
pnpm add @dotdev/harmony-sdk
|
|
35
24
|
```
|
|
36
25
|
|
|
37
26
|
## Usage
|
|
@@ -39,50 +28,114 @@ pnpm run build
|
|
|
39
28
|
Here's a basic example of how to use the Harmony SDK:
|
|
40
29
|
|
|
41
30
|
```typescript
|
|
42
|
-
import { HarmonyAPI } from "@
|
|
31
|
+
import { HarmonyAPI, AuthenticationToken } from "@dotdev/harmony-sdk";
|
|
43
32
|
|
|
44
|
-
const api = new HarmonyAPI("
|
|
33
|
+
const api = new HarmonyAPI("https://your-harmony-api-url.com");
|
|
45
34
|
|
|
46
35
|
async function main() {
|
|
36
|
+
const authToken: AuthenticationToken = {
|
|
37
|
+
// Fill in your authentication details
|
|
38
|
+
};
|
|
39
|
+
|
|
47
40
|
try {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log("Stock info:", stockInfo);
|
|
41
|
+
const sessionId = await api.authenticate(authToken);
|
|
42
|
+
console.log("Authenticated successfully. Session ID:", sessionId);
|
|
43
|
+
|
|
44
|
+
// Example: Perform a stock lookup
|
|
45
|
+
const stockLookupParams = {
|
|
46
|
+
// Fill in your stock lookup parameters
|
|
47
|
+
};
|
|
48
|
+
const stockResults = await api.stockLookup(stockLookupParams, sessionId);
|
|
49
|
+
console.log("Stock lookup results:", stockResults);
|
|
50
|
+
|
|
51
|
+
// Use other methods as needed...
|
|
60
52
|
} catch (error) {
|
|
61
|
-
console.error("
|
|
53
|
+
console.error("Error:", error);
|
|
62
54
|
}
|
|
63
55
|
}
|
|
56
|
+
|
|
57
|
+
main();
|
|
64
58
|
```
|
|
65
59
|
|
|
66
60
|
## Development
|
|
67
61
|
|
|
68
|
-
To
|
|
62
|
+
To set up the development environment:
|
|
69
63
|
|
|
70
|
-
1.
|
|
71
|
-
1. Write tests for your changes in the tests directory.
|
|
72
|
-
1. Run tests:
|
|
64
|
+
1. Clone the repository:
|
|
73
65
|
|
|
74
|
-
```bash
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
```bash
|
|
67
|
+
git clone git@bitbucket.org:dotcollectiveanz/harmony-sdk.git
|
|
68
|
+
cd harmony-sdk
|
|
69
|
+
```
|
|
77
70
|
|
|
78
|
-
|
|
71
|
+
2. Install dependencies:
|
|
79
72
|
|
|
80
|
-
```bash
|
|
81
|
-
pnpm
|
|
82
|
-
```
|
|
73
|
+
```bash
|
|
74
|
+
pnpm install
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
3. Build the project:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pnpm run build
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
4. Run tests:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pnpm test
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
5. To watch for changes during development:
|
|
90
|
+
```bash
|
|
91
|
+
pnpm run watch
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Implemented Endpoints
|
|
95
|
+
|
|
96
|
+
The Harmony SDK implements the following endpoints:
|
|
97
|
+
|
|
98
|
+
1. Authentication
|
|
99
|
+
|
|
100
|
+
- `authenticate(authToken: AuthenticationToken): Promise<string>`
|
|
101
|
+
|
|
102
|
+
2. Stock Lookup Module
|
|
103
|
+
|
|
104
|
+
- `stockLookup(params: StockLookupRequestParams, sessionId: string): Promise<Stock[]>`
|
|
105
|
+
- `stockCategoryLookup(sessionId: string): Promise<StockCategory[]>`
|
|
106
|
+
- `stockBarcodeLookup(params: StockLookupRequestParams, sessionId: string): Promise<StockBarcode[]>`
|
|
107
|
+
- `stockColorLookup(sessionId: string): Promise<StockColor[]>`
|
|
108
|
+
- `sizeGridLookup(sessionId: string): Promise<SizeGrid[]>`
|
|
109
|
+
- `stockClassificationLookup(sessionId: string, searchType?: StockClassificationType): Promise<StockClassification[]>`
|
|
110
|
+
|
|
111
|
+
3. Stock Level Lookup Module
|
|
112
|
+
|
|
113
|
+
- `warehouseLookup(sessionId: string): Promise<Warehouse[]>`
|
|
114
|
+
- `stockLevelLookup(params: StockLevelLookupQueryParams, sessionId: string): Promise<StockLevel[]>`
|
|
115
|
+
- `stockLevelLookupByWarehouseQuickView(params: StockLevelLookupQueryParams, sessionId: string): Promise<StockLevel[]>`
|
|
116
|
+
|
|
117
|
+
4. Point of Sale Module
|
|
118
|
+
|
|
119
|
+
- `processSalesOrder(params: ProcessSaleOrderQueryParams, sessionId: string): Promise<boolean>`
|
|
120
|
+
- `processReturns(params: ProcessSaleOrderQueryParams, sessionId: string): Promise<boolean>`
|
|
121
|
+
- `modifyExistingSalesOrder(params: ProcessSaleOrderQueryParams, sessionId: string): Promise<boolean>`
|
|
122
|
+
- `cancelExistingSalesOrder(params: ProcessSaleOrderQueryParams, sessionId: string): Promise<boolean>`
|
|
123
|
+
|
|
124
|
+
5. Carrier Module
|
|
125
|
+
|
|
126
|
+
- `getCarrier(sessionId: string): Promise<Carrier[]>`
|
|
127
|
+
- `getCarrierShipmentByOrderNo(orderNo: string, sessionId: string): Promise<CarrierShipment[]>`
|
|
128
|
+
- `getCarrierBySysTime(params: GetCarrierShipmentByTimeQueryParams, sessionId: string): Promise<CarrierShipment[]>`
|
|
129
|
+
|
|
130
|
+
6. Diary Module
|
|
83
131
|
|
|
84
|
-
|
|
132
|
+
- `getDiaryBy(params: GetDiaryQueryParams, sessionId: string): Promise<Diary[]>`
|
|
133
|
+
- `createDiary(params: CreateDiaryQueryParams, sessionId: string): Promise<boolean>`
|
|
85
134
|
|
|
86
|
-
|
|
135
|
+
7. Gift Voucher Module
|
|
136
|
+
- `giftVoucherLookup(params: GiftVoucherLookupQueryParams, sessionId: string): Promise<GiftVoucher[]>`
|
|
137
|
+
- `giftVoucherVerificationKey(params: GiftVoucherVerificationKeyQueryParams, sessionId: string): Promise<string>`
|
|
138
|
+
- `giftVoucherReservation(params: GiftVoucherReservationQueryParams, sessionId: string): Promise<string>`
|
|
139
|
+
- `giftVoucherUsed(params: GiftVoucherUsedQueryParams, sessionId: string): Promise<number>`
|
|
87
140
|
|
|
88
|
-
|
|
141
|
+
For detailed information on each endpoint and its parameters, please refer to the source code and type definitions.
|
package/package.json
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotdev/harmony-sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Harmony API SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
|
-
"keywords": [
|
|
11
|
-
|
|
10
|
+
"keywords": [
|
|
11
|
+
"harmony",
|
|
12
|
+
"sdk",
|
|
13
|
+
"api",
|
|
14
|
+
"client",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
17
|
+
"author": "DotApparel",
|
|
12
18
|
"license": "ISC",
|
|
13
19
|
"dependencies": {
|
|
14
20
|
"axios": "^1.7.2",
|
|
@@ -19,6 +25,7 @@
|
|
|
19
25
|
"@types/node": "^16.3.1",
|
|
20
26
|
"@types/xml2js": "^0.4.14",
|
|
21
27
|
"jest": "^29.7.0",
|
|
28
|
+
"prettier": "^3.3.3",
|
|
22
29
|
"standard-version": "^9.5.0",
|
|
23
30
|
"ts-jest": "^29.1.2",
|
|
24
31
|
"ts-node": "^10.2.1",
|
|
@@ -34,6 +41,7 @@
|
|
|
34
41
|
"build": "tsc",
|
|
35
42
|
"watch": "tsc -w",
|
|
36
43
|
"test": "jest",
|
|
37
|
-
"release": "./release.sh"
|
|
44
|
+
"release": "./release.sh",
|
|
45
|
+
"prettier": "prettier --write ."
|
|
38
46
|
}
|
|
39
47
|
}
|