ModuleNamespace modules.namespace@1

Generated at from openvibe-contracts v0.33.0 and openvibe-sdk v0.5.0.

Version
1.0.0
Owner
network
Visibility
public
Status
active
Compatibility
backward
Decision
ADR-001
Schema
https://openvibe.network/contracts/modules/namespace.v1.json

Policy for one user-module namespace: portable per-subject summaries and preferences stored by OpenVibe.Network. Never domain truth, money or authoritative game inventory (roadmap 4.3-4.5). The person's account decides what happens to their records in every namespace: when an account is removed, Network deletes all of its records; when two accounts are merged, the surviving account keeps its own record in a namespace where both have one (the other is deleted), and a record only the absorbed account had moves to the survivor. Each of these changes is announced as network.module.updated (reason subject_removed or subject_merged). That is separate from onOwnerRemoved, which says what happens to a namespace's records when the service that owns the namespace is retired.

Fields

FieldTypeRequiredDescriptionConstraints
namespacestringyes
  • pattern ^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$
ownerstringyesService that owns the namespace and may write it with network.modules.write.
  • pattern ^[a-z][a-z0-9-]{1,39}$
versionintegeryesSchema version stored with every record; a change needs a migration note.
  • minimum 1
descriptionstring
schemaobjectyesJSON Schema (2020-12) every stored value must satisfy.
writersarray of enumyesowner = the owning service with a token; user = the subject themselves.
  • minItems 1
  • items: one of "owner", "user"
publicFieldsarray of stringyesTop-level fields anyone may read. Everything else is readable only by the subject and granted services.
quotaBytesintegeryes
  • minimum 64
  • maximum 65536
onOwnerRemovedenumyesWhat happens to records when the owning service or mod is retired.
  • one of "retain-readonly", "delete-after-retention"
retentionDaysinteger
  • minimum 0
migrationstringHow records of the previous version are upgraded.

Examples

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

Valid: live-profile
{
  "namespace": "live.profile",
  "owner": "live",
  "version": 1,
  "description": "Live channel summary shown on other sites. Written by Live only.",
  "writers": [
    "owner"
  ],
  "publicFields": [
    "channel_url",
    "followers",
    "is_streamer",
    "last_live_at"
  ],
  "quotaBytes": 4096,
  "onOwnerRemoved": "retain-readonly",
  "schema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "channel_url": {
        "type": "string",
        "format": "uri"
      },
      "followers": {
        "type": "integer",
        "minimum": 0
      },
      "is_streamer": {
        "type": "boolean"
      },
      "last_live_at": {
        "type": [
          "string",
          "null"
        ]
      },
      "stream_minutes_30d": {
        "type": "integer",
        "minimum": 0
      }
    }
  }
}
Rejected: huge-quota
{
  "namespace": "x.y",
  "owner": "live",
  "version": 1,
  "schema": {},
  "writers": [
    "user"
  ],
  "publicFields": [],
  "quotaBytes": 10000000,
  "onOwnerRemoved": "retain-readonly"
}
Rejected: no-writers
{
  "namespace": "x.y",
  "owner": "live",
  "version": 1,
  "schema": {},
  "writers": [],
  "publicFields": [],
  "quotaBytes": 100,
  "onOwnerRemoved": "retain-readonly"
}

Validate

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