create-instant-app 0.22.167 → 0.22.168

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-instant-app",
3
- "version": "0.22.167",
3
+ "version": "0.22.168",
4
4
  "description": "Scaffold a new web/mobile app with InstantDB",
5
5
  "homepage": "https://github.com/instantdb/instant/tree/main/client/packages/create-instant-app",
6
6
  "repository": {
@@ -36,9 +36,9 @@
36
36
  "ora": "6.3.1",
37
37
  "slugify": "^1.6.6",
38
38
  "sort-package-json": "^2.10.0",
39
- "@instantdb/version": "0.22.167",
40
- "@instantdb/platform": "0.22.167",
41
- "instant-cli": "0.22.167"
39
+ "@instantdb/version": "0.22.168",
40
+ "@instantdb/platform": "0.22.168",
41
+ "instant-cli": "0.22.168"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@anthropic-ai/sdk": "^0.60.0",
@@ -176,9 +176,11 @@ data.ref(someVar + '.members.id')
176
176
  ## $users Permissions
177
177
 
178
178
  - Default `view` permission is `auth.id == data.id`
179
- - Default `create`, `update`, and `delete` permissions is false
180
- - Can override `view` and `update`
181
- - Cannot override `create` or `delete`
179
+ - Default `update` and `delete` permissions is false
180
+ - Default `create` permission is true (anyone can sign up)
181
+ - Can override `view`, `update`, and `create`
182
+ - Cannot override `delete`
183
+ - The `create` rule runs during auth signup flows (not via `transact`). Use it to restrict signups or validate `extraFields`.
182
184
 
183
185
  ## $files Permissions
184
186
 
@@ -277,6 +279,30 @@ function App() {
277
279
  }
278
280
  ```
279
281
 
282
+ ## Set custom properties at signup with `extraFields`
283
+
284
+ Pass `extraFields` to any sign-in method to write custom `$users` properties atomically on user creation.
285
+ Fields must be defined as optional attrs on `$users` in your schema.
286
+ Use the `created` boolean to scaffold data for new users.
287
+
288
+ ```tsx
289
+ // Set properties at signup
290
+ const { user, created } = await db.auth.signInWithMagicCode({
291
+ email,
292
+ code,
293
+ extraFields: { nickname, createdAt: Date.now() },
294
+ });
295
+
296
+ // Scaffold data for new users
297
+ if (created) {
298
+ db.transact([
299
+ db.tx.settings[id()]
300
+ .update({ theme: 'light', notifications: true })
301
+ .link({ user: user.id }),
302
+ ]);
303
+ }
304
+ ```
305
+
280
306
  # Ad-hoc queries from the CLI
281
307
 
282
308
  Run `npx instant-cli query '{ posts: {} }' --admin` to query your app. A context flag is required: `--admin`, `--as-email <email>`, or `--as-guest`. Also supports `--app <id>`.
@@ -182,9 +182,11 @@ data.ref(someVar + '.members.id')
182
182
  ## $users Permissions
183
183
 
184
184
  - Default `view` permission is `auth.id == data.id`
185
- - Default `create`, `update`, and `delete` permissions is false
186
- - Can override `view` and `update`
187
- - Cannot override `create` or `delete`
185
+ - Default `update` and `delete` permissions is false
186
+ - Default `create` permission is true (anyone can sign up)
187
+ - Can override `view`, `update`, and `create`
188
+ - Cannot override `delete`
189
+ - The `create` rule runs during auth signup flows (not via `transact`). Use it to restrict signups or validate `extraFields`.
188
190
 
189
191
  ## $files Permissions
190
192
 
@@ -283,6 +285,30 @@ function App() {
283
285
  }
284
286
  ```
285
287
 
288
+ ## Set custom properties at signup with `extraFields`
289
+
290
+ Pass `extraFields` to any sign-in method to write custom `$users` properties atomically on user creation.
291
+ Fields must be defined as optional attrs on `$users` in your schema.
292
+ Use the `created` boolean to scaffold data for new users.
293
+
294
+ ```tsx
295
+ // Set properties at signup
296
+ const { user, created } = await db.auth.signInWithMagicCode({
297
+ email,
298
+ code,
299
+ extraFields: { nickname, createdAt: Date.now() },
300
+ });
301
+
302
+ // Scaffold data for new users
303
+ if (created) {
304
+ db.transact([
305
+ db.tx.settings[id()]
306
+ .update({ theme: 'light', notifications: true })
307
+ .link({ user: user.id }),
308
+ ]);
309
+ }
310
+ ```
311
+
286
312
  # Ad-hoc queries from the CLI
287
313
 
288
314
  Run `npx instant-cli query '{ posts: {} }' --admin` to query your app. A context flag is required: `--admin`, `--as-email <email>`, or `--as-guest`. Also supports `--app <id>`.
@@ -182,9 +182,11 @@ data.ref(someVar + '.members.id')
182
182
  ## $users Permissions
183
183
 
184
184
  - Default `view` permission is `auth.id == data.id`
185
- - Default `create`, `update`, and `delete` permissions is false
186
- - Can override `view` and `update`
187
- - Cannot override `create` or `delete`
185
+ - Default `update` and `delete` permissions is false
186
+ - Default `create` permission is true (anyone can sign up)
187
+ - Can override `view`, `update`, and `create`
188
+ - Cannot override `delete`
189
+ - The `create` rule runs during auth signup flows (not via `transact`). Use it to restrict signups or validate `extraFields`.
188
190
 
189
191
  ## $files Permissions
190
192
 
@@ -283,6 +285,30 @@ function App() {
283
285
  }
284
286
  ```
285
287
 
288
+ ## Set custom properties at signup with `extraFields`
289
+
290
+ Pass `extraFields` to any sign-in method to write custom `$users` properties atomically on user creation.
291
+ Fields must be defined as optional attrs on `$users` in your schema.
292
+ Use the `created` boolean to scaffold data for new users.
293
+
294
+ ```tsx
295
+ // Set properties at signup
296
+ const { user, created } = await db.auth.signInWithMagicCode({
297
+ email,
298
+ code,
299
+ extraFields: { nickname, createdAt: Date.now() },
300
+ });
301
+
302
+ // Scaffold data for new users
303
+ if (created) {
304
+ db.transact([
305
+ db.tx.settings[id()]
306
+ .update({ theme: 'light', notifications: true })
307
+ .link({ user: user.id }),
308
+ ]);
309
+ }
310
+ ```
311
+
286
312
  # Ad-hoc queries from the CLI
287
313
 
288
314
  Run `npx instant-cli query '{ posts: {} }' --admin` to query your app. A context flag is required: `--admin`, `--as-email <email>`, or `--as-guest`. Also supports `--app <id>`.