@lonca/trendyol 0.9.0 → 0.11.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.
@@ -0,0 +1,46 @@
1
+ import { f as BatchRequestStatus, b3 as TrendyolClient } from './client-BZeFAlrp.cjs';
2
+ import '@lonca/core';
3
+
4
+ /** A request the fake client received, normalized for matching in a `handler`. */
5
+ interface FakeTrendyolRequest {
6
+ method: string;
7
+ /** URL path only — no host, no query string. */
8
+ path: string;
9
+ /** Parsed query parameters. */
10
+ query: URLSearchParams;
11
+ /** Parsed JSON request body, when present. */
12
+ body?: unknown;
13
+ }
14
+ interface TrendyolFakeSeed {
15
+ /**
16
+ * Return the raw JSON the Trendyol API would respond with for a request, or
17
+ * `undefined` to fall through to the built-in hot-path defaults.
18
+ */
19
+ handler?: (req: FakeTrendyolRequest) => unknown;
20
+ /** `batchRequestId` returned by `inventory.update` and echoed by `getBatchStatus`. Default: `'fake-batch-1'`. */
21
+ batchRequestId?: string;
22
+ /** Terminal status `getBatchStatus` reports. Default: `'COMPLETED'`. */
23
+ batchStatus?: BatchRequestStatus;
24
+ }
25
+ /**
26
+ * Build an in-memory {@link TrendyolClient} for unit tests.
27
+ *
28
+ * It is the real client graph wired over a fake `fetch`, so your tests exercise
29
+ * the SDK's real request building and response normalization — no network, no
30
+ * structural-compat guessing. The batch hot-path
31
+ * (`inventory.update` → `products.getBatchStatus` → `inventory.updateAndWait`)
32
+ * works out of the box; drive any other endpoint with `seed.handler`.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const client = createFakeTrendyolClient({ batchRequestId: 'b1' });
37
+ * const [result] = await client.inventory.updateAndWait(
38
+ * [{ barcode: 'X', quantity: 1 }],
39
+ * { pollIntervalMs: 1 },
40
+ * );
41
+ * result.status; // 'COMPLETED'
42
+ * ```
43
+ */
44
+ declare function createFakeTrendyolClient(seed?: TrendyolFakeSeed): TrendyolClient;
45
+
46
+ export { type FakeTrendyolRequest, type TrendyolFakeSeed, createFakeTrendyolClient };
@@ -0,0 +1,46 @@
1
+ import { f as BatchRequestStatus, b3 as TrendyolClient } from './client-BZeFAlrp.js';
2
+ import '@lonca/core';
3
+
4
+ /** A request the fake client received, normalized for matching in a `handler`. */
5
+ interface FakeTrendyolRequest {
6
+ method: string;
7
+ /** URL path only — no host, no query string. */
8
+ path: string;
9
+ /** Parsed query parameters. */
10
+ query: URLSearchParams;
11
+ /** Parsed JSON request body, when present. */
12
+ body?: unknown;
13
+ }
14
+ interface TrendyolFakeSeed {
15
+ /**
16
+ * Return the raw JSON the Trendyol API would respond with for a request, or
17
+ * `undefined` to fall through to the built-in hot-path defaults.
18
+ */
19
+ handler?: (req: FakeTrendyolRequest) => unknown;
20
+ /** `batchRequestId` returned by `inventory.update` and echoed by `getBatchStatus`. Default: `'fake-batch-1'`. */
21
+ batchRequestId?: string;
22
+ /** Terminal status `getBatchStatus` reports. Default: `'COMPLETED'`. */
23
+ batchStatus?: BatchRequestStatus;
24
+ }
25
+ /**
26
+ * Build an in-memory {@link TrendyolClient} for unit tests.
27
+ *
28
+ * It is the real client graph wired over a fake `fetch`, so your tests exercise
29
+ * the SDK's real request building and response normalization — no network, no
30
+ * structural-compat guessing. The batch hot-path
31
+ * (`inventory.update` → `products.getBatchStatus` → `inventory.updateAndWait`)
32
+ * works out of the box; drive any other endpoint with `seed.handler`.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const client = createFakeTrendyolClient({ batchRequestId: 'b1' });
37
+ * const [result] = await client.inventory.updateAndWait(
38
+ * [{ barcode: 'X', quantity: 1 }],
39
+ * { pollIntervalMs: 1 },
40
+ * );
41
+ * result.status; // 'COMPLETED'
42
+ * ```
43
+ */
44
+ declare function createFakeTrendyolClient(seed?: TrendyolFakeSeed): TrendyolClient;
45
+
46
+ export { type FakeTrendyolRequest, type TrendyolFakeSeed, createFakeTrendyolClient };