shipflow 0.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 +328 -0
- package/dist/carriers/aymakan/adapter.d.ts +87 -0
- package/dist/carriers/aymakan/adapter.d.ts.map +1 -0
- package/dist/carriers/aymakan/index.d.ts +9 -0
- package/dist/carriers/aymakan/index.d.ts.map +1 -0
- package/dist/carriers/aymakan/index.js +625 -0
- package/dist/carriers/aymakan/index.js.map +12 -0
- package/dist/carriers/aymakan/mappers.d.ts +21 -0
- package/dist/carriers/aymakan/mappers.d.ts.map +1 -0
- package/dist/carriers/aymakan/services.d.ts +47 -0
- package/dist/carriers/aymakan/services.d.ts.map +1 -0
- package/dist/carriers/aymakan/types.d.ts +287 -0
- package/dist/carriers/aymakan/types.d.ts.map +1 -0
- package/dist/carriers/base.d.ts +88 -0
- package/dist/carriers/base.d.ts.map +1 -0
- package/dist/carriers/smsaexpress/adapter.d.ts +57 -0
- package/dist/carriers/smsaexpress/adapter.d.ts.map +1 -0
- package/dist/carriers/smsaexpress/index.d.ts +9 -0
- package/dist/carriers/smsaexpress/index.d.ts.map +1 -0
- package/dist/carriers/smsaexpress/index.js +408 -0
- package/dist/carriers/smsaexpress/index.js.map +12 -0
- package/dist/carriers/smsaexpress/mappers.d.ts +45 -0
- package/dist/carriers/smsaexpress/mappers.d.ts.map +1 -0
- package/dist/carriers/smsaexpress/services.d.ts +21 -0
- package/dist/carriers/smsaexpress/services.d.ts.map +1 -0
- package/dist/carriers/smsaexpress/types.d.ts +197 -0
- package/dist/carriers/smsaexpress/types.d.ts.map +1 -0
- package/dist/client.d.ts +44 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/core/errors.d.ts +69 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/http.d.ts +72 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/schemas.d.ts +832 -0
- package/dist/core/schemas.d.ts.map +1 -0
- package/dist/core/types.d.ts +234 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/index-x8sk1kw9.js +4600 -0
- package/dist/index-x8sk1kw9.js.map +22 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/index.js.map +10 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# ShipFlow
|
|
2
|
+
|
|
3
|
+
Unified Shipping SDK for MENA region carriers. A single API to create shipments, track packages, manage labels, handle webhooks, and more — across Aymakan, SMSA Express, and future carriers.
|
|
4
|
+
|
|
5
|
+
Think EasyPost / Shippo, but purpose-built for Saudi Arabia and the GCC.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Unified types** — one `CreateShipmentInput`, one `TrackingResult`, one `WebhookEvent`, regardless of carrier
|
|
10
|
+
- **Tree-shakeable** — only the carriers you import are bundled
|
|
11
|
+
- **Auto-validation** — Zod schemas validate every `createShipment()` call before it hits the network
|
|
12
|
+
- **Webhook parsing** — normalize incoming carrier webhooks into a single event format
|
|
13
|
+
- **Zero runtime dependencies** — Bun-native `fetch`, no axios/node-fetch
|
|
14
|
+
- **TypeScript-first** — strict types, no `any`
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bun add shipflow
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { ShipFlow } from "shipflow";
|
|
26
|
+
import { AymakanAdapter, AymakanService } from "shipflow/carriers/aymakan";
|
|
27
|
+
import { SMSAExpressAdapter, SMSAService } from "shipflow/carriers/smsaexpress";
|
|
28
|
+
|
|
29
|
+
const client = new ShipFlow({
|
|
30
|
+
adapters: [
|
|
31
|
+
new AymakanAdapter({
|
|
32
|
+
mode: "sandbox",
|
|
33
|
+
credentials: { apiKey: process.env.AYMAKAN_API_KEY! },
|
|
34
|
+
}),
|
|
35
|
+
new SMSAExpressAdapter({
|
|
36
|
+
mode: "sandbox",
|
|
37
|
+
credentials: { apiKey: process.env.SMSA_API_KEY! },
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Create a shipment (auto-validated)
|
|
43
|
+
const shipment = await client.carrier("aymakan").createShipment({
|
|
44
|
+
shipper: {
|
|
45
|
+
name: "My Store",
|
|
46
|
+
phone: "966500000000",
|
|
47
|
+
line1: "123 Main St",
|
|
48
|
+
city: "Riyadh",
|
|
49
|
+
countryCode: "SA",
|
|
50
|
+
},
|
|
51
|
+
consignee: {
|
|
52
|
+
name: "Customer",
|
|
53
|
+
phone: "966500000001",
|
|
54
|
+
line1: "456 Side St",
|
|
55
|
+
city: "Jeddah",
|
|
56
|
+
countryCode: "SA",
|
|
57
|
+
},
|
|
58
|
+
parcels: [{ weight: { value: 2, unit: "kg" }, pieces: 1 }],
|
|
59
|
+
serviceType: AymakanService.ECOMMERCE,
|
|
60
|
+
cod: { enabled: true, amount: 150, currency: "SAR" },
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
console.log(shipment.trackingNumber); // "AY..."
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## API Reference
|
|
67
|
+
|
|
68
|
+
### ShipFlow Client
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
const client = new ShipFlow({ adapters: [...] });
|
|
72
|
+
|
|
73
|
+
client.carrier('aymakan') // Get a specific carrier adapter
|
|
74
|
+
client.carriers // List configured carrier names
|
|
75
|
+
client.hasCarrier('smsaexpress') // Check if a carrier is configured
|
|
76
|
+
await client.getRatesFromAll(input) // Fetch rates from all carriers in parallel
|
|
77
|
+
await client.trackAcrossCarriers(tn) // Try all carriers to find tracking info
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Carrier Operations
|
|
81
|
+
|
|
82
|
+
Every carrier adapter implements these **required** methods:
|
|
83
|
+
|
|
84
|
+
| Method | Description |
|
|
85
|
+
| ----------------------------------- | ----------------------------------------- |
|
|
86
|
+
| `createShipment(input)` | Create a single shipment (auto-validated) |
|
|
87
|
+
| `cancelShipment(trackingNumber)` | Cancel a shipment |
|
|
88
|
+
| `track(trackingNumber)` | Track a single shipment |
|
|
89
|
+
| `trackMultiple(trackingNumbers)` | Track multiple shipments |
|
|
90
|
+
| `getLabel(trackingNumber, format?)` | Get label URL or data URI |
|
|
91
|
+
|
|
92
|
+
Plus these **optional** methods (availability varies by carrier):
|
|
93
|
+
|
|
94
|
+
| Method | Aymakan | SMSA |
|
|
95
|
+
| ------------------------------------ | ------- | ---- |
|
|
96
|
+
| `createBulkShipments(inputs)` | ✅ | — |
|
|
97
|
+
| `cancelByReference(ref)` | ✅ | — |
|
|
98
|
+
| `updateDeliveryAddress(tn, address)` | ✅ | — |
|
|
99
|
+
| `trackByReference(ref)` | ✅ | ✅ |
|
|
100
|
+
| `getBulkLabels(trackingNumbers)` | ✅ | — |
|
|
101
|
+
| `getPickupCities()` | ✅ | — |
|
|
102
|
+
| `getTimeSlots(city, date)` | ✅ | — |
|
|
103
|
+
| `createPickup(input)` | ✅ | — |
|
|
104
|
+
| `cancelPickup(id)` | ✅ | — |
|
|
105
|
+
| `getPickupRequests()` | ✅ | — |
|
|
106
|
+
| `getCities()` | ✅ | ✅ |
|
|
107
|
+
| `getDropoffLocations()` | ✅ | ✅ |
|
|
108
|
+
| `createCustomerAddress(addr)` | ✅ | — |
|
|
109
|
+
| `getCustomerAddresses()` | ✅ | — |
|
|
110
|
+
| `updateCustomerAddress(id, addr)` | ✅ | — |
|
|
111
|
+
| `deleteCustomerAddress(id)` | ✅ | — |
|
|
112
|
+
| `parseWebhook(payload, options)` | ✅ | ✅ |
|
|
113
|
+
|
|
114
|
+
SMSA-specific methods:
|
|
115
|
+
|
|
116
|
+
| Method | Description |
|
|
117
|
+
| ------------------------------------- | ---------------------------------------- |
|
|
118
|
+
| `create2WayShipment(input)` | Create forward + return shipment |
|
|
119
|
+
| `sendInvoice(request)` | Submit invoice for a shipment |
|
|
120
|
+
| `validateShortAddress(shortCode)` | Resolve Saudi national address |
|
|
121
|
+
| `pushIdDetails(request)` | Submit identity documents for KYC |
|
|
122
|
+
| `parseWebhookBatch(payload, options)` | Parse batch webhook (array of shipments) |
|
|
123
|
+
|
|
124
|
+
## Carrier Support
|
|
125
|
+
|
|
126
|
+
| Feature | Aymakan | SMSA Express |
|
|
127
|
+
| ----------------- | ------------------------------- | ---------------------------------- |
|
|
128
|
+
| Countries | SA, AE, BH, KW, OM, QA | SA, AE, BH, EG, KW, OM, QA, JO |
|
|
129
|
+
| Service types | 10 (ONP, SDD, RVP, EXH, ...) | 3 (EDDL, EDEL, EDCR) |
|
|
130
|
+
| Shipment creation | Single + Bulk | B2C + C2B + 2-Way |
|
|
131
|
+
| COD | ✅ | ✅ (B2C only) |
|
|
132
|
+
| Cancellation | By tracking # or reference | C2B only |
|
|
133
|
+
| Tracking | Single, bulk, by reference | Single, bulk, by reference |
|
|
134
|
+
| Labels | PDF/PNG, single + bulk | PDF/ZPL |
|
|
135
|
+
| Pickups | Full lifecycle | — |
|
|
136
|
+
| Webhooks | ✅ (with auth verification) | ✅ (batch, with auth verification) |
|
|
137
|
+
| City resolution | Arabic ↔ English smart matching | Code-based lookup |
|
|
138
|
+
| Rates | ❌ | ❌ |
|
|
139
|
+
|
|
140
|
+
## Webhook Handling
|
|
141
|
+
|
|
142
|
+
### Aymakan
|
|
143
|
+
|
|
144
|
+
Aymakan sends a single shipment status update per webhook call:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
const event = client.carrier("aymakan").parseWebhook!(requestBody, {
|
|
148
|
+
headers: req.headers,
|
|
149
|
+
config: {
|
|
150
|
+
authHeader: "X-Aymakan-Auth",
|
|
151
|
+
authValue: process.env.AYMAKAN_WEBHOOK_SECRET!,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
console.log(event.trackingNumber); // "AY..."
|
|
156
|
+
console.log(event.status); // "delivered"
|
|
157
|
+
console.log(event.statusCode); // "AY-0005"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### SMSA Express
|
|
161
|
+
|
|
162
|
+
SMSA sends an **array** of shipment updates per webhook call:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
const adapter = client.carrier("smsaexpress") as SMSAExpressAdapter;
|
|
166
|
+
|
|
167
|
+
// Parse all shipments in the batch
|
|
168
|
+
const events = adapter.parseWebhookBatch(requestBody, {
|
|
169
|
+
queryParams: { key: req.query.key },
|
|
170
|
+
config: {
|
|
171
|
+
authQueryParam: "key",
|
|
172
|
+
authQueryValue: process.env.SMSA_WEBHOOK_KEY!,
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
for (const event of events) {
|
|
177
|
+
console.log(event.trackingNumber); // "231200021000"
|
|
178
|
+
console.log(event.status); // "delivered" | "out_for_delivery" | ...
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Or parse only the first item (CarrierAdapter interface compatible)
|
|
182
|
+
const single = adapter.parseWebhook(requestBody);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### WebhookEvent Shape
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
interface WebhookEvent {
|
|
189
|
+
carrier: string;
|
|
190
|
+
eventType: "status_update" | "weight_update";
|
|
191
|
+
trackingNumber: string;
|
|
192
|
+
reference?: string;
|
|
193
|
+
status: ShipmentStatus;
|
|
194
|
+
statusCode: string;
|
|
195
|
+
statusLabel: string;
|
|
196
|
+
reasonCode?: string; // Aymakan: reason for failed delivery
|
|
197
|
+
reasonLabel?: string;
|
|
198
|
+
timestamp: Date;
|
|
199
|
+
raw: unknown; // Original carrier payload
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Input Validation
|
|
204
|
+
|
|
205
|
+
All `createShipment()` calls are **automatically validated** using Zod schemas before hitting the carrier API. Invalid input throws a `ValidationError` with field-level details:
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
try {
|
|
209
|
+
await client.carrier("aymakan").createShipment({
|
|
210
|
+
shipper: { name: "", phone: "", line1: "", city: "", countryCode: "X" },
|
|
211
|
+
consignee: { name: "", phone: "", line1: "", city: "", countryCode: "" },
|
|
212
|
+
parcels: [],
|
|
213
|
+
serviceType: "",
|
|
214
|
+
});
|
|
215
|
+
} catch (error) {
|
|
216
|
+
if (error instanceof ValidationError) {
|
|
217
|
+
console.log(error.issues);
|
|
218
|
+
// [
|
|
219
|
+
// { path: "shipper.name", message: "Name is required" },
|
|
220
|
+
// { path: "shipper.countryCode", message: "Country code must be ISO 3166-1 alpha-2 (2 characters)" },
|
|
221
|
+
// { path: "parcels", message: "At least one parcel is required" },
|
|
222
|
+
// ...
|
|
223
|
+
// ]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
You can also validate manually before calling the API:
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import { validateCreateShipmentInput, validatePickupRequest } from "shipflow";
|
|
232
|
+
|
|
233
|
+
validateCreateShipmentInput(input); // throws ValidationError or returns validated input
|
|
234
|
+
validatePickupRequest(pickupInput); // same pattern
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Exported Zod schemas for advanced use (custom refinements, partial validation, etc.):
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
import {
|
|
241
|
+
AddressSchema,
|
|
242
|
+
ParcelSchema,
|
|
243
|
+
CreateShipmentInputSchema,
|
|
244
|
+
PickupRequestSchema,
|
|
245
|
+
} from "shipflow";
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Error Handling
|
|
249
|
+
|
|
250
|
+
All errors extend `ShipFlowError` for easy catch-all handling:
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
import {
|
|
254
|
+
ShipFlowError,
|
|
255
|
+
NetworkError,
|
|
256
|
+
APIError,
|
|
257
|
+
ValidationError,
|
|
258
|
+
AuthenticationError,
|
|
259
|
+
WebhookVerificationError,
|
|
260
|
+
UnsupportedOperationError,
|
|
261
|
+
} from "shipflow";
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
await client.carrier("aymakan").createShipment(input);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
if (error instanceof ValidationError) {
|
|
267
|
+
// Bad input — check error.issues
|
|
268
|
+
} else if (error instanceof AuthenticationError) {
|
|
269
|
+
// Invalid API key
|
|
270
|
+
} else if (error instanceof APIError) {
|
|
271
|
+
// Carrier returned an error — check error.statusCode, error.errors
|
|
272
|
+
} else if (error instanceof NetworkError) {
|
|
273
|
+
// Timeout, DNS, connection refused
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Custom Adapters
|
|
279
|
+
|
|
280
|
+
Implement the `CarrierAdapter` interface or extend `BaseCarrierAdapter`:
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
import { BaseCarrierAdapter } from "shipflow";
|
|
284
|
+
import type { CreateShipmentInput, Shipment, TrackingResult } from "shipflow";
|
|
285
|
+
|
|
286
|
+
class MyCarrierAdapter extends BaseCarrierAdapter {
|
|
287
|
+
readonly name = "mycarrier";
|
|
288
|
+
readonly supportedCountries = ["SA"];
|
|
289
|
+
|
|
290
|
+
protected getBaseUrl() {
|
|
291
|
+
return this.config.mode === "production"
|
|
292
|
+
? "https://api.mycarrier.com"
|
|
293
|
+
: "https://sandbox.mycarrier.com";
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
protected async executeCreateShipment(
|
|
297
|
+
input: CreateShipmentInput,
|
|
298
|
+
): Promise<Shipment> {
|
|
299
|
+
// Your implementation — input is already validated by BaseCarrierAdapter
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async cancelShipment(trackingNumber: string): Promise<boolean> {
|
|
303
|
+
/* ... */
|
|
304
|
+
}
|
|
305
|
+
async track(trackingNumber: string): Promise<TrackingResult> {
|
|
306
|
+
/* ... */
|
|
307
|
+
}
|
|
308
|
+
async trackMultiple(trackingNumbers: string[]): Promise<TrackingResult[]> {
|
|
309
|
+
/* ... */
|
|
310
|
+
}
|
|
311
|
+
async getLabel(trackingNumber: string): Promise<string> {
|
|
312
|
+
/* ... */
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Development
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
bun install
|
|
321
|
+
bun test # Run all tests
|
|
322
|
+
bun test --watch # Watch mode
|
|
323
|
+
bun run typecheck # TypeScript check
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## License
|
|
327
|
+
|
|
328
|
+
MIT
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aymakan Carrier Adapter
|
|
3
|
+
* Full implementation of the CarrierAdapter interface for Aymakan API.
|
|
4
|
+
*/
|
|
5
|
+
import type { Address, CarrierConfig, City, CreateShipmentInput, CustomerAddress, Pickup, PickupRequest, Shipment, TimeSlot, TrackingResult, WebhookConfig, WebhookEvent } from "../../core/types.js";
|
|
6
|
+
import { BaseCarrierAdapter } from "../base.js";
|
|
7
|
+
export interface AymakanConfig extends CarrierConfig {
|
|
8
|
+
credentials: {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare class AymakanAdapter extends BaseCarrierAdapter {
|
|
13
|
+
readonly name = "aymakan";
|
|
14
|
+
readonly supportedCountries: string[];
|
|
15
|
+
private http;
|
|
16
|
+
/** Cached Aymakan cities list for city name resolution */
|
|
17
|
+
private citiesCache;
|
|
18
|
+
private citiesCacheTime;
|
|
19
|
+
/** Cache TTL: 1 hour */
|
|
20
|
+
private static readonly CITIES_CACHE_TTL;
|
|
21
|
+
constructor(config: AymakanConfig);
|
|
22
|
+
protected getBaseUrl(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Load cities list from Aymakan API and cache it.
|
|
25
|
+
* Silently falls back to empty list on failure so shipments can still be attempted.
|
|
26
|
+
*/
|
|
27
|
+
private ensureCitiesLoaded;
|
|
28
|
+
/**
|
|
29
|
+
* Normalize Arabic text for comparison:
|
|
30
|
+
* - Strip diacritics (tashkeel)
|
|
31
|
+
* - Normalize alef variants (أ إ آ → ا)
|
|
32
|
+
* - Normalize taa marbuta (ة → ه)
|
|
33
|
+
* - Trim whitespace
|
|
34
|
+
*/
|
|
35
|
+
private static normalizeArabic;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve a user-input city name to the valid Aymakan English city name.
|
|
38
|
+
*
|
|
39
|
+
* Matching strategy (first match wins):
|
|
40
|
+
* 1. Exact match on English name (case-insensitive)
|
|
41
|
+
* 2. Exact match on Arabic name
|
|
42
|
+
* 3. Normalized Arabic match (handles tashkeel, alef variants, taa marbuta)
|
|
43
|
+
* 4. Match after stripping "ال" prefix from Arabic input
|
|
44
|
+
* 5. Substring/contains match on English name (case-insensitive)
|
|
45
|
+
*
|
|
46
|
+
* Falls back to the original input if no match is found.
|
|
47
|
+
*/
|
|
48
|
+
private resolveCity;
|
|
49
|
+
/**
|
|
50
|
+
* Resolve city names in a CreateShipmentInput to valid Aymakan city names.
|
|
51
|
+
*/
|
|
52
|
+
private resolveCitiesInInput;
|
|
53
|
+
protected executeCreateShipment(input: CreateShipmentInput): Promise<Shipment>;
|
|
54
|
+
createBulkShipments(inputs: CreateShipmentInput[]): Promise<Shipment[]>;
|
|
55
|
+
cancelShipment(trackingNumber: string): Promise<boolean>;
|
|
56
|
+
cancelByReference(reference: string): Promise<boolean>;
|
|
57
|
+
updateDeliveryAddress(trackingNumber: string, address: Address): Promise<boolean>;
|
|
58
|
+
track(trackingNumber: string): Promise<TrackingResult>;
|
|
59
|
+
trackMultiple(trackingNumbers: string[]): Promise<TrackingResult[]>;
|
|
60
|
+
trackByReference(reference: string): Promise<TrackingResult>;
|
|
61
|
+
getLabel(trackingNumber: string, format?: "PDF" | "PNG"): Promise<string>;
|
|
62
|
+
getBulkLabels(trackingNumbers: string[]): Promise<string>;
|
|
63
|
+
getPickupCities(): Promise<City[]>;
|
|
64
|
+
getTimeSlots(_city: string, date: string): Promise<TimeSlot[]>;
|
|
65
|
+
createPickup(input: PickupRequest): Promise<Pickup>;
|
|
66
|
+
cancelPickup(pickupId: string | number): Promise<boolean>;
|
|
67
|
+
getPickupRequests(): Promise<Pickup[]>;
|
|
68
|
+
getCities(): Promise<City[]>;
|
|
69
|
+
getDropoffLocations(): Promise<{
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
nameAr?: string;
|
|
73
|
+
address?: string;
|
|
74
|
+
city?: string;
|
|
75
|
+
}[]>;
|
|
76
|
+
createCustomerAddress(address: CustomerAddress): Promise<CustomerAddress>;
|
|
77
|
+
getCustomerAddresses(): Promise<CustomerAddress[]>;
|
|
78
|
+
updateCustomerAddress(id: number, address: Partial<CustomerAddress>): Promise<CustomerAddress>;
|
|
79
|
+
deleteCustomerAddress(id: number): Promise<boolean>;
|
|
80
|
+
parseWebhook(payload: unknown, options?: {
|
|
81
|
+
headers?: Record<string, string>;
|
|
82
|
+
queryParams?: Record<string, string>;
|
|
83
|
+
config?: WebhookConfig;
|
|
84
|
+
}): WebhookEvent;
|
|
85
|
+
getRates(): Promise<never>;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/carriers/aymakan/adapter.ts"],"names":[],"mappings":"AACA;;;GAGG;AAQH,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,IAAI,EACJ,mBAAmB,EACnB,eAAe,EACf,MAAM,EACN,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,aAAa,EACb,YAAY,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MA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,MAAM,CAAC,CAAC;QACjC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GACA,YAAY;IAQf,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC;CAG3B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aymakan Carrier Exports
|
|
3
|
+
* Import from 'shipflow/carriers/aymakan' for tree-shaking.
|
|
4
|
+
*/
|
|
5
|
+
export { AymakanAdapter, type AymakanConfig } from './adapter.js';
|
|
6
|
+
export { AymakanService, AymakanStatusCodes, type AymakanServiceType } from './services.js';
|
|
7
|
+
export { parseAymakanWebhook, mapAymakanStatus } from './mappers.js';
|
|
8
|
+
export type { AymakanCreateShipmentRequest, AymakanShipmentResponse, AymakanTrackingEvent, AymakanWebhookPayload, } from './types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/carriers/aymakan/index.ts"],"names":[],"mappings":"AACA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGzF,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlE,YAAY,EACR,4BAA4B,EAC5B,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,GACxB,MAAM,SAAS,CAAC"}
|