@etainabl/nodejs-sdk 1.3.158 → 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,6 +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>>;
1579
+ createAutomationFetchRun: (data: any, options?: AxiosRequestConfig) => Promise<AutomationFetchRunResponse>;
1571
1580
  listAutomationRun: <P = AutomationRun<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1572
1581
  getAutomationRun: (id: string, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string | Date>>;
1573
1582
  updateAutomationRun: (id: string, data: any, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string>>;
@@ -1682,15 +1691,25 @@ declare class IngestHandler {
1682
1691
  deleteMessage(queueUrl?: string | undefined): Promise<void>;
1683
1692
  }
1684
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
+
1685
1703
  type index$1_IngestHandler = IngestHandler;
1686
1704
  declare const index$1_IngestHandler: typeof IngestHandler;
1687
1705
  declare const index$1_automationServices: typeof automationServices;
1688
1706
  declare const index$1_automationSources: typeof automationSources;
1689
1707
  declare const index$1_getMeterPointNumberBottomLine: typeof getMeterPointNumberBottomLine;
1708
+ declare const index$1_isTransientError: typeof isTransientError;
1690
1709
  declare const index$1_utilityTypes: typeof utilityTypes;
1691
1710
  declare const index$1_wasteCategories: typeof wasteCategories;
1692
1711
  declare namespace index$1 {
1693
- 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 };
1694
1713
  }
1695
1714
 
1696
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,6 +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>>;
1579
+ createAutomationFetchRun: (data: any, options?: AxiosRequestConfig) => Promise<AutomationFetchRunResponse>;
1571
1580
  listAutomationRun: <P = AutomationRun<string, string | Date>>(options?: AxiosRequestConfig) => Promise<ETNPagedResponse<P>>;
1572
1581
  getAutomationRun: (id: string, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string | Date>>;
1573
1582
  updateAutomationRun: (id: string, data: any, options?: AxiosRequestConfig) => Promise<AutomationRun<string, string>>;
@@ -1682,15 +1691,25 @@ declare class IngestHandler {
1682
1691
  deleteMessage(queueUrl?: string | undefined): Promise<void>;
1683
1692
  }
1684
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
+
1685
1703
  type index$1_IngestHandler = IngestHandler;
1686
1704
  declare const index$1_IngestHandler: typeof IngestHandler;
1687
1705
  declare const index$1_automationServices: typeof automationServices;
1688
1706
  declare const index$1_automationSources: typeof automationSources;
1689
1707
  declare const index$1_getMeterPointNumberBottomLine: typeof getMeterPointNumberBottomLine;
1708
+ declare const index$1_isTransientError: typeof isTransientError;
1690
1709
  declare const index$1_utilityTypes: typeof utilityTypes;
1691
1710
  declare const index$1_wasteCategories: typeof wasteCategories;
1692
1711
  declare namespace index$1 {
1693
- 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 };
1694
1713
  }
1695
1714
 
1696
1715
  interface ETNModel {
package/dist/index.js CHANGED
@@ -16569,6 +16569,7 @@ var api_default = (auth, instanceOptions = {}) => {
16569
16569
  createScraperRunLog: subFactory.create(etainablApi, "scraper-runs", "logs"),
16570
16570
  // automation runs
16571
16571
  createAutomationRun: factory.create(etainablApi, "automation-runs"),
16572
+ createAutomationFetchRun: factory.create(etainablApi, "automation-runs", "fetch-run"),
16572
16573
  listAutomationRun: factory.list(etainablApi, "automation-runs"),
16573
16574
  getAutomationRun: factory.getWithId(etainablApi, "automation-runs"),
16574
16575
  updateAutomationRun: factory.update(etainablApi, "automation-runs"),
@@ -17143,6 +17144,7 @@ __export(utils_exports, {
17143
17144
  automationServices: () => automationServices,
17144
17145
  automationSources: () => automationSources,
17145
17146
  getMeterPointNumberBottomLine: () => getMeterPointNumberBottomLine,
17147
+ isTransientError: () => isTransientError2,
17146
17148
  units: () => units,
17147
17149
  utilityTypes: () => utilityTypes,
17148
17150
  wasteCategories: () => wasteCategories
@@ -23296,6 +23298,23 @@ var IngestHandler = class {
23296
23298
  }
23297
23299
  };
23298
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
+
23299
23318
  // src/openai/index.ts
23300
23319
  var openai_exports = {};
23301
23320
  __export(openai_exports, {