@rudderhq/db 0.4.6-canary.9 → 0.5.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/dist/client.test.js +629 -0
- package/dist/client.test.js.map +1 -1
- package/dist/embedded-postgres-recovery.d.ts +1 -0
- package/dist/embedded-postgres-recovery.d.ts.map +1 -1
- package/dist/embedded-postgres-recovery.js +33 -0
- package/dist/embedded-postgres-recovery.js.map +1 -1
- package/dist/embedded-postgres-recovery.test.js +19 -1
- package/dist/embedded-postgres-recovery.test.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/migration-runtime.d.ts.map +1 -1
- package/dist/migration-runtime.js +3 -20
- package/dist/migration-runtime.js.map +1 -1
- package/dist/migrations/0102_complex_retro_girl.sql +38 -0
- package/dist/migrations/0103_cute_colonel_america.sql +4 -0
- package/dist/migrations/0104_unusual_mister_fear.sql +173 -0
- package/dist/migrations/0105_chat_queue_actor_reconciliation.sql +54 -0
- package/dist/migrations/0106_damp_amphibian.sql +9 -0
- package/dist/migrations/meta/0102_snapshot.json +19090 -0
- package/dist/migrations/meta/0103_snapshot.json +19114 -0
- package/dist/migrations/meta/0104_snapshot.json +20338 -0
- package/dist/migrations/meta/0105_snapshot.json +20338 -0
- package/dist/migrations/meta/0106_snapshot.json +20442 -0
- package/dist/migrations/meta/_journal.json +35 -0
- package/dist/schema/activity_log.d.ts +17 -0
- package/dist/schema/activity_log.d.ts.map +1 -1
- package/dist/schema/activity_log.js +6 -1
- package/dist/schema/activity_log.js.map +1 -1
- package/dist/schema/agent_wakeup_requests.d.ts.map +1 -1
- package/dist/schema/agent_wakeup_requests.js +5 -1
- package/dist/schema/agent_wakeup_requests.js.map +1 -1
- package/dist/schema/chat_control_actions.d.ts +442 -0
- package/dist/schema/chat_control_actions.d.ts.map +1 -0
- package/dist/schema/chat_control_actions.js +35 -0
- package/dist/schema/chat_control_actions.js.map +1 -0
- package/dist/schema/chat_conversations.d.ts +119 -0
- package/dist/schema/chat_conversations.d.ts.map +1 -1
- package/dist/schema/chat_conversations.js +10 -1
- package/dist/schema/chat_conversations.js.map +1 -1
- package/dist/schema/chat_generation_events.d.ts +268 -0
- package/dist/schema/chat_generation_events.d.ts.map +1 -0
- package/dist/schema/chat_generation_events.js +32 -0
- package/dist/schema/chat_generation_events.js.map +1 -0
- package/dist/schema/chat_generation_terminal_outbox.d.ts +370 -0
- package/dist/schema/chat_generation_terminal_outbox.d.ts.map +1 -0
- package/dist/schema/chat_generation_terminal_outbox.js +33 -0
- package/dist/schema/chat_generation_terminal_outbox.js.map +1 -0
- package/dist/schema/chat_generations.d.ts +279 -2
- package/dist/schema/chat_generations.d.ts.map +1 -1
- package/dist/schema/chat_generations.js +23 -2
- package/dist/schema/chat_generations.js.map +1 -1
- package/dist/schema/chat_queued_messages.d.ts +285 -2
- package/dist/schema/chat_queued_messages.d.ts.map +1 -1
- package/dist/schema/chat_queued_messages.js +23 -1
- package/dist/schema/chat_queued_messages.js.map +1 -1
- package/dist/schema/cost_events.d.ts +34 -0
- package/dist/schema/cost_events.d.ts.map +1 -1
- package/dist/schema/cost_events.js +5 -1
- package/dist/schema/cost_events.js.map +1 -1
- package/dist/schema/heartbeat_run_events.d.ts +17 -0
- package/dist/schema/heartbeat_run_events.d.ts.map +1 -1
- package/dist/schema/heartbeat_run_events.js +6 -1
- package/dist/schema/heartbeat_run_events.js.map +1 -1
- package/dist/schema/heartbeat_runs.d.ts +303 -0
- package/dist/schema/heartbeat_runs.d.ts.map +1 -1
- package/dist/schema/heartbeat_runs.js +24 -2
- package/dist/schema/heartbeat_runs.js.map +1 -1
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +3 -0
- package/dist/schema/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
UPDATE "chat_queued_messages" AS "queue"
|
|
2
|
+
SET
|
|
3
|
+
"request_actor" = (
|
|
4
|
+
SELECT CASE
|
|
5
|
+
WHEN "activity"."actor_type" = 'agent' AND "activity"."agent_id" IS NOT NULL THEN
|
|
6
|
+
jsonb_strip_nulls(jsonb_build_object(
|
|
7
|
+
'type', 'agent',
|
|
8
|
+
'source', 'agent_key',
|
|
9
|
+
'orgId', "queue"."org_id"::text,
|
|
10
|
+
'agentId', "activity"."agent_id"::text,
|
|
11
|
+
'runId', "activity"."run_id"::text
|
|
12
|
+
))
|
|
13
|
+
WHEN "activity"."actor_type" = 'user' THEN
|
|
14
|
+
jsonb_strip_nulls(jsonb_build_object(
|
|
15
|
+
'type', 'board',
|
|
16
|
+
'source', 'session',
|
|
17
|
+
'userId', "activity"."actor_id",
|
|
18
|
+
'orgIds', jsonb_build_array("queue"."org_id"::text),
|
|
19
|
+
'isInstanceAdmin', false,
|
|
20
|
+
'runId', "activity"."run_id"::text
|
|
21
|
+
))
|
|
22
|
+
ELSE NULL
|
|
23
|
+
END
|
|
24
|
+
FROM "activity_log" AS "activity"
|
|
25
|
+
WHERE "activity"."org_id" = "queue"."org_id"
|
|
26
|
+
AND "activity"."action" = 'chat.queue.created'
|
|
27
|
+
AND "activity"."entity_type" = 'chat'
|
|
28
|
+
AND "activity"."entity_id" = "queue"."conversation_id"::text
|
|
29
|
+
AND "activity"."details"->>'queuedMessageId' = "queue"."id"::text
|
|
30
|
+
AND (
|
|
31
|
+
"activity"."actor_type" = 'user'
|
|
32
|
+
OR ("activity"."actor_type" = 'agent' AND "activity"."agent_id" IS NOT NULL)
|
|
33
|
+
)
|
|
34
|
+
ORDER BY "activity"."created_at" DESC, "activity"."id" DESC
|
|
35
|
+
LIMIT 1
|
|
36
|
+
),
|
|
37
|
+
"updated_at" = now()
|
|
38
|
+
WHERE ("queue"."request_actor" IS NULL OR "queue"."request_actor" = 'null'::jsonb)
|
|
39
|
+
AND "queue"."status" IN ('queued', 'steer_pending', 'continuation_pending', 'dequeue_claimed');--> statement-breakpoint
|
|
40
|
+
UPDATE "chat_queued_messages"
|
|
41
|
+
SET
|
|
42
|
+
"status" = 'queued',
|
|
43
|
+
"delivery_intent" = 'queue',
|
|
44
|
+
"delivery_disposition" = NULL,
|
|
45
|
+
"control_action_id" = NULL,
|
|
46
|
+
"delivery_lease_token" = NULL,
|
|
47
|
+
"delivery_lease_owner" = NULL,
|
|
48
|
+
"delivery_lease_expires_at" = NULL,
|
|
49
|
+
"reconciliation_reason" = 'legacy_request_actor_unavailable',
|
|
50
|
+
"last_delivery_reason" = 'legacy_request_actor_unavailable',
|
|
51
|
+
"version" = "version" + 1,
|
|
52
|
+
"updated_at" = now()
|
|
53
|
+
WHERE ("request_actor" IS NULL OR "request_actor" = 'null'::jsonb)
|
|
54
|
+
AND "status" IN ('queued', 'steer_pending', 'continuation_pending', 'dequeue_claimed');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
ALTER TABLE "chat_conversations" ADD COLUMN "conversation_kind" text DEFAULT 'chat' NOT NULL;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "chat_conversations" ADD COLUMN "messenger_visible" boolean DEFAULT true NOT NULL;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "chat_conversations" ADD COLUMN "side_chat_state" text;--> statement-breakpoint
|
|
4
|
+
ALTER TABLE "chat_conversations" ADD COLUMN "side_chat_expires_at" timestamp with time zone;--> statement-breakpoint
|
|
5
|
+
ALTER TABLE "chat_conversations" ADD COLUMN "side_chat_completed_at" timestamp with time zone;--> statement-breakpoint
|
|
6
|
+
ALTER TABLE "chat_conversations" ADD COLUMN "side_chat_kept_at" timestamp with time zone;--> statement-breakpoint
|
|
7
|
+
ALTER TABLE "chat_conversations" ADD COLUMN "side_chat_client_mutation_id" text;--> statement-breakpoint
|
|
8
|
+
CREATE INDEX "chat_conversations_org_messenger_visibility_idx" ON "chat_conversations" USING btree ("org_id","messenger_visible","status","updated_at");--> statement-breakpoint
|
|
9
|
+
CREATE UNIQUE INDEX "chat_conversations_side_chat_owner_mutation_idx" ON "chat_conversations" USING btree ("org_id","created_by_user_id","side_chat_client_mutation_id");
|