@base44-preview/sdk 0.8.17-pr.73.3aab597 → 0.8.17-pr.73.e88f2f7
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.js +1 -0
- package/dist/modules/mobile.js +18 -0
- package/dist/modules/mobile.types.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
package/dist/modules/mobile.js
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides mobile native capabilities like push notifications.
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Validates notification parameters against character limits.
|
|
8
|
+
* @param params - Notification parameters to validate
|
|
9
|
+
* @throws Error if any parameter exceeds its limit
|
|
10
|
+
*/
|
|
11
|
+
function validateNotificationParams(params) {
|
|
12
|
+
if (params.title.length > 100) {
|
|
13
|
+
throw new Error(`Title must be 100 characters or less (current: ${params.title.length})`);
|
|
14
|
+
}
|
|
15
|
+
if (params.content.length > 500) {
|
|
16
|
+
throw new Error(`Content must be 500 characters or less (current: ${params.content.length})`);
|
|
17
|
+
}
|
|
18
|
+
if (params.actionLabel && params.actionLabel.length > 50) {
|
|
19
|
+
throw new Error(`Action label must be 50 characters or less (current: ${params.actionLabel.length})`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
6
22
|
/**
|
|
7
23
|
* Creates the mobile module for the Base44 SDK.
|
|
8
24
|
*
|
|
@@ -14,6 +30,8 @@
|
|
|
14
30
|
export function createMobileModule(axios, appId) {
|
|
15
31
|
return {
|
|
16
32
|
async sendNotification(params) {
|
|
33
|
+
// Validate input parameters
|
|
34
|
+
validateNotificationParams(params);
|
|
17
35
|
const response = await axios.post(`/api/apps/${appId}/mobile/notifications`, params);
|
|
18
36
|
return response.data;
|
|
19
37
|
},
|
|
@@ -27,7 +27,7 @@ export interface SendNotificationParams {
|
|
|
27
27
|
/** Optional list of channels. If not specified, uses all channels (mobile_push + in_app) */
|
|
28
28
|
channels?: NotificationChannel[];
|
|
29
29
|
/** Optional custom metadata */
|
|
30
|
-
metadata?: Record<string,
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Result from a single notification channel.
|