@morlay/session-rdb 0.1.9 → 0.1.10-alpha.2
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 +24 -3
- package/dist/artifact.d.mts +118 -3
- package/dist/artifact.mjs +5 -3
- package/dist/{log-C0q5svm7.d.mts → backend-BKtJ5sO5.d.mts} +189 -291
- package/dist/backend-rdb-BDCntVDy.mjs +1341 -0
- package/dist/branch-CG1PUlO6.mjs +833 -0
- package/dist/deletion-SSX7IqU8.mjs +35 -0
- package/dist/deletion.d.mts +1 -3
- package/dist/deletion.mjs +2 -2
- package/dist/export-CfJQjQfr.mjs +123 -0
- package/dist/export.d.mts +1 -3
- package/dist/export.mjs +32 -57
- package/dist/import.d.mts +1 -3
- package/dist/import.mjs +32 -78
- package/dist/index-CUD2ZpTA.d.mts +71 -0
- package/dist/index.d.mts +20 -2
- package/dist/index.mjs +1562 -5
- package/dist/open-YoyD_kah.mjs +561 -0
- package/dist/organize.d.mts +9 -0
- package/dist/organize.mjs +30 -0
- package/dist/route-DpfY0zq-.mjs +114 -0
- package/dist/storage.d.mts +41 -50
- package/dist/storage.mjs +3 -1
- package/dist/testing.d.mts +9 -5
- package/dist/testing.mjs +27 -8
- package/dist/usage-row-BQQM-_t6.mjs +36 -0
- package/dist/usage.d.mts +1 -1
- package/dist/usage.mjs +8 -42
- package/dist/write-guard-CYrY58GM.mjs +174 -0
- package/package.json +32 -36
- package/src/artifact.ts +4 -1
- package/src/backend-rdb.ts +331 -0
- package/src/backend.ts +32 -15
- package/src/{branch.ts → branch/index.ts} +125 -112
- package/src/branch/port.ts +62 -0
- package/src/branch/semantics.ts +69 -0
- package/src/db/open.ts +180 -0
- package/src/db/stats.ts +449 -0
- package/src/deletion-error.ts +17 -0
- package/src/deletion.ts +19 -72
- package/src/entities/index.ts +16 -1
- package/src/entities/v3/event-usage.ts +3 -3
- package/src/entities/v3/events.ts +3 -3
- package/src/entities/v3/index.ts +4 -16
- package/src/entities/v3/persistence-state.ts +3 -3
- package/src/entities/v3/schema-meta.ts +3 -3
- package/src/entities/v3/session-counts.ts +3 -3
- package/src/entities/v3/session-events.ts +3 -3
- package/src/entities/v3/session-projcache-rows.ts +3 -3
- package/src/entities/v3/session-usage.ts +3 -3
- package/src/entities/v3/sessions.ts +3 -3
- package/src/entities/v3/storage-records.ts +17 -0
- package/src/entities/v3/storage-units.ts +3 -3
- package/src/{schema.ts → event-shape.ts} +0 -46
- package/src/export.ts +32 -78
- package/src/handles.ts +349 -0
- package/src/http/route.ts +178 -0
- package/src/import-storages.ts +5 -2
- package/src/import.ts +63 -125
- package/src/index.ts +15 -1630
- package/src/legacy.ts +3 -1
- package/src/live-routing.ts +205 -0
- package/src/log/export.ts +84 -0
- package/src/{log.ts → log/repair.ts} +1 -272
- package/src/log/rows.ts +107 -0
- package/src/log/usage-row.ts +64 -0
- package/src/migrations.ts +196 -0
- package/src/organize.ts +38 -0
- package/src/read-path.ts +190 -0
- package/src/routes.ts +2 -1
- package/src/rows.ts +25 -77
- package/src/session-ops.ts +444 -0
- package/src/session-query.ts +17 -4
- package/src/session-store.ts +675 -0
- package/src/stats-fold.ts +44 -0
- package/src/storage-takeover/index.ts +2 -5
- package/src/storage-takeover/legacy-domain-migration.ts +118 -0
- package/src/storage-takeover/projection-cache.ts +139 -77
- package/src/storage-takeover/read-model.ts +189 -0
- package/src/storage-takeover/repository.ts +238 -425
- package/src/storage-takeover/storage-backend.ts +47 -149
- package/src/storage-takeover/types.ts +45 -14
- package/src/storage-takeover/workspace-documents.ts +65 -0
- package/src/storage.ts +4 -2
- package/src/testing.ts +21 -1
- package/src/usage.ts +11 -65
- package/src/version.ts +13 -0
- package/src/write-path.ts +286 -0
- package/dist/branch-DbFW3rJX.mjs +0 -391
- package/dist/deletion-ODZFcbZm.mjs +0 -2218
- package/dist/gc.d.mts +0 -6
- package/dist/gc.mjs +0 -49
- package/dist/log-DYxdjJ-l.mjs +0 -562
- package/dist/routes-DGBlBE_I.mjs +0 -10
- package/dist/sqlite-DjOnMRh2.mjs +0 -1777
- package/drizzle/postgres/20260908072805_v2_initial/migration.sql +0 -58
- package/drizzle/postgres/20260908072805_v2_initial/snapshot.json +0 -686
- package/drizzle/postgres/20260908072806_v3_drop_original_seq/migration.sql +0 -1
- package/drizzle/postgres/20260908072806_v3_drop_original_seq/snapshot.json +0 -673
- package/drizzle/postgres/20260910120001_v3_storage_tables/migration.sql +0 -65
- package/drizzle/postgres/20260910120001_v3_storage_tables/snapshot.json +0 -1183
- package/drizzle/postgres/20260910130001_v3_session_title_backfill/migration.sql +0 -10
- package/drizzle/postgres/20260910130001_v3_session_title_backfill/snapshot.json +0 -1183
- package/drizzle/postgres/20260918120000_v3_event_usage/migration.sql +0 -14
- package/drizzle/postgres/20260918120000_v3_event_usage/snapshot.json +0 -1309
- package/drizzle/postgres/20260921075900_v3_agent_preset/migration.sql +0 -1
- package/drizzle/postgres/20260922090001_v3_pinned_seq/migration.sql +0 -2
- package/drizzle/postgres/20260922093001_v3_last_event_at/migration.sql +0 -10
- package/drizzle/postgres/20260923120000_v3_usage_materialized/migration.sql +0 -48
- package/drizzle/postgres/20261008103001_v3_schedule_tasks/migration.sql +0 -11
- package/drizzle/sqlite/20260908072751_v2_initial/migration.sql +0 -53
- package/drizzle/sqlite/20260908072751_v2_initial/snapshot.json +0 -492
- package/drizzle/sqlite/20260908072752_v3_drop_original_seq/migration.sql +0 -6
- package/drizzle/sqlite/20260908072752_v3_drop_original_seq/snapshot.json +0 -513
- package/drizzle/sqlite/20260910120000_v3_storage_tables/migration.sql +0 -66
- package/drizzle/sqlite/20260910120000_v3_storage_tables/snapshot.json +0 -905
- package/drizzle/sqlite/20260910130000_v3_session_title_backfill/migration.sql +0 -13
- package/drizzle/sqlite/20260910130000_v3_session_title_backfill/snapshot.json +0 -905
- package/drizzle/sqlite/20260918120000_v3_event_usage/migration.sql +0 -14
- package/drizzle/sqlite/20260918120000_v3_event_usage/snapshot.json +0 -1031
- package/drizzle/sqlite/20260921075855_v3_agent_preset/migration.sql +0 -7
- package/drizzle/sqlite/20260921075855_v3_agent_preset/snapshot.json +0 -1041
- package/drizzle/sqlite/20260922090000_v3_pinned_seq/migration.sql +0 -4
- package/drizzle/sqlite/20260922093000_v3_last_event_at/migration.sql +0 -13
- package/drizzle/sqlite/20260923120000_v3_usage_materialized/migration.sql +0 -48
- package/drizzle/sqlite/20261008103000_v3_schedule_tasks/migration.sql +0 -14
- package/src/adapters/index.ts +0 -12
- package/src/adapters/to-postgres.ts +0 -93
- package/src/adapters/to-sqlite.ts +0 -83
- package/src/adapters/types.ts +0 -44
- package/src/drizzle/postgres-v2.ts +0 -10
- package/src/drizzle/postgres-v3.ts +0 -18
- package/src/drizzle/sqlite-v2.ts +0 -9
- package/src/drizzle/sqlite-v3.ts +0 -18
- package/src/entities/v2/index.ts +0 -20
- package/src/entities/v2/session-events.ts +0 -10
- package/src/entities/v3/schedule-tasks.ts +0 -16
- package/src/entities/v3/workspace-sessions.ts +0 -19
- package/src/entities/v3/workspace-state.ts +0 -12
- package/src/entities/v3/workspaces.ts +0 -14
- package/src/gc.ts +0 -77
- package/src/postgres.ts +0 -1015
- package/src/sqlite.ts +0 -1086
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
ALTER TABLE "t_sessions" ADD COLUMN "f_archived_at" bigint;
|
|
2
|
-
--> statement-breakpoint
|
|
3
|
-
ALTER TABLE "t_sessions" ADD COLUMN "f_title" text;
|
|
4
|
-
--> statement-breakpoint
|
|
5
|
-
ALTER TABLE "t_sessions" ADD COLUMN "f_title_seq" integer;
|
|
6
|
-
--> statement-breakpoint
|
|
7
|
-
UPDATE "t_sessions" s SET "f_title" = sub.title, "f_title_seq" = sub.seq
|
|
8
|
-
FROM (
|
|
9
|
-
SELECT DISTINCT ON (b.f_session_id) b.f_session_id,
|
|
10
|
-
COALESCE(e.f_data::jsonb -> 'data' ->> 'title', e.f_data::jsonb ->> 'title') AS title,
|
|
11
|
-
b.f_sequence AS seq
|
|
12
|
-
FROM t_session_events b JOIN t_events e ON e.f_event_id = b.f_event_id
|
|
13
|
-
WHERE e.f_type = 'session/title'
|
|
14
|
-
ORDER BY b.f_session_id, b.f_sequence DESC
|
|
15
|
-
) sub
|
|
16
|
-
WHERE s.f_session_id = sub.f_session_id;
|
|
17
|
-
--> statement-breakpoint
|
|
18
|
-
CREATE TABLE "t_session_projcache_row" (
|
|
19
|
-
"f_id" serial PRIMARY KEY,
|
|
20
|
-
"f_session_id" text NOT NULL,
|
|
21
|
-
"f_key" text NOT NULL,
|
|
22
|
-
"f_ver" integer NOT NULL,
|
|
23
|
-
"f_seq" integer NOT NULL,
|
|
24
|
-
"f_val" text NOT NULL,
|
|
25
|
-
CONSTRAINT "uq_session_projcache_row_session_key" UNIQUE("f_session_id", "f_key")
|
|
26
|
-
);
|
|
27
|
-
--> statement-breakpoint
|
|
28
|
-
CREATE TABLE "t_storage_units" (
|
|
29
|
-
"f_name" text PRIMARY KEY,
|
|
30
|
-
"f_version" integer NOT NULL
|
|
31
|
-
);
|
|
32
|
-
--> statement-breakpoint
|
|
33
|
-
CREATE TABLE "t_workspace_state" (
|
|
34
|
-
"f_singleton" integer PRIMARY KEY,
|
|
35
|
-
"f_initialized" integer NOT NULL,
|
|
36
|
-
"f_pending_operation" text,
|
|
37
|
-
"f_pending_workspace_id" text,
|
|
38
|
-
CONSTRAINT "ck_workspace_state_singleton" CHECK (f_singleton = 1)
|
|
39
|
-
);
|
|
40
|
-
--> statement-breakpoint
|
|
41
|
-
CREATE TABLE "t_workspaces" (
|
|
42
|
-
"f_id" serial PRIMARY KEY,
|
|
43
|
-
"f_workspace_id" text NOT NULL UNIQUE,
|
|
44
|
-
"f_path" text NOT NULL,
|
|
45
|
-
"f_title" text NOT NULL,
|
|
46
|
-
"f_created_at" text NOT NULL,
|
|
47
|
-
"f_updated_at" text NOT NULL,
|
|
48
|
-
"f_position" integer DEFAULT -1 NOT NULL
|
|
49
|
-
);
|
|
50
|
-
--> statement-breakpoint
|
|
51
|
-
CREATE TABLE "t_workspace_sessions" (
|
|
52
|
-
"f_id" serial PRIMARY KEY,
|
|
53
|
-
"f_workspace_id" text NOT NULL,
|
|
54
|
-
"f_session_id" text NOT NULL,
|
|
55
|
-
"f_position" integer NOT NULL,
|
|
56
|
-
CONSTRAINT "uq_workspace_sessions_workspace_session" UNIQUE("f_workspace_id", "f_session_id")
|
|
57
|
-
);
|
|
58
|
-
--> statement-breakpoint
|
|
59
|
-
CREATE INDEX "idx_session_projcache_row_key" ON "t_session_projcache_row" ("f_key");
|
|
60
|
-
--> statement-breakpoint
|
|
61
|
-
CREATE INDEX "idx_workspace_sessions_session_id" ON "t_workspace_sessions" ("f_session_id");
|
|
62
|
-
--> statement-breakpoint
|
|
63
|
-
ALTER TABLE "t_session_projcache_row" ADD CONSTRAINT "fk_t_session_projcache_row_f_session_id_t_sessions_f_session_id_fk" FOREIGN KEY ("f_session_id") REFERENCES "t_sessions"("f_session_id") ON DELETE CASCADE;
|
|
64
|
-
--> statement-breakpoint
|
|
65
|
-
ALTER TABLE "t_workspace_sessions" ADD CONSTRAINT "fk_t_workspace_sessions_f_workspace_id_t_workspaces_f_workspace_id_fk" FOREIGN KEY ("f_workspace_id") REFERENCES "t_workspaces"("f_workspace_id") ON DELETE CASCADE;
|