@etainabl/nodejs-sdk 1.3.159 → 1.3.160

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
@@ -1438,6 +1438,14 @@ interface ETNPagedResponse<T = any> {
1438
1438
  limit: number;
1439
1439
  skip: number;
1440
1440
  }
1441
+ interface AutomationFetchRunResponse {
1442
+ success: boolean;
1443
+ processed: number;
1444
+ results: Array<{
1445
+ automationRunId: string;
1446
+ accountId: string;
1447
+ }>;
1448
+ }
1441
1449
  interface AuthOptions {
1442
1450
  key?: string;
1443
1451
  token?: string;
@@ -1568,7 +1576,7 @@ declare const _default$4: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
1568
1576
  createScraperRun: (data: any, options?: AxiosRequestConfig) => Promise<ScraperRun<string>>;
1569
1577
  createScraperRunLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<ScraperRun<string>>;
1570
1578
  createAutomationRun: (data: Omit<AutomationRun<string, string>, "_id">, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string | Date>>;
1571
- createAutomationFetchRun: (data: any, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string | Date>>;
1579
+ createAutomationFetchRun: (data: any, options?: AxiosRequestConfig) => Promise<AutomationFetchRunResponse>;
1572
1580
  listAutomationRun: <P = AutomationRun<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1573
1581
  getAutomationRun: (id: string, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string | Date>>;
1574
1582
  updateAutomationRun: (id: string, data: any, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string>>;
@@ -1683,15 +1691,25 @@ declare class IngestHandler {
1683
1691
  deleteMessage(queueUrl?: string | undefined): Promise<void>;
1684
1692
  }
1685
1693
 
1694
+ /**
1695
+ * Determines if an error is transient and should be retried automatically.
1696
+ * Transient errors include network issues, timeouts, and server errors.
1697
+ *
1698
+ * @param error - The error object to check
1699
+ * @returns true if the error is transient and should be retried
1700
+ */
1701
+ declare function isTransientError(error: any): boolean;
1702
+
1686
1703
  type index$1_IngestHandler = IngestHandler;
1687
1704
  declare const index$1_IngestHandler: typeof IngestHandler;
1688
1705
  declare const index$1_automationServices: typeof automationServices;
1689
1706
  declare const index$1_automationSources: typeof automationSources;
1690
1707
  declare const index$1_getMeterPointNumberBottomLine: typeof getMeterPointNumberBottomLine;
1708
+ declare const index$1_isTransientError: typeof isTransientError;
1691
1709
  declare const index$1_utilityTypes: typeof utilityTypes;
1692
1710
  declare const index$1_wasteCategories: typeof wasteCategories;
1693
1711
  declare namespace index$1 {
1694
- export { index$1_IngestHandler as IngestHandler, index$1_automationServices as automationServices, index$1_automationSources as automationSources, index$1_getMeterPointNumberBottomLine as getMeterPointNumberBottomLine, units$1 as units, index$1_utilityTypes as utilityTypes, index$1_wasteCategories as wasteCategories };
1712
+ export { index$1_IngestHandler as IngestHandler, index$1_automationServices as automationServices, index$1_automationSources as automationSources, index$1_getMeterPointNumberBottomLine as getMeterPointNumberBottomLine, index$1_isTransientError as isTransientError, units$1 as units, index$1_utilityTypes as utilityTypes, index$1_wasteCategories as wasteCategories };
1695
1713
  }
1696
1714
 
1697
1715
  interface ETNModel {
package/dist/index.d.ts CHANGED
@@ -1438,6 +1438,14 @@ interface ETNPagedResponse<T = any> {
1438
1438
  limit: number;
1439
1439
  skip: number;
1440
1440
  }
1441
+ interface AutomationFetchRunResponse {
1442
+ success: boolean;
1443
+ processed: number;
1444
+ results: Array<{
1445
+ automationRunId: string;
1446
+ accountId: string;
1447
+ }>;
1448
+ }
1441
1449
  interface AuthOptions {
1442
1450
  key?: string;
1443
1451
  token?: string;
@@ -1568,7 +1576,7 @@ declare const _default$4: (auth: AuthOptions, instanceOptions?: CreateAxiosDefau
1568
1576
  createScraperRun: (data: any, options?: AxiosRequestConfig) => Promise<ScraperRun<string>>;
1569
1577
  createScraperRunLog: (id: string, data: any, options?: AxiosRequestConfig) => Promise<ScraperRun<string>>;
1570
1578
  createAutomationRun: (data: Omit<AutomationRun<string, string>, "_id">, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string | Date>>;
1571
- createAutomationFetchRun: (data: any, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string | Date>>;
1579
+ createAutomationFetchRun: (data: any, options?: AxiosRequestConfig) => Promise<AutomationFetchRunResponse>;
1572
1580
  listAutomationRun: <P = AutomationRun<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1573
1581
  getAutomationRun: (id: string, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string | Date>>;
1574
1582
  updateAutomationRun: (id: string, data: any, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string>>;
@@ -1683,15 +1691,25 @@ declare class IngestHandler {
1683
1691
  deleteMessage(queueUrl?: string | undefined): Promise<void>;
1684
1692
  }
1685
1693
 
1694
+ /**
1695
+ * Determines if an error is transient and should be retried automatically.
1696
+ * Transient errors include network issues, timeouts, and server errors.
1697
+ *
1698
+ * @param error - The error object to check
1699
+ * @returns true if the error is transient and should be retried
1700
+ */
1701
+ declare function isTransientError(error: any): boolean;
1702
+
1686
1703
  type index$1_IngestHandler = IngestHandler;
1687
1704
  declare const index$1_IngestHandler: typeof IngestHandler;
1688
1705
  declare const index$1_automationServices: typeof automationServices;
1689
1706
  declare const index$1_automationSources: typeof automationSources;
1690
1707
  declare const index$1_getMeterPointNumberBottomLine: typeof getMeterPointNumberBottomLine;
1708
+ declare const index$1_isTransientError: typeof isTransientError;
1691
1709
  declare const index$1_utilityTypes: typeof utilityTypes;
1692
1710
  declare const index$1_wasteCategories: typeof wasteCategories;
1693
1711
  declare namespace index$1 {
1694
- export { index$1_IngestHandler as IngestHandler, index$1_automationServices as automationServices, index$1_automationSources as automationSources, index$1_getMeterPointNumberBottomLine as getMeterPointNumberBottomLine, units$1 as units, index$1_utilityTypes as utilityTypes, index$1_wasteCategories as wasteCategories };
1712
+ export { index$1_IngestHandler as IngestHandler, index$1_automationServices as automationServices, index$1_automationSources as automationSources, index$1_getMeterPointNumberBottomLine as getMeterPointNumberBottomLine, index$1_isTransientError as isTransientError, units$1 as units, index$1_utilityTypes as utilityTypes, index$1_wasteCategories as wasteCategories };
1695
1713
  }
1696
1714
 
1697
1715
  interface ETNModel {
package/dist/index.js CHANGED
@@ -17144,6 +17144,7 @@ __export(utils_exports, {
17144
17144
  automationServices: () => automationServices,
17145
17145
  automationSources: () => automationSources,
17146
17146
  getMeterPointNumberBottomLine: () => getMeterPointNumberBottomLine,
17147
+ isTransientError: () => isTransientError2,
17147
17148
  units: () => units,
17148
17149
  utilityTypes: () => utilityTypes,
17149
17150
  wasteCategories: () => wasteCategories
@@ -23297,6 +23298,23 @@ var IngestHandler = class {
23297
23298
  }
23298
23299
  };
23299
23300
 
23301
+ // src/utils/errors.ts
23302
+ function isTransientError2(error) {
23303
+ if (error.code === "ETIMEDOUT" || error.code === "ECONNRESET" || error.code === "ENOTFOUND" || error.code === "ECONNREFUSED") {
23304
+ return true;
23305
+ }
23306
+ if (error.message?.includes("timeout") || error.message?.includes("ETIMEDOUT")) {
23307
+ return true;
23308
+ }
23309
+ if (error.response?.status >= 500 && error.response?.status < 600) {
23310
+ return true;
23311
+ }
23312
+ if (error.message?.includes("Cloudflare") || error.message?.includes("522") || error.message?.includes("524")) {
23313
+ return true;
23314
+ }
23315
+ return false;
23316
+ }
23317
+
23300
23318
  // src/openai/index.ts
23301
23319
  var openai_exports = {};
23302
23320
  __export(openai_exports, {