polls-free.openapps.xyz

Source

This app’s code and revision history are public. Download a copy or explore the files below.

Public
The app’s code and revision history are public.
Owned app · rev c06cea4889e9
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone 334801de44cb0fe911d5a88b
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
← All files
policy-tests/votes.json
{
  "version": "1",
  "name": "one vote per person per poll, changed only while open and allowed",
  "actors": {
    "Host": "host_user",
    "Ann": "ann_user",
    "Ben": "ben_user",
    "Eve": "eve_user"
  },
  "constants": {
    "BOUNDED_PUBLIC_PRINCIPAL_API": "api_principal"
  },
  "steps": [
    {
      "op": "setTime",
      "epoch": 1800000000
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "setMany",
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa",
          "data": {
            "title": "Class",
            "code": "123456",
            "current": "",
            "qa": true,
            "moderate": false,
            "allowChange": true,
            "createdBy": "$Host",
            "createdAt": 1800000000
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/joins/host_user",
          "data": {
            "at": 1800000000
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/owners/host_user",
          "data": {
            "at": 1800000000
          }
        },
        {
          "path": "eventkeys/evaaaaaaaaaaaaaaaaaa",
          "data": {
            "key": "kkkkkkkkkkkkkkkkkkkkkkkk"
          }
        },
        {
          "path": "codes/123456",
          "data": {
            "event": "evaaaaaaaaaaaaaaaaaa",
            "at": 1800000000
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1",
          "data": {
            "type": "choice",
            "question": "Best day?",
            "options": "[\"Mon\",\"Tue\"]",
            "multi": false,
            "max": 0,
            "pos": 0,
            "status": "draft",
            "showResults": false,
            "results": "",
            "createdAt": 1800000000
          }
        }
      ]
    },
    {
      "op": "as",
      "who": "Ann"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
      "data": {
        "answer": "[0]",
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/joins/ann_user",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
      "data": {
        "answer": "[0]",
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1",
      "data": {
        "status": "open"
      }
    },
    {
      "op": "as",
      "who": "Ann"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
      "data": {
        "answer": "",
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
      "data": {
        "answer": "[0]",
        "at": 1800000099
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
      "data": {
        "answer": "[0]",
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
      "data": {
        "answer": "[1]",
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ben_user",
      "data": {
        "answer": "[1]",
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "delete",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa",
      "data": {
        "allowChange": false
      }
    },
    {
      "op": "as",
      "who": "Ann"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
      "data": {
        "answer": "[0]",
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "expect",
      "expr": "get(/events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user).answer == '[1]'"
    },
    {
      "op": "as",
      "who": "Ben"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/joins/ben_user",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ben_user",
      "data": {
        "answer": "[0]",
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ben_user",
      "data": {
        "answer": "[1]",
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa",
      "data": {
        "allowChange": true
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1",
      "data": {
        "status": "closed"
      }
    },
    {
      "op": "as",
      "who": "Ben"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ben_user",
      "data": {
        "answer": "[1]",
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Eve"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/joins/eve_user",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/eve_user",
      "data": {
        "answer": "[1]",
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "delete",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ben_user",
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "deleteMany",
      "paths": [
        "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ann_user",
        "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ben_user"
      ]
    },
    {
      "op": "expect",
      "expr": "get(/events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ben_user) == null"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1",
      "data": {
        "status": "open"
      }
    },
    {
      "op": "as",
      "who": "Ben"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/polls/p1/votes/ben_user",
      "data": {
        "answer": "[1]",
        "at": 1800000000
      }
    }
  ]
}

Change history

Point OpenApps links to openapps.free
c06cea4889 · 17 hours ago
Bind agent address in policy constants
a7de116d52 · 19 hours ago
Use OpenApps service URLs and add contribution strip
e8ce0b0bf0 · 19 hours ago
Bounded source sync
dcdc4d56e6 · 1 day ago
Bounded source sync
7acdace1e1 · 1 day ago
Bounded source sync
2140a66ea0 · 1 day ago
Bounded source sync
0db2fe3ca0 · 1 day ago
Bounded source sync
996f633a3c · 1 day ago