@base44-preview/sdk 0.7.10-dev.1beb8e4 → 0.8.0-pr.40.3483989

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
@@ -44,6 +44,9 @@ export declare function createClient(config: {
44
44
  sso: {
45
45
  getAccessToken(userid: string): Promise<import("axios").AxiosResponse<any, any>>;
46
46
  };
47
+ externalAuth: {
48
+ getAccessToken(integrationType: import("./types.js").ExternalAuthIntegrationType): Promise<import("./types.js").ExternalAuthAccessTokenResponse>;
49
+ };
47
50
  functions: {
48
51
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
49
52
  };
@@ -135,6 +138,9 @@ export declare function createClientFromRequest(request: Request): {
135
138
  sso: {
136
139
  getAccessToken(userid: string): Promise<import("axios").AxiosResponse<any, any>>;
137
140
  };
141
+ externalAuth: {
142
+ getAccessToken(integrationType: import("./types.js").ExternalAuthIntegrationType): Promise<import("./types.js").ExternalAuthAccessTokenResponse>;
143
+ };
138
144
  functions: {
139
145
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
140
146
  };
package/dist/client.js CHANGED
@@ -3,6 +3,7 @@ import { createEntitiesModule } from "./modules/entities.js";
3
3
  import { createIntegrationsModule } from "./modules/integrations.js";
4
4
  import { createAuthModule } from "./modules/auth.js";
5
5
  import { createSsoModule } from "./modules/sso.js";
6
+ import { createExternalAuthModule } from "./modules/external-auth.js";
6
7
  import { getAccessToken } from "./utils/auth-utils.js";
7
8
  import { createFunctionsModule } from "./modules/functions.js";
8
9
  import { createAgentsModule } from "./modules/agents.js";
@@ -88,6 +89,7 @@ export function createClient(config) {
88
89
  entities: createEntitiesModule(serviceRoleAxiosClient, appId),
89
90
  integrations: createIntegrationsModule(serviceRoleAxiosClient, appId),
90
91
  sso: createSsoModule(serviceRoleAxiosClient, appId, token),
92
+ externalAuth: createExternalAuthModule(serviceRoleAxiosClient, appId),
91
93
  functions: createFunctionsModule(serviceRoleFunctionsAxiosClient, appId),
92
94
  agents: createAgentsModule({
93
95
  axios: serviceRoleAxiosClient,
@@ -0,0 +1,16 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { ExternalAuthIntegrationType, ExternalAuthAccessTokenResponse } from "./external-auth.types.js";
3
+ /**
4
+ * Creates the External Auth module for the Base44 SDK
5
+ * @param axios - Axios instance (should be service role client)
6
+ * @param appId - Application ID
7
+ * @returns External Auth module
8
+ */
9
+ export declare function createExternalAuthModule(axios: AxiosInstance, appId: string): {
10
+ /**
11
+ * Retrieve an access token for a given integration type
12
+ * @param integrationType - The integration type to get access token for
13
+ * @returns Access token response
14
+ */
15
+ getAccessToken(integrationType: ExternalAuthIntegrationType): Promise<ExternalAuthAccessTokenResponse>;
16
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates the External Auth module for the Base44 SDK
3
+ * @param axios - Axios instance (should be service role client)
4
+ * @param appId - Application ID
5
+ * @returns External Auth module
6
+ */
7
+ export function createExternalAuthModule(axios, appId) {
8
+ return {
9
+ /**
10
+ * Retrieve an access token for a given integration type
11
+ * @param integrationType - The integration type to get access token for
12
+ * @returns Access token response
13
+ */
14
+ async getAccessToken(integrationType) {
15
+ if (!integrationType || typeof integrationType !== "string") {
16
+ throw new Error("Integration type is required and must be a string");
17
+ }
18
+ const response = await axios.get(`/apps/${appId}/external-auth/tokens/${integrationType}`);
19
+ // @ts-expect-error
20
+ return response.access_token;
21
+ },
22
+ };
23
+ }
@@ -0,0 +1,4 @@
1
+ export type ExternalAuthIntegrationType = string;
2
+ export type ExternalAuthAccessTokenResponse = {
3
+ access_token: string;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,3 @@
1
1
  export * from "./app.types.js";
2
2
  export * from "./agents.types.js";
3
+ export * from "./external-auth.types.js";
@@ -1,2 +1,3 @@
1
1
  export * from "./app.types.js";
2
2
  export * from "./agents.types.js";
3
+ export * from "./external-auth.types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.7.10-dev.1beb8e4",
3
+ "version": "0.8.0-pr.40.3483989",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",