create-bw-app 0.13.3 → 0.14.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 (86) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/app-manifest.mjs +4 -2
  4. package/src/constants.mjs +88 -11
  5. package/src/doctor.mjs +38 -0
  6. package/src/generator.mjs +75 -19
  7. package/template/base/app/(auth)/auth/confirmed/page.tsx +1 -0
  8. package/template/base/app/(auth)/auth/post-login/page.tsx +1 -0
  9. package/template/base/app/(auth)/auth-provider.tsx +25 -0
  10. package/template/base/app/(auth)/forgot-password/page.tsx +1 -0
  11. package/template/base/app/(auth)/invite/[invitationId]/invite-route-mount.tsx +10 -0
  12. package/template/base/app/(auth)/invite/[invitationId]/page.tsx +1 -0
  13. package/template/base/app/(auth)/layout.tsx +5 -0
  14. package/template/base/app/(auth)/login/page.tsx +1 -0
  15. package/template/base/app/(auth)/reset-password/page.tsx +1 -0
  16. package/template/base/app/(auth)/signup/page.tsx +1 -0
  17. package/template/base/app/(shell)/account/page.tsx +5 -0
  18. package/template/base/app/(shell)/dashboard/dashboard-live-mount.tsx +21 -0
  19. package/template/base/app/(shell)/dashboard/page.tsx +1 -0
  20. package/template/base/app/(shell)/layout.tsx +24 -0
  21. package/template/base/app/(shell)/shell-layout-client.tsx +134 -0
  22. package/template/base/app/api/account/route.ts +2 -0
  23. package/template/base/app/auth/callback/route.ts +1 -0
  24. package/template/base/app/auth/cleanup/route.ts +1 -0
  25. package/template/base/app/layout.tsx +8 -2
  26. package/template/base/config/env.ts +98 -0
  27. package/template/modules/marketing/app/(shell)/marketing/page.tsx +1 -0
  28. package/template/modules/marketing/app/api/marketing/_handlers.ts +144 -0
  29. package/template/modules/marketing/app/api/marketing/analytics/campaigns/[id]/route.ts +2 -0
  30. package/template/modules/marketing/app/api/marketing/analytics/overview/route.ts +2 -0
  31. package/template/modules/marketing/app/api/marketing/analytics/segments/[id]/route.ts +2 -0
  32. package/template/modules/marketing/app/api/marketing/campaigns/[id]/cancel/route.ts +2 -0
  33. package/template/modules/marketing/app/api/marketing/campaigns/[id]/recipients/route.ts +2 -0
  34. package/template/modules/marketing/app/api/marketing/campaigns/[id]/retry/route.ts +2 -0
  35. package/template/modules/marketing/app/api/marketing/campaigns/[id]/route.ts +2 -0
  36. package/template/modules/marketing/app/api/marketing/campaigns/[id]/schedule/route.ts +2 -0
  37. package/template/modules/marketing/app/api/marketing/campaigns/[id]/send/route.ts +2 -0
  38. package/template/modules/marketing/app/api/marketing/campaigns/[id]/test/route.ts +2 -0
  39. package/template/modules/marketing/app/api/marketing/campaigns/route.ts +2 -0
  40. package/template/modules/marketing/app/api/marketing/segments/[id]/preview/route.ts +2 -0
  41. package/template/modules/marketing/app/api/marketing/segments/[id]/route.ts +2 -0
  42. package/template/modules/marketing/app/api/marketing/segments/preview/route.ts +2 -0
  43. package/template/modules/marketing/app/api/marketing/segments/route.ts +2 -0
  44. package/template/modules/marketing/app/api/marketing/topics/route.ts +2 -0
  45. package/template/modules/marketing/app/api/marketing/unsubscribe/[token]/route.ts +2 -0
  46. package/template/modules/marketing/app/api/marketing/webhooks/resend/route.ts +2 -0
  47. package/template/modules/marketing/app/api/marketing/worker/route.ts +2 -0
  48. package/template/modules/marketing/app/api/marketing/workflows/[id]/activate/route.ts +2 -0
  49. package/template/modules/marketing/app/api/marketing/workflows/[id]/nodes/[nodeId]/route.ts +2 -0
  50. package/template/modules/marketing/app/api/marketing/workflows/[id]/nodes/route.ts +2 -0
  51. package/template/modules/marketing/app/api/marketing/workflows/[id]/pause/route.ts +2 -0
  52. package/template/modules/marketing/app/api/marketing/workflows/[id]/route.ts +2 -0
  53. package/template/modules/marketing/app/api/marketing/workflows/[id]/runs/route.ts +2 -0
  54. package/template/modules/marketing/app/api/marketing/workflows/route.ts +2 -0
  55. package/template/modules/projects/app/(shell)/projects/[id]/board/page.tsx +1 -0
  56. package/template/modules/projects/app/(shell)/projects/[id]/page.tsx +1 -0
  57. package/template/modules/projects/app/(shell)/projects/[id]/tasks/page.tsx +1 -0
  58. package/template/modules/projects/app/(shell)/projects/layout.tsx +5 -0
  59. package/template/modules/projects/app/(shell)/projects/page.tsx +1 -0
  60. package/template/modules/projects/app/(shell)/projects/projects-live-mounts.tsx +27 -0
  61. package/template/modules/projects/app/(shell)/projects/projects-server-mounts.tsx +54 -0
  62. package/template/modules/projects/app/api/projects/[id]/activity/route.ts +2 -0
  63. package/template/modules/projects/app/api/projects/[id]/links/[itemId]/route.ts +2 -0
  64. package/template/modules/projects/app/api/projects/[id]/links/route.ts +2 -0
  65. package/template/modules/projects/app/api/projects/[id]/members/route.ts +2 -0
  66. package/template/modules/projects/app/api/projects/[id]/milestones/[itemId]/route.ts +2 -0
  67. package/template/modules/projects/app/api/projects/[id]/milestones/route.ts +2 -0
  68. package/template/modules/projects/app/api/projects/[id]/route.ts +2 -0
  69. package/template/modules/projects/app/api/projects/[id]/tasks/[itemId]/route.ts +2 -0
  70. package/template/modules/projects/app/api/projects/[id]/tasks/route.ts +2 -0
  71. package/template/modules/projects/app/api/projects/_handlers.ts +86 -0
  72. package/template/modules/projects/app/api/projects/organizations/route.ts +2 -0
  73. package/template/modules/projects/app/api/projects/route.ts +2 -0
  74. package/template/modules/projects/app/api/projects/stats/route.ts +2 -0
  75. package/template/supabase/README.md +3 -0
  76. package/template/supabase/module-registry.json +6 -0
  77. package/template/supabase/modules/marketing/README.md +12 -0
  78. package/template/supabase/modules/marketing/migrations/20260725120000_marketing_v1.sql +118 -0
  79. package/template/supabase/modules/marketing/migrations/20260725130000_marketing_campaigns.sql +133 -0
  80. package/template/supabase/modules/marketing/migrations/20260726120000_marketing_segments.sql +41 -0
  81. package/template/supabase/modules/marketing/migrations/20260726150000_marketing_workflows.sql +174 -0
  82. package/template/supabase/modules/marketing/migrations/20260726170000_marketing_engine_safety.sql +68 -0
  83. /package/template/modules/admin/app/{admin → (shell)/admin}/users/page.tsx +0 -0
  84. /package/template/modules/crm/app/{crm → (shell)/crm}/layout.tsx +0 -0
  85. /package/template/modules/crm/app/{crm → (shell)/crm}/page.tsx +0 -0
  86. /package/template/modules/crm/app/{crm → (shell)/crm}/report/page.tsx +0 -0
