@moneylion/engine-api 1.3.7 → 1.3.8

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/client.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  type HttpMethod = "GET" | "POST" | "PATCH" | "DELETE";
3
+ export interface ClientOptions {
4
+ timeout_ms?: number;
5
+ additional_headers?: Record<string, string>;
6
+ }
3
7
  /**
4
8
  * The base HTTP client that the API clients depend on.
5
9
  * It handles setting the appropriate headers and also handles serialization and deserialization.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Client, ApiError } from "./client.js";
1
+ export { Client, ApiError, type ClientOptions } from "./client.js";
2
2
  export * from "./leads.js";
3
3
  export * from "./rate_tables.js";
4
4
  export * from "./offer_catalog_rate_tables.js";
package/dist/leads.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type ClientOptions } from "./client.js";
1
2
  import { AsyncRateTable, type RateTable } from "./rate_tables.js";
2
3
  import { AsyncOfferCatalogRateTable, type OfferCatalogRateTable } from "./offer_catalog_rate_tables.js";
3
4
  import type { components } from "./generated/schema";
@@ -13,8 +14,9 @@ export declare class Leads {
13
14
  *
14
15
  * @param host - A hostname used to construct a Client instance.
15
16
  * @param auth_token - An authentication token used to construct a Client instance.
17
+ * @param options - Optional configuration including timeout_ms and additional_headers.
16
18
  */
17
- constructor(host: string, auth_token: string);
19
+ constructor(host: string, auth_token: string, options?: ClientOptions);
18
20
  /**
19
21
  * Create a new lead and retrieve its rate table.
20
22
  *
package/dist/leads.js CHANGED
@@ -21,9 +21,10 @@ export class Leads {
21
21
  *
22
22
  * @param host - A hostname used to construct a Client instance.
23
23
  * @param auth_token - An authentication token used to construct a Client instance.
24
+ * @param options - Optional configuration including timeout_ms and additional_headers.
24
25
  */
