Examples / record-shop

record-shop.json

targets v0.38.0 17 entities 19 schemas

A branded sweater, a red-M variant (parent), warehouse stock, an offer whose item is the variant, and a two-unit order line. The bill is an invoice the pending payment points at. The box is in transit from the shed to the porch. A porch note hangs on the order. The buyer carries taxId. GTIN is digits only. Not a cart engine - docs/records.md.

Speaks

rig.calendar.event · rig.calendar.span · rig.commerce.invoice · rig.commerce.invoice_line · rig.commerce.offer · rig.commerce.order · rig.commerce.order_line · rig.commerce.price · rig.commerce.product · rig.commerce.shipment · rig.commerce.shipment_line · rig.commerce.stock · rig.finance.payment · rig.meta.named · rig.organisation.identity · rig.person.identifier · rig.person.name · rig.place.address · rig.record.note

Document

Validates under npm run check — raw file · open in RigPlayer — drop it in, press play, remix it, share the link.

{
  "rig": "0.38.0",
  "document": {
    "title": "Record shop (product / stock / order / invoice)",
    "createdAt": "2026-10-20",
    "timeZone": "America/Los_Angeles"
  },
  "entities": [
    {
      "id": "mill",
      "components": {
        "rig.meta.named": {
          "name": "Mill Goods",
          "stableId": "mill-goods"
        },
        "rig.organisation.identity": {
          "registrationNumber": "US-MILL"
        }
      }
    },
    {
      "id": "buyer",
      "components": {
        "rig.meta.named": {
          "name": "Sam Ortiz",
          "stableId": "sam-ortiz"
        },
        "rig.person.name": {
          "givenName": "Sam",
          "familyName": "Ortiz"
        },
        "rig.person.identifier": {
          "taxId": "123-45-6789"
        }
      }
    },
    {
      "id": "porch",
      "components": {
        "rig.meta.named": {
          "name": "Sam porch",
          "stableId": "sam-porch"
        },
        "rig.place.address": {
          "streetName": "Adeline Street",
          "buildingNumber": "210",
          "townName": "Oakland",
          "postCode": "94607",
          "country": "US"
        }
      }
    },
    {
      "id": "westbound",
      "components": {
        "rig.meta.named": {
          "name": "Westbound Parcel",
          "stableId": "westbound"
        },
        "rig.organisation.identity": {
          "registrationNumber": "US-WESTBOUND"
        }
      }
    },
    {
      "id": "warehouse",
      "components": {
        "rig.meta.named": {
          "name": "Oakland shed",
          "stableId": "oakland-shed"
        },
        "rig.place.address": {
          "streetName": "Mandela Parkway",
          "buildingNumber": "1400",
          "townName": "Oakland",
          "postCode": "94607",
          "country": "US"
        }
      }
    },
    {
      "id": "sweater",
      "components": {
        "rig.meta.named": {
          "name": "Crew sweater",
          "stableId": "sweater"
        },
        "rig.commerce.product": {
          "gtin": "012345678905",
          "brand": "mill"
        }
      }
    },
    {
      "id": "sweater-red",
      "components": {
        "rig.meta.named": {
          "name": "Crew sweater red M",
          "stableId": "sweater-red-m"
        },
        "rig.commerce.product": {
          "gtin": "0123456789123",
          "brand": "mill",
          "parent": "sweater"
        }
      }
    },
    {
      "id": "on-hand",
      "components": {
        "rig.commerce.stock": {
          "product": "sweater-red",
          "place": "warehouse",
          "quantity": 42,
          "unit": "each"
        }
      }
    },
    {
      "id": "autumn-offer",
      "components": {
        "rig.meta.named": {
          "name": "Autumn crew",
          "stableId": "autumn-crew"
        },
        "rig.commerce.offer": {
          "item": "sweater-red",
          "seller": "mill",
          "availability": "in-stock",
          "sku": "MG-CREW-RED-M"
        },
        "rig.commerce.price": {
          "amount": 68,
          "currency": "USD",
          "vatIncluded": true
        },
        "rig.calendar.span": {
          "startDate": "2026-09-01",
          "endDate": "2026-11-30"
        }
      }
    },
    {
      "id": "order-1",
      "components": {
        "rig.meta.named": {
          "name": "Order 8801",
          "stableId": "order-8801"
        },
        "rig.commerce.order": {
          "buyer": "buyer",
          "seller": "mill",
          "status": "placed",
          "identifier": "8801"
        }
      }
    },
    {
      "id": "line-1",
      "components": {
        "rig.commerce.order_line": {
          "order": "order-1",
          "product": "sweater-red",
          "quantity": 2,
          "offer": "autumn-offer"
        },
        "rig.commerce.price": {
          "amount": 136,
          "currency": "USD",
          "vatIncluded": true
        }
      }
    },
    {
      "id": "inv-8801",
      "components": {
        "rig.meta.named": {
          "name": "Invoice 8801",
          "stableId": "inv-8801"
        },
        "rig.commerce.invoice": {
          "buyer": "buyer",
          "seller": "mill",
          "status": "issued",
          "identifier": "INV-8801",
          "issuedDate": "2026-10-20",
          "dueDate": "2026-11-03",
          "order": "order-1"
        },
        "rig.commerce.price": {
          "amount": 136,
          "currency": "USD",
          "vatIncluded": true
        }
      }
    },
    {
      "id": "inv-line-1",
      "components": {
        "rig.commerce.invoice_line": {
          "invoice": "inv-8801",
          "product": "sweater-red",
          "quantity": 2,
          "orderLine": "line-1"
        },
        "rig.commerce.price": {
          "amount": 136,
          "currency": "USD",
          "vatIncluded": true
        }
      }
    },
    {
      "id": "pay-8801",
      "components": {
        "rig.finance.payment": {
          "debtor": "buyer",
          "creditor": "mill",
          "status": "pending",
          "invoice": "inv-8801"
        },
        "rig.commerce.price": {
          "amount": 136,
          "currency": "USD"
        }
      }
    },
    {
      "id": "box-1",
      "components": {
        "rig.meta.named": {
          "name": "Parcel 8801",
          "stableId": "box-1"
        },
        "rig.commerce.shipment": {
          "status": "in-transit",
          "order": "order-1",
          "carrier": "westbound",
          "tracking": "WB-8801-441",
          "origin": "warehouse",
          "destination": "porch",
          "shippedDate": "2026-10-21"
        }
      }
    },
    {
      "id": "box-line-1",
      "components": {
        "rig.commerce.shipment_line": {
          "shipment": "box-1",
          "product": "sweater-red",
          "quantity": 2,
          "orderLine": "line-1"
        }
      }
    },
    {
      "id": "pick-note",
      "components": {
        "rig.record.note": {
          "subject": "order-1",
          "body": "Leave at the porch if no one answers.",
          "author": "buyer"
        },
        "rig.calendar.event": {
          "startDate": "2026-10-20",
          "startMinutes": 600
        }
      }
    }
  ]
}