CouponsIndexDocumentUpsertedPayload coupons.index_document.upserted@1
Generated at from
openvibe-contracts v0.34.2 and
openvibe-sdk v0.5.0.
- Version
- 1.0.0
- Owner
- coupons
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/events/payloads/coupons.index_document.upserted.v1.json
coupons.index_document.upserted v1 (OpenVibe.Coupons server/domain/publication.js sendDocument, via openvibe-publishing/index-hooks indexEvent). The OpenVibe.Search document of a code in active results (type coupon: published, merchant active, not expired or disabled; title '<code> — <title> (<merchant>)', status and expiry in the summary, description and restrictions in the body, facets merchant, status and expiry_known, Sources items in provenance) or of an active merchant (type merchant: facets active_codes; indexability noindex thin_content while it has no active code). Sent in the transaction of every change to what Search should hold (coupons.js syncIndex and syncMerchant); the revision (coupons_index_revisions) grows only when the document changed, and an unchanged document is not sent again. Visibility is always public. Consumed by OpenVibe.Search ('*.index_document.*'). Envelope: subject { type: coupon | merchant, id, revision: <document revision> }, visibility internal, priority important, actor service:coupons.
Fields
This schema has no named fields.
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: coupon
{
"owner": "coupons",
"type": "coupon",
"id": "cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"revision": 2,
"deleted": false,
"visibility": "public",
"canonical_url": "https://openvibe.coupons/c/cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"title": "TRAIL15 — 15% off tents (Acme Outdoor)",
"summary": "reported working; expiry 2026-10-31",
"body": "Applies to full-price tents only.\nMinimum spend $50.00\nRegion: US",
"facets": {
"merchant": "acme-outdoor",
"status": "reported_working",
"expiry_known": true
},
"language": "en",
"provenance": [
{
"service": "sources",
"type": "item",
"id": "itm_01K5R6S0T1V2W3X4Y5Z6A7B8C9",
"revision": 3,
"url": "https://acme-outdoor.com/promos",
"retrieved_at": "2026-09-21T08:00:00.000Z"
}
],
"publication_state": "published",
"published_at": "2026-09-21T08:05:00.000Z",
"updated_at": "2026-09-23T10:12:00.000Z",
"indexability": {
"decision": "index",
"reasons": []
}
}Valid: merchant-thin
{
"owner": "coupons",
"type": "merchant",
"id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
"revision": 4,
"deleted": false,
"visibility": "public",
"canonical_url": "https://openvibe.coupons/m/acme-outdoor",
"title": "Acme Outdoor coupon codes",
"summary": "0 active codes",
"body": "",
"facets": {
"active_codes": 0
},
"language": "en",
"provenance": [],
"publication_state": "published",
"published_at": "2026-09-20T12:00:00.000Z",
"updated_at": "2026-09-20T12:00:00.000Z",
"indexability": {
"decision": "noindex",
"reasons": [
"thin_content"
]
}
}Rejected: no-indexability
{
"owner": "coupons",
"type": "coupon",
"id": "cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"revision": 2,
"deleted": false,
"visibility": "public",
"canonical_url": "https://openvibe.coupons/c/cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"title": "TRAIL15 — 15% off tents (Acme Outdoor)",
"summary": "validity unknown; expiry unknown",
"body": "",
"facets": {
"merchant": "acme-outdoor",
"status": "unknown",
"expiry_known": false
},
"language": "en",
"provenance": [],
"publication_state": "published",
"published_at": "2026-09-21T08:05:00.000Z",
"updated_at": "2026-09-21T08:05:00.000Z"
}Rejected: other-owner
{
"owner": "deals",
"type": "coupon",
"id": "cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"revision": 2,
"deleted": false,
"visibility": "public",
"canonical_url": "https://openvibe.coupons/c/cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"title": "TRAIL15 — 15% off tents (Acme Outdoor)",
"summary": "validity unknown; expiry unknown",
"body": "",
"facets": {
"merchant": "acme-outdoor",
"status": "unknown",
"expiry_known": false
},
"language": "en",
"provenance": [],
"publication_state": "published",
"published_at": "2026-09-21T08:05:00.000Z",
"updated_at": "2026-09-21T08:05:00.000Z",
"indexability": {
"decision": "index",
"reasons": []
}
}Rejected: tombstone
{
"owner": "coupons",
"type": "coupon",
"id": "cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"revision": 3,
"deleted": true
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('coupons.index_document.upserted@1', value); // { valid, errors: [{ path, message }] }