@base44/sdk 0.4.0 → 0.6.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/client.d.ts CHANGED
@@ -32,6 +32,9 @@ 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
  };
@@ -40,12 +43,11 @@ export declare function createClient(config: {
40
43
  integrations: {};
41
44
  auth: {
42
45
  me(): Promise<import("axios").AxiosResponse<any, any>>;
43
- getSsoAccessToken(): Promise<import("axios").AxiosResponse<any, any>>;
44
46
  updateMe(data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
45
47
  redirectToLogin(nextUrl: string): void;
46
48
  logout(redirectUrl?: string): void;
47
49
  setToken(token: string, saveToStorage?: boolean): void;
48
- loginViaUsernamePassword(email: string, password: string, turnstileToken?: string): Promise<{
50
+ loginViaEmailPassword(email: string, password: string, turnstileToken?: string): Promise<{
49
51
  access_token: string;
50
52
  user: any;
51
53
  }>;
@@ -73,6 +75,9 @@ export declare function createClientFromRequest(request: Request): {
73
75
  asServiceRole: {
74
76
  entities: {};
75
77
  integrations: {};
78
+ sso: {
79
+ getAccessToken(userid: string): Promise<import("axios").AxiosResponse<any, any>>;
80
+ };
76
81
  functions: {
77
82
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
78
83
  };
@@ -81,12 +86,11 @@ export declare function createClientFromRequest(request: Request): {
81
86
  integrations: {};
82
87
  auth: {
83
88
  me(): Promise<import("axios").AxiosResponse<any, any>>;
84
- getSsoAccessToken(): Promise<import("axios").AxiosResponse<any, any>>;
85
89
  updateMe(data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
86
90
  redirectToLogin(nextUrl: string): void;
87
91
  logout(redirectUrl?: string): void;
88
92
  setToken(token: string, saveToStorage?: boolean): void;
89
- loginViaUsernamePassword(email: string, password: string, turnstileToken?: string): Promise<{
93
+ loginViaEmailPassword(email: string, password: string, turnstileToken?: string): Promise<{
90
94
  access_token: string;
91
95
  user: any;
92
96
  }>;
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,6 +66,7 @@ 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),
69
71
  };
70
72
  // Always try to get token from localStorage or URL parameters
@@ -12,11 +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
- * @returns {Promise<Object>} Current user sso access_token
18
- */
19
- getSsoAccessToken(): Promise<import("axios").AxiosResponse<any, any>>;
20
15
  /**
21
16
  * Update current user data
22
17
  * @param {Object} data - Updated user data
@@ -49,7 +44,7 @@ export declare function createAuthModule(axios: AxiosInstance, functionsAxiosCli
49
44
  * @param turnstileToken - Optional Turnstile captcha token
50
45
  * @returns Login response with access_token and user
51
46
  */
52
- loginViaUsernamePassword(email: string, password: string, turnstileToken?: string): Promise<{
47
+ loginViaEmailPassword(email: string, password: string, turnstileToken?: string): Promise<{
53
48
  access_token: string;
54
49
  user: any;
55
50
  }>;
@@ -14,13 +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
- * @returns {Promise<Object>} Current user sso access_token
20
- */
21
- async getSsoAccessToken() {
22
- return axios.get(`/apps/${appId}/auth/sso/accesstoken`);
23
- },
24
17
  /**
25
18
  * Update current user data
26
19
  * @param {Object} data - Updated user data
@@ -103,7 +96,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId) {
103
96
  * @param turnstileToken - Optional Turnstile captcha token
104
97
  * @returns Login response with access_token and user
105
98
  */
106
- async loginViaUsernamePassword(email, password, turnstileToken) {
99
+ async loginViaEmailPassword(email, password, turnstileToken) {
107
100
  var _a;
108
101
  try {
109
102
  const response = await axios.post(`/apps/${appId}/auth/login`, {
@@ -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/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",