NetworkModuleUpdatedPayload network.module.updated@1
Generated at from
openvibe-contracts v0.33.0 and
openvibe-sdk v0.5.0.
- Version
- 1.0.0
- Owner
- network
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/events/payloads/network.module.updated.v1.json
network.module.updated v1 (OpenVibe.Network server/identity/module-events.js buildEnvelope, called from server/identity/modules.js). One event per change to one person's user-module record (modules.module-record@1): a write (created or updated), a delete by the person (delete) or by the owning service (owner_delete, also the retention sweep of a retired owner's delete-after-retention namespace), account removal (subject_removed: every record of the account is deleted) and account merge (subject_merged: the absorbed account's records are deleted, merged_into; a record moved to the surviving account is created there, merged_from; where the survivor already has one, the survivor's is kept and unchanged). Written into Network's event outbox in the transaction that makes the change. revision grows by one on every change to (owner, namespace), deletes included, and never restarts: a consumer keeps the highest revision it applied and ignores anything lower. Values of private fields never leave Network: keys names the changed fields, public carries only the new values of changed public fields. Envelope: subject { type: user_module, id: <owner id>:<namespace>, revision }, visibility internal, actor the person, the owning service or system:network.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
owner | one of | yes | The person the record belongs to (identity.subject-ref@1, a user or a guest). | |
namespace | string | yes | e.g. chat.preferences (modules.namespace@1). |
|
namespace_owner | string | yes | The service that owns the namespace when the change was made. |
|
schema_version | integer | yes | The namespace version the record was written under. |
|
revision | integer | yes | The record's revision after this change (the envelope subject revision). |
|
change | enum | yes |
| |
reason | enum | yes |
| |
keys | array of string | yes | Top-level fields added, changed or removed, names only, sorted. A deleted record lists every field it held. |
|
public | object | The new values of the changed fields the namespace declares public; null for one that was removed. Absent when no public field changed, for a namespace without public fields and for a deleted record. | ||
merged_into | one of | On the absorbed account's deleted record (reason subject_merged): the account that survives. | ||
merged_from | one of | On a record moved to the surviving account (created, reason subject_merged): the account it came from. |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: account-removed
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 5,
"change": "deleted",
"reason": "subject_removed",
"keys": [
"followers",
"is_streamer"
]
}Valid: merge-absorbed-side
{
"owner": {
"type": "guest",
"id": "gst_01JAB2C3D4E5F6G7H8J9K0MNPR"
},
"namespace": "chat.tts_defaults",
"namespace_owner": "live",
"schema_version": 1,
"revision": 2,
"change": "deleted",
"reason": "subject_merged",
"keys": [
"rate"
],
"merged_into": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}
}Valid: merge-surviving-side
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "chat.tts_defaults",
"namespace_owner": "live",
"schema_version": 1,
"revision": 1,
"change": "created",
"reason": "subject_merged",
"keys": [
"rate"
],
"merged_from": {
"type": "guest",
"id": "gst_01JAB2C3D4E5F6G7H8J9K0MNPR"
}
}Valid: private-namespace
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "chat.preferences",
"namespace_owner": "chat",
"schema_version": 1,
"revision": 1,
"change": "created",
"reason": "write",
"keys": [
"compact",
"timestamps"
]
}Valid: public-field-changed
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 3,
"change": "updated",
"reason": "write",
"keys": [
"followers",
"stream_minutes_30d"
],
"public": {
"followers": 4
}
}Valid: public-field-removed
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 4,
"change": "updated",
"reason": "write",
"keys": [
"last_live_at"
],
"public": {
"last_live_at": null
}
}Rejected: carries-data
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 3,
"change": "updated",
"reason": "write",
"keys": [
"followers",
"stream_minutes_30d"
],
"public": {
"followers": 4
},
"data": {
"followers": 4,
"stream_minutes_30d": 12
}
}Rejected: deleted-with-values
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 5,
"change": "deleted",
"reason": "delete",
"keys": [
"followers"
],
"public": {
"followers": 4
}
}Rejected: merged-into-on-a-write
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 3,
"change": "updated",
"reason": "write",
"keys": [
"followers",
"stream_minutes_30d"
],
"public": {
"followers": 4
},
"merged_into": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
}
}Rejected: revision-zero
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 0,
"change": "updated",
"reason": "write",
"keys": [
"followers",
"stream_minutes_30d"
],
"public": {
"followers": 4
}
}Rejected: service-owner
{
"owner": {
"type": "service",
"id": "live"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 3,
"change": "updated",
"reason": "write",
"keys": [
"followers",
"stream_minutes_30d"
],
"public": {
"followers": 4
}
}Rejected: unknown-reason
{
"owner": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"namespace": "live.profile",
"namespace_owner": "live",
"schema_version": 1,
"revision": 3,
"change": "updated",
"reason": "expired",
"keys": [
"followers",
"stream_minutes_30d"
],
"public": {
"followers": 4
}
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('network.module.updated@1', value); // { valid, errors: [{ path, message }] }