@base44-preview/sdk 0.8.43-pr.260.d28232f → 0.8.44-pr.260.59c4ba5

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.
@@ -134,12 +134,15 @@ export interface AuthModule {
134
134
  /**
135
135
  * Updates the current authenticated user's information.
136
136
  *
137
- * You can update `role` and any [custom fields](/developers/backend/resources/entities/user-schema#custom-fields) defined in your
138
- * User entity schema.
139
- * The `role` value must be either `'user'` or `'admin'`.
137
+ * You can update any [custom fields](/developers/backend/resources/entities/user-schema#custom-fields)
138
+ * defined in your User entity schema.
139
+ *
140
+ * Updating `role` requires editor access on the app.
141
+ *
140
142
  * <Note>
141
- * The following fields are read-only and can't be changed with this method:
142
- * `id`, `email`, `full_name`, `created_date`, `updated_date`, and `created_by`.
143
+ * These fields can't be changed with this method:
144
+ * `id`, `email`, `full_name`, `created_date`, `updated_date`, `created_by`,
145
+ * and `collaborator_role`.
143
146
  * </Note>
144
147
  *
145
148
  * @param data - Object containing the fields to update.
@@ -147,9 +150,8 @@ export interface AuthModule {
147
150
  *
148
151
  * @example
149
152
  * ```typescript
150
- * // Update role and custom fields defined in your User entity
153
+ * // Update custom fields defined in your User entity
151
154
  * await base44.auth.updateMe({
152
- * role: 'admin',
153
155
  * bio: 'Software developer',
154
156
  * preferences: { theme: 'dark' }
155
157
  * });
@@ -25,7 +25,7 @@ export function createConnectorsModule(axios, appId) {
25
25
  if (!integrationType || typeof integrationType !== "string") {
26
26
  throw new Error("Integration type is required and must be a string");
27
27
  }
28
- const response = await axios.get(`/apps/${appId}/external-auth/tokens/${integrationType}`);
28
+ const response = await axios.get(`/apps/${appId}/external-auth/tokens/${encodeURIComponent(integrationType)}`);
29
29
  // @ts-expect-error
30
30
  return response.access_token;
31
31
  },
@@ -34,7 +34,7 @@ export function createConnectorsModule(axios, appId) {
34
34
  if (!integrationType || typeof integrationType !== "string") {
35
35
  throw new Error("Integration type is required and must be a string");
36
36
  }
37
- const response = await axios.get(`/apps/${appId}/external-auth/tokens/${integrationType}`);
37
+ const response = await axios.get(`/apps/${appId}/external-auth/tokens/${encodeURIComponent(integrationType)}`);
38
38
  const data = response;
39
39
  return {
40
40
  accessToken: data.access_token,
@@ -46,7 +46,7 @@ export function createConnectorsModule(axios, appId) {
46
46
  if (!connectorId || typeof connectorId !== "string") {
47
47
  throw new Error("Connector ID is required and must be a string");
48
48
  }
49
- const response = await axios.get(`/apps/${appId}/external-auth/tokens/connectors/${connectorId}`);
49
+ const response = await axios.get(`/apps/${appId}/external-auth/tokens/connectors/${encodeURIComponent(connectorId)}`);
50
50
  const data = response;
51
51
  return {
52
52
  accessToken: data.access_token,
@@ -60,7 +60,7 @@ export function createConnectorsModule(axios, appId) {
60
60
  if (!connectorId || typeof connectorId !== "string") {
61
61
  throw new Error("Connector ID is required and must be a string");
62
62
  }
63
- const response = await axios.get(`/apps/${appId}/app-user-auth/connectors/${connectorId}/token`);
63
+ const response = await axios.get(`/apps/${appId}/app-user-auth/connectors/${encodeURIComponent(connectorId)}/token`);
64
64
  const data = response;
65
65
  return data.access_token;
66
66
  },
@@ -69,7 +69,7 @@ export function createConnectorsModule(axios, appId) {
69
69
  if (!connectorId || typeof connectorId !== "string") {
70
70
  throw new Error("Connector ID is required and must be a string");
71
71
  }
72
- const response = await axios.get(`/apps/${appId}/app-user-auth/connectors/${connectorId}/token`);
72
+ const response = await axios.get(`/apps/${appId}/app-user-auth/connectors/${encodeURIComponent(connectorId)}/token`);
73
73
  const data = response;
74
74
  return {
75
75
  accessToken: data.access_token,
@@ -78,7 +78,9 @@ export function createConnectorsModule(axios, appId) {
78
78
  },
79
79
  async callApi(integrationType, request) {
80
80
  assertNonEmptyString(integrationType, "Integration type");
81
- return proxyCall(axios, `/apps/${appId}/connectors/${integrationType}/call`, request);
81
+ // Encoded so a runtime-built identifier can only ever select a
82
+ // connector, never re-target another route under this token.
83
+ return proxyCall(axios, `/apps/${appId}/connectors/${encodeURIComponent(integrationType)}/call`, request);
82
84
  },
83
85
  };
84
86
  }
@@ -108,9 +110,9 @@ async function proxyCall(axios, url, request) {
108
110
  }
109
111
  const response = await axios.post(url, {
110
112
  method,
111
- // Omitted rather than sent as null so the proxy applies the connector's
112
- // declared default host.
113
- ...(request.host === undefined ? {} : { host: request.host }),
113
+ // Omitted when unset (undefined or null, since untyped callers write
114
+ // either) so the proxy applies the connector's declared default host.
115
+ ...(request.host == null ? {} : { host: request.host }),
114
116
  path: request.path,
115
117
  query: (_b = request.query) !== null && _b !== void 0 ? _b : {},
116
118
  headers: (_c = request.headers) !== null && _c !== void 0 ? _c : {},
@@ -142,7 +144,7 @@ export function createUserConnectorsModule(axios, appId) {
142
144
  if (!connectorId || typeof connectorId !== "string") {
143
145
  throw new Error("Connector ID is required and must be a string");
144
146
  }
145
- const response = await axios.post(`/apps/${appId}/app-user-auth/connectors/${connectorId}/initiate`);
147
+ const response = await axios.post(`/apps/${appId}/app-user-auth/connectors/${encodeURIComponent(connectorId)}/initiate`);
146
148
  const data = response;
147
149
  return data.redirect_url;
148
150
  },
@@ -150,7 +152,7 @@ export function createUserConnectorsModule(axios, appId) {
150
152
  if (!connectorId || typeof connectorId !== "string") {
151
153
  throw new Error("Connector ID is required and must be a string");
152
154
  }
153
- await axios.delete(`/apps/${appId}/app-user-auth/connectors/${connectorId}`);
155
+ await axios.delete(`/apps/${appId}/app-user-auth/connectors/${encodeURIComponent(connectorId)}`);
154
156
  },
155
157
  };
156
158
  }
@@ -89,7 +89,7 @@ export interface ConnectorApiResponse<T = unknown> {
89
89
  * The parsed upstream response body, or proxy error details when no response
90
90
  * was received. `null` when the response was binary — see {@link dataBase64}.
91
91
  */
92
- data: T;
92
+ data: T | null;
93
93
  /**
94
94
  * The response body base64-encoded, for the media types the connector declares
95
95
  * as binary (images, PDFs). Set instead of {@link data}, never alongside it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.43-pr.260.d28232f",
3
+ "version": "0.8.44-pr.260.59c4ba5",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",