book-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 f8f1b3a80195
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 7385a6c1c47153b1728160ff
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/bookings.json
{
 "version": "1",
 "name": "no double booking, moves, cancels, owners and days off",
 "actors": {
  "Olive": "olive_id",
  "Gus": "gus_id",
  "Hal": "hal_id",
  "Api": "api_principal"
 },
 "constants": {
  "BOUNDED_PUBLIC_PRINCIPAL_API": "api_principal"
 },
 "steps": [
  {
   "op": "setTime",
   "epoch": 1800000000
  },
  {
   "op": "as",
   "who": "Olive"
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pages/olivepage",
     "data": {
      "name": "Olive",
      "title": "Intro call",
      "description": "",
      "durationMin": 30,
      "timezone": "UTC",
      "hours": "{\"mon\":[\"09:00-17:00\"]}",
      "noticeHours": 0,
      "horizonDays": 60,
      "bufferMin": 0,
      "questions": "[]",
      "meeting": "Google Meet",
      "createdBy": "$Olive",
      "createdAt": 1800000000
     }
    },
    {
     "path": "pages/olivepage/owners/olive_id",
     "data": {
      "at": 1800000000
     }
    },
    {
     "path": "pagekeys/olivepage",
     "data": {
      "key": "ownerkeyownerkeyownerkey"
     }
    },
    {
     "path": "pagelinks/olivepage",
     "data": {
      "meetingUrl": "https://meet.google.com/abc-defg-hij"
     }
    }
   ]
  },
  {
   "op": "set",
   "path": "pages/olivepage",
   "data": {
    "name": "Olive",
    "title": "Intro call",
    "description": "",
    "durationMin": 30,
    "timezone": "UTC",
    "hours": "{\"mon\":[\"09:00-17:00\"]}",
    "noticeHours": 0,
    "horizonDays": 60,
    "bufferMin": 0,
    "questions": "[]",
    "meeting": "Google Meet",
    "createdBy": "$Olive",
    "createdAt": 1800000000,
    "daysOff": "[[\"2027-01-20\",\"2027-01-22\"]]"
   }
  },
  {
   "op": "expect",
   "expr": "get(/pages/olivepage).daysOff == '[[\"2027-01-20\",\"2027-01-22\"]]'"
  },
  {
   "op": "as",
   "who": "Gus"
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pages/olivepage/bookings/bookingGus111111111",
     "data": {
      "start": 1800086400,
      "end": 1800088200,
      "heldUntil": 1800088200,
      "name": "Guest",
      "email": "guest@example.com",
      "note": "",
      "answers": "[]",
      "status": "booked",
      "by": "$Gus",
      "createdAt": 1800000000
     }
    },
    {
     "path": "pages/olivepage/slots/1800086400",
     "data": {
      "bookingId": "bookingGus111111111",
      "at": 1800086400,
      "next": 1800087300
     }
    },
    {
     "path": "pages/olivepage/slots/1800087300",
     "data": {
      "bookingId": "bookingGus111111111",
      "at": 1800087300
     }
    },
    {
     "path": "bookingkeys/bookingGus111111111",
     "data": {
      "key": "cancelkeycancelkeycancel",
      "handle": "olivepage"
     }
    },
    {
     "path": "pages/olivepage/bookers/gus_id",
     "data": {
      "bookingId": "bookingGus111111111"
     }
    }
   ]
  },
  {
   "op": "read",
   "path": "pages/olivepage/bookings/bookingGus111111111"
  },
  {
   "op": "read",
   "path": "pagelinks/olivepage"
  },
  {
   "op": "set",
   "path": "pages/olivepage",
   "data": {
    "name": "Olive",
    "title": "Intro call",
    "description": "",
    "durationMin": 30,
    "timezone": "UTC",
    "hours": "{\"mon\":[\"09:00-17:00\"]}",
    "noticeHours": 0,
    "horizonDays": 60,
    "bufferMin": 0,
    "questions": "[]",
    "meeting": "Google Meet",
    "createdBy": "$Olive",
    "createdAt": 1800000000,
    "daysOff": "[]"
   },
   "shouldFail": true
  },
  {
   "op": "as",
   "who": "Hal"
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pages/olivepage/bookings/bookingHal111111111",
     "data": {
      "start": 1800087300,
      "end": 1800089100,
      "heldUntil": 1800089100,
      "name": "Guest",
      "email": "guest@example.com",
      "note": "",
      "answers": "[]",
      "status": "booked",
      "by": "$Hal",
      "createdAt": 1800000000
     }
    },
    {
     "path": "pages/olivepage/slots/1800087300",
     "data": {
      "bookingId": "bookingHal111111111",
      "at": 1800087300,
      "next": 1800088200
     }
    },
    {
     "path": "pages/olivepage/slots/1800088200",
     "data": {
      "bookingId": "bookingHal111111111",
      "at": 1800088200
     }
    },
    {
     "path": "bookingkeys/bookingHal111111111",
     "data": {
      "key": "cancelkeycancelkeycancel",
      "handle": "olivepage"
     }
    },
    {
     "path": "pages/olivepage/bookers/hal_id",
     "data": {
      "bookingId": "bookingHal111111111"
     }
    }
   ],
   "shouldFail": true
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pages/olivepage/bookings/bookingHal222222222",
     "data": {
      "start": 1800086400,
      "end": 1800088200,
      "heldUntil": 1800088200,
      "name": "Guest",
      "email": "guest@example.com",
      "note": "",
      "answers": "[]",
      "status": "booked",
      "by": "$Hal",
      "createdAt": 1800000000
     }
    },
    {
     "path": "pages/olivepage/slots/1800086400",
     "data": {
      "bookingId": "bookingHal222222222",
      "at": 1800086400,
      "next": 1800087300
     }
    },
    {
     "path": "pages/olivepage/slots/1800087300",
     "data": {
      "bookingId": "bookingHal222222222",
      "at": 1800087300
     }
    },
    {
     "path": "bookingkeys/bookingHal222222222",
     "data": {
      "key": "cancelkeycancelkeycancel",
      "handle": "olivepage"
     }
    },
    {
     "path": "pages/olivepage/bookers/hal_id",
     "data": {
      "bookingId": "bookingHal222222222"
     }
    }
   ],
   "shouldFail": true
  },
  {
   "op": "read",
   "path": "pages/olivepage/bookings/bookingGus111111111",
   "shouldFail": true
  },
  {
   "op": "read",
   "path": "pagelinks/olivepage",
   "shouldFail": true
  },
  {
   "op": "read",
   "path": "pagekeys/olivepage",
   "shouldFail": true
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pages/olivepage/bookings/bookingHal333333333",
     "data": {
      "start": 1800088200,
      "end": 1800090000,
      "heldUntil": 1800090000,
      "name": "Guest",
      "email": "guest@example.com",
      "note": "",
      "answers": "[]",
      "status": "booked",
      "by": "$Hal",
      "createdAt": 1800000000
     }
    },
    {
     "path": "pages/olivepage/slots/1800088200",
     "data": {
      "bookingId": "bookingHal333333333",
      "at": 1800088200,
      "next": 1800089100
     }
    },
    {
     "path": "pages/olivepage/slots/1800089100",
     "data": {
      "bookingId": "bookingHal333333333",
      "at": 1800089100
     }
    },
    {
     "path": "bookingkeys/bookingHal333333333",
     "data": {
      "key": "halkeyhalkeyhalkeyhalkey",
      "handle": "olivepage"
     }
    },
    {
     "path": "pages/olivepage/bookers/hal_id",
     "data": {
      "bookingId": "bookingHal333333333"
     }
    }
   ]
  },
  {
   "op": "set",
   "path": "pages/olivepage/bookings/bookingGus111111111",
   "data": {
    "status": "cancelled",
    "cancelledBy": "guest",
    "cancelledAt": 1800000000,
    "movedTo": "bookingHal333333333"
   },
   "shouldFail": true
  },
  {
   "op": "set",
   "path": "pages/olivepage/bookings/bookingHal333333333",
   "data": {
    "movedTo": "bookingHal333333333"
   },
   "shouldFail": true
  },
  {
   "op": "as",
   "who": "Gus"
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pages/olivepage/bookings/bookingGus222222222",
     "data": {
      "start": 1800090000,
      "end": 1800091800,
      "heldUntil": 1800091800,
      "name": "Guest",
      "email": "guest@example.com",
      "note": "",
      "answers": "[]",
      "status": "booked",
      "by": "$Gus",
      "createdAt": 1800000000
     }
    },
    {
     "path": "pages/olivepage/slots/1800090000",
     "data": {
      "bookingId": "bookingGus222222222",
      "at": 1800090000,
      "next": 1800090900
     }
    },
    {
     "path": "pages/olivepage/slots/1800090900",
     "data": {
      "bookingId": "bookingGus222222222",
      "at": 1800090900
     }
    },
    {
     "path": "bookingkeys/bookingGus222222222",
     "data": {
      "key": "cancelkeycancelkeycancel",
      "handle": "olivepage"
     }
    },
    {
     "path": "pages/olivepage/bookers/gus_id",
     "data": {
      "bookingId": "bookingGus222222222"
     }
    },
    {
     "path": "pages/olivepage/bookings/bookingGus111111111",
     "data": {
      "status": "cancelled",
      "cancelledBy": "guest",
      "cancelledAt": 1800000000,
      "movedTo": "bookingGus222222222"
     }
    }
   ]
  },
  {
   "op": "deleteMany",
   "paths": [
    "pages/olivepage/slots/1800086400",
    "pages/olivepage/slots/1800087300"
   ]
  },
  {
   "op": "expect",
   "expr": "get(/pages/olivepage/bookings/bookingGus111111111).status == 'cancelled' && get(/pages/olivepage/bookings/bookingGus111111111).movedTo == 'bookingGus222222222'"
  },
  {
   "op": "expect",
   "expr": "get(/pages/olivepage/slots/1800086400) == null && get(/pages/olivepage/slots/1800090000).bookingId == 'bookingGus222222222'"
  },
  {
   "op": "set",
   "path": "pages/olivepage/bookings/bookingGus111111111",
   "data": {
    "status": "booked"
   },
   "shouldFail": true
  },
  {
   "op": "as",
   "who": "Hal"
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pages/olivepage/bookings/bookingHal444444444",
     "data": {
      "start": 1800086400,
      "end": 1800088200,
      "heldUntil": 1800088200,
      "name": "Guest",
      "email": "guest@example.com",
      "note": "",
      "answers": "[]",
      "status": "booked",
      "by": "$Hal",
      "createdAt": 1800000000
     }
    },
    {
     "path": "pages/olivepage/slots/1800086400",
     "data": {
      "bookingId": "bookingHal444444444",
      "at": 1800086400,
      "next": 1800087300
     }
    },
    {
     "path": "pages/olivepage/slots/1800087300",
     "data": {
      "bookingId": "bookingHal444444444",
      "at": 1800087300
     }
    },
    {
     "path": "bookingkeys/bookingHal444444444",
     "data": {
      "key": "halkeyhalkeyhalkeyhalke2",
      "handle": "olivepage"
     }
    },
    {
     "path": "pages/olivepage/bookers/hal_id",
     "data": {
      "bookingId": "bookingHal444444444"
     }
    }
   ]
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pageclaims/olivepage/c/hal_id",
     "data": {
      "key": "wrongkeywrongkeywrongkey"
     }
    },
    {
     "path": "pages/olivepage/owners/hal_id",
     "data": {
      "at": 1800000000
     }
    }
   ],
   "shouldFail": true
  },
  {
   "op": "as",
   "who": "Olive"
  },
  {
   "op": "read",
   "path": "pages/olivepage/bookings/bookingGus222222222"
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pages/olivepage/bookings/bookingHal333333333",
     "data": {
      "status": "cancelled",
      "cancelledBy": "owner",
      "cancelledAt": 1800000000
     }
    }
   ]
  },
  {
   "op": "deleteMany",
   "paths": [
    "pages/olivepage/slots/1800088200",
    "pages/olivepage/slots/1800089100"
   ]
  },
  {
   "op": "set",
   "path": "pages/olivepage",
   "data": {
    "name": "Olive",
    "title": "Intro call",
    "description": "",
    "durationMin": 30,
    "timezone": "UTC",
    "hours": "{\"mon\":[\"09:00-17:00\"]}",
    "noticeHours": 0,
    "horizonDays": 60,
    "bufferMin": 0,
    "questions": "[]",
    "meeting": "Google Meet",
    "createdBy": "$Olive",
    "createdAt": 1800000000,
    "daysOff": null
   }
  },
  {
   "op": "as",
   "who": "Api"
  },
  {
   "op": "read",
   "path": "pagekeys/olivepage"
  },
  {
   "op": "as",
   "who": "Hal"
  },
  {
   "op": "setMany",
   "writes": [
    {
     "path": "pageclaims/olivepage/c/hal_id",
     "data": {
      "key": "ownerkeyownerkeyownerkey"
     }
    },
    {
     "path": "pages/olivepage/owners/hal_id",
     "data": {
      "at": 1800000000
     }
    }
   ]
  },
  {
   "op": "read",
   "path": "pages/olivepage/bookings/bookingGus222222222"
  }
 ]
}

Change history

Add favicon.ico and link tag
f8f1b3a801 · 2 hours ago
Quality pass: guest reschedule, days off, calendar feed, API docs
c827e5d073 · 5 hours ago
Bounded source sync
68e67b4092 · 1 day ago
Bounded source sync
ab2e006f9b · 1 day ago
Bounded source sync
bb10824b54 · 1 day ago
Bounded source sync
d22f765fb7 · 1 day ago
Bounded source sync
30b4b06513 · 1 day ago
Bounded source sync
c3d297477a · 1 day ago
Bounded source sync
7b18317417 · 1 day ago