@entegrasyonapp/lib 1.0.1 → 1.3.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/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * as N11 from './integrations/n11/v2';
6
6
  export * as PttAvm from './integrations/pttavm/v1';
7
7
  export * as LCW from './integrations/lcw/v1';
8
8
  export * as Ozon from './integrations/ozon/v1';
9
+ export * as Temu from './integrations/temu/v1';
9
10
  export { generateRequestId } from './utils/request-id';
10
11
  export { backoffRequest, defaultBackoffRequestOptions } from './utils/backoff-request';
11
12
  export type { IBackoffRequestOptions } from './utils/backoff-request';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAG/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvF,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGtE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAG/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvF,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGtE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.defaultBackoffRequestOptions = exports.backoffRequest = exports.generateRequestId = exports.Ozon = exports.LCW = exports.PttAvm = exports.N11 = exports.Boyner = exports.Ciceksepeti = exports.Trendyol = exports.Hepsiburada = void 0;
36
+ exports.defaultBackoffRequestOptions = exports.backoffRequest = exports.generateRequestId = exports.Temu = exports.Ozon = exports.LCW = exports.PttAvm = exports.N11 = exports.Boyner = exports.Ciceksepeti = exports.Trendyol = exports.Hepsiburada = void 0;
27
37
  // Integrations
28
38
  exports.Hepsiburada = __importStar(require("./integrations/hepsiburada/v1"));
29
39
  exports.Trendyol = __importStar(require("./integrations/trendyol/v1"));
@@ -33,6 +43,7 @@ exports.N11 = __importStar(require("./integrations/n11/v2"));
33
43
  exports.PttAvm = __importStar(require("./integrations/pttavm/v1"));
34
44
  exports.LCW = __importStar(require("./integrations/lcw/v1"));
35
45
  exports.Ozon = __importStar(require("./integrations/ozon/v1"));
46
+ exports.Temu = __importStar(require("./integrations/temu/v1"));
36
47
  // Utils
37
48
  var request_id_1 = require("./utils/request-id");
