@pexcode/dlis-sdk 1.0.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.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +332 -0
  3. package/dist/api/core/ApiError.d.ts +10 -0
  4. package/dist/api/core/ApiError.js +15 -0
  5. package/dist/api/core/ApiRequestOptions.d.ts +13 -0
  6. package/dist/api/core/ApiRequestOptions.js +2 -0
  7. package/dist/api/core/ApiResult.d.ts +7 -0
  8. package/dist/api/core/ApiResult.js +2 -0
  9. package/dist/api/core/CancelablePromise.d.ts +20 -0
  10. package/dist/api/core/CancelablePromise.js +116 -0
  11. package/dist/api/core/OpenAPI.d.ts +16 -0
  12. package/dist/api/core/OpenAPI.js +14 -0
  13. package/dist/api/core/request.d.ts +34 -0
  14. package/dist/api/core/request.js +294 -0
  15. package/dist/api/index.d.ts +46 -0
  16. package/dist/api/index.js +48 -0
  17. package/dist/api/models/AppLevel.d.ts +5 -0
  18. package/dist/api/models/AppLevel.js +13 -0
  19. package/dist/api/models/BillingType.d.ts +5 -0
  20. package/dist/api/models/BillingType.js +13 -0
  21. package/dist/api/models/BranchId.d.ts +1 -0
  22. package/dist/api/models/BranchId.js +2 -0
  23. package/dist/api/models/BranchLedgerAttributes.d.ts +23 -0
  24. package/dist/api/models/BranchLedgerAttributes.js +2 -0
  25. package/dist/api/models/CalculateCostAttributes.d.ts +14 -0
  26. package/dist/api/models/CalculateCostAttributes.js +2 -0
  27. package/dist/api/models/CheckBlackListAttribute.d.ts +7 -0
  28. package/dist/api/models/CheckBlackListAttribute.js +2 -0
  29. package/dist/api/models/ClientAttributes.d.ts +26 -0
  30. package/dist/api/models/ClientAttributes.js +2 -0
  31. package/dist/api/models/ClientCreationAttributes.d.ts +12 -0
  32. package/dist/api/models/ClientCreationAttributes.js +2 -0
  33. package/dist/api/models/ClientTypeEnum.d.ts +4 -0
  34. package/dist/api/models/ClientTypeEnum.js +12 -0
  35. package/dist/api/models/CostId.d.ts +1 -0
  36. package/dist/api/models/CostId.js +2 -0
  37. package/dist/api/models/Currencies.d.ts +7 -0
  38. package/dist/api/models/Currencies.js +15 -0
  39. package/dist/api/models/EndpointId.d.ts +1 -0
  40. package/dist/api/models/EndpointId.js +2 -0
  41. package/dist/api/models/HttpSuccess.d.ts +5 -0
  42. package/dist/api/models/HttpSuccess.js +2 -0
  43. package/dist/api/models/LedgerCategory.d.ts +7 -0
  44. package/dist/api/models/LedgerCategory.js +15 -0
  45. package/dist/api/models/LedgerStatus.d.ts +5 -0
  46. package/dist/api/models/LedgerStatus.js +13 -0
  47. package/dist/api/models/LedgerType.d.ts +4 -0
  48. package/dist/api/models/LedgerType.js +12 -0
  49. package/dist/api/models/MovementsStatusAttributes.d.ts +6 -0
  50. package/dist/api/models/MovementsStatusAttributes.js +14 -0
  51. package/dist/api/models/PackageId.d.ts +1 -0
  52. package/dist/api/models/PackageId.js +2 -0
  53. package/dist/api/models/PackagePlatform.d.ts +6 -0
  54. package/dist/api/models/PackagePlatform.js +14 -0
  55. package/dist/api/models/PackageType.d.ts +4 -0
  56. package/dist/api/models/PackageType.js +12 -0
  57. package/dist/api/models/PlatformEnum.d.ts +8 -0
  58. package/dist/api/models/PlatformEnum.js +16 -0
  59. package/dist/api/models/ProofOfDeliveryType.d.ts +5 -0
  60. package/dist/api/models/ProofOfDeliveryType.js +13 -0
  61. package/dist/api/models/ReferenceType.d.ts +4 -0
  62. package/dist/api/models/ReferenceType.js +12 -0
  63. package/dist/api/models/SdkId.d.ts +1 -0
  64. package/dist/api/models/SdkId.js +2 -0
  65. package/dist/api/models/SdkInfoAttributes.d.ts +25 -0
  66. package/dist/api/models/SdkInfoAttributes.js +2 -0
  67. package/dist/api/models/SdkLedgerOverview.d.ts +6 -0
  68. package/dist/api/models/SdkLedgerOverview.js +2 -0
  69. package/dist/api/models/SdkPackagesCreationAttributes.d.ts +26 -0
  70. package/dist/api/models/SdkPackagesCreationAttributes.js +2 -0
  71. package/dist/api/models/ShippingOption.d.ts +5 -0
  72. package/dist/api/models/ShippingOption.js +13 -0
  73. package/dist/api/models/ShippingServiceData.d.ts +10 -0
  74. package/dist/api/models/ShippingServiceData.js +2 -0
  75. package/dist/api/models/Sizes.d.ts +5 -0
  76. package/dist/api/models/Sizes.js +13 -0
  77. package/dist/api/models/TenantId.d.ts +1 -0
  78. package/dist/api/models/TenantId.js +2 -0
  79. package/dist/api/models/UserId.d.ts +1 -0
  80. package/dist/api/models/UserId.js +2 -0
  81. package/dist/api/models/appAttributes.d.ts +4 -0
  82. package/dist/api/models/appAttributes.js +2 -0
  83. package/dist/api/models/branchesAttributes.d.ts +28 -0
  84. package/dist/api/models/branchesAttributes.js +2 -0
  85. package/dist/api/models/citiesAttributes.d.ts +12 -0
  86. package/dist/api/models/citiesAttributes.js +2 -0
  87. package/dist/api/models/costModelAttributes.d.ts +29 -0
  88. package/dist/api/models/costModelAttributes.js +2 -0
  89. package/dist/api/models/limitedSdkAttributes.d.ts +11 -0
  90. package/dist/api/models/limitedSdkAttributes.js +2 -0
  91. package/dist/api/models/movementsAttributes.d.ts +19 -0
  92. package/dist/api/models/movementsAttributes.js +2 -0
  93. package/dist/api/models/packagesAttributes.d.ts +70 -0
  94. package/dist/api/models/packagesAttributes.js +2 -0
  95. package/dist/api/models/packagesGroupAttributes.d.ts +8 -0
  96. package/dist/api/models/packagesGroupAttributes.js +2 -0
  97. package/dist/api/models/regionsAttributes.d.ts +11 -0
  98. package/dist/api/models/regionsAttributes.js +2 -0
  99. package/dist/api/models/sdksAttributes.d.ts +23 -0
  100. package/dist/api/models/sdksAttributes.js +2 -0
  101. package/dist/api/services/RegionsControllerService.d.ts +30 -0
  102. package/dist/api/services/RegionsControllerService.js +49 -0
  103. package/dist/api/services/SdkControllerService.d.ts +54 -0
  104. package/dist/api/services/SdkControllerService.js +94 -0
  105. package/dist/api/services/SdkPackagesControllerService.d.ts +55 -0
  106. package/dist/api/services/SdkPackagesControllerService.js +109 -0
  107. package/dist/api/services/SdkRegionsControllerService.d.ts +17 -0
  108. package/dist/api/services/SdkRegionsControllerService.js +36 -0
  109. package/dist/api-handler.d.ts +10 -0
  110. package/dist/api-handler.js +26 -0
  111. package/dist/index.d.ts +36 -0
  112. package/dist/index.js +130 -0
  113. package/dist/sdk.spec.d.ts +1 -0
  114. package/dist/sdk.spec.js +150 -0
  115. package/package.json +38 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 pexcode
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,332 @@
1
+ # @pexcode/dlis-sdk
2
+
3
+ Official TypeScript/JavaScript SDK from [Pexcode](https://pexcode.com) for integrating with the **DLIS API** (delivery and logistics management platform).
4
+
5
+ The SDK supports package creation, cost calculation, branch and region management, ledger tracking, and webhook configuration.
6
+
7
+ ---
8
+
9
+ ## Requirements
10
+
11
+ - Node.js 18 or later
12
+ - API token from the DLIS dashboard
13
+ - DLIS API base URL
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @pexcode/dlis-sdk
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Quick Start
26
+
27
+ ```typescript
28
+ import { DLISystem } from "@pexcode/dlis-sdk";
29
+
30
+ const dlis = new DLISystem(
31
+ "https://your-api-base-url.com", // DLIS API base URL
32
+ "your-api-token" // API token
33
+ );
34
+
35
+ // Verify connected SDK app info
36
+ const info = await dlis.MyInfo();
37
+ console.log(info);
38
+ ```
39
+
40
+ > **Note:** The SDK automatically uses API version `v3` via the `x-version` header.
41
+
42
+ ### Backward Compatibility
43
+
44
+ For backward compatibility, you can import the legacy name `QDSystem` instead of `DLISystem`:
45
+
46
+ ```typescript
47
+ import { QDSystem } from "@pexcode/dlis-sdk";
48
+
49
+ const dlis = new QDSystem("https://your-api-base-url.com", "your-api-token");
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Typical Workflow
55
+
56
+ Common steps to create a new package:
57
+
58
+ ```
59
+ 1. Fetch regions
60
+ 2. Fetch cities
61
+ 3. Fetch company branches in the city
62
+ 4. Calculate shipping cost
63
+ 5. Check blacklist (optional)
64
+ 6. Create the package
65
+ 7. Send package data to the center
66
+ ```
67
+
68
+ ```typescript
69
+ import { DLISystem } from "@pexcode/dlis-sdk";
70
+
71
+ const dlis = new DLISystem("https://your-api-base-url.com", "your-api-token");
72
+
73
+ const countryId = 1;
74
+ const regions = await dlis.GetRegionsList(countryId);
75
+ const cities = await dlis.GetCitiesListInByRegion(regions[0].id);
76
+
77
+ const cityId = cities[0].id;
78
+ const branches = await dlis.getCompanyListOfCity(cityId);
79
+ const branch = branches[0];
80
+
81
+ const cost = await dlis.CalculateCost({
82
+ costId: branch.costModel![0].id,
83
+ branchId: branch.id,
84
+ receiverCityId: cityId,
85
+ receiverAddress: "10 Example Street",
86
+ shippingOption: "standard",
87
+ isPickup: false,
88
+ weight: 2,
89
+ });
90
+
91
+ await dlis.CheckBlackList({
92
+ phone: "+966500000000",
93
+ firstName: "John",
94
+ lastName: "Doe",
95
+ });
96
+
97
+ const pkg = await dlis.CreatePackage({
98
+ weight: 2,
99
+ shippingOption: "standard",
100
+ billingType: "prepaid",
101
+ proofOfDeliveryType: "signature",
102
+ branchId: branch.id,
103
+ costId: branch.costModel![0].id,
104
+ type: "Package",
105
+ note: "Store order",
106
+ pickup: false,
107
+ includeProducts: false,
108
+ isTesting: false,
109
+ receiverInfo: {
110
+ firstName: "John",
111
+ lastName: "Doe",
112
+ address: "10 Example Street",
113
+ phone: "+966500000000",
114
+ cityId,
115
+ },
116
+ });
117
+
118
+ await dlis.SendDataToCenter(pkg.id);
119
+ ```
120
+
121
+ ---
122
+
123
+ ## API Reference
124
+
125
+ ### App Info & Branches
126
+
127
+ | Method | Description |
128
+ |--------|-------------|
129
+ | `MyInfo()` | Returns connected SDK app info (status, limits, webhook, etc.) |
130
+ | `getTenantBranches()` | Fetches all tenant branches |
131
+ | `getCompanyListOfCity(cityId)` | Fetches company branches available in a given city |
132
+
133
+ ```typescript
134
+ const info = await dlis.MyInfo();
135
+ const branches = await dlis.getTenantBranches();
136
+ const cityBranches = await dlis.getCompanyListOfCity(42);
137
+ ```
138
+
139
+ ---
140
+
141
+ ### Regions & Cities
142
+
143
+ | Method | Description |
144
+ |--------|-------------|
145
+ | `GetRegionsList(countryId)` | Fetches regions for a given country |
146
+ | `GetCitiesListInByRegion(regionId)` | Fetches cities within a given region |
147
+
148
+ ```typescript
149
+ const regions = await dlis.GetRegionsList(1);
150
+ const cities = await dlis.GetCitiesListInByRegion(regions[0].id);
151
+ ```
152
+
153
+ ---
154
+
155
+ ### Packages
156
+
157
+ | Method | Description |
158
+ |--------|-------------|
159
+ | `GetList(page?, pageSize?)` | Fetches paginated package list (default: page 1, 10 items) |
160
+ | `GetPackageDetails(id)` | Fetches a single package by ID |
161
+ | `CreatePackage(payload)` | Creates a new package |
162
+ | `CancelOne(id)` | Cancels a package |
163
+ | `ReportOne(id, body)` | Reports an issue with a package |
164
+ | `SendDataToCenter(id)` | Sends package data to the center after preparation |
165
+
166
+ ```typescript
167
+ const packages = await dlis.GetList(1, 20);
168
+ const details = await dlis.GetPackageDetails("package-id");
169
+ const created = await dlis.CreatePackage({ /* ... */ });
170
+ await dlis.CancelOne("package-id");
171
+ await dlis.ReportOne("package-id", { reason: "Delivery delayed" });
172
+ await dlis.SendDataToCenter("package-id");
173
+ ```
174
+
175
+ ---
176
+
177
+ ### Cost & Validation
178
+
179
+ | Method | Description |
180
+ |--------|-------------|
181
+ | `CalculateCost(params)` | Calculates shipping cost before creating a package |
182
+ | `CheckBlackList(query)` | Checks receiver details against the blacklist |
183
+
184
+ ```typescript
185
+ const cost = await dlis.CalculateCost({
186
+ costId: "cost-id",
187
+ branchId: "branch-id",
188
+ receiverCityId: 42,
189
+ receiverAddress: "10 Example Street",
190
+ receiverLat: 24.7136,
191
+ receiverLng: 46.6753,
192
+ shippingOption: "express",
193
+ isPickup: true,
194
+ weight: 3,
195
+ });
196
+
197
+ const blacklistCheck = await dlis.CheckBlackList({
198
+ phone: "+966500000000",
199
+ email: "user@example.com",
200
+ });
201
+ ```
202
+
203
+ ---
204
+
205
+ ### Ledger
206
+
207
+ | Method | Description |
208
+ |--------|-------------|
209
+ | `GetMyLedgerOverview()` | Summary of current balance and unpaid amounts |
210
+ | `GetMyLedger(year?, month?)` | Financial transaction history (optional year and month) |
211
+
212
+ ```typescript
213
+ const overview = await dlis.GetMyLedgerOverview();
214
+ // overview.currentBalance, overview.unpaidIncome, overview.unpaidExpenses, overview.expectedBalance
215
+
216
+ const ledger = await dlis.GetMyLedger(2026, 7);
217
+ ```
218
+
219
+ ---
220
+
221
+ ### Webhook
222
+
223
+ | Method | Description |
224
+ |--------|-------------|
225
+ | `SetWebhook(payload)` | Registers a webhook URL to receive update notifications |
226
+
227
+ ```typescript
228
+ await dlis.SetWebhook({
229
+ host: "https://your-server.com",
230
+ path: "/webhooks/dlis",
231
+ webhookToken: "your-secret-token",
232
+ });
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Main Data Types
238
+
239
+ ### Create Package — `SdkPackagesCreationAttributes`
240
+
241
+ | Field | Type | Required | Description |
242
+ |-------|------|----------|-------------|
243
+ | `weight` | `number` | Yes | Package weight in kilograms |
244
+ | `shippingOption` | `ShippingOption` | Yes | Shipping type |
245
+ | `billingType` | `BillingType` | Yes | Billing type |
246
+ | `proofOfDeliveryType` | `ProofOfDeliveryType` | Yes | Proof of delivery |
247
+ | `branchId` | `string` | Yes | Branch ID |
248
+ | `costId` | `string` | Yes | Cost model ID |
249
+ | `type` | `PackageType` | Yes | Package type |
250
+ | `note` | `string` | Yes | Notes |
251
+ | `pickup` | `boolean` | Yes | Pickup from branch? |
252
+ | `includeProducts` | `boolean` | Yes | Includes products? |
253
+ | `isTesting` | `boolean` | Yes | Test package |
254
+ | `receiverInfo` | `ClientCreationAttributes` | Yes | Receiver details |
255
+ | `futureTenantId` | `string` | No | Future tenant ID |
256
+ | `packageCost` | `number` | No | Package contents value |
257
+ | `endpoint` | `string` | No | Specific delivery endpoint |
258
+
259
+ ### Receiver Info — `ClientCreationAttributes`
260
+
261
+ | Field | Type | Required |
262
+ |-------|------|----------|
263
+ | `firstName` | `string` | Yes |
264
+ | `lastName` | `string` | Yes |
265
+ | `address` | `string` | Yes |
266
+ | `phone` | `string` | Yes |
267
+ | `cityId` | `number` | Yes |
268
+ | `postCode` | `string` | No |
269
+ | `email` | `string` | No |
270
+ | `lng` / `lat` | `number` | No |
271
+ | `houseNumber` | `string` | No |
272
+
273
+ ---
274
+
275
+ ## Enums
276
+
277
+ ### `ShippingOption`
278
+
279
+ | Value | Description |
280
+ |-------|-------------|
281
+ | `standard` | Standard shipping |
282
+ | `express` | Express shipping |
283
+ | `same_day` | Same-day delivery |
284
+
285
+ ### `BillingType`
286
+
287
+ | Value | Description |
288
+ |-------|-------------|
289
+ | `none` | No billing |
290
+ | `prepaid` | Prepaid |
291
+ | `postpaid` | Cash on delivery |
292
+
293
+ ### `ProofOfDeliveryType`
294
+
295
+ | Value | Description |
296
+ |-------|-------------|
297
+ | `none` | No proof required |
298
+ | `signature` | Receiver signature |
299
+ | `otp` | One-time password (OTP) |
300
+
301
+ ### `PackageType`
302
+
303
+ | Value | Description |
304
+ |-------|-------------|
305
+ | `Package` | Package |
306
+ | `Document` | Document |
307
+
308
+ ---
309
+
310
+ ## Error Handling
311
+
312
+ When a request fails, the SDK throws an `Error` with the server message. Handle it like this:
313
+
314
+ ```typescript
315
+ try {
316
+ const pkg = await dlis.CreatePackage(payload);
317
+ } catch (error) {
318
+ console.error("Failed to create package:", (error as Error).message);
319
+ }
320
+ ```
321
+
322
+ ---
323
+
324
+ ## TypeScript
325
+
326
+ The SDK is written in TypeScript and ships with type definitions. All request and response types are available when importing from the package.
327
+
328
+ ---
329
+
330
+ ## License
331
+
332
+ MIT — © Pexcode
@@ -0,0 +1,10 @@
1
+ import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ import type { ApiResult } from './ApiResult';
3
+ export declare class ApiError extends Error {
4
+ readonly url: string;
5
+ readonly status: number;
6
+ readonly statusText: string;
7
+ readonly body: any;
8
+ readonly request: ApiRequestOptions;
9
+ constructor(request: ApiRequestOptions, response: ApiResult, message: string);
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiError = void 0;
4
+ class ApiError extends Error {
5
+ constructor(request, response, message) {
6
+ super(message);
7
+ this.name = 'ApiError';
8
+ this.url = response.url;
9
+ this.status = response.status;
10
+ this.statusText = response.statusText;
11
+ this.body = response.body;
12
+ this.request = request;
13
+ }
14
+ }
15
+ exports.ApiError = ApiError;
@@ -0,0 +1,13 @@
1
+ export type ApiRequestOptions = {
2
+ readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
3
+ readonly url: string;
4
+ readonly path?: Record<string, any>;
5
+ readonly cookies?: Record<string, any>;
6
+ readonly headers?: Record<string, any>;
7
+ readonly query?: Record<string, any>;
8
+ readonly formData?: Record<string, any>;
9
+ readonly body?: any;
10
+ readonly mediaType?: string;
11
+ readonly responseHeader?: string;
12
+ readonly errors?: Record<number, string>;
13
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export type ApiResult = {
2
+ readonly url: string;
3
+ readonly ok: boolean;
4
+ readonly status: number;
5
+ readonly statusText: string;
6
+ readonly body: any;
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ export declare class CancelError extends Error {
2
+ constructor(message: string);
3
+ get isCancelled(): boolean;
4
+ }
5
+ export interface OnCancel {
6
+ readonly isResolved: boolean;
7
+ readonly isRejected: boolean;
8
+ readonly isCancelled: boolean;
9
+ (cancelHandler: () => void): void;
10
+ }
11
+ export declare class CancelablePromise<T> implements Promise<T> {
12
+ #private;
13
+ constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
14
+ get [Symbol.toStringTag](): string;
15
+ then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
16
+ catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
17
+ finally(onFinally?: (() => void) | null): Promise<T>;
18
+ cancel(): void;
19
+ get isCancelled(): boolean;
20
+ }
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _CancelablePromise_isResolved, _CancelablePromise_isRejected, _CancelablePromise_isCancelled, _CancelablePromise_cancelHandlers, _CancelablePromise_promise, _CancelablePromise_resolve, _CancelablePromise_reject;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.CancelablePromise = exports.CancelError = void 0;
16
+ /* generated using openapi-typescript-codegen -- do not edit */
17
+ /* istanbul ignore file */
18
+ /* tslint:disable */
19
+ /* eslint-disable */
20
+ class CancelError extends Error {
21
+ constructor(message) {
22
+ super(message);
23
+ this.name = 'CancelError';
24
+ }
25
+ get isCancelled() {
26
+ return true;
27
+ }
28
+ }
29
+ exports.CancelError = CancelError;
30
+ class CancelablePromise {
31
+ constructor(executor) {
32
+ _CancelablePromise_isResolved.set(this, void 0);
33
+ _CancelablePromise_isRejected.set(this, void 0);
34
+ _CancelablePromise_isCancelled.set(this, void 0);
35
+ _CancelablePromise_cancelHandlers.set(this, void 0);
36
+ _CancelablePromise_promise.set(this, void 0);
37
+ _CancelablePromise_resolve.set(this, void 0);
38
+ _CancelablePromise_reject.set(this, void 0);
39
+ __classPrivateFieldSet(this, _CancelablePromise_isResolved, false, "f");
40
+ __classPrivateFieldSet(this, _CancelablePromise_isRejected, false, "f");
41
+ __classPrivateFieldSet(this, _CancelablePromise_isCancelled, false, "f");
42
+ __classPrivateFieldSet(this, _CancelablePromise_cancelHandlers, [], "f");
43
+ __classPrivateFieldSet(this, _CancelablePromise_promise, new Promise((resolve, reject) => {
44
+ __classPrivateFieldSet(this, _CancelablePromise_resolve, resolve, "f");
45
+ __classPrivateFieldSet(this, _CancelablePromise_reject, reject, "f");
46
+ const onResolve = (value) => {
47
+ if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
48
+ return;
49
+ }
50
+ __classPrivateFieldSet(this, _CancelablePromise_isResolved, true, "f");
51
+ if (__classPrivateFieldGet(this, _CancelablePromise_resolve, "f"))
52
+ __classPrivateFieldGet(this, _CancelablePromise_resolve, "f").call(this, value);
53
+ };
54
+ const onReject = (reason) => {
55
+ if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
56
+ return;
57
+ }
58
+ __classPrivateFieldSet(this, _CancelablePromise_isRejected, true, "f");
59
+ if (__classPrivateFieldGet(this, _CancelablePromise_reject, "f"))
60
+ __classPrivateFieldGet(this, _CancelablePromise_reject, "f").call(this, reason);
61
+ };
62
+ const onCancel = (cancelHandler) => {
63
+ if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
64
+ return;
65
+ }
66
+ __classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").push(cancelHandler);
67
+ };
68
+ Object.defineProperty(onCancel, 'isResolved', {
69
+ get: () => __classPrivateFieldGet(this, _CancelablePromise_isResolved, "f"),
70
+ });
71
+ Object.defineProperty(onCancel, 'isRejected', {
72
+ get: () => __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f"),
73
+ });
74
+ Object.defineProperty(onCancel, 'isCancelled', {
75
+ get: () => __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f"),
76
+ });
77
+ return executor(onResolve, onReject, onCancel);
78
+ }), "f");
79
+ }
80
+ get [(_CancelablePromise_isResolved = new WeakMap(), _CancelablePromise_isRejected = new WeakMap(), _CancelablePromise_isCancelled = new WeakMap(), _CancelablePromise_cancelHandlers = new WeakMap(), _CancelablePromise_promise = new WeakMap(), _CancelablePromise_resolve = new WeakMap(), _CancelablePromise_reject = new WeakMap(), Symbol.toStringTag)]() {
81
+ return "Cancellable Promise";
82
+ }
83
+ then(onFulfilled, onRejected) {
84
+ return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").then(onFulfilled, onRejected);
85
+ }
86
+ catch(onRejected) {
87
+ return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").catch(onRejected);
88
+ }
89
+ finally(onFinally) {
90
+ return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").finally(onFinally);
91
+ }
92
+ cancel() {
93
+ if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
94
+ return;
95
+ }
96
+ __classPrivateFieldSet(this, _CancelablePromise_isCancelled, true, "f");
97
+ if (__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").length) {
98
+ try {
99
+ for (const cancelHandler of __classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f")) {
100
+ cancelHandler();
101
+ }
102
+ }
103
+ catch (error) {
104
+ console.warn('Cancellation threw an error', error);
105
+ return;
106
+ }
107
+ }
108
+ __classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").length = 0;
109
+ if (__classPrivateFieldGet(this, _CancelablePromise_reject, "f"))
110
+ __classPrivateFieldGet(this, _CancelablePromise_reject, "f").call(this, new CancelError('Request aborted'));
111
+ }
112
+ get isCancelled() {
113
+ return __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f");
114
+ }
115
+ }
116
+ exports.CancelablePromise = CancelablePromise;
@@ -0,0 +1,16 @@
1
+ import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
3
+ type Headers = Record<string, string>;
4
+ export type OpenAPIConfig = {
5
+ BASE: string;
6
+ VERSION: string;
7
+ WITH_CREDENTIALS: boolean;
8
+ CREDENTIALS: 'include' | 'omit' | 'same-origin';
9
+ TOKEN?: string | Resolver<string> | undefined;
10
+ USERNAME?: string | Resolver<string> | undefined;
11
+ PASSWORD?: string | Resolver<string> | undefined;
12
+ HEADERS?: Headers | Resolver<Headers> | undefined;
13
+ ENCODE_PATH?: ((path: string) => string) | undefined;
14
+ };
15
+ export declare const OpenAPI: OpenAPIConfig;
16
+ export {};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenAPI = void 0;
4
+ exports.OpenAPI = {
5
+ BASE: '',
6
+ VERSION: '1.0.0',
7
+ WITH_CREDENTIALS: false,
8
+ CREDENTIALS: 'include',
9
+ TOKEN: undefined,
10
+ USERNAME: undefined,
11
+ PASSWORD: undefined,
12
+ HEADERS: undefined,
13
+ ENCODE_PATH: undefined,
14
+ };
@@ -0,0 +1,34 @@
1
+ import type { AxiosResponse, AxiosInstance } from 'axios';
2
+ import FormData from 'form-data';
3
+ import type { ApiRequestOptions } from './ApiRequestOptions';
4
+ import type { ApiResult } from './ApiResult';
5
+ import { CancelablePromise } from './CancelablePromise';
6
+ import type { OnCancel } from './CancelablePromise';
7
+ import type { OpenAPIConfig } from './OpenAPI';
8
+ export declare const isDefined: <T>(value: T | null | undefined) => value is Exclude<T, null | undefined>;
9
+ export declare const isString: (value: any) => value is string;
10
+ export declare const isStringWithValue: (value: any) => value is string;
11
+ export declare const isBlob: (value: any) => value is Blob;
12
+ export declare const isFormData: (value: any) => value is FormData;
13
+ export declare const isSuccess: (status: number) => boolean;
14
+ export declare const base64: (str: string) => string;
15
+ export declare const getQueryString: (params: Record<string, any>) => string;
16
+ export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
17
+ type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
18
+ export declare const resolve: <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>) => Promise<T | undefined>;
19
+ export declare const getHeaders: (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData) => Promise<Record<string, string>>;
20
+ export declare const getRequestBody: (options: ApiRequestOptions) => any;
21
+ export declare const sendRequest: <T>(config: OpenAPIConfig, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Record<string, string>, onCancel: OnCancel, axiosClient: AxiosInstance) => Promise<AxiosResponse<T>>;
22
+ export declare const getResponseHeader: (response: AxiosResponse<any>, responseHeader?: string) => string | undefined;
23
+ export declare const getResponseBody: (response: AxiosResponse<any>) => any;
24
+ export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
25
+ /**
26
+ * Request method
27
+ * @param config The OpenAPI configuration object
28
+ * @param options The request options from the service
29
+ * @param axiosClient The axios client instance to use
30
+ * @returns CancelablePromise<T>
31
+ * @throws ApiError
32
+ */
33
+ export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions, axiosClient?: AxiosInstance) => CancelablePromise<T>;
34
+ export {};