@meshagent/meshagent-ts-auth 0.39.8 → 0.40.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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.40.0]
2
+ - Enabled websocket compression for Node protocol connections while preserving the browser path.
3
+ - Aligned the JS and TS protocol surface with realtime model selection and output-modality negotiation.
4
+ - Refreshed the generated Node entrypoint to match the updated realtime protocol flow.
5
+
6
+ ## [0.39.9]
7
+ - Added streaming `watchTable` support to the TypeScript DatasetsClient to receive dataset table change events with versioning metadata.
8
+
1
9
  ## [0.39.8]
2
10
  - TypeScript API: `RoomContainer` now includes a required `ports: number[]` field (and validation) in container listings
3
11
  - TypeScript API: `ContainerSpec` now supports optional fields `private`, `on_demand`, and `writable_root_fs`
@@ -12378,11 +12378,15 @@ ${err.toString()}`);
12378
12378
  };
12379
12379
  }
12380
12380
  async function* buildInputStream(params2) {
12381
+ const tags = params2.tags ?? (params2.tag === void 0 ? [] : [params2.tag]);
12382
+ if (tags.length === 0) {
12383
+ throw new room_server_client_12.RoomServerException("containers.build requires at least one tag");
12384
+ }
12381
12385
  yield new response_12.BinaryContent({
12382
12386
  data: new Uint8Array(0),
12383
12387
  headers: {
12384
12388
  kind: "start",
12385
- tag: params2.tag,
12389
+ tags,
12386
12390
  mount_path: params2.mountPath,
12387
12391
  context_path: params2.contextPath,
12388
12392
  dockerfile_path: params2.dockerfilePath ?? null,
@@ -12765,6 +12769,7 @@ ${err.toString()}`);
12765
12769
  logs(params2) {
12766
12770
  const requestId = (0, uuid_14.v4)();
12767
12771
  const closeInput = new completer_12.Completer();
12772
+ const progressController = new stream_controller_1.StreamController();
12768
12773
  const streamController = new stream_controller_1.StreamController();
12769
12774
  const result = new completer_12.Completer();
12770
12775
  let inputClosed = false;
@@ -12801,6 +12806,7 @@ ${err.toString()}`);
12801
12806
  if (chunk instanceof response_12.ControlContent) {
12802
12807
  if (chunk.method === "close") {
12803
12808
  closeInputStream();
12809
+ progressController.close();
12804
12810
  streamController.close();
12805
12811
  if (!result.completed) {
12806
12812
  result.complete();
@@ -12822,12 +12828,14 @@ ${err.toString()}`);
12822
12828
  streamController.add(decodeUtf8(chunk.data, "logs"));
12823
12829
  }
12824
12830
  closeInputStream();
12831
+ progressController.close();
12825
12832
  streamController.close();
12826
12833
  if (!result.completed) {
12827
12834
  result.complete();
12828
12835
  }
12829
12836
  }).catch((error) => {
12830
12837
  closeInputStream();
12838
+ progressController.close();
12831
12839
  streamController.close();
12832
12840
  if (!result.completed) {
12833
12841
  result.completeError(error);
@@ -12855,6 +12863,7 @@ ${err.toString()}`);
12855
12863
  }
12856
12864
  };
12857
12865
  return {
12866
+ progress: progressController.stream,
12858
12867
  stream: outputStream,
12859
12868
  result: result.fut,
12860
12869
  cancel: async () => {
@@ -30040,6 +30049,18 @@ return true;`);
30040
30049
  manifestSize: value.manifest_size ?? null
30041
30050
  };
30042
30051
  }