38
49
  Object.defineProperty(exports, "generateRequestId", { enumerable: true, get: function () { return request_id_1.generateRequestId; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,eAAe;AACf,6EAA6D;AAC7D,uEAAuD;AACvD,6EAA6D;AAC7D,mEAAmD;AACnD,6DAA6C;AAC7C,mEAAmD;AACnD,6DAA6C;AAC7C,+DAA+C;AAE/C,QAAQ;AACR,iDAAuD;AAA9C,+GAAA,iBAAiB,OAAA;AAC1B,2DAAuF;AAA9E,iHAAA,cAAc,OAAA;AAAE,+HAAA,4BAA4B,OAAA","sourcesContent":["// Integrations\nexport * as Hepsiburada from './integrations/hepsiburada/v1';\nexport * as Trendyol from './integrations/trendyol/v1';\nexport * as Ciceksepeti from './integrations/ciceksepeti/v1';\nexport * as Boyner from './integrations/boyner/v1';\nexport * as N11 from './integrations/n11/v2';\nexport * as PttAvm from './integrations/pttavm/v1';\nexport * as LCW from './integrations/lcw/v1';\nexport * as Ozon from './integrations/ozon/v1';\n\n// Utils\nexport { generateRequestId } from './utils/request-id';\nexport { backoffRequest, defaultBackoffRequestOptions } from './utils/backoff-request';\nexport type { IBackoffRequestOptions } from './utils/backoff-request';\n\n// Common\nexport type { IClient } from './common/client';\nexport type { IRequest, IRequestInput } from './common/request';\nexport type { IKVHandler } from './common/kv-handler';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,eAAe;AACf,6EAA6D;AAC7D,uEAAuD;AACvD,6EAA6D;AAC7D,mEAAmD;AACnD,6DAA6C;AAC7C,mEAAmD;AACnD,6DAA6C;AAC7C,+DAA+C;AAC/C,+DAA+C;AAE/C,QAAQ;AACR,iDAAuD;AAA9C,+GAAA,iBAAiB,OAAA;AAC1B,2DAAuF;AAA9E,iHAAA,cAAc,OAAA;AAAE,+HAAA,4BAA4B,OAAA","sourcesContent":["// Integrations\nexport * as Hepsiburada from './integrations/hepsiburada/v1';\nexport * as Trendyol from './integrations/trendyol/v1';\nexport * as Ciceksepeti from './integrations/ciceksepeti/v1';\nexport * as Boyner from './integrations/boyner/v1';\nexport * as N11 from './integrations/n11/v2';\nexport * as PttAvm from './integrations/pttavm/v1';\nexport * as LCW from './integrations/lcw/v1';\nexport * as Ozon from './integrations/ozon/v1';\nexport * as Temu from './integrations/temu/v1';\n\n// Utils\nexport { generateRequestId } from './utils/request-id';\nexport { backoffRequest, defaultBackoffRequestOptions } from './utils/backoff-request';\nexport type { IBackoffRequestOptions } from './utils/backoff-request';\n\n// Common\nexport type { IClient } from './common/client';\nexport type { IRequest, IRequestInput } from './common/request';\nexport type { IKVHandler } from './common/kv-handler';\n"]}
@@ -40,7 +40,7 @@ class Request {
40
40
  headers: this.request.headers,
41
41
  responseType: 'json',
42
42
  validateStatus: (status) => {
43
- return ![401, 403, 404].includes(status);
43
+ return ![401, 403, 404, 500].includes(status);
44
44
  },
45
45
  };
46
46
  this.axiosConfig.auth = {
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/boyner/v1/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,kDAAiE;AAEjE,4EAA6C;AAE7C,0DAA8D;AAE9D,MAAa,OAAO;IAII;IAAwB;IAHpC,WAAW,CAA8B;IACzC,iBAAiB,CAAY;IAErC,YAAoB,MAAc,EAAU,OAA+B;QAAvD,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAwB;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAAC;QACxF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,oBAAoB,CAAC;QAC9I,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI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,IAAI;QAEN,sCAAsC;QACtC,IAAI,IAAI,CAAC,iBAAiB,IAAI,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,IAAI,4BAAW,CAAC,eAAK,CAAC,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ;AArDD,0BAqDC","sourcesContent":["/**\n * Request module for Boyner\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? `${this.client.params.credentials.supplierId} - Entegrasyon.app`;\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404].includes(status);\n },\n };\n\n this.axiosConfig.auth = {\n username: this.client.params.credentials.apiKey,\n password: this.client.params.credentials.apiSecret\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'boyner-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/boyner/v1/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,kDAAiE;AAEjE,4EAA6C;AAE7C,0DAA8D;AAE9D,MAAa,OAAO;IAII;IAAwB;IAHpC,WAAW,CAA8B;IACzC,iBAAiB,CAAY;IAErC,YAAoB,MAAc,EAAU,OAA+B;QAAvD,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAwB;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAAC;QACxF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,oBAAoB,CAAC;QAC9I,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,IAAI,kBAAkB,CAAC;QACxG,CAAC;QAED,IAAI,CAAC,WAAW,GAAG;YACf,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACjC,OAAO,E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AAW,CAAC,CAAC;IACnC,CAAC;CACJ;AArDD,0BAqDC","sourcesContent":["/**\n * Request module for Boyner\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? `${this.client.params.credentials.supplierId} - Entegrasyon.app`;\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404, 500].includes(status);\n },\n };\n\n this.axiosConfig.auth = {\n username: this.client.params.credentials.apiKey,\n password: this.client.params.credentials.apiSecret\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'boyner-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
@@ -40,7 +40,7 @@ class Request {
40
40
  headers: this.request.headers,
41
41
  responseType: 'json',
42
42
  validateStatus: (status) => {
43
- return ![401, 403, 404].includes(status);
43
+ return ![401, 403, 404, 500].includes(status);
44
44
  },
45
45
  };
46
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/ciceksepeti/v1/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,kDAAiE;AAEjE,4EAA6C;AAE7C,0DAA8D;AAE9D,MAAa,OAAO;IAII;IAAwB;IAHpC,WAAW,CAA8B;IACzC,iBAAiB,CAAY;IAErC,YAAoB,MAAc,EAAU,OAA+B;QAAvD,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAwB;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAAC;QACxF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;QAC1E,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,IAAI,kBAAkB,CAAC;QACxG,CAAC;QAED,IAAI,CAAC,WAAW,GAAG;YACf,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACjC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO;YAC5C,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK;YACxC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC7B,YAAY,EAAE,MAAM;YACpB,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE;gBAC/B,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC7C,CAAC;SACJ,CAAC;IACN,CAAC;IAED,YAAY,CAAC,QAAkB;QAC3B,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC;IACtC,CAAC;IAED,YAAY;QACR,OAAO,IAAA,8BAAiB,EAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAI;QAEN,sCAAsC;QACtC,IAAI,IAAI,CAAC,iBAAiB,IAAI,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,IAAI,4BAAW,CAAC,eAAK,CAAC,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ;AAhDD,0BAgDC","sourcesContent":["/**\n * Request module for Çiçeksepeti\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['x-api-key'] = this.client.params.credentials.apiKey;\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404].includes(status);\n },\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'ciceksepeti-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/ciceksepeti/v1/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,kDAAiE;AAEjE,4EAA6C;AAE7C,0DAA8D;AAE9D,MAAa,OAAO;IAII;IAAwB;IAHpC,WAAW,CAA8B;IACzC,iBAAiB,CAAY;IAErC,YAAoB,MAAc,EAAU,OAA+B;QAAvD,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAwB;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAA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ACjE,CAAC;IAED,KAAK,CAAC,IAAI;QAEN,sCAAsC;QACtC,IAAI,IAAI,CAAC,iBAAiB,IAAI,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,IAAI,4BAAW,CAAC,eAAK,CAAC,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ;AAhDD,0BAgDC","sourcesContent":["/**\n * Request module for Çiçeksepeti\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['x-api-key'] = this.client.params.credentials.apiKey;\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404, 500].includes(status);\n },\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'ciceksepeti-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
@@ -42,7 +42,7 @@ class Request {
42
42
  headers: this.request.headers,
43
43
  responseType: 'json',
44
44
  validateStatus: (status) => {
45
- return ![401, 403, 404].includes(status);
45
+ return ![401, 403, 404, 500].includes(status);
46
46
  },
47
47
  };
48
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/n11/v2/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,kDAAiE;AAEjE,4EAA6C;AAE7C,0DAA8D;AAE9D,MAAa,OAAO;IAII;IAAwB;IAHpC,WAAW,CAA8B;IACzC,iBAAiB,CAAY;IAErC,YAAoB,MAAc,EAAU,OAA+B;QAAvD,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAwB;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAAC;QACxF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,qBAAqB,CAAC;QACnG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;QACvE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC;QAC7E,IAA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,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ;AAlDD,0BAkDC","sourcesContent":["/**\n * Request module for N11\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? 'Entegrasyon.app/1.0';\n this.request.headers['appkey'] = this.client.params.credentials.apiKey;\n this.request.headers['appsecret'] = this.client.params.credentials.apiSecret;\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404].includes(status);\n },\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'n11-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
1
+ {"version":3,"file":"request.js","sourceRoot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,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO;YAC5C,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK;YACxC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC7B,YAAY,EAAE,MAAM;YACpB,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE;gBAC/B,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC;SACJ,CAAC;IACN,CAAC;IAED,YAAY,CAAC,QAAkB;QAC3B,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC;IACtC,CAAC;IAED,YAAY;QACR,OAAO,IAAA,8BAAiB,EAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,IAAI;QAEN,sCAAsC;QACtC,IAAI,IAAI,CAAC,iBAAiB,IAAI,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,IAAI,4BAAW,CAAC,eAAK,CAAC,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ;AAlDD,0BAkDC","sourcesContent":["/**\n * Request module for N11\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? 'Entegrasyon.app/1.0';\n this.request.headers['appkey'] = this.client.params.credentials.apiKey;\n this.request.headers['appsecret'] = this.client.params.credentials.apiSecret;\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404, 500].includes(status);\n },\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'n11-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
@@ -43,7 +43,7 @@ class Request {
43
43
  headers: this.request.headers,
44
44
  responseType: 'text',
45
45
  validateStatus: (status) => {
46
- return ![401, 403, 404, 415].includes(status);
46
+ return ![401, 403, 404, 415, 500].includes(status);
47
47
  },
48
48
  };
49
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/pttavm/v1/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,kDAAiE;AAEjE,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I,CAAC,OAAO,CAAC,MAAM;YAC3B,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC7B,YAAY,EAAE,MAAM;YACpB,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE;gBAC/B,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC;SACJ,CAAC;IACN,CAAC;IAED,YAAY,CAAC,QAAkB;QAC3B,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC;IACtC,CAAC;IAED,YAAY;QACR,OAAO,IAAA,8BAAiB,EAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,IAAI;QAEN,sCAAsC;QACtC,IAAI,IAAI,CAAC,iBAAiB,IAAI,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,IAAI,4BAAW,CAAC,eAAK,CAAC,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ;AApDD,0BAoDC","sourcesContent":["/**\n * Request module for PttAvm\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'text/xml';\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'text/xml;charset=utf-8';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? 'Entegrasyon.app/1.0';\n this.request.headers['SOAPAction'] = `http://tempuri.org/IService/${this.request.soapAction}`;\n\n // PttAvm uses POST as a default method.\n if (!this.request.method) {\n this.request.method = 'post';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'text',\n validateStatus: (status: number) => {\n return ![401, 403, 404, 415].includes(status);\n },\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'pttavm-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/pttavm/v1/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,kDAAiE;AAEjE,4EAA6C;AAE7C,0DAA8D;AAE9D,MAAa,OAAO;IAII;IAAwB;IAHpC,WAAW,CAA8B;IACzC,iBAAiB,CAAY;IAErC,YAAoB,MAAc,EAAU,OAA+B;QAAvD,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAwB;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,OAAO,GAA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AAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACvD,CAAC;SACJ,CAAC;IACN,CAAC;IAED,YAAY,CAAC,QAAkB;QAC3B,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC;IACtC,CAAC;IAED,YAAY;QACR,OAAO,IAAA,8BAAiB,EAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,IAAI;QAEN,sCAAsC;QACtC,IAAI,IAAI,CAAC,iBAAiB,IAAI,SAAS,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,IAAI,4BAAW,CAAC,eAAK,CAAC,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ;AApDD,0BAoDC","sourcesContent":["/**\n * Request module for PttAvm\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'text/xml';\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'text/xml;charset=utf-8';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? 'Entegrasyon.app/1.0';\n this.request.headers['SOAPAction'] = `http://tempuri.org/IService/${this.request.soapAction}`;\n\n // PttAvm uses POST as a default method.\n if (!this.request.method) {\n this.request.method = 'post';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'text',\n validateStatus: (status: number) => {\n return ![401, 403, 404, 415, 500].includes(status);\n },\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'pttavm-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Client module for Temu
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2026
6
+ */
7
+ import { Request } from "./request";
8
+ import { IClient } from "../../../common/client";
9
+ import { IRequestInput } from "../../../common/request";
10
+ export interface ICredentials {
11
+ appKey: string;
12
+ appSecret: string;
13
+ accessToken: string;
14
+ }
15
+ export interface IOptions {
16
+ endpoint: Endpoint;
17
+ debug: boolean;
18
+ timeout: number;
19
+ proxy: any;
20
+ }
21
+ export declare enum Endpoint {
22
+ EU = "eu",
23
+ US = "us",
24
+ GLOBAL = "global"
25
+ }
26
+ export interface IClientParams {
27
+ credentials: ICredentials;
28
+ options?: Partial<IOptions>;
29
+ }
30
+ export declare class Client implements IClient {
31
+ params: IClientParams;
32
+ constructor(params: IClientParams);
33
+ getBaseURL(): string;
34
+ request(request: Partial<IRequestInput>): Request;
35
+ }
36
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/integrations/temu/v1/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,GAAG,CAAC;CACd;AAED,oBAAY,QAAQ;IAChB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,MAAM,WAAW;CACpB;AAED,MAAM,WAAW,aAAa;IAC1B,WAAW,EAAE,YAAY,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC/B;AAED,qBAAa,MAAO,YAAW,OAAO;IACf,MAAM,EAAE,aAAa;gBAArB,MAAM,EAAE,aAAa;IAUxC,UAAU,IAAI,MAAM;IAKpB,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,OAAO;CAGpD"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * Client module for Temu
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2026
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Client = exports.Endpoint = void 0;
10
+ const request_1 = require("./request");
11
+ var Endpoint;
12
+ (function (Endpoint) {
13
+ Endpoint["EU"] = "eu";
14
+ Endpoint["US"] = "us";
15
+ Endpoint["GLOBAL"] = "global";
16
+ })(Endpoint || (exports.Endpoint = Endpoint = {}));
17
+ class Client {
18
+ params;
19
+ constructor(params) {
20
+ this.params = params;
21
+ const defaultOptions = {
22
+ endpoint: Endpoint.EU,
23
+ debug: false,
24
+ timeout: 0, // no timeout
25
+ proxy: undefined
26
+ };
27
+ this.params.options = { ...defaultOptions, ...this.params.options }; // {...{foo:'bar'}, ...undefined} == {foo:'bar'}
28
+ }
29
+ getBaseURL() {
30
+ const endpoint = this.params.options?.endpoint || Endpoint.EU;
31
+ return `https://openapi-b-${endpoint}.temu.com/openapi/router`;
32
+ }
33
+ request(request) {
34
+ return new request_1.Request(this, request);
35
+ }
36
+ }
37
+ exports.Client = Client;
38
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/integrations/temu/v1/client.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uCAAoC;AAiBpC,IAAY,QAIX;AAJD,WAAY,QAAQ;IAChB,qBAAS,CAAA;IACT,qBAAS,CAAA;IACT,6BAAiB,CAAA;AACrB,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB;AAOD,MAAa,MAAM;IACI;IAAnB,YAAmB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;QACpC,MAAM,cAAc,GAAa;YAC7B,QAAQ,EAAE,QAAQ,CAAC,EAAE;YACrB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,CAAC,EAAE,aAAa;YACzB,KAAK,EAAE,SAAS;SACnB,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,gDAAgD;IACzH,CAAC;IAED,UAAU;QACN,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,IAAI,QAAQ,CAAC,EAAE,CAAC;QAC9D,OAAO,qBAAqB,QAAQ,0BAA0B,CAAC;IACnE,CAAC;IAED,OAAO,CAAC,OAA+B;QACnC,OAAO,IAAI,iBAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ;AAnBD,wBAmBC","sourcesContent":["/**\n * Client module for Temu\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2026\n */\n\nimport { Request } from \"./request\";\nimport { IClient } from \"../../../common/client\";\nimport { IRequestInput } from \"../../../common/request\";\n\nexport interface ICredentials {\n appKey: string;\n appSecret: string;\n accessToken: string;\n}\n\nexport interface IOptions {\n endpoint: Endpoint;\n debug: boolean;\n timeout: number; // milliseconds\n proxy: any;\n}\n\nexport enum Endpoint {\n EU = 'eu',\n US = 'us',\n GLOBAL = 'global',\n}\n\nexport interface IClientParams {\n credentials: ICredentials;\n options?: Partial<IOptions>;\n}\n\nexport class Client implements IClient {\n constructor(public params: IClientParams) {\n const defaultOptions: IOptions = {\n endpoint: Endpoint.EU,\n debug: false,\n timeout: 0, // no timeout\n proxy: undefined\n };\n this.params.options = { ...defaultOptions, ...this.params.options }; // {...{foo:'bar'}, ...undefined} == {foo:'bar'}\n }\n\n getBaseURL(): string {\n const endpoint = this.params.options?.endpoint || Endpoint.EU;\n return `https://openapi-b-${endpoint}.temu.com/openapi/router`;\n }\n\n request(request: Partial<IRequestInput>): Request {\n return new Request(this, request);\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { Client, Endpoint } from "./client";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/temu/v1/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Endpoint = exports.Client = void 0;
4
+ var client_1 = require("./client");
5
+ Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
6
+ Object.defineProperty(exports, "Endpoint", { enumerable: true, get: function () { return client_1.Endpoint; } });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integrations/temu/v1/index.ts"],"names":[],"mappings":";;;AAAA,mCAA4C;AAAnC,gGAAA,MAAM,OAAA;AAAE,kGAAA,QAAQ,OAAA","sourcesContent":["export { Client, Endpoint } from \"./client\";\n"]}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Request module for Temu
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2026
6
+ */
7
+ import { AxiosResponse } from "axios";
8
+ import { Client } from "./client";
9
+ import { IRequest, IRequestInput } from "../../../common/request";
10
+ export declare class Request implements IRequest {
11
+ private client;
12
+ private request;
13
+ private axiosConfig;
14
+ private axiosMockCallback?;
15
+ constructor(client: Client, request: Partial<IRequestInput>);
16
+ setAxiosMock(callback: Function): void;
17
+ getRequestId(): string;
18
+ send(): Promise<AxiosResponse>;
19
+ private calculateSign;
20
+ }
21
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/integrations/temu/v1/request.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAc,EAAsB,aAAa,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGlE,qBAAa,OAAQ,YAAW,QAAQ;IAIxB,OAAO,CAAC,MAAM;IAAU,OAAO,CAAC,OAAO;IAHnD,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,iBAAiB,CAAC,CAAW;gBAEjB,MAAM,EAAE,MAAM,EAAU,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC;IA6C3E,YAAY,CAAC,QAAQ,EAAE,QAAQ;IAI/B,YAAY,IAAI,MAAM;IAIhB,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;IAWpC,OAAO,CAAC,aAAa;CAcxB"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ /**
3
+ * Request module for Temu
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2026
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Request = void 0;
13
+ const md5_1 = __importDefault(require("crypto-js/md5"));
14
+ const axios_1 = __importDefault(require("axios"));
15
+ const axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
16
+ const request_id_1 = require("../../../utils/request-id");
17
+ class Request {
18
+ client;
19
+ request;
20
+ axiosConfig;
21
+ axiosMockCallback;
22
+ constructor(client, request) {
23
+ this.client = client;
24
+ this.request = request;
25
+ if (this.request.headers == undefined) {
26
+ this.request.headers = {};
27
+ }
28
+ this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';
29
+ this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? 'Entegrasyon.app/1.0';
30
+ if (this.request.body) {
31
+ this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';
32
+ if (typeof this.request.body === 'string') {
33
+ this.request.body = JSON.parse(this.request.body);
34
+ }
35
+ const additionalParams = {
36
+ app_key: this.client.params.credentials.appKey,
37
+ access_token: this.client.params.credentials.accessToken,
38
+ data_type: 'JSON',
39
+ timestamp: Math.floor(Date.now() / 1000),
40
+ };
41
+ Object.assign(this.request.body, additionalParams);
42
+ this.request.body['sign'] = this.calculateSign(this.request.body);
43
+ this.request.body = JSON.stringify(this.request.body);
44
+ if (this.client.params.options?.debug) {
45
+ console.log("Request Body:", this.request.body);
46
+ }
47
+ }
48
+ this.axiosConfig = {
49
+ baseURL: this.client.getBaseURL(),
50
+ timeout: this.client.params.options?.timeout,
51
+ proxy: this.client.params.options?.proxy,
52
+ method: this.request?.method ?? 'post',
53
+ url: this.request?.path ?? '',
54
+ params: this.request.params,
55
+ data: this.request.body,
56
+ headers: this.request.headers,
57
+ responseType: 'json',
58
+ validateStatus: (status) => {
59
+ return ![401, 403, 404, 500].includes(status);
60
+ },
61
+ };
62
+ }
63
+ setAxiosMock(callback) {
64
+ this.axiosMockCallback = callback;
65
+ }
66
+ getRequestId() {
67
+ return (0, request_id_1.generateRequestId)(this.axiosConfig, 'temu-v1');
68
+ }
69
+ async send() {
70
+ // mocks will be used during the tests
71
+ if (this.axiosMockCallback != undefined) {
72
+ const mock = new axios_mock_adapter_1.default(axios_1.default);
73
+ this.axiosMockCallback(mock);
74
+ }
75
+ return (0, axios_1.default)(this.axiosConfig);
76
+ }
77
+ calculateSign(params) {
78
+ let keys = Object.keys(params).sort();
79
+ let temp = [];
80
+ keys.forEach(key => {
81
+ const value = JSON.stringify(params[key], null, 0).replace(/^"|"$/g, '');
82
+ temp.push(key + value);
83
+ });
84
+ const app_secret = this.client.params.credentials.appSecret;
85
+ const un_sign = app_secret + temp.join('') + app_secret;
86
+ const sign = (0, md5_1.default)(un_sign).toString().toUpperCase();
87
+ return sign;
88
+ }
89
+ }
90
+ exports.Request = Request;
91
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/temu/v1/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,wDAAgC;AAChC,kDAAiE;AAEjE,4EAA6C;AAE7C,0DAA8D;AAE9D,MAAa,OAAO;IAII;IAAwB;IAHpC,WAAW,CAA8B;IACzC,iBAAiB,CAAY;IAErC,YAAoB,MAAc,EAAU,OAA+B;QAAvD,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAwB;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAA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;YACtC,MAAM,IAAI,GAAG,IAAI,4BAAW,CAAC,eAAK,CAAC,CAAC;YACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAEO,aAAa,CAAC,MAAW;QAC7B,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAEtC,IAAI,IAAI,GAAU,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACf,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACzE,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC;QAC5D,MAAM,OAAO,GAAG,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC;QACxD,MAAM,IAAI,GAAG,IAAA,aAAG,EAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;QACnD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlFD,0BAkFC","sourcesContent":["/**\n * Request module for Temu\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2026\n */\n\nimport MD5 from \"crypto-js/md5\";\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? 'Entegrasyon.app/1.0';\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n\n if (typeof this.request.body === 'string') {\n this.request.body = JSON.parse(this.request.body);\n }\n\n const additionalParams = {\n app_key: this.client.params.credentials.appKey,\n access_token: this.client.params.credentials.accessToken,\n data_type: 'JSON',\n timestamp: Math.floor(Date.now() / 1000),\n };\n Object.assign(this.request.body, additionalParams); \n\n this.request.body['sign'] = this.calculateSign(this.request.body);\n this.request.body = JSON.stringify(this.request.body);\n if (this.client.params.options?.debug) {\n console.log(\"Request Body:\", this.request.body);\n }\n }\n \n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request?.method ?? 'post',\n url: this.request?.path ?? '',\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404, 500].includes(status);\n },\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'temu-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n\n private calculateSign(params: any): string {\n let keys = Object.keys(params).sort();\n\n let temp: any[] = [];\n keys.forEach(key => {\n const value = JSON.stringify(params[key], null, 0).replace(/^\"|\"$/g, ''); \n temp.push(key + value);\n });\n\n const app_secret = this.client.params.credentials.appSecret;\n const un_sign = app_secret + temp.join('') + app_secret;\n const sign = MD5(un_sign).toString().toUpperCase();\n return sign;\n }\n}"]}
@@ -40,7 +40,7 @@ class Request {
40
40
  headers: this.request.headers,
41
41
  responseType: 'json',
42
42
  validateStatus: (status) => {
43
- return ![401, 403, 404].includes(status);
43
+ return ![401, 403, 404, 500].includes(status);
44
44
  },
45
45
  };