@@ -0,0 +1,68 @@
1
+ alter table public.marketing_worker_cursors
2
+ add column if not exists cursor_id uuid;
3
+
4
+ with duplicate_steps as (
5
+ select
6
+ id,
7
+ row_number() over (
8
+ partition by run_id, node_id
9
+ order by executed_at, id
10
+ ) as duplicate_number
11
+ from public.marketing_workflow_step_runs
12
+ where node_id is not null
13
+ )
14
+ delete from public.marketing_workflow_step_runs
15
+ where id in (
16
+ select id
17
+ from duplicate_steps
18
+ where duplicate_number > 1
19
+ );
20
+
21
+ create unique index if not exists marketing_workflow_step_runs_run_node_idx
22
+ on public.marketing_workflow_step_runs (run_id, node_id)
23
+ where node_id is not null;
24
+
25
+ create or replace function public.claim_marketing_campaign_recipients(
26
+ target_campaign_id uuid,
27
+ claim_limit integer,
28
+ claim_time timestamptz default now()
29
+ )
30
+ returns setof public.marketing_campaign_recipients
31
+ language sql
32
+ security definer
33
+ set search_path = public
34
+ as $$
35
+ update public.marketing_campaign_recipients
36
+ set status = 'sending',
37
+ attempt_count = attempt_count + 1,
38
+ next_attempt_at = null,
39
+ updated_at = claim_time
40
+ where id in (
41
+ select id
42
+ from public.marketing_campaign_recipients
43
+ where campaign_id = target_campaign_id
44
+ and (
45
+ status = 'queued'
46
+ or (
47
+ status = 'failed'
48
+ and attempt_count < 3
49
+ and next_attempt_at is not null
50
+ and next_attempt_at <= claim_time
51
+ )
52
+ or (
53
+ status = 'sending'
54
+ and attempt_count < 3
55
+ and updated_at <= claim_time - interval '15 minutes'
56
+ )
57
+ )
58
+ order by created_at, id
59
+ for update skip locked
60
+ limit greatest(1, least(claim_limit, 1000))
61
+ )
62
+ returning *;
63
+ $$;
64
+
65
+ revoke all on function public.claim_marketing_campaign_recipients(uuid, integer, timestamptz)
66
+ from public, anon, authenticated;
67
+ grant execute on function public.claim_marketing_campaign_recipients(uuid, integer, timestamptz)
68
+ to service_role;