@etainabl/nodejs-sdk 1.3.176 → 1.3.179

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.
Files changed (26) hide show
  1. package/dist/esm/{chunk-HR3W7R4B.js → chunk-2N3MHFXC.js} +23 -5
  2. package/dist/esm/chunk-2N3MHFXC.js.map +1 -0
  3. package/dist/esm/{chunk-4G647IUM.js → chunk-MOHFNRAW.js} +2 -2
  4. package/dist/esm/{chunk-UR6FJOYI.js → chunk-WZHLTH2I.js} +2 -2
  5. package/dist/esm/{dist-es-XOZGODLE.js → dist-es-MCMK7LMC.js} +4 -4
  6. package/dist/esm/{dist-es-QWNQVMYC.js → dist-es-YMAKE32J.js} +4 -4
  7. package/dist/esm/{dist-es-JA6GH4HX.js → dist-es-YSZAYJCN.js} +2 -2
  8. package/dist/esm/index.js +47 -16
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/esm/{loadSso-66ZTLICD.js → loadSso-G7F52TGQ.js} +3 -3
  11. package/dist/esm/{sso-oidc-Z2X56STB.js → sso-oidc-45CVA5J4.js} +3 -3
  12. package/dist/esm/{sts-XINKL27T.js → sts-FE6UEDK6.js} +3 -3
  13. package/dist/index.d.cts +37 -5
  14. package/dist/index.d.ts +37 -5
  15. package/dist/index.js +63 -14
  16. package/dist/index.js.map +1 -1
  17. package/package.json +2 -1
  18. package/dist/esm/chunk-HR3W7R4B.js.map +0 -1
  19. /package/dist/esm/{chunk-4G647IUM.js.map → chunk-MOHFNRAW.js.map} +0 -0
  20. /package/dist/esm/{chunk-UR6FJOYI.js.map → chunk-WZHLTH2I.js.map} +0 -0
  21. /package/dist/esm/{dist-es-XOZGODLE.js.map → dist-es-MCMK7LMC.js.map} +0 -0
  22. /package/dist/esm/{dist-es-QWNQVMYC.js.map → dist-es-YMAKE32J.js.map} +0 -0
  23. /package/dist/esm/{dist-es-JA6GH4HX.js.map → dist-es-YSZAYJCN.js.map} +0 -0
  24. /package/dist/esm/{loadSso-66ZTLICD.js.map → loadSso-G7F52TGQ.js.map} +0 -0
  25. /package/dist/esm/{sso-oidc-Z2X56STB.js.map → sso-oidc-45CVA5J4.js.map} +0 -0
  26. /package/dist/esm/{sts-XINKL27T.js.map → sts-FE6UEDK6.js.map} +0 -0
@@ -12,7 +12,7 @@ import {
12
12
  parseJsonErrorBody,
13
13
  requestBuilder,
14
14
  take
15
- } from "./chunk-UR6FJOYI.js";
15
+ } from "./chunk-WZHLTH2I.js";
16
16
  import {
17
17
  AwsSdkSigV4Signer,
18
18
  Client,
@@ -67,7 +67,7 @@ import {
67
67
  resolveRetryConfig,
68
68
  resolveUserAgentConfig,
69
69
  withBaseException
70
- } from "./chunk-HR3W7R4B.js";
70
+ } from "./chunk-2N3MHFXC.js";
71
71
  import {
72
72
  loadConfig,
73
73
  parseUrl
@@ -659,4 +659,4 @@ export {
659
659
  GetRoleCredentialsCommand,
660
660
  SSOClient
661
661
  };
662
- //# sourceMappingURL=loadSso-66ZTLICD.js.map
662
+ //# sourceMappingURL=loadSso-G7F52TGQ.js.map
@@ -13,7 +13,7 @@ import {
13
13
  parseJsonErrorBody,
14
14
  requestBuilder,
15
15
  take
16
- } from "./chunk-UR6FJOYI.js";
16
+ } from "./chunk-WZHLTH2I.js";
17
17
  import {
18
18
  AwsSdkSigV4Signer,
19
19
  Client,
@@ -68,7 +68,7 @@ import {
68
68
  resolveRetryConfig,
69
69
  resolveUserAgentConfig,
70
70
  withBaseException
71
- } from "./chunk-HR3W7R4B.js";
71
+ } from "./chunk-2N3MHFXC.js";
72
72
  import {
73
73
  loadConfig,
74
74
  parseUrl
@@ -829,4 +829,4 @@ export {
829
829
  UnsupportedGrantTypeException,
830
830
  Client as __Client
831
831
  };
832
- //# sourceMappingURL=sso-oidc-Z2X56STB.js.map
832
+ //# sourceMappingURL=sso-oidc-45CVA5J4.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parseXmlBody,
3
3
  parseXmlErrorBody
4
- } from "./chunk-4G647IUM.js";
4
+ } from "./chunk-MOHFNRAW.js";
5
5
  import {
6
6
  parseRfc3339DateTimeWithOffset
7
7
  } from "./chunk-YLT3BSXS.js";
