doboxa-js 1.0.0 → 1.0.2
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/dist/chunk-36DDSV5T.mjs +3077 -0
- package/dist/chunk-36DDSV5T.mjs.map +1 -0
- package/dist/chunk-CGJD4ZO5.mjs +107 -0
- package/dist/chunk-CGJD4ZO5.mjs.map +1 -0
- package/dist/client.js +2046 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +8 -0
- package/dist/client.mjs.map +1 -0
- package/dist/errors.js +91 -0
- package/dist/errors.js.map +1 -0
- package/dist/errors.mjs +15 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/index.js +3724 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +719 -0
- package/dist/index.mjs.map +1 -0
- package/dist/models.js +1 -0
- package/dist/models.js.map +1 -0
- package/dist/models.mjs +1 -0
- package/dist/models.mjs.map +1 -0
- package/package.json +18 -11
- package/api-doc.yaml +0 -2013
- package/openapi-generator-config.yaml +0 -15
- package/openapitools.json +0 -7
- package/src/client.ts +0 -99
- package/src/errors.ts +0 -90
- package/src/http/client.ts +0 -156
- package/src/index.ts +0 -31
- package/src/models.ts +0 -0
- package/src/resources/authentication.ts +0 -73
- package/src/resources/clients.ts +0 -32
- package/src/resources/discountCodes.ts +0 -32
- package/src/resources/invoices.ts +0 -46
- package/src/resources/orderComments.ts +0 -38
- package/src/resources/orderStatusChanges.ts +0 -38
- package/src/resources/orders.ts +0 -123
- package/src/resources/trackingNumbers.ts +0 -38
- package/src/resources/users.ts +0 -28
- package/src/types/index.ts +0 -59
- package/src/utils/config.ts +0 -10
- package/src/utils/tokenManager.ts +0 -68
- package/tsconfig.json +0 -12
- package/tsup.config.ts +0 -27
package/dist/client.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/errors.ts
|
|
20
|
+
var errors_exports = {};
|
|
21
|
+
__export(errors_exports, {
|
|
22
|
+
DoboxaAPIError: () => DoboxaAPIError,
|
|
23
|
+
DoboxaAuthenticationError: () => DoboxaAuthenticationError,
|
|
24
|
+
DoboxaError: () => DoboxaError,
|
|
25
|
+
DoboxaValidationError: () => DoboxaValidationError,
|
|
26
|
+
parseErrorResponse: () => parseErrorResponse
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(errors_exports);
|
|
29
|
+
var DoboxaError = class _DoboxaError extends Error {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "DoboxaError";
|
|
33
|
+
Object.setPrototypeOf(this, _DoboxaError.prototype);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var DoboxaAPIError = class _DoboxaAPIError extends DoboxaError {
|
|
37
|
+
constructor(statusCode, message, body) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = "DoboxaAPIError";
|
|
40
|
+
this.statusCode = statusCode;
|
|
41
|
+
if (body) {
|
|
42
|
+
if ("result_code" in body) {
|
|
43
|
+
this.code = body.result_code;
|
|
44
|
+
}
|
|
45
|
+
if ("error_message" in body) {
|
|
46
|
+
this.errorMessage = body.error_message || void 0;
|
|
47
|
+
}
|
|
48
|
+
if ("invalid_parameters" in body && body.invalid_parameters) {
|
|
49
|
+
this.invalidParameters = body.invalid_parameters.map((param) => ({
|
|
50
|
+
parameter: param.parameter,
|
|
51
|
+
error_cause: param.error_cause
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
Object.setPrototypeOf(this, _DoboxaAPIError.prototype);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var DoboxaAuthenticationError = class _DoboxaAuthenticationError extends DoboxaError {
|
|
59
|
+
constructor(message = "Authentication failed") {
|
|
60
|
+
super(message);
|
|
61
|
+
this.name = "DoboxaAuthenticationError";
|
|
62
|
+
Object.setPrototypeOf(this, _DoboxaAuthenticationError.prototype);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var DoboxaValidationError = class _DoboxaValidationError extends DoboxaAPIError {
|
|
66
|
+
constructor(statusCode, message, body) {
|
|
67
|
+
super(statusCode, message, body);
|
|
68
|
+
this.name = "DoboxaValidationError";
|
|
69
|
+
Object.setPrototypeOf(this, _DoboxaValidationError.prototype);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function parseErrorResponse(statusCode, body) {
|
|
73
|
+
if (typeof body === "object" && body !== null) {
|
|
74
|
+
if ("invalid_parameters" in body || "error_message" in body) {
|
|
75
|
+
return body;
|
|
76
|
+
}
|
|
77
|
+
if ("error_message" in body && "result_code" in body) {
|
|
78
|
+
return body;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
DoboxaAPIError,
|
|
86
|
+
DoboxaAuthenticationError,
|
|
87
|
+
DoboxaError,
|
|
88
|
+
DoboxaValidationError,
|
|
89
|
+
parseErrorResponse
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts"],"sourcesContent":["import type { InvalidRequestDataResponse, ServerErrorResponse } from './types/generated/src/models';\n\n/**\n * Base error class for all Doboxa errors\n */\nexport class DoboxaError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'DoboxaError';\n Object.setPrototypeOf(this, DoboxaError.prototype);\n }\n}\n\n/**\n * Error thrown when API returns an error response\n */\nexport class DoboxaAPIError extends DoboxaError {\n public readonly statusCode: number;\n public readonly code?: number;\n public readonly errorMessage?: string;\n public readonly invalidParameters?: Array<{ parameter: string; error_cause: string }>;\n\n constructor(\n statusCode: number,\n message: string,\n body?: InvalidRequestDataResponse | ServerErrorResponse\n ) {\n super(message);\n this.name = 'DoboxaAPIError';\n this.statusCode = statusCode;\n\n if (body) {\n if ('result_code' in body) {\n this.code = body.result_code;\n }\n if ('error_message' in body) {\n this.errorMessage = body.error_message || undefined;\n }\n if ('invalid_parameters' in body && body.invalid_parameters) {\n this.invalidParameters = body.invalid_parameters.map((param) => ({\n parameter: param.parameter,\n error_cause: param.error_cause,\n }));\n }\n }\n\n Object.setPrototypeOf(this, DoboxaAPIError.prototype);\n }\n}\n\n/**\n * Error thrown when authentication fails\n */\nexport class DoboxaAuthenticationError extends DoboxaError {\n constructor(message: string = 'Authentication failed') {\n super(message);\n this.name = 'DoboxaAuthenticationError';\n Object.setPrototypeOf(this, DoboxaAuthenticationError.prototype);\n }\n}\n\n/**\n * Error thrown when request validation fails\n */\nexport class DoboxaValidationError extends DoboxaAPIError {\n constructor(statusCode: number, message: string, body?: InvalidRequestDataResponse) {\n super(statusCode, message, body);\n this.name = 'DoboxaValidationError';\n Object.setPrototypeOf(this, DoboxaValidationError.prototype);\n }\n}\n\n/**\n * Parse error response from API\n */\nexport function parseErrorResponse(\n statusCode: number,\n body: unknown\n): InvalidRequestDataResponse | ServerErrorResponse | undefined {\n if (typeof body === 'object' && body !== null) {\n if ('invalid_parameters' in body || 'error_message' in body) {\n return body as InvalidRequestDataResponse;\n }\n if ('error_message' in body && 'result_code' in body) {\n return body as ServerErrorResponse;\n }\n }\n return undefined;\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAM,cAAN,MAAM,qBAAoB,MAAM;AAAA,EACrC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,aAAY,SAAS;AAAA,EACnD;AACF;AAKO,IAAM,iBAAN,MAAM,wBAAuB,YAAY;AAAA,EAM9C,YACE,YACA,SACA,MACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,aAAa;AAElB,QAAI,MAAM;AACR,UAAI,iBAAiB,MAAM;AACzB,aAAK,OAAO,KAAK;AAAA,MACnB;AACA,UAAI,mBAAmB,MAAM;AAC3B,aAAK,eAAe,KAAK,iBAAiB;AAAA,MAC5C;AACA,UAAI,wBAAwB,QAAQ,KAAK,oBAAoB;AAC3D,aAAK,oBAAoB,KAAK,mBAAmB,IAAI,CAAC,WAAW;AAAA,UAC/D,WAAW,MAAM;AAAA,UACjB,aAAa,MAAM;AAAA,QACrB,EAAE;AAAA,MACJ;AAAA,IACF;AAEA,WAAO,eAAe,MAAM,gBAAe,SAAS;AAAA,EACtD;AACF;AAKO,IAAM,4BAAN,MAAM,mCAAkC,YAAY;AAAA,EACzD,YAAY,UAAkB,yBAAyB;AACrD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,2BAA0B,SAAS;AAAA,EACjE;AACF;AAKO,IAAM,wBAAN,MAAM,+BAA8B,eAAe;AAAA,EACxD,YAAY,YAAoB,SAAiB,MAAmC;AAClF,UAAM,YAAY,SAAS,IAAI;AAC/B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,uBAAsB,SAAS;AAAA,EAC7D;AACF;AAKO,SAAS,mBACd,YACA,MAC8D;AAC9D,MAAI,OAAO,SAAS,YAAY,SAAS,MAAM;AAC7C,QAAI,wBAAwB,QAAQ,mBAAmB,MAAM;AAC3D,aAAO;AAAA,IACT;AACA,QAAI,mBAAmB,QAAQ,iBAAiB,MAAM;AACpD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
package/dist/errors.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DoboxaAPIError,
|
|
3
|
+
DoboxaAuthenticationError,
|
|
4
|
+
DoboxaError,
|
|
5
|
+
DoboxaValidationError,
|
|
6
|
+
parseErrorResponse
|
|
7
|
+
} from "./chunk-CGJD4ZO5.mjs";
|
|
8
|
+
export {
|
|
9
|
+
DoboxaAPIError,
|
|
10
|
+
DoboxaAuthenticationError,
|
|
11
|
+
DoboxaError,
|
|
12
|
+
DoboxaValidationError,
|
|
13
|
+
parseErrorResponse
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|