IF Commons GitHub

stageContract

concept

What a stage guarantees to the stage after it, the outcome codes it may give and how its failure is detected: the stage-contract table of a pipeline

Model flow. Written in commons/data/models/flow/mod.ts:102. Identified by stageContractId.

Governance: attributes

detectiontextrequired

How a failure of it is found

Becomes the column detection of stage_contract.

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

graincode of grainrequired

What a ledger row of it stands for

Becomes the column grain of stage_contract.

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

inputGuaranteetextrequired

What it may assume of what it is given

Becomes the column input_guarantee of stage_contract.

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

outputGuaranteetextrequired

What it guarantees of what it gives

Becomes the column output_guarantee of stage_contract.

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

ownertextrequired

Who answers for it

Becomes the column owner of stage_contract.

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

pipelinetextrequired

The pipeline it is of

Becomes the column pipeline of stage_contract.

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

stagecode of stagerequired

The stage

Becomes the column stage of stage_contract.

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

stageContractIdidentifierrequired

What identifies the contract: its pipeline and stage

Becomes the column stage_contract_id of stage_contract.

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

Logical: the table

Projects to the table stage_contract with the primary key stage_contract_id.

ColumnTypeNullRoleFrom
detectiontextfalseattributestageContract.detection
graintextfalseattributestageContract.grain
input_guaranteetextfalseattributestageContract.inputGuarantee
output_guaranteetextfalseattributestageContract.outputGuarantee
ownertextfalseattributestageContract.owner
pipelinetextfalseattributestageContract.pipeline
stagetextfalseattributestageContract.stage
stage_contract_idtextfalseattributestageContract.stageContractId

Physical: SQL

CREATE TABLE IF NOT EXISTS "stage_contract" (
    "stage_contract_id" VARCHAR NOT NULL PRIMARY KEY,
    "pipeline" VARCHAR NOT NULL,
    "stage" VARCHAR NOT NULL,
    "input_guarantee" VARCHAR NOT NULL,
    "output_guarantee" VARCHAR NOT NULL,
    "owner" VARCHAR NOT NULL,
    "detection" VARCHAR NOT NULL,
    "grain" VARCHAR NOT NULL,
    CONSTRAINT "stage_contract_pipeline_stage_uq" UNIQUE ("pipeline", "stage"),
    CONSTRAINT "stage_contract_stage_ck" CHECK ("stage" IN ('received', 'captured', 'parsed', 'mapped', 'validated', 'forwarded', 'dest_verdict', 'usable')),
    CONSTRAINT "stage_contract_grain_ck" CHECK ("grain" IN ('message', 'batch', 'entity'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { stageContract } 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 { stageContract } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(stageContract).select((s) => ({ stageContractId: s.stageContract.stageContractId, pipeline: s.stageContract.pipeline })).run(runner);

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