@naturali/sdk 0.30.0 → 0.32.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/dist/index.cjs CHANGED
@@ -784,7 +784,7 @@ var Auth = class {
784
784
  /**
785
785
  * Refresh a session
786
786
  *
787
- * Exchanges a valid refresh token for a new access JWT and a rotated refresh token. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection).
787
+ * Exchanges a valid refresh token for a new access JWT and a rotated refresh token, taken from the body or from the `refresh_token` cookie set at sign-in — a browser sends an empty body and the cookie carries the credential. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection), except within a few seconds of the rotation, where it is treated as two tabs racing on one cookie and rotated again.
788
788
  *
789
789
  */
790
790
  static refreshSession(options) {
@@ -800,7 +800,7 @@ var Auth = class {
800
800
  /**
801
801
  * Log out
802
802
  *
803
- * Revokes the current refresh token (and its rotation family). Pass `all: true` to revoke every active session for the user.
803
+ * Revokes the current refresh token (and its rotation family) and clears the `refresh_token` cookie. Pass `all: true` to revoke every active session for the user.
804
804
  *
805
805
  */
806
806
  static logout(options) {
package/dist/index.d.cts CHANGED
@@ -531,7 +531,7 @@ type Acknowledgement = {
531
531
  message?: string;
532
532
  };
533
533
  /**
534
- * A short-lived access JWT plus a rotating refresh token. Web clients may receive the refresh token as an httpOnly, Secure cookie instead of in the body.
534
+ * A short-lived access JWT plus a rotating refresh token. The refresh token is also set as an httpOnly, SameSite=Lax cookie scoped to `/v1/auth` (Secure whenever the connection is https), which is what carries a browser session across a reload; the body copy is for clients with no cookie jar, such as the CLI.
535
535
  *
536
536
  */
537
537
  type AuthSession = {
@@ -551,7 +551,8 @@ type AuthSession = {
551
551
  user: User;
552
552
  };
553
553
  /**
554
- * The refresh token may instead be presented via an httpOnly cookie.
554
+ * Send an empty object from a browser the httpOnly `refresh_token` cookie is presented instead, and takes over when the body omits the field.
555
+ *
555
556
  */
556
557
  type RefreshRequest = {
557
558
  refresh_token?: string;
@@ -5097,14 +5098,14 @@ declare class Auth {
5097
5098
  /**
5098
5099
  * Refresh a session
5099
5100
  *
5100
- * Exchanges a valid refresh token for a new access JWT and a rotated refresh token. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection).
5101
+ * Exchanges a valid refresh token for a new access JWT and a rotated refresh token, taken from the body or from the `refresh_token` cookie set at sign-in — a browser sends an empty body and the cookie carries the credential. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection), except within a few seconds of the rotation, where it is treated as two tabs racing on one cookie and rotated again.
5101
5102
  *
5102
5103
  */
5103
5104
  static refreshSession<ThrowOnError extends boolean = false>(options: Options<RefreshSessionData, ThrowOnError>): RequestResult<RefreshSessionResponses, RefreshSessionErrors, ThrowOnError>;
5104
5105
  /**
5105
5106
  * Log out
5106
5107
  *
5107
- * Revokes the current refresh token (and its rotation family). Pass `all: true` to revoke every active session for the user.
5108
+ * Revokes the current refresh token (and its rotation family) and clears the `refresh_token` cookie. Pass `all: true` to revoke every active session for the user.
5108
5109
  *
5109
5110
  */
5110
5111
  static logout<ThrowOnError extends boolean = false>(options?: Options<LogoutData, ThrowOnError>): RequestResult<LogoutResponses, LogoutErrors, ThrowOnError>;
package/dist/index.d.mts CHANGED
@@ -531,7 +531,7 @@ type Acknowledgement = {
531
531
  message?: string;
532
532
  };
533
533
  /**
534
- * A short-lived access JWT plus a rotating refresh token. Web clients may receive the refresh token as an httpOnly, Secure cookie instead of in the body.
534
+ * A short-lived access JWT plus a rotating refresh token. The refresh token is also set as an httpOnly, SameSite=Lax cookie scoped to `/v1/auth` (Secure whenever the connection is https), which is what carries a browser session across a reload; the body copy is for clients with no cookie jar, such as the CLI.
535
535
  *
536
536
  */
537
537
  type AuthSession = {
@@ -551,7 +551,8 @@ type AuthSession = {
551
551
  user: User;
552
552
  };
553
553
  /**
554
- * The refresh token may instead be presented via an httpOnly cookie.
554
+ * Send an empty object from a browser the httpOnly `refresh_token` cookie is presented instead, and takes over when the body omits the field.
555
+ *
555
556
  */
556
557
  type RefreshRequest = {
557
558
  refresh_token?: string;
@@ -5097,14 +5098,14 @@ declare class Auth {
5097
5098
  /**
5098
5099
  * Refresh a session
5099
5100
  *
5100
- * Exchanges a valid refresh token for a new access JWT and a rotated refresh token. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection).
5101
+ * Exchanges a valid refresh token for a new access JWT and a rotated refresh token, taken from the body or from the `refresh_token` cookie set at sign-in — a browser sends an empty body and the cookie carries the credential. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection), except within a few seconds of the rotation, where it is treated as two tabs racing on one cookie and rotated again.
5101
5102
  *
5102
5103
  */
5103
5104
  static refreshSession<ThrowOnError extends boolean = false>(options: Options<RefreshSessionData, ThrowOnError>): RequestResult<RefreshSessionResponses, RefreshSessionErrors, ThrowOnError>;
5104
5105
  /**
5105
5106
  * Log out
5106
5107
  *
5107
- * Revokes the current refresh token (and its rotation family). Pass `all: true` to revoke every active session for the user.
5108
+ * Revokes the current refresh token (and its rotation family) and clears the `refresh_token` cookie. Pass `all: true` to revoke every active session for the user.
5108
5109
  *
5109
5110
  */
5110
5111
  static logout<ThrowOnError extends boolean = false>(options?: Options<LogoutData, ThrowOnError>): RequestResult<LogoutResponses, LogoutErrors, ThrowOnError>;
package/dist/index.mjs CHANGED
@@ -783,7 +783,7 @@ var Auth = class {
783
783
  /**
784
784
  * Refresh a session
785
785
  *
786
- * Exchanges a valid refresh token for a new access JWT and a rotated refresh token. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection).
786
+ * Exchanges a valid refresh token for a new access JWT and a rotated refresh token, taken from the body or from the `refresh_token` cookie set at sign-in — a browser sends an empty body and the cookie carries the credential. Refresh tokens are single-use; presenting a previously-rotated token is treated as reuse and revokes the whole session family (createRefreshRotation reuse detection), except within a few seconds of the rotation, where it is treated as two tabs racing on one cookie and rotated again.
787
787
  *
788
788
  */
789
789
  static refreshSession(options) {
@@ -799,7 +799,7 @@ var Auth = class {
799
799
  /**
800
800
  * Log out
801
801
  *
802
- * Revokes the current refresh token (and its rotation family). Pass `all: true` to revoke every active session for the user.
802
+ * Revokes the current refresh token (and its rotation family) and clears the `refresh_token` cookie. Pass `all: true` to revoke every active session for the user.
803
803
  *
804
804
  */
805
805
  static logout(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.30.0",
3
+ "version": "0.32.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  "tsx": "^4.23.1",
38
38
  "typescript": "~6.0.3",
39
39
  "vitest": "^4.1.10",
40
- "@naturali/api": "0.30.0"
40
+ "@naturali/api": "0.32.0"
41
41
  },
42
42
  "scripts": {
43
43
  "generate": "tsx scripts/generate.ts",