@entegrasyonapp/lib 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 (122) hide show
  1. package/README.md +19 -0
  2. package/dist/common/client.d.ts +12 -0
  3. package/dist/common/client.d.ts.map +1 -0
  4. package/dist/common/client.js +9 -0
  5. package/dist/common/client.js.map +1 -0
  6. package/dist/common/kv-handler.d.ts +17 -0
  7. package/dist/common/kv-handler.d.ts.map +1 -0
  8. package/dist/common/kv-handler.js +24 -0
  9. package/dist/common/kv-handler.js.map +1 -0
  10. package/dist/common/request.d.ts +21 -0
  11. package/dist/common/request.d.ts.map +1 -0
  12. package/dist/common/request.js +9 -0
  13. package/dist/common/request.js.map +1 -0
  14. package/dist/index.d.ts +15 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +42 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/integrations/boyner/v1/client.d.ts +30 -0
  19. package/dist/integrations/boyner/v1/client.d.ts.map +1 -0
  20. package/dist/integrations/boyner/v1/client.js +30 -0
  21. package/dist/integrations/boyner/v1/client.js.map +1 -0
  22. package/dist/integrations/boyner/v1/index.d.ts +2 -0
  23. package/dist/integrations/boyner/v1/index.d.ts.map +1 -0
  24. package/dist/integrations/boyner/v1/index.js +6 -0
  25. package/dist/integrations/boyner/v1/index.js.map +1 -0
  26. package/dist/integrations/boyner/v1/request.d.ts +20 -0
  27. package/dist/integrations/boyner/v1/request.d.ts.map +1 -0
  28. package/dist/integrations/boyner/v1/request.js +67 -0
  29. package/dist/integrations/boyner/v1/request.js.map +1 -0
  30. package/dist/integrations/ciceksepeti/v1/client.d.ts +33 -0
  31. package/dist/integrations/ciceksepeti/v1/client.d.ts.map +1 -0
  32. package/dist/integrations/ciceksepeti/v1/client.js +39 -0
  33. package/dist/integrations/ciceksepeti/v1/client.js.map +1 -0
  34. package/dist/integrations/ciceksepeti/v1/index.d.ts +2 -0
  35. package/dist/integrations/ciceksepeti/v1/index.d.ts.map +1 -0
  36. package/dist/integrations/ciceksepeti/v1/index.js +7 -0
  37. package/dist/integrations/ciceksepeti/v1/index.js.map +1 -0
  38. package/dist/integrations/ciceksepeti/v1/request.d.ts +20 -0
  39. package/dist/integrations/ciceksepeti/v1/request.d.ts.map +1 -0
  40. package/dist/integrations/ciceksepeti/v1/request.js +63 -0
  41. package/dist/integrations/ciceksepeti/v1/request.js.map +1 -0
  42. package/dist/integrations/hepsiburada/v1/client.d.ts +42 -0
  43. package/dist/integrations/hepsiburada/v1/client.d.ts.map +1 -0
  44. package/dist/integrations/hepsiburada/v1/client.js +48 -0
  45. package/dist/integrations/hepsiburada/v1/client.js.map +1 -0
  46. package/dist/integrations/hepsiburada/v1/index.d.ts +2 -0
  47. package/dist/integrations/hepsiburada/v1/index.d.ts.map +1 -0
  48. package/dist/integrations/hepsiburada/v1/index.js +8 -0
  49. package/dist/integrations/hepsiburada/v1/index.js.map +1 -0
  50. package/dist/integrations/hepsiburada/v1/request.d.ts +20 -0
  51. package/dist/integrations/hepsiburada/v1/request.d.ts.map +1 -0
  52. package/dist/integrations/hepsiburada/v1/request.js +67 -0
  53. package/dist/integrations/hepsiburada/v1/request.js.map +1 -0
  54. package/dist/integrations/lcw/v1/client.d.ts +42 -0
  55. package/dist/integrations/lcw/v1/client.d.ts.map +1 -0
  56. package/dist/integrations/lcw/v1/client.js +42 -0
  57. package/dist/integrations/lcw/v1/client.js.map +1 -0
  58. package/dist/integrations/lcw/v1/index.d.ts +2 -0
  59. package/dist/integrations/lcw/v1/index.d.ts.map +1 -0
  60. package/dist/integrations/lcw/v1/index.js +8 -0
  61. package/dist/integrations/lcw/v1/index.js.map +1 -0
  62. package/dist/integrations/lcw/v1/request.d.ts +21 -0
  63. package/dist/integrations/lcw/v1/request.d.ts.map +1 -0
  64. package/dist/integrations/lcw/v1/request.js +97 -0
  65. package/dist/integrations/lcw/v1/request.js.map +1 -0
  66. package/dist/integrations/n11/v2/client.d.ts +29 -0
  67. package/dist/integrations/n11/v2/client.d.ts.map +1 -0
  68. package/dist/integrations/n11/v2/client.js +30 -0
  69. package/dist/integrations/n11/v2/client.js.map +1 -0
  70. package/dist/integrations/n11/v2/index.d.ts +2 -0
  71. package/dist/integrations/n11/v2/index.d.ts.map +1 -0
  72. package/dist/integrations/n11/v2/index.js +6 -0
  73. package/dist/integrations/n11/v2/index.js.map +1 -0
  74. package/dist/integrations/n11/v2/request.d.ts +20 -0
  75. package/dist/integrations/n11/v2/request.d.ts.map +1 -0
  76. package/dist/integrations/n11/v2/request.js +65 -0
  77. package/dist/integrations/n11/v2/request.js.map +1 -0
  78. package/dist/integrations/ozon/v1/client.d.ts +36 -0
  79. package/dist/integrations/ozon/v1/client.d.ts.map +1 -0
  80. package/dist/integrations/ozon/v1/client.js +38 -0
  81. package/dist/integrations/ozon/v1/client.js.map +1 -0
  82. package/dist/integrations/ozon/v1/index.d.ts +2 -0
  83. package/dist/integrations/ozon/v1/index.d.ts.map +1 -0
  84. package/dist/integrations/ozon/v1/index.js +7 -0
  85. package/dist/integrations/ozon/v1/index.js.map +1 -0
  86. package/dist/integrations/ozon/v1/request.d.ts +20 -0
  87. package/dist/integrations/ozon/v1/request.d.ts.map +1 -0
  88. package/dist/integrations/ozon/v1/request.js +65 -0
  89. package/dist/integrations/ozon/v1/request.js.map +1 -0
  90. package/dist/integrations/pttavm/v1/client.d.ts +30 -0
  91. package/dist/integrations/pttavm/v1/client.d.ts.map +1 -0
  92. package/dist/integrations/pttavm/v1/client.js +30 -0
  93. package/dist/integrations/pttavm/v1/client.js.map +1 -0
  94. package/dist/integrations/pttavm/v1/index.d.ts +2 -0
  95. package/dist/integrations/pttavm/v1/index.d.ts.map +1 -0
  96. package/dist/integrations/pttavm/v1/index.js +6 -0
  97. package/dist/integrations/pttavm/v1/index.js.map +1 -0
  98. package/dist/integrations/pttavm/v1/request.d.ts +20 -0
  99. package/dist/integrations/pttavm/v1/request.d.ts.map +1 -0
  100. package/dist/integrations/pttavm/v1/request.js +66 -0
  101. package/dist/integrations/pttavm/v1/request.js.map +1 -0
  102. package/dist/integrations/trendyol/v1/client.d.ts +35 -0
  103. package/dist/integrations/trendyol/v1/client.d.ts.map +1 -0
  104. package/dist/integrations/trendyol/v1/client.js +39 -0
  105. package/dist/integrations/trendyol/v1/client.js.map +1 -0
  106. package/dist/integrations/trendyol/v1/index.d.ts +2 -0
  107. package/dist/integrations/trendyol/v1/index.d.ts.map +1 -0
  108. package/dist/integrations/trendyol/v1/index.js +7 -0
  109. package/dist/integrations/trendyol/v1/index.js.map +1 -0
  110. package/dist/integrations/trendyol/v1/request.d.ts +20 -0
  111. package/dist/integrations/trendyol/v1/request.d.ts.map +1 -0
  112. package/dist/integrations/trendyol/v1/request.js +67 -0
  113. package/dist/integrations/trendyol/v1/request.js.map +1 -0
  114. package/dist/utils/backoff-request.d.ts +33 -0
  115. package/dist/utils/backoff-request.d.ts.map +1 -0
  116. package/dist/utils/backoff-request.js +67 -0
  117. package/dist/utils/backoff-request.js.map +1 -0
  118. package/dist/utils/request-id.d.ts +17 -0
  119. package/dist/utils/request-id.d.ts.map +1 -0
  120. package/dist/utils/request-id.js +72 -0
  121. package/dist/utils/request-id.js.map +1 -0
  122. package/package.json +45 -0
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # entegrasyonapp/lib
2
+
3
+ ## How to?
4
+
5
+ ### Run tests
6
+
7
+ ```bash
8
+ npm run test
9
+ ```
10
+
11
+ ### Build
12
+
13
+ ```bash
14
+ npm run build
15
+ ```
16
+
17
+ ## Examples
18
+
19
+ Example usages are in the `examples/` folder.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Common client interfaces
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2024
6
+ */
7
+ import { IRequest, IRequestInput } from "./request";
8
+ export interface IClient {
9
+ getBaseURL(): string;
10
+ request(request: Partial<IRequestInput>): IRequest;
11
+ }
12
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,WAAW,OAAO;IACpB,UAAU,IAAI,MAAM,CAAC;IACrB,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC;CACtD"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Common client interfaces
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2024
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":";AAAA;;;;;GAKG","sourcesContent":["/**\n * Common client interfaces\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport { IRequest, IRequestInput } from \"./request\";\n\nexport interface IClient {\n getBaseURL(): string;\n request(request: Partial<IRequestInput>): IRequest;\n}\n"]}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Common key-value handler interface
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2024
6
+ */
7
+ export interface IKVHandler {
8
+ set(key: string, value: string, expiry?: number): Promise<void>;
9
+ get(key: string): Promise<string | null | undefined>;
10
+ }
11
+ export declare class ExampleKVHandler implements IKVHandler {
12
+ private keys;
13
+ constructor(keys?: Map<string, string>);
14
+ set(key: string, value: string, expiry?: number | undefined): Promise<void>;
15
+ get(key: string): Promise<string | null | undefined>;
16
+ }
17
+ //# sourceMappingURL=kv-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kv-handler.d.ts","sourceRoot":"","sources":["../../src/common/kv-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACvB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACxD;AAED,qBAAa,gBAAiB,YAAW,UAAU;IACnC,OAAO,CAAC,IAAI;gBAAJ,IAAI,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa;IAEzD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3E,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAGvD"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * Common key-value handler interface
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2024
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ExampleKVHandler = void 0;
10
+ class ExampleKVHandler {
11
+ keys;
12
+ constructor(keys = new Map()) {
13
+ this.keys = keys;
14
+ }
15
+ set(key, value, expiry) {
16
+ this.keys.set(key, value);
17
+ return Promise.resolve();
18
+ }
19
+ get(key) {
20
+ return Promise.resolve(this.keys.get(key));
21
+ }
22
+ }
23
+ exports.ExampleKVHandler = ExampleKVHandler;
24
+ //# sourceMappingURL=kv-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kv-handler.js","sourceRoot":"","sources":["../../src/common/kv-handler.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAOH,MAAa,gBAAgB;IACL;IAApB,YAAoB,OAA4B,IAAI,GAAG,EAAE;QAArC,SAAI,GAAJ,IAAI,CAAiC;IAAG,CAAC;IAE7D,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,MAA2B;QACvD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,GAAW;QACX,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC;CACJ;AAXD,4CAWC","sourcesContent":["/**\n * Common key-value handler interface\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nexport interface IKVHandler {\n set(key: string, value: string, expiry?: number): Promise<void>;\n get(key: string): Promise<string | null | undefined>;\n}\n\nexport class ExampleKVHandler implements IKVHandler {\n constructor(private keys: Map<string, string> = new Map()) {}\n\n set(key: string, value: string, expiry?: number | undefined): Promise<void> {\n this.keys.set(key, value);\n return Promise.resolve();\n }\n\n get(key: string): Promise<string | null | undefined> {\n return Promise.resolve(this.keys.get(key));\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Common request interfaces
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2024
6
+ */
7
+ import { AxiosResponse } from "axios";
8
+ export interface IRequest {
9
+ setAxiosMock(callback: Function): void;
10
+ getRequestId(): string;
11
+ send(): Promise<AxiosResponse>;
12
+ }
13
+ export interface IRequestInput {
14
+ method: string;
15
+ path: string;
16
+ params: any;
17
+ body: any;
18
+ headers: any;
19
+ soapAction: string;
20
+ }
21
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/common/request.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,WAAW,QAAQ;IACrB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvC,YAAY,IAAI,MAAM,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;IACZ,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,GAAG,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Common request interfaces
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2024
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/common/request.ts"],"names":[],"mappings":";AAAA;;;;;GAKG","sourcesContent":["/**\n * Common request interfaces\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport { AxiosResponse } from \"axios\";\n\nexport interface IRequest {\n setAxiosMock(callback: Function): void;\n getRequestId(): string;\n send(): Promise<AxiosResponse>;\n}\n\nexport interface IRequestInput {\n method: string;\n path: string;\n params: any;\n body: any;\n headers: any;\n soapAction: string;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ export * as Hepsiburada from './integrations/hepsiburada/v1';
2
+ export * as Trendyol from './integrations/trendyol/v1';
3
+ export * as Ciceksepeti from './integrations/ciceksepeti/v1';
4
+ export * as Boyner from './integrations/boyner/v1';
5
+ export * as N11 from './integrations/n11/v2';
6
+ export * as PttAvm from './integrations/pttavm/v1';
7
+ export * as LCW from './integrations/lcw/v1';
8
+ export * as Ozon from './integrations/ozon/v1';
9
+ export { generateRequestId } from './utils/request-id';
10
+ export { backoffRequest, defaultBackoffRequestOptions } from './utils/backoff-request';
11
+ export type { IBackoffRequestOptions } from './utils/backoff-request';
12
+ export type { IClient } from './common/client';
13
+ export type { IRequest, IRequestInput } from './common/request';
14
+ export type { IKVHandler } from './common/kv-handler';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
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
+ };
25
+ 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;
27
+ // Integrations
28
+ exports.Hepsiburada = __importStar(require("./integrations/hepsiburada/v1"));
29
+ exports.Trendyol = __importStar(require("./integrations/trendyol/v1"));
30
+ exports.Ciceksepeti = __importStar(require("./integrations/ciceksepeti/v1"));
31
+ exports.Boyner = __importStar(require("./integrations/boyner/v1"));
32
+ exports.N11 = __importStar(require("./integrations/n11/v2"));
33
+ exports.PttAvm = __importStar(require("./integrations/pttavm/v1"));
34
+ exports.LCW = __importStar(require("./integrations/lcw/v1"));
35
+ exports.Ozon = __importStar(require("./integrations/ozon/v1"));
36
+ // Utils
37
+ var request_id_1 = require("./utils/request-id");
38
+ Object.defineProperty(exports, "generateRequestId", { enumerable: true, get: function () { return request_id_1.generateRequestId; } });
39
+ var backoff_request_1 = require("./utils/backoff-request");
40
+ Object.defineProperty(exports, "backoffRequest", { enumerable: true, get: function () { return backoff_request_1.backoffRequest; } });
41
+ Object.defineProperty(exports, "defaultBackoffRequestOptions", { enumerable: true, get: function () { return backoff_request_1.defaultBackoffRequestOptions; } });
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Client module for Boyner
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2024
6
+ */
7
+ import { Request } from "./request";
8
+ import { IClient } from "./../../../common/client";
9
+ import { IRequestInput } from "./../../../common/request";
10
+ export interface ICredentials {
11
+ supplierId: string;
12
+ apiKey: string;
13
+ apiSecret: string;
14
+ }
15
+ export interface IOptions {
16
+ debug: boolean;
17
+ timeout: number;
18
+ proxy: any;
19
+ }
20
+ export interface IClientParams {
21
+ credentials: ICredentials;
22
+ options?: Partial<IOptions>;
23
+ }
24
+ export declare class Client implements IClient {
25
+ params: IClientParams;
26
+ constructor(params: IClientParams);
27
+ getBaseURL(): string;
28
+ request(request: Partial<IRequestInput>): Request;
29
+ }
30
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/integrations/boyner/v1/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,WAAW,YAAY;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,GAAG,CAAC;CACd;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;IASxC,UAAU,IAAI,MAAM;IAIpB,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,OAAO;CAGpD"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * Client module for Boyner
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2024
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Client = void 0;
10
+ const request_1 = require("./request");
11
+ class Client {
12
+ params;
13
+ constructor(params) {
14
+ this.params = params;
15
+ const defaultOptions = {
16
+ debug: false,
17
+ timeout: 0, // no timeout
18
+ proxy: undefined
19
+ };
20
+ this.params.options = { ...defaultOptions, ...this.params.options }; // {...{foo:'bar'}, ...undefined} == {foo:'bar'}
21
+ }
22
+ getBaseURL() {
23
+ return 'https://merchantapi.boyner.com.tr/sapigw/';
24
+ }
25
+ request(request) {
26
+ return new request_1.Request(this, request);
27
+ }
28
+ }
29
+ exports.Client = Client;
30
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/integrations/boyner/v1/client.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uCAAoC;AAqBpC,MAAa,MAAM;IACI;IAAnB,YAAmB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;QACpC,MAAM,cAAc,GAAa;YAC7B,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,OAAO,2CAA2C,CAAC;IACvD,CAAC;IAED,OAAO,CAAC,OAA+B;QACnC,OAAO,IAAI,iBAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ;AAjBD,wBAiBC","sourcesContent":["/**\n * Client module for Boyner\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport { Request } from \"./request\";\nimport { IClient } from \"./../../../common/client\";\nimport { IRequestInput } from \"./../../../common/request\";\n\nexport interface ICredentials {\n supplierId: string;\n apiKey: string;\n apiSecret: string;\n}\n\nexport interface IOptions {\n debug: boolean;\n timeout: number; // milliseconds\n proxy: any;\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 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 return 'https://merchantapi.boyner.com.tr/sapigw/';\n }\n\n request(request: Partial<IRequestInput>): Request {\n return new Request(this, request);\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { Client } from "./client";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/boyner/v1/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Client = void 0;
4
+ var client_1 = require("./client");
5
+ Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integrations/boyner/v1/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA","sourcesContent":["export { Client } from \"./client\";\n"]}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Request module for Boyner
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2024
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
+ }
20
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/integrations/boyner/v1/request.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAsB,aAAa,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAGpE,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;IA+B3E,YAAY,CAAC,QAAQ,EAAE,QAAQ;IAI/B,YAAY,IAAI,MAAM;IAIhB,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;CAUvC"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * Request module for Boyner
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2024
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 axios_1 = __importDefault(require("axios"));
14
+ const axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
15
+ const request_id_1 = require("../../../utils/request-id");
16
+ class Request {
17
+ client;
18
+ request;
19
+ axiosConfig;
20
+ axiosMockCallback;
21
+ constructor(client, request) {
22
+ this.client = client;
23
+ this.request = request;
24
+ if (this.request.headers == undefined) {
25
+ this.request.headers = {};
26
+ }
27
+ this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';
28
+ this.request.headers['User-Agent'] = this.request.headers?.['User-Agent'] ?? `${this.client.params.credentials.supplierId} - Entegrasyon.app`;
29
+ if (this.request.body) {
30
+ this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';
31
+ }
32
+ this.axiosConfig = {
33
+ baseURL: this.client.getBaseURL(),
34
+ timeout: this.client.params.options?.timeout,
35
+ proxy: this.client.params.options?.proxy,
36
+ method: this.request.method,
37
+ url: this.request.path,
38
+ params: this.request.params,
39
+ data: this.request.body,
40
+ headers: this.request.headers,
41
+ responseType: 'json',
42
+ validateStatus: (status) => {
43
+ return ![401, 403, 404].includes(status);
44
+ },
45
+ };
46
+ this.axiosConfig.auth = {
47
+ username: this.client.params.credentials.apiKey,
48
+ password: this.client.params.credentials.apiSecret
49
+ };
50
+ }
51
+ setAxiosMock(callback) {
52
+ this.axiosMockCallback = callback;
53
+ }
54
+ getRequestId() {
55
+ return (0, request_id_1.generateRequestId)(this.axiosConfig, 'boyner-v1');
56
+ }
57
+ async send() {
58
+ // mocks will be used during the tests
59
+ if (this.axiosMockCallback != undefined) {
60
+ const mock = new axios_mock_adapter_1.default(axios_1.default);
61
+ this.axiosMockCallback(mock);
62
+ }
63
+ return (0, axios_1.default)(this.axiosConfig);
64
+ }
65
+ }
66
+ exports.Request = Request;
67
+ //# sourceMappingURL=request.js.map
@@ -0,0 +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,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;QAEF,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG;YACpB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM;YAC/C,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS;SACrD,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;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}"]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Client module for Çiçeksepeti
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2024
6
+ */
7
+ import { Request } from "./request";
8
+ import { IClient } from "./../../../common/client";
9
+ import { IRequestInput } from "./../../../common/request";
10
+ export interface ICredentials {
11
+ apiKey: string;
12
+ }
13
+ export interface IOptions {
14
+ env: Environment;
15
+ debug: boolean;
16
+ timeout: number;
17
+ proxy: any;
18
+ }
19
+ export declare enum Environment {
20
+ PRODUCTION = 0,
21
+ STAGE = 1
22
+ }
23
+ export interface IClientParams {
24
+ credentials: ICredentials;
25
+ options?: Partial<IOptions>;
26
+ }
27
+ export declare class Client implements IClient {
28
+ params: IClientParams;
29
+ constructor(params: IClientParams);
30
+ getBaseURL(): string;
31
+ request(request: Partial<IRequestInput>): Request;
32
+ }
33
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/integrations/ciceksepeti/v1/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACrB,GAAG,EAAE,WAAW,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,GAAG,CAAC;CACd;AAED,oBAAY,WAAW;IACnB,UAAU,IAAA;IACV,KAAK,IAAA;CACR;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;IAOpB,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,OAAO;CAGpD"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Client module for Çiçeksepeti
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2024
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Client = exports.Environment = void 0;
10
+ const request_1 = require("./request");
11
+ var Environment;
12
+ (function (Environment) {
13
+ Environment[Environment["PRODUCTION"] = 0] = "PRODUCTION";
14
+ Environment[Environment["STAGE"] = 1] = "STAGE";
15
+ })(Environment || (exports.Environment = Environment = {}));
16
+ class Client {
17
+ params;
18
+ constructor(params) {
19
+ this.params = params;
20
+ const defaultOptions = {
21
+ env: Environment.PRODUCTION,
22
+ debug: false,
23
+ timeout: 0, // no timeout
24
+ proxy: undefined
25
+ };
26
+ this.params.options = { ...defaultOptions, ...this.params.options }; // {...{foo:'bar'}, ...undefined} == {foo:'bar'}
27
+ }
28
+ getBaseURL() {
29
+ if (this.params.options?.env == Environment.STAGE) {
30
+ return 'https://sandbox-apis.ciceksepeti.com/api/v1/';
31
+ }
32
+ return 'https://apis.ciceksepeti.com/api/v1/';
33
+ }
34
+ request(request) {
35
+ return new request_1.Request(this, request);
36
+ }
37
+ }
38
+ exports.Client = Client;
39
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/integrations/ciceksepeti/v1/client.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uCAAoC;AAepC,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,yDAAU,CAAA;IACV,+CAAK,CAAA;AACT,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAOD,MAAa,MAAM;IACI;IAAnB,YAAmB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;QACpC,MAAM,cAAc,GAAa;YAC7B,GAAG,EAAE,WAAW,CAAC,UAAU;YAC3B,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,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;YAChD,OAAO,8CAA8C,CAAC;QAC1D,CAAC;QACD,OAAO,sCAAsC,CAAC;IAClD,CAAC;IAED,OAAO,CAAC,OAA+B;QACnC,OAAO,IAAI,iBAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ;AArBD,wBAqBC","sourcesContent":["/**\n * Client module for Çiçeksepeti\n * @package entegrasyonapp/lib\n * @author Ekin Karadeniz\n * @copyright 2023-2024\n */\n\nimport { Request } from \"./request\";\nimport { IClient } from \"./../../../common/client\";\nimport { IRequestInput } from \"./../../../common/request\";\n\nexport interface ICredentials {\n apiKey: string;\n}\n\nexport interface IOptions {\n env: Environment;\n debug: boolean;\n timeout: number; // milliseconds\n proxy: any;\n}\n\nexport enum Environment {\n PRODUCTION,\n STAGE\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 env: Environment.PRODUCTION,\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 if (this.params.options?.env == Environment.STAGE) {\n return 'https://sandbox-apis.ciceksepeti.com/api/v1/';\n }\n return 'https://apis.ciceksepeti.com/api/v1/';\n }\n\n request(request: Partial<IRequestInput>): Request {\n return new Request(this, request);\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { Client, Environment } from "./client";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/ciceksepeti/v1/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Environment = 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, "Environment", { enumerable: true, get: function () { return client_1.Environment; } });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integrations/ciceksepeti/v1/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAAtC,gGAAA,MAAM,OAAA;AAAE,qGAAA,WAAW,OAAA","sourcesContent":["export { Client, Environment } from \"./client\";\n"]}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Request module for Çiçeksepeti
3
+ * @package entegrasyonapp/lib
4
+ * @author Ekin Karadeniz
5
+ * @copyright 2023-2024
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
+ }
20
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/integrations/ciceksepeti/v1/request.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAsB,aAAa,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAGpE,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;IA0B3E,YAAY,CAAC,QAAQ,EAAE,QAAQ;IAI/B,YAAY,IAAI,MAAM;IAIhB,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC;CAUvC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /**
3
+ * Request module for Çiçeksepeti
4
+ * @package entegrasyonapp/lib
5
+ * @author Ekin Karadeniz
6
+ * @copyright 2023-2024
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 axios_1 = __importDefault(require("axios"));
14
+ const axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
15
+ const request_id_1 = require("../../../utils/request-id");
16
+ class Request {
17
+ client;
18
+ request;
19
+ axiosConfig;
20
+ axiosMockCallback;
21
+ constructor(client, request) {
22
+ this.client = client;
23
+ this.request = request;
24
+ if (this.request.headers == undefined) {
25
+ this.request.headers = {};
26
+ }
27
+ this.request.headers['Accept'] = this.request.headers?.['Accept'] ?? 'application/json';
28
+ this.request.headers['x-api-key'] = this.client.params.credentials.apiKey;
29
+ if (this.request.body) {
30
+ this.request.headers['Content-Type'] = this.request.headers?.['Content-Type'] ?? 'application/json';
31
+ }
32
+ this.axiosConfig = {
33
+ baseURL: this.client.getBaseURL(),
34
+ timeout: this.client.params.options?.timeout,
35
+ proxy: this.client.params.options?.proxy,
36
+ method: this.request.method,
37
+ url: this.request.path,
38
+ params: this.request.params,
39
+ data: this.request.body,
40
+ headers: this.request.headers,
41
+ responseType: 'json',
42
+ validateStatus: (status) => {
43
+ return ![401, 403, 404].includes(status);
44
+ },
45
+ };
46
+ }
47
+ setAxiosMock(callback) {
48
+ this.axiosMockCallback = callback;
49
+ }
50
+ getRequestId() {
51
+ return (0, request_id_1.generateRequestId)(this.axiosConfig, 'ciceksepeti-v1');
52
+ }
53
+ async send() {
54
+ // mocks will be used during the tests
55
+ if (this.axiosMockCallback != undefined) {
56
+ const mock = new axios_mock_adapter_1.default(axios_1.default);
57
+ this.axiosMockCallback(mock);
58
+ }
59
+ return (0, axios_1.default)(this.axiosConfig);
60
+ }
61
+ }
62
+ exports.Request = Request;
63
+ //# sourceMappingURL=request.js.map
@@ -0,0 +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}"]}