@flaredev/cli 0.1.2 → 0.3.0

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.
Files changed (89) hide show
  1. package/bin/flare.js +9 -1
  2. package/dist/index.js +985 -337
  3. package/package.json +3 -2
  4. package/templates/app/app/admin/page.tsx +9 -61
  5. package/templates/app/app/api/openapi.json/route.ts +23 -0
  6. package/templates/app/app/api/reference/route.ts +36 -0
  7. package/templates/app/app/dashboard/account/page.tsx +40 -0
  8. package/templates/app/app/{admin → dashboard}/actions.ts +109 -11
  9. package/templates/app/app/dashboard/import-actions.ts +91 -0
  10. package/templates/app/app/dashboard/layout.tsx +42 -0
  11. package/templates/app/app/dashboard/observability/page.tsx +174 -0
  12. package/templates/app/app/dashboard/page.tsx +123 -9
  13. package/templates/app/app/forgot-password/page.tsx +22 -0
  14. package/templates/app/app/globals.css +109 -4
  15. package/templates/app/app/layout.tsx +28 -26
  16. package/templates/app/app/page.tsx +126 -13
  17. package/templates/app/app/reset-password/page.tsx +31 -0
  18. package/templates/app/app/sign-in/page.tsx +49 -33
  19. package/templates/app/app/sign-up/page.tsx +42 -23
  20. package/templates/app/app/two-factor/page.tsx +25 -0
  21. package/templates/app/app/verify-email/page.tsx +33 -0
  22. package/templates/app/components/account/security-settings.tsx +522 -0
  23. package/templates/app/components/auth/auth-shell.tsx +284 -0
  24. package/templates/app/components/auth/otp-input.tsx +95 -0
  25. package/templates/app/components/auth/password-field.tsx +116 -0
  26. package/templates/app/components/auth/password-forms.tsx +76 -0
  27. package/templates/app/components/auth/provider-icons.tsx +39 -0
  28. package/templates/app/components/auth/sign-in-flow.tsx +306 -0
  29. package/templates/app/components/auth/sign-up-form.tsx +93 -0
  30. package/templates/app/components/auth/social-buttons.tsx +56 -0
  31. package/templates/app/components/auth/two-factor-form.tsx +139 -0
  32. package/templates/app/components/auth/ui.tsx +96 -0
  33. package/templates/app/components/auth/use-resend.ts +44 -0
  34. package/templates/app/components/auth/verify-email-form.tsx +135 -0
  35. package/templates/app/components/{admin/admin-header.tsx → dashboard/dashboard-header.tsx} +78 -78
  36. package/templates/app/components/{admin/resource-nav.tsx → dashboard/dashboard-sidebar.tsx} +66 -9
  37. package/templates/app/components/dashboard/export-button.tsx +41 -0
  38. package/templates/app/components/dashboard/fields/country-field.tsx +152 -0
  39. package/templates/app/components/{admin → dashboard}/fields/field-widget.tsx +186 -128
  40. package/templates/app/components/{admin → dashboard}/fields/file-field.tsx +302 -302
  41. package/templates/app/components/dashboard/fields/multi-select-field.tsx +46 -0
  42. package/templates/app/components/dashboard/fields/phone-field.tsx +86 -0
  43. package/templates/app/components/dashboard/import-dialog.tsx +487 -0
  44. package/templates/app/components/dashboard/page-header.tsx +57 -0
  45. package/templates/app/components/dashboard/resource-form-dialog.tsx +80 -0
  46. package/templates/app/components/{admin → dashboard}/resource-form-page.tsx +61 -55
  47. package/templates/app/components/{admin → dashboard}/resource-form.tsx +165 -139
  48. package/templates/app/components/dashboard/resource-stats.tsx +53 -0
  49. package/templates/app/components/{admin → dashboard}/resource-table.tsx +331 -251
  50. package/templates/app/components/{admin → dashboard}/row-actions.tsx +144 -111
  51. package/templates/app/components/dashboard/stat-card.tsx +69 -0
  52. package/templates/app/components/dashboard/table-selection.tsx +185 -0
  53. package/templates/app/components/dashboard/traffic-chart.tsx +32 -0
  54. package/templates/app/components/marketing/product-preview.tsx +70 -0
  55. package/templates/app/components/marketing/site-header.tsx +39 -0
  56. package/templates/app/components/sign-out-button.tsx +1 -1
  57. package/templates/app/components/ui/checkbox.tsx +25 -0
  58. package/templates/app/components/ui/radio-group.tsx +29 -0
  59. package/templates/app/db/auth-schema.ts +167 -118
  60. package/templates/app/db/flare-schema.ts +33 -1
  61. package/templates/app/lib/analytics.ts +121 -0
  62. package/templates/app/lib/api-docs.ts +16 -0
  63. package/templates/app/lib/audit.ts +80 -0
  64. package/templates/app/lib/auth-client.ts +16 -1
  65. package/templates/app/lib/auth-config.ts +38 -0
  66. package/templates/app/lib/auth-emails.ts +94 -0
  67. package/templates/app/lib/auth.ts +115 -6
  68. package/templates/app/lib/cache.ts +83 -83
  69. package/templates/app/lib/csv.ts +24 -0
  70. package/templates/app/lib/dashboard-nav.ts +15 -0
  71. package/templates/app/lib/{admin.ts → dashboard.ts} +138 -103
  72. package/templates/app/lib/password-rules.ts +159 -0
  73. package/templates/app/lib/site.ts +56 -0
  74. package/templates/app/lib/theme.ts +79 -0
  75. package/templates/app/migrations/0000_init.sql +47 -4
  76. package/templates/app/migrations/meta/0000_snapshot.json +311 -1
  77. package/templates/app/migrations/meta/_journal.json +1 -1
  78. package/templates/app/vite.config.ts +5 -3
  79. package/templates/app/worker-configuration.d.ts +15764 -0
  80. package/templates/locks/package-lock.json +9189 -0
  81. package/templates/locks/pnpm-lock.yaml +6347 -0
  82. package/templates/app/app/admin/layout.tsx +0 -32
  83. package/templates/app/components/auth-form.tsx +0 -120
  84. package/templates/app/lib/admin-nav.ts +0 -15
  85. /package/templates/app/components/{admin → dashboard}/fields/date-field.tsx +0 -0
  86. /package/templates/app/components/{admin → dashboard}/fields/relation-field.tsx +0 -0
  87. /package/templates/app/components/{admin → dashboard}/query.ts +0 -0
  88. /package/templates/app/components/{admin → dashboard}/resource-icon.tsx +0 -0
  89. /package/templates/app/components/{admin → dashboard}/resource-table-toolbar.tsx +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "0d286de4-e9a3-4fb7-a0d3-e3fa1f8ac57f",
