@translated/lara 1.2.2 → 1.3.1

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.
@@ -15,7 +15,9 @@ export declare abstract class LaraClient {
15
15
  private readonly crypto;
16
16
  private readonly accessKeyId;
17
17
  private readonly accessKeySecret;
18
+ private readonly extraHeaders;
18
19
  protected constructor(accessKeyId: string, accessKeySecret: string);
20
+ setExtraHeader(name: string, value: string): void;
19
21
  get<T>(path: string, params?: Record<string, any>): Promise<T>;
20
22
  delete<T>(path: string, params?: Record<string, any>): Promise<T>;
21
23
  post<T>(path: string, body?: Record<string, any>, files?: Record<string, string>): Promise<T>;
package/lib/net/client.js CHANGED
@@ -33,9 +33,13 @@ function parseContent(content) {
33
33
  class LaraClient {
34
34
  constructor(accessKeyId, accessKeySecret) {
35
35
  this.crypto = (0, crypto_1.default)();
36
+ this.extraHeaders = {};
36
37
  this.accessKeyId = accessKeyId;
37
38
  this.accessKeySecret = accessKeySecret;
38
39
  }
40
+ setExtraHeader(name, value) {
41
+ this.extraHeaders[name] = value;
42
+ }
39
43
  get(path, params) {
40
44
  return this.request("GET", path, params);
41
45
  }
@@ -55,7 +59,8 @@ class LaraClient {
55
59
  "X-HTTP-Method-Override": method,
56
60
  "X-Lara-Date": new Date().toUTCString(),
57
61
  "X-Lara-SDK-Name": "lara-node",
58
- 'X-Lara-SDK-Version': sdk_version_1.version
62
+ 'X-Lara-SDK-Version': sdk_version_1.version,
63
+ ...this.extraHeaders
59
64
  };
60
65
  if (body) {
61
66
  body = Object.fromEntries(Object.entries(body).filter(([_, v]) => v !== undefined && v !== null));
@@ -1 +1 @@
1
- export declare const version = "1.2.2";
1
+ export declare const version = "1.3.1";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = "1.2.2";
4
+ exports.version = "1.3.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@translated/lara",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "engines": {