@spacelr/sdk 0.18.0 → 0.18.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
@@ -1592,6 +1592,7 @@ var RealtimeClient = class {
1592
1592
  captureDurableHandshake(state, ack) {
1593
1593
  if (ack.generation !== void 0) state.generation = ack.generation;
1594
1594
  if (ack.session !== void 0) state.session = ack.session;
1595
+ this.scheduleDurableAck(state);
1595
1596
  }
1596
1597
  /**
1597
1598
  * #768 — schedule a coalesced durable ack. Only durable subscriptions (a
@@ -1714,6 +1715,10 @@ var RealtimeClient = class {
1714
1715
  }
1715
1716
  }
1716
1717
  async resubscribeOne(primary, set) {
1718
+ for (const s of set) {
1719
+ s.generation = void 0;
1720
+ s.session = void 0;
1721
+ }
1717
1722
  try {
1718
1723
  const ack = await this.emitSubscribeEvents(primary);
1719
1724
  if (ack.error) {
@@ -1726,12 +1731,9 @@ var RealtimeClient = class {
1726
1731
  }
1727
1732
  return;
1728
1733
  }
1729
- for (const s of set) {
1730
- s.generation = void 0;
1731
- s.session = void 0;
1732
- }
1733
- this.captureDurableHandshake(primary, ack);
1734
- if (!this.streamSubscriptions.has(primary.subscriptionKey)) {
1734
+ if (this.streamSubscriptions.has(primary.subscriptionKey)) {
1735
+ this.captureDurableHandshake(primary, ack);
1736
+ } else {
1735
1737
  const payload = {
1736
1738
  projectId: primary.options.projectId,
1737
1739
  collectionName: primary.options.collectionName
@@ -1999,11 +2001,19 @@ var AuthModule = class _AuthModule {
1999
2001
  await this.tokenManager.clearTokens();
2000
2002
  this.emitState("unauthenticated");
2001
2003
  }
2004
+ /**
2005
+ * Verify an email address with the token from the verification email.
2006
+ *
2007
+ * The token is sent in the request BODY, never the URL (#941): a query
2008
+ * string reaches server, proxy and CDN logs. When the project mints one, the
2009
+ * response carries a one-time `loginCode`; pass it to `exchangeCode` to sign
2010
+ * the user in.
2011
+ */
2002
2012
  async verifyEmail(token) {
2003
2013
  return this.http.request({
2004
- method: "GET",
2014
+ method: "POST",
2005
2015
  path: "/auth/verify-email",
2006
- query: { token }
2016
+ body: { token }
2007
2017
  });
2008
2018
  }
2009
2019
  async resendVerification(email) {
@@ -2248,6 +2258,11 @@ var AuthModule = class _AuthModule {
2248
2258
  /**
2249
2259
  * Fetch WebAuthn attestation options to register a new passkey for the
2250
2260
  * currently authenticated user.
2261
+ *
2262
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
2263
+ * server answers 401 `STALE_SESSION` and this throws
2264
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
2265
+ * A token refresh does not help.
2251
2266
  */
2252
2267
  async beginPasskeyRegistration() {
2253
2268
  return this.http.request({
@@ -2262,6 +2277,11 @@ var AuthModule = class _AuthModule {
2262
2277
  * against the options returned by `beginPasskeyRegistration()`, saving the
2263
2278
  * new credential under the current user. This does not issue tokens or
2264
2279
  * change auth state — the caller is already authenticated.
2280
+ *
2281
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
2282
+ * server answers 401 `STALE_SESSION` and this throws
2283
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
2284
+ * A token refresh does not help.
2265
2285
  */
2266
2286
  async verifyPasskeyRegistration(response, label) {
2267
2287
  return this.http.request({
@@ -2511,6 +2531,11 @@ var AuthModule = class _AuthModule {
2511
2531
  /**
2512
2532
  * Approve the pending device link (signed-in device A). Authenticated.
2513
2533
  * Ownership/identity are derived server-side from the JWT.
2534
+ *
2535
+ * Requires a recent interactive login (within 5 minutes). Otherwise the
2536
+ * server answers 401 `STALE_SESSION` and this throws
2537
+ * {@link SpacelrStepUpRequiredError}: sign the user in again, then retry.
2538
+ * A token refresh does not help.
2514
2539
  */
2515
2540
  async approveDeviceLink(code) {
2516
2541
  return this.http.request({