@@ -67,7 +67,7 @@ import {
67
67
  resolveRetryConfig,
68
68
  resolveUserAgentConfig,
69
69
  withBaseException
70
- } from "./chunk-HR3W7R4B.js";
70
+ } from "./chunk-2N3MHFXC.js";
71
71
  import {
72
72
  loadConfig,
73
73
  parseUrl
@@ -1166,4 +1166,4 @@ export {
1166
1166
  getDefaultRoleAssumer2 as getDefaultRoleAssumer,
1167
1167
  getDefaultRoleAssumerWithWebIdentity2 as getDefaultRoleAssumerWithWebIdentity
1168
1168
  };
1169
- //# sourceMappingURL=sts-XINKL27T.js.map
1169
+ //# sourceMappingURL=sts-FE6UEDK6.js.map
package/dist/index.d.cts CHANGED
@@ -1283,6 +1283,7 @@ interface InvoiceCapture<IDType = ObjectId | string> {
1283
1283
  results?: any;
1284
1284
  metadata?: InvoiceCaptureMetadata;
1285
1285
  uploadFileName?: string | null;
1286
+ tags: string[];
1286
1287
  companyId: string;
1287
1288
  userSub: string;
1288
1289
  }
@@ -1407,8 +1408,8 @@ interface Notification<ID = string, DateType = Date | string> {
1407
1408
  declare const NotificationTemplateCategories: readonly ["automation", "report", "team", "dataQuality", "discussion", "scraper"];
1408
1409
  type NotificationTemplateCategory = typeof NotificationTemplateCategories[number];
1409
1410
  declare const EventNamesByCategory: {
1410
- readonly automation: readonly ["runError", "runCompleted", "hasnotRun", "fileNotExpected"];
1411
- readonly report: readonly ["runCompleted", "runError"];
1411
+ readonly automation: readonly ["automationFailed", "runCompleted", "hasnotRun", "fileNotExpected"];
1412
+ readonly report: readonly ["reportSuccess", "reportFailed"];
1412
1413
  readonly team: readonly ["newUserSignIn"];
1413
1414
  readonly dataQuality: readonly ["thresholdBreached", "approachingThreshold", "readingOverdue", "readingDueSoon", "contractRenewalUpcoming", "contractRenewalOverdue"];
1414
1415
  readonly discussion: readonly ["commentAdded", "mentionInComment"];
@@ -1458,16 +1459,48 @@ interface NotificationTemplate<ID = string, DateType = Date | string> {
1458
1459
  }
1459
1460
 
1460
1461
  type NotificationContextMap = {
1461
- generalReportGenerated: {
1462
+ reportSuccess: {
1463
+ report: {
1464
+ fileName: string;
1465
+ _id: string;
1466
+ };
1467
+ };
1468
+ reportFailed: {
1462
1469
  report: {
1463
1470
  fileName: string;
1464
- type: string;
1465
1471
  _id: string;
1466
1472
  };
1467
1473
  };
1468
1474
  automationFailed: {
1469
1475
  context: {
1470
1476
  message: string;
1477
+ metadata: {
1478
+ items: {
1479
+ message: string;
1480
+ route: {
1481
+ name: string;
1482
+ query: {
1483
+ id: string;
1484
+ };
1485
+ };
1486
+ }[];
1487
+ };
1488
+ };
1489
+ };
1490
+ readingOverdue: {
1491
+ context: {
1492
+ message: string;
1493
+ metadata: {
1494
+ items: {
1495
+ message: string;
1496
+ route: {
1497
+ name: string;
1498
+ params: {
1499
+ id: string;
1500
+ };
1501
+ };
1502
+ }[];
1503
+ };
1471
1504
  };
1472
1505
  };
1473
1506
  };
@@ -1956,7 +1989,6 @@ declare const _default$3: {
1956
1989
 
1957
1990
  interface LoggerOptions {
1958
1991
  betterstack: boolean;
1959
- betterStackToken: string;
1960
1992
  betterStackHost: string;
1961
1993
  }
1962
1994
  interface ExtendedLogger extends winston.Logger {
package/dist/index.d.ts CHANGED
@@ -1283,6 +1283,7 @@ interface InvoiceCapture<IDType = ObjectId | string> {
1283
1283
  results?: any;
1284
1284
  metadata?: InvoiceCaptureMetadata;
1285
1285
  uploadFileName?: string | null;
1286
+ tags: string[];
1286
1287
  companyId: string;
1287
1288
  userSub: string;
1288
1289
  }
@@ -1407,8 +1408,8 @@ interface Notification<ID = string, DateType = Date | string> {
1407
1408
  declare const NotificationTemplateCategories: readonly ["automation", "report", "team", "dataQuality", "discussion", "scraper"];
1408
1409
  type NotificationTemplateCategory = typeof NotificationTemplateCategories[number];
1409
1410
  declare const EventNamesByCategory: {
1410
- readonly automation: readonly ["runError", "runCompleted", "hasnotRun", "fileNotExpected"];
1411
- readonly report: readonly ["runCompleted", "runError"];
1411
+ readonly automation: readonly ["automationFailed", "runCompleted", "hasnotRun", "fileNotExpected"];
1412
+ readonly report: readonly ["reportSuccess", "reportFailed"];
1412
1413
  readonly team: readonly ["newUserSignIn"];
1413
1414
  readonly dataQuality: readonly ["thresholdBreached", "approachingThreshold", "readingOverdue", "readingDueSoon", "contractRenewalUpcoming", "contractRenewalOverdue"];
1414
1415
  readonly discussion: readonly ["commentAdded", "mentionInComment"];
@@ -1458,16 +1459,48 @@ interface NotificationTemplate<ID = string, DateType = Date | string> {
1458
1459
  }
1459
1460
 
1460
1461
  type NotificationContextMap = {
1461
- generalReportGenerated: {
1462
+ reportSuccess: {
1463
+ report: {
1464
+ fileName: string;
1465
+ _id: string;
1466
+ };
1467
+ };
1468
+ reportFailed: {
1462
1469
  report: {
1463
1470
  fileName: string;
1464
- type: string;
1465
1471
  _id: string;
1466
1472
  };
1467
1473
  };
1468
1474
  automationFailed: {
1469
1475
  context: {
1470
1476
  message: string;
1477
+ metadata: {
1478
+ items: {
1479
+ message: string;
1480
+ route: {
1481
+ name: string;
1482
+ query: {
1483
+ id: string;
1484
+ };
1485
+ };
1486
+ }[];
1487
+ };
1488
+ };
1489
+ };
1490
+ readingOverdue: {
1491
+ context: {
1492
+ message: string;
1493
+ metadata: {
1494
+ items: {
1495
+ message: string;
1496
+ route: {
1497
+ name: string;
1498
+ params: {
1499
+ id: string;
1500
+ };
1501
+ };
1502
+ }[];
1503
+ };
1471
1504
  };
1472
1505
  };
1473
1506
  };
@@ -1956,7 +1989,6 @@ declare const _default$3: {
1956
1989
 
1957
1990
  interface LoggerOptions {
1958
1991
  betterstack: boolean;
1959
- betterStackToken: string;
1960
1992
  betterStackHost: string;
1961
1993
  }
1962
1994
  interface ExtendedLogger extends winston.Logger {
package/dist/index.js CHANGED
@@ -60505,6 +60505,12 @@ var init_client2 = __esm({
60505
60505
  handlers;
60506
60506
  constructor(config) {
60507
60507
  this.config = config;
60508
+ const { protocol, protocolSettings } = config;
60509
+ if (protocolSettings) {
60510
+ if (typeof protocol === "function") {
60511
+ config.protocol = new protocol(protocolSettings);
60512
+ }
60513
+ }
60508
60514
  }
60509
60515
  send(command, optionsOrCb, cb2) {
60510
60516
  const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0;
@@ -62398,7 +62404,12 @@ var init_NormalizedSchema = __esm({
62398
62404
  }
62399
62405
  isStructSchema() {
62400
62406
  const sc = this.getSchema();
62401
- return sc[0] === 3 || sc[0] === -3;
62407
+ const id = sc[0];
62408
+ return id === 3 || id === -3 || id === 4;
62409
+ }
62410
+ isUnionSchema() {
62411
+ const sc = this.getSchema();
62412
+ return sc[0] === 4;
62402
62413
  }
62403
62414
  isBlobSchema() {
62404
62415
  const sc = this.getSchema();
@@ -69338,9 +69349,16 @@ var createConfigValueProvider;
69338
69349
  var init_createConfigValueProvider = __esm({
69339
69350
  "node_modules/@smithy/middleware-endpoint/dist-es/adaptors/createConfigValueProvider.js"() {
69340
69351
  "use strict";
69341
- createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) => {
69352
+ createConfigValueProvider = (configKey, canonicalEndpointParamKey, config, isClientContextParam = false) => {
69342
69353
  const configProvider = async () => {
69343
- const configValue = config[configKey] ?? config[canonicalEndpointParamKey];
69354
+ let configValue;
69355
+ if (isClientContextParam) {
69356
+ const clientContextParams = config.clientContextParams;
69357
+ const nestedValue = clientContextParams?.[configKey];
69358
+ configValue = nestedValue ?? config[configKey] ?? config[canonicalEndpointParamKey];
69359
+ } else {
69360
+ configValue = config[configKey] ?? config[canonicalEndpointParamKey];
69361
+ }
69344
69362
  if (typeof configValue === "function") {
69345
69363
  return configValue();
69346
69364
  }
@@ -69930,7 +69948,7 @@ var init_getEndpointFromInstructions = __esm({
69930
69948
  break;
69931
69949
  case "clientContextParams":
69932
69950
  case "builtInParams":
69933
- endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)();
69951
+ endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig, instruction.type !== "builtInParams")();
69934
69952
  break;
69935
69953
  case "operationContextParams":
69936
69954
  endpointParams[name] = instruction.get(commandInput);
@@ -76010,6 +76028,7 @@ var import_https = __toESM(require("https"), 1);
76010
76028
  var import_winston = __toESM(require("winston"), 1);
76011
76029
  var import_node = require("@logtail/node");
76012
76030
  var import_winston2 = require("@logtail/winston");
76031
+ var import_client_ssm = require("@aws-sdk/client-ssm");
76013
76032
  var localFormat = import_winston.default.format.combine(
76014
76033
  import_winston.default.format.timestamp({ format: "HH:mm:ss" }),
76015
76034
  import_winston.default.format.colorize(),
@@ -76020,22 +76039,52 @@ var localFormat = import_winston.default.format.combine(
76020
76039
  return `${timestamp} ${level} ${namespace} ${message}${metaStr}`;
76021
76040
  })
76022
76041
  );
76042
+ var cachedToken = null;
76043
+ var tokenFetchPromise = null;
76044
+ function getBetterStackToken() {
76045
+ if (cachedToken) {
76046
+ return Promise.resolve(cachedToken);
76047
+ }
76048
+ if (tokenFetchPromise) {
76049
+ return tokenFetchPromise;
76050
+ }
76051
+ tokenFetchPromise = (async () => {
76052
+ try {
76053
+ const ssm = new import_client_ssm.SSMClient({});
76054
+ const command = new import_client_ssm.GetParameterCommand({
76055
+ Name: "/services/betterstack_token",
76056
+ WithDecryption: true
76057
+ });
76058
+ const response = await ssm.send(command);
76059
+ cachedToken = response.Parameter?.Value ?? null;
76060
+ return cachedToken;
76061
+ } catch (error) {
76062
+ console.warn("Failed to fetch BetterStack token from SSM:", error);
76063
+ return null;
76064
+ }
76065
+ })();
76066
+ return tokenFetchPromise;
76067
+ }
76023
76068
  var logger_default = (namespace, betterStackOptions) => {
76024
76069
  const transports = [new import_winston.default.transports.Console()];
76025
- let logtail;
76026
- if (betterStackOptions?.betterstack && betterStackOptions?.betterStackToken && betterStackOptions?.betterStackHost && (process.env.ENV === "prod" || process.env.ENV === "dev")) {
76027
- logtail = new import_node.Logtail(betterStackOptions.betterStackToken, {
76028
- endpoint: betterStackOptions.betterStackHost
76029
- });
76030
- transports.push(new import_winston2.LogtailTransport(logtail));
76031
- }
76032
76070
  const logger2 = import_winston.default.createLogger({
76033
76071
  level: "debug",
76034
76072
  format: process.env.ENV === "local" ? localFormat : import_winston.default.format.combine(import_winston.default.format.timestamp(), import_winston.default.format.json()),
76035
76073
  defaultMeta: { service: process.env.AWS_LAMBDA_FUNCTION_NAME, script: namespace },
76036
76074
  transports
76037
76075
  });
76038
- logger2.logtail = logtail;
76076
+ logger2.logtail = void 0;
76077
+ if (betterStackOptions?.betterstack && betterStackOptions?.betterStackHost && (process.env.ENV === "prod" || process.env.ENV === "dev")) {
76078
+ getBetterStackToken().then((token) => {
76079
+ if (token) {
76080
+ const logtail = new import_node.Logtail(token, {
76081
+ endpoint: betterStackOptions.betterStackHost
76082
+ });
76083
+ logger2.logtail = logtail;
76084
+ logger2.add(new import_winston2.LogtailTransport(logtail));
76085
+ }
76086
+ });
76087
+ }
76039
76088
  return logger2;
76040
76089
  };
76041
76090
 
@@ -85871,8 +85920,8 @@ var NotificationTemplateCategories = [
85871
85920
  "scraper"
85872
85921
  ];
85873
85922
  var EventNamesByCategory = {
85874
- automation: ["runError", "runCompleted", "hasnotRun", "fileNotExpected"],
85875
- report: ["runCompleted", "runError"],
85923
+ automation: ["automationFailed", "runCompleted", "hasnotRun", "fileNotExpected"],
85924
+ report: ["reportSuccess", "reportFailed"],
85876
85925
  team: ["newUserSignIn"],
85877
85926
  dataQuality: ["thresholdBreached", "approachingThreshold", "readingOverdue", "readingDueSoon", "contractRenewalUpcoming", "contractRenewalOverdue"],
85878
85927
  discussion: ["commentAdded", "mentionInComment"],