4
+ "id": "b98aab68-42f4-4832-ac5d-de8a121d8eae",
5
5
  "prevId": "00000000-0000-0000-0000-000000000000",
6
6
  "tables": {
7
7
  "account": {
@@ -128,6 +128,122 @@
128
128
  "uniqueConstraints": {},
129
129
  "checkConstraints": {}
130
130
  },
131
+ "passkey": {
132
+ "name": "passkey",
133
+ "columns": {
134
+ "id": {
135
+ "name": "id",
136
+ "type": "text",
137
+ "primaryKey": true,
138
+ "notNull": true,
139
+ "autoincrement": false
140
+ },
141
+ "name": {
142
+ "name": "name",
143
+ "type": "text",
144
+ "primaryKey": false,
145
+ "notNull": false,
146
+ "autoincrement": false
147
+ },
148
+ "public_key": {
149
+ "name": "public_key",
150
+ "type": "text",
151
+ "primaryKey": false,
152
+ "notNull": true,
153
+ "autoincrement": false
154
+ },
155
+ "user_id": {
156
+ "name": "user_id",
157
+ "type": "text",
158
+ "primaryKey": false,
159
+ "notNull": true,
160
+ "autoincrement": false
161
+ },
162
+ "credential_id": {
163
+ "name": "credential_id",
164
+ "type": "text",
165
+ "primaryKey": false,
166
+ "notNull": true,
167
+ "autoincrement": false
168
+ },
169
+ "counter": {
170
+ "name": "counter",
171
+ "type": "integer",
172
+ "primaryKey": false,
173
+ "notNull": true,
174
+ "autoincrement": false
175
+ },
176
+ "device_type": {
177
+ "name": "device_type",
178
+ "type": "text",
179
+ "primaryKey": false,
180
+ "notNull": true,
181
+ "autoincrement": false
182
+ },
183
+ "backed_up": {
184
+ "name": "backed_up",
185
+ "type": "integer",
186
+ "primaryKey": false,
187
+ "notNull": true,
188
+ "autoincrement": false
189
+ },
190
+ "transports": {
191
+ "name": "transports",
192
+ "type": "text",
193
+ "primaryKey": false,
194
+ "notNull": false,
195
+ "autoincrement": false
196
+ },
197
+ "created_at": {
198
+ "name": "created_at",
199
+ "type": "integer",
200
+ "primaryKey": false,
201
+ "notNull": false,
202
+ "autoincrement": false
203
+ },
204
+ "aaguid": {
205
+ "name": "aaguid",
206
+ "type": "text",
207
+ "primaryKey": false,
208
+ "notNull": false,
209
+ "autoincrement": false
210
+ }
211
+ },
212
+ "indexes": {
213
+ "passkey_userId_idx": {
214
+ "name": "passkey_userId_idx",
215
+ "columns": [
216
+ "user_id"
217
+ ],
218
+ "isUnique": false
219
+ },
220
+ "passkey_credentialID_idx": {
221
+ "name": "passkey_credentialID_idx",
222
+ "columns": [
223
+ "credential_id"
224
+ ],
225
+ "isUnique": false
226
+ }
227
+ },
228
+ "foreignKeys": {
229
+ "passkey_user_id_user_id_fk": {
230
+ "name": "passkey_user_id_user_id_fk",
231
+ "tableFrom": "passkey",
232
+ "tableTo": "user",
233
+ "columnsFrom": [
234
+ "user_id"
235
+ ],
236
+ "columnsTo": [
237
+ "id"
238
+ ],
239
+ "onDelete": "cascade",
240
+ "onUpdate": "no action"
241
+ }
242
+ },
243
+ "compositePrimaryKeys": {},
244
+ "uniqueConstraints": {},
245
+ "checkConstraints": {}
246
+ },
131
247
  "session": {
132
248
  "name": "session",
133
249
  "columns": {
@@ -231,6 +347,96 @@
231
347
  "uniqueConstraints": {},
232
348
  "checkConstraints": {}
233
349
  },
350
+ "two_factor": {
351
+ "name": "two_factor",
352
+ "columns": {
353
+ "id": {
354
+ "name": "id",
355
+ "type": "text",
356
+ "primaryKey": true,
357
+ "notNull": true,
358
+ "autoincrement": false
359
+ },
360
+ "secret": {
361
+ "name": "secret",
362
+ "type": "text",
363
+ "primaryKey": false,
364
+ "notNull": true,
365
+ "autoincrement": false
366
+ },
367
+ "backup_codes": {
368
+ "name": "backup_codes",
369
+ "type": "text",
370
+ "primaryKey": false,
371
+ "notNull": true,
372
+ "autoincrement": false
373
+ },
374
+ "user_id": {
375
+ "name": "user_id",
376
+ "type": "text",
377
+ "primaryKey": false,
378
+ "notNull": true,
379
+ "autoincrement": false
380
+ },
381
+ "verified": {
382
+ "name": "verified",
383
+ "type": "integer",
384
+ "primaryKey": false,
385
+ "notNull": false,
386
+ "autoincrement": false,
387
+ "default": true
388
+ },
389
+ "failed_verification_count": {
390
+ "name": "failed_verification_count",
391
+ "type": "integer",
392
+ "primaryKey": false,
393
+ "notNull": false,
394
+ "autoincrement": false,
395
+ "default": 0
396
+ },
397
+ "locked_until": {
398
+ "name": "locked_until",
399
+ "type": "integer",
400
+ "primaryKey": false,
401
+ "notNull": false,
402
+ "autoincrement": false
403
+ }
404
+ },
405
+ "indexes": {
406
+ "twoFactor_secret_idx": {
407
+ "name": "twoFactor_secret_idx",
408
+ "columns": [
409
+ "secret"
410
+ ],
411
+ "isUnique": false
412
+ },
413
+ "twoFactor_userId_idx": {
414
+ "name": "twoFactor_userId_idx",
415
+ "columns": [
416
+ "user_id"
417
+ ],
418
+ "isUnique": false
419
+ }
420
+ },
421
+ "foreignKeys": {
422
+ "two_factor_user_id_user_id_fk": {
423
+ "name": "two_factor_user_id_user_id_fk",
424
+ "tableFrom": "two_factor",
425
+ "tableTo": "user",
426
+ "columnsFrom": [
427
+ "user_id"
428
+ ],
429
+ "columnsTo": [
430
+ "id"
431
+ ],
432
+ "onDelete": "cascade",
433
+ "onUpdate": "no action"
434
+ }
435
+ },
436
+ "compositePrimaryKeys": {},
437
+ "uniqueConstraints": {},
438
+ "checkConstraints": {}
439
+ },
234
440
  "user": {
235
441
  "name": "user",
236
442
  "columns": {
@@ -314,6 +520,14 @@
314
520
  "primaryKey": false,
315
521
  "notNull": false,
316
522
  "autoincrement": false
523
+ },
524
+ "two_factor_enabled": {
525
+ "name": "two_factor_enabled",
526
+ "type": "integer",
527
+ "primaryKey": false,
528
+ "notNull": false,
529
+ "autoincrement": false,
530
+ "default": false
317
531
  }
318
532
  },
319
533
  "indexes": {
@@ -392,6 +606,102 @@
392
606
  "uniqueConstraints": {},
393
607
  "checkConstraints": {}
394
608
  },
609
+ "audit_log": {
610
+ "name": "audit_log",
611
+ "columns": {
612
+ "id": {
613
+ "name": "id",
614
+ "type": "text",
615
+ "primaryKey": true,
616
+ "notNull": true,
617
+ "autoincrement": false
618
+ },
619
+ "action": {
620
+ "name": "action",
621
+ "type": "text",
622
+ "primaryKey": false,
623
+ "notNull": true,
624
+ "autoincrement": false
625
+ },
626
+ "resource": {
627
+ "name": "resource",
628
+ "type": "text",
629
+ "primaryKey": false,
630
+ "notNull": true,
631
+ "autoincrement": false
632
+ },
633
+ "record_id": {
634
+ "name": "record_id",
635
+ "type": "text",
636
+ "primaryKey": false,
637
+ "notNull": false,
638
+ "autoincrement": false
639
+ },
640
+ "record_label": {
641
+ "name": "record_label",
642
+ "type": "text",
643
+ "primaryKey": false,
644
+ "notNull": false,
645
+ "autoincrement": false
646
+ },
647
+ "user_id": {
648
+ "name": "user_id",
649
+ "type": "text",
650
+ "primaryKey": false,
651
+ "notNull": false,
652
+ "autoincrement": false
653
+ },
654
+ "user_email": {
655
+ "name": "user_email",
656
+ "type": "text",
657
+ "primaryKey": false,
658
+ "notNull": false,
659
+ "autoincrement": false
660
+ },
661
+ "changes": {
662
+ "name": "changes",
663
+ "type": "text",
664
+ "primaryKey": false,
665
+ "notNull": false,
666
+ "autoincrement": false
667
+ },
668
+ "ip": {
669
+ "name": "ip",
670
+ "type": "text",
671
+ "primaryKey": false,
672
+ "notNull": false,
673
+ "autoincrement": false
674
+ },
675
+ "created_at": {
676
+ "name": "created_at",
677
+ "type": "integer",
678
+ "primaryKey": false,
679
+ "notNull": true,
680
+ "autoincrement": false,
681
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
682
+ }
683
+ },
684
+ "indexes": {
685
+ "audit_log_created_at_idx": {
686
+ "name": "audit_log_created_at_idx",
687
+ "columns": [
688
+ "created_at"
689
+ ],
690
+ "isUnique": false
691
+ },
692
+ "audit_log_resource_idx": {
693
+ "name": "audit_log_resource_idx",
694
+ "columns": [
695
+ "resource"
696
+ ],
697
+ "isUnique": false
698
+ }
699
+ },
700
+ "foreignKeys": {},
701
+ "compositePrimaryKeys": {},
702
+ "uniqueConstraints": {},
703
+ "checkConstraints": {}
704
+ },
395
705
  "role": {
396
706
  "name": "role",
397
707
  "columns": {
@@ -5,7 +5,7 @@
5
5
  {
6
6
  "idx": 0,
7
7
  "version": "6",
8
- "when": 1789674564602,
8
+ "when": 1790112915429,
9
9
  "tag": "0000_init",
10
10
  "breakpoints": true
11
11
  }
@@ -1,9 +1,11 @@
1
- import { defineConfig } from "vite";
1
+ import { defineConfig, loadEnv } from "vite";
2
2
  import vinext from "vinext";
3
3
  import { cloudflare } from "@cloudflare/vite-plugin";
4
4
  import { kvDataAdapter } from "@vinext/cloudflare/cache/kv-data-adapter";
5
5
 
6
- export default defineConfig({
6
+ export default defineConfig(({ mode }) => ({
7
+ // FLARE_THEME (shell or .env) picks the theme for this build; see lib/theme.ts.
8
+ define: { __FLARE_THEME__: JSON.stringify(loadEnv(mode, process.cwd(), "FLARE_").FLARE_THEME ?? "") },
7
9
  // `flare dev --tunnel` serves the dev server on a https://*.trycloudflare.com URL.
8
10
  server: { allowedHosts: [".trycloudflare.com"] },
9
11
  plugins: [
@@ -26,4 +28,4 @@ export default defineConfig({
26
28
  },
27
29
  }),
28
30
  ],
29
- });
31
+ }));