@meshagent/meshagent-ts-auth 0.48.0 → 0.49.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.49.0]
2
+ - Breaking: `createProject` no longer accepts inline settings; project settings are now document-based with `room_roles` support.
3
+ - Route path models now use a service-port/content-target union and support CORS, compression, index, and IAP for room-content routes.
4
+ - `RoomRole` now includes `guest`, and missing project-settings documents return `undefined`.
5
+
6
+ ## [0.48.1]
7
+ - Stability
8
+
1
9
  ## [0.48.0]
2
10
  - Reworked the TS/JS agent chat stack to preserve ordered threaded messages and support injected-message threads across chat clients and process handling.
3
11
  - Added chat feed widgets and virtual scrolling to the React/Tailwind UI, improving large-thread performance.
@@ -42707,7 +42707,7 @@ ${newlined}
42707
42707
  return url.toString();
42708
42708
  }
42709
42709
  async request(path, options) {
42710
- const { method = "GET", query, json, body, headers, action, responseType = "json" } = options;
42710
+ const { method = "GET", query, json, body, headers, action, responseType = "json", returnUndefinedOnNotFound = false } = options;
42711
42711
  const url = this.buildUrl(path, query);
42712
42712
  const finalHeaders = {};
42713
42713
  if (this.token) {
@@ -42734,6 +42734,9 @@ ${newlined}
42734
42734
  headers: finalHeaders,
42735
42735
  body: toFetchBody(requestBody)
42736
42736
  });
42737
+ if (response.status === 404 && returnUndefinedOnNotFound) {
42738
+ return void 0;
42739
+ }
42737
42740
  if (!response.ok) {
42738
42741
  let message2;
42739
42742
  try {
@@ -43204,10 +43207,10 @@ ${newlined}
43204
43207
  responseType: "arrayBuffer"
43205
43208
  });
43206
43209
  }
43207
- async createProject(name, settings) {
43210
+ async createProject(name) {
43208
43211
  return await this.request(`/accounts/projects`, {
43209
43212
  method: "POST",
43210
- json: { name, settings },
43213
+ json: { name },
43211
43214
  action: "create project"
43212
43215
  });
43213
43216
  }
@@ -43231,11 +43234,26 @@ ${newlined}
43231
43234
  action: "remove user from project"
43232
43235
  });
43233
43236
  }
43234
- async updateProjectSettings(projectId, settings) {
43235
- return await this.request(`/accounts/projects/${projectId}/settings`, {
43237
+ projectSettingsDocumentPath(name) {
43238
+ return name === "room_roles" ? "room-roles" : name;
43239
+ }
43240
+ async getProjectSettingsDocument(projectId, name) {
43241
+ return await this.request(`/accounts/projects/${projectId}/settings/${this.projectSettingsDocumentPath(name)}`, {
43242
+ action: `get ${name} project settings`,
43243
+ returnUndefinedOnNotFound: true
43244
+ });
43245
+ }
43246
+ async setProjectSettingsDocument(projectId, name, document2) {
43247
+ return await this.request(`/accounts/projects/${projectId}/settings/${this.projectSettingsDocumentPath(name)}`, {
43236
43248
  method: "PUT",
43237
- json: settings,
43238
- action: "update project settings"
43249
+ json: document2,
43250
+ action: `set ${name} project settings`
43251
+ });
43252
+ }
43253
+ async deleteProjectSettingsDocument(projectId, name) {
43254
+ return await this.request(`/accounts/projects/${projectId}/settings/${this.projectSettingsDocumentPath(name)}`, {
43255
+ method: "DELETE",
43256
+ action: `delete ${name} project settings`
43239
43257
  });
43240
43258
  }
43241
43259
  async updateUserInProject(projectId, userId, roles) {
@@ -45137,8 +45155,14 @@ ${newlined}
45137
45155
  break;
45138
45156
  }
45139
45157
  const event = new room_event_js_1.RoomMessageEvent({ message: message2 });
45140
- this.client.emit(event);
45141
- this.emit("message", event);
45158
+ try {
45159
+ this.client.emit(event);
45160
+ this.emit("message", event);
45161
+ } finally {
45162
+ if (message2.type === "dismiss") {
45163
+ this.client._dismiss();
45164
+ }
45165
+ }
45142
45166
  }
45143
45167
  _onParticipantEnabled(message2) {
45144
45168
  const data = message2.message;
@@ -47950,6 +47974,7 @@ ${newlined}
47950
47974
  this._localParticipantReady = new completer_js_1.Completer();
47951
47975
  this._connected = false;
47952
47976
  this._closing = false;
47977
+ this._dismissed = false;
47953
47978
  this._localParticipant = null;
47954
47979
  this._lifecycleTask = null;
47955
47980
  this._terminalState = null;
@@ -48588,7 +48613,7 @@ ${newlined}
48588
48613
  const deadline = this._reconnectTimeout == null ? null : Date.now() + this._reconnectTimeout;
48589
48614
  let firstAttempt = true;
48590
48615
  let retryCount = 0;
48591
- while (!this._closing) {
48616
+ while (!this._closing && !this._dismissed) {
48592
48617
  if (firstAttempt) {
48593
48618
  firstAttempt = false;
48594
48619
  if (this._reconnectTimeout == null) {
@@ -48714,7 +48739,7 @@ ${newlined}
48714
48739
  this._completeRoomClosed();
48715
48740
  return;
48716
48741
  }
48717
- if (closeKind !== protocol_js_1.ProtocolCloseKind.ERROR) {
48742
+ if (closeKind !== protocol_js_1.ProtocolCloseKind.ERROR || this._dismissed) {
48718
48743
  this._setTerminalState({ state });
48719
48744
  }
48720
48745
  this._markDisconnected({ reason: closeReason, kind: closeKind });
@@ -48726,7 +48751,7 @@ ${newlined}
48726
48751
  this.messaging._onRoomDisconnect({ reason: closeReason });
48727
48752
  await this._failPendingWork({ state });
48728
48753
  await this._closeProtocol(protocol);
48729
- if (closeKind === protocol_js_1.ProtocolCloseKind.ERROR) {
48754
+ if (closeKind === protocol_js_1.ProtocolCloseKind.ERROR && !this._dismissed) {
48730
48755
  if (this._reconnectTimeout === 0) {
48731
48756
  if (closeReason == null) {
48732
48757
  console.warn("room connection lost; automatic reconnect disabled");
@@ -48753,6 +48778,13 @@ ${newlined}
48753
48778
  return;
48754
48779
  }
48755
48780
  }
48781
+ _dismiss() {
48782
+ if (this._closing || this._dismissed) {
48783
+ return;
48784
+ }
48785
+ this._dismissed = true;
48786
+ this._protocolInstance.dispose();
48787
+ }
48756
48788
  dispose() {
48757
48789
  this._closing = true;
48758
48790
  this._markDisconnected({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent-ts-auth",
3
- "version": "0.48.0",
3
+ "version": "0.49.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.48.0",
42
+ "@meshagent/meshagent": "^0.49.0",
43
43
  "typescript": "^5.8.3"
44
44
  },
45
45
  "devDependencies": {