@cloudnux/aws-cloud-provider 0.8.0 → 0.10.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.
@@ -8,8 +8,8 @@ var root = freeGlobal_default || freeSelf || Function("return this")();
8
8
  var root_default = root;
9
9
 
10
10
  // ../../../node_modules/lodash-es/_Symbol.js
11
- var Symbol2 = root_default.Symbol;
12
- var Symbol_default = Symbol2;
11
+ var Symbol = root_default.Symbol;
12
+ var Symbol_default = Symbol;
13
13
 
14
14
  // ../../../node_modules/lodash-es/_getRawTag.js
15
15
  var objectProto = Object.prototype;
@@ -444,8 +444,8 @@ ListCache.prototype.set = listCacheSet_default;
444
444
  var ListCache_default = ListCache;
445
445
 
446
446
  // ../../../node_modules/lodash-es/_Map.js
447
- var Map2 = getNative_default(root_default, "Map");
448
- var Map_default = Map2;
447
+ var Map = getNative_default(root_default, "Map");
448
+ var Map_default = Map;
449
449
 
450
450
  // ../../../node_modules/lodash-es/_mapCacheClear.js
451
451
  function mapCacheClear() {
@@ -820,590 +820,16 @@ var utils = {
820
820
  };
821
821
  var env = Object.assign(_env, utils);
822
822
 
823
- // ../../../node_modules/chalk/source/vendor/ansi-styles/index.js
824
- var ANSI_BACKGROUND_OFFSET = 10;
825
- var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
826
- var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
827
- var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
828
- var styles = {
829
- modifier: {
830
- reset: [0, 0],
831
- // 21 isn't widely supported and 22 does the same thing
832
- bold: [1, 22],
833
- dim: [2, 22],
834
- italic: [3, 23],
835
- underline: [4, 24],
836
- overline: [53, 55],
837
- inverse: [7, 27],
838
- hidden: [8, 28],
839
- strikethrough: [9, 29]
840
- },
841
- color: {
842
- black: [30, 39],
843
- red: [31, 39],
844
- green: [32, 39],
845
- yellow: [33, 39],
846
- blue: [34, 39],
847
- magenta: [35, 39],
848
- cyan: [36, 39],
849
- white: [37, 39],
850
- // Bright color
851
- blackBright: [90, 39],
852
- gray: [90, 39],
853
- // Alias of `blackBright`
854
- grey: [90, 39],
855
- // Alias of `blackBright`
856
- redBright: [91, 39],
857
- greenBright: [92, 39],
858
- yellowBright: [93, 39],
859
- blueBright: [94, 39],
860
- magentaBright: [95, 39],
861
- cyanBright: [96, 39],
862
- whiteBright: [97, 39]
863
- },
864
- bgColor: {
865
- bgBlack: [40, 49],
866
- bgRed: [41, 49],
867
- bgGreen: [42, 49],
868
- bgYellow: [43, 49],
869
- bgBlue: [44, 49],
870
- bgMagenta: [45, 49],
871
- bgCyan: [46, 49],
872
- bgWhite: [47, 49],
873
- // Bright color
874
- bgBlackBright: [100, 49],
875
- bgGray: [100, 49],
876
- // Alias of `bgBlackBright`
877
- bgGrey: [100, 49],
878
- // Alias of `bgBlackBright`
879
- bgRedBright: [101, 49],
880
- bgGreenBright: [102, 49],
881
- bgYellowBright: [103, 49],
882
- bgBlueBright: [104, 49],
883
- bgMagentaBright: [105, 49],
884
- bgCyanBright: [106, 49],
885
- bgWhiteBright: [107, 49]
886
- }
887
- };
888
- var modifierNames = Object.keys(styles.modifier);
889
- var foregroundColorNames = Object.keys(styles.color);
890
- var backgroundColorNames = Object.keys(styles.bgColor);
891
- var colorNames = [...foregroundColorNames, ...backgroundColorNames];
892
- function assembleStyles() {
893
- const codes = /* @__PURE__ */ new Map();
894
- for (const [groupName, group] of Object.entries(styles)) {
895
- for (const [styleName, style] of Object.entries(group)) {
896
- styles[styleName] = {
897
- open: `\x1B[${style[0]}m`,
898
- close: `\x1B[${style[1]}m`
899
- };
900
- group[styleName] = styles[styleName];
901
- codes.set(style[0], style[1]);
902
- }
903
- Object.defineProperty(styles, groupName, {
904
- value: group,
905
- enumerable: false
906
- });
907
- }
908
- Object.defineProperty(styles, "codes", {
909
- value: codes,
910
- enumerable: false
911
- });
912
- styles.color.close = "\x1B[39m";
913
- styles.bgColor.close = "\x1B[49m";
914
- styles.color.ansi = wrapAnsi16();
915
- styles.color.ansi256 = wrapAnsi256();
916
- styles.color.ansi16m = wrapAnsi16m();
917
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
918
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
919
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
920
- Object.defineProperties(styles, {
921
- rgbToAnsi256: {
922
- value(red, green, blue) {
923
- if (red === green && green === blue) {
924
- if (red < 8) {
925
- return 16;
926
- }
927
- if (red > 248) {
928
- return 231;
929
- }
930
- return Math.round((red - 8) / 247 * 24) + 232;
931
- }
932
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
933
- },
934
- enumerable: false
935
- },
936
- hexToRgb: {
937
- value(hex) {
938
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
939
- if (!matches) {
940
- return [0, 0, 0];
941
- }
942
- let [colorString] = matches;
943
- if (colorString.length === 3) {
944
- colorString = [...colorString].map((character) => character + character).join("");
945
- }
946
- const integer = Number.parseInt(colorString, 16);
947
- return [
948
- /* eslint-disable no-bitwise */
949
- integer >> 16 & 255,
950
- integer >> 8 & 255,
951
- integer & 255
952
- /* eslint-enable no-bitwise */
953
- ];
954
- },
955
- enumerable: false
956
- },
957
- hexToAnsi256: {
958
- value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
959
- enumerable: false
960
- },
961
- ansi256ToAnsi: {
962
- value(code) {
963
- if (code < 8) {
964
- return 30 + code;
965
- }
966
- if (code < 16) {
967
- return 90 + (code - 8);
968
- }
969
- let red;
970
- let green;
971
- let blue;
972
- if (code >= 232) {
973
- red = ((code - 232) * 10 + 8) / 255;
974
- green = red;
975
- blue = red;
976
- } else {
977
- code -= 16;
978
- const remainder = code % 36;
979
- red = Math.floor(code / 36) / 5;
980
- green = Math.floor(remainder / 6) / 5;
981
- blue = remainder % 6 / 5;
982
- }
983
- const value = Math.max(red, green, blue) * 2;
984
- if (value === 0) {
985
- return 30;
986
- }
987
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
988
- if (value === 2) {
989
- result += 60;
990
- }
991
- return result;
992
- },
993
- enumerable: false
994
- },
995
- rgbToAnsi: {
996
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
997
- enumerable: false
998
- },
999
- hexToAnsi: {
1000
- value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
1001
- enumerable: false
1002
- }
1003
- });
1004
- return styles;
1005
- }
1006
- var ansiStyles = assembleStyles();
1007
- var ansi_styles_default = ansiStyles;
1008
-
1009
- // ../../../node_modules/chalk/source/vendor/supports-color/index.js
1010
- import process2 from "process";
1011
- import os from "os";
1012
- import tty from "tty";
1013
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
1014
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
1015
- const position = argv.indexOf(prefix + flag);
1016
- const terminatorPosition = argv.indexOf("--");
1017
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
1018
- }
1019
- var { env: env2 } = process2;
1020
- var flagForceColor;
1021
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
1022
- flagForceColor = 0;
1023
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
1024
- flagForceColor = 1;
1025
- }
1026
- function envForceColor() {
1027
- if ("FORCE_COLOR" in env2) {
1028
- if (env2.FORCE_COLOR === "true") {
1029
- return 1;
1030
- }
1031
- if (env2.FORCE_COLOR === "false") {
1032
- return 0;
1033
- }
1034
- return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
1035
- }
1036
- }
1037
- function translateLevel(level) {
1038
- if (level === 0) {
1039
- return false;
1040
- }
1041
- return {
1042
- level,
1043
- hasBasic: true,
1044
- has256: level >= 2,
1045
- has16m: level >= 3
1046
- };
1047
- }
1048
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1049
- const noFlagForceColor = envForceColor();
1050
- if (noFlagForceColor !== void 0) {
1051
- flagForceColor = noFlagForceColor;
1052
- }
1053
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
1054
- if (forceColor === 0) {
1055
- return 0;
1056
- }
1057
- if (sniffFlags) {
1058
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
1059
- return 3;
1060
- }
1061
- if (hasFlag("color=256")) {
1062
- return 2;
1063
- }
1064
- }
1065
- if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
1066
- return 1;
1067
- }
1068
- if (haveStream && !streamIsTTY && forceColor === void 0) {
1069
- return 0;
1070
- }
1071
- const min = forceColor || 0;
1072
- if (env2.TERM === "dumb") {
1073
- return min;
1074
- }
1075
- if (process2.platform === "win32") {
1076
- const osRelease = os.release().split(".");
1077
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1078
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
1079
- }
1080
- return 1;
1081
- }
1082
- if ("CI" in env2) {
1083
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env2)) {
1084
- return 3;
1085
- }
1086
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
1087
- return 1;
1088
- }
1089
- return min;
1090
- }
1091
- if ("TEAMCITY_VERSION" in env2) {
1092
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
1093
- }
1094
- if (env2.COLORTERM === "truecolor") {
1095
- return 3;
1096
- }
1097
- if (env2.TERM === "xterm-kitty") {
1098
- return 3;
1099
- }
1100
- if ("TERM_PROGRAM" in env2) {
1101
- const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1102
- switch (env2.TERM_PROGRAM) {
1103
- case "iTerm.app": {
1104
- return version >= 3 ? 3 : 2;
1105
- }
1106
- case "Apple_Terminal": {
1107
- return 2;
1108
- }
1109
- }
1110
- }
1111
- if (/-256(color)?$/i.test(env2.TERM)) {
1112
- return 2;
1113
- }
1114
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
1115
- return 1;
1116
- }
1117
- if ("COLORTERM" in env2) {
1118
- return 1;
1119
- }
1120
- return min;
1121
- }
1122
- function createSupportsColor(stream, options = {}) {
1123
- const level = _supportsColor(stream, {
1124
- streamIsTTY: stream && stream.isTTY,
1125
- ...options
1126
- });
1127
- return translateLevel(level);
1128
- }
1129
- var supportsColor = {
1130
- stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
1131
- stderr: createSupportsColor({ isTTY: tty.isatty(2) })
1132
- };
1133
- var supports_color_default = supportsColor;
1134
-
1135
- // ../../../node_modules/chalk/source/utilities.js
1136
- function stringReplaceAll(string, substring, replacer) {
1137
- let index = string.indexOf(substring);
1138
- if (index === -1) {
1139
- return string;
1140
- }
1141
- const substringLength = substring.length;
1142
- let endIndex = 0;
1143
- let returnValue = "";
1144
- do {
1145
- returnValue += string.slice(endIndex, index) + substring + replacer;
1146
- endIndex = index + substringLength;
1147
- index = string.indexOf(substring, endIndex);
1148
- } while (index !== -1);
1149
- returnValue += string.slice(endIndex);
1150
- return returnValue;
1151
- }
1152
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
1153
- let endIndex = 0;
1154
- let returnValue = "";
1155
- do {
1156
- const gotCR = string[index - 1] === "\r";
1157
- returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
1158
- endIndex = index + 1;
1159
- index = string.indexOf("\n", endIndex);
1160
- } while (index !== -1);
1161
- returnValue += string.slice(endIndex);
1162
- return returnValue;
1163
- }
1164
-
1165
- // ../../../node_modules/chalk/source/index.js
1166
- var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
1167
- var GENERATOR = Symbol("GENERATOR");
1168
- var STYLER = Symbol("STYLER");
1169
- var IS_EMPTY = Symbol("IS_EMPTY");
1170
- var levelMapping = [
1171
- "ansi",
1172
- "ansi",
1173
- "ansi256",
1174
- "ansi16m"
1175
- ];
1176
- var styles2 = /* @__PURE__ */ Object.create(null);
1177
- var applyOptions = (object, options = {}) => {
1178
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
1179
- throw new Error("The `level` option should be an integer from 0 to 3");
1180
- }
1181
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
1182
- object.level = options.level === void 0 ? colorLevel : options.level;
1183
- };
1184
- var chalkFactory = (options) => {
1185
- const chalk2 = (...strings) => strings.join(" ");
1186
- applyOptions(chalk2, options);
1187
- Object.setPrototypeOf(chalk2, createChalk.prototype);
1188
- return chalk2;
1189
- };
1190
- function createChalk(options) {
1191
- return chalkFactory(options);
1192
- }
1193
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
1194
- for (const [styleName, style] of Object.entries(ansi_styles_default)) {
1195
- styles2[styleName] = {
1196
- get() {
1197
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
1198
- Object.defineProperty(this, styleName, { value: builder });
1199
- return builder;
1200
- }
1201
- };
1202
- }
1203
- styles2.visible = {
1204
- get() {
1205
- const builder = createBuilder(this, this[STYLER], true);
1206
- Object.defineProperty(this, "visible", { value: builder });
1207
- return builder;
1208
- }
1209
- };
1210
- var getModelAnsi = (model, level, type, ...arguments_) => {
1211
- if (model === "rgb") {
1212
- if (level === "ansi16m") {
1213
- return ansi_styles_default[type].ansi16m(...arguments_);
1214
- }
1215
- if (level === "ansi256") {
1216
- return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
1217
- }
1218
- return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
1219
- }
1220
- if (model === "hex") {
1221
- return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
1222
- }
1223
- return ansi_styles_default[type][model](...arguments_);
1224
- };
1225
- var usedModels = ["rgb", "hex", "ansi256"];
1226
- for (const model of usedModels) {
1227
- styles2[model] = {
1228
- get() {
1229
- const { level } = this;
1230
- return function(...arguments_) {
1231
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
1232
- return createBuilder(this, styler, this[IS_EMPTY]);
1233
- };
1234
- }
1235
- };
1236
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
1237
- styles2[bgModel] = {
1238
- get() {
1239
- const { level } = this;
1240
- return function(...arguments_) {
1241
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
1242
- return createBuilder(this, styler, this[IS_EMPTY]);
1243
- };
1244
- }
1245
- };
1246
- }
1247
- var proto = Object.defineProperties(() => {
1248
- }, {
1249
- ...styles2,
1250
- level: {
1251
- enumerable: true,
1252
- get() {
1253
- return this[GENERATOR].level;
1254
- },
1255
- set(level) {
1256
- this[GENERATOR].level = level;
1257
- }
1258
- }
1259
- });
1260
- var createStyler = (open, close, parent) => {
1261
- let openAll;
1262
- let closeAll;
1263
- if (parent === void 0) {
1264
- openAll = open;
1265
- closeAll = close;
1266
- } else {
1267
- openAll = parent.openAll + open;
1268
- closeAll = close + parent.closeAll;
1269
- }
1270
- return {
1271
- open,
1272
- close,
1273
- openAll,
1274
- closeAll,
1275
- parent
1276
- };
1277
- };
1278
- var createBuilder = (self2, _styler, _isEmpty) => {
1279
- const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
1280
- Object.setPrototypeOf(builder, proto);
1281
- builder[GENERATOR] = self2;
1282
- builder[STYLER] = _styler;
1283
- builder[IS_EMPTY] = _isEmpty;
1284
- return builder;
1285
- };
1286
- var applyStyle = (self2, string) => {
1287
- if (self2.level <= 0 || !string) {
1288
- return self2[IS_EMPTY] ? "" : string;
1289
- }
1290
- let styler = self2[STYLER];
1291
- if (styler === void 0) {
1292
- return string;
1293
- }
1294
- const { openAll, closeAll } = styler;
1295
- if (string.includes("\x1B")) {
1296
- while (styler !== void 0) {
1297
- string = stringReplaceAll(string, styler.close, styler.open);
1298
- styler = styler.parent;
1299
- }
1300
- }
1301
- const lfIndex = string.indexOf("\n");
1302
- if (lfIndex !== -1) {
1303
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
1304
- }
1305
- return openAll + string + closeAll;
1306
- };
1307
- Object.defineProperties(createChalk.prototype, styles2);
1308
- var chalk = createChalk();
1309
- var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1310
- var source_default = chalk;
1311
-
1312
823
  // ../../utils/src/logging/index.ts
