@cloudnux/aws-cloud-provider 0.8.0 → 0.11.0

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.
@@ -820,7 +820,7 @@ var utils = {
820
820
  };
821
821
  var env = Object.assign(_env, utils);
822
822
 
823
- // ../../../node_modules/chalk/source/vendor/ansi-styles/index.js
823
+ // ../../utils/node_modules/chalk/source/vendor/ansi-styles/index.js
824
824
  var ANSI_BACKGROUND_OFFSET = 10;
825
825
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
826
826
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -1006,7 +1006,7 @@ function assembleStyles() {
1006
1006
  var ansiStyles = assembleStyles();
1007
1007
  var ansi_styles_default = ansiStyles;
1008
1008
 
1009
- // ../../../node_modules/chalk/source/vendor/supports-color/index.js
1009
+ // ../../utils/node_modules/chalk/source/vendor/supports-color/index.js
1010
1010
  import process2 from "process";
1011
1011
  import os from "os";
1012
1012
  import tty from "tty";
@@ -1097,6 +1097,12 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1097
1097
  if (env2.TERM === "xterm-kitty") {
1098
1098
  return 3;
1099
1099
  }
1100
+ if (env2.TERM === "xterm-ghostty") {
1101
+ return 3;
1102
+ }
1103
+ if (env2.TERM === "wezterm") {
1104
+ return 3;
1105
+ }
1100
1106
  if ("TERM_PROGRAM" in env2) {
1101
1107
  const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1102
1108
  switch (env2.TERM_PROGRAM) {
@@ -1132,7 +1138,7 @@ var supportsColor = {
1132
1138
  };
1133
1139
  var supports_color_default = supportsColor;
1134
1140
 
1135
- // ../../../node_modules/chalk/source/utilities.js
1141
+ // ../../utils/node_modules/chalk/source/utilities.js
1136
1142
  function stringReplaceAll(string, substring, replacer) {
1137
1143
  let index = string.indexOf(substring);
1138
1144
  if (index === -1) {
@@ -1162,7 +1168,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
1162
1168
  return returnValue;
1163
1169
  }
1164
1170
 
1165
- // ../../../node_modules/chalk/source/index.js
1171
+ // ../../utils/node_modules/chalk/source/index.js
1166
1172
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
1167
1173
  var GENERATOR = Symbol("GENERATOR");
1168
1174
  var STYLER = Symbol("STYLER");
@@ -1347,12 +1353,14 @@ var errorToString = (error) => {
1347
1353
 
1348
1354
  // ../../utils/src/logging/index.ts
1349
1355
  var currentLogLevel = logLevels[env("LOG_LEVEL")?.toLowerCase()] ?? logLevels.info;
1356
+ var module = "default";
1357
+ var requestId = "";
1350
1358
  var logger = {
1351
1359
  fatal: (message, meta) => {
1352
1360
  if (currentLogLevel >= logLevels.fatal) {
1353
1361
  console.error(
1354
1362
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1355
- `${source_default.bgRed.white(" fatal ")}${EOL}`,
1363
+ `${source_default.bgRed.white(" fatal ")} - ${module || "unknown module"} - ${requestId || "no request ID"} - ${EOL}`,
1356
1364
  errorToString(message),
1357
1365
  meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1358
1366
  );
@@ -1362,7 +1370,7 @@ var logger = {
1362
1370
  if (currentLogLevel >= logLevels.error) {
1363
1371
  console.error(
1364
1372
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1365
- `${source_default.bgRed.white(" error ")}${EOL}`,
1373
+ `${source_default.bgRed.white(" error ")} - ${module || "unknown module"} - ${requestId || "no request ID"} - ${EOL}`,
1366
1374
  errorToString(message),
1367
1375
  meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1368
1376
  );
@@ -1372,7 +1380,7 @@ var logger = {
1372
1380
  if (currentLogLevel >= logLevels.warn) {
1373
1381
  console.warn(
1374
1382
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1375
- `${source_default.bgYellow.black(" warn ")}${EOL}`,
1383
+ `${source_default.bgYellow.black(" warn ")} - ${module || "unknown module"} - ${requestId || "no request ID"} - ${EOL}`,
1376
1384
  errorToString(message),
1377
1385
  meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1378
1386
  );
@@ -1382,7 +1390,7 @@ var logger = {
1382
1390
  if (currentLogLevel >= logLevels.info) {
1383
1391
  console.info(
1384
1392
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1385
- `${source_default.bgBlue.white(" info ")}${EOL}`,
1393
+ `${source_default.bgBlue.white(" info ")} - ${module || "unknown module"} - ${requestId || "no request ID"} - ${EOL}`,
1386
1394
  message,
1387
1395
  meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1388
1396
  );
@@ -1392,7 +1400,7 @@ var logger = {
1392
1400
  if (currentLogLevel >= logLevels.debug) {
1393
1401
  console.debug(
1394
1402
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1395
- `${source_default.bgWhite.black(" debug ")}${EOL}`,
1403
+ `${source_default.bgWhite.black(" debug ")} - ${module || "unknown module"} - ${requestId || "no request ID"} - ${EOL}`,
1396
1404
  message,
1397
1405
  meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1398
1406
  );
@@ -1404,6 +1412,9 @@ var logger = {
1404
1412
  function createRouter() {
1405
1413
  const routes = [];
1406
1414
  function detectEventType(event) {
1415
+ if ("requestContext" in event && "connectionId" in event.requestContext) {
1416
+ return "websocket";
1417
+ }
1407
1418
  if ("requestContext" in event && "http" in event.requestContext) {
1408
1419
  return "http";
1409
1420
  }
@@ -1533,6 +1544,25 @@ function createRouter() {
1533
1544
  }
1534
1545
  throw new Error("No event handler found");
1535
1546
  }
1547
+ async function handleWebSocketEvent(event, context, routes2) {
1548
+ const routeKey = event.requestContext?.routeKey;
1549
+ for (const route of routes2) {
1550
+ if (route.type === "websocket" && route.wsRouteKey === routeKey) {
1551
+ try {
1552
+ return await route.handler(event, context);
1553
+ } catch (error) {
1554
+ return {
1555
+ statusCode: 500,
1556
+ body: JSON.stringify({
1557
+ error: "Internal Server Error",
1558
+ message: error instanceof Error ? error.message : "Unknown error"
1559
+ })
1560
+ };
1561
+ }
1562
+ }
1563
+ }
1564
+ throw new Error(`No WebSocket handler found for route key: ${routeKey}`);
1565
+ }
1536
1566
  return {
1537
1567
  // Register HTTP route
1538
1568
  http(method, route, handler) {
@@ -1562,6 +1592,14 @@ function createRouter() {
1562
1592
  handler
1563
1593
  });
1564
1594
  },
1595
+ // Register WebSocket route
1596
+ websocket(wsRouteKey, handler) {
1597
+ routes.push({
1598
+ type: "websocket",
1599
+ wsRouteKey,
1600
+ handler
1601
+ });
1602
+ },
1565
1603
  async run(event, context) {
1566
1604
  const eventType = detectEventType(event);
1567
1605
  switch (eventType) {
@@ -1571,6 +1609,8 @@ function createRouter() {
1571
1609
  return await handleScheduleEvent(event, context, routes);
1572
1610
  case "event":
1573
1611
  return await handleEventBrokerEvent(event, context, routes);
1612
+ case "websocket":
1613
+ return await handleWebSocketEvent(event, context, routes);
1574
1614
  default:
1575
1615
  throw new Error(`Unsupported event type: ${eventType}`);
1576
1616
  }