25
- constructor(host, auth_token) {
26
- this.client = new Client(host, auth_token);
26
+ constructor(host, auth_token, options) {
27
+ this.client = new Client(host, auth_token, options === null || options === void 0 ? void 0 : options.timeout_ms, undefined, options === null || options === void 0 ? void 0 : options.additional_headers);
27
28
  }
28
29
  /**
29
30
  * Create a new lead and retrieve its rate table.
@@ -1,4 +1,4 @@
1
- import { Client } from "./client.js";
1
+ import { Client, type ClientOptions } from "./client.js";
2
2
  import { type FixedOfferCatalogRateTable } from "./decoders.js";
3
3
  export type OfferCatalogRateTable = FixedOfferCatalogRateTable;
4
4
  export interface AsyncOfferCatalogRateTableCtorArgs {
@@ -7,6 +7,7 @@ export interface AsyncOfferCatalogRateTableCtorArgs {
7
7
  uuid?: string;
8
8
  host?: string;
9
9
  auth_token?: string;
10
+ options?: ClientOptions;
10
11
  }
11
12
  /**
12
13
  * The class used to fetch offer catalog rate tables from the Engine API.
@@ -23,12 +24,13 @@ export declare class AsyncOfferCatalogRateTable {
23
24
  * @param client - A Client instance to use for fetching the data.
24
25
  * @param host - A host used to construct a Client instance if none is provided.
25
26
  * @param auth_token - An authentication token used to construct a Client instance if none is provided.
27
+ * @param options - Optional configuration including timeout_ms and additional_headers.
26
28
  *
27
29
  * @remarks
28
30
  * Either one of rateTable or uuid is required, but providing both is an error.
29
31
  * Similarly, provide either a pre-constructed Client instance or the host and auth_token parameters to construct one but not both.
30
32
  */
31
- constructor({ rateTable, uuid, client, host, auth_token, }: AsyncOfferCatalogRateTableCtorArgs);
33
+ constructor({ rateTable, uuid, client, host, auth_token, options, }: AsyncOfferCatalogRateTableCtorArgs);
32
34
  /**
33
35
  * Resolve the async Offer Catalog Rate Table into a real Offer Catalog Rate Table.
34
36
  *
@@ -22,12 +22,13 @@ export class AsyncOfferCatalogRateTable {
22
22
  * @param client - A Client instance to use for fetching the data.
23
23
  * @param host - A host used to construct a Client instance if none is provided.
24
24
  * @param auth_token - An authentication token used to construct a Client instance if none is provided.
25
+ * @param options - Optional configuration including timeout_ms and additional_headers.
25
26
  *
26
27
  * @remarks
27
28
  * Either one of rateTable or uuid is required, but providing both is an error.
28
29
  * Similarly, provide either a pre-constructed Client instance or the host and auth_token parameters to construct one but not both.
29
30
  */
30
- constructor({ rateTable, uuid, client, host, auth_token, }) {
31
+ constructor({ rateTable, uuid, client, host, auth_token, options, }) {
31
32
  if (client && host && auth_token) {
32
33
  throw new TypeError("Client cannot be provided at the same time as a host and auth_token.");
33
34
  }
@@ -38,7 +39,7 @@ export class AsyncOfferCatalogRateTable {
38
39
  this.client = client;
39
40
  }
40
41
  else if (host && auth_token) {
41
- this.client = new Client(host, auth_token);
42
+ this.client = new Client(host, auth_token, options === null || options === void 0 ? void 0 : options.timeout_ms, undefined, options === null || options === void 0 ? void 0 : options.additional_headers);
42
43
  }
43
44
  else {
44
45
  throw new TypeError("Either client must be provided or host and auth_token must be provided.");
@@ -1,4 +1,4 @@
1
- import { Client } from "./client.js";
1
+ import { Client, type ClientOptions } from "./client.js";
2
2
  import { type FixedRateTable } from "./decoders.js";
3
3
  export type RateTable = FixedRateTable;
4
4
  export interface AsyncRateTableCtorArgs {
@@ -7,6 +7,7 @@ export interface AsyncRateTableCtorArgs {
7
7
  uuid?: string;
8
8
  host?: string;
9
9
  auth_token?: string;
10
+ options?: ClientOptions;
10
11
  }
11
12
  /**
12
13
  * The class used to fetch rate tables from the Engine API.
@@ -23,12 +24,13 @@ export declare class AsyncRateTable {
23
24
  * @param client - A Client instance to use for fetching the data.
24
25
  * @param host - A host used to construct a Client instance if none is provided.
25
26
  * @param auth_token - An authentication token used to construct a Client instance if none is provided.
27
+ * @param options - Optional configuration including timeout_ms and additional_headers.
26
28
  *
27
29
  * @remarks
28
30
  * Either one of rateTable or uuid is required, but providing both is an error.
29
31
  * Similarly, provide either a pre-constructed Client instance or the host and auth_token parameters to construct one but not both.
30
32
  */
31
- constructor({ rateTable, uuid, client, host, auth_token, }: AsyncRateTableCtorArgs);
33
+ constructor({ rateTable, uuid, client, host, auth_token, options, }: AsyncRateTableCtorArgs);
32
34
  /**
33
35
  * Resolve the async Rate Table into a real Rate Table.
34
36
  *
@@ -22,12 +22,13 @@ export class AsyncRateTable {
22
22
  * @param client - A Client instance to use for fetching the data.
23
23
  * @param host - A host used to construct a Client instance if none is provided.
24
24
  * @param auth_token - An authentication token used to construct a Client instance if none is provided.
25
+ * @param options - Optional configuration including timeout_ms and additional_headers.
25
26
  *
26
27
  * @remarks
27
28
  * Either one of rateTable or uuid is required, but providing both is an error.
28
29
  * Similarly, provide either a pre-constructed Client instance or the host and auth_token parameters to construct one but not both.
29
30
  */
30
- constructor({ rateTable, uuid, client, host, auth_token, }) {
31
+ constructor({ rateTable, uuid, client, host, auth_token, options, }) {
31
32
  if (client && host && auth_token) {
32
33
  throw new TypeError("Client cannot be provided at the same time as a host and auth_token.");
33
34
  }
@@ -38,7 +39,7 @@ export class AsyncRateTable {
38
39
  this.client = client;
39
40
  }
40
41
  else if (host && auth_token) {
41
- this.client = new Client(host, auth_token);
42
+ this.client = new Client(host, auth_token, options === null || options === void 0 ? void 0 : options.timeout_ms, undefined, options === null || options === void 0 ? void 0 : options.additional_headers);
42
43
  }
43
44
  else {
44
45
  throw new TypeError("Either client must be provided or host and auth_token must be provided.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneylion/engine-api",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "Interface to engine.tech API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",