1313
- import { EOL } from "os";
1314
-
1315
- // ../../utils/src/logging/types.ts
1316
- var logLevels = {
1317
- fatal: -1,
1318
- error: 0,
1319
- warn: 1,
1320
- info: 2,
1321
- debug: 3
1322
- };
1323
-
1324
- // ../../utils/src/logging/error-to-string.ts
1325
- var errorToString = (error) => {
1326
- if (error === null) return "Null error";
1327
- if (error === void 0) return "Undefined error";
1328
- if (error instanceof Error) {
1329
- return [
1330
- `Name: ${error.name}`,
1331
- `Message: ${error.message}`,
1332
- `Stack: ${error.stack || "No stack trace available"}`,
1333
- // Handle additional properties that might exist on custom errors
1334
- ...Object.entries(error).filter(([key]) => !["name", "message", "stack"].includes(key)).map(([key, value]) => `${key}: ${JSON.stringify(value)}`)
1335
- ].join("\n");
1336
- }
1337
- if (typeof error === "string") return error;
1338
- if (typeof error === "object") {
1339
- try {
1340
- return JSON.stringify(error, null, 2);
1341
- } catch {
1342
- return `[Object that cannot be stringified: ${Object.prototype.toString.call(error)}]`;
1343
- }
1344
- }
1345
- return String(error);
1346
- };
1347
-
1348
- // ../../utils/src/logging/index.ts
1349
- var currentLogLevel = logLevels[env("LOG_LEVEL")?.toLowerCase()] ?? logLevels.info;
1350
- var logger = {
1351
- fatal: (message, meta) => {
1352
- if (currentLogLevel >= logLevels.fatal) {
1353
- console.error(
1354
- `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1355
- `${source_default.bgRed.white(" fatal ")}${EOL}`,
1356
- errorToString(message),
1357
- meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1358
- );
1359
- }
1360
- },
1361
- error: (message, meta) => {
1362
- if (currentLogLevel >= logLevels.error) {
1363
- console.error(
1364
- `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1365
- `${source_default.bgRed.white(" error ")}${EOL}`,
1366
- errorToString(message),
1367
- meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1368
- );
1369
- }
1370
- },
1371
- warn: (message, meta) => {
1372
- if (currentLogLevel >= logLevels.warn) {
1373
- console.warn(
1374
- `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1375
- `${source_default.bgYellow.black(" warn ")}${EOL}`,
1376
- errorToString(message),
1377
- meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1378
- );
1379
- }
1380
- },
1381
- info: (message, meta) => {
1382
- if (currentLogLevel >= logLevels.info) {
1383
- console.info(
1384
- `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1385
- `${source_default.bgBlue.white(" info ")}${EOL}`,
1386
- message,
1387
- meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1388
- );
1389
- }
1390
- },
1391
- debug: (message, meta) => {
1392
- if (currentLogLevel >= logLevels.debug) {
1393
- console.debug(
1394
- `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1395
- `${source_default.bgWhite.black(" debug ")}${EOL}`,
1396
- message,
1397
- meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1398
- );
1399
- }
1400
- }
1401
- };
824
+ var logger;
1402
825
 
1403
826
  // src/router/index.ts
1404
827
  function createRouter() {
1405
828
  const routes = [];
1406
829
  function detectEventType(event) {
830
+ if ("requestContext" in event && "connectionId" in event.requestContext) {
831
+ return "websocket";
832
+ }
1407
833
  if ("requestContext" in event && "http" in event.requestContext) {
1408
834
  return "http";
1409
835
  }
@@ -1533,6 +959,25 @@ function createRouter() {
1533
959
  }
1534
960
  throw new Error("No event handler found");
1535
961
  }
962
+ async function handleWebSocketEvent(event, context, routes2) {
963
+ const routeKey = event.requestContext?.routeKey;
964
+ for (const route of routes2) {
965
+ if (route.type === "websocket" && route.wsRouteKey === routeKey) {
966
+ try {
967
+ return await route.handler(event, context);
968
+ } catch (error) {
969
+ return {
970
+ statusCode: 500,
971
+ body: JSON.stringify({
972
+ error: "Internal Server Error",
973
+ message: error instanceof Error ? error.message : "Unknown error"
974
+ })
975
+ };
976
+ }
977
+ }
978
+ }
979
+ throw new Error(`No WebSocket handler found for route key: ${routeKey}`);
980
+ }
1536
981
  return {
1537
982
  // Register HTTP route
1538
983
  http(method, route, handler) {
@@ -1562,6 +1007,14 @@ function createRouter() {
1562
1007
  handler
1563
1008
  });
1564
1009
  },
1010
+ // Register WebSocket route
1011
+ websocket(wsRouteKey, handler) {
1012
+ routes.push({
1013
+ type: "websocket",
1014
+ wsRouteKey,
1015
+ handler
1016
+ });
1017
+ },
1565
1018
  async run(event, context) {
1566
1019
  const eventType = detectEventType(event);
1567
1020
  switch (eventType) {
@@ -1571,6 +1024,8 @@ function createRouter() {
1571
1024
  return await handleScheduleEvent(event, context, routes);
1572
1025
  case "event":
1573
1026
  return await handleEventBrokerEvent(event, context, routes);
1027
+ case "websocket":
1028
+ return await handleWebSocketEvent(event, context, routes);
1574
1029
  default:
1575
1030
  throw new Error(`Unsupported event type: ${eventType}`);
1576
1031
  }