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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
namespace | string | yes |
| |
owner | string | yes | Service that owns the namespace and may write it with network.modules.write. |
|
version | integer | yes | Schema version stored with every record; a change needs a migration note. |
|
description | string | |||
schema | object | yes | JSON Schema (2020-12) every stored value must satisfy. | |
writers | array of enum | yes | owner = the owning service with a token; user = the subject themselves. |
|
publicFields | array of string | yes | Top-level fields anyone may read. Everything else is readable only by the subject and granted services. | |
quotaBytes | integer | yes |
| |
onOwnerRemoved | enum | yes | What happens to records when the owning service or mod is retired. |
|
retentionDays | integer |
| ||
migration | string | How 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 }] }