@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,307 @@
|
|
|
1
|
+
import { t as schema_exports } from "./schema.mjs";
|
|
2
|
+
import { defineRelations } from "drizzle-orm";
|
|
3
|
+
//#region src/relations.ts
|
|
4
|
+
const relations = defineRelations(schema_exports, (r) => ({
|
|
5
|
+
keys: { versions: r.many.keyVersions({
|
|
6
|
+
from: r.keys.id,
|
|
7
|
+
to: r.keyVersions.keyId
|
|
8
|
+
}) },
|
|
9
|
+
keyVersions: {
|
|
10
|
+
key: r.one.keys({
|
|
11
|
+
from: r.keyVersions.keyId,
|
|
12
|
+
to: r.keys.id,
|
|
13
|
+
optional: false
|
|
14
|
+
}),
|
|
15
|
+
activityDeliveries: r.many.activityDeliveries({
|
|
16
|
+
from: r.keyVersions.id,
|
|
17
|
+
to: r.activityDeliveries.verificationKeyId
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
activityDeliveries: {
|
|
21
|
+
instance: r.one.instances({
|
|
22
|
+
from: r.activityDeliveries.instanceId,
|
|
23
|
+
to: r.instances.id,
|
|
24
|
+
optional: false
|
|
25
|
+
}),
|
|
26
|
+
actor: r.one.actors({
|
|
27
|
+
from: r.activityDeliveries.actorId,
|
|
28
|
+
to: r.actors.id,
|
|
29
|
+
where: { deleted: { isNull: true } }
|
|
30
|
+
}),
|
|
31
|
+
actorLinks: r.many.activityDeliveryActors({
|
|
32
|
+
from: r.activityDeliveries.id,
|
|
33
|
+
to: r.activityDeliveryActors.deliveryId
|
|
34
|
+
}),
|
|
35
|
+
verificationKey: r.one.keyVersions({
|
|
36
|
+
from: r.activityDeliveries.verificationKeyId,
|
|
37
|
+
to: r.keyVersions.id
|
|
38
|
+
}),
|
|
39
|
+
attempts: r.many.activityDeliveryAttempts({
|
|
40
|
+
from: r.activityDeliveries.id,
|
|
41
|
+
to: r.activityDeliveryAttempts.deliveryId
|
|
42
|
+
}),
|
|
43
|
+
activity: r.one.activities({
|
|
44
|
+
from: r.activityDeliveries.activityId,
|
|
45
|
+
to: r.activities.id
|
|
46
|
+
})
|
|
47
|
+
},
|
|
48
|
+
activityDeliveryAttempts: { delivery: r.one.activityDeliveries({
|
|
49
|
+
from: r.activityDeliveryAttempts.deliveryId,
|
|
50
|
+
to: r.activityDeliveries.id,
|
|
51
|
+
optional: false
|
|
52
|
+
}) },
|
|
53
|
+
activityDeliveryActors: {
|
|
54
|
+
delivery: r.one.activityDeliveries({
|
|
55
|
+
from: r.activityDeliveryActors.deliveryId,
|
|
56
|
+
to: r.activityDeliveries.id,
|
|
57
|
+
optional: false
|
|
58
|
+
}),
|
|
59
|
+
actor: r.one.actors({
|
|
60
|
+
from: r.activityDeliveryActors.actorId,
|
|
61
|
+
to: r.actors.id,
|
|
62
|
+
optional: false
|
|
63
|
+
}),
|
|
64
|
+
collections: r.many.activityDeliveryActorCollections({
|
|
65
|
+
from: [r.activityDeliveryActors.deliveryId, r.activityDeliveryActors.actorId],
|
|
66
|
+
to: [r.activityDeliveryActorCollections.deliveryId, r.activityDeliveryActorCollections.actorId]
|
|
67
|
+
})
|
|
68
|
+
},
|
|
69
|
+
activityDeliveryActorCollections: { actorLink: r.one.activityDeliveryActors({
|
|
70
|
+
from: [r.activityDeliveryActorCollections.deliveryId, r.activityDeliveryActorCollections.actorId],
|
|
71
|
+
to: [r.activityDeliveryActors.deliveryId, r.activityDeliveryActors.actorId],
|
|
72
|
+
optional: false
|
|
73
|
+
}) },
|
|
74
|
+
accounts: {
|
|
75
|
+
instances: r.many.instances({
|
|
76
|
+
from: r.accounts.id.through(r.instanceMembers.accountId),
|
|
77
|
+
to: r.instances.id.through(r.instanceMembers.instanceId)
|
|
78
|
+
}),
|
|
79
|
+
instanceMembers: r.many.instanceMembers({
|
|
80
|
+
from: r.accounts.id,
|
|
81
|
+
to: r.instanceMembers.accountId,
|
|
82
|
+
where: { accepted: { isNotNull: true } }
|
|
83
|
+
}),
|
|
84
|
+
sessions: r.many.sessions({
|
|
85
|
+
from: r.accounts.id,
|
|
86
|
+
to: r.sessions.accountId
|
|
87
|
+
}),
|
|
88
|
+
loginChallenges: r.many.loginChallenges({
|
|
89
|
+
from: r.accounts.id,
|
|
90
|
+
to: r.loginChallenges.accountId
|
|
91
|
+
})
|
|
92
|
+
},
|
|
93
|
+
instanceMembers: {
|
|
94
|
+
account: r.one.accounts({
|
|
95
|
+
from: r.instanceMembers.accountId,
|
|
96
|
+
to: r.accounts.id
|
|
97
|
+
}),
|
|
98
|
+
instance: r.one.instances({
|
|
99
|
+
from: r.instanceMembers.instanceId,
|
|
100
|
+
to: r.instances.id
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
instances: {
|
|
104
|
+
activityDeliveries: r.many.activityDeliveries({
|
|
105
|
+
from: r.instances.id,
|
|
106
|
+
to: r.activityDeliveries.instanceId
|
|
107
|
+
}),
|
|
108
|
+
members: r.many.accounts({
|
|
109
|
+
from: r.instances.id.through(r.instanceMembers.instanceId),
|
|
110
|
+
to: r.accounts.id.through(r.instanceMembers.accountId)
|
|
111
|
+
}),
|
|
112
|
+
instanceMembers: r.many.instanceMembers({
|
|
113
|
+
from: r.instances.id,
|
|
114
|
+
to: r.instanceMembers.instanceId,
|
|
115
|
+
where: { accepted: { isNotNull: true } }
|
|
116
|
+
}),
|
|
117
|
+
actors: r.many.actors({
|
|
118
|
+
from: r.instances.id,
|
|
119
|
+
to: r.actors.instanceId,
|
|
120
|
+
where: { deleted: { isNull: true } }
|
|
121
|
+
}),
|
|
122
|
+
localInstance: r.one.localInstances({
|
|
123
|
+
from: r.instances.localId,
|
|
124
|
+
to: r.localInstances.id
|
|
125
|
+
})
|
|
126
|
+
},
|
|
127
|
+
localInstances: { instance: r.one.instances({
|
|
128
|
+
from: r.localInstances.id,
|
|
129
|
+
to: r.instances.localId
|
|
130
|
+
}) },
|
|
131
|
+
sessions: { account: r.one.accounts({
|
|
132
|
+
from: r.sessions.accountId,
|
|
133
|
+
to: r.accounts.id,
|
|
134
|
+
optional: false
|
|
135
|
+
}) },
|
|
136
|
+
loginChallenges: { account: r.one.accounts({
|
|
137
|
+
from: r.loginChallenges.accountId,
|
|
138
|
+
to: r.accounts.id,
|
|
139
|
+
optional: false
|
|
140
|
+
}) },
|
|
141
|
+
resources: {
|
|
142
|
+
actor: r.one.actors({
|
|
143
|
+
from: r.resources.id,
|
|
144
|
+
to: r.actors.id,
|
|
145
|
+
optional: true
|
|
146
|
+
}),
|
|
147
|
+
object: r.one.objects({
|
|
148
|
+
from: r.resources.id,
|
|
149
|
+
to: r.objects.id,
|
|
150
|
+
optional: true
|
|
151
|
+
}),
|
|
152
|
+
activity: r.one.activities({
|
|
153
|
+
from: r.resources.id,
|
|
154
|
+
to: r.activities.id,
|
|
155
|
+
optional: true
|
|
156
|
+
}),
|
|
157
|
+
collection: r.one.collections({
|
|
158
|
+
from: r.resources.id,
|
|
159
|
+
to: r.collections.id,
|
|
160
|
+
optional: true
|
|
161
|
+
}),
|
|
162
|
+
addressedBy: r.many.addressing({
|
|
163
|
+
from: r.resources.id,
|
|
164
|
+
to: r.addressing.targetId
|
|
165
|
+
})
|
|
166
|
+
},
|
|
167
|
+
addressing: {
|
|
168
|
+
source: r.one.resources({
|
|
169
|
+
from: r.addressing.sourceId,
|
|
170
|
+
to: r.resources.id,
|
|
171
|
+
optional: false
|
|
172
|
+
}),
|
|
173
|
+
targetResource: r.one.resources({
|
|
174
|
+
from: r.addressing.targetId,
|
|
175
|
+
to: r.resources.id,
|
|
176
|
+
optional: false
|
|
177
|
+
})
|
|
178
|
+
},
|
|
179
|
+
actorCollectionReferences: {
|
|
180
|
+
actor: r.one.actors({
|
|
181
|
+
from: r.actorCollectionReferences.actorId,
|
|
182
|
+
to: r.actors.id,
|
|
183
|
+
optional: false
|
|
184
|
+
}),
|
|
185
|
+
collection: r.one.collections({
|
|
186
|
+
from: r.actorCollectionReferences.collectionId,
|
|
187
|
+
to: r.collections.id,
|
|
188
|
+
optional: false
|
|
189
|
+
})
|
|
190
|
+
},
|
|
191
|
+
collections: {
|
|
192
|
+
resource: r.one.resources({
|
|
193
|
+
from: r.collections.id,
|
|
194
|
+
to: r.resources.id,
|
|
195
|
+
optional: false
|
|
196
|
+
}),
|
|
197
|
+
ownerActor: r.one.actors({
|
|
198
|
+
from: r.collections.ownerActorId,
|
|
199
|
+
to: r.actors.id
|
|
200
|
+
}),
|
|
201
|
+
items: r.many.collectionItems({
|
|
202
|
+
from: r.collections.id,
|
|
203
|
+
to: r.collectionItems.collectionId
|
|
204
|
+
})
|
|
205
|
+
},
|
|
206
|
+
collectionItems: {
|
|
207
|
+
collection: r.one.collections({
|
|
208
|
+
from: r.collectionItems.collectionId,
|
|
209
|
+
to: r.collections.id,
|
|
210
|
+
optional: false
|
|
211
|
+
}),
|
|
212
|
+
item: r.one.resources({
|
|
213
|
+
from: r.collectionItems.itemId,
|
|
214
|
+
to: r.resources.id,
|
|
215
|
+
optional: false
|
|
216
|
+
})
|
|
217
|
+
},
|
|
218
|
+
activities: {
|
|
219
|
+
resource: r.one.resources({
|
|
220
|
+
from: r.activities.id,
|
|
221
|
+
to: r.resources.id,
|
|
222
|
+
optional: false
|
|
223
|
+
}),
|
|
224
|
+
actor: r.one.actors({
|
|
225
|
+
from: r.activities.actorId,
|
|
226
|
+
to: r.actors.id,
|
|
227
|
+
optional: false
|
|
228
|
+
}),
|
|
229
|
+
object: r.one.resources({
|
|
230
|
+
from: r.activities.objectId,
|
|
231
|
+
to: r.resources.id
|
|
232
|
+
}),
|
|
233
|
+
addressing: r.many.addressing({
|
|
234
|
+
from: r.activities.id,
|
|
235
|
+
to: r.addressing.sourceId
|
|
236
|
+
}),
|
|
237
|
+
deliveries: r.many.activityDeliveries({
|
|
238
|
+
from: r.activities.id,
|
|
239
|
+
to: r.activityDeliveries.activityId
|
|
240
|
+
})
|
|
241
|
+
},
|
|
242
|
+
objects: {
|
|
243
|
+
resource: r.one.resources({
|
|
244
|
+
from: r.objects.id,
|
|
245
|
+
to: r.resources.id,
|
|
246
|
+
optional: false
|
|
247
|
+
}),
|
|
248
|
+
addressing: r.many.addressing({
|
|
249
|
+
from: r.objects.id,
|
|
250
|
+
to: r.addressing.sourceId
|
|
251
|
+
}),
|
|
252
|
+
activities: r.many.activities({
|
|
253
|
+
from: r.objects.id,
|
|
254
|
+
to: r.activities.objectId
|
|
255
|
+
}),
|
|
256
|
+
actor: r.one.actors({
|
|
257
|
+
from: r.objects.actorId,
|
|
258
|
+
to: r.actors.id,
|
|
259
|
+
optional: false
|
|
260
|
+
})
|
|
261
|
+
},
|
|
262
|
+
actors: {
|
|
263
|
+
activityDeliveryLinks: r.many.activityDeliveryActors({
|
|
264
|
+
from: r.actors.id,
|
|
265
|
+
to: r.activityDeliveryActors.actorId
|
|
266
|
+
}),
|
|
267
|
+
collectionReferences: r.many.actorCollectionReferences({
|
|
268
|
+
from: r.actors.id,
|
|
269
|
+
to: r.actorCollectionReferences.actorId
|
|
270
|
+
}),
|
|
271
|
+
resource: r.one.resources({
|
|
272
|
+
from: r.actors.id,
|
|
273
|
+
to: r.resources.id,
|
|
274
|
+
optional: false
|
|
275
|
+
}),
|
|
276
|
+
collections: r.many.collections({
|
|
277
|
+
from: r.actors.id,
|
|
278
|
+
to: r.collections.ownerActorId
|
|
279
|
+
}),
|
|
280
|
+
activities: r.many.activities({
|
|
281
|
+
from: r.actors.id,
|
|
282
|
+
to: r.activities.actorId
|
|
283
|
+
}),
|
|
284
|
+
objects: r.many.objects({
|
|
285
|
+
from: r.actors.id,
|
|
286
|
+
to: r.objects.actorId,
|
|
287
|
+
where: { deleted: { isNull: true } }
|
|
288
|
+
}),
|
|
289
|
+
instance: r.one.instances({
|
|
290
|
+
from: r.actors.instanceId,
|
|
291
|
+
to: r.instances.id,
|
|
292
|
+
optional: false
|
|
293
|
+
}),
|
|
294
|
+
localActor: r.one.localActors({
|
|
295
|
+
from: r.actors.localId,
|
|
296
|
+
to: r.localActors.id
|
|
297
|
+
})
|
|
298
|
+
},
|
|
299
|
+
localActors: { actor: r.one.actors({
|
|
300
|
+
from: r.localActors.id,
|
|
301
|
+
to: r.actors.localId
|
|
302
|
+
}) }
|
|
303
|
+
}));
|
|
304
|
+
//#endregion
|
|
305
|
+
export { relations as default, relations };
|
|
306
|
+
|
|
307
|
+
//# sourceMappingURL=relations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relations.mjs","names":["schema"],"sources":["../src/relations.ts"],"sourcesContent":["// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nimport { defineRelations } from \"drizzle-orm\";\n\nimport * as schema from \"./schema.ts\";\n\nexport const relations = defineRelations(schema, (r) => ({\n keys: {\n versions: r.many.keyVersions({ from: r.keys.id, to: r.keyVersions.keyId }),\n },\n keyVersions: {\n key: r.one.keys({\n from: r.keyVersions.keyId,\n to: r.keys.id,\n optional: false,\n }),\n activityDeliveries: r.many.activityDeliveries({\n from: r.keyVersions.id,\n to: r.activityDeliveries.verificationKeyId,\n }),\n },\n activityDeliveries: {\n instance: r.one.instances({\n from: r.activityDeliveries.instanceId,\n to: r.instances.id,\n optional: false,\n }),\n actor: r.one.actors({\n from: r.activityDeliveries.actorId,\n to: r.actors.id,\n where: { deleted: { isNull: true } },\n }),\n actorLinks: r.many.activityDeliveryActors({\n from: r.activityDeliveries.id,\n to: r.activityDeliveryActors.deliveryId,\n }),\n verificationKey: r.one.keyVersions({\n from: r.activityDeliveries.verificationKeyId,\n to: r.keyVersions.id,\n }),\n attempts: r.many.activityDeliveryAttempts({\n from: r.activityDeliveries.id,\n to: r.activityDeliveryAttempts.deliveryId,\n }),\n activity: r.one.activities({\n from: r.activityDeliveries.activityId,\n to: r.activities.id,\n }),\n },\n activityDeliveryAttempts: {\n delivery: r.one.activityDeliveries({\n from: r.activityDeliveryAttempts.deliveryId,\n to: r.activityDeliveries.id,\n optional: false,\n }),\n },\n activityDeliveryActors: {\n delivery: r.one.activityDeliveries({\n from: r.activityDeliveryActors.deliveryId,\n to: r.activityDeliveries.id,\n optional: false,\n }),\n actor: r.one.actors({\n from: r.activityDeliveryActors.actorId,\n to: r.actors.id,\n optional: false,\n }),\n collections: r.many.activityDeliveryActorCollections({\n from: [\n r.activityDeliveryActors.deliveryId,\n r.activityDeliveryActors.actorId,\n ],\n to: [\n r.activityDeliveryActorCollections.deliveryId,\n r.activityDeliveryActorCollections.actorId,\n ],\n }),\n },\n activityDeliveryActorCollections: {\n actorLink: r.one.activityDeliveryActors({\n from: [\n r.activityDeliveryActorCollections.deliveryId,\n r.activityDeliveryActorCollections.actorId,\n ],\n to: [\n r.activityDeliveryActors.deliveryId,\n r.activityDeliveryActors.actorId,\n ],\n optional: false,\n }),\n },\n accounts: {\n instances: r.many.instances({\n from: r.accounts.id.through(r.instanceMembers.accountId),\n to: r.instances.id.through(r.instanceMembers.instanceId),\n // Drizzle ORM currently does not support many-to-many relationships with\n // additional filters on the junction table. So we need to specify\n // filter `accepted IS NOT NULL` everywhere we query for instances of\n // an account (sigh). See also the below issue:\n // https://github.com/drizzle-team/drizzle-orm/issues/5343\n }),\n instanceMembers: r.many.instanceMembers({\n from: r.accounts.id,\n to: r.instanceMembers.accountId,\n where: {\n accepted: { isNotNull: true },\n },\n }),\n sessions: r.many.sessions({\n from: r.accounts.id,\n to: r.sessions.accountId,\n }),\n loginChallenges: r.many.loginChallenges({\n from: r.accounts.id,\n to: r.loginChallenges.accountId,\n }),\n },\n instanceMembers: {\n account: r.one.accounts({\n from: r.instanceMembers.accountId,\n to: r.accounts.id,\n }),\n instance: r.one.instances({\n from: r.instanceMembers.instanceId,\n to: r.instances.id,\n }),\n },\n instances: {\n activityDeliveries: r.many.activityDeliveries({\n from: r.instances.id,\n to: r.activityDeliveries.instanceId,\n }),\n members: r.many.accounts({\n from: r.instances.id.through(r.instanceMembers.instanceId),\n to: r.accounts.id.through(r.instanceMembers.accountId),\n // Drizzle ORM currently does not support many-to-many relationships with\n // additional filters on the junction table. So we need to specify\n // filter `accepted IS NOT NULL` everywhere we query for members of\n // an instance (sigh). See also the below issue:\n // https://github.com/drizzle-team/drizzle-orm/issues/5343\n }),\n instanceMembers: r.many.instanceMembers({\n from: r.instances.id,\n to: r.instanceMembers.instanceId,\n where: {\n accepted: { isNotNull: true },\n },\n }),\n actors: r.many.actors({\n from: r.instances.id,\n to: r.actors.instanceId,\n where: { deleted: { isNull: true } },\n }),\n localInstance: r.one.localInstances({\n from: r.instances.localId,\n to: r.localInstances.id,\n }),\n },\n localInstances: {\n instance: r.one.instances({\n from: r.localInstances.id,\n to: r.instances.localId,\n }),\n },\n sessions: {\n account: r.one.accounts({\n from: r.sessions.accountId,\n to: r.accounts.id,\n optional: false,\n }),\n },\n loginChallenges: {\n account: r.one.accounts({\n from: r.loginChallenges.accountId,\n to: r.accounts.id,\n optional: false,\n }),\n },\n resources: {\n actor: r.one.actors({\n from: r.resources.id,\n to: r.actors.id,\n optional: true,\n }),\n object: r.one.objects({\n from: r.resources.id,\n to: r.objects.id,\n optional: true,\n }),\n activity: r.one.activities({\n from: r.resources.id,\n to: r.activities.id,\n optional: true,\n }),\n collection: r.one.collections({\n from: r.resources.id,\n to: r.collections.id,\n optional: true,\n }),\n addressedBy: r.many.addressing({\n from: r.resources.id,\n to: r.addressing.targetId,\n }),\n },\n addressing: {\n source: r.one.resources({\n from: r.addressing.sourceId,\n to: r.resources.id,\n optional: false,\n }),\n targetResource: r.one.resources({\n from: r.addressing.targetId,\n to: r.resources.id,\n optional: false,\n }),\n },\n actorCollectionReferences: {\n actor: r.one.actors({\n from: r.actorCollectionReferences.actorId,\n to: r.actors.id,\n optional: false,\n }),\n collection: r.one.collections({\n from: r.actorCollectionReferences.collectionId,\n to: r.collections.id,\n optional: false,\n }),\n },\n collections: {\n resource: r.one.resources({\n from: r.collections.id,\n to: r.resources.id,\n optional: false,\n }),\n ownerActor: r.one.actors({\n from: r.collections.ownerActorId,\n to: r.actors.id,\n }),\n items: r.many.collectionItems({\n from: r.collections.id,\n to: r.collectionItems.collectionId,\n }),\n },\n collectionItems: {\n collection: r.one.collections({\n from: r.collectionItems.collectionId,\n to: r.collections.id,\n optional: false,\n }),\n item: r.one.resources({\n from: r.collectionItems.itemId,\n to: r.resources.id,\n optional: false,\n }),\n },\n activities: {\n resource: r.one.resources({\n from: r.activities.id,\n to: r.resources.id,\n optional: false,\n }),\n actor: r.one.actors({\n from: r.activities.actorId,\n to: r.actors.id,\n optional: false,\n }),\n object: r.one.resources({\n from: r.activities.objectId,\n to: r.resources.id,\n }),\n addressing: r.many.addressing({\n from: r.activities.id,\n to: r.addressing.sourceId,\n }),\n deliveries: r.many.activityDeliveries({\n from: r.activities.id,\n to: r.activityDeliveries.activityId,\n }),\n },\n objects: {\n resource: r.one.resources({\n from: r.objects.id,\n to: r.resources.id,\n optional: false,\n }),\n addressing: r.many.addressing({\n from: r.objects.id,\n to: r.addressing.sourceId,\n }),\n activities: r.many.activities({\n from: r.objects.id,\n to: r.activities.objectId,\n }),\n actor: r.one.actors({\n from: r.objects.actorId,\n to: r.actors.id,\n optional: false,\n }),\n },\n actors: {\n activityDeliveryLinks: r.many.activityDeliveryActors({\n from: r.actors.id,\n to: r.activityDeliveryActors.actorId,\n }),\n collectionReferences: r.many.actorCollectionReferences({\n from: r.actors.id,\n to: r.actorCollectionReferences.actorId,\n }),\n resource: r.one.resources({\n from: r.actors.id,\n to: r.resources.id,\n optional: false,\n }),\n collections: r.many.collections({\n from: r.actors.id,\n to: r.collections.ownerActorId,\n }),\n activities: r.many.activities({\n from: r.actors.id,\n to: r.activities.actorId,\n }),\n objects: r.many.objects({\n from: r.actors.id,\n to: r.objects.actorId,\n where: { deleted: { isNull: true } },\n }),\n instance: r.one.instances({\n from: r.actors.instanceId,\n to: r.instances.id,\n optional: false,\n }),\n localActor: r.one.localActors({\n from: r.actors.localId,\n to: r.localActors.id,\n }),\n },\n localActors: {\n actor: r.one.actors({ from: r.localActors.id, to: r.actors.localId }),\n },\n}));\n\nexport default relations;\n"],"mappings":";;;AAoBA,MAAa,YAAY,gBAAgBA,iBAAS,OAAO;CACvD,MAAM,EACJ,UAAU,EAAE,KAAK,YAAY;EAAE,MAAM,EAAE,KAAK;EAAI,IAAI,EAAE,YAAY;CAAM,CAAC,EAC3E;CACA,aAAa;EACX,KAAK,EAAE,IAAI,KAAK;GACd,MAAM,EAAE,YAAY;GACpB,IAAI,EAAE,KAAK;GACX,UAAU;EACZ,CAAC;EACD,oBAAoB,EAAE,KAAK,mBAAmB;GAC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OAAO;GACf,IAAI,EAAE,UAAU;GAChB,UAAU;EACZ,CAAC;EACD,YAAY,EAAE,IAAI,YAAY;GAC5B,MAAM,EAAE,OAAO;GACf,IAAI,EAAE,YAAY;EACpB,CAAC;CACH;CACA,aAAa,EACX,OAAO,EAAE,IAAI,OAAO;EAAE,MAAM,EAAE,YAAY;EAAI,IAAI,EAAE,OAAO;CAAQ,CAAC,EACtE;AACF,EAAE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { W as Resource, b as CollectionRole, r as Transaction, t as Database, v as AddressingProperty } from "./db-DtcLuISw.mjs";
|
|
2
|
+
import { t as Uuid } from "./uuid-CKMzlIND.mjs";
|
|
3
|
+
//#region src/resource.d.ts
|
|
4
|
+
declare const PUBLIC_IRI = "https://www.w3.org/ns/activitystreams#Public";
|
|
5
|
+
declare const PUBLIC_RESOURCE_ID: Uuid;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the canonical resource without interpreting or normalizing its IRI.
|
|
8
|
+
* @returns The existing or newly registered resource.
|
|
9
|
+
*/
|
|
10
|
+
declare function ensureResource(tx: Database | Transaction, iri: string, id?: `${string}-${string}-${string}-${string}-${string}`): Promise<Resource>;
|
|
11
|
+
/**
|
|
12
|
+
* Locks resources for promotion in IRI order, so that transactions promoting
|
|
13
|
+
* several of them never wait for each other in a cycle. Only registered IRIs
|
|
14
|
+
* are locked; see {@link ensureResource}.
|
|
15
|
+
*/
|
|
16
|
+
declare function lockResources(tx: Transaction, iris: readonly string[]): Promise<void>;
|
|
17
|
+
/** Thrown when an IRI is already registered as another kind of resource. */
|
|
18
|
+
declare class ResourceKindConflictError extends Error {
|
|
19
|
+
readonly iri: string;
|
|
20
|
+
readonly kind: Resource["kind"];
|
|
21
|
+
readonly requested: Exclude<Resource["kind"], "unknown">;
|
|
22
|
+
constructor(iri: string, kind: Resource["kind"], requested: Exclude<Resource["kind"], "unknown">);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Atomically promotes an unknown IRI and inserts its typed row. An IRI that
|
|
26
|
+
* already is of the kind is passed to `reuse` instead, under the same lock, so
|
|
27
|
+
* that concurrent writers of one IRI insert its typed row once.
|
|
28
|
+
* @returns The typed-row insertion or reuse callback result.
|
|
29
|
+
* @throws {ResourceKindConflictError} If the IRI is another kind of resource.
|
|
30
|
+
* @throws {Error} If the IRI already is of the kind and `reuse` is not given.
|
|
31
|
+
*/
|
|
32
|
+
declare function promoteResource<T>(db: Database | Transaction, iri: string, kind: Exclude<Resource["kind"], "unknown">, insert: (tx: Transaction, resource: Resource) => Promise<T>, id?: Uuid, reuse?: (tx: Transaction, resource: Resource) => Promise<T>): Promise<T>;
|
|
33
|
+
type AddressingInput = Readonly<Partial<Record<AddressingProperty, readonly string[]>>>;
|
|
34
|
+
/** Stores every occurrence, including duplicates, in its original position. */
|
|
35
|
+
declare function storeAddressing(tx: Transaction, sourceId: Uuid, input: AddressingInput): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Locks an actor's declared collection until the transaction ends.
|
|
38
|
+
* @returns The locked collection ID.
|
|
39
|
+
*/
|
|
40
|
+
declare function lockActorCollection(tx: Transaction, actorId: Uuid, role: CollectionRole): Promise<Uuid>;
|
|
41
|
+
/**
|
|
42
|
+
* Records a resource in an actor's declared collection, idempotently.
|
|
43
|
+
* Position ASC is presentation order. Outboxes are reverse chronological,
|
|
44
|
+
* so the newest item receives the smallest position.
|
|
45
|
+
* @throws {Error} If the actor declares no collection for the role.
|
|
46
|
+
*/
|
|
47
|
+
declare function addActorCollectionItem(db: Database | Transaction, actorId: Uuid, role: CollectionRole, itemId: Uuid): Promise<void>;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { AddressingInput, PUBLIC_IRI, PUBLIC_RESOURCE_ID, ResourceKindConflictError, addActorCollectionItem, ensureResource, lockActorCollection, lockResources, promoteResource, storeAddressing };
|
|
50
|
+
//# sourceMappingURL=resource.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.d.mts","names":[],"sources":["../src/resource.ts"],"mappings":";;;cAmCa;cACA,oBAAoB;;;;;iBAMX,eACpB,IAAI,WAAW,aACf,aACA,2DACC,QAAQ;;;;;;iBAqCW,cACpB,IAAI,aACJ,0BACC;;cAYU,kCAAkC;WAElC;WACA,MAAM;WACN,WAAW,QAAQ;EAH9B,YACW,aACA,MAAM,kBACN,WAAW,QAAQ;;;;;;;;;;iBAeV,gBAAgB,GACpC,IAAI,WAAW,aACf,aACA,MAAM,QAAQ,8BACd,SAAS,IAAI,aAAa,UAAU,aAAa,QAAQ,IACzD,KAAK,MACL,SAAS,IAAI,aAAa,UAAU,aAAa,QAAQ,KACxD,QAAQ;KA8BC,kBAAkB,SAC5B,QAAQ,OAAO;;iBAIK,gBACpB,IAAI,aACJ,UAAU,MACV,OAAO,kBACN;;;;;iBA8BmB,oBACpB,IAAI,aACJ,SAAS,MACT,MAAM,iBACL,QAAQ;;;;;;;iBA4BW,uBACpB,IAAI,WAAW,aACf,SAAS,MACT,MAAM,gBACN,QAAQ,OACP"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { actorCollectionReferences, addressing, addressingPropertyEnum, collectionItems, collections, resources } from "./schema.mjs";
|
|
2
|
+
import { uuidV7 } from "./uuid.mjs";
|
|
3
|
+
import { and, asc, eq, inArray, min } from "drizzle-orm";
|
|
4
|
+
//#region src/resource.ts
|
|
5
|
+
const PUBLIC_IRI = "https://www.w3.org/ns/activitystreams#Public";
|
|
6
|
+
const PUBLIC_RESOURCE_ID = "00000000-0000-4000-8000-000000000000";
|
|
7
|
+
/**
|
|
8
|
+
* Returns the canonical resource without interpreting or normalizing its IRI.
|
|
9
|
+
* @returns The existing or newly registered resource.
|
|
10
|
+
*/
|
|
11
|
+
async function ensureResource(tx, iri, id = uuidV7()) {
|
|
12
|
+
const [existing] = await tx.select().from(resources).where(eq(resources.iri, iri)).limit(1);
|
|
13
|
+
if (existing != null) return existing;
|
|
14
|
+
const [inserted] = await tx.insert(resources).values({
|
|
15
|
+
id,
|
|
16
|
+
iri,
|
|
17
|
+
kind: "unknown"
|
|
18
|
+
}).onConflictDoNothing({ target: resources.iri }).returning();
|
|
19
|
+
if (inserted != null) return inserted;
|
|
20
|
+
const [resource] = await tx.select().from(resources).where(eq(resources.iri, iri)).limit(1);
|
|
21
|
+
if (resource == null) throw new Error("Resource insertion returned no row.");
|
|
22
|
+
return resource;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Promotions of one resource exclude each other, but not the foreign key
|
|
26
|
+
* checks of rows referring to it, such as addressing it: `kind` is no key.
|
|
27
|
+
* An exclusive lock would make two writers that each promote one resource and
|
|
28
|
+
* address the other deadlock.
|
|
29
|
+
*/
|
|
30
|
+
const PROMOTION_LOCK = "no key update";
|
|
31
|
+
/**
|
|
32
|
+
* Locks resources for promotion in IRI order, so that transactions promoting
|
|
33
|
+
* several of them never wait for each other in a cycle. Only registered IRIs
|
|
34
|
+
* are locked; see {@link ensureResource}.
|
|
35
|
+
*/
|
|
36
|
+
async function lockResources(tx, iris) {
|
|
37
|
+
if (iris.length === 0) return;
|
|
38
|
+
await tx.select({ id: resources.id }).from(resources).where(inArray(resources.iri, [...iris])).orderBy(asc(resources.iri)).for(PROMOTION_LOCK);
|
|
39
|
+
}
|
|
40
|
+
/** Thrown when an IRI is already registered as another kind of resource. */
|
|
41
|
+
var ResourceKindConflictError = class extends Error {
|
|
42
|
+
iri;
|
|
43
|
+
kind;
|
|
44
|
+
requested;
|
|
45
|
+
constructor(iri, kind, requested) {
|
|
46
|
+
super(`Resource ${iri} is already a ${kind}.`);
|
|
47
|
+
this.iri = iri;
|
|
48
|
+
this.kind = kind;
|
|
49
|
+
this.requested = requested;
|
|
50
|
+
this.name = "ResourceKindConflictError";
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Atomically promotes an unknown IRI and inserts its typed row. An IRI that
|
|
55
|
+
* already is of the kind is passed to `reuse` instead, under the same lock, so
|
|
56
|
+
* that concurrent writers of one IRI insert its typed row once.
|
|
57
|
+
* @returns The typed-row insertion or reuse callback result.
|
|
58
|
+
* @throws {ResourceKindConflictError} If the IRI is another kind of resource.
|
|
59
|
+
* @throws {Error} If the IRI already is of the kind and `reuse` is not given.
|
|
60
|
+
*/
|
|
61
|
+
async function promoteResource(db, iri, kind, insert, id, reuse) {
|
|
62
|
+
return await db.transaction(async (tx) => {
|
|
63
|
+
const ensured = await ensureResource(tx, iri, id);
|
|
64
|
+
const [resource] = await tx.select().from(resources).where(eq(resources.id, ensured.id)).for(PROMOTION_LOCK);
|
|
65
|
+
if (resource == null) throw new Error("Resource disappeared during promotion.");
|
|
66
|
+
if (resource.kind === kind) {
|
|
67
|
+
if (reuse == null) throw new Error(`Resource ${iri} has already been promoted.`);
|
|
68
|
+
return await reuse(tx, resource);
|
|
69
|
+
}
|
|
70
|
+
if (resource.kind !== "unknown") throw new ResourceKindConflictError(iri, resource.kind, kind);
|
|
71
|
+
await tx.update(resources).set({ kind }).where(eq(resources.id, resource.id));
|
|
72
|
+
return await insert(tx, {
|
|
73
|
+
...resource,
|
|
74
|
+
kind
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** Stores every occurrence, including duplicates, in its original position. */
|
|
79
|
+
async function storeAddressing(tx, sourceId, input) {
|
|
80
|
+
const targets = /* @__PURE__ */ new Map();
|
|
81
|
+
const iris = [...new Set(addressingPropertyEnum.enumValues.flatMap((property) => input[property] ?? []))].sort();
|
|
82
|
+
for (const iri of iris) targets.set(iri, await ensureResource(tx, iri));
|
|
83
|
+
for (const property of addressingPropertyEnum.enumValues) for (const [position, iri] of (input[property] ?? []).entries()) {
|
|
84
|
+
const target = targets.get(iri);
|
|
85
|
+
await tx.insert(addressing).values({
|
|
86
|
+
id: uuidV7(),
|
|
87
|
+
sourceId,
|
|
88
|
+
property,
|
|
89
|
+
position,
|
|
90
|
+
targetId: target.id
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Locks an actor's declared collection until the transaction ends.
|
|
96
|
+
* @returns The locked collection ID.
|
|
97
|
+
*/
|
|
98
|
+
async function lockActorCollection(tx, actorId, role) {
|
|
99
|
+
const [reference] = await tx.select({ collectionId: collections.id }).from(collections).innerJoin(actorCollectionReferences, eq(collections.id, actorCollectionReferences.collectionId)).where(and(eq(actorCollectionReferences.actorId, actorId), eq(actorCollectionReferences.role, role))).for("update", { of: collections }).limit(1);
|
|
100
|
+
if (reference == null) throw new Error(`Actor ${actorId} declares no ${role} collection.`);
|
|
101
|
+
return reference.collectionId;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Records a resource in an actor's declared collection, idempotently.
|
|
105
|
+
* Position ASC is presentation order. Outboxes are reverse chronological,
|
|
106
|
+
* so the newest item receives the smallest position.
|
|
107
|
+
* @throws {Error} If the actor declares no collection for the role.
|
|
108
|
+
*/
|
|
109
|
+
async function addActorCollectionItem(db, actorId, role, itemId) {
|
|
110
|
+
await db.transaction(async (tx) => {
|
|
111
|
+
const collectionId = await lockActorCollection(tx, actorId, role);
|
|
112
|
+
const [row] = await tx.select({ position: min(collectionItems.position) }).from(collectionItems).where(eq(collectionItems.collectionId, collectionId));
|
|
113
|
+
await tx.insert(collectionItems).values({
|
|
114
|
+
collectionId,
|
|
115
|
+
itemId,
|
|
116
|
+
position: (row?.position ?? 0) - 1
|
|
117
|
+
}).onConflictDoNothing();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { PUBLIC_IRI, PUBLIC_RESOURCE_ID, ResourceKindConflictError, addActorCollectionItem, ensureResource, lockActorCollection, lockResources, promoteResource, storeAddressing };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=resource.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.mjs","names":[],"sources":["../src/resource.ts"],"sourcesContent":["// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\n// Keep dependent database writes and observations sequential.\n// oxlint-disable no-await-in-loop\n\nimport { and, asc, eq, inArray, min } from \"drizzle-orm\";\n\nimport type { Database, Transaction } from \"./db.ts\";\nimport {\n type AddressingProperty,\n type CollectionRole,\n type Resource,\n actorCollectionReferences,\n addressing,\n addressingPropertyEnum,\n collectionItems,\n collections,\n resources,\n} from \"./schema.ts\";\nimport { type Uuid, uuidV7 } from \"./uuid.ts\";\n\nexport const PUBLIC_IRI = \"https://www.w3.org/ns/activitystreams#Public\";\nexport const PUBLIC_RESOURCE_ID: Uuid = \"00000000-0000-4000-8000-000000000000\";\n\n/**\n * Returns the canonical resource without interpreting or normalizing its IRI.\n * @returns The existing or newly registered resource.\n */\nexport async function ensureResource(\n tx: Database | Transaction,\n iri: string,\n id = uuidV7(),\n): Promise<Resource> {\n const [existing] = await tx\n .select()\n .from(resources)\n .where(eq(resources.iri, iri))\n .limit(1);\n if (existing != null) return existing;\n const [inserted] = await tx\n .insert(resources)\n .values({ id, iri, kind: \"unknown\" })\n .onConflictDoNothing({ target: resources.iri })\n .returning();\n if (inserted != null) return inserted;\n // A concurrent insertion can win after the first SELECT. A separate\n // statement sees that committed row under PostgreSQL's READ COMMITTED.\n const [resource] = await tx\n .select()\n .from(resources)\n .where(eq(resources.iri, iri))\n .limit(1);\n if (resource == null) throw new Error(\"Resource insertion returned no row.\");\n return resource;\n}\n\n/**\n * Promotions of one resource exclude each other, but not the foreign key\n * checks of rows referring to it, such as addressing it: `kind` is no key.\n * An exclusive lock would make two writers that each promote one resource and\n * address the other deadlock.\n */\nconst PROMOTION_LOCK = \"no key update\";\n\n/**\n * Locks resources for promotion in IRI order, so that transactions promoting\n * several of them never wait for each other in a cycle. Only registered IRIs\n * are locked; see {@link ensureResource}.\n */\nexport async function lockResources(\n tx: Transaction,\n iris: readonly string[],\n): Promise<void> {\n if (iris.length === 0) return;\n // PostgreSQL locks the rows after sorting them.\n await tx\n .select({ id: resources.id })\n .from(resources)\n .where(inArray(resources.iri, [...iris]))\n .orderBy(asc(resources.iri))\n .for(PROMOTION_LOCK);\n}\n\n/** Thrown when an IRI is already registered as another kind of resource. */\nexport class ResourceKindConflictError extends Error {\n constructor(\n readonly iri: string,\n readonly kind: Resource[\"kind\"],\n readonly requested: Exclude<Resource[\"kind\"], \"unknown\">,\n ) {\n super(`Resource ${iri} is already a ${kind}.`);\n this.name = \"ResourceKindConflictError\";\n }\n}\n\n/**\n * Atomically promotes an unknown IRI and inserts its typed row. An IRI that\n * already is of the kind is passed to `reuse` instead, under the same lock, so\n * that concurrent writers of one IRI insert its typed row once.\n * @returns The typed-row insertion or reuse callback result.\n * @throws {ResourceKindConflictError} If the IRI is another kind of resource.\n * @throws {Error} If the IRI already is of the kind and `reuse` is not given.\n */\nexport async function promoteResource<T>(\n db: Database | Transaction,\n iri: string,\n kind: Exclude<Resource[\"kind\"], \"unknown\">,\n insert: (tx: Transaction, resource: Resource) => Promise<T>,\n id?: Uuid,\n reuse?: (tx: Transaction, resource: Resource) => Promise<T>,\n): Promise<T> {\n return await db.transaction(async (tx) => {\n const ensured = await ensureResource(tx, iri, id);\n // Re-read the kind after locking so a concurrent promotion cannot change\n // it between validation and update.\n const [resource] = await tx\n .select()\n .from(resources)\n .where(eq(resources.id, ensured.id))\n .for(PROMOTION_LOCK);\n if (resource == null) {\n throw new Error(\"Resource disappeared during promotion.\");\n }\n if (resource.kind === kind) {\n if (reuse == null) {\n throw new Error(`Resource ${iri} has already been promoted.`);\n }\n return await reuse(tx, resource);\n }\n if (resource.kind !== \"unknown\") {\n throw new ResourceKindConflictError(iri, resource.kind, kind);\n }\n await tx\n .update(resources)\n .set({ kind })\n .where(eq(resources.id, resource.id));\n return await insert(tx, { ...resource, kind });\n });\n}\n\nexport type AddressingInput = Readonly<\n Partial<Record<AddressingProperty, readonly string[]>>\n>;\n\n/** Stores every occurrence, including duplicates, in its original position. */\nexport async function storeAddressing(\n tx: Transaction,\n sourceId: Uuid,\n input: AddressingInput,\n): Promise<void> {\n // Acquire unique-index locks for new IRIs in a consistent order across\n // writers. This does not change occurrence order in the addressing rows.\n const targets = new Map<string, Resource>();\n const iris = [\n ...new Set(\n addressingPropertyEnum.enumValues.flatMap(\n (property) => input[property] ?? [],\n ),\n ),\n ].sort();\n for (const iri of iris) targets.set(iri, await ensureResource(tx, iri));\n for (const property of addressingPropertyEnum.enumValues) {\n for (const [position, iri] of (input[property] ?? []).entries()) {\n const target = targets.get(iri)!;\n await tx.insert(addressing).values({\n id: uuidV7(),\n sourceId,\n property,\n position,\n targetId: target.id,\n });\n }\n }\n}\n\n/**\n * Locks an actor's declared collection until the transaction ends.\n * @returns The locked collection ID.\n */\nexport async function lockActorCollection(\n tx: Transaction,\n actorId: Uuid,\n role: CollectionRole,\n): Promise<Uuid> {\n const [reference] = await tx\n .select({ collectionId: collections.id })\n .from(collections)\n .innerJoin(\n actorCollectionReferences,\n eq(collections.id, actorCollectionReferences.collectionId),\n )\n .where(\n and(\n eq(actorCollectionReferences.actorId, actorId),\n eq(actorCollectionReferences.role, role),\n ),\n )\n .for(\"update\", { of: collections })\n .limit(1);\n if (reference == null) {\n throw new Error(`Actor ${actorId} declares no ${role} collection.`);\n }\n return reference.collectionId;\n}\n\n/**\n * Records a resource in an actor's declared collection, idempotently.\n * Position ASC is presentation order. Outboxes are reverse chronological,\n * so the newest item receives the smallest position.\n * @throws {Error} If the actor declares no collection for the role.\n */\nexport async function addActorCollectionItem(\n db: Database | Transaction,\n actorId: Uuid,\n role: CollectionRole,\n itemId: Uuid,\n): Promise<void> {\n await db.transaction(async (tx) => {\n const collectionId = await lockActorCollection(tx, actorId, role);\n const [row] = await tx\n .select({ position: min(collectionItems.position) })\n .from(collectionItems)\n .where(eq(collectionItems.collectionId, collectionId));\n await tx\n .insert(collectionItems)\n .values({ collectionId, itemId, position: (row?.position ?? 0) - 1 })\n .onConflictDoNothing();\n });\n}\n"],"mappings":";;;;AAmCA,MAAa,aAAa;AAC1B,MAAa,qBAA2B;;;;;AAMxC,eAAsB,eACpB,IACA,KACA,KAAK,OAAO,GACO;CACnB,MAAM,CAAC,YAAY,MAAM,GACtB,OAAO,CAAC,CACR,KAAK,SAAS,CAAC,CACf,MAAM,GAAG,UAAU,KAAK,GAAG,CAAC,CAAC,CAC7B,MAAM,CAAC;CACV,IAAI,YAAY,MAAM,OAAO;CAC7B,MAAM,CAAC,YAAY,MAAM,GACtB,OAAO,SAAS,CAAC,CACjB,OAAO;EAAE;EAAI;EAAK,MAAM;CAAU,CAAC,CAAC,CACpC,oBAAoB,EAAE,QAAQ,UAAU,IAAI,CAAC,CAAC,CAC9C,UAAU;CACb,IAAI,YAAY,MAAM,OAAO;CAG7B,MAAM,CAAC,YAAY,MAAM,GACtB,OAAO,CAAC,CACR,KAAK,SAAS,CAAC,CACf,MAAM,GAAG,UAAU,KAAK,GAAG,CAAC,CAAC,CAC7B,MAAM,CAAC;CACV,IAAI,YAAY,MAAM,MAAM,IAAI,MAAM,qCAAqC;CAC3E,OAAO;AACT;;;;;;;AAQA,MAAM,iBAAiB;;;;;;AAOvB,eAAsB,cACpB,IACA,MACe;CACf,IAAI,KAAK,WAAW,GAAG;CAEvB,MAAM,GACH,OAAO,EAAE,IAAI,UAAU,GAAG,CAAC,CAAC,CAC5B,KAAK,SAAS,CAAC,CACf,MAAM,QAAQ,UAAU,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CACxC,QAAQ,IAAI,UAAU,GAAG,CAAC,CAAC,C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js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { $ as activityDeliveryDirectionEnum, A as LoginChallenge, B as NewLocalInstance, C as Key, Ct as objects, D as LocalActorKey, Dt as sessions, E as LocalActor, F as NewActor, G as Session, H as NewSession, I as NewInstance, J as activities, K as StoredActivity, L as NewInstanceMember, M as NewActivityDelivery, N as NewActivityDeliveryActor, O as LocalActorKeyType, P as NewActivityPubObject, Q as activityDeliveryAttempts, R as NewLocalActor, S as InstanceMember, St as objectTypeEnum, T as LOGIN_CHALLENGE_CODE_LENGTH, Tt as resources, U as ObjectType, V as NewLoginChallenge, W as Resource, X as activityDeliveryActorCollections, Y as activityDeliveries, Z as activityDeliveryActors, _ as Addressing, _t as localActorKeyTypeEnum, a as Account, at as actorTypeEnum, b as CollectionRole, bt as localInstances, c as ActivityDeliveryActorCollection, ct as addressingPropertyEnum, d as ActivityDeliveryStatus, dt as collectionTypeEnum, et as activityDeliveryStatusEnum, f as ActivityDeliveryVerificationMechanism, ft as collections, g as ActorType, gt as keys, h as Actor, ht as keyVersions, it as actorCollectionReferences, j as NewAccount, k as LocalInstance, l as ActivityDeliveryAttempt, lt as collectionItems, m as ActivityPubObject, mt as instances, nt as activityDeliveryVerificationResultEnum, o as ActivityDelivery, ot as actors, p as ActivityDeliveryVerificationResult, pt as instanceMembers, q as accounts, rt as activityTypeEnum, s as ActivityDeliveryActor, st as addressing, tt as activityDeliveryVerificationMechanismEnum, u as ActivityDeliveryDirection, ut as collectionRoleEnum, v as AddressingProperty, vt as localActorKeys, w as KeyVersion, wt as resourceKindEnum, x as Instance, xt as loginChallenges, y as Collection, yt as localActors, z as NewLocalActorKey } from "./db-DtcLuISw.mjs";
|
|
2
|
+
export { Account, ActivityDelivery, ActivityDeliveryActor, ActivityDeliveryActorCollection, ActivityDeliveryAttempt, ActivityDeliveryDirection, ActivityDeliveryStatus, ActivityDeliveryVerificationMechanism, ActivityDeliveryVerificationResult, ActivityPubObject, Actor, ActorType, Addressing, AddressingProperty, Collection, CollectionRole, Instance, InstanceMember, Key, KeyVersion, LOGIN_CHALLENGE_CODE_LENGTH, LocalActor, LocalActorKey, LocalActorKeyType, LocalInstance, LoginChallenge, NewAccount, NewActivityDelivery, NewActivityDeliveryActor, NewActivityPubObject, NewActor, NewInstance, NewInstanceMember, NewLocalActor, NewLocalActorKey, NewLocalInstance, NewLoginChallenge, NewSession, ObjectType, Resource, Session, StoredActivity, accounts, activities, activityDeliveries, activityDeliveryActorCollections, activityDeliveryActors, activityDeliveryAttempts, activityDeliveryDirectionEnum, activityDeliveryStatusEnum, activityDeliveryVerificationMechanismEnum, activityDeliveryVerificationResultEnum, activityTypeEnum, actorCollectionReferences, actorTypeEnum, actors, addressing, addressingPropertyEnum, collectionItems, collectionRoleEnum, collectionTypeEnum, collections, instanceMembers, instances, keyVersions, keys, localActorKeyTypeEnum, localActorKeys, localActors, localInstances, loginChallenges, objectTypeEnum, objects, resourceKindEnum, resources, sessions };
|