@base44-preview/sdk 0.5.0-pr.21.2b7656a → 0.5.0-pr.22.6580e2e

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/client.d.ts CHANGED
@@ -32,15 +32,29 @@ export declare function createClient(config: {
32
32
  asServiceRole: {
33
33
  entities: {};
34
34
  integrations: {};
35
+ sso: {
36
+ getAccessToken(userid: string): Promise<import("axios").AxiosResponse<any, any>>;
37
+ };
35
38
  functions: {
36
39
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
37
40
  };
41
+ auth: {
42
+ me(): Promise<import("axios").AxiosResponse<any, any>>;
43
+ updateMe(data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
44
+ redirectToLogin(nextUrl: string): void;
45
+ logout(redirectUrl?: string): void;
46
+ setToken(token: string, saveToStorage?: boolean): void;
47
+ loginViaEmailPassword(email: string, password: string, turnstileToken?: string): Promise<{
48
+ access_token: string;
49
+ user: any;
50
+ }>;
51
+ isAuthenticated(): Promise<boolean>;
52
+ };
38
53
  };
39
54
  entities: {};
40
55
  integrations: {};
41
56
  auth: {
42
57
  me(): Promise<import("axios").AxiosResponse<any, any>>;
43
- getSsoAccessToken(userid?: string): Promise<import("axios").AxiosResponse<any, any>>;
44
58
  updateMe(data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
45
59
  redirectToLogin(nextUrl: string): void;
46
60
  logout(redirectUrl?: string): void;
@@ -73,15 +87,29 @@ export declare function createClientFromRequest(request: Request): {
73
87
  asServiceRole: {
74
88
  entities: {};
75
89
  integrations: {};
90
+ sso: {
91
+ getAccessToken(userid: string): Promise<import("axios").AxiosResponse<any, any>>;
92
+ };
76
93
  functions: {
77
94
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
78
95
  };
96
+ auth: {
97
+ me(): Promise<import("axios").AxiosResponse<any, any>>;
98
+ updateMe(data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
99
+ redirectToLogin(nextUrl: string): void;
100
+ logout(redirectUrl?: string): void;
101
+ setToken(token: string, saveToStorage?: boolean): void;
102
+ loginViaEmailPassword(email: string, password: string, turnstileToken?: string): Promise<{
103
+ access_token: string;
104
+ user: any;
105
+ }>;
106
+ isAuthenticated(): Promise<boolean>;
107
+ };
79
108
  };
80
109
  entities: {};
81
110
  integrations: {};
82
111
  auth: {
83
112
  me(): Promise<import("axios").AxiosResponse<any, any>>;
84
- getSsoAccessToken(userid?: string): Promise<import("axios").AxiosResponse<any, any>>;
85
113
  updateMe(data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
86
114
  redirectToLogin(nextUrl: string): void;
87
115
  logout(redirectUrl?: string): void;
package/dist/client.js CHANGED
@@ -2,6 +2,7 @@ import { createAxiosClient } from "./utils/axios-client.js";
2
2
  import { createEntitiesModule } from "./modules/entities.js";
3
3
  import { createIntegrationsModule } from "./modules/integrations.js";
4
4
  import { createAuthModule } from "./modules/auth.js";
5
+ import { createSsoModule } from "./modules/sso.js";
5
6
  import { getAccessToken } from "./utils/auth-utils.js";
6
7
  import { createFunctionsModule } from "./modules/functions.js";
7
8
  /**
@@ -65,7 +66,9 @@ export function createClient(config) {
65
66
  const serviceRoleModules = {
66
67
  entities: createEntitiesModule(serviceRoleAxiosClient, appId),
67
68
  integrations: createIntegrationsModule(serviceRoleAxiosClient, appId),
69
+ sso: createSsoModule(serviceRoleAxiosClient, appId),
68
70
  functions: createFunctionsModule(serviceRoleFunctionsAxiosClient, appId),
71
+ auth: createAuthModule(axiosClient, functionsAxiosClient, appId),
69
72
  };
70
73
  // Always try to get token from localStorage or URL parameters
71
74
  if (typeof window !== "undefined") {
@@ -12,12 +12,6 @@ export declare function createAuthModule(axios: AxiosInstance, functionsAxiosCli
12
12
  * @returns {Promise<Object>} Current user data
13
13
  */
14
14
  me(): Promise<import("axios").AxiosResponse<any, any>>;
15
- /**
16
- * Get current user sso access token
17
- * @param {string} [userid] - Optional user ID to include as URL parameter
18
- * @returns {Promise<Object>} Current user sso access_token
19
- */
20
- getSsoAccessToken(userid?: string): Promise<import("axios").AxiosResponse<any, any>>;
21
15
  /**
22
16
  * Update current user data
23
17
  * @param {Object} data - Updated user data
@@ -14,16 +14,6 @@ export function createAuthModule(axios, functionsAxiosClient, appId) {
14
14
  async me() {
15
15
  return axios.get(`/apps/${appId}/entities/User/me`);
16
16
  },
17
- /**
18
- * Get current user sso access token
19
- * @param {string} [userid] - Optional user ID to include as URL parameter
20
- * @returns {Promise<Object>} Current user sso access_token
21
- */
22
- async getSsoAccessToken(userid) {
23
- const url = `/apps/${appId}/auth/sso/accesstoken`;
24
- const params = userid ? { userid } : {};
25
- return axios.get(url, { params });
26
- },
27
17
  /**
28
18
  * Update current user data
29
19
  * @param {Object} data - Updated user data
@@ -0,0 +1,15 @@
1
+ import { AxiosInstance } from "axios";
2
+ /**
3
+ * Creates the SSO module for the Base44 SDK
4
+ * @param {import('axios').AxiosInstance} axios - Axios instance
5
+ * @param {string} appId - Application ID
6
+ * @returns {Object} SSO module with SSO authentication methods
7
+ */
8
+ export declare function createSsoModule(axios: AxiosInstance, appId: string): {
9
+ /**
10
+ * Get current user sso access token
11
+ * @param {string} userid - User ID to include as path parameter
12
+ * @returns {Promise<Object>} Current user sso access_token
13
+ */
14
+ getAccessToken(userid: string): Promise<import("axios").AxiosResponse<any, any>>;
15
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Creates the SSO module for the Base44 SDK
3
+ * @param {import('axios').AxiosInstance} axios - Axios instance
4
+ * @param {string} appId - Application ID
5
+ * @returns {Object} SSO module with SSO authentication methods
6
+ */
7
+ export function createSsoModule(axios, appId) {
8
+ return {
9
+ /**
10
+ * Get current user sso access token
11
+ * @param {string} userid - User ID to include as path parameter
12
+ * @returns {Promise<Object>} Current user sso access_token
13
+ */
14
+ async getAccessToken(userid) {
15
+ const url = `/apps/${appId}/auth/sso/accesstoken/${userid}`;
16
+ return axios.get(url);
17
+ },
18
+ };
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.5.0-pr.21.2b7656a",
3
+ "version": "0.5.0-pr.22.6580e2e",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",