| 1 | // Stand-ins for identity, events, security and billing, so the repos |
| 2 | // service answers anonymous git requests with `wrangler dev` (repos.jsonc). |
| 3 | // |
| 4 | // - Identity knows nobody: credentials name no one, and no workspace was |
| 5 | // renamed. Public repositories can be cloned without signing in. |
| 6 | // - Events takes every event and audit entry and logs them. |
| 7 | // - Security has allowed no secrets; billing says every workspace is free. |
| 8 | |
| 9 | export default { |
| 10 | async fetch(request) { |
| 11 | const method = new URL(request.url).pathname.replace(/^\/rpc\//, ""); |
| 12 | const args = await request.json().catch(() => ({})); |
| 13 | const json = (value) => Response.json(value); |
| 14 | switch (method) { |
| 15 | case "user_for_git_credentials": |
| 16 | case "resolve_slug": |
| 17 | return json(null); |
| 18 | case "is_free": |
| 19 | case "plan": |
| 20 | return json({ free: true }); |
| 21 | default: |
| 22 | console.log(`stub ${method}`, JSON.stringify(args).slice(0, 200)); |
| 23 | return json(null); |
| 24 | } |
| 25 | }, |
| 26 | }; |