@spacelr/sdk 0.19.0 → 0.19.2

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.mjs CHANGED
@@ -1128,6 +1128,18 @@ var RealtimeClient = class {
1128
1128
  if (ack.error) {
1129
1129
  const message = ack.message ?? ack.error;
1130
1130
  const err = new SpacelrError(message, ack.error);
1131
+ if (keepOnConnectFailure && ack.error === "disconnected" && !this.disposed) {
1132
+ for (const sibling of [...this.streamSubscriptions.get(subscriptionKey) ?? []]) {
1133
+ try {
1134
+ sibling.options.onError?.(err);
1135
+ } catch {
1136
+ }
1137
+ }
1138
+ return {
1139
+ unsubscribe: () => this.unsubscribeStream(state),
1140
+ ack: syntheticAck
1141
+ };
1142
+ }
1131
1143
  this.evictStreamKey(subscriptionKey, err, state);
1132
1144
  options.onError?.(err);
1133
1145
  throw err;
@@ -4298,7 +4310,8 @@ var NotificationsModule = class _NotificationsModule {
4298
4310
  if (!stored) return;
4299
4311
  await this.deleteSubscription(
4300
4312
  stored.subscription.platform,
4301
- _NotificationsModule.identifierOf(stored.subscription)
4313
+ _NotificationsModule.identifierOf(stored.subscription),
4314
+ true
4302
4315
  ).catch(() => void 0);
4303
4316
  });
4304
4317
  let timer;
@@ -4315,7 +4328,7 @@ var NotificationsModule = class _NotificationsModule {
4315
4328
  this.pushQueue = run.catch(() => void 0);
4316
4329
  return run;
4317
4330
  }
4318
- deleteSubscription(platform, identifier) {
4331
+ deleteSubscription(platform, identifier, skipAuthRefresh = false) {
4319
4332
  const body = { platform };
4320
4333
  if (platform === "web") {
4321
4334
  body["endpoint"] = identifier;
@@ -4326,7 +4339,8 @@ var NotificationsModule = class _NotificationsModule {
4326
4339
  method: "DELETE",
4327
4340
  path: "/notifications/subscribe",
4328
4341
  body,
4329
- authenticated: true
4342
+ authenticated: true,
4343
+ skipAuthRefresh
4330
4344
  });
4331
4345
  }
4332
4346
  /** The value `unsubscribe()` identifies a subscription by: endpoint for web, token otherwise. */