yalidine-sdk 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 +15 -0
- package/dist/index.cjs +512 -0
- package/dist/index.d.cts +530 -0
- package/dist/index.d.ts +530 -0
- package/dist/index.js +470 -0
- package/package.json +38 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
// src/helpers/calculateBillabeWeight.js
|
|
2
|
+
function calculateBillableWeight(height, width, length, weight) {
|
|
3
|
+
const volumetricWeight = height * width * length * 2e-4;
|
|
4
|
+
return weight > volumetricWeight ? weight : volumetricWeight;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// src/utils.js
|
|
8
|
+
function ensureServer() {
|
|
9
|
+
if (typeof window !== "undefined") {
|
|
10
|
+
throw new Error(
|
|
11
|
+
"astro-yalidine: server-only helper imported in client code. Use these helpers only in server contexts ( API routes, server-side page formatter, etc.)."
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function getConfig() {
|
|
16
|
+
if (typeof __YALIDINE_CONFIG__ === void 0 || !__YALIDINE_CONFIG__) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"astro-yalidine: Configuration missing. Did you add yalidine to astro.config.mjs ?"
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return __YALIDINE_CONFIG__;
|
|
22
|
+
}
|
|
23
|
+
async function setRequest({ endpoint, method = "GET", options = {}, params = {} }) {
|
|
24
|
+
const { apiId, apiToken, apiUrl } = getConfig();
|
|
25
|
+
const query = new URLSearchParams(params).toString();
|
|
26
|
+
const url = `${apiUrl.replace(/\/$/, "")}/${endpoint.replace(/^\//, "")}${query ? `?${query}` : ""}`;
|
|
27
|
+
const fetchOptions = {
|
|
28
|
+
method,
|
|
29
|
+
headers: {
|
|
30
|
+
"X-API-ID": apiId.trim(),
|
|
31
|
+
"X-API-TOKEN": apiToken.trim(),
|
|
32
|
+
"Accept": "application/json",
|
|
33
|
+
...options.headers
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
if (method !== "GET" && options.body) {
|
|
37
|
+
fetchOptions.body = JSON.stringify(options.body);
|
|
38
|
+
}
|
|
39
|
+
const res = await fetch(url, fetchOptions);
|
|
40
|
+
if (!res.ok) {
|
|
41
|
+
throw new Error(`'Request failed: ${res.status} ${res.statusText}`);
|
|
42
|
+
}
|
|
43
|
+
return await res.json();
|
|
44
|
+
}
|
|
45
|
+
function getIds(options) {
|
|
46
|
+
return options.id.split(",").map(Number);
|
|
47
|
+
}
|
|
48
|
+
function calculateOverWeight(baseFee, overSizeFee, weight) {
|
|
49
|
+
if (weight <= 5) {
|
|
50
|
+
return baseFee;
|
|
51
|
+
} else {
|
|
52
|
+
return baseFee + overSizeFee * (weight - 5);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function validateParcels(parcels) {
|
|
56
|
+
if (!parcels || parcels.length === 0) {
|
|
57
|
+
throw new Error("At least one parcel should be entered!");
|
|
58
|
+
}
|
|
59
|
+
if (parcels.length > 50) {
|
|
60
|
+
throw new Error("Too many parcels in one request. Please split into smaller batches.");
|
|
61
|
+
}
|
|
62
|
+
let errorsCount = 0;
|
|
63
|
+
let errorMessage = "";
|
|
64
|
+
const displayErrorCount = (count) => count === 1 ? "One error" : `${count} errors`;
|
|
65
|
+
parcels.forEach((parcel, index) => {
|
|
66
|
+
const requiredStrings = [
|
|
67
|
+
"order_id",
|
|
68
|
+
"from_wilaya_name",
|
|
69
|
+
"firstname",
|
|
70
|
+
"familyname",
|
|
71
|
+
"contact_phone",
|
|
72
|
+
"address",
|
|
73
|
+
"to_commune_name",
|
|
74
|
+
"to_wilaya_name",
|
|
75
|
+
"product_list"
|
|
76
|
+
];
|
|
77
|
+
requiredStrings.forEach((field) => {
|
|
78
|
+
if (!parcel[field] || typeof parcel[field] !== "string" || parcel[field].trim().length === 0) {
|
|
79
|
+
errorsCount++;
|
|
80
|
+
errorMessage += `Parcel ${index}: ${field} must be a non-empty string
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const numericFields = ["price", "declared_value", "length", "width", "height", "weight"];
|
|
85
|
+
numericFields.forEach((field) => {
|
|
86
|
+
if (parcel[field] == null || typeof parcel[field] !== "number" || parcel[field] < 0) {
|
|
87
|
+
errorsCount++;
|
|
88
|
+
errorMessage += `Parcel ${index}: ${field} must be a number >= 0
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
if (parcel.price < 0 || parcel.price > 15e4) {
|
|
93
|
+
errorsCount++;
|
|
94
|
+
errorMessage += `Parcel ${index}: price must be between 0 and 150000
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
if (parcel.declared_value < 0 || parcel.declared_value > 15e4) {
|
|
98
|
+
errorsCount++;
|
|
99
|
+
errorMessage += `Parcel ${index}: declared_value must be between 0 and 150000
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
const booleanFields = ["do_insurance", "freeshipping", "is_stopdesk", "has_exchange", "economic"];
|
|
103
|
+
booleanFields.forEach((field) => {
|
|
104
|
+
if (parcel[field] != null && typeof parcel[field] !== "boolean") {
|
|
105
|
+
errorsCount++;
|
|
106
|
+
errorMessage += `Parcel ${index}: ${field} must be a boolean if provided
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
if (parcel.is_stopdesk && (!parcel.stopdesk_id || typeof parcel.stopdesk_id !== "string")) {
|
|
111
|
+
errorsCount++;
|
|
112
|
+
errorMessage += `Parcel ${index}: stopdesk_id is required when is_stopdesk is true
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
if (parcel.has_exchange && (!parcel.product_to_collect || typeof parcel.product_to_collect !== "string")) {
|
|
116
|
+
errorsCount++;
|
|
117
|
+
errorMessage += `Parcel ${index}: product_to_collect is required when has_exchange is true
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
if (parcel.contact_phone) {
|
|
121
|
+
const phones = parcel.contact_phone.split(",").map((p) => p.trim());
|
|
122
|
+
phones.forEach((p) => {
|
|
123
|
+
if (!/^0\d{8,9}$/.test(p)) {
|
|
124
|
+
errorsCount++;
|
|
125
|
+
errorMessage += `Parcel ${index}: contact_phone "${p}" is invalid, must start with 0 and be 9 or 10 digits
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
if (errorsCount > 0) {
|
|
132
|
+
throw new Error(`${displayErrorCount(errorsCount)} prevent the helper from sending the request:
|
|
133
|
+
${errorMessage}`);
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/helpers/calculateParcels.js
|
|
139
|
+
async function createParcels(...parcels) {
|
|
140
|
+
ensureServer();
|
|
141
|
+
validateParcels(parcels);
|
|
142
|
+
const data = await setRequest({
|
|
143
|
+
endpoint: "parcel",
|
|
144
|
+
method: "POST",
|
|
145
|
+
params: { body: parcels }
|
|
146
|
+
});
|
|
147
|
+
const succeededParcels = [];
|
|
148
|
+
const failedParcels = [];
|
|
149
|
+
for (const [orderId, result] of Object.entries(data)) {
|
|
150
|
+
if (result.success) succeededParcels.push(orderId);
|
|
151
|
+
else failedParcels.push(orderId);
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
data,
|
|
155
|
+
meta: { succeededParcels, failedParcels }
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// src/helpers/getCentersByCommune.js
|
|
160
|
+
async function getCentersByCommune({
|
|
161
|
+
communeId,
|
|
162
|
+
params = {}
|
|
163
|
+
}) {
|
|
164
|
+
ensureServer();
|
|
165
|
+
if (!communeId) {
|
|
166
|
+
throw new Error("A commune Id must be entered to retrieve centers.");
|
|
167
|
+
}
|
|
168
|
+
const response = await setRequest({
|
|
169
|
+
endpoint: "centers",
|
|
170
|
+
params: {
|
|
171
|
+
commune_id: communeId,
|
|
172
|
+
...params
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
const centers = response.data;
|
|
176
|
+
return centers.map((c) => ({
|
|
177
|
+
id: c.center_id,
|
|
178
|
+
name: c.name,
|
|
179
|
+
address: c.address,
|
|
180
|
+
gps: c.gps,
|
|
181
|
+
commune_id: c.commune_id,
|
|
182
|
+
commune_name: c.commune_name,
|
|
183
|
+
wilaya_id: c.wilaya_id
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// src/cache/fileCacheAdapter.js
|
|
188
|
+
import fs from "fs";
|
|
189
|
+
import path from "path";
|
|
190
|
+
|
|
191
|
+
// src/cache/cacheAdapter.js
|
|
192
|
+
var CacheAdapter = class {
|
|
193
|
+
async get(key) {
|
|
194
|
+
throw new Error("Not implemented");
|
|
195
|
+
}
|
|
196
|
+
async set(key, value, ttl) {
|
|
197
|
+
throw new Error("Not implemented");
|
|
198
|
+
}
|
|
199
|
+
async delete(key) {
|
|
200
|
+
throw new Error("Not implemented");
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/cache/memoryCacheAdapter.js
|
|
205
|
+
var MemoryCacheAdapter = class extends CacheAdapter {
|
|
206
|
+
constructor() {
|
|
207
|
+
super();
|
|
208
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
209
|
+
}
|
|
210
|
+
async get(key) {
|
|
211
|
+
const entry = this.cache.get(key);
|
|
212
|
+
if (!entry) return null;
|
|
213
|
+
if (entry.expiry && date.now() > entry.expiry) {
|
|
214
|
+
this.cache.delete(key);
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
return entry.value;
|
|
218
|
+
}
|
|
219
|
+
async set(key, value, ttl) {
|
|
220
|
+
const expiry = ttl ? Date.now() + ttl : null;
|
|
221
|
+
this.cache.set(key, { value, expiry });
|
|
222
|
+
}
|
|
223
|
+
async delete(key) {
|
|
224
|
+
this.cache.delete(key);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// src/cache/fileCacheAdapter.js
|
|
229
|
+
var FileCacheAdapter = class extends CacheAdapter {
|
|
230
|
+
constructor(filePath = "./.cache/yalidine.json") {
|
|
231
|
+
super();
|
|
232
|
+
this.filePath = filePath;
|
|
233
|
+
this.memoryFallback = new MemoryCacheAdapter();
|
|
234
|
+
this.load();
|
|
235
|
+
}
|
|
236
|
+
load() {
|
|
237
|
+
try {
|
|
238
|
+
if (fs.existsSync(this.filePath)) {
|
|
239
|
+
const json = JSON.parse(fs.readFileSync(this.filePath, "utf-8"));
|
|
240
|
+
this.store = new Map(Object.entries(json));
|
|
241
|
+
} else {
|
|
242
|
+
this.store = /* @__PURE__ */ new Map();
|
|
243
|
+
}
|
|
244
|
+
} catch {
|
|
245
|
+
this.store = null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
async get(key) {
|
|
249
|
+
if (!this.store) return this.memoryFallback.get(key);
|
|
250
|
+
const entry = this.store.get(key);
|
|
251
|
+
if (!entry) return null;
|
|
252
|
+
if (entry.expiry && Date.now() > entry.expiry) {
|
|
253
|
+
this.store.delete(key);
|
|
254
|
+
this.save();
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
return entry.value;
|
|
258
|
+
}
|
|
259
|
+
async set(key, value, ttl) {
|
|
260
|
+
if (!this.store) return this.memoryFallback.set(key, value, ttl);
|
|
261
|
+
const expiry = ttl ? Date.now() + ttl : null;
|
|
262
|
+
this.store.set(key, { value, expiry });
|
|
263
|
+
this.save();
|
|
264
|
+
}
|
|
265
|
+
save() {
|
|
266
|
+
try {
|
|
267
|
+
fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
|
|
268
|
+
fs.writeFileSync(
|
|
269
|
+
this.filePath,
|
|
270
|
+
JSON.stringify(Object.fromEntries(this.store), null, 2)
|
|
271
|
+
);
|
|
272
|
+
} catch {
|
|
273
|
+
this.store = null;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
async delete(key) {
|
|
277
|
+
if (!this.store) return this.memoryFallback.delete(key);
|
|
278
|
+
this.store.delete(key);
|
|
279
|
+
this.save();
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// src/cache/cacheConfig.js
|
|
284
|
+
function getCacheConfig() {
|
|
285
|
+
const { defaultCache, cacheLifeTime } = getConfig();
|
|
286
|
+
const CACHE_TTL = cacheLifeTime * 1e3 * 60 * 60 * 24;
|
|
287
|
+
let cache;
|
|
288
|
+
switch (defaultCache) {
|
|
289
|
+
case "file":
|
|
290
|
+
cache = new FileCacheAdapter();
|
|
291
|
+
break;
|
|
292
|
+
case "memory":
|
|
293
|
+
default:
|
|
294
|
+
cache = new MemoryCacheAdapter();
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
cache,
|
|
299
|
+
CACHE_TTL
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// src/helpers/getCentersByWilaya.js
|
|
304
|
+
async function getCentersByWilaya({
|
|
305
|
+
wilayaId,
|
|
306
|
+
params = {}
|
|
307
|
+
}) {
|
|
308
|
+
ensureServer();
|
|
309
|
+
if (!wilayaId) {
|
|
310
|
+
throw new Error("A wilaya Id must be entered to retrieve centers.");
|
|
311
|
+
}
|
|
312
|
+
const { cache, CACHE_TTL } = getCacheConfig();
|
|
313
|
+
const cacheKey = `centers-${wilayaId}`;
|
|
314
|
+
const cached = await cache.get(cacheKey);
|
|
315
|
+
let centers;
|
|
316
|
+
if (cached) {
|
|
317
|
+
centers = cached;
|
|
318
|
+
} else {
|
|
319
|
+
const response = await setRequest({
|
|
320
|
+
endpoint: "centers",
|
|
321
|
+
params: {
|
|
322
|
+
wilaya_id: wilayaId,
|
|
323
|
+
...params
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
centers = response.data;
|
|
327
|
+
await cache.set(cacheKey, centers, CACHE_TTL);
|
|
328
|
+
}
|
|
329
|
+
return centers.map((c) => ({
|
|
330
|
+
id: c.center_id,
|
|
331
|
+
name: c.name,
|
|
332
|
+
address: c.address,
|
|
333
|
+
gps: c.gps,
|
|
334
|
+
commune_id: c.commune_id,
|
|
335
|
+
commune_name: c.commune_name,
|
|
336
|
+
wilaya_id: c.wilaya_id
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// src/helpers/getCommunesByWilaya.js
|
|
341
|
+
async function getCommunesByWilaya({
|
|
342
|
+
wilayaId,
|
|
343
|
+
deliverableOnly = true,
|
|
344
|
+
hasStopDesk = false,
|
|
345
|
+
params = {}
|
|
346
|
+
}) {
|
|
347
|
+
ensureServer();
|
|
348
|
+
const { cache, CACHE_TTL } = getCacheConfig();
|
|
349
|
+
const isPartial = Boolean(params.id);
|
|
350
|
+
const cacheKey = `communes-${wilayaId}`;
|
|
351
|
+
const cached = await cache.get(cacheKey);
|
|
352
|
+
let communes;
|
|
353
|
+
if (cached) {
|
|
354
|
+
if (isPartial) {
|
|
355
|
+
const ids = getIds(params);
|
|
356
|
+
communes = cached.filter((c) => ids.includes(c.id));
|
|
357
|
+
} else {
|
|
358
|
+
communes = cached;
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
const response = await setRequest({
|
|
362
|
+
endpoint: "communes",
|
|
363
|
+
params: {
|
|
364
|
+
wilaya_id: wilayaId,
|
|
365
|
+
...params
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
communes = response.data;
|
|
369
|
+
if (!isPartial) {
|
|
370
|
+
await cache.set(cacheKey, communes, CACHE_TTL);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const cleanedDeliverability = deliverableOnly ? communes.filter((c) => c.is_deliverable === 1) : communes;
|
|
374
|
+
const cleaned = hasStopDesk ? cleanedDeliverability.filter((c) => c.has_stop_desk === 1) : cleanedDeliverability;
|
|
375
|
+
return cleaned.map((c) => ({
|
|
376
|
+
id: c.id,
|
|
377
|
+
name: c.name,
|
|
378
|
+
delivery_time_parcel: c.delivery_time_parcel,
|
|
379
|
+
...deliverableOnly ? {} : { is_deliverable: c.is_deliverable },
|
|
380
|
+
...hasStopDesk ? {} : { has_stop_desk: c.has_stop_desk }
|
|
381
|
+
}));
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// src/helpers/getFees.js
|
|
385
|
+
async function getFees({
|
|
386
|
+
fromWilayaId,
|
|
387
|
+
toWilayaId,
|
|
388
|
+
toCommuneId,
|
|
389
|
+
billableWeight = 5
|
|
390
|
+
}) {
|
|
391
|
+
ensureServer();
|
|
392
|
+
if (!toWilayaId || !toCommuneId) {
|
|
393
|
+
throw new Error("Destination wilaya and commune are required to calculate fees.");
|
|
394
|
+
}
|
|
395
|
+
const safeWeight = typeof billableWeight === "number" && billableWeight > 0 ? billableWeight : 5;
|
|
396
|
+
const startingWilaya = fromWilayaId ?? getConfig().startingWilaya;
|
|
397
|
+
const data = await setRequest({
|
|
398
|
+
endpoint: "fees",
|
|
399
|
+
params: {
|
|
400
|
+
from_wilaya_id: startingWilaya,
|
|
401
|
+
to_wilaya_id: toWilayaId
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
if (!data.per_commune[toCommuneId]) {
|
|
405
|
+
throw new Error("Commune not found");
|
|
406
|
+
}
|
|
407
|
+
;
|
|
408
|
+
const communeFee = data.per_commune[toCommuneId];
|
|
409
|
+
const oversizeFee = data.oversize_fee;
|
|
410
|
+
return {
|
|
411
|
+
fees: {
|
|
412
|
+
expressHome: calculateOverWeight(communeFee.express_home, oversizeFee, safeWeight),
|
|
413
|
+
expressDesk: calculateOverWeight(communeFee.express_desk, oversizeFee, safeWeight),
|
|
414
|
+
economicHome: communeFee.economic_home ? calculateOverWeight(communeFee.economic_home, oversizeFee, safeWeight) : null,
|
|
415
|
+
economicDesk: communeFee.economic_desk ? calculateOverWeight(communeFee.economic_desk, oversizeFee, safeWeight) : null
|
|
416
|
+
},
|
|
417
|
+
meta: {
|
|
418
|
+
retourFee: data.retour_fee,
|
|
419
|
+
codPercentage: data.cod_percentage,
|
|
420
|
+
insurancePercentage: data.insurance_percentage,
|
|
421
|
+
oversizeApplied: safeWeight > 5
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// src/helpers/getWilayas.js
|
|
427
|
+
async function getWilayas({
|
|
428
|
+
deliverableOnly = true,
|
|
429
|
+
params = {}
|
|
430
|
+
}) {
|
|
431
|
+
ensureServer();
|
|
432
|
+
const { cache, CACHE_TTL } = getCacheConfig();
|
|
433
|
+
const isPartial = Boolean(params.id);
|
|
434
|
+
const cacheKey = "wilayas";
|
|
435
|
+
const cached = await cache.get(cacheKey);
|
|
436
|
+
let wilayas;
|
|
437
|
+
if (cached) {
|
|
438
|
+
if (isPartial) {
|
|
439
|
+
const ids = getIds(params);
|
|
440
|
+
wilayas = cached.filter((w) => ids.includes(w.id));
|
|
441
|
+
} else {
|
|
442
|
+
wilayas = cached;
|
|
443
|
+
}
|
|
444
|
+
} else {
|
|
445
|
+
const response = await setRequest({
|
|
446
|
+
endpoint: "wilayas",
|
|
447
|
+
params
|
|
448
|
+
});
|
|
449
|
+
wilayas = response.data;
|
|
450
|
+
if (!isPartial) {
|
|
451
|
+
await cache.set(cacheKey, wilayas, CACHE_TTL);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
const cleaned = deliverableOnly ? wilayas.filter((w) => w.is_deliverable === 1) : wilayas;
|
|
455
|
+
return cleaned.map((w) => ({
|
|
456
|
+
id: w.id,
|
|
457
|
+
name: w.name,
|
|
458
|
+
zone: w.zone,
|
|
459
|
+
...deliverableOnly ? {} : { is_deliverable: w.is_deliverable }
|
|
460
|
+
}));
|
|
461
|
+
}
|
|
462
|
+
export {
|
|
463
|
+
calculateBillableWeight,
|
|
464
|
+
createParcels,
|
|
465
|
+
getCentersByCommune,
|
|
466
|
+
getCentersByWilaya,
|
|
467
|
+
getCommunesByWilaya,
|
|
468
|
+
getFees,
|
|
469
|
+
getWilayas
|
|
470
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "yalidine-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "dist/index.cjs",
|
|
5
|
+
"module": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsup index.js --format esm,cjs --dts",
|
|
23
|
+
"test": "vitest",
|
|
24
|
+
"test:watch": "vitest --watch",
|
|
25
|
+
"coverage": "vitest run --coverage"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"sdk",
|
|
29
|
+
"yalidine",
|
|
30
|
+
"shipping",
|
|
31
|
+
"api"
|
|
32
|
+
],
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@vitest/coverage-v8": "^4.0.14",
|
|
35
|
+
"tsup": "^8.5.1",
|
|
36
|
+
"vitest": "^4.0.14"
|
|
37
|
+
}
|
|
38
|
+
}
|