@arcote.tech/arc-cli 0.7.31 → 0.7.32

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 (2) hide show
  1. package/dist/index.js +29 -19
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -23070,7 +23070,7 @@ var {
23070
23070
  // ../../node_modules/.bun/find-up@7.0.0/node_modules/find-up/index.js
23071
23071
  import path2 from "path";
23072
23072
 
23073
- // ../../node_modules/.bun/locate-path@7.2.0/node_modules/locate-path/index.js
23073
+ // ../../node_modules/.bun/find-up@7.0.0/node_modules/find-up/node_modules/locate-path/index.js
23074
23074
  import process2 from "process";
23075
23075
  import path from "path";
23076
23076
  import fs, { promises as fsPromises } from "fs";
@@ -37944,6 +37944,7 @@ async function createArcServer(config) {
37944
37944
  const cronScheduler = new CronScheduler(contextHandler);
37945
37945
  cronScheduler.start();
37946
37946
  const connectionManager = new ConnectionManager;
37947
+ const messageChains = new Map;
37947
37948
  const coep = config.coep ?? "unsafe-none";
37948
37949
  const corsOrigins = config.corsOrigins;
37949
37950
  const maxRequestBodySize = config.maxRequestBodySize ?? 10 * 1024 * 1024;
@@ -38082,29 +38083,38 @@ async function createArcServer(config) {
38082
38083
  console.error("WS handler error:", error);
38083
38084
  }
38084
38085
  };
38085
- const telemetry = config.telemetry;
38086
- if (!telemetry) {
38087
- await dispatch();
38088
- return;
38089
- }
38090
- const carrier = {};
38091
- if (typeof message?.traceparent === "string")
38092
- carrier.traceparent = message.traceparent;
38093
- if (typeof message?.tracestate === "string")
38094
- carrier.tracestate = message.tracestate;
38095
- await telemetry.runWithExtractedContext(carrier, () => telemetry.startSpan(`ws.${message?.type ?? "message"}`, () => dispatch(), {
38096
- kind: 2,
38097
- attributes: {
38098
- "messaging.system": "arc-ws",
38099
- "messaging.operation": "process",
38100
- "messaging.message.type": message?.type,
38101
- "arc.ws.client_id": client.id
38086
+ const processMessage = async () => {
38087
+ const telemetry = config.telemetry;
38088
+ if (!telemetry) {
38089
+ await dispatch();
38090
+ return;
38102
38091
  }
38103
- }));
38092
+ const carrier = {};
38093
+ if (typeof message?.traceparent === "string")
38094
+ carrier.traceparent = message.traceparent;
38095
+ if (typeof message?.tracestate === "string")
38096
+ carrier.tracestate = message.tracestate;
38097
+ await telemetry.runWithExtractedContext(carrier, () => telemetry.startSpan(`ws.${message?.type ?? "message"}`, () => dispatch(), {
38098
+ kind: 2,
38099
+ attributes: {
38100
+ "messaging.system": "arc-ws",
38101
+ "messaging.operation": "process",
38102
+ "messaging.message.type": message?.type,
38103
+ "arc.ws.client_id": client.id
38104
+ }
38105
+ }));
38106
+ };
38107
+ const prev = messageChains.get(client.id) ?? Promise.resolve();
38108
+ const next = prev.then(processMessage, processMessage).catch((error) => {
38109
+ console.error("WS message chain error:", error);
38110
+ });
38111
+ messageChains.set(client.id, next);
38112
+ await next;
38104
38113
  },
38105
38114
  close(ws) {
38106
38115
  const client = connectionManager.getClientByWs(ws);
38107
38116
  if (client) {
38117
+ messageChains.delete(client.id);
38108
38118
  cleanupClientSubs(client.id);
38109
38119
  config.onWsClose?.(client.id);
38110
38120
  connectionManager.removeClient(client.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcote.tech/arc-cli",
3
- "version": "0.7.31",
3
+ "version": "0.7.32",
4
4
  "description": "CLI tool for Arc framework",
5
5
  "module": "index.ts",
6
6
  "main": "dist/index.js",
@@ -12,13 +12,13 @@
12
12
  "build": "bun build --target=bun ./src/index.ts --outdir=dist --external @arcote.tech/arc --external @arcote.tech/arc-ds --external @arcote.tech/arc-react --external @arcote.tech/platform --external @arcote.tech/arc-map --external '@opentelemetry/*' && chmod +x dist/index.js"
13
13
  },
14
14
  "dependencies": {
15
- "@arcote.tech/arc": "^0.7.31",
16
- "@arcote.tech/arc-ds": "^0.7.31",
17
- "@arcote.tech/arc-react": "^0.7.31",
18
- "@arcote.tech/arc-host": "^0.7.31",
19
- "@arcote.tech/arc-adapter-db-sqlite": "^0.7.31",
20
- "@arcote.tech/arc-adapter-db-postgres": "^0.7.31",
21
- "@arcote.tech/arc-otel": "^0.7.31",
15
+ "@arcote.tech/arc": "^0.7.32",
16
+ "@arcote.tech/arc-ds": "^0.7.32",
17
+ "@arcote.tech/arc-react": "^0.7.32",
18
+ "@arcote.tech/arc-host": "^0.7.32",
19
+ "@arcote.tech/arc-adapter-db-sqlite": "^0.7.32",
20
+ "@arcote.tech/arc-adapter-db-postgres": "^0.7.32",
21
+ "@arcote.tech/arc-otel": "^0.7.32",
22
22
  "@opentelemetry/api": "^1.9.0",
23
23
  "@opentelemetry/api-logs": "^0.57.0",
24
24
  "@opentelemetry/core": "^1.30.0",
@@ -31,8 +31,8 @@
31
31
  "@opentelemetry/sdk-trace-base": "^1.30.0",
32
32
  "@opentelemetry/sdk-trace-node": "^1.30.0",
33
33
  "@opentelemetry/semantic-conventions": "^1.27.0",
34
- "@arcote.tech/platform": "^0.7.31",
35
- "@arcote.tech/arc-map": "^0.7.31",
34
+ "@arcote.tech/platform": "^0.7.32",
35
+ "@arcote.tech/arc-map": "^0.7.32",
36
36
  "@clack/prompts": "^0.9.0",
37
37
  "commander": "^11.1.0",
38
38
  "chokidar": "^3.5.3",