@depup/base44__sdk 0.8.22-depup.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.
Files changed (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/changes.json +14 -0
  4. package/dist/client.d.ts +96 -0
  5. package/dist/client.js +375 -0
  6. package/dist/client.types.d.ts +144 -0
  7. package/dist/client.types.js +1 -0
  8. package/dist/index.d.ts +16 -0
  9. package/dist/index.js +5 -0
  10. package/dist/modules/agents.d.ts +2 -0
  11. package/dist/modules/agents.js +77 -0
  12. package/dist/modules/agents.types.d.ts +377 -0
  13. package/dist/modules/agents.types.js +1 -0
  14. package/dist/modules/analytics.d.ts +20 -0
  15. package/dist/modules/analytics.js +277 -0
  16. package/dist/modules/analytics.types.d.ts +122 -0
  17. package/dist/modules/analytics.types.js +1 -0
  18. package/dist/modules/app-logs.d.ts +11 -0
  19. package/dist/modules/app-logs.js +27 -0
  20. package/dist/modules/app-logs.types.d.ts +46 -0
  21. package/dist/modules/app-logs.types.js +1 -0
  22. package/dist/modules/app.types.d.ts +142 -0
  23. package/dist/modules/app.types.js +1 -0
  24. package/dist/modules/auth.d.ts +13 -0
  25. package/dist/modules/auth.js +180 -0
  26. package/dist/modules/auth.types.d.ts +481 -0
  27. package/dist/modules/auth.types.js +1 -0
  28. package/dist/modules/connectors.d.ts +20 -0
  29. package/dist/modules/connectors.js +71 -0
  30. package/dist/modules/connectors.types.d.ts +296 -0
  31. package/dist/modules/connectors.types.js +1 -0
  32. package/dist/modules/custom-integrations.d.ts +11 -0
  33. package/dist/modules/custom-integrations.js +32 -0
  34. package/dist/modules/custom-integrations.types.d.ts +89 -0
  35. package/dist/modules/custom-integrations.types.js +1 -0
  36. package/dist/modules/entities.d.ts +20 -0
  37. package/dist/modules/entities.js +149 -0
  38. package/dist/modules/entities.types.d.ts +552 -0
  39. package/dist/modules/entities.types.js +1 -0
  40. package/dist/modules/functions.d.ts +12 -0
  41. package/dist/modules/functions.js +79 -0
  42. package/dist/modules/functions.types.d.ts +103 -0
  43. package/dist/modules/functions.types.js +1 -0
  44. package/dist/modules/integrations.d.ts +11 -0
  45. package/dist/modules/integrations.js +77 -0
  46. package/dist/modules/integrations.types.d.ts +413 -0
  47. package/dist/modules/integrations.types.js +1 -0
  48. package/dist/modules/sso.d.ts +12 -0
  49. package/dist/modules/sso.js +23 -0
  50. package/dist/modules/sso.types.d.ts +44 -0
  51. package/dist/modules/sso.types.js +1 -0
  52. package/dist/modules/types.d.ts +4 -0
  53. package/dist/modules/types.js +4 -0
  54. package/dist/modules/users.d.ts +16 -0
  55. package/dist/modules/users.js +23 -0
  56. package/dist/types.d.ts +72 -0
  57. package/dist/types.js +1 -0
  58. package/dist/utils/auth-utils.d.ts +117 -0
  59. package/dist/utils/auth-utils.js +189 -0
  60. package/dist/utils/auth-utils.types.d.ts +146 -0
  61. package/dist/utils/auth-utils.types.js +1 -0
  62. package/dist/utils/axios-client.d.ts +100 -0
  63. package/dist/utils/axios-client.js +193 -0
  64. package/dist/utils/axios-client.types.d.ts +28 -0
  65. package/dist/utils/axios-client.types.js +1 -0
  66. package/dist/utils/common.d.ts +3 -0
  67. package/dist/utils/common.js +6 -0
  68. package/dist/utils/sharedInstance.d.ts +1 -0
  69. package/dist/utils/sharedInstance.js +15 -0
  70. package/dist/utils/socket-utils.d.ts +47 -0
  71. package/dist/utils/socket-utils.js +115 -0
  72. package/package.json +87 -0
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Response from SSO access token endpoint.
3
+ * @internal
4
+ */
5
+ export interface SsoAccessTokenResponse {
6
+ access_token: string;
7
+ }
8
+ /**
9
+ * SSO (Single Sign-On) module for managing SSO authentication.
10
+ *
11
+ * This module provides methods for retrieving SSO access tokens for users.
12
+ * These tokens allow you to authenticate Base44 users with external
13
+ * systems or services.
14
+ *
15
+ * 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.
16
+ *
17
+ * @internal
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // Access SSO module with service role
22
+ * const response = await base44.asServiceRole.sso.getAccessToken('user_123');
23
+ * console.log(response.data.access_token);
24
+ * ```
25
+ */
26
+ export interface SsoModule {
27
+ /**
28
+ * Gets SSO access token for a specific user.
29
+ *
30
+ * Retrieves a Single Sign-On access token that can be used to authenticate
31
+ * a user with external services or systems.
32
+ *
33
+ * @param userid - The user ID to get the access token for.
34
+ * @returns Promise resolving to the SSO access token response.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // Get SSO access token for a user
39
+ * const response = await base44.asServiceRole.sso.getAccessToken('user_123');
40
+ * console.log(response.access_token);
41
+ * ```
42
+ */
43
+ getAccessToken(userid: string): Promise<SsoAccessTokenResponse>;
44
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./app.types.js";
2
+ export * from "./agents.types.js";
3
+ export * from "./connectors.types.js";
4
+ export * from "./analytics.types.js";
@@ -0,0 +1,4 @@
1
+ export * from "./app.types.js";
2
+ export * from "./agents.types.js";
3
+ export * from "./connectors.types.js";
4
+ export * from "./analytics.types.js";
@@ -0,0 +1,16 @@
1
+ import { AxiosInstance } from "axios";
2
+ /**
3
+ * Creates the users module for the Base44 SDK
4
+ * @param {AxiosInstance} axios - Axios instance
5
+ * @param {string} appId - Application ID
6
+ * @returns {Object} Users module
7
+ */
8
+ export declare function createUsersModule(axios: AxiosInstance, appId: string): {
9
+ /**
10
+ * Invite a user to the application
11
+ * @param {string} user_email - User's email address
12
+ * @param {'user'|'admin'} role - User's role (user or admin)
13
+ * @returns {Promise<any>}
14
+ */
15
+ inviteUser(user_email: string, role: "user" | "admin"): Promise<any>;
16
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates the users module for the Base44 SDK
3
+ * @param {AxiosInstance} axios - Axios instance
4
+ * @param {string} appId - Application ID
5
+ * @returns {Object} Users module
6
+ */
7
+ export function createUsersModule(axios, appId) {
8
+ return {
9
+ /**
10
+ * Invite a user to the application
11
+ * @param {string} user_email - User's email address
12
+ * @param {'user'|'admin'} role - User's role (user or admin)
13
+ * @returns {Promise<any>}
14
+ */
15
+ async inviteUser(user_email, role) {
16
+ if (role !== "user" && role !== "admin") {
17
+ throw new Error(`Invalid role: "${role}". Role must be either "user" or "admin".`);
18
+ }
19
+ const response = await axios.post(`/apps/${appId}/runtime/users/invite-user`, { user_email, role });
20
+ return response;
21
+ },
22
+ };
23
+ }
@@ -0,0 +1,72 @@
1
+ export * from "./modules/types.js";
2
+ /**
3
+ * Parameters for filtering, sorting, and paginating agent model data.
4
+ *
5
+ * Used in the agents module for querying agent conversations. Provides a structured way to specify query criteria, sorting, pagination, and field selection.
6
+ *
7
+ * @property q - Query object with field-value pairs for filtering.
8
+ * @property sort - Sort parameter. For example, "-created_date" for descending order.
9
+ * @property sort_by - Alternative sort parameter. Use either `sort` or `sort_by`.
10
+ * @property limit - Maximum number of results to return.
11
+ * @property skip - Number of results to skip. Used for pagination.
12
+ * @property fields - Array of field names to include in the response.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // Filter conversations by agent name
17
+ * const conversations = await base44.agents.listConversations({
18
+ * q: { agent_name: 'support-bot' }
19
+ * });
20
+ * ```
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Filter conversations with sorting
25
+ * const conversations = await base44.agents.listConversations({
26
+ * q: { status: 'active' },
27
+ * sort: '-created_at' // Sort by created_at descending
28
+ * });
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // Filter conversations with pagination
34
+ * const conversations = await base44.agents.listConversations({
35
+ * q: { agent_name: 'support-bot' },
36
+ * limit: 20, // Get 20 results
37
+ * skip: 40 // Skip first 40 (page 3)
38
+ * });
39
+ * ```
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * // Filter conversations with field selection
44
+ * const conversations = await base44.agents.listConversations({
45
+ * q: { status: 'active' },
46
+ * fields: ['id', 'agent_name', 'created_at']
47
+ * });
48
+ * ```
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * // Filter conversations with multiple filters
53
+ * const conversations = await base44.agents.listConversations({
54
+ * q: {
55
+ * agent_name: 'support-bot',
56
+ * 'metadata.priority': 'high',
57
+ * status: 'active'
58
+ * },
59
+ * sort: '-updated_at',
60
+ * limit: 50,
61
+ * skip: 0
62
+ * });
63
+ * ```
64
+ */
65
+ export interface ModelFilterParams {
66
+ q?: Record<string, any>;
67
+ sort?: string | null;
68
+ sort_by?: string | null;
69
+ limit?: number | null;
70
+ skip?: number | null;
71
+ fields?: string[] | null;
72
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./modules/types.js";
@@ -0,0 +1,117 @@
1
+ import { GetAccessTokenOptions, SaveAccessTokenOptions, RemoveAccessTokenOptions, GetLoginUrlOptions } from "./auth-utils.types.js";
2
+ /**
3
+ * Retrieves an access token from URL parameters or local storage.
4
+ *
5
+ * Low-level utility for manually retrieving tokens. In most cases, the Base44 client handles
6
+ * token management automatically. This function is useful for custom authentication flows or when you need direct access to stored tokens. Requires a browser environment and can't be used in the backend.
7
+ *
8
+ * @internal
9
+ *
10
+ * @param options - Configuration options for token retrieval.
11
+ * @returns The access token string if found, null otherwise.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // Get access token from URL or local storage
16
+ * const token = getAccessToken();
17
+ *
18
+ * if (token) {
19
+ * console.log('User is authenticated');
20
+ * } else {
21
+ * console.log('No token found, redirect to login');
22
+ * }
23
+ * ```
24
+ * @example
25
+ * ```typescript
26
+ * // Get access token from custom local storage key
27
+ * const token = getAccessToken({ storageKey: 'my_app_token' });
28
+ * ```
29
+ * @example
30
+ * ```typescript
31
+ * // Get access token from URL but don't save or remove it
32
+ * const token = getAccessToken({
33
+ * saveToStorage: false,
34
+ * removeFromUrl: false
35
+ * });
36
+ * ```
37
+ */
38
+ export declare function getAccessToken(options?: GetAccessTokenOptions): string | null;
39
+ /**
40
+ * Saves an access token to local storage.
41
+ *
42
+ * Low-level utility for manually saving tokens. In most cases, the Base44 client handles token management automatically. This function is useful for custom authentication flows or managing custom tokens. Requires a browser environment and can't be used in the backend.
43
+ *
44
+ * @internal
45
+ *
46
+ * @param token - The access token string to save.
47
+ * @param options - Configuration options for saving the token.
48
+ * @returns Returns`true` if the token was saved successfully, `false` otherwise.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * // Save access token after login
53
+ * const response = await base44.auth.loginViaEmailPassword(email, password);
54
+ * const success = saveAccessToken(response.access_token, {});
55
+ *
56
+ * if (success) {
57
+ * console.log('User is now authenticated');
58
+ * // Token is now available for future page loads
59
+ * }
60
+ * ```
61
+ * @example
62
+ * ```typescript
63
+ * // Save access token to local storage using custom key
64
+ * const success = saveAccessToken(token, {
65
+ * storageKey: `my_custom_token_key`
66
+ * });
67
+ * ```
68
+ */
69
+ export declare function saveAccessToken(token: string, options: SaveAccessTokenOptions): boolean;
70
+ /**
71
+ * Removes the access token from local storage.
72
+ *
73
+ * Low-level utility for manually removing tokens from the browser's local storage. In most cases, the Base44 client handles token management automatically. For standard logout flows, use {@linkcode AuthModule.logout | base44.auth.logout()} instead, which handles token removal and redirects automatically. This function is useful for custom authentication flows or when you need to manually remove tokens. Requires a browser environment and can't be used in the backend.
74
+ *
75
+ * @internal
76
+ *
77
+ * @param options - Configuration options for token removal.
78
+ * @returns Returns `true` if the token was removed successfully, `false` otherwise.
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * // Remove custom token key
83
+ * const success = removeAccessToken({
84
+ * storageKey: 'my_custom_token_key'
85
+ * });
86
+ * ```
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * // Standard logout flow with token removal and redirect
91
+ * base44.auth.logout('/login');
92
+ * ```
93
+ */
94
+ export declare function removeAccessToken(options: RemoveAccessTokenOptions): boolean;
95
+ /**
96
+ * Constructs the absolute URL for the login page with a redirect parameter.
97
+ *
98
+ * Low-level utility for building login URLs. For standard login redirects, use {@linkcode AuthModule.redirectToLogin | base44.auth.redirectToLogin()} instead, which handles this automatically. This function is useful when you need to construct login URLs without a client instance or for custom authentication flows.
99
+ *
100
+ * @internal
101
+ *
102
+ * @param nextUrl - The URL to redirect to after successful login.
103
+ * @param options - Configuration options.
104
+ * @returns The complete login URL with encoded redirect parameters.
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * // Redirect to login page
109
+ * const loginUrl = getLoginUrl('/dashboard', {
110
+ * serverUrl: 'https://base44.app',
111
+ * appId: 'my-app-123'
112
+ * });
113
+ * window.location.href = loginUrl;
114
+ * // User will be redirected back to /dashboard after login
115
+ * ```
116
+ */
117
+ export declare function getLoginUrl(nextUrl: string, options: GetLoginUrlOptions): string;
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Retrieves an access token from URL parameters or local storage.
3
+ *
4
+ * Low-level utility for manually retrieving tokens. In most cases, the Base44 client handles
5
+ * token management automatically. This function is useful for custom authentication flows or when you need direct access to stored tokens. Requires a browser environment and can't be used in the backend.
6
+ *
7
+ * @internal
8
+ *
9
+ * @param options - Configuration options for token retrieval.
10
+ * @returns The access token string if found, null otherwise.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Get access token from URL or local storage
15
+ * const token = getAccessToken();
16
+ *
17
+ * if (token) {
18
+ * console.log('User is authenticated');
19
+ * } else {
20
+ * console.log('No token found, redirect to login');
21
+ * }
22
+ * ```
23
+ * @example
24
+ * ```typescript
25
+ * // Get access token from custom local storage key
26
+ * const token = getAccessToken({ storageKey: 'my_app_token' });
27
+ * ```
28
+ * @example
29
+ * ```typescript
30
+ * // Get access token from URL but don't save or remove it
31
+ * const token = getAccessToken({
32
+ * saveToStorage: false,
33
+ * removeFromUrl: false
34
+ * });
35
+ * ```
36
+ */
37
+ export function getAccessToken(options = {}) {
38
+ const { storageKey = "base44_access_token", paramName = "access_token", saveToStorage = true, removeFromUrl = true, } = options;
39
+ let token = null;
40
+ // Try to get token from URL parameters
41
+ if (typeof window !== "undefined" && window.location) {
42
+ try {
43
+ const urlParams = new URLSearchParams(window.location.search);
44
+ token = urlParams.get(paramName);
45
+ // If token found in URL
46
+ if (token) {
47
+ // Save token to local storage if requested
48
+ if (saveToStorage) {
49
+ saveAccessToken(token, { storageKey });
50
+ }
51
+ // Remove token from URL for security if requested
52
+ if (removeFromUrl) {
53
+ urlParams.delete(paramName);
54
+ const newUrl = `${window.location.pathname}${urlParams.toString() ? `?${urlParams.toString()}` : ""}${window.location.hash}`;
55
+ window.history.replaceState({}, document.title, newUrl);
56
+ }
57
+ return token;
58
+ }
59
+ }
60
+ catch (e) {
61
+ console.error("Error retrieving token from URL:", e);
62
+ }
63
+ }
64
+ // If no token in URL, try local storage
65
+ if (typeof window !== "undefined" && window.localStorage) {
66
+ try {
67
+ token = window.localStorage.getItem(storageKey);
68
+ return token;
69
+ }
70
+ catch (e) {
71
+ console.error("Error retrieving token from local storage:", e);
72
+ }
73
+ }
74
+ return null;
75
+ }
76
+ /**
77
+ * Saves an access token to local storage.
78
+ *
79
+ * Low-level utility for manually saving tokens. In most cases, the Base44 client handles token management automatically. This function is useful for custom authentication flows or managing custom tokens. Requires a browser environment and can't be used in the backend.
80
+ *
81
+ * @internal
82
+ *
83
+ * @param token - The access token string to save.
84
+ * @param options - Configuration options for saving the token.
85
+ * @returns Returns`true` if the token was saved successfully, `false` otherwise.
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * // Save access token after login
90
+ * const response = await base44.auth.loginViaEmailPassword(email, password);
91
+ * const success = saveAccessToken(response.access_token, {});
92
+ *
93
+ * if (success) {
94
+ * console.log('User is now authenticated');
95
+ * // Token is now available for future page loads
96
+ * }
97
+ * ```
98
+ * @example
99
+ * ```typescript
100
+ * // Save access token to local storage using custom key
101
+ * const success = saveAccessToken(token, {
102
+ * storageKey: `my_custom_token_key`
103
+ * });
104
+ * ```
105
+ */
106
+ export function saveAccessToken(token, options) {
107
+ const { storageKey = "base44_access_token" } = options;
108
+ if (typeof window === "undefined" || !window.localStorage || !token) {
109
+ return false;
110
+ }
111
+ try {
112
+ window.localStorage.setItem(storageKey, token);
113
+ // Set "token" that is set by the built-in SDK of platform version 2
114
+ window.localStorage.setItem("token", token);
115
+ return true;
116
+ }
117
+ catch (e) {
118
+ console.error("Error saving token to local storage:", e);
119
+ return false;
120
+ }
121
+ }
122
+ /**
123
+ * Removes the access token from local storage.
124
+ *
125
+ * Low-level utility for manually removing tokens from the browser's local storage. In most cases, the Base44 client handles token management automatically. For standard logout flows, use {@linkcode AuthModule.logout | base44.auth.logout()} instead, which handles token removal and redirects automatically. This function is useful for custom authentication flows or when you need to manually remove tokens. Requires a browser environment and can't be used in the backend.
126
+ *
127
+ * @internal
128
+ *
129
+ * @param options - Configuration options for token removal.
130
+ * @returns Returns `true` if the token was removed successfully, `false` otherwise.
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * // Remove custom token key
135
+ * const success = removeAccessToken({
136
+ * storageKey: 'my_custom_token_key'
137
+ * });
138
+ * ```
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * // Standard logout flow with token removal and redirect
143
+ * base44.auth.logout('/login');
144
+ * ```
145
+ */
146
+ export function removeAccessToken(options) {
147
+ const { storageKey = "base44_access_token" } = options;
148
+ if (typeof window === "undefined" || !window.localStorage) {
149
+ return false;
150
+ }
151
+ try {
152
+ window.localStorage.removeItem(storageKey);
153
+ return true;
154
+ }
155
+ catch (e) {
156
+ console.error("Error removing token from local storage:", e);
157
+ return false;
158
+ }
159
+ }
160
+ /**
161
+ * Constructs the absolute URL for the login page with a redirect parameter.
162
+ *
163
+ * Low-level utility for building login URLs. For standard login redirects, use {@linkcode AuthModule.redirectToLogin | base44.auth.redirectToLogin()} instead, which handles this automatically. This function is useful when you need to construct login URLs without a client instance or for custom authentication flows.
164
+ *
165
+ * @internal
166
+ *
167
+ * @param nextUrl - The URL to redirect to after successful login.
168
+ * @param options - Configuration options.
169
+ * @returns The complete login URL with encoded redirect parameters.
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * // Redirect to login page
174
+ * const loginUrl = getLoginUrl('/dashboard', {
175
+ * serverUrl: 'https://base44.app',
176
+ * appId: 'my-app-123'
177
+ * });
178
+ * window.location.href = loginUrl;
179
+ * // User will be redirected back to /dashboard after login
180
+ * ```
181
+ */
182
+ export function getLoginUrl(nextUrl, options) {
183
+ const { serverUrl, appId, loginPath = "/login" } = options;
184
+ if (!serverUrl || !appId) {
185
+ throw new Error("serverUrl and appId are required to construct login URL");
186
+ }
187
+ const encodedRedirectUrl = encodeURIComponent(nextUrl || (typeof window !== "undefined" ? window.location.href : ""));
188
+ return `${serverUrl}${loginPath}?from_url=${encodedRedirectUrl}&app_id=${appId}`;
189
+ }
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Configuration options for retrieving an access token.
3
+ *
4
+ * @internal
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * // Get access token from URL or local storage using default options
9
+ * const token = getAccessToken();
10
+ * ```
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Get access token from custom local storage key
15
+ * const token = getAccessToken({ storageKey: 'my_app_token' });
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Get token from URL but don't save or remove from URL
21
+ * const token = getAccessToken({
22
+ * saveToStorage: false,
23
+ * removeFromUrl: false
24
+ * });
25
+ * ```
26
+ */
27
+ export interface GetAccessTokenOptions {
28
+ /**
29
+ * The key to use when storing or retrieving the token in local storage.
30
+ * @default 'base44_access_token'
31
+ */
32
+ storageKey?: string;
33
+ /**
34
+ * The URL parameter name to check for the access token.
35
+ * @default 'access_token'
36
+ */
37
+ paramName?: string;
38
+ /**
39
+ * Whether to save the token to local storage if found in the URL.
40
+ * @default true
41
+ */
42
+ saveToStorage?: boolean;
43
+ /**
44
+ * Whether to remove the token from the URL after retrieval for security.
45
+ * @default true
46
+ */
47
+ removeFromUrl?: boolean;
48
+ }
49
+ /**
50
+ * Configuration options for saving an access token.
51
+ *
52
+ * @internal
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * // Use default storage key
57
+ * saveAccessToken('my-token-123', {});
58
+ *
59
+ * // Use custom storage key
60
+ * saveAccessToken('my-token-123', { storageKey: 'my_app_token' });
61
+ * ```
62
+ */
63
+ export interface SaveAccessTokenOptions {
64
+ /**
65
+ * The key to use when storing the token in local storage.
66
+ * @default 'base44_access_token'
67
+ */
68
+ storageKey?: string;
69
+ }
70
+ /**
71
+ * Configuration options for removing an access token.
72
+ *
73
+ * @internal
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * // Remove token from default storage key
78
+ * removeAccessToken({});
79
+ *
80
+ * // Remove token from custom storage key
81
+ * removeAccessToken({ storageKey: 'my_app_token' });
82
+ * ```
83
+ */
84
+ export interface RemoveAccessTokenOptions {
85
+ /**
86
+ * The key to use when removing the token from local storage.
87
+ * @default 'base44_access_token'
88
+ */
89
+ storageKey?: string;
90
+ }
91
+ /**
92
+ * Configuration options for constructing a login URL.
93
+ *
94
+ * @internal
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const loginUrl = getLoginUrl('/dashboard', {
99
+ * serverUrl: 'https://base44.app',
100
+ * appId: 'my-app-123'
101
+ * });
102
+ * // Returns: 'https://base44.app/login?from_url=%2Fdashboard&app_id=my-app-123'
103
+ *
104
+ * // Custom login path
105
+ * const loginUrl = getLoginUrl('/dashboard', {
106
+ * serverUrl: 'https://base44.app',
107
+ * appId: 'my-app-123',
108
+ * loginPath: '/auth/login'
109
+ * });
110
+ * ```
111
+ */
112
+ export interface GetLoginUrlOptions {
113
+ /**
114
+ * The base server URL (e.g., 'https://base44.app').
115
+ */
116
+ serverUrl: string;
117
+ /**
118
+ * The app ID.
119
+ */
120
+ appId: string;
121
+ /**
122
+ * The path to the login endpoint.
123
+ * @default '/login'
124
+ */
125
+ loginPath?: string;
126
+ }
127
+ /**
128
+ * Type definition for getAccessToken function.
129
+ * @internal
130
+ */
131
+ export type GetAccessTokenFunction = (options?: GetAccessTokenOptions) => string | null;
132
+ /**
133
+ * Type definition for saveAccessToken function.
134
+ * @internal
135
+ */
136
+ export type SaveAccessTokenFunction = (token: string, options: SaveAccessTokenOptions) => boolean;
137
+ /**
138
+ * Type definition for removeAccessToken function.
139
+ * @internal
140
+ */
141
+ export type RemoveAccessTokenFunction = (options: RemoveAccessTokenOptions) => boolean;
142
+ /**
143
+ * Type definition for getLoginUrl function.
144
+ * @internal
145
+ */
146
+ export type GetLoginUrlFunction = (nextUrl: string, options: GetLoginUrlOptions) => string;
@@ -0,0 +1 @@
1
+ export {};