Makes the blog-generated product run on the digital-core domain built from
semprini-data-domain, with the same changes the canonical template received:
- flink/job.sql connects to ods:5432/ods as postgres with ${ODS_PASSWORD},
substituted by data-domain at submission, instead of the blog's credentials
- lakehouse/010_replication.sql uses the platform's `ods` sync group and grants
the lake tables to ducklake_reader and ducklake_writer
- product.yaml sync group, odps.yaml access URLs (domain ports 20000-20003,
management zone Apicurio on 8081), CLI names in comments
Adds tests/: the canonical template's generic unit tests and this product's
expectations.yaml (seed rows, 24 constraint rejections, 5 relationship
traversals, one inbound-to-tombstone round trip).
Verified on digital-core on 2026-09-18: 65 of 65 smoke checks, 100 unit tests
passing, and registered in OpenMetadata under the digital-core domain.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
166 lines
8.1 KiB
GraphQL
166 lines
8.1 KiB
GraphQL
# Canonical Party: GraphQL surface reflected by pg_graphql from the canonical_party ODS tables.
|
|
#
|
|
# This file documents the contract consumers can rely on. It is not loaded anywhere; the live
|
|
# schema is reflected from the tables and available by introspection:
|
|
# curl http://localhost:20000/rpc/canonical_party_graphql -H 'Content-Type: application/json' \
|
|
# --data '{"query":"{ __type(name: \"Party\") { fields { name } } }"}'
|
|
#
|
|
# Naming (inflect_names: true): table party_role -> type PartyRole; column role_status -> roleStatus.
|
|
# Scalars: uuid -> UUID, text -> String, boolean -> Boolean, date -> Date, timestamptz -> Datetime.
|
|
# A relationship field backed by a NOT NULL foreign key is non-null (Party!).
|
|
#
|
|
# Relationship fields are derived from the foreign keys. Two cases need the @graphql directives
|
|
# set in ods/020_tables.sql: the subtype primary-key-as-foreign-key (Person, Company, Customer),
|
|
# which otherwise reflects as Person.person / Party.person, and the two foreign keys from
|
|
# party_association to party, which otherwise produce two identical partyAssociationCollection
|
|
# fields on Party. The names below are what the directives produce.
|
|
|
|
type Party implements Node {
|
|
nodeId: ID!
|
|
partyId: UUID!
|
|
partyType: String! # discriminator: 'Person' | 'Company'
|
|
legalName: String!
|
|
alsoKnownAs: String # semicolon-separated; see canonical_data_product/README.md type mapping
|
|
partyStatus: String # enum:Party Status, enforced by CHECK in the ODS
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
person: Person # subtype row, when partyType = 'Person'
|
|
company: Company # subtype row, when partyType = 'Company'
|
|
partyRoleCollection(first: Int, after: Cursor, filter: PartyRoleFilter, orderBy: [PartyRoleOrderBy!]): PartyRoleConnection
|
|
contactAddressCollection(first: Int, after: Cursor, filter: ContactAddressFilter, orderBy: [ContactAddressOrderBy!]): ContactAddressConnection
|
|
outgoingAssociationCollection(first: Int, after: Cursor, filter: PartyAssociationFilter, orderBy: [PartyAssociationOrderBy!]): PartyAssociationConnection # this party is source_party_id
|
|
incomingAssociationCollection(first: Int, after: Cursor, filter: PartyAssociationFilter, orderBy: [PartyAssociationOrderBy!]): PartyAssociationConnection # this party is target_party_id
|
|
}
|
|
|
|
type Address implements Node {
|
|
nodeId: ID!
|
|
addressId: UUID!
|
|
addressType: String # enum:Address Type
|
|
addressLine1: String
|
|
addressLine2: String
|
|
suburb: String
|
|
city: String
|
|
stateOrRegion: String
|
|
postcode: String
|
|
country: String!
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
contactAddressCollection(first: Int, after: Cursor, filter: ContactAddressFilter, orderBy: [ContactAddressOrderBy!]): ContactAddressConnection
|
|
}
|
|
|
|
type Person implements Node {
|
|
nodeId: ID!
|
|
personId: UUID! # equals the extended party's partyId
|
|
dateOfBirth: Date
|
|
preferredName: String
|
|
countryOfResidence: String
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
party: Party! # from person_id (extends Party)
|
|
}
|
|
|
|
type Company implements Node {
|
|
nodeId: ID!
|
|
companyId: UUID! # equals the extended party's partyId
|
|
companyRegistrationNumber: String
|
|
incorporationCountry: String
|
|
incorporationDate: Date
|
|
legalStructure: String # enum:Company Legal Structure
|
|
taxIdentifier: String
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
party: Party! # from company_id (extends Party)
|
|
}
|
|
|
|
type PartyRole implements Node {
|
|
nodeId: ID!
|
|
partyRoleId: UUID!
|
|
partyRoleType: String! # discriminator: 'Customer'
|
|
roleStatus: String # enum:Party Role Status
|
|
roleStartDate: Date
|
|
roleEndDate: Date
|
|
partyId: UUID!
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
party: Party! # from party_id (Party Assumes Roles)
|
|
customer: Customer # subtype row, when partyRoleType = 'Customer'
|
|
partyRoleContactAddressCollection(first: Int, after: Cursor, filter: PartyRoleContactAddressFilter, orderBy: [PartyRoleContactAddressOrderBy!]): PartyRoleContactAddressConnection
|
|
}
|
|
|
|
type Customer implements Node {
|
|
nodeId: ID!
|
|
customerId: UUID! # equals the extended role's partyRoleId
|
|
customerNumber: String! # unique business key
|
|
onboardingDate: Date
|
|
relationshipStartDate: Date
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
partyRole: PartyRole! # from customer_id (extends Party Role)
|
|
}
|
|
|
|
type ContactAddress implements Node {
|
|
nodeId: ID!
|
|
contactAddressId: UUID!
|
|
addressPurpose: String # enum:Address Purpose
|
|
isPrimary: Boolean
|
|
verificationStatus: String # enum:Address Verification Status
|
|
verificationDate: Date
|
|
verificationMethod: String # enum:Verification Method
|
|
validFrom: Date
|
|
validTo: Date
|
|
partyId: UUID!
|
|
addressId: UUID!
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
party: Party! # from party_id (Party Has Contact Addresses)
|
|
address: Address! # from address_id (Contact Address References Address)
|
|
partyRoleContactAddressCollection(first: Int, after: Cursor, filter: PartyRoleContactAddressFilter, orderBy: [PartyRoleContactAddressOrderBy!]): PartyRoleContactAddressConnection
|
|
}
|
|
|
|
type PartyRoleContactAddress implements Node {
|
|
nodeId: ID!
|
|
partyRoleContactAddressId: UUID!
|
|
partyRoleId: UUID!
|
|
contactAddressId: UUID!
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
partyRole: PartyRole! # from party_role_id
|
|
contactAddress: ContactAddress! # from contact_address_id
|
|
}
|
|
|
|
type PartyAssociation implements Node {
|
|
nodeId: ID!
|
|
partyAssociationId: UUID!
|
|
sourcePartyId: UUID!
|
|
targetPartyId: UUID!
|
|
associationType: String # enum:Association Type
|
|
associationStartDate: Date
|
|
associationEndDate: Date
|
|
verified: Boolean
|
|
createdAt: Datetime!
|
|
updatedAt: Datetime!
|
|
sourceParty: Party! # from source_party_id
|
|
targetParty: Party! # from target_party_id
|
|
}
|
|
|
|
extend type Query {
|
|
partyCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: PartyFilter, orderBy: [PartyOrderBy!]): PartyConnection
|
|
addressCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: AddressFilter, orderBy: [AddressOrderBy!]): AddressConnection
|
|
personCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: PersonFilter, orderBy: [PersonOrderBy!]): PersonConnection
|
|
companyCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: CompanyFilter, orderBy: [CompanyOrderBy!]): CompanyConnection
|
|
partyRoleCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: PartyRoleFilter, orderBy: [PartyRoleOrderBy!]): PartyRoleConnection
|
|
customerCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: CustomerFilter, orderBy: [CustomerOrderBy!]): CustomerConnection
|
|
contactAddressCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: ContactAddressFilter, orderBy: [ContactAddressOrderBy!]): ContactAddressConnection
|
|
partyRoleContactAddressCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: PartyRoleContactAddressFilter, orderBy: [PartyRoleContactAddressOrderBy!]): PartyRoleContactAddressConnection
|
|
partyAssociationCollection(first: Int, last: Int, before: Cursor, after: Cursor, filter: PartyAssociationFilter, orderBy: [PartyAssociationOrderBy!]): PartyAssociationConnection
|
|
}
|
|
|
|
# Every type has the same three mutations; shown once for Party.
|
|
extend type Mutation {
|
|
insertIntoPartyCollection(objects: [PartyInsertInput!]!): PartyInsertResponse
|
|
updatePartyCollection(set: PartyUpdateInput!, filter: PartyFilter, atMost: Int! = 1): PartyUpdateResponse
|
|
deleteFromPartyCollection(filter: PartyFilter, atMost: Int! = 1): PartyDeleteResponse
|
|
# ... insertIntoAddressCollection, updateAddressCollection, deleteFromAddressCollection, and so on
|
|
# for Person, Company, PartyRole, Customer, ContactAddress, PartyRoleContactAddress, PartyAssociation.
|
|
}
|