@blinkdotnew/sdk 0.7.0 → 0.7.1

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/README.md CHANGED
@@ -107,6 +107,7 @@ This SDK powers every Blink-generated app with:
107
107
  - **🤖 AI**: Text generation with web search, object generation, image creation, speech synthesis, and transcription
108
108
  - **📄 Data**: Extract text content from documents, secure API proxy with secret substitution, web scraping, screenshots, and web search
109
109
  - **📁 Storage**: File upload, download, and management
110
+ - **📧 Notifications**: Email sending with attachments, custom branding, and delivery tracking
110
111
  - **⚡ Realtime**: WebSocket-based pub/sub messaging, presence tracking, and live updates
111
112
  - **🌐 Universal**: Works on client-side and server-side
112
113
  - **📱 Framework Agnostic**: React, Vue, Svelte, vanilla JS, Node.js, Deno
@@ -499,6 +500,56 @@ const { publicUrl } = await blink.storage.upload(
499
500
  await blink.storage.remove('file1.jpg', 'file2.jpg')
500
501
  ```
501
502
 
503
+ ### Notifications Operations
504
+
505
+ ```typescript
506
+ // Send a simple email
507
+ const { success, messageId } = await blink.notifications.email({
508
+ to: 'customer@example.com',
509
+ subject: 'Your order has shipped!',
510
+ html: '<h1>Order Confirmation</h1><p>Your order #12345 is on its way.</p>'
511
+ })
512
+
513
+ // Send an email with attachments and custom sender
514
+ const { success } = await blink.notifications.email({
515
+ to: ['team@example.com', 'manager@example.com'],
516
+ from: 'Blink Invoicing', // Custom sender name
517
+ replyTo: 'support@example.com',
518
+ subject: 'New Invoice',
519
+ html: '<p>Please find the invoice attached.</p>',
520
+ text: 'Please find the invoice attached.', // Plain text fallback
521
+ cc: 'manager@example.com',
522
+ bcc: 'archive@example.com',
523
+ attachments: [
524
+ {
525
+ url: 'https://example.com/invoice.pdf',
526
+ filename: 'invoice.pdf',
527
+ type: 'application/pdf'
528
+ }
529
+ ]
530
+ })
531
+
532
+ // Send to multiple recipients
533
+ const { success } = await blink.notifications.email({
534
+ to: ['user1@example.com', 'user2@example.com'],
535
+ subject: 'Team Update',
536
+ html: '<h2>Weekly Update</h2><p>Here are this week\'s highlights...</p>'
537
+ })
538
+
539
+ // Error handling
540
+ try {
541
+ await blink.notifications.email({
542
+ to: 'customer@example.com',
543
+ subject: 'Welcome!',
544
+ html: '<p>Welcome to our service!</p>'
545
+ })
546
+ } catch (error) {
547
+ if (error instanceof BlinkNotificationsError) {
548
+ console.error('Failed to send email:', error.message)
549
+ }
550
+ }
551
+ ```
552
+
502
553
  ### Realtime Operations
503
554
 
504
555
  ```typescript
@@ -1045,36 +1096,4 @@ MIT © Blink Team
1045
1096
 
1046
1097
  **Made with ❤️ by the Blink team**
1047
1098
 
1048
- 🤖 **Ready to build your next app?** Visit [blink.new](https://blink.new) and let our AI create it for you in seconds!
1049
-
1050
- ### Notifications (NEW!)
1051
-
1052
- ```typescript
1053
- // Send a simple email
1054
- const { success, messageId } = await blink.notifications.email({
1055
- to: 'customer@example.com',
1056
- subject: 'Your order has shipped!',
1057
- html: '<h1>Order Confirmation</h1><p>Your order #12345 is on its way.</p>'
1058
- });
1059
-
1060
- // Send an email with attachments, a custom 'from' name, and a 'replyTo' address
1061
- const { success } = await blink.notifications.email({
1062
- to: ['team@example.com', 'manager@example.com'],
1063
- from: 'Blink Invoicing', // Displays as: "Blink Invoicing" <noreply@project.blink-email.com>
1064
- replyTo: 'support@example.com',
1065
- subject: 'New Invoice',
1066
- html: '<p>Please find the invoice attached.</p>',
1067
- attachments: [
1068
- { url: 'https://example.com/invoice.pdf', filename: 'invoice.pdf' }
1069
- ]
1070
- });
1071
-
1072
- // Handle errors
1073
- try {
1074
- await blink.notifications.email({ to: 'invalid-email' });
1075
- } catch (error) {
1076
- if (error instanceof BlinkNotificationsError) {
1077
- console.error('Failed to send email:', error.message);
1078
- }
1079
- }
1080
- ```
1099
+ 🤖 **Ready to build your next app?** Visit [blink.new](https://blink.new) and let our AI create it for you in seconds!
package/dist/index.js CHANGED
@@ -60,6 +60,10 @@ var BlinkRealtimeError = class extends BlinkError {
60
60
  }
61
61
  };
62
62
  var BlinkNotificationsError = class extends BlinkError {
63
+ constructor(message, status, details) {
64
+ super(message, "NOTIFICATIONS_ERROR", status, details);
65
+ this.name = "BlinkNotificationsError";
66
+ }
63
67
  };
64
68
 
65
69
  // ../core/src/query-builder.ts
@@ -2871,7 +2875,7 @@ var BlinkNotificationsImpl = class {
2871
2875
  throw error;
2872
2876
  }
2873
2877
  const errorMessage = error.response?.data?.error?.message || error.message || "An unknown error occurred";
2874
- throw new BlinkNotificationsError(`Failed to send email: ${errorMessage}`, error.response?.data?.error);
2878
+ throw new BlinkNotificationsError(`Failed to send email: ${errorMessage}`, error.response?.status, error.response?.data?.error);
2875
2879
  }
2876
2880
  }
2877
2881
  };
package/dist/index.mjs CHANGED
@@ -58,6 +58,10 @@ var BlinkRealtimeError = class extends BlinkError {
58
58
  }
59
59
  };
60
60
  var BlinkNotificationsError = class extends BlinkError {
61
+ constructor(message, status, details) {
62
+ super(message, "NOTIFICATIONS_ERROR", status, details);
63
+ this.name = "BlinkNotificationsError";
64
+ }
61
65
  };
62
66
 
63
67
  // ../core/src/query-builder.ts
@@ -2869,7 +2873,7 @@ var BlinkNotificationsImpl = class {
2869
2873
  throw error;
2870
2874
  }
2871
2875
  const errorMessage = error.response?.data?.error?.message || error.message || "An unknown error occurred";
2872
- throw new BlinkNotificationsError(`Failed to send email: ${errorMessage}`, error.response?.data?.error);
2876
+ throw new BlinkNotificationsError(`Failed to send email: ${errorMessage}`, error.response?.status, error.response?.data?.error);
2873
2877
  }
2874
2878
  }
2875
2879
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blinkdotnew/sdk",
3
- "version": "0.7.0",
4
- "description": "Blink TypeScript SDK for client-side applications - Zero-boilerplate CRUD + auth for modern SaaS/AI apps",
3
+ "version": "0.7.1",
4
+ "description": "Blink TypeScript SDK for client-side applications - Zero-boilerplate CRUD + auth + AI + notifications for modern SaaS/AI apps",
5
5
  "keywords": [
6
6
  "blink",
7
7
  "sdk",
@@ -10,6 +10,8 @@
10
10
  "database",
11
11
  "ai",
12
12
  "storage",
13
+ "notifications",
14
+ "email",
13
15
  "crud",
14
16
  "client"
15
17
  ],