30052
+ function optionalDatasetInt(value) {
30053
+ if (typeof value === "number" && Number.isInteger(value)) {
30054
+ return value;
30055
+ }
30056
+ if (typeof value === "string" && /^-?\d+$/.test(value)) {
30057
+ return Number.parseInt(value, 10);
30058
+ }
30059
+ return void 0;
30060
+ }
30061
+ function optionalDatasetString(value) {
30062
+ return typeof value === "string" ? value : void 0;
30063
+ }
30043
30064
  async function* toAsyncArrowIterable(chunks) {
30044
30065
  if (Symbol.asyncIterator in chunks) {
30045
30066
  for await (const chunk of chunks) {
@@ -30816,6 +30837,70 @@ return true;`);
30816
30837
  version: version2 ?? null
30817
30838
  });
30818
30839
  }
30840
+ async *watchTable({ table, namespace, branch, pollIntervalSeconds = 0.5 }) {
30841
+ const input = new DatasetArrowReadInputStream({
30842
+ kind: "start",
30843
+ table,
30844
+ namespace: namespace ?? null,
30845
+ branch: branch ?? null,
30846
+ poll_interval_seconds: pollIntervalSeconds
30847
+ });
30848
+ const response = await this.invokeStream("watch_table", input.stream());
30849
+ input.requestNext();
30850
+ try {
30851
+ for await (const chunk of response) {
30852
+ if (chunk instanceof response_13.ErrorContent) {
30853
+ throw new room_server_client_13.RoomServerException(chunk.text, chunk.code);
30854
+ }
30855
+ if (chunk instanceof response_13.ControlContent) {
30856
+ if (chunk.method === "close") {
30857
+ return;
30858
+ }
30859
+ throw this._unexpectedResponseError("watch_table");
30860
+ }
30861
+ if (chunk instanceof response_13.BinaryContent) {
30862
+ if (chunk.headers.kind !== "data") {
30863
+ throw this._unexpectedResponseError("watch_table");
30864
+ }
30865
+ const watchEvent = optionalDatasetString(chunk.headers.watch_event);
30866
+ yield {
30867
+ kind: watchEvent ?? "data",
30868
+ phase: optionalDatasetString(chunk.headers.phase),
30869
+ table: tableFromIPCBytes(chunk.data),
30870
+ version: optionalDatasetInt(chunk.headers.version),
30871
+ changeType: optionalDatasetString(chunk.headers.change_type),
30872
+ beginVersion: optionalDatasetInt(chunk.headers.begin_version),
30873
+ endVersion: optionalDatasetInt(chunk.headers.end_version),
30874
+ watchEvent
30875
+ };
30876
+ input.requestNext();
30877
+ continue;
30878
+ }
30879
+ if (chunk instanceof response_13.JsonContent) {
30880
+ if (!isRecord3(chunk.json)) {
30881
+ throw this._unexpectedResponseError("watch_table");
30882
+ }
30883
+ const rawTransactions = chunk.json.transactions;
30884
+ const rawTransaction = chunk.json.transaction;
30885
+ yield {
30886
+ kind: typeof chunk.json.kind === "string" ? chunk.json.kind : "event",
30887
+ phase: optionalDatasetString(chunk.json.phase),
30888
+ version: optionalDatasetInt(chunk.json.version),
30889
+ beginVersion: optionalDatasetInt(chunk.json.begin_version),
30890
+ endVersion: optionalDatasetInt(chunk.json.end_version),
30891
+ transactions: Array.isArray(rawTransactions) ? rawTransactions.filter(isRecord3) : void 0,
30892
+ deletePredicate: optionalDatasetString(chunk.json.predicate),
30893
+ transaction: isRecord3(rawTransaction) ? rawTransaction : void 0
30894
+ };
30895
+ input.requestNext();
30896
+ continue;
30897
+ }
30898
+ throw this._unexpectedResponseError("watch_table");
30899
+ }
30900
+ } finally {
30901
+ input.close();
30902
+ }
30903
+ }
30819
30904
  async count({ table, text, vector, where, namespace, branch, version: version2 }) {
30820
30905
  const response = await this.invoke("count", {
30821
30906
  table,
@@ -37381,7 +37466,7 @@ ${newlined}
37381
37466
  this._onDataReceived = onDataReceived;
37382
37467
  this._doneHandler = onDone;
37383
37468
  this._errorHandler = onError;
37384
- const socket = new isomorphic_ws_1.default(url.toString());
37469
+ const socket = isNodeRuntime() ? new isomorphic_ws_1.default(url.toString(), [], { perMessageDeflate: true }) : new isomorphic_ws_1.default(url.toString());
37385
37470
  this.webSocket = socket;
37386
37471
  if (isNodeRuntime()) {
37387
37472
  socket.on("unexpected-response", this._onUnexpectedResponse);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent-ts-auth",
3
- "version": "0.39.8",
3
+ "version": "0.40.0",
4
4
  "description": "Meshagent Typescript Auth",
5
5
  "homepage": "https://github.com/meshagent/meshagent-ts-auth",
6
6
  "scripts": {
@@ -39,7 +39,7 @@
39
39
  "CHANGELOG.md"
40
40
  ],
41
41
  "dependencies": {
42
- "@meshagent/meshagent": "^0.39.8",
42
+ "@meshagent/meshagent": "^0.40.0",
43
43
  "typescript": "^5.8.3"
44
44
  },
45
45
  "devDependencies": {