@base44-preview/sdk 0.8.59-pr.369.5281fd5 → 0.8.59-pr.371.9b61876

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.
@@ -3,15 +3,15 @@
3
3
  */
4
4
  export interface BrowserSessionOptions {
5
5
  /**
6
- * Whether to capture browser recordings and diagnostic logs for the session.
6
+ * Whether Base44's browser provider records the session and keeps its diagnostic logs.
7
7
  *
8
- * Captured artifacts stay with the remote browser provider and can't be retrieved through the SDK. Defaults to `true`.
8
+ * You can't retrieve the recordings or logs through the SDK. Set this to `false` when the session shows sensitive data that shouldn't be recorded. Defaults to `true`.
9
9
  */
10
10
  captureDebugArtifacts?: boolean;
11
11
  /**
12
12
  * Maximum lifetime of the session, in whole seconds.
13
13
  *
14
- * The session ends when the timeout expires, even if it's still in use. Base44 sets minimum and maximum allowed values and clamps the timeout to that range. When omitted, Base44 applies a default timeout.
14
+ * The session ends when the timeout expires, even if it's still in use. Base44 clamps the value to between `60` and `900` seconds. Defaults to `300`.
15
15
  */
16
16
  sessionTimeoutSeconds?: number;
17
17
  }
@@ -22,7 +22,7 @@ export interface BrowserSession {
22
22
  /**
23
23
  * Opaque session identifier issued to your app.
24
24
  *
25
- * Pass it unchanged to {@linkcode BrowserModule.endSession | endSession()} to end the session from a different request.
25
+ * Pass it unchanged to [`endSession()`](#endsession) to end the session from a different request.
26
26
  */
27
27
  sessionId: string;
28
28
  /**
@@ -43,25 +43,30 @@ export interface BrowserSession {
43
43
  /** ISO 8601 timestamp when the browser session expires. Omitted when the provider doesn't expose it. */
44
44
  sessionExpiresAt?: string;
45
45
  /**
46
- * Ends the session. Equivalent to calling {@linkcode BrowserModule.endSession | endSession()} with this session's ID.
46
+ * Ends the session. Equivalent to calling [`endSession()`](#endsession) with this session's ID.
47
47
  */
48
48
  end: () => Promise<void>;
49
49
  }
50
50
  /**
51
51
  * Browser module for running browser automation from your backend.
52
52
  *
53
- * This module creates remote browser sessions that you can control with a CDP client library such as Playwright or Puppeteer. Base44 doesn't store browser state, so each session is independent. End each session when you're done with it. Otherwise it keeps running until its timeout expires. To change the timeout, pass the `sessionTimeoutSeconds` option to {@linkcode BrowserModule.getSession | getSession()}.
53
+ * This module creates remote browser sessions that you can control with a [Chrome DevTools Protocol (CDP)](https://chromedevtools.github.io/devtools-protocol/) client library such as [Playwright](https://playwright.dev/docs/api/class-browsertype#browser-type-connect-over-cdp) or [Puppeteer](https://pptr.dev/api/puppeteer.puppeteer.connect). Base44 doesn't store browser state, so each session is independent.
54
54
  *
55
- * This module is only available to use with a client in service role authentication mode, which means it can only be used in backend environments.
55
+ * ## Authentication modes
56
+ *
57
+ * This module is only available to use with a client in [service role authentication mode](/developers/references/sdk/getting-started/client#service-role) (`base44.asServiceRole.browser`), which means it can only be used in backend environments.
56
58
  */
57
59
  export interface BrowserModule {
58
60
  /**
59
61
  * Creates a new remote browser session and returns its connection details.
60
62
  *
61
- * Each call creates a fresh session. Calls aren't retried automatically, and repeating a failed call doesn't resume a previous session. Session creation is rate limited per app.
63
+ * Each call creates a fresh session, which uses credits from the workspace that owns the app. Each session is billed by the minute until it ends. An open session keeps running until its timeout expires. When you're done, call `end()` on the session. To end it from a different request, use {@linkcode endSession | endSession()}.
62
64
  *
63
65
  * @param options - Optional session settings.
64
- * @returns Promise resolving to the new browser session.
66
+ * @returns Promise resolving to the new browser session. Rejects with a [`Base44Error`](/developers/references/sdk/getting-started/work-with-sdk#error-handling) whose `code` is one of the values under [Throws](#throws).
67
+ * @throws `insufficient_credits`: The workspace is out of credits.
68
+ * @throws `rate_limited`: You created more than 100 sessions in the last minute.
69
+ * @throws `browser_capacity_exceeded`: Browser capacity is temporarily unavailable.
65
70
  *
66
71
  * @example
67
72
  * ```typescript
@@ -93,28 +98,27 @@ export interface BrowserModule {
93
98
  * const session = await base44.asServiceRole.browser.getSession({
94
99
  * captureDebugArtifacts: false,
95
100
  * });
96
- * ```
97
101
  *
98
- * @example
99
- * ```typescript
100
- * // Request a custom session timeout
101
- * const session = await base44.asServiceRole.browser.getSession({
102
- * sessionTimeoutSeconds: 600,
103
- * });
102
+ * try {
103
+ * // Connect to session.connectionUrl and run your automation
104
+ * } finally {
105
+ * await session.end();
106
+ * }
104
107
  * ```
105
108
  */
106
109
  getSession(options?: BrowserSessionOptions): Promise<BrowserSession>;
107
110
  /**
108
111
  * Ends a browser session created by your app.
109
112
  *
110
- * Use this when the session was created in a different request. Otherwise call `end()` on the session returned by {@linkcode getSession | getSession()}. Ending a session that has already ended succeeds, so it's safe to call more than once. The call fails with the `browser_session_not_found` error code if the ID wasn't issued to your app.
113
+ * Use this when the session was created in a different request. Otherwise call `end()` on the session returned by {@linkcode getSession | getSession()}. Ending a session that has already ended succeeds, so it's safe to call more than once.
111
114
  *
112
- * @param sessionId - The `sessionId` returned by {@linkcode getSession | getSession()}, unchanged.
113
- * @returns Promise that resolves when the session has ended.
115
+ * @param sessionId - The `sessionId` returned by {@linkcode getSession | getSession()}.
116
+ * @returns Promise that resolves when the session has ended. Rejects with a [`Base44Error`](/developers/references/sdk/getting-started/work-with-sdk#error-handling) whose `code` is one of the values under [Throws](#throws-2).
117
+ * @throws `browser_session_not_found`: The session ID wasn't issued to your app.
114
118
  *
115
119
  * @example
116
120
  * ```typescript
117
- * // End a session whose ID was saved by an earlier request
121
+ * // End a session from a later request, using the ID sent in the request body
118
122
  * import { createClientFromRequest } from 'npm:@base44/sdk';
119
123
  *
120
124
  * Deno.serve(async (req) => {
@@ -11,7 +11,9 @@ export interface SsoAccessTokenResponse {
11
11
  * tokens allow you to authenticate Base44 users with external systems or
12
12
  * services.
13
13
  *
14
- * This module is only available to use with a client in service role authentication mode, which means it can only be used in backend environments.
14
+ * ## Authentication modes
15
+ *
16
+ * This module is only available to use with a client in [service role authentication mode](/developers/references/sdk/getting-started/client#service-role) (`base44.asServiceRole.sso`), which means it can only be used in backend environments.
15
17
  */
16
18
  export interface SsoModule {
17
19
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.59-pr.369.5281fd5",
3
+ "version": "0.8.59-pr.371.9b61876",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",