NetworkModGrantsChangedPayload network.mod.grants_changed@1

Generated at from openvibe-contracts v0.76.0 and openvibe-sdk v0.20.1.

Version
1.0.0
Owner
network
Visibility
first-party
Status
active
Compatibility
backward
Decision
ADR-013
Schema
https://openvibe.network/contracts/events/payloads/network.mod.grants_changed.v1.json

network.mod.grants_changed v1 (OpenVibe.Network; roadmap WS-M task 3, ADR-013): a mod principal's grants changed: registered, a capability approved or revoked, or the whole install revoked. `approved` is the complete approved set after the change, so the owning runtime sets its copy to it (idempotent by revision: an older revision changes nothing). `by` says whether the owning runtime or Network staff made the change; a runtime applies both.

Fields

FieldTypeRequiredDescriptionConstraints
mod_idstringyes
  • pattern ^mod_[0-9A-HJKMNP-TV-Z]{26}$
ownerstringyes
  • pattern ^[a-z][a-z0-9-]{1,31}$
statusenumyes
  • one of "active", "revoked"
approvedarray of stringyes
  • maxItems 64
  • unique items
  • items: pattern ^[a-z][a-z0-9_]*(\.[a-z0-9_]+){2,}$
pendingarray of string
  • maxItems 64
  • unique items
  • items: pattern ^[a-z][a-z0-9_]*(\.[a-z0-9_]+){2,}$
revisionintegeryes
  • minimum 1
changeobjectyes
  • no other fields
change.actionenumyes
  • one of "register", "approve", "revoke", "revoke_all"
change.capabilitystring
  • pattern ^[a-z][a-z0-9_]*(\.[a-z0-9_]+){2,}$
byenumyes
  • one of "runtime", "staff"
reasonstring
  • maxLength 500

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: staff-revoke
{
  "mod_id": "mod_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "owner": "games",
  "status": "active",
  "approved": [],
  "pending": [
    "games.prop.place"
  ],
  "revision": 3,
  "change": {
    "action": "revoke",
    "capability": "games.world.announce"
  },
  "by": "staff",
  "reason": "spawned items in a safe zone"
}
Rejected: unknown-action
{
  "mod_id": "mod_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "owner": "games",
  "status": "active",
  "approved": [],
  "revision": 3,
  "change": {
    "action": "delete"
  },
  "by": "staff"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('network.mod.grants_changed@1', value);   // { valid, errors: [{ path, message }] }