46
46
  this.axiosConfig.auth = {
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/integrations/trendyol/v1/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,kDAAiE;AAEjE,4EAA6C;AAE7C,0DAA8D;AAE9D,MAAa,OAAO;IAII;IAAwB;IAHpC,WAAW,CAA8B;IACzC,iBAAiB,CAAY;IAErC,YAAoB,MAAc,EAAU,OAA+B;QAAvD,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAwB;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAAC;QACxF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,wBAAwB,CAAC;QAClJ,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,IAAI,kBAAkB,C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C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ;AArDD,0BAqDC","sourcesContent":["/**\n * Request module for Trendyol\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? `${this.client.params.credentials.supplierId} - Entegrasyon.app/1.0`;\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404].includes(status);\n },\n };\n\n this.axiosConfig.auth = {\n username: this.client.params.credentials.apiKey,\n password: this.client.params.credentials.apiSecret\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'trendyol-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.ax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\nimport axios, { AxiosRequestConfig, AxiosResponse } from \"axios\";\nimport { Client } from \"./client\";\nimport MockAdapter from \"axios-mock-adapter\";\nimport { IRequest, IRequestInput } from \"./../../../common/request\";\nimport { generateRequestId } from \"../../../utils/request-id\";\n\nexport class Request implements IRequest {\n private axiosConfig: Partial<AxiosRequestConfig>;\n private axiosMockCallback?: Function;\n\n constructor(private client: Client, private request: Partial<IRequestInput>) {\n if (this.request.headers == undefined) {\n this.request.headers = {};\n }\n this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';\n this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? `${this.client.params.credentials.supplierId} - Entegrasyon.app/1.0`;\n if (this.request.body) {\n this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';\n }\n\n this.axiosConfig = {\n baseURL: this.client.getBaseURL(),\n timeout: this.client.params.options?.timeout,\n proxy: this.client.params.options?.proxy,\n method: this.request.method,\n url: this.request.path,\n params: this.request.params,\n data: this.request.body,\n headers: this.request.headers,\n responseType: 'json',\n validateStatus: (status: number) => {\n return ![401, 403, 404, 500].includes(status);\n },\n };\n\n this.axiosConfig.auth = {\n username: this.client.params.credentials.apiKey,\n password: this.client.params.credentials.apiSecret\n };\n }\n\n setAxiosMock(callback: Function) {\n this.axiosMockCallback = callback;\n }\n\n getRequestId(): string {\n return generateRequestId(this.axiosConfig, 'trendyol-v1');\n }\n\n async send(): Promise<AxiosResponse> {\n\n // mocks will be used during the tests\n if (this.axiosMockCallback != undefined) {\n const mock = new MockAdapter(axios);\n this.axiosMockCallback(mock);\n }\n\n return axios(this.axiosConfig);\n }\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entegrasyonapp/lib",
3
- "version": "1.0.1",
3
+ "version": "1.3.0",
4
4
  "description": "Entegrasyon.app libraries.",
5
5
  "scripts": {
6
6
  "clean": "rimraf ./dist && rimraf *.tsbuildinfo",
@@ -28,17 +28,19 @@
28
28
  },
29
29
  "homepage": "https://github.com/entegrasyonapp/lib",
30
30
  "devDependencies": {
31
- "@types/jest": "^29.5.11",
32
- "@types/node": "^20.11.0",
33
- "jest": "^29.7.0",
34
- "rimraf": "^5.0.5",
35
- "ts-jest": "^29.1.1",
31
+ "@types/crypto-js": "^4.2.2",
32
+ "@types/jest": "^30.0.0",
33
+ "@types/node": "^24.10.0",
34
+ "jest": "^30.2.0",
35
+ "rimraf": "^6.1.0",
36
+ "ts-jest": "^29.4.5",
36
37
  "ts-node": "^10.9.2",
37
- "typescript": "^5.4.3"
38
+ "typescript": "^5.9.3"
38
39
  },
39
40
  "dependencies": {
40
- "axios": "^1.6.8",
41
- "axios-mock-adapter": "^1.22.0"
41
+ "axios": "^1.13.2",
42
+ "axios-mock-adapter": "^2.1.0",
43
+ "crypto-js": "^4.2.0"
42
44
  },
43
45
  "packageManager": "yarn@3.8.5+sha512.786c27300bc8fb134a1a0630db71cfeccc2b92272c031df17ff662876e89c2df488e6819dd7f2ffaf02e021b6827f75d3eb6a6df0a10218f72a589b735db6cc2",
44
46
  "types": "./dist/index.d.ts"