@marktiderman/genesis-cli 1.7.0 → 1.9.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.
- package/README.md +26 -4
- package/dist/cli.js +933 -319
- package/dist/cli.js.map +1 -1
- package/dist/{config-CrZbM3jD.d.ts → config-QC_Ewwwp.d.ts} +27 -3
- package/dist/doctor.d.ts +68 -4
- package/dist/doctor.js +654 -87
- package/dist/doctor.js.map +1 -1
- package/dist/expo.d.ts +2 -2
- package/dist/expo.js.map +1 -1
- package/dist/genesis-catalog.json +164 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +666 -101
- package/dist/index.js.map +1 -1
- package/dist/starter/.env.example +3 -0
- package/dist/starter/README.md +7 -0
- package/dist/starter/__tests__/app-config.test.ts +27 -0
- package/dist/starter/__tests__/chat-outboxes.test.ts +64 -0
- package/dist/starter/__tests__/check-in-photos.test.ts +5 -3
- package/dist/starter/__tests__/components/fake-supabase.ts +8 -0
- package/dist/starter/__tests__/components/messages.test.tsx +33 -0
- package/dist/starter/__tests__/components/settings.test.tsx +34 -0
- package/dist/starter/__tests__/components/setup.ts +13 -0
- package/dist/starter/__tests__/components/tabs-feature-off.test.tsx +1 -1
- package/dist/starter/__tests__/components/tabs.test.tsx +2 -2
- package/dist/starter/__tests__/inline-copy.ts +1 -1
- package/dist/starter/__tests__/starter.test.ts +117 -3
- package/dist/starter/app.config.ts +19 -2
- package/dist/starter/genesis.config.json +2 -2
- package/dist/starter/jest.config.js +2 -1
- package/dist/starter/metro.config.js +1 -1
- package/dist/starter/package.json +9 -0
- package/dist/starter/src/app/(app)/(home)/check-in.tsx +4 -38
- package/dist/starter/src/app/(app)/_layout.tsx +25 -3
- package/dist/starter/src/app/(app)/messages/[id].tsx +63 -0
- package/dist/starter/src/app/(app)/messages/_layout.tsx +11 -0
- package/dist/starter/src/app/(app)/messages/check-in.tsx +9 -0
- package/dist/starter/src/app/(app)/messages/index.tsx +38 -0
- package/dist/starter/src/app/(app)/messages/search.tsx +39 -0
- package/dist/starter/src/app/(app)/notifications/index.tsx +7 -13
- package/dist/starter/src/app/(app)/settings/availability.tsx +16 -0
- package/dist/starter/src/app/(app)/settings/index.tsx +8 -3
- package/dist/starter/src/app/(app)/settings/notifications.tsx +6 -3
- package/dist/starter/src/copy.ts +19 -0
- package/dist/starter/src/lib/chat-outboxes.ts +50 -0
- package/dist/starter/src/lib/chat-video.ts +57 -0
- package/dist/starter/src/lib/chat.tsx +319 -0
- package/dist/starter/src/lib/check-in-screen.tsx +43 -0
- package/dist/starter/src/lib/define-starter.ts +9 -0
- package/dist/starter/src/lib/env.ts +4 -0
- package/dist/starter/src/lib/links.ts +2 -0
- package/dist/starter/src/lib/notifications.ts +30 -12
- package/dist/starter/src/lib/push.ts +21 -5
- package/dist/starter/starter.config.ts +1 -0
- package/dist/starter/supabase/config.toml +5 -0
- package/dist/starter/supabase/migrations/20261025000000_genesis_chat.sql +1836 -0
- package/dist/starter/supabase/migrations/20261025000050_genesis_chat_coaching.sql +934 -0
- package/dist/starter/supabase/migrations/20261025000060_genesis_chat_search_threads.sql +85 -0
- package/dist/starter/supabase/migrations/20261025000100_genesis_notifications.sql +2057 -0
- package/dist/starter/supabase/migrations/20261026000000_chat_people.sql +57 -0
- package/dist/starter/supabase/tests/database/chat_people.test.sql +112 -0
- package/dist/starter/supabase/tests/database/genesis_chat.test.sql +254 -0
- package/dist/starter/supabase/tests/database/genesis_chat_coaching.test.sql +269 -0
- package/dist/starter/supabase/tests/database/genesis_chat_search_threads.test.sql +50 -0
- package/dist/starter/supabase/tests/database/genesis_notifications.test.sql +473 -0
- package/dist/vite.js +651 -86
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
- package/dist/starter/supabase/tests/database/genesis_push.test.sql +0 -407
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
-- Genesis Chat 0003: a search hit inside a reply thread says which thread
|
|
2
|
+
--
|
|
3
|
+
-- Builds on 0001 and 0002 (never edited once released). genesis_chat.search_messages now also
|
|
4
|
+
-- returns thread_root_id, so the app opens the thread a reply lives in instead of reporting the
|
|
5
|
+
-- message missing. A return type can't change in place, so the function is dropped and made
|
|
6
|
+
-- again, with its grants given again by name.
|
|
7
|
+
--
|
|
8
|
+
-- Also: any change to a message's moderation (a moderator job, an admin edit, not only
|
|
9
|
+
-- moderate_message) sends readers a live hint, so a hidden message updates without a relaunch.
|
|
10
|
+
--
|
|
11
|
+
-- Use: `genesis add chat` copies this after 0002. Verify: tests/0003_genesis_chat_search_threads.test.sql.
|
|
12
|
+
|
|
13
|
+
-- Messages (and voice or video transcripts) you can read that match `p_query`, newest first.
|
|
14
|
+
-- Within one conversation, or across all of yours. The snippet marks matches with « and »; the
|
|
15
|
+
-- text's own « and » become ‹ and › first, so a message can't fake a highlight. A reply in a
|
|
16
|
+
-- thread carries its thread_root_id.
|
|
17
|
+
drop function genesis_chat.search_messages(text, uuid, integer);
|
|
18
|
+
create function genesis_chat.search_messages(p_query text, p_conversation_id uuid default null, p_limit integer default 30)
|
|
19
|
+
returns table (message_id uuid, conversation_id uuid, seq bigint, sender_id uuid, created_at timestamptz, snippet text, in_transcript boolean, thread_root_id uuid)
|
|
20
|
+
language plpgsql
|
|
21
|
+
stable
|
|
22
|
+
security definer
|
|
23
|
+
set search_path = ''
|
|
24
|
+
as $$
|
|
25
|
+
declare
|
|
26
|
+
q tsquery;
|
|
27
|
+
begin
|
|
28
|
+
if auth.uid() is null or length(btrim(coalesce(p_query, ''))) < 2 then
|
|
29
|
+
return;
|
|
30
|
+
end if;
|
|
31
|
+
q := websearch_to_tsquery('simple', p_query);
|
|
32
|
+
return query
|
|
33
|
+
with mine as (
|
|
34
|
+
select me.conversation_id from genesis_chat.members me
|
|
35
|
+
where me.user_id = auth.uid() and me.left_at is null and me.role <> 'observer'
|
|
36
|
+
and (p_conversation_id is null or me.conversation_id = p_conversation_id)
|
|
37
|
+
union
|
|
38
|
+
select p_conversation_id where p_conversation_id is not null and genesis_chat.i_observe(p_conversation_id)
|
|
39
|
+
), hits as (
|
|
40
|
+
select m.id, m.conversation_id, m.seq, m.sender_id, m.created_at,
|
|
41
|
+
ts_headline('simple', translate(m.body, '«»', '‹›'), q, 'MaxWords=18, MinWords=6, StartSel=«, StopSel=»') as snippet, false as in_transcript,
|
|
42
|
+
m.thread_root_id
|
|
43
|
+
from genesis_chat.messages m join mine using (conversation_id)
|
|
44
|
+
where m.search @@ q and m.deleted_at is null
|
|
45
|
+
and (m.visibility = 'everyone' or genesis_chat.i_observe(m.conversation_id))
|
|
46
|
+
and (m.moderation is distinct from 'hidden' or m.sender_id = auth.uid() or genesis_chat.i_observe(m.conversation_id))
|
|
47
|
+
union all
|
|
48
|
+
select m.id, m.conversation_id, m.seq, m.sender_id, m.created_at,
|
|
49
|
+
ts_headline('simple', translate(a.transcript, '«»', '‹›'), q, 'MaxWords=18, MinWords=6, StartSel=«, StopSel=»'), true,
|
|
50
|
+
m.thread_root_id
|
|
51
|
+
from genesis_chat.attachments a
|
|
52
|
+
join genesis_chat.messages m on m.id = a.message_id
|
|
53
|
+
join mine on mine.conversation_id = m.conversation_id
|
|
54
|
+
where a.transcript is not null and a.transcript_search @@ q and m.deleted_at is null
|
|
55
|
+
and (m.visibility = 'everyone' or genesis_chat.i_observe(m.conversation_id))
|
|
56
|
+
and (m.moderation is distinct from 'hidden' or m.sender_id = auth.uid() or genesis_chat.i_observe(m.conversation_id))
|
|
57
|
+
)
|
|
58
|
+
select distinct on (h.created_at, h.id) h.id, h.conversation_id, h.seq, h.sender_id, h.created_at, h.snippet, h.in_transcript, h.thread_root_id
|
|
59
|
+
from hits h
|
|
60
|
+
order by h.created_at desc, h.id
|
|
61
|
+
limit least(greatest(coalesce(p_limit, 30), 1), 100);
|
|
62
|
+
end;
|
|
63
|
+
$$;
|
|
64
|
+
|
|
65
|
+
revoke execute on function genesis_chat.search_messages(text, uuid, integer) from public, anon;
|
|
66
|
+
grant execute on function genesis_chat.search_messages(text, uuid, integer) to authenticated, service_role;
|
|
67
|
+
|
|
68
|
+
-- ── Moderation changes reach readers live ─────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
create or replace function genesis_chat.message_moderation_changed()
|
|
71
|
+
returns trigger
|
|
72
|
+
language plpgsql
|
|
73
|
+
security definer
|
|
74
|
+
set search_path = ''
|
|
75
|
+
as $$
|
|
76
|
+
begin
|
|
77
|
+
perform genesis_chat.broadcast('genesis-chat:conv:' || new.conversation_id, 'message',
|
|
78
|
+
jsonb_build_object('id', new.id, 'seq', new.seq, 'conversation_id', new.conversation_id, 'op', 'update'));
|
|
79
|
+
return null;
|
|
80
|
+
end;
|
|
81
|
+
$$;
|
|
82
|
+
revoke execute on function genesis_chat.message_moderation_changed() from public, anon, authenticated;
|
|
83
|
+
create trigger messages_moderation_changed after update of moderation on genesis_chat.messages
|
|
84
|
+
for each row when (new.moderation is distinct from old.moderation)
|
|
85
|
+
execute function genesis_chat.message_moderation_changed();
|