VipPolicyEvaluateResult vip.policy-evaluate-result@1

Generated at from openvibe-contracts v0.53.0 and openvibe-sdk v0.11.0.

Version
1.0.0
Owner
vip
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/vip/policy-evaluate-result.v1.json

vip.policy-evaluate-result@1: the answer of vip.resource.policy.evaluate on OpenVibe.VIP. POST /api/v1/policies/evaluate → { allow, reason, rule?, entitlement?, fallback? }. It fails closed: no owner, no rule, a disabled rule, a suspended creator, an entitlement VIP cannot confirm, a missing plan or perk, or any error is allow false with the reason. allow true only for the owner themselves (reason owner) or a member meeting the rule (member). fallback true when the product's default gate decided (rule null).

Fields

FieldTypeRequiredDescriptionConstraints
allowbooleanyes
reasonenumyes
  • one of "owner", "member", "invalid_resource", "invalid_fallback", "owner_required", "no_rule", "rule_mismatch", "owner_mismatch", "rule_disabled", "creator_unavailable", "not_signed_in", "not_a_member", "entitlement_unknown", "plan_required", "perk_missing"
ruleone of
entitlementone of
fallbackconst
  • = true

Examples

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

Valid: fallback
{
  "allow": false,
  "reason": "entitlement_unknown",
  "rule": null,
  "fallback": true,
  "entitlement": {
    "member": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
    },
    "creator": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    },
    "kind": "channel_subscription",
    "status": "unknown",
    "active": false,
    "expires_at": null,
    "cancel_at_period_end": false,
    "source": "none",
    "stale": false,
    "valid_until": null,
    "checked_at": "2026-09-25T09:12:40.118Z",
    "reason": "billing_unavailable",
    "membership": null
  }
}
Valid: member
{
  "allow": true,
  "reason": "member",
  "rule": {
    "id": "vgr_01JAB2C3D4E5F6G7H8J9K0MNPY",
    "creator": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    },
    "creator_id": "vcr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
    "resource": {
      "service": "blog",
      "type": "post",
      "id": "pst_01JAB2C3D4E5F6G7H8J9K0MNPZ"
    },
    "requirement": "perk",
    "plan_id": null,
    "perk_key": "chat-badge",
    "sensitive": false,
    "status": "active",
    "updated_at": "2026-09-20T18:04:11.402Z"
  },
  "entitlement": {
    "member": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
    },
    "creator": {
      "type": "user",
      "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
    },
    "kind": "channel_subscription",
    "status": "active",
    "active": true,
    "expires_at": "2026-10-20T18:04:11.000Z",
    "cancel_at_period_end": false,
    "source": "projection",
    "stale": false,
    "valid_until": "2026-09-25T09:17:40.118Z",
    "checked_at": "2026-09-25T09:12:40.118Z",
    "membership": {
      "id": "vms_01JAB2C3D4E5F6G7H8J9K0MNPX",
      "member": {
        "type": "user",
        "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
      },
      "creator_id": "vcr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
      "plan_id": "vpl_01JAB2C3D4E5F6G7H8J9K0MNPW",
      "plan_version": {
        "id": "vpv_01JAB2C3D4E5F6G7H8J9K0MNPT",
        "version": 2,
        "name": "Supporter",
        "terms": {
          "name": "Supporter",
          "description": "Back the stream every month.",
          "benefits": [
            "Supporter badge in chat",
            "Members-only VOD chapters"
          ],
          "perks": [
            {
              "key": "chat-badge",
              "name": "Chat badge",
              "kind": "badge",
              "scope": "creator"
            }
          ],
          "billing_kind": "channel_subscription",
          "price": "set and charged by OpenVibe.Billing",
          "digest": "3fa9c0d27e5b8814"
        }
      },
      "perks": [
        "chat-badge"
      ],
      "origin": "checkout",
      "joined_at": "2026-09-20T18:04:11.402Z",
      "terms_since": "2026-09-20T18:04:11.402Z"
    }
  }
}
Valid: no-rule
{
  "allow": false,
  "reason": "no_rule"
}
Rejected: bad-reason
{
  "allow": false,
  "reason": "nope"
}

Validate

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