@drfed/models 0.0.0-stage → 0.1.0-dev.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/LICENSE +661 -0
- package/README.md +230 -2
- package/dist/activity-delivery.d.mts +111 -0
- package/dist/activity-delivery.d.mts.map +1 -0
- package/dist/activity-delivery.mjs +240 -0
- package/dist/activity-delivery.mjs.map +1 -0
- package/dist/db-DtcLuISw.d.mts +3098 -0
- package/dist/db-DtcLuISw.d.mts.map +1 -0
- package/dist/db.d.mts +2 -0
- package/dist/db.mjs +3 -0
- package/dist/email.d.mts +39 -0
- package/dist/email.d.mts.map +1 -0
- package/dist/email.mjs +12 -0
- package/dist/email.mjs.map +1 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +18 -0
- package/dist/instance.d.mts +11 -0
- package/dist/instance.d.mts.map +1 -0
- package/dist/instance.mjs +21 -0
- package/dist/instance.mjs.map +1 -0
- package/dist/key.d.mts +2 -0
- package/dist/key.mjs +86 -0
- package/dist/key.mjs.map +1 -0
- package/dist/login.d.mts +49 -0
- package/dist/login.d.mts.map +1 -0
- package/dist/login.mjs +71 -0
- package/dist/login.mjs.map +1 -0
- package/dist/migrate.d.mts +46 -0
- package/dist/migrate.d.mts.map +1 -0
- package/dist/migrate.mjs +58 -0
- package/dist/migrate.mjs.map +1 -0
- package/dist/migration-manifest.d.mts +39 -0
- package/dist/migration-manifest.d.mts.map +1 -0
- package/dist/migration-manifest.mjs +77 -0
- package/dist/migration-manifest.mjs.map +1 -0
- package/dist/migration-session-B4xHeU_a.d.mts +56 -0
- package/dist/migration-session-B4xHeU_a.d.mts.map +1 -0
- package/dist/migration-session.d.mts +2 -0
- package/dist/migration-session.mjs +204 -0
- package/dist/migration-session.mjs.map +1 -0
- package/dist/migration-snapshot-OM5jQN1-.mjs +69 -0
- package/dist/migration-snapshot-OM5jQN1-.mjs.map +1 -0
- package/dist/migration-state.d.mts +41 -0
- package/dist/migration-state.d.mts.map +1 -0
- package/dist/migration-state.mjs +155 -0
- package/dist/migration-state.mjs.map +1 -0
- package/dist/migrations-manifest.json +109 -0
- package/dist/pglite-preparation.d.mts +23 -0
- package/dist/pglite-preparation.d.mts.map +1 -0
- package/dist/pglite-preparation.mjs +77 -0
- package/dist/pglite-preparation.mjs.map +1 -0
- package/dist/pglite-store.d.mts +29 -0
- package/dist/pglite-store.d.mts.map +1 -0
- package/dist/pglite-store.mjs +117 -0
- package/dist/pglite-store.mjs.map +1 -0
- package/dist/relations.d.mts +2 -0
- package/dist/relations.mjs +307 -0
- package/dist/relations.mjs.map +1 -0
- package/dist/resource.d.mts +50 -0
- package/dist/resource.d.mts.map +1 -0
- package/dist/resource.mjs +123 -0
- package/dist/resource.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/schema.d.mts +2 -0
- package/dist/schema.mjs +495 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/slug.d.mts +28 -0
- package/dist/slug.d.mts.map +1 -0
- package/dist/slug.mjs +55 -0
- package/dist/slug.mjs.map +1 -0
- package/dist/text.d.mts +10 -0
- package/dist/text.d.mts.map +1 -0
- package/dist/text.mjs +11 -0
- package/dist/text.mjs.map +1 -0
- package/dist/uuid-CKMzlIND.d.mts +26 -0
- package/dist/uuid-CKMzlIND.d.mts.map +1 -0
- package/dist/uuid.d.mts +2 -0
- package/dist/uuid.mjs +28 -0
- package/dist/uuid.mjs.map +1 -0
- package/drizzle/20260622021748_init/migration.sql +25 -0
- package/drizzle/20260622021748_init/snapshot.json +246 -0
- package/drizzle/20260623162238_dear_felicia_hardy/migration.sql +5 -0
- package/drizzle/20260623162238_dear_felicia_hardy/snapshot.json +321 -0
- package/drizzle/20260624094817_lethal_sinister_six/migration.sql +2 -0
- package/drizzle/20260624094817_lethal_sinister_six/snapshot.json +347 -0
- package/drizzle/20260716000333_email_auth/migration.sql +20 -0
- package/drizzle/20260716000333_email_auth/snapshot.json +575 -0
- package/drizzle/20260723065002_chief_colleen_wing/migration.sql +2 -0
- package/drizzle/20260723065002_chief_colleen_wing/snapshot.json +595 -0
- package/drizzle/20260802205417_separate-instance-local-remote/migration.sql +26 -0
- package/drizzle/20260802205417_separate-instance-local-remote/snapshot.json +768 -0
- package/drizzle/20260804061119_instances-local-remote-constraint/migration.sql +7 -0
- package/drizzle/20260804061119_instances-local-remote-constraint/snapshot.json +843 -0
- package/drizzle/20260818080259_dark_night_thrasher/migration.sql +15 -0
- package/drizzle/20260818080259_dark_night_thrasher/snapshot.json +722 -0
- package/drizzle/20260821072150_merge_remote_actors/migration.sql +54 -0
- package/drizzle/20260821072150_merge_remote_actors/snapshot.json +1312 -0
- package/drizzle/20260906052949_rename_followees_to_following/migration.sql +2 -0
- package/drizzle/20260906052949_rename_followees_to_following/snapshot.json +1315 -0
- package/drizzle/20260908062446_rename_login_tokens_to_login_challenges/migration.sql +1 -0
- package/drizzle/20260908062446_rename_login_tokens_to_login_challenges/snapshot.json +1312 -0
- package/drizzle/20260908065945_simplify_login_challenges/migration.sql +7 -0
- package/drizzle/20260908065945_simplify_login_challenges/snapshot.json +1290 -0
- package/drizzle/20260915061356_tighten_slug_constraint/migration.sql +12 -0
- package/drizzle/20260915061356_tighten_slug_constraint/snapshot.json +1290 -0
- package/drizzle/20260915063339_widen_instance_host/migration.sql +1 -0
- package/drizzle/20260915063339_widen_instance_host/snapshot.json +1290 -0
- package/drizzle/20260916085902_add_objects_activities_and_resources/migration.sql +110 -0
- package/drizzle/20260916085902_add_objects_activities_and_resources/snapshot.json +2263 -0
- package/drizzle/20260917163517_order_local_outbox_items/migration.sql +22 -0
- package/drizzle/20260917163517_order_local_outbox_items/snapshot.json +2263 -0
- package/drizzle/20260918071839_add_activity_object_index/migration.sql +1 -0
- package/drizzle/20260918071839_add_activity_object_index/snapshot.json +2298 -0
- package/drizzle/20261006061745_add_activity_deliveries_and_keys/migration.sql +106 -0
- package/drizzle/20261006061745_add_activity_deliveries_and_keys/snapshot.json +3538 -0
- package/drizzle/20261006085045_snake_case_columns/migration.sql +42 -0
- package/drizzle/20261006085045_snake_case_columns/snapshot.json +3570 -0
- package/drizzle/20261006122653_local_actor_keys/migration.sql +11 -0
- package/drizzle/20261006122653_local_actor_keys/snapshot.json +3627 -0
- package/drizzle/20261010044954_link_activity_deliveries_to_activities/migration.sql +8 -0
- package/drizzle/20261010044954_link_activity_deliveries_to_activities/snapshot.json +3714 -0
- package/drizzle/20261010073134_check_inbound_activity_link/migration.sql +1 -0
- package/drizzle/20261010073134_check_inbound_activity_link/snapshot.json +3721 -0
- package/drizzle/20261010104304_record_object_activity/migration.sql +3 -0
- package/drizzle/20261010104304_record_object_activity/snapshot.json +3756 -0
- package/drizzle/20261010111648_record_delivery_snapshot/migration.sql +29 -0
- package/drizzle/20261010111648_record_delivery_snapshot/snapshot.json +3769 -0
- package/drizzle/20261011144453_record_object_snapshot/migration.sql +10 -0
- package/drizzle/20261011144453_record_object_snapshot/snapshot.json +3808 -0
- package/drizzle/20261011192718_record_actor_followers/migration.sql +1 -0
- package/drizzle/20261011192718_record_actor_followers/snapshot.json +3821 -0
- package/package.json +181 -3
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
CREATE TYPE "activity_type" AS ENUM('Create');--> statement-breakpoint
|
|
2
|
+
CREATE TYPE "addressing_property" AS ENUM('to', 'cc', 'bto', 'bcc', 'audience');--> statement-breakpoint
|
|
3
|
+
CREATE TYPE "collection_role" AS ENUM('followers', 'following', 'featured', 'outbox');--> statement-breakpoint
|
|
4
|
+
CREATE TYPE "collection_type" AS ENUM('Collection', 'OrderedCollection');--> statement-breakpoint
|
|
5
|
+
CREATE TYPE "object_type" AS ENUM('Article', 'Note');--> statement-breakpoint
|
|
6
|
+
CREATE TYPE "resource_kind" AS ENUM('actor', 'object', 'activity', 'collection', 'unknown');--> statement-breakpoint
|
|
7
|
+
CREATE TABLE "activities" (
|
|
8
|
+
"id" uuid PRIMARY KEY,
|
|
9
|
+
"type" "activity_type" NOT NULL,
|
|
10
|
+
"actorId" uuid NOT NULL,
|
|
11
|
+
"objectId" uuid,
|
|
12
|
+
"published" timestamp with time zone NOT NULL,
|
|
13
|
+
"document" json,
|
|
14
|
+
"created" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
15
|
+
);
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
CREATE TABLE "actor_collection_references" (
|
|
18
|
+
"actorId" uuid,
|
|
19
|
+
"role" "collection_role",
|
|
20
|
+
"collectionId" uuid NOT NULL,
|
|
21
|
+
CONSTRAINT "actor_collection_references_pkey" PRIMARY KEY("actorId","role")
|
|
22
|
+
);
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
CREATE TABLE "addressing" (
|
|
25
|
+
"id" uuid PRIMARY KEY,
|
|
26
|
+
"sourceId" uuid NOT NULL,
|
|
27
|
+
"property" "addressing_property" NOT NULL,
|
|
28
|
+
"position" integer NOT NULL,
|
|
29
|
+
"targetId" uuid NOT NULL,
|
|
30
|
+
CONSTRAINT "addressing_source_property_position_key" UNIQUE("sourceId","property","position")
|
|
31
|
+
);
|
|
32
|
+
--> statement-breakpoint
|
|
33
|
+
CREATE TABLE "collection_items" (
|
|
34
|
+
"collectionId" uuid,
|
|
35
|
+
"itemId" uuid,
|
|
36
|
+
"position" integer,
|
|
37
|
+
"observed" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
38
|
+
CONSTRAINT "collection_items_pkey" PRIMARY KEY("collectionId","itemId")
|
|
39
|
+
);
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
CREATE TABLE "collections" (
|
|
42
|
+
"id" uuid PRIMARY KEY,
|
|
43
|
+
"type" "collection_type" NOT NULL,
|
|
44
|
+
"ownerActorId" uuid,
|
|
45
|
+
"totalItems" integer,
|
|
46
|
+
"document" json,
|
|
47
|
+
"updated" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
48
|
+
);
|
|
49
|
+
--> statement-breakpoint
|
|
50
|
+
CREATE TABLE "objects" (
|
|
51
|
+
"id" uuid PRIMARY KEY,
|
|
52
|
+
"actorId" uuid NOT NULL,
|
|
53
|
+
"type" "object_type" NOT NULL,
|
|
54
|
+
"document" json,
|
|
55
|
+
"url" text,
|
|
56
|
+
"name" text,
|
|
57
|
+
"summary" text,
|
|
58
|
+
"contentHtml" text NOT NULL,
|
|
59
|
+
"language" varchar(35),
|
|
60
|
+
"sensitive" boolean DEFAULT false NOT NULL,
|
|
61
|
+
"published" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
62
|
+
"updated" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
63
|
+
"created" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
64
|
+
"deleted" timestamp with time zone,
|
|
65
|
+
CONSTRAINT "objects_content_html_check" CHECK (trim(both from "contentHtml") <> '')
|
|
66
|
+
);
|
|
67
|
+
--> statement-breakpoint
|
|
68
|
+
CREATE TABLE "resources" (
|
|
69
|
+
"id" uuid PRIMARY KEY,
|
|
70
|
+
"iri" text NOT NULL UNIQUE,
|
|
71
|
+
"kind" "resource_kind" NOT NULL,
|
|
72
|
+
"created" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
73
|
+
);
|
|
74
|
+
--> statement-breakpoint
|
|
75
|
+
-- Register existing actors as resources before their IRI column disappears.
|
|
76
|
+
INSERT INTO resources (id, iri, kind, created) SELECT id, iri, 'actor', created FROM actors;
|
|
77
|
+
--> statement-breakpoint
|
|
78
|
+
ALTER TABLE "actors" DROP CONSTRAINT "actors_iri_key";--> statement-breakpoint
|
|
79
|
+
ALTER TABLE "actors" ADD COLUMN "document" json;--> statement-breakpoint
|
|
80
|
+
ALTER TABLE "actors" DROP COLUMN "iri";--> statement-breakpoint
|
|
81
|
+
ALTER TABLE "actors" DROP COLUMN "outboxUrl";--> statement-breakpoint
|
|
82
|
+
ALTER TABLE "actors" DROP COLUMN "followersUrl";--> statement-breakpoint
|
|
83
|
+
ALTER TABLE "actors" DROP COLUMN "followingUrl";--> statement-breakpoint
|
|
84
|
+
ALTER TABLE "actors" DROP COLUMN "featuredUrl";--> statement-breakpoint
|
|
85
|
+
-- Object counts are derived from objects.deleted instead of a stored counter.
|
|
86
|
+
ALTER TABLE "actors" DROP COLUMN "postsCount";--> statement-breakpoint
|
|
87
|
+
CREATE INDEX "activity_actor_published_index" ON "activities" ("actorId","published" desc,"id" desc);--> statement-breakpoint
|
|
88
|
+
CREATE INDEX "actor_collection_reference_collection_index" ON "actor_collection_references" ("collectionId");--> statement-breakpoint
|
|
89
|
+
CREATE INDEX "addressing_target_property_index" ON "addressing" ("targetId","property");--> statement-breakpoint
|
|
90
|
+
CREATE INDEX "collection_item_position_index" ON "collection_items" ("collectionId","position");--> statement-breakpoint
|
|
91
|
+
CREATE INDEX "object_actor_published_index" ON "objects" ("actorId","published" desc,"id" desc);--> statement-breakpoint
|
|
92
|
+
ALTER TABLE "activities" ADD CONSTRAINT "activities_id_resources_id_fkey" FOREIGN KEY ("id") REFERENCES "resources"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
93
|
+
ALTER TABLE "activities" ADD CONSTRAINT "activities_actorId_actors_id_fkey" FOREIGN KEY ("actorId") REFERENCES "actors"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
94
|
+
ALTER TABLE "activities" ADD CONSTRAINT "activities_objectId_resources_id_fkey" FOREIGN KEY ("objectId") REFERENCES "resources"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
95
|
+
ALTER TABLE "actor_collection_references" ADD CONSTRAINT "actor_collection_references_actorId_actors_id_fkey" FOREIGN KEY ("actorId") REFERENCES "actors"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
96
|
+
ALTER TABLE "actor_collection_references" ADD CONSTRAINT "actor_collection_references_collectionId_collections_id_fkey" FOREIGN KEY ("collectionId") REFERENCES "collections"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
97
|
+
ALTER TABLE "actors" ADD CONSTRAINT "actors_id_resources_id_fkey" FOREIGN KEY ("id") REFERENCES "resources"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
98
|
+
ALTER TABLE "addressing" ADD CONSTRAINT "addressing_sourceId_resources_id_fkey" FOREIGN KEY ("sourceId") REFERENCES "resources"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
99
|
+
ALTER TABLE "addressing" ADD CONSTRAINT "addressing_targetId_resources_id_fkey" FOREIGN KEY ("targetId") REFERENCES "resources"("id") ON DELETE RESTRICT;--> statement-breakpoint
|
|
100
|
+
ALTER TABLE "collection_items" ADD CONSTRAINT "collection_items_collectionId_collections_id_fkey" FOREIGN KEY ("collectionId") REFERENCES "collections"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
101
|
+
ALTER TABLE "collection_items" ADD CONSTRAINT "collection_items_itemId_resources_id_fkey" FOREIGN KEY ("itemId") REFERENCES "resources"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
102
|
+
ALTER TABLE "collections" ADD CONSTRAINT "collections_id_resources_id_fkey" FOREIGN KEY ("id") REFERENCES "resources"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
103
|
+
ALTER TABLE "collections" ADD CONSTRAINT "collections_ownerActorId_actors_id_fkey" FOREIGN KEY ("ownerActorId") REFERENCES "actors"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
104
|
+
ALTER TABLE "objects" ADD CONSTRAINT "objects_id_resources_id_fkey" FOREIGN KEY ("id") REFERENCES "resources"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
105
|
+
ALTER TABLE "objects" ADD CONSTRAINT "objects_actorId_actors_id_fkey" FOREIGN KEY ("actorId") REFERENCES "actors"("id") ON DELETE CASCADE;
|
|
106
|
+
--> statement-breakpoint
|
|
107
|
+
-- The public addressing collection has a fixed identifier (PUBLIC_RESOURCE_ID).
|
|
108
|
+
INSERT INTO resources (id, iri, kind) VALUES ('00000000-0000-4000-8000-000000000000', 'https://www.w3.org/ns/activitystreams#Public', 'collection');
|
|
109
|
+
--> statement-breakpoint
|
|
110
|
+
INSERT INTO collections (id, type) VALUES ('00000000-0000-4000-8000-000000000000', 'Collection');
|