@blinkdotnew/sdk 0.18.6 → 0.18.8

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
@@ -187,8 +187,7 @@ const blink = createClient({
187
187
  auth: { mode: 'managed' } // Manual token management
188
188
  })
189
189
 
190
- // Set JWT manually
191
- blink.auth.setToken(jwtFromHeader)
190
+ // Token injection is only needed when calling blink.auth.* methods on the server
192
191
  ```
193
192
 
194
193
  ## 📖 API Reference
@@ -235,6 +234,22 @@ const user = await blink.auth.signInWithGitHub()
235
234
  const user = await blink.auth.signInWithApple()
236
235
  const user = await blink.auth.signInWithMicrosoft()
237
236
 
237
+ // ✅ Store custom signup fields inside metadata
238
+ await blink.auth.signUp({
239
+ email: 'founder@example.com',
240
+ password: 'SuperSecret123',
241
+ displayName: 'Alex Founder',
242
+ role: 'operations',
243
+ metadata: {
244
+ company: 'Acme Freight',
245
+ marketingConsent: true
246
+ }
247
+ })
248
+ // `displayName`, `avatar`, and `role` map to dedicated auth columns.
249
+ // Everything else goes into auth.users.metadata automatically.
250
+ // Keep custom fields in metadata or your own profile table—avoid adding NOT NULL
251
+ // columns directly to auth tables.
252
+
238
253
  // Magic links (passwordless)
239
254
  await blink.auth.sendMagicLink(email)
240
255
 
@@ -427,6 +442,8 @@ function EditButton() {
427
442
 
428
443
  #### Core Methods
429
444
 
445
+ > ⚠️ Tokens are managed automatically for Blink APIs. Use `getValidToken()` only if you must manually pass a token to your own backend or third-party services.
446
+
430
447
  ```typescript
431
448
  // User management
432
449
  const user = await blink.auth.me()
@@ -435,6 +452,7 @@ await blink.auth.updateMe({ displayName: 'New Name' })
435
452
  // Token management
436
453
  blink.auth.setToken(jwt, persist?)
437
454
  const isAuth = blink.auth.isAuthenticated()
455
+ const token = await blink.auth.getValidToken() // Get valid token (auto-refreshes)
438
456
 
439
457
  // Password management
440
458
  await blink.auth.sendPasswordResetEmail('user@example.com')
@@ -2356,9 +2374,6 @@ const blink = createClient({
2356
2374
  })
2357
2375
 
2358
2376
  export default async function handler(req, res) {
2359
- const jwt = req.headers.authorization?.replace('Bearer ', '')
2360
- blink.auth.setToken(jwt)
2361
-
2362
2377
  const todos = await blink.db.todos.list()
2363
2378
  res.json(todos)
2364
2379
  }
@@ -2376,9 +2391,6 @@ const blink = createClient({
2376
2391
  })
2377
2392
 
2378
2393
  Deno.serve(async (req) => {
2379
- const jwt = req.headers.get('authorization')?.replace('Bearer ', '')
2380
- blink.auth.setToken(jwt)
2381
-
2382
2394
  const todos = await blink.db.todos.list()
2383
2395
  return Response.json(todos)
2384
2396
  })
package/dist/index.js CHANGED
@@ -4850,11 +4850,7 @@ function createClient(config) {
4850
4850
  if (!config.projectId) {
4851
4851
  throw new Error("projectId is required");
4852
4852
  }
4853
- const clientConfig = {
4854
- authRequired: true,
4855
- ...config
4856
- };
4857
- return new BlinkClientImpl(clientConfig);
4853
+ return new BlinkClientImpl(config);
4858
4854
  }
4859
4855
 
4860
4856
  exports.BlinkAIImpl = BlinkAIImpl;
package/dist/index.mjs CHANGED
@@ -4848,11 +4848,7 @@ function createClient(config) {
4848
4848
  if (!config.projectId) {
4849
4849
  throw new Error("projectId is required");
4850
4850
  }
4851
- const clientConfig = {
4852
- authRequired: true,
4853
- ...config
4854
- };
4855
- return new BlinkClientImpl(clientConfig);
4851
+ return new BlinkClientImpl(config);
4856
4852
  }
4857
4853
 
4858
4854
  export { BlinkAIImpl, BlinkAnalyticsImpl, BlinkDataImpl, BlinkDatabase, BlinkRealtimeChannel, BlinkRealtimeImpl, BlinkStorageImpl, BlinkTable, createClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/sdk",
3
- "version": "0.18.6",
3
+ "version": "0.18.8",
4
4
  "description": "Blink TypeScript SDK for client-side applications - Zero-boilerplate CRUD + auth + AI + analytics + notifications for modern SaaS/AI apps",
5
5
  "keywords": [
6
6
  "blink",