notte-sdk 1.10.0 → 1.10.1

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
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var SDK_VERSION = true ? "1.10.0" : "dev";
2
+ var SDK_VERSION = true ? "1.10.1" : "dev";
3
3
  var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
4
4
 
5
5
  // src/version-check.ts
@@ -2008,6 +2008,7 @@ var NotteManagedAuth = class {
2008
2008
  constructor(client2) {
2009
2009
  this.client = client2;
2010
2010
  }
2011
+ client;
2011
2012
  /** Run only the verifier; this does not submit login credentials. */
2012
2013
  async checkConnection(connectionId) {
2013
2014
  const response = await this.client.getClient().post({
@@ -2171,6 +2172,9 @@ function createResources(client2, getApiKey) {
2171
2172
  },
2172
2173
  /** sessionStart: /sessions/start. Returns the API response body. */
2173
2174
  start: async (body, requestOptions = {}) => {
2175
+ body = { ...body };
2176
+ if (body.record_session === true) delete body.record_session;
2177
+ if (body.log_session === true) delete body.log_session;
2174
2178
  const response = await sessionStart({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body });
2175
2179
  return response.data;
2176
2180
  },
@@ -3212,6 +3216,8 @@ var Session = class {
3212
3216
  ...auth_retry !== void 0 ? { auth_retry } : {},
3213
3217
  ...request.auth_ids?.length ? { wait_for_authentication: false } : {}
3214
3218
  };
3219
+ if (body.record_session === true) delete body.record_session;
3220
+ if (body.log_session === true) delete body.log_session;
3215
3221
  const shouldWait = options.wait_for_authentication ?? wait_for_authentication ?? true;
3216
3222
  const maxRetries = this.client.getConfig().maxRetries ?? 0;
3217
3223
  const timeoutMs = this.client.getConfig().timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
@@ -3513,7 +3519,11 @@ var Session = class {
3513
3519
  if (!(error instanceof NotteAPIError) || error.statusCode !== 404) {
3514
3520
  throw error;
3515
3521
  }
3516
- if (this.isActive && (error.apiMessage ?? "").includes("still active")) {
3522
+ const waitingForClose = error.error.replay_status === "waiting_for_session";
3523
+ if (error.error.replay_status === "disabled" || error.error.retryable === false && !waitingForClose) {
3524
+ throw error;
3525
+ }
3526
+ if (this.isActive && this.sessionId === sessionId && (waitingForClose || (error.apiMessage ?? "").includes("still active"))) {
3517
3527
  throw new Error(`Session ${sessionId} is still active \u2014 close the session first to generate the replay.`, {
3518
3528
  cause: error
3519
3529
  });
@@ -5322,6 +5332,8 @@ var SessionFiles = class {
5322
5332
  this.client = client2;
5323
5333
  this.sessionId = sessionId;
5324
5334
  }
5335
+ client;
5336
+ sessionId;
5325
5337
  /**
5326
5338
  * Upload bytes as a session file. `filename` is what the browser sees when
5327
5339
  * the file is later attached to a page.
@@ -5426,6 +5438,7 @@ var RemoteFileStorage = class _RemoteFileStorage {
5426
5438
  this.client = client2;
5427
5439
  this._sessionId = sessionId ?? null;
5428
5440
  }
5441
+ client;
5429
5442
  _sessionId;
5430
5443
  /** Bind the storage to a session. Called by `Session.start()` when the storage was passed to the session. */
5431
5444
  setSessionId(sessionId) {