IF Commons GitHub

delivery

concept

A message as it first arrived, with the hash of its content and how many times it has been delivered: the intake that makes a redelivery safe

Model flow. Written in commons/data/models/flow/mod.ts:137. Identified by deliveryId.

Governance: attributes

contentSha256textrequired

The SHA-256 of its content, as first delivered

Becomes the column content_sha_256 of delivery.

Written at commons/data/models/flow/mod.ts:143

deliveryCountintegerrequired

How many times the same content has been delivered

Becomes the column delivery_count of delivery.

Written at commons/data/models/flow/mod.ts:144

deliveryIdidentifierrequired

What identifies the message: its tenant and the id its sender gave it

Becomes the column delivery_id of delivery.

Written at commons/data/models/flow/mod.ts:140

firstSeeninstantrequired

When it was first seen

Becomes the column first_seen of delivery.

Written at commons/data/models/flow/mod.ts:145

senderMessageIdtextrequired

The id the sender gave it

Becomes the column sender_message_id of delivery.

Written at commons/data/models/flow/mod.ts:142

tenanttextrequired

The tenant

Becomes the column tenant of delivery.

Written at commons/data/models/flow/mod.ts:141

Governance: relationships

firstLoadone

The load of its first delivery To load. Written at commons/data/models/flow/mod.ts:137

Logical: the table

Projects to the table delivery with the primary key delivery_id.

ColumnTypeNullRoleFrom
content_sha_256textfalseattributedelivery.contentSha256
delivery_countintegerfalseattributedelivery.deliveryCount
delivery_idtextfalseattributedelivery.deliveryId
first_load_load_idtextfalsereferencedelivery.firstLoad
first_seentimestampfalseattributedelivery.firstSeen
sender_message_idtextfalseattributedelivery.senderMessageId
tenanttextfalseattributedelivery.tenant

Physical: SQL

CREATE TABLE IF NOT EXISTS "delivery" (
    "delivery_id" VARCHAR NOT NULL PRIMARY KEY,
    "tenant" VARCHAR NOT NULL,
    "sender_message_id" VARCHAR NOT NULL,
    "content_sha_256" VARCHAR NOT NULL,
    "delivery_count" INTEGER NOT NULL,
    "first_seen" TIMESTAMPTZ NOT NULL,
    "first_load_load_id" VARCHAR NOT NULL,
    CONSTRAINT "delivery_first_load_load_id_fk" FOREIGN KEY ("first_load_load_id") REFERENCES "load" ("load_id"),
    CONSTRAINT "delivery_tenant_sender_message_id_uq" UNIQUE ("tenant", "sender_message_id")
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { delivery } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/flow.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { delivery } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(delivery).select((s) => ({ deliveryId: s.delivery.deliveryId, tenant: s.delivery.tenant })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.