@drfed/models 0.2.0-dev.639 → 0.2.0-dev.682
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 +340 -188
- package/dist/activity-delivery.d.mts +1 -1
- package/dist/activity-delivery.d.mts.map +1 -1
- package/dist/activity-delivery.mjs +34 -9
- package/dist/activity-delivery.mjs.map +1 -1
- package/dist/{db-DtcLuISw.d.mts → db-BBw4F4HU.d.mts} +478 -6
- package/dist/{db-DtcLuISw.d.mts.map → db-BBw4F4HU.d.mts.map} +1 -1
- package/dist/db.d.mts +1 -1
- package/dist/document.d.mts +200 -0
- package/dist/document.d.mts.map +1 -0
- package/dist/document.mjs +1264 -0
- package/dist/document.mjs.map +1 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +2 -1
- package/dist/instance.d.mts +1 -1
- package/dist/key.d.mts +1 -1
- package/dist/login.d.mts +1 -1
- package/dist/migrations-manifest.json +12 -0
- package/dist/relations.d.mts +1 -1
- package/dist/relations.mjs +65 -0
- package/dist/relations.mjs.map +1 -1
- package/dist/resource-revision-BuG5kUlA.d.mts +103 -0
- package/dist/resource-revision-BuG5kUlA.d.mts.map +1 -0
- package/dist/resource-revision-DWg6et77.mjs +313 -0
- package/dist/resource-revision-DWg6et77.mjs.map +1 -0
- package/dist/resource-revision.d.mts +2 -0
- package/dist/resource-revision.mjs +3 -0
- package/dist/resource.d.mts +1 -1
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +104 -5
- package/dist/schema.mjs.map +1 -1
- package/drizzle/20261026181201_resource_revision_storage/migration.sql +72 -0
- package/drizzle/20261026181201_resource_revision_storage/snapshot.json +4501 -0
- package/drizzle/20261026181206_guard_resource_revisions/migration.sql +175 -0
- package/drizzle/20261026181206_guard_resource_revisions/snapshot.json +4501 -0
- package/drizzle/20261026192411_capture_legacy_resource_revisions/migration.sql +249 -0
- package/drizzle/20261026192411_capture_legacy_resource_revisions/snapshot.json +4501 -0
- package/package.json +19 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-delivery.mjs","names":[],"sources":["../src/activity-delivery.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 { isDeepStrictEqual } from \"node:util\";\n\nimport { and, desc, eq, inArray, isNotNull, isNull, sql } from \"drizzle-orm\";\n\nimport type { Database, Transaction } from \"./db.ts\";\nimport {\n type ActivityDelivery,\n type NewActivityDelivery,\n type NewActivityDeliveryActor,\n activities,\n activityDeliveries,\n activityDeliveryActorCollections,\n activityDeliveryActors,\n activityDeliveryAttempts,\n actors,\n objects,\n resources,\n} from \"./schema.ts\";\nimport { storableText } from \"./text.ts\";\nimport { type Uuid, uuidV7 } from \"./uuid.ts\";\n\n/** The marks of what a delivery carried are the model's to decide. */\ntype DeliveryEntry = Omit<\n NewActivityDelivery,\n \"id\" | \"direction\" | \"status\" | \"carriedSnapshot\" | \"carriedObjectSnapshot\"\n>;\n\nexport interface AddressedActor {\n readonly actorId: Uuid;\n readonly viaCollectionIri?: string | null;\n}\n\n/**\n * `payload` is `undefined` for an unparsable body and `null` for JSON `null`;\n * it is stored as SQL `NULL` when jsonb cannot hold it, and `body` keeps it.\n * `fetchedObject` is stored as SQL `NULL` when jsonb cannot hold it too.\n * An inbound delivery is linked to its activity only by\n * `linkInboundActivity()`.\n */\nexport type InboundDeliveryEntry = Omit<\n DeliveryEntry,\n \"body\" | \"verificationResult\" | \"recipientIris\" | \"activityId\"\n> & {\n /**\n * Chosen in advance when something must name the delivery before it exists.\n */\n readonly id?: Uuid;\n readonly status: \"received\" | \"acknowledged\" | \"unverified\" | \"rejected\";\n readonly verificationResult: NonNullable<DeliveryEntry[\"verificationResult\"]>;\n readonly body: Uint8Array;\n readonly addressed?: readonly AddressedActor[];\n /** When the request arrived, before verification and handling. */\n readonly created: Temporal.Instant;\n /** When DrFed answered the request. */\n readonly completed: Temporal.Instant;\n};\n\n/** `payload` is the document before signing, without `bto` and `bcc`. */\nexport type OutboundDeliveryEntry = Omit<\n DeliveryEntry,\n | \"verificationKeyId\"\n | \"verificationMechanism\"\n | \"verificationResult\"\n | \"body\"\n | \"headers\"\n | \"requestUrl\"\n | \"completed\"\n | \"fetchedObject\"\n> & {\n readonly activityIri: string;\n};\n\ntype ActorRow = Omit<NewActivityDeliveryActor, \"deliveryId\" | \"created\"> & {\n /** The addressed collections that reached the actor, sorted. */\n readonly collectionIris?: readonly string[];\n};\n\n/**\n * Merge the inbox owner and addressed actors into one row per actor, keeping\n * every way each was addressed, whatever order they come in.\n * @returns The actor rows of an inbound delivery.\n */\nexport function inboundActorRows(entry: {\n readonly actorId?: Uuid | null | undefined;\n readonly addressed?: readonly AddressedActor[] | undefined;\n}): ActorRow[] {\n const rows = new Map<Uuid, ActorRow>();\n if (entry.actorId != null) {\n rows.set(entry.actorId, { actorId: entry.actorId, inboxOwner: true });\n }\n for (const { actorId, viaCollectionIri } of entry.addressed ?? []) {\n const row = rows.get(actorId);\n const collectionIris = row?.collectionIris ?? [];\n rows.set(actorId, {\n ...row,\n actorId,\n addressed: true,\n addressedDirectly:\n row?.addressedDirectly === true || viaCollectionIri == null,\n collectionIris:\n viaCollectionIri == null\n ? collectionIris\n : [...new Set([...collectionIris, viaCollectionIri])].toSorted(),\n });\n }\n return [...rows.values()];\n}\n\n/**\n * PostgreSQL's jsonb holds neither U+0000 nor an unpaired surrogate, in keys\n * or in values.\n * @returns Whether the JSON value can be stored as jsonb.\n */\nfunction storableJson(value: unknown): boolean {\n if (typeof value === \"string\") return storableText(value);\n return (\n typeof value !== \"object\" ||\n value == null ||\n Object.entries(value).every(\n ([key, item]) => storableJson(key) && storableJson(item),\n )\n );\n}\n\n/**\n * Keep a payload jsonb cannot hold out of the delivery, rather than the\n * delivery.\n * @returns The value to store, SQL `NULL` for such a payload.\n */\nconst jsonb = (payload: unknown) =>\n payload === null\n ? sql`'null'::jsonb`\n : storableJson(payload)\n ? payload\n : null;\n\n/**\n * A fetched object is a JSON object, so nothing fetched is SQL `NULL`.\n * @returns The value to store.\n */\nconst storedObject = (document: unknown) =>\n document == null ? null : jsonb(document);\n\n/**\n * PostgreSQL's text holds no U+0000, which a remote response or an error\n * quoting one may carry; keep the rest of it rather than lose the delivery.\n * @returns The text with each U+0000 replaced by U+FFFD.\n */\nconst text = (value: string | null | undefined): string | null =>\n value?.replaceAll(\"\\0\", \"\\ufffd\") ?? null;\n\n/**\n * Refuse to relate a delivery to anything but local actors of its instance,\n * which neither foreign key can tell.\n * @throws {Error} When an actor is remote, or of another instance.\n */\nasync function checkLocalActors(\n tx: Transaction,\n instanceId: Uuid,\n actorIds: readonly (Uuid | null | undefined)[],\n): Promise<void> {\n const ids = [...new Set(actorIds.filter((id) => id != null))];\n if (ids.length === 0) return;\n const local = await tx.$count(\n actors,\n and(\n inArray(actors.id, ids),\n eq(actors.instanceId, instanceId),\n isNotNull(actors.localId),\n ),\n );\n if (local !== ids.length) {\n throw new Error(\n \"An activity delivery relates only to local actors of its instance.\",\n );\n }\n}\n\nasync function insertDelivery(\n db: Database,\n delivery: NewActivityDelivery,\n links: readonly ActorRow[],\n): Promise<ActivityDelivery> {\n return await db.transaction(async (tx) => {\n await checkLocalActors(tx, delivery.instanceId, [\n delivery.actorId,\n ...links.map(({ actorId }) => actorId),\n ]);\n const [row] = await tx\n .insert(activityDeliveries)\n .values({\n ...delivery,\n error: text(delivery.error),\n responseBody: text(delivery.responseBody),\n })\n .returning();\n if (row == null) {\n throw new Error(\"Missing activity delivery after insertion.\");\n }\n if (links.length > 0) {\n await tx.insert(activityDeliveryActors).values(\n links.map(({ collectionIris: _, ...link }) => ({\n ...link,\n deliveryId: row.id,\n created: row.created,\n })),\n );\n }\n const collections = links.flatMap(({ actorId, collectionIris = [] }) =>\n collectionIris.map((collectionIri) => ({\n deliveryId: row.id,\n actorId,\n collectionIri,\n })),\n );\n if (collections.length > 0) {\n await tx.insert(activityDeliveryActorCollections).values(collections);\n }\n return row;\n });\n}\n\n/**\n * Persist one inbound observation with its actor rows in one transaction.\n * The inbox owner and every addressed actor must be local actors of\n * `instanceId`; otherwise nothing is recorded.\n * @returns The inserted inbound delivery.\n * @throws {Error} When an actor is not a local actor of the instance.\n */\nexport async function recordInbound(\n db: Database,\n { addressed, body, id = uuidV7(), ...entry }: InboundDeliveryEntry,\n): Promise<ActivityDelivery> {\n return await insertDelivery(\n db,\n {\n ...entry,\n body: Buffer.from(body),\n payload: jsonb(entry.payload),\n fetchedObject: storedObject(entry.fetchedObject),\n id,\n direction: \"inbound\",\n // Whatever a caller outside TypeScript passes.\n carriedSnapshot: false,\n carriedObjectSnapshot: false,\n },\n inboundActorRows({ actorId: entry.actorId, addressed }),\n );\n}\n\n/**\n * Record that an inbox listener ran for an inbound delivery answered before it\n * did, as a queued one is.\n * @returns Whether an acknowledged inbound delivery was found.\n */\nexport async function receiveInbound(db: Database, id: Uuid): Promise<boolean> {\n const rows = await db\n .update(activityDeliveries)\n .set({ status: \"received\" })\n .where(\n and(\n eq(activityDeliveries.id, id),\n eq(activityDeliveries.direction, \"inbound\"),\n eq(activityDeliveries.status, \"acknowledged\"),\n ),\n )\n .returning({ id: activityDeliveries.id });\n return rows.length > 0;\n}\n\n/**\n * Decide what a linked inbound delivery carried, anew every time, so that a\n * mark left from an activity deleted since never carries over to another\n * stored under the same IRI:\n *\n * - The stored activity, when its payload is the stored document, since the\n * same IRI may arrive again with other contents.\n * - The object stored with that activity, when the delivery carried the\n * activity and the object was taken from it, or when its inbox listener\n * fetched the object as stored. Matching the activity proves nothing of\n * an object fetched apart from it, which may differ from fetch to fetch.\n *\n * A payload or a fetched object jsonb could not hold is stored as SQL `NULL`\n * and carries nothing. An unlinked delivery is left as is.\n */\nasync function decideCarried(tx: Transaction, deliveryId: Uuid): Promise<void> {\n const [row] = await tx\n .select({\n payload: activityDeliveries.payload,\n fetchedObject: activityDeliveries.fetchedObject,\n activity: activities.document,\n object: objects.document,\n fetched: objects.fetched,\n })\n .from(activityDeliveries)\n .innerJoin(activities, eq(activities.id, activityDeliveries.activityId))\n .leftJoin(objects, eq(objects.activityId, activityDeliveries.activityId))\n .where(\n and(\n eq(activityDeliveries.id, deliveryId),\n eq(activityDeliveries.direction, \"inbound\"),\n ),\n );\n if (row == null) return;\n const carriedSnapshot =\n row.payload != null && isDeepStrictEqual(row.payload, row.activity);\n const carriedObjectSnapshot =\n carriedSnapshot &&\n row.fetched != null &&\n (!row.fetched ||\n (row.fetchedObject != null &&\n isDeepStrictEqual(row.fetchedObject, row.object)));\n await tx\n .update(activityDeliveries)\n .set({ carriedSnapshot, carriedObjectSnapshot })\n .where(eq(activityDeliveries.id, deliveryId));\n}\n\n/**\n * Link an inbound delivery to the stored activity its activity IRI names.\n * Only a delivery Fedify verified and answered with 2xx is linked: Fedify\n * authenticates an activity before accepting it, so its actor has the origin\n * of the activity's ID, whether an inbox listener ran or it was a duplicate.\n * A delivery that is already linked is left as is.\n *\n * The link names the activity whatever the delivery carried; what it carried\n * is decided as the link is made, as `recordFetchedObject()` decides it again.\n * @returns Whether the delivery was linked.\n */\nexport async function linkInboundActivity(\n db: Database | Transaction,\n deliveryId: Uuid,\n): Promise<boolean> {\n return await db.transaction(async (tx) => {\n const [row] = await tx\n .update(activityDeliveries)\n .set({ activityId: resources.id })\n .from(resources)\n .innerJoin(activities, eq(activities.id, resources.id))\n .where(\n and(\n eq(activityDeliveries.id, deliveryId),\n eq(activityDeliveries.direction, \"inbound\"),\n inArray(activityDeliveries.status, [\"received\", \"acknowledged\"]),\n eq(activityDeliveries.verificationResult, \"verified\"),\n isNull(activityDeliveries.activityId),\n eq(resources.iri, activityDeliveries.activityIri),\n eq(resources.kind, \"activity\"),\n ),\n )\n .returning({ id: activityDeliveries.id });\n if (row == null) return false;\n await decideCarried(tx, deliveryId);\n return true;\n });\n}\n\n/**\n * Record the object an inbound delivery's inbox listener fetched from its IRI,\n * and decide again what the delivery carried if it is linked already, as a\n * duplicate queued for a worker is before its listener runs.\n * @returns Whether the inbound delivery was found.\n */\nexport async function recordFetchedObject(\n db: Database,\n deliveryId: Uuid,\n document: unknown,\n): Promise<boolean> {\n return await db.transaction(async (tx) => {\n const rows = await tx\n .update(activityDeliveries)\n .set({ fetchedObject: storedObject(document) })\n .where(\n and(\n eq(activityDeliveries.id, deliveryId),\n eq(activityDeliveries.direction, \"inbound\"),\n ),\n )\n .returning({ id: activityDeliveries.id });\n if (rows.length < 1) return false;\n await decideCarried(tx, deliveryId);\n return true;\n });\n}\n\n/**\n * Start a delivery observation. The payload is the document before signing.\n * The sender must be a local actor of `instanceId`; otherwise nothing is\n * recorded.\n * @returns The inserted queued outbound delivery.\n * @throws {Error} When the sender is not a local actor of the instance.\n */\nexport async function recordOutbound(\n db: Database,\n entry: OutboundDeliveryEntry,\n): Promise<ActivityDelivery> {\n return await insertDelivery(\n db,\n {\n ...entry,\n // The application clock, as inbound deliveries use, so both directions sort together.\n created: entry.created ?? Temporal.Now.instant(),\n payload: jsonb(entry.payload),\n id: uuidV7(),\n direction: \"outbound\",\n status: \"queued\",\n fetchedObject: null,\n carriedSnapshot: false,\n carriedObjectSnapshot: false,\n },\n entry.actorId == null ? [] : [{ actorId: entry.actorId, sender: true }],\n );\n}\n\n/** What a settled delivery shows; null fields for a successful attempt. */\nexport interface OutboundSettlement {\n readonly activityIri: string;\n readonly inboxUrl: string;\n readonly status: \"sent\" | \"failed\" | \"permanently_failed\" | \"abandoned\";\n readonly statusCode?: number | null;\n readonly error?: string | null;\n readonly responseBody?: string | null;\n /** Whether an attempt ended with this result, rather than none being made. */\n readonly attempted: boolean;\n /** Restrict a synchronous delivery to the row started by that invocation. */\n readonly id?: Uuid;\n}\n\n/**\n * Settle the most recent pending (`queued` or `failed`) delivery to an inbox,\n * keeping each ended attempt. `sent`, `permanently_failed` and `abandoned`\n * deliveries are never changed again.\n * @returns Whether a pending delivery was found.\n */\nexport async function settleOutbound(\n db: Database,\n entry: OutboundSettlement,\n): Promise<boolean> {\n const summary = {\n statusCode: entry.statusCode ?? null,\n error: text(entry.error),\n responseBody: text(entry.responseBody),\n };\n return await db.transaction(async (tx) => {\n const [delivery] = await tx\n .select({ id: activityDeliveries.id })\n .from(activityDeliveries)\n .where(\n and(\n eq(activityDeliveries.direction, \"outbound\"),\n eq(activityDeliveries.activityIri, entry.activityIri),\n eq(activityDeliveries.inboxUrl, entry.inboxUrl),\n inArray(activityDeliveries.status, [\"queued\", \"failed\"]),\n entry.id == null ? undefined : eq(activityDeliveries.id, entry.id),\n ),\n )\n .orderBy(desc(activityDeliveries.created), desc(activityDeliveries.id))\n .limit(1)\n .for(\"update\");\n if (delivery == null) return false;\n const completed = Temporal.Now.instant();\n if (entry.attempted) {\n await tx.insert(activityDeliveryAttempts).values({\n ...summary,\n id: uuidV7(),\n deliveryId: delivery.id,\n succeeded: entry.status === \"sent\",\n created: completed,\n });\n }\n await tx\n .update(activityDeliveries)\n .set({ ...summary, status: entry.status, completed })\n .where(eq(activityDeliveries.id, delivery.id));\n return true;\n });\n}\n"],"mappings":";;;;;;;;;;;AAkGA,SAAgB,iBAAiB,OAGlB;CACb,MAAM,uBAAO,IAAI,IAAoB;CACrC,IAAI,MAAM,WAAW,MACnB,KAAK,IAAI,MAAM,SAAS;EAAE,SAAS,MAAM;EAAS,YAAY;CAAK,CAAC;CAEtE,KAAK,MAAM,EAAE,SAAS,sBAAsB,MAAM,aAAa,CAAC,GAAG;EACjE,MAAM,MAAM,KAAK,IAAI,OAAO;EAC5B,MAAM,iBAAiB,KAAK,kBAAkB,CA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CAAC,YAAY,MAAM,GACtB,OAAO,EAAE,IAAI,mBAAmB,GAAG,CAAC,CAAC,CACrC,KAAK,kBAAkB,CAAC,CACxB,MACC,IACE,GAAG,mBAAmB,WAAW,UAAU,GAC3C,GAAG,mBAAmB,aAAa,MAAM,WAAW,GACpD,GAAG,mBAAmB,UAAU,MAAM,QAAQ,GAC9C,QAAQ,mBAAmB,QAAQ,CAAC,UAAU,QAAQ,CAAC,GACvD,MAAM,MAAM,OAAO,KAAA,IAAY,GAAG,mBAAmB,IAAI,MAAM,EAAE,CACnE,CACF,CAAC,CACA,QAAQ,KAAK,mBAAmB,OAAO,GAAG,KAAK,mBAAmB,EAAE,CAAC,CAAC,CACtE,MAAM,CAAC,CAAC,CACR,IAAI,QAAQ;EACf,IAAI,YAAY,MAAM,OAAO;EAC7B,MAAM,YAAY,SAAS,IAAI,QAAQ;EACvC,IAAI,MAAM,WACR,MAAM,GAAG,OAAO,wBAAwB,CAAC,CAAC,OAAO;GAC/C,GAAG;GACH,IAAI,OAAO;GACX,YAAY,SAAS;GACrB,WAAW,MAAM,WAAW;GAC5B,SAAS;EACX,CAAC;EAEH,MAAM,GACH,OAAO,kBAAkB,CAAC,CAC1B,IAAI;GAAE,GAAG;GAAS,QAAQ,MAAM;GAAQ;EAAU,CAAC,CAAC,CACpD,MAAM,GAAG,mBAAmB,IAAI,SAAS,EAAE,CAAC;EAC/C,OAAO;CACT,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"activity-delivery.mjs","names":[],"sources":["../src/activity-delivery.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 { isDeepStrictEqual } from \"node:util\";\n\nimport { and, desc, eq, inArray, isNotNull, isNull, sql } from \"drizzle-orm\";\n\nimport type { Database, Transaction } from \"./db.ts\";\nimport {\n type ActivityDelivery,\n type NewActivityDelivery,\n type NewActivityDeliveryActor,\n activities,\n activityDeliveries,\n activityDeliveryActorCollections,\n activityDeliveryActors,\n activityDeliveryAttempts,\n actors,\n objects,\n resourceRevisions,\n resources,\n revisionReceipts,\n} from \"./schema.ts\";\nimport { storableText } from \"./text.ts\";\nimport { type Uuid, uuidV7 } from \"./uuid.ts\";\n\n/** The marks of what a delivery carried are the model's to decide. */\ntype DeliveryEntry = Omit<\n NewActivityDelivery,\n \"id\" | \"direction\" | \"status\" | \"carriedSnapshot\" | \"carriedObjectSnapshot\"\n>;\n\nexport interface AddressedActor {\n readonly actorId: Uuid;\n readonly viaCollectionIri?: string | null;\n}\n\n/**\n * `payload` is `undefined` for an unparsable body and `null` for JSON `null`;\n * it is stored as SQL `NULL` when jsonb cannot hold it, and `body` keeps it.\n * `fetchedObject` is stored as SQL `NULL` when jsonb cannot hold it too.\n * An inbound delivery is linked to its activity only by\n * `linkInboundActivity()`.\n */\nexport type InboundDeliveryEntry = Omit<\n DeliveryEntry,\n \"body\" | \"verificationResult\" | \"recipientIris\" | \"activityId\"\n> & {\n /**\n * Chosen in advance when something must name the delivery before it exists.\n */\n readonly id?: Uuid;\n readonly status: \"received\" | \"acknowledged\" | \"unverified\" | \"rejected\";\n readonly verificationResult: NonNullable<DeliveryEntry[\"verificationResult\"]>;\n readonly body: Uint8Array;\n readonly addressed?: readonly AddressedActor[];\n /** When the request arrived, before verification and handling. */\n readonly created: Temporal.Instant;\n /** When DrFed answered the request. */\n readonly completed: Temporal.Instant;\n};\n\n/** `payload` is the document before signing, without `bto` and `bcc`. */\nexport type OutboundDeliveryEntry = Omit<\n DeliveryEntry,\n | \"verificationKeyId\"\n | \"verificationMechanism\"\n | \"verificationResult\"\n | \"body\"\n | \"headers\"\n | \"requestUrl\"\n | \"completed\"\n | \"fetchedObject\"\n> & {\n readonly activityIri: string;\n};\n\ntype ActorRow = Omit<NewActivityDeliveryActor, \"deliveryId\" | \"created\"> & {\n /** The addressed collections that reached the actor, sorted. */\n readonly collectionIris?: readonly string[];\n};\n\n/**\n * Merge the inbox owner and addressed actors into one row per actor, keeping\n * every way each was addressed, whatever order they come in.\n * @returns The actor rows of an inbound delivery.\n */\nexport function inboundActorRows(entry: {\n readonly actorId?: Uuid | null | undefined;\n readonly addressed?: readonly AddressedActor[] | undefined;\n}): ActorRow[] {\n const rows = new Map<Uuid, ActorRow>();\n if (entry.actorId != null) {\n rows.set(entry.actorId, { actorId: entry.actorId, inboxOwner: true });\n }\n for (const { actorId, viaCollectionIri } of entry.addressed ?? []) {\n const row = rows.get(actorId);\n const collectionIris = row?.collectionIris ?? [];\n rows.set(actorId, {\n ...row,\n actorId,\n addressed: true,\n addressedDirectly:\n row?.addressedDirectly === true || viaCollectionIri == null,\n collectionIris:\n viaCollectionIri == null\n ? collectionIris\n : [...new Set([...collectionIris, viaCollectionIri])].toSorted(),\n });\n }\n return [...rows.values()];\n}\n\n/**\n * PostgreSQL's jsonb holds neither U+0000 nor an unpaired surrogate, in keys\n * or in values.\n * @returns Whether the JSON value can be stored as jsonb.\n */\nfunction storableJson(value: unknown): boolean {\n if (typeof value === \"string\") return storableText(value);\n return (\n typeof value !== \"object\" ||\n value == null ||\n Object.entries(value).every(\n ([key, item]) => storableJson(key) && storableJson(item),\n )\n );\n}\n\n/**\n * Keep a payload jsonb cannot hold out of the delivery, rather than the\n * delivery.\n * @returns The value to store, SQL `NULL` for such a payload.\n */\nconst jsonb = (payload: unknown) =>\n payload === null\n ? sql`'null'::jsonb`\n : storableJson(payload)\n ? payload\n : null;\n\n/**\n * A fetched object is a JSON object, so nothing fetched is SQL `NULL`.\n * @returns The value to store.\n */\nconst storedObject = (document: unknown) =>\n document == null ? null : jsonb(document);\n\n/**\n * PostgreSQL's text holds no U+0000, which a remote response or an error\n * quoting one may carry; keep the rest of it rather than lose the delivery.\n * @returns The text with each U+0000 replaced by U+FFFD.\n */\nconst text = (value: string | null | undefined): string | null =>\n value?.replaceAll(\"\\0\", \"\\ufffd\") ?? null;\n\n/**\n * Refuse to relate a delivery to anything but local actors of its instance,\n * which neither foreign key can tell.\n * @throws {Error} When an actor is remote, or of another instance.\n */\nasync function checkLocalActors(\n tx: Transaction,\n instanceId: Uuid,\n actorIds: readonly (Uuid | null | undefined)[],\n): Promise<void> {\n const ids = [...new Set(actorIds.filter((id) => id != null))];\n if (ids.length === 0) return;\n const local = await tx.$count(\n actors,\n and(\n inArray(actors.id, ids),\n eq(actors.instanceId, instanceId),\n isNotNull(actors.localId),\n ),\n );\n if (local !== ids.length) {\n throw new Error(\n \"An activity delivery relates only to local actors of its instance.\",\n );\n }\n}\n\nasync function insertDelivery(\n db: Database,\n delivery: NewActivityDelivery,\n links: readonly ActorRow[],\n): Promise<ActivityDelivery> {\n return await db.transaction(async (tx) => {\n await checkLocalActors(tx, delivery.instanceId, [\n delivery.actorId,\n ...links.map(({ actorId }) => actorId),\n ]);\n const [row] = await tx\n .insert(activityDeliveries)\n .values({\n ...delivery,\n error: text(delivery.error),\n responseBody: text(delivery.responseBody),\n })\n .returning();\n if (row == null) {\n throw new Error(\"Missing activity delivery after insertion.\");\n }\n if (links.length > 0) {\n await tx.insert(activityDeliveryActors).values(\n links.map(({ collectionIris: _, ...link }) => ({\n ...link,\n deliveryId: row.id,\n created: row.created,\n })),\n );\n }\n const collections = links.flatMap(({ actorId, collectionIris = [] }) =>\n collectionIris.map((collectionIri) => ({\n deliveryId: row.id,\n actorId,\n collectionIri,\n })),\n );\n if (collections.length > 0) {\n await tx.insert(activityDeliveryActorCollections).values(collections);\n }\n return row;\n });\n}\n\n/**\n * Persist one inbound observation with its actor rows in one transaction.\n * The inbox owner and every addressed actor must be local actors of\n * `instanceId`; otherwise nothing is recorded.\n * @returns The inserted inbound delivery.\n * @throws {Error} When an actor is not a local actor of the instance.\n */\nexport async function recordInbound(\n db: Database,\n { addressed, body, id = uuidV7(), ...entry }: InboundDeliveryEntry,\n): Promise<ActivityDelivery> {\n return await insertDelivery(\n db,\n {\n ...entry,\n body: Buffer.from(body),\n payload: jsonb(entry.payload),\n fetchedObject: storedObject(entry.fetchedObject),\n id,\n direction: \"inbound\",\n // Whatever a caller outside TypeScript passes.\n carriedSnapshot: false,\n carriedObjectSnapshot: false,\n },\n inboundActorRows({ actorId: entry.actorId, addressed }),\n );\n}\n\n/**\n * Record that an inbox listener ran for an inbound delivery answered before it\n * did, as a queued one is.\n * @returns Whether an acknowledged inbound delivery was found.\n */\nexport async function receiveInbound(db: Database, id: Uuid): Promise<boolean> {\n const rows = await db\n .update(activityDeliveries)\n .set({ status: \"received\" })\n .where(\n and(\n eq(activityDeliveries.id, id),\n eq(activityDeliveries.direction, \"inbound\"),\n eq(activityDeliveries.status, \"acknowledged\"),\n ),\n )\n .returning({ id: activityDeliveries.id });\n return rows.length > 0;\n}\n\n/**\n * Decide what a linked inbound delivery carried, anew every time, so that a\n * mark left from an activity deleted since never carries over to another\n * stored under the same IRI:\n *\n * - The stored activity, when its payload is the stored document, since the\n * same IRI may arrive again with other contents.\n * - The object stored with that activity, when the delivery carried the\n * activity and the object was taken from it, or when its inbox listener\n * fetched the object as stored. Matching the activity proves nothing of\n * an object fetched apart from it, which may differ from fetch to fetch.\n *\n * A payload or a fetched object jsonb could not hold is stored as SQL `NULL`\n * and carries nothing. An unlinked delivery is left as is.\n */\nasync function decideCarried(tx: Transaction, deliveryId: Uuid): Promise<void> {\n // Both current callers already update this delivery; retain that lock order\n // explicitly so every recomputation serializes evidence and receipt changes.\n const [delivery] = await tx\n .select({\n activityId: activityDeliveries.activityId,\n payload: activityDeliveries.payload,\n fetchedObject: activityDeliveries.fetchedObject,\n })\n .from(activityDeliveries)\n .where(\n and(\n eq(activityDeliveries.id, deliveryId),\n eq(activityDeliveries.direction, \"inbound\"),\n ),\n )\n .for(\"update\");\n if (delivery === undefined) return;\n const [activity] =\n delivery.activityId === null\n ? []\n : await tx\n .select({\n id: activities.id,\n document: activities.document,\n })\n .from(activities)\n .where(eq(activities.id, delivery.activityId));\n // Lock separately, never the nullable side of an outer join. Deletion waits\n // for this transaction, then its AFTER DELETE cleanup sees our receipts.\n // This must precede receipt writes to avoid reversing the delete lock order.\n const [object] =\n activity === undefined\n ? []\n : await tx\n .select({\n id: objects.id,\n document: objects.document,\n fetched: objects.fetched,\n })\n .from(objects)\n .where(eq(objects.activityId, activity.id))\n .for(\"key share\");\n await tx\n .delete(revisionReceipts)\n .where(eq(revisionReceipts.deliveryId, deliveryId));\n if (activity === undefined) return;\n const carriedSnapshot =\n delivery.payload != null &&\n isDeepStrictEqual(delivery.payload, activity.document);\n const carriedObjectSnapshot =\n carriedSnapshot &&\n object !== undefined &&\n (!object.fetched ||\n (delivery.fetchedObject != null &&\n isDeepStrictEqual(delivery.fetchedObject, object.document)));\n await tx\n .update(activityDeliveries)\n .set({ carriedSnapshot, carriedObjectSnapshot })\n .where(eq(activityDeliveries.id, deliveryId));\n if (!carriedSnapshot) return;\n const revisions = await tx\n .select()\n .from(resourceRevisions)\n .where(\n and(\n inArray(\n resourceRevisions.resourceId,\n object === undefined ? [activity.id] : [activity.id, object.id],\n ),\n eq(resourceRevisions.sequence, 1),\n eq(resourceRevisions.kind, \"snapshot\"),\n ),\n );\n const activityRevision = revisions.find(\n (revision) => revision.resourceId === activity.id,\n );\n if (\n activityRevision === undefined ||\n !isDeepStrictEqual(activityRevision.document, activity.document)\n ) {\n return;\n }\n const receipts: (typeof revisionReceipts.$inferInsert)[] = [\n {\n deliveryId,\n revisionId: activityRevision.id,\n role: \"activity\",\n },\n ];\n const objectRevision =\n object === undefined\n ? undefined\n : revisions.find((revision) => revision.resourceId === object.id);\n if (\n carriedObjectSnapshot &&\n object !== undefined &&\n objectRevision !== undefined &&\n isDeepStrictEqual(objectRevision.document, object.document)\n ) {\n receipts.push({\n deliveryId,\n revisionId: objectRevision.id,\n role: \"object\",\n });\n }\n await tx.insert(revisionReceipts).values(receipts);\n}\n\n/**\n * Link an inbound delivery to the stored activity its activity IRI names.\n * Only a delivery Fedify verified and answered with 2xx is linked: Fedify\n * authenticates an activity before accepting it, so its actor has the origin\n * of the activity's ID, whether an inbox listener ran or it was a duplicate.\n * A delivery that is already linked is left as is.\n *\n * The link names the activity whatever the delivery carried; what it carried\n * is decided as the link is made, as `recordFetchedObject()` decides it again.\n * @returns Whether the delivery was linked.\n */\nexport async function linkInboundActivity(\n db: Database | Transaction,\n deliveryId: Uuid,\n): Promise<boolean> {\n return await db.transaction(async (tx) => {\n const [row] = await tx\n .update(activityDeliveries)\n .set({ activityId: resources.id })\n .from(resources)\n .innerJoin(activities, eq(activities.id, resources.id))\n .where(\n and(\n eq(activityDeliveries.id, deliveryId),\n eq(activityDeliveries.direction, \"inbound\"),\n inArray(activityDeliveries.status, [\"received\", \"acknowledged\"]),\n eq(activityDeliveries.verificationResult, \"verified\"),\n isNull(activityDeliveries.activityId),\n eq(resources.iri, activityDeliveries.activityIri),\n eq(resources.kind, \"activity\"),\n ),\n )\n .returning({ id: activityDeliveries.id });\n if (row == null) return false;\n await decideCarried(tx, deliveryId);\n return true;\n });\n}\n\n/**\n * Record the object an inbound delivery's inbox listener fetched from its IRI,\n * and decide again what the delivery carried if it is linked already, as a\n * duplicate queued for a worker is before its listener runs.\n * @returns Whether the inbound delivery was found.\n */\nexport async function recordFetchedObject(\n db: Database,\n deliveryId: Uuid,\n document: unknown,\n): Promise<boolean> {\n return await db.transaction(async (tx) => {\n const rows = await tx\n .update(activityDeliveries)\n .set({ fetchedObject: storedObject(document) })\n .where(\n and(\n eq(activityDeliveries.id, deliveryId),\n eq(activityDeliveries.direction, \"inbound\"),\n ),\n )\n .returning({ id: activityDeliveries.id });\n if (rows.length < 1) return false;\n await decideCarried(tx, deliveryId);\n return true;\n });\n}\n\n/**\n * Start a delivery observation. The payload is the document before signing.\n * The sender must be a local actor of `instanceId`; otherwise nothing is\n * recorded.\n * @returns The inserted queued outbound delivery.\n * @throws {Error} When the sender is not a local actor of the instance.\n */\nexport async function recordOutbound(\n db: Database,\n entry: OutboundDeliveryEntry,\n): Promise<ActivityDelivery> {\n return await insertDelivery(\n db,\n {\n ...entry,\n // The application clock, as inbound deliveries use, so both directions sort together.\n created: entry.created ?? Temporal.Now.instant(),\n payload: jsonb(entry.payload),\n id: uuidV7(),\n direction: \"outbound\",\n status: \"queued\",\n fetchedObject: null,\n carriedSnapshot: false,\n carriedObjectSnapshot: false,\n },\n entry.actorId == null ? [] : [{ actorId: entry.actorId, sender: true }],\n );\n}\n\n/** What a settled delivery shows; null fields for a successful attempt. */\nexport interface OutboundSettlement {\n readonly activityIri: string;\n readonly inboxUrl: string;\n readonly status: \"sent\" | \"failed\" | \"permanently_failed\" | \"abandoned\";\n readonly statusCode?: number | null;\n readonly error?: string | null;\n readonly responseBody?: string | null;\n /** Whether an attempt ended with this result, rather than none being made. */\n readonly attempted: boolean;\n /** Restrict a synchronous delivery to the row started by that invocation. */\n readonly id?: Uuid;\n}\n\n/**\n * Settle the most recent pending (`queued` or `failed`) delivery to an inbox,\n * keeping each ended attempt. `sent`, `permanently_failed` and `abandoned`\n * deliveries are never changed again.\n * @returns Whether a pending delivery was found.\n */\nexport async function settleOutbound(\n db: Database,\n entry: OutboundSettlement,\n): Promise<boolean> {\n const summary = {\n statusCode: entry.statusCode ?? null,\n error: text(entry.error),\n responseBody: text(entry.responseBody),\n };\n return await db.transaction(async (tx) => {\n const [delivery] = await tx\n .select({ id: activityDeliveries.id })\n .from(activityDeliveries)\n .where(\n and(\n eq(activityDeliveries.direction, \"outbound\"),\n eq(activityDeliveries.activityIri, entry.activityIri),\n eq(activityDeliveries.inboxUrl, entry.inboxUrl),\n inArray(activityDeliveries.status, [\"queued\", \"failed\"]),\n entry.id == null ? undefined : eq(activityDeliveries.id, entry.id),\n ),\n )\n .orderBy(desc(activityDeliveries.created), desc(activityDeliveries.id))\n .limit(1)\n .for(\"update\");\n if (delivery == null) return false;\n const completed = Temporal.Now.instant();\n if (entry.attempted) {\n await tx.insert(activityDeliveryAttempts).values({\n ...summary,\n id: uuidV7(),\n deliveryId: delivery.id,\n succeeded: entry.status === \"sent\",\n created: completed,\n });\n }\n await tx\n .update(activityDeliveries)\n .set({ ...summary, status: entry.status, completed })\n .where(eq(activityDeliveries.id, delivery.id));\n return true;\n });\n}\n"],"mappings":";;;;;;;;;;;AAoGA,SAAgB,iBAAiB,OAGlB;CACb,MAAM,uBAAO,IAAI,IAAoB;CACrC,IAAI,MAAM,WAAW,MACnB,KAAK,IAAI,MAAM,SAAS;EAAE,SAAS,MAAM;EAAS,YAAY;CAAK,CAAC;CAEtE,KAAK,MAAM,EAAE,SAAS,sBAAsB,MAAM,aAAa,CAAC,GAAG;EACjE,MAAM,MAAM,KAAK,IAAI,OAAO;EAC5B,MAAM,iBAAiB,KAAK,kBAAkB,CAAC;EAC/C,KAAK,IAAI,SAAS;GAChB,GAAG;GACH;GACA,WAAW;GACX,mBACE,KAAK,sBAAsB,QAAQ,oBAAoB;GACzD,gBACE,oBAAoB,OAChB,iBACA,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,gBAAgB,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;EACrE,CAAC;CACH;CACA,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC;AAC1B;;;;;;AAOA,SAAS,aAAa,OAAyB;CAC7C,IAAI,OAAO,UAAU,UAAU,OAAO,aAAa,KAAK;CACxD,OACE,OAAO,UAAU,YACjB,SAAS,QACT,OAAO,QAAQ,KAAK,CAAC,CAAC,OACnB,CAAC,KAAK,UAAU,aAAa,GAAG,KAAK,aAAa,IAAI,CACzD;AAEJ;;;;;;AAOA,MAAM,SAAS,YACb,YAAY,OACR,GAAG,kBACH,aAAa,OAAO,IAClB,UACA;;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C,OAAO;GAC/C,GAAG;GACH,IAAI,OAAO;GACX,YAAY,SAAS;GACrB,WAAW,MAAM,WAAW;GAC5B,SAAS;EACX,CAAC;EAEH,MAAM,GACH,OAAO,kBAAkB,CAAC,CAC1B,IAAI;GAAE,GAAG;GAAS,QAAQ,MAAM;GAAQ;EAAU,CAAC,CAAC,CACpD,MAAM,GAAG,mBAAmB,IAAI,SAAS,EAAE,CAAC;EAC/C,OAAO;CACT,CAAC;AACH"}
|
|
@@ -32,7 +32,7 @@ declare function observeKeyVersion(db: Database, entry: {
|
|
|
32
32
|
readonly observed?: Temporal.Instant;
|
|
33
33
|
}): Promise<KeyVersion>;
|
|
34
34
|
declare namespace schema_d_exports {
|
|
35
|
-
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 };
|
|
35
|
+
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, NewResourceRevision, NewSession, ObjectType, Resource, ResourceHead, ResourceRevision, RevisionAddressing, RevisionReceipt, RevisionRelation, 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, resourceHeads, resourceKindEnum, resourceRevisionCaptureEnum, resourceRevisionKindEnum, resourceRevisionProjectionEnum, resourceRevisions, resources, revisionAddressing, revisionReceiptRoleEnum, revisionReceipts, revisionRelationRepresentationEnum, revisionRelations, sessions };
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* The database table to represent accounts.
|
|
@@ -648,9 +648,9 @@ declare const actorTypeEnum: import("drizzle-orm/pg-core").PgEnum<["Application"
|
|
|
648
648
|
type ActorType = (typeof actorTypeEnum.enumValues)[number];
|
|
649
649
|
declare const resourceKindEnum: import("drizzle-orm/pg-core").PgEnum<["actor", "object", "activity", "collection", "unknown"]>;
|
|
650
650
|
/**
|
|
651
|
-
* Canonical IRI registry.
|
|
652
|
-
*
|
|
653
|
-
*
|
|
651
|
+
* Canonical IRI registry. Retained revisions keep their resource identity
|
|
652
|
+
* even after a current typed row is deleted. Other references may also
|
|
653
|
+
* intentionally restrict physical removal of the resource.
|
|
654
654
|
*/
|
|
655
655
|
declare const resources: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
656
656
|
name: "resources";
|
|
@@ -2973,9 +2973,478 @@ type ActivityDeliveryDirection = (typeof activityDeliveryDirectionEnum.enumValue
|
|
|
2973
2973
|
type ActivityDeliveryStatus = (typeof activityDeliveryStatusEnum.enumValues)[number];
|
|
2974
2974
|
type ActivityDeliveryVerificationMechanism = (typeof activityDeliveryVerificationMechanismEnum.enumValues)[number];
|
|
2975
2975
|
type ActivityDeliveryVerificationResult = (typeof activityDeliveryVerificationResultEnum.enumValues)[number];
|
|
2976
|
+
declare const resourceRevisionKindEnum: import("drizzle-orm/pg-core").PgEnum<["snapshot", "unavailable", "whiteout"]>;
|
|
2977
|
+
declare const resourceRevisionCaptureEnum: import("drizzle-orm/pg-core").PgEnum<["local", "received", "embedded", "fetched"]>;
|
|
2978
|
+
declare const resourceRevisionProjectionEnum: import("drizzle-orm/pg-core").PgEnum<["partial", "complete"]>;
|
|
2979
|
+
/** Immutable parsed documents, independently of current typed rows. */
|
|
2980
|
+
declare const resourceRevisions: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2981
|
+
name: "resource_revisions";
|
|
2982
|
+
schema: undefined;
|
|
2983
|
+
columns: {
|
|
2984
|
+
id: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgUUIDBuilder, `${string}-${string}-${string}-${string}-${string}`>>>, {
|
|
2985
|
+
name: string;
|
|
2986
|
+
tableName: "resource_revisions";
|
|
2987
|
+
dataType: "string uuid";
|
|
2988
|
+
data: `${string}-${string}-${string}-${string}-${string}`;
|
|
2989
|
+
driverParam: string;
|
|
2990
|
+
notNull: true;
|
|
2991
|
+
hasDefault: true;
|
|
2992
|
+
isPrimaryKey: false;
|
|
2993
|
+
isAutoincrement: false;
|
|
2994
|
+
hasRuntimeDefault: false;
|
|
2995
|
+
enumValues: undefined;
|
|
2996
|
+
identity: undefined;
|
|
2997
|
+
generated: undefined;
|
|
2998
|
+
}>;
|
|
2999
|
+
resourceId: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgUUIDBuilder, `${string}-${string}-${string}-${string}-${string}`>>, {
|
|
3000
|
+
name: string;
|
|
3001
|
+
tableName: "resource_revisions";
|
|
3002
|
+
dataType: "string uuid";
|
|
3003
|
+
data: `${string}-${string}-${string}-${string}-${string}`;
|
|
3004
|
+
driverParam: string;
|
|
3005
|
+
notNull: true;
|
|
3006
|
+
hasDefault: false;
|
|
3007
|
+
isPrimaryKey: false;
|
|
3008
|
+
isAutoincrement: false;
|
|
3009
|
+
hasRuntimeDefault: false;
|
|
3010
|
+
enumValues: undefined;
|
|
3011
|
+
identity: undefined;
|
|
3012
|
+
generated: undefined;
|
|
3013
|
+
}>;
|
|
3014
|
+
sequence: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgIntegerBuilder>, {
|
|
3015
|
+
name: string;
|
|
3016
|
+
tableName: "resource_revisions";
|
|
3017
|
+
dataType: "number int32";
|
|
3018
|
+
data: number;
|
|
3019
|
+
driverParam: string | number;
|
|
3020
|
+
notNull: true;
|
|
3021
|
+
hasDefault: false;
|
|
3022
|
+
isPrimaryKey: false;
|
|
3023
|
+
isAutoincrement: false;
|
|
3024
|
+
hasRuntimeDefault: false;
|
|
3025
|
+
enumValues: undefined;
|
|
3026
|
+
identity: undefined;
|
|
3027
|
+
generated: undefined;
|
|
3028
|
+
}>;
|
|
3029
|
+
kind: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgEnumColumnBuilder<["snapshot", "unavailable", "whiteout"]>>, {
|
|
3030
|
+
name: string;
|
|
3031
|
+
tableName: "resource_revisions";
|
|
3032
|
+
dataType: "string enum";
|
|
3033
|
+
data: "snapshot" | "unavailable" | "whiteout";
|
|
3034
|
+
driverParam: string;
|
|
3035
|
+
notNull: true;
|
|
3036
|
+
hasDefault: false;
|
|
3037
|
+
isPrimaryKey: false;
|
|
3038
|
+
isAutoincrement: false;
|
|
3039
|
+
hasRuntimeDefault: false;
|
|
3040
|
+
enumValues: ["snapshot", "unavailable", "whiteout"];
|
|
3041
|
+
identity: undefined;
|
|
3042
|
+
generated: undefined;
|
|
3043
|
+
}>;
|
|
3044
|
+
capture: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgEnumColumnBuilder<["local", "received", "embedded", "fetched"]>>, {
|
|
3045
|
+
name: string;
|
|
3046
|
+
tableName: "resource_revisions";
|
|
3047
|
+
dataType: "string enum";
|
|
3048
|
+
data: "embedded" | "fetched" | "local" | "received";
|
|
3049
|
+
driverParam: string;
|
|
3050
|
+
notNull: true;
|
|
3051
|
+
hasDefault: false;
|
|
3052
|
+
isPrimaryKey: false;
|
|
3053
|
+
isAutoincrement: false;
|
|
3054
|
+
hasRuntimeDefault: false;
|
|
3055
|
+
enumValues: ["local", "received", "embedded", "fetched"];
|
|
3056
|
+
identity: undefined;
|
|
3057
|
+
generated: undefined;
|
|
3058
|
+
}>;
|
|
3059
|
+
backfilled: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBooleanBuilder>>, {
|
|
3060
|
+
name: string;
|
|
3061
|
+
tableName: "resource_revisions";
|
|
3062
|
+
dataType: "boolean";
|
|
3063
|
+
data: boolean;
|
|
3064
|
+
driverParam: boolean;
|
|
3065
|
+
notNull: true;
|
|
3066
|
+
hasDefault: true;
|
|
3067
|
+
isPrimaryKey: false;
|
|
3068
|
+
isAutoincrement: false;
|
|
3069
|
+
hasRuntimeDefault: false;
|
|
3070
|
+
enumValues: undefined;
|
|
3071
|
+
identity: undefined;
|
|
3072
|
+
generated: undefined;
|
|
3073
|
+
}>;
|
|
3074
|
+
document: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").PgJsonBuilder, {
|
|
3075
|
+
name: string;
|
|
3076
|
+
tableName: "resource_revisions";
|
|
3077
|
+
dataType: "object json";
|
|
3078
|
+
data: unknown;
|
|
3079
|
+
driverParam: unknown;
|
|
3080
|
+
notNull: false;
|
|
3081
|
+
hasDefault: false;
|
|
3082
|
+
isPrimaryKey: false;
|
|
3083
|
+
isAutoincrement: false;
|
|
3084
|
+
hasRuntimeDefault: false;
|
|
3085
|
+
enumValues: undefined;
|
|
3086
|
+
identity: undefined;
|
|
3087
|
+
generated: undefined;
|
|
3088
|
+
}>;
|
|
3089
|
+
formerTypes: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetDimensions<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, 1>, {
|
|
3090
|
+
name: string;
|
|
3091
|
+
tableName: "resource_revisions";
|
|
3092
|
+
dataType: "string";
|
|
3093
|
+
data: string[];
|
|
3094
|
+
driverParam: string | string[];
|
|
3095
|
+
notNull: false;
|
|
3096
|
+
hasDefault: false;
|
|
3097
|
+
isPrimaryKey: false;
|
|
3098
|
+
isAutoincrement: false;
|
|
3099
|
+
hasRuntimeDefault: false;
|
|
3100
|
+
enumValues: undefined;
|
|
3101
|
+
identity: undefined;
|
|
3102
|
+
generated: undefined;
|
|
3103
|
+
}>;
|
|
3104
|
+
deleted: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
3105
|
+
dataType: 'custom';
|
|
3106
|
+
data: Temporal.Instant;
|
|
3107
|
+
driverParam: string;
|
|
3108
|
+
}>, {
|
|
3109
|
+
name: string;
|
|
3110
|
+
tableName: "resource_revisions";
|
|
3111
|
+
dataType: "custom";
|
|
3112
|
+
data: Temporal.Instant;
|
|
3113
|
+
driverParam: string;
|
|
3114
|
+
notNull: false;
|
|
3115
|
+
hasDefault: false;
|
|
3116
|
+
isPrimaryKey: false;
|
|
3117
|
+
isAutoincrement: false;
|
|
3118
|
+
hasRuntimeDefault: false;
|
|
3119
|
+
enumValues: undefined;
|
|
3120
|
+
identity: undefined;
|
|
3121
|
+
generated: undefined;
|
|
3122
|
+
}>;
|
|
3123
|
+
projection: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgEnumColumnBuilder<["partial", "complete"]>>>, {
|
|
3124
|
+
name: string;
|
|
3125
|
+
tableName: "resource_revisions";
|
|
3126
|
+
dataType: "string enum";
|
|
3127
|
+
data: "complete" | "partial";
|
|
3128
|
+
driverParam: string;
|
|
3129
|
+
notNull: true;
|
|
3130
|
+
hasDefault: true;
|
|
3131
|
+
isPrimaryKey: false;
|
|
3132
|
+
isAutoincrement: false;
|
|
3133
|
+
hasRuntimeDefault: false;
|
|
3134
|
+
enumValues: ["partial", "complete"];
|
|
3135
|
+
identity: undefined;
|
|
3136
|
+
generated: undefined;
|
|
3137
|
+
}>;
|
|
3138
|
+
created: import("drizzle-orm/pg-core").PgBuildColumn<"resource_revisions", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
3139
|
+
dataType: 'custom';
|
|
3140
|
+
data: Temporal.Instant;
|
|
3141
|
+
driverParam: string;
|
|
3142
|
+
}>>>, {
|
|
3143
|
+
name: string;
|
|
3144
|
+
tableName: "resource_revisions";
|
|
3145
|
+
dataType: "custom";
|
|
3146
|
+
data: Temporal.Instant;
|
|
3147
|
+
driverParam: string;
|
|
3148
|
+
notNull: true;
|
|
3149
|
+
hasDefault: true;
|
|
3150
|
+
isPrimaryKey: false;
|
|
3151
|
+
isAutoincrement: false;
|
|
3152
|
+
hasRuntimeDefault: false;
|
|
3153
|
+
enumValues: undefined;
|
|
3154
|
+
identity: undefined;
|
|
3155
|
+
generated: undefined;
|
|
3156
|
+
}>;
|
|
3157
|
+
};
|
|
3158
|
+
dialect: 'pg';
|
|
3159
|
+
}>;
|
|
3160
|
+
/** The current revision of one canonical resource. */
|
|
3161
|
+
declare const resourceHeads: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3162
|
+
name: "resource_heads";
|
|
3163
|
+
schema: undefined;
|
|
3164
|
+
columns: {
|
|
3165
|
+
resourceId: import("drizzle-orm/pg-core").PgBuildColumn<"resource_heads", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgUUIDBuilder, `${string}-${string}-${string}-${string}-${string}`>>, {
|
|
3166
|
+
name: string;
|
|
3167
|
+
tableName: "resource_heads";
|
|
3168
|
+
dataType: "string uuid";
|
|
3169
|
+
data: `${string}-${string}-${string}-${string}-${string}`;
|
|
3170
|
+
driverParam: string;
|
|
3171
|
+
notNull: true;
|
|
3172
|
+
hasDefault: false;
|
|
3173
|
+
isPrimaryKey: false;
|
|
3174
|
+
isAutoincrement: false;
|
|
3175
|
+
hasRuntimeDefault: false;
|
|
3176
|
+
enumValues: undefined;
|
|
3177
|
+
identity: undefined;
|
|
3178
|
+
generated: undefined;
|
|
3179
|
+
}>;
|
|
3180
|
+
revisionId: import("drizzle-orm/pg-core").PgBuildColumn<"resource_heads", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgUUIDBuilder, `${string}-${string}-${string}-${string}-${string}`>>, {
|
|
3181
|
+
name: string;
|
|
3182
|
+
tableName: "resource_heads";
|
|
3183
|
+
dataType: "string uuid";
|
|
3184
|
+
data: `${string}-${string}-${string}-${string}-${string}`;
|
|
3185
|
+
driverParam: string;
|
|
3186
|
+
notNull: true;
|
|
3187
|
+
hasDefault: false;
|
|
3188
|
+
isPrimaryKey: false;
|
|
3189
|
+
isAutoincrement: false;
|
|
3190
|
+
hasRuntimeDefault: false;
|
|
3191
|
+
enumValues: undefined;
|
|
3192
|
+
identity: undefined;
|
|
3193
|
+
generated: undefined;
|
|
3194
|
+
}>;
|
|
3195
|
+
};
|
|
3196
|
+
dialect: 'pg';
|
|
3197
|
+
}>;
|
|
3198
|
+
/** Root addressing occurrences, including blind recipients and duplicates. */
|
|
3199
|
+
declare const revisionAddressing: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3200
|
+
name: "revision_addressing";
|
|
3201
|
+
schema: undefined;
|
|
3202
|
+
columns: {
|
|
3203
|
+
revisionId: import("drizzle-orm/pg-core").PgBuildColumn<"revision_addressing", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgUUIDBuilder, `${string}-${string}-${string}-${string}-${string}`>>, {
|
|
3204
|
+
name: string;
|
|
3205
|
+
tableName: "revision_addressing";
|
|
3206
|
+
dataType: "string uuid";
|
|
3207
|
+
data: `${string}-${string}-${string}-${string}-${string}`;
|
|
3208
|
+
driverParam: string;
|
|
3209
|
+
notNull: true;
|
|
3210
|
+
hasDefault: false;
|
|
3211
|
+
isPrimaryKey: false;
|
|
3212
|
+
isAutoincrement: false;
|
|
3213
|
+
hasRuntimeDefault: false;
|
|
3214
|
+
enumValues: undefined;
|
|
3215
|
+
identity: undefined;
|
|
3216
|
+
generated: undefined;
|
|
3217
|
+
}>;
|
|
3218
|
+
property: import("drizzle-orm/pg-core").PgBuildColumn<"revision_addressing", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgEnumColumnBuilder<["to", "cc", "bto", "bcc", "audience"]>>, {
|
|
3219
|
+
name: string;
|
|
3220
|
+
tableName: "revision_addressing";
|
|
3221
|
+
dataType: "string enum";
|
|
3222
|
+
data: "audience" | "bcc" | "bto" | "cc" | "to";
|
|
3223
|
+
driverParam: string;
|
|
3224
|
+
notNull: true;
|
|
3225
|
+
hasDefault: false;
|
|
3226
|
+
isPrimaryKey: false;
|
|
3227
|
+
isAutoincrement: false;
|
|
3228
|
+
hasRuntimeDefault: false;
|
|
3229
|
+
enumValues: ["to", "cc", "bto", "bcc", "audience"];
|
|
3230
|
+
identity: undefined;
|
|
3231
|
+
generated: undefined;
|
|
3232
|
+
}>;
|
|
3233
|
+
position: import("drizzle-orm/pg-core").PgBuildColumn<"revision_addressing", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgIntegerBuilder>, {
|
|
3234
|
+
name: string;
|
|
3235
|
+
tableName: "revision_addressing";
|
|
3236
|
+
dataType: "number int32";
|
|
3237
|
+
data: number;
|
|
3238
|
+
driverParam: string | number;
|
|
3239
|
+
notNull: true;
|
|
3240
|
+
hasDefault: false;
|
|
3241
|
+
isPrimaryKey: false;
|
|
3242
|
+
isAutoincrement: false;
|
|
3243
|
+
hasRuntimeDefault: false;
|
|
3244
|
+
enumValues: undefined;
|
|
3245
|
+
identity: undefined;
|
|
3246
|
+
generated: undefined;
|
|
3247
|
+
}>;
|
|
3248
|
+
iri: import("drizzle-orm/pg-core").PgBuildColumn<"revision_addressing", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
|
|
3249
|
+
name: string;
|
|
3250
|
+
tableName: "revision_addressing";
|
|
3251
|
+
dataType: "string";
|
|
3252
|
+
data: string;
|
|
3253
|
+
driverParam: string;
|
|
3254
|
+
notNull: true;
|
|
3255
|
+
hasDefault: false;
|
|
3256
|
+
isPrimaryKey: false;
|
|
3257
|
+
isAutoincrement: false;
|
|
3258
|
+
hasRuntimeDefault: false;
|
|
3259
|
+
enumValues: undefined;
|
|
3260
|
+
identity: undefined;
|
|
3261
|
+
generated: undefined;
|
|
3262
|
+
}>;
|
|
3263
|
+
};
|
|
3264
|
+
dialect: 'pg';
|
|
3265
|
+
}>;
|
|
3266
|
+
declare const revisionRelationRepresentationEnum: import("drizzle-orm/pg-core").PgEnum<["reference", "embedded", "link"]>;
|
|
3267
|
+
/** Caller-supplied relation occurrences; the saved JSON remains authoritative. */
|
|
3268
|
+
declare const revisionRelations: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3269
|
+
name: "revision_relations";
|
|
3270
|
+
schema: undefined;
|
|
3271
|
+
columns: {
|
|
3272
|
+
revisionId: import("drizzle-orm/pg-core").PgBuildColumn<"revision_relations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgUUIDBuilder, `${string}-${string}-${string}-${string}-${string}`>>, {
|
|
3273
|
+
name: string;
|
|
3274
|
+
tableName: "revision_relations";
|
|
3275
|
+
dataType: "string uuid";
|
|
3276
|
+
data: `${string}-${string}-${string}-${string}-${string}`;
|
|
3277
|
+
driverParam: string;
|
|
3278
|
+
notNull: true;
|
|
3279
|
+
hasDefault: false;
|
|
3280
|
+
isPrimaryKey: false;
|
|
3281
|
+
isAutoincrement: false;
|
|
3282
|
+
hasRuntimeDefault: false;
|
|
3283
|
+
enumValues: undefined;
|
|
3284
|
+
identity: undefined;
|
|
3285
|
+
generated: undefined;
|
|
3286
|
+
}>;
|
|
3287
|
+
occurrence: import("drizzle-orm/pg-core").PgBuildColumn<"revision_relations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgIntegerBuilder>, {
|
|
3288
|
+
name: string;
|
|
3289
|
+
tableName: "revision_relations";
|
|
3290
|
+
dataType: "number int32";
|
|
3291
|
+
data: number;
|
|
3292
|
+
driverParam: string | number;
|
|
3293
|
+
notNull: true;
|
|
3294
|
+
hasDefault: false;
|
|
3295
|
+
isPrimaryKey: false;
|
|
3296
|
+
isAutoincrement: false;
|
|
3297
|
+
hasRuntimeDefault: false;
|
|
3298
|
+
enumValues: undefined;
|
|
3299
|
+
identity: undefined;
|
|
3300
|
+
generated: undefined;
|
|
3301
|
+
}>;
|
|
3302
|
+
property: import("drizzle-orm/pg-core").PgBuildColumn<"revision_relations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
|
|
3303
|
+
name: string;
|
|
3304
|
+
tableName: "revision_relations";
|
|
3305
|
+
dataType: "string";
|
|
3306
|
+
data: string;
|
|
3307
|
+
driverParam: string;
|
|
3308
|
+
notNull: true;
|
|
3309
|
+
hasDefault: false;
|
|
3310
|
+
isPrimaryKey: false;
|
|
3311
|
+
isAutoincrement: false;
|
|
3312
|
+
hasRuntimeDefault: false;
|
|
3313
|
+
enumValues: undefined;
|
|
3314
|
+
identity: undefined;
|
|
3315
|
+
generated: undefined;
|
|
3316
|
+
}>;
|
|
3317
|
+
path: import("drizzle-orm/pg-core").PgBuildColumn<"revision_relations", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonBuilder, readonly (string | number)[]>, {
|
|
3318
|
+
name: string;
|
|
3319
|
+
tableName: "revision_relations";
|
|
3320
|
+
dataType: "object json";
|
|
3321
|
+
data: readonly (string | number)[];
|
|
3322
|
+
driverParam: unknown;
|
|
3323
|
+
notNull: false;
|
|
3324
|
+
hasDefault: false;
|
|
3325
|
+
isPrimaryKey: false;
|
|
3326
|
+
isAutoincrement: false;
|
|
3327
|
+
hasRuntimeDefault: false;
|
|
3328
|
+
enumValues: undefined;
|
|
3329
|
+
identity: undefined;
|
|
3330
|
+
generated: undefined;
|
|
3331
|
+
}>;
|
|
3332
|
+
representation: import("drizzle-orm/pg-core").PgBuildColumn<"revision_relations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgEnumColumnBuilder<["reference", "embedded", "link"]>>, {
|
|
3333
|
+
name: string;
|
|
3334
|
+
tableName: "revision_relations";
|
|
3335
|
+
dataType: "string enum";
|
|
3336
|
+
data: "embedded" | "link" | "reference";
|
|
3337
|
+
driverParam: string;
|
|
3338
|
+
notNull: true;
|
|
3339
|
+
hasDefault: false;
|
|
3340
|
+
isPrimaryKey: false;
|
|
3341
|
+
isAutoincrement: false;
|
|
3342
|
+
hasRuntimeDefault: false;
|
|
3343
|
+
enumValues: ["reference", "embedded", "link"];
|
|
3344
|
+
identity: undefined;
|
|
3345
|
+
generated: undefined;
|
|
3346
|
+
}>;
|
|
3347
|
+
targetIri: import("drizzle-orm/pg-core").PgBuildColumn<"revision_relations", import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, {
|
|
3348
|
+
name: string;
|
|
3349
|
+
tableName: "revision_relations";
|
|
3350
|
+
dataType: "string";
|
|
3351
|
+
data: string;
|
|
3352
|
+
driverParam: string;
|
|
3353
|
+
notNull: false;
|
|
3354
|
+
hasDefault: false;
|
|
3355
|
+
isPrimaryKey: false;
|
|
3356
|
+
isAutoincrement: false;
|
|
3357
|
+
hasRuntimeDefault: false;
|
|
3358
|
+
enumValues: undefined;
|
|
3359
|
+
identity: undefined;
|
|
3360
|
+
generated: undefined;
|
|
3361
|
+
}>;
|
|
3362
|
+
};
|
|
3363
|
+
dialect: 'pg';
|
|
3364
|
+
}>;
|
|
3365
|
+
declare const revisionReceiptRoleEnum: import("drizzle-orm/pg-core").PgEnum<["activity", "object"]>;
|
|
3366
|
+
/** Mutable index of delivery evidence, not part of immutable document history. */
|
|
3367
|
+
declare const revisionReceipts: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3368
|
+
name: "revision_receipts";
|
|
3369
|
+
schema: undefined;
|
|
3370
|
+
columns: {
|
|
3371
|
+
deliveryId: import("drizzle-orm/pg-core").PgBuildColumn<"revision_receipts", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgUUIDBuilder, `${string}-${string}-${string}-${string}-${string}`>>, {
|
|
3372
|
+
name: string;
|
|
3373
|
+
tableName: "revision_receipts";
|
|
3374
|
+
dataType: "string uuid";
|
|
3375
|
+
data: `${string}-${string}-${string}-${string}-${string}`;
|
|
3376
|
+
driverParam: string;
|
|
3377
|
+
notNull: true;
|
|
3378
|
+
hasDefault: false;
|
|
3379
|
+
isPrimaryKey: false;
|
|
3380
|
+
isAutoincrement: false;
|
|
3381
|
+
hasRuntimeDefault: false;
|
|
3382
|
+
enumValues: undefined;
|
|
3383
|
+
identity: undefined;
|
|
3384
|
+
generated: undefined;
|
|
3385
|
+
}>;
|
|
3386
|
+
revisionId: import("drizzle-orm/pg-core").PgBuildColumn<"revision_receipts", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgUUIDBuilder, `${string}-${string}-${string}-${string}-${string}`>>, {
|
|
3387
|
+
name: string;
|
|
3388
|
+
tableName: "revision_receipts";
|
|
3389
|
+
dataType: "string uuid";
|
|
3390
|
+
data: `${string}-${string}-${string}-${string}-${string}`;
|
|
3391
|
+
driverParam: string;
|
|
3392
|
+
notNull: true;
|
|
3393
|
+
hasDefault: false;
|
|
3394
|
+
isPrimaryKey: false;
|
|
3395
|
+
isAutoincrement: false;
|
|
3396
|
+
hasRuntimeDefault: false;
|
|
3397
|
+
enumValues: undefined;
|
|
3398
|
+
identity: undefined;
|
|
3399
|
+
generated: undefined;
|
|
3400
|
+
}>;
|
|
3401
|
+
role: import("drizzle-orm/pg-core").PgBuildColumn<"revision_receipts", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgEnumColumnBuilder<["activity", "object"]>>, {
|
|
3402
|
+
name: string;
|
|
3403
|
+
tableName: "revision_receipts";
|
|
3404
|
+
dataType: "string enum";
|
|
3405
|
+
data: "activity" | "object";
|
|
3406
|
+
driverParam: string;
|
|
3407
|
+
notNull: true;
|
|
3408
|
+
hasDefault: false;
|
|
3409
|
+
isPrimaryKey: false;
|
|
3410
|
+
isAutoincrement: false;
|
|
3411
|
+
hasRuntimeDefault: false;
|
|
3412
|
+
enumValues: ["activity", "object"];
|
|
3413
|
+
identity: undefined;
|
|
3414
|
+
generated: undefined;
|
|
3415
|
+
}>;
|
|
3416
|
+
};
|
|
3417
|
+
dialect: 'pg';
|
|
3418
|
+
}>;
|
|
3419
|
+
type ResourceRevision = typeof resourceRevisions.$inferSelect;
|
|
3420
|
+
type NewResourceRevision = typeof resourceRevisions.$inferInsert;
|
|
3421
|
+
type ResourceHead = typeof resourceHeads.$inferSelect;
|
|
3422
|
+
type RevisionAddressing = typeof revisionAddressing.$inferSelect;
|
|
3423
|
+
type RevisionRelation = typeof revisionRelations.$inferSelect;
|
|
3424
|
+
type RevisionReceipt = typeof revisionReceipts.$inferSelect;
|
|
2976
3425
|
//#endregion
|
|
2977
3426
|
//#region src/relations.d.ts
|
|
2978
3427
|
declare const relations: import("drizzle-orm").ExtractTablesWithRelations<{
|
|
3428
|
+
resourceRevisions: {
|
|
3429
|
+
resource: import("drizzle-orm").One<"resources", false>;
|
|
3430
|
+
addressing: import("drizzle-orm").Many<"revisionAddressing">;
|
|
3431
|
+
relations: import("drizzle-orm").Many<"revisionRelations">;
|
|
3432
|
+
receipts: import("drizzle-orm").Many<"revisionReceipts">;
|
|
3433
|
+
};
|
|
3434
|
+
resourceHeads: {
|
|
3435
|
+
resource: import("drizzle-orm").One<"resources", false>;
|
|
3436
|
+
revision: import("drizzle-orm").One<"resourceRevisions", false>;
|
|
3437
|
+
};
|
|
3438
|
+
revisionAddressing: {
|
|
3439
|
+
revision: import("drizzle-orm").One<"resourceRevisions", false>;
|
|
3440
|
+
};
|
|
3441
|
+
revisionRelations: {
|
|
3442
|
+
revision: import("drizzle-orm").One<"resourceRevisions", false>;
|
|
3443
|
+
};
|
|
3444
|
+
revisionReceipts: {
|
|
3445
|
+
revision: import("drizzle-orm").One<"resourceRevisions", false>;
|
|
3446
|
+
delivery: import("drizzle-orm").One<"activityDeliveries", false>;
|
|
3447
|
+
};
|
|
2979
3448
|
keys: {
|
|
2980
3449
|
versions: import("drizzle-orm").Many<"keyVersions">;
|
|
2981
3450
|
};
|
|
@@ -2984,6 +3453,7 @@ declare const relations: import("drizzle-orm").ExtractTablesWithRelations<{
|
|
|
2984
3453
|
activityDeliveries: import("drizzle-orm").Many<"activityDeliveries">;
|
|
2985
3454
|
};
|
|
2986
3455
|
activityDeliveries: {
|
|
3456
|
+
revisionReceipts: import("drizzle-orm").Many<"revisionReceipts">;
|
|
2987
3457
|
instance: import("drizzle-orm").One<"instances", false>;
|
|
2988
3458
|
actor: import("drizzle-orm").One<"actors", true>;
|
|
2989
3459
|
actorLinks: import("drizzle-orm").Many<"activityDeliveryActors">;
|
|
@@ -3029,6 +3499,8 @@ declare const relations: import("drizzle-orm").ExtractTablesWithRelations<{
|
|
|
3029
3499
|
account: import("drizzle-orm").One<"accounts", false>;
|
|
3030
3500
|
};
|
|
3031
3501
|
resources: {
|
|
3502
|
+
revisions: import("drizzle-orm").Many<"resourceRevisions">;
|
|
3503
|
+
head: import("drizzle-orm").One<"resourceHeads", true>;
|
|
3032
3504
|
actor: import("drizzle-orm").One<"actors", true>;
|
|
3033
3505
|
object: import("drizzle-orm").One<"objects", true>;
|
|
3034
3506
|
activity: import("drizzle-orm").One<"activities", true>;
|
|
@@ -3094,5 +3566,5 @@ type Transaction = PgAsyncTransaction<PgQueryResultHKT, typeof schema_d_exports,
|
|
|
3094
3566
|
*/
|
|
3095
3567
|
type RelationsFilter$1<T extends keyof typeof relations> = RelationsFilter<(typeof relations)[T], typeof relations>;
|
|
3096
3568
|
//#endregion
|
|
3097
|
-
export {
|
|
3098
|
-
//# sourceMappingURL=db-
|
|
3569
|
+
export { accounts as $, LoginChallenge as A, resourceHeads as At, NewLocalInstance as B, revisionRelationRepresentationEnum as Bt, Key as C, localActorKeyTypeEnum as Ct, LocalActorKey as D, loginChallenges as Dt, LocalActor as E, localInstances as Et, NewActor as F, resourceRevisions as Ft, Resource as G, jwkThumbprint as Gt, NewResourceRevision as H, schema_d_exports as Ht, NewInstance as I, resources as It, RevisionAddressing as J, toPublicJwk as Jt, ResourceHead as K, observeKeyVersion as Kt, NewInstanceMember as L, revisionAddressing as Lt, NewActivityDelivery as M, resourceRevisionCaptureEnum as Mt, NewActivityDeliveryActor as N, resourceRevisionKindEnum as Nt, LocalActorKeyType as O, objectTypeEnum as Ot, NewActivityPubObject as P, resourceRevisionProjectionEnum as Pt, StoredActivity as Q, NewLocalActor as R, revisionReceiptRoleEnum as Rt, InstanceMember as S, keys as St, LOGIN_CHALLENGE_CODE_LENGTH as T, localActors as Tt, NewSession as U, sessions as Ut, NewLoginChallenge as V, revisionRelations as Vt, ObjectType as W, PublicJwk as Wt, RevisionRelation as X, RevisionReceipt as Y, Session as Z, Addressing as _, collectionTypeEnum as _t, Account as a, activityDeliveryDirectionEnum as at, CollectionRole as b, instances as bt, ActivityDeliveryActorCollection as c, activityDeliveryVerificationResultEnum as ct, ActivityDeliveryStatus as d, actorTypeEnum as dt, activities as et, ActivityDeliveryVerificationMechanism as f, actors as ft, ActorType as g, collectionRoleEnum as gt, Actor as h, collectionItems as ht, relations as i, activityDeliveryAttempts as it, NewAccount as j, resourceKindEnum as jt, LocalInstance as k, objects as kt, ActivityDeliveryAttempt as l, activityTypeEnum as lt, ActivityPubObject as m, addressingPropertyEnum as mt, RelationsFilter$1 as n, activityDeliveryActorCollections as nt, ActivityDelivery as o, activityDeliveryStatusEnum as ot, ActivityDeliveryVerificationResult as p, addressing as pt, ResourceRevision as q, thumbprintInput as qt, Transaction as r, activityDeliveryActors as rt, ActivityDeliveryActor as s, activityDeliveryVerificationMechanismEnum as st, Database as t, activityDeliveries as tt, ActivityDeliveryDirection as u, actorCollectionReferences as ut, AddressingProperty as v, collections as vt, KeyVersion as w, localActorKeys as wt, Instance as x, keyVersions as xt, Collection as y, instanceMembers as yt, NewLocalActorKey as z, revisionReceipts as zt };
|
|
3570
|
+
//# sourceMappingURL=db-BBw4F4HU.d.mts.map
|