Give records business meaning.
Define suppliers, cases, agreements, and the typed properties that describe them. Give each object a stable identity that applications and operations can refer to.
Define objects, properties, and relationships that give your applications a consistent business vocabulary.
Explore the case, agreement, and evidence behind a supplier’s current state.
Define suppliers, cases, agreements, and the typed properties that describe them. Give each object a stable identity that applications and operations can refer to.
Connect a supplier to its onboarding cases and a signature request to the exact agreement it concerns. Move between related records while keeping their meaning intact.
Surface the Functions that answer questions about an object and the Actions that can change it. An operator can inspect a case and act from the same business context.
Externally sourced records remain projections of their source. Platform-owned objects are created and changed through declared Actions, with their changes recorded.
An exact excerpt from the repository, with the complete source file available to inspect and download.
func define(module.Context, module.Value) (product.Document, error) { supplier := must(algebra.NewObjectDefinition(algebra.ObjectOptions{Name: "Supplier", Description: "A supplier and the exact evidence revision considered for activation.", PlatformBacked: true, Key: []string{"supplier_id"}, Properties: []algebra.ObjectProperty{ property("supplier_id", av.TypeString, false, false), property("name", av.TypeString, false, false), property("is_active", av.TypeBoolean, false, true), property("evidence_revision", av.TypeInteger, false, true), property("evidence_complete", av.TypeBoolean, false, true), property("is_high_risk", av.TypeBoolean, false, true), property("risk_revision", av.TypeInteger, false, true), }, Display: algebra.ObjectDisplay{Primary: "name", Secondary: "supplier_id"}})) caseObject := must(algebra.NewObjectDefinition(algebra.ObjectOptions{Name: "OnboardingCase", Description: "Business record for onboarding, independent from any Workflow run.", PlatformBacked: true, Key: []string{"case_id"}, Properties: []algebra.ObjectProperty{ property("case_id", av.TypeString, false, false), property("supplier_id", av.TypeString, false, false), property("status", av.TypeString, false, true, "requested", "needs_evidence", "awaiting_approval", "approved", "awaiting_signature", "signature_expired", "signature_cancelled", "complete"), property("evidence_revision", av.TypeInteger, false, true), property("approved_revision", av.TypeInteger, true, true), property("findings", av.TypeString, false, true), }, Display: algebra.ObjectDisplay{Primary: "case_id", Secondary: "status"}})) assessmentSchema := must(av.NewSchema([]av.Column{column("supplier_id", av.TypeString, false), column("evidence_revision", av.TypeInteger, false), column("evidence_complete", av.TypeBoolean, false), column("findings", av.TypeString, false), column("route", av.TypeString, false)}, nil, nil)) assessmentBody := must(algebra.SQLRelation(algebra.SQLRelationOptions{Dialect: algebra.DialectPostgres, Text: `SELECT s.supplier_id, s.evidence_revision, s.evidence_complete, CASE WHEN s.evidence_complete THEN 'Evidence package is complete.' ELSE 'Required supplier evidence is incomplete.' END AS findings, CASE WHEN s.evidence_complete THEN 'awaiting_approval' ELSE 'needs_evidence' END AS route FROM "input.cases" c JOIN "input.suppliers" s ON s.supplier_id = c.supplier_id WHERE c.case_id = $1`, Inputs: []algebra.SQLInput{{Name: "cases", Relation: algebra.SourceRelation("OnboardingCase", "c")}, {Name: "suppliers", Relation: algebra.SourceRelation("Supplier", "s")}}, Arguments: []algebra.Expr{algebra.Param("case_id")}, Schema: assessmentSchema})) assessment := must(algebra.NewFunctionDefinition(algebra.FunctionOptions{Name: "assess_supplier", Parameters: []algebra.Parameter{must(algebra.NewParameterDefinition(algebra.ParameterOptions{Name: "case_id", Type: av.TypeString}))}, Cardinality: algebra.CardinalityOne, Body: assessmentBody, ResultKind: "onboarding.assessment", Doc: "Assess the current supplier evidence for an onboarding case."})) listSchema := must(av.NewSchema([]av.Column{column("case_id", av.TypeString, false), column("supplier_id", av.TypeString, false), column("status", av.TypeString, false), column("evidence_revision", av.TypeInteger, false), column("findings", av.TypeString, false)}, []av.Order{must(av.NewOrder("case_id", av.Ascending, av.NullsLast))}, nil)) listBody := must(algebra.SQLRelation(algebra.SQLRelationOptions{Dialect: algebra.DialectPostgres, Text: `SELECT case_id, supplier_id, status, evidence_revision, findings FROM "input.cases" ORDER BY case_id`, Inputs: []algebra.SQLInput{{Name: "cases", Relation: algebra.SourceRelation("OnboardingCase", "c")}}, Schema: listSchema})) list := must(algebra.NewFunctionDefinition(algebra.FunctionOptions{Name: "onboarding_cases", Cardinality: algebra.CardinalityMany, Body: listBody, ResultKind: "onboarding.cases", Doc: "Current onboarding cases."})) functions := append(append([]algebra.FunctionDefinition{assessment, list, supplierRiskFunction()}, importerFunctions()...), signatureFunctions()...) definition := algebra.NewDefinition(nil, []algebra.ObjectDefinition{supplier, caseObject, riskCaseObject(), importedSupplierObject(), signatureRequestObject()}, signatureRelationships(), []algebra.PolicyDefinition{algebra.RowGuardPolicy("supplier_visible", "Supplier", algebra.True()), algebra.RowGuardPolicy("onboarding_case_visible", "OnboardingCase", algebra.True()), algebra.RowGuardPolicy("risk_case_visible", "SupplierRiskCase", algebra.True()), algebra.RowGuardPolicy("imported_supplier_visible", "ImportedSupplier", algebra.True()), algebra.RowGuardPolicy("signature_request_visible", "SignatureRequest", algebra.True())}, functions, nil) algebraValue, err := product.Algebra(definition) if err != nil { return product.Document{}, errA relationship does not grant access to its destination. Reads and operations are evaluated under the caller’s current authority. External records and platform-owned objects have different write paths.
Read the capability referenceA business process, the systems it touches, and the rules it needs to follow.