@lonca/trendyol 0.6.0 → 0.7.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.cts CHANGED
@@ -10,7 +10,7 @@ interface TransportConfig {
10
10
  apiKey: string;
11
11
  apiSecret: string;
12
12
  env: TrendyolEnvironment;
13
- integratorName?: string;
13
+ integratorName: string;
14
14
  clientIp?: string;
15
15
  logger?: Logger;
16
16
  /** Request timeout in ms. Default: 30_000. */
@@ -2152,11 +2152,12 @@ interface CreateClientOptions {
2152
2152
  /** Which Trendyol environment to target. */
2153
2153
  env: TrendyolEnvironment;
2154
2154
  /**
2155
- * Integrator company name to send in `User-Agent` / `x-agentname`.
2156
- * Defaults to `'SelfIntegration'` if the seller owns the integration code.
2155
+ * Integrator company name to send in `User-Agent` / `x-agentname`. Required —
2156
+ * Trendyol uses this to attribute API traffic. Use `'SelfIntegration'` if
2157
+ * the seller owns the integration code, otherwise your company / product name.
2157
2158
  * Trendyol caps this at 30 alphanumeric characters.
2158
2159
  */
2159
- integratorName?: string;
2160
+ integratorName: string;
2160
2161
  /**
2161
2162
  * IPv4 address to send in `x-clientip`.
2162
2163
  * Defaults to `'127.0.0.1'` — Trendyol does not validate this against the
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ interface TransportConfig {
10
10
  apiKey: string;
11
11
  apiSecret: string;
12
12
  env: TrendyolEnvironment;
13
- integratorName?: string;
13
+ integratorName: string;
14
14
  clientIp?: string;
15
15
  logger?: Logger;
16
16
  /** Request timeout in ms. Default: 30_000. */
@@ -2152,11 +2152,12 @@ interface CreateClientOptions {
2152
2152
  /** Which Trendyol environment to target. */
2153
2153
  env: TrendyolEnvironment;
2154
2154
  /**
2155
- * Integrator company name to send in `User-Agent` / `x-agentname`.
2156
- * Defaults to `'SelfIntegration'` if the seller owns the integration code.
2155
+ * Integrator company name to send in `User-Agent` / `x-agentname`. Required —
2156
+ * Trendyol uses this to attribute API traffic. Use `'SelfIntegration'` if
2157
+ * the seller owns the integration code, otherwise your company / product name.
2157
2158
  * Trendyol caps this at 30 alphanumeric characters.
2158
2159
  */
2159
- integratorName?: string;
2160
+ integratorName: string;
2160
2161
  /**
2161
2162
  * IPv4 address to send in `x-clientip`.
2162
2163
  * Defaults to `'127.0.0.1'` — Trendyol does not validate this against the
package/dist/index.js CHANGED
@@ -2224,7 +2224,7 @@ function buildAuthHeader(apiKey, apiSecret) {
2224
2224
  const token = Buffer.from(`${apiKey}:${apiSecret}`, "utf8").toString("base64");
2225
2225
  return `Basic ${token}`;
2226
2226
  }
2227
- function buildUserAgent(sellerId, integratorName = "SelfIntegration") {
2227
+ function buildUserAgent(sellerId, integratorName) {
2228
2228
  return `${sellerId} - ${integratorName}`;
2229
2229
  }
2230
2230
  function mapHttpError(status, body, retryAfterMs) {
@@ -2385,13 +2385,12 @@ var TrendyolTransport = class {
2385
2385
  return url.toString();
2386
2386
  }
2387
2387
  buildHeaders(correlationId) {
2388
- const integratorName = this.config.integratorName ?? "SelfIntegration";
2389
2388
  return {
2390
2389
  Authorization: buildAuthHeader(this.config.apiKey, this.config.apiSecret),
2391
2390
  "x-clientip": this.config.clientIp ?? "127.0.0.1",
2392
2391
  "x-correlationid": correlationId,
2393
- "x-agentname": integratorName,
2394
- "User-Agent": buildUserAgent(this.config.sellerId, integratorName),
2392
+ "x-agentname": this.config.integratorName,
2393
+ "User-Agent": buildUserAgent(this.config.sellerId, this.config.integratorName),
2395
2394
  "Content-Type": "application/json",
2396
2395
  Accept: "application/json"
2397
2396
  };