c8y-nitro 0.9.0 → 0.9.1

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.
@@ -1,4 +1,4 @@
1
- import { n as name, r as version, t as description } from "../package-gK1cGX1w.mjs";
1
+ import { n as name, r as version, t as description } from "../package-CUuWGZoQ.mjs";
2
2
  import { defineCommand, runMain } from "citty";
3
3
  //#region src/cli/index.ts
4
4
  runMain(defineCommand({
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { _ as GENERATED_READINESS_ROUTE, g as GENERATED_LIVENESS_ROUTE, h as GENERATED_INVALIDATE_TENANT_OPTIONS_ROUTE, m as createC8yManifestFromNitro, p as createC8yManifest } from "./c8y-api-DpCWhaJU.mjs";
2
2
  import { t as autoBootstrap } from "./autoBootstrap-qCcCgset.mjs";
3
- import { n as name } from "./package-gK1cGX1w.mjs";
3
+ import { n as name } from "./package-CUuWGZoQ.mjs";
4
4
  import { basename, dirname, join, relative } from "node:path";
5
5
  import { mkdir, writeFile } from "node:fs/promises";
6
6
  import { x } from "tinyexec";
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "c8y-nitro";
3
- var version = "0.9.0";
3
+ var version = "0.9.1";
4
4
  var description = "Lightning fast Cumulocity IoT microservice development powered by Nitro";
5
5
  //#endregion
6
6
  export { name as n, version as r, description as t };
package/dist/utils.mjs CHANGED
@@ -12,6 +12,7 @@ import { defineHandler } from "nitro/h3";
12
12
  import { c8yManifest } from "c8y-nitro/runtime";
13
13
  import { Cron } from "croner";
14
14
  import { ms } from "itty-time";
15
+ import { WebSocket } from "ws";
15
16
  //#region src/utils/internal/common.ts
16
17
  /**
17
18
  * Whether two sets of tenant credentials are equivalent for the purposes of
@@ -1156,6 +1157,21 @@ function c8yTasks() {
1156
1157
  }
1157
1158
  //#endregion
1158
1159
  //#region src/utils/realtime.ts
1160
+ /**
1161
+ * `ws` as the factory type c8y-realtime asks for.
1162
+ *
1163
+ * The cast is needed, and it is safe. TypeScript only compares the *first*
1164
+ * overload of an overloaded member, and `ws` is overloaded twice over:
1165
+ * `@types/ws` declares `constructor(address: null)` first (the socket
1166
+ * `WebSocketServer` builds for an incoming connection), and its `on` is declared
1167
+ * per event (`on('close', …)`, `on('error', …)`). So TS never looks at the
1168
+ * signatures we actually use.
1169
+ *
1170
+ * At runtime `ws` has all seven methods `WebSocketInstanceLike` lists. The global
1171
+ * WebSocket, which assigns with no cast at all, has four — it lacks `ping`,
1172
+ * `terminate` and `removeAllListeners`.
1173
+ */
1174
+ const wsWebSocketImpl = WebSocket;
1159
1175
  const REPAIR_SWEEP_INTERVAL_MS = 3e4;
1160
1176
  const pool = /* @__PURE__ */ new Map();
1161
1177
  let lifecycleWired = false;
@@ -1191,6 +1207,7 @@ function createRealtimeClientForTenant(tenantId, creds) {
1191
1207
  return createRealtimeClient({
1192
1208
  ...realtimeConfig(),
1193
1209
  ...toLibCredentials(tenantId, creds),
1210
+ webSocketImpl: wsWebSocketImpl,
1194
1211
  logger: console
1195
1212
  });
1196
1213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c8y-nitro",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "type": "module",
5
5
  "description": "Lightning fast Cumulocity IoT microservice development powered by Nitro",
6
6
  "keywords": [
@@ -49,13 +49,15 @@
49
49
  "pathe": "^2.0.3",
50
50
  "pkg-types": "^2.3.1",
51
51
  "spinnies": "^0.5.1",
52
- "tinyexec": "^1.2.4"
52
+ "tinyexec": "^1.2.4",
53
+ "ws": "^8.21.3"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@c8y/client": "^1023.97.0",
56
57
  "@schplitt/eslint-config": "^1.5.2",
57
58
  "@types/node": "^24.12.3",
58
59
  "@types/spinnies": "^0.5.3",
60
+ "@types/ws": "^8.18.1",
59
61
  "bumpp": "^11.1.0",
60
62
  "changelogithub": "^14.0.0",
61
63
  "eslint": "^10.7.0",