@cloudnux/cloud-sdk 0.2.0 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -10,10 +10,10 @@ declare const cloudLocations: () => LocationService;
10
10
  type Handler$1 = (context: EventFunctionContext) => Promise<void>;
11
11
  declare function eventBrokerHandler(handler: Handler$1, ...args: any[]): Promise<any>;
12
12
 
13
- type HttpHandler = (context: HttpFunctionContext) => Promise<void>;
13
+ type HttpHandler = (context: HttpFunctionContext) => Promise<void> | void;
14
14
  declare function httpHandler(handler: HttpHandler, ...args: any[]): Promise<any>;
15
15
 
16
- type Handler = (context: ScheduleFunctionContext) => Promise<void>;
16
+ type Handler = (context: ScheduleFunctionContext) => Promise<void> | void;
17
17
  declare function scheduleHandler(handler: Handler, ...args: any[]): Promise<any>;
18
18
 
19
19
  /**
package/dist/index.js CHANGED
@@ -1,46 +1,3 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- cloudEventBroker: () => cloudEventBroker,
34
- cloudLocations: () => cloudLocations,
35
- cloudStorage: () => cloudStorage,
36
- eventBrokerHandler: () => eventBrokerHandler,
37
- getCloudProvider: () => getCloudProvider,
38
- httpHandler: () => httpHandler,
39
- scheduleHandler: () => scheduleHandler,
40
- useCloudProvider: () => useCloudProvider
41
- });
42
- module.exports = __toCommonJS(index_exports);
43
-
44
1
  // src/provider.ts
45
2
  var provider = null;
46
3
  function getCloudProvider() {
@@ -1095,16 +1052,16 @@ var ansiStyles = assembleStyles();
1095
1052
  var ansi_styles_default = ansiStyles;
1096
1053
 
1097
1054
  // ../../node_modules/chalk/source/vendor/supports-color/index.js
1098
- var import_node_process = __toESM(require("process"), 1);
1099
- var import_node_os = __toESM(require("os"), 1);
1100
- var import_node_tty = __toESM(require("tty"), 1);
1101
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
1055
+ import process2 from "node:process";
1056
+ import os from "node:os";
1057
+ import tty from "node:tty";
1058
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
1102
1059
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
1103
1060
  const position = argv.indexOf(prefix + flag);
1104
1061
  const terminatorPosition = argv.indexOf("--");
1105
1062
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
1106
1063
  }
1107
- var { env: env2 } = import_node_process.default;
1064
+ var { env: env2 } = process2;
1108
1065
  var flagForceColor;
1109
1066
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
1110
1067
  flagForceColor = 0;
@@ -1160,8 +1117,8 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1160
1117
  if (env2.TERM === "dumb") {
1161
1118
  return min;
1162
1119
  }
1163
- if (import_node_process.default.platform === "win32") {
1164
- const osRelease = import_node_os.default.release().split(".");
1120
+ if (process2.platform === "win32") {
1121
+ const osRelease = os.release().split(".");
1165
1122
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1166
1123
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
1167
1124
  }
@@ -1215,8 +1172,8 @@ function createSupportsColor(stream, options = {}) {
1215
1172
  return translateLevel(level);
1216
1173
  }
1217
1174
  var supportsColor = {
1218
- stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
1219
- stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
1175
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
1176
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
1220
1177
  };
1221
1178
  var supports_color_default = supportsColor;
1222
1179
 
@@ -1398,7 +1355,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1398
1355
  var source_default = chalk;
1399
1356
 
1400
1357
  // ../utils/src/logging/index.ts
1401
- var import_os = require("os");
1358
+ import { EOL } from "os";
1402
1359
 
1403
1360
  // ../utils/src/logging/types.ts
1404
1361
  var logLevels = {
@@ -1434,15 +1391,15 @@ var errorToString = (error) => {
1434
1391
  };
1435
1392
 
1436
1393
  // ../utils/src/logging/index.ts
1437
- var currentLogLevel = env.int("LOG_LEVEL", logLevels.info);
1394
+ var currentLogLevel = logLevels[env("LOG_LEVEL")?.toLowerCase()] ?? logLevels.info;
1438
1395
  var logger = {
1439
1396
  fatal: (message, meta) => {
1440
1397
  if (currentLogLevel >= logLevels.fatal) {
1441
1398
  console.error(
1442
1399
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1443
- `${source_default.bgRed.white(" fatal ")}${import_os.EOL}`,
1400
+ `${source_default.bgRed.white(" fatal ")}${EOL}`,
1444
1401
  errorToString(message),
1445
- meta ? `${import_os.EOL}${JSON.stringify(meta, null, 2)}` : ""
1402
+ meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1446
1403
  );
1447
1404
  }
1448
1405
  },
@@ -1450,9 +1407,9 @@ var logger = {
1450
1407
  if (currentLogLevel >= logLevels.error) {
1451
1408
  console.error(
1452
1409
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1453
- `${source_default.bgRed.white(" error ")}${import_os.EOL}`,
1410
+ `${source_default.bgRed.white(" error ")}${EOL}`,
1454
1411
  errorToString(message),
1455
- meta ? `${import_os.EOL}${JSON.stringify(meta, null, 2)}` : ""
1412
+ meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1456
1413
  );
1457
1414
  }
1458
1415
  },
@@ -1460,9 +1417,9 @@ var logger = {
1460
1417
  if (currentLogLevel >= logLevels.warn) {
1461
1418
  console.warn(
1462
1419
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1463
- `${source_default.bgYellow.black(" warn ")}${import_os.EOL}`,
1420
+ `${source_default.bgYellow.black(" warn ")}${EOL}`,
1464
1421
  errorToString(message),
1465
- meta ? `${import_os.EOL}${JSON.stringify(meta, null, 2)}` : ""
1422
+ meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1466
1423
  );
1467
1424
  }
1468
1425
  },
@@ -1470,9 +1427,9 @@ var logger = {
1470
1427
  if (currentLogLevel >= logLevels.info) {
1471
1428
  console.info(
1472
1429
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1473
- `${source_default.bgBlue.white(" info ")}${import_os.EOL}`,
1430
+ `${source_default.bgBlue.white(" info ")}${EOL}`,
1474
1431
  message,
1475
- meta ? `${import_os.EOL}${JSON.stringify(meta, null, 2)}` : ""
1432
+ meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1476
1433
  );
1477
1434
  }
1478
1435
  },
@@ -1480,9 +1437,9 @@ var logger = {
1480
1437
  if (currentLogLevel >= logLevels.debug) {
1481
1438
  console.debug(
1482
1439
  `[${(/* @__PURE__ */ new Date()).toTimeString()}]`,
1483
- `${source_default.bgWhite.black(" debug ")}${import_os.EOL}`,
1440
+ `${source_default.bgWhite.black(" debug ")}${EOL}`,
1484
1441
  message,
1485
- meta ? `${import_os.EOL}${JSON.stringify(meta, null, 2)}` : ""
1442
+ meta ? `${EOL}${JSON.stringify(meta, null, 2)}` : ""
1486
1443
  );
1487
1444
  }
1488
1445
  }
@@ -1556,7 +1513,7 @@ async function eventBrokerHandler(handler, ...args) {
1556
1513
  }
1557
1514
 
1558
1515
  // src/services/functions/http/create-http-context.ts
1559
- var import_node_querystring = __toESM(require("querystring"));
1516
+ import querystring from "node:querystring";
1560
1517
  function createHttpContext(request, auth) {
1561
1518
  const response = {
1562
1519
  body: void 0,
@@ -1601,7 +1558,7 @@ function createHttpContext(request, auth) {
1601
1558
  params() {
1602
1559
  return {
1603
1560
  ...request.params || {},
1604
- ...import_node_querystring.default.parse(request.rawQueryString || "")
1561
+ ...querystring.parse(request.rawQueryString || "")
1605
1562
  };
1606
1563
  },
1607
1564
  output,
@@ -1763,8 +1720,7 @@ async function scheduleHandler(handler, ...args) {
1763
1720
  throw error;
1764
1721
  }
1765
1722
  }
1766
- // Annotate the CommonJS export names for ESM import in node:
1767
- 0 && (module.exports = {
1723
+ export {
1768
1724
  cloudEventBroker,
1769
1725
  cloudLocations,
1770
1726
  cloudStorage,
@@ -1773,7 +1729,7 @@ async function scheduleHandler(handler, ...args) {
1773
1729
  httpHandler,
1774
1730
  scheduleHandler,
1775
1731
  useCloudProvider
1776
- });
1732
+ };
1777
1733
  /*! Bundled license information:
1778
1734
 
1779
1735
  lodash-es/lodash.js: