{"file":"server/src/issues/index.ts","version":318,"total":64,"from":1,"to":64,"lines":[{"n":1,"text":"// Issues, asks and news for the open server: one IssueProject Durable Object per project (bound as ISSUES_DO,","atom":"a1518","author":"trials","version":151},{"n":2,"text":"// named by the project's name), reached through issuesFetch from the Worker's /issues/p/:project/... routes.","atom":"a1518","author":"trials","version":151},{"n":3,"text":"// The logic is in serve.ts, store.ts and routes.ts, which run under node --test without Cloudflare's runtime.","atom":"a1518","author":"trials","version":151},{"n":4,"text":"//","atom":"a1518","author":"trials","version":151},{"n":5,"text":"//   GET  /issues/p/:project/issues[?status=&agent=&parent=&label=&open=1]   issues, most recently updated first","atom":"a1518","author":"trials","version":151},{"n":6,"text":"//   GET  /issues/p/:project/issue/:n                                        one issue with its comments, edits and asks","atom":"a1518","author":"trials","version":151},{"n":7,"text":"//   GET  /issues/p/:project/search?q=[&limit=]                               full-text search","atom":"a1518","author":"trials","version":151},{"n":8,"text":"//   GET  /issues/p/:project/labels | changes | waiting[?of=] | ask/:n | asked?by= | answered?of=","atom":"a1518","author":"trials","version":151},{"n":9,"text":"//   GET  /issues/p/:project/a/:agent/waiting | asked | drafts | news[?before=]","atom":"a1518","author":"trials","version":151},{"n":10,"text":"//   POST /issues/p/:project/a/:agent/issue | ask | answer/:n | ack/:n | reply/:n | withdraw/:n","atom":"a1518","author":"trials","version":151},{"n":11,"text":"//   POST /issues/p/:project/a/:agent/issue/:n/comment | edit | drop | reopen | done","atom":"a1518","author":"trials","version":151},{"n":12,"text":"//   POST /issues/p/:project/a/:agent/draft | draft/:n/open | draft/:n/delete | news/read","atom":"a1518","author":"trials","version":151},{"n":13,"text":"","atom":"a1453","author":"speed","version":150},{"n":14,"text":"import { DurableObject } from \"cloudflare:workers\";","atom":"a1453","author":"speed","version":150},{"n":15,"text":"import { type IssuesEnv, IssuesObject } from \"./serve.ts\";","atom":"a1518","author":"trials","version":151},{"n":16,"text":"import type { News } from \"./store.ts\";","atom":"a1518","author":"trials","version":151},{"n":17,"text":"","atom":"a1518","author":"trials","version":151},{"n":18,"text":"export {","atom":"a1518","author":"trials","version":151},{"n":19,"text":"\ttype IssueNews,","atom":"a1518","author":"trials","version":151},{"n":20,"text":"\ttype IssuesAuth,","atom":"a1518","author":"trials","version":151},{"n":21,"text":"\ttype IssuesEnv,","atom":"a1518","author":"trials","version":151},{"n":22,"text":"\tissuesFetch,","atom":"a1518","author":"trials","version":151},{"n":23,"text":"\ttype NamespaceLike,","atom":"a1518","author":"trials","version":151},{"n":24,"text":"\ttype ProjectHooks,","atom":"a1518","author":"trials","version":151},{"n":25,"text":"\ttype WaitUntil,","atom":"a1518","author":"trials","version":151},{"n":26,"text":"} from \"./serve.ts\";","atom":"a1518","author":"trials","version":151},{"n":27,"text":"","atom":"a1518","author":"trials","version":151},{"n":28,"text":"/** One project's issues, in its own SQLite. */","atom":"a1518","author":"trials","version":151},{"n":29,"text":"export class IssueProject extends DurableObject<IssuesEnv> {","atom":"a1518","author":"trials","version":151},{"n":30,"text":"\tprivate readonly issues: IssuesObject;","atom":"a1518","author":"trials","version":151},{"n":31,"text":"","atom":"a1518","author":"trials","version":151},{"n":32,"text":"\tconstructor(ctx: DurableObjectState, env: IssuesEnv) {","atom":"a1518","author":"trials","version":151},{"n":33,"text":"\t\tsuper(ctx, env);","atom":"a1518","author":"trials","version":151},{"n":34,"text":"\t\t// The migrations are synchronous SQL, so they finish here, before the object takes any request.","atom":"a1518","author":"trials","version":151},{"n":35,"text":"\t\tthis.issues = new IssuesObject(","atom":"a1518","author":"trials","version":151},{"n":36,"text":"\t\t\t{ sql: ctx.storage.sql, transactionSync: (action) => ctx.storage.transactionSync(action) },","atom":"a1518","author":"trials","version":151},{"n":37,"text":"\t\t\tenv,","atom":"a1518","author":"trials","version":151},{"n":38,"text":"\t\t);","atom":"a1518","author":"trials","version":151},{"n":39,"text":"\t}","atom":"a1518","author":"trials","version":151},{"n":40,"text":"","atom":"a1518","author":"trials","version":151},{"n":41,"text":"\tasync fetch(request: Request): Promise<Response> {","atom":"a1518","author":"trials","version":151},{"n":42,"text":"\t\treturn this.issues.fetch(request);","atom":"a1518","author":"trials","version":151},{"n":43,"text":"\t}","atom":"a1518","author":"trials","version":151},{"n":44,"text":"","atom":"a1518","author":"trials","version":151},{"n":45,"text":"\t/** A start note names the issue; `change` is the note's log position. A missing or closed issue is ignored. */","atom":"a1518","author":"trials","version":151},{"n":46,"text":"\tasync claim(agent: string, issue: number, change: number): Promise<void> {","atom":"a1518","author":"trials","version":151},{"n":47,"text":"\t\tthis.issues.store.claim(agent, issue, change);","atom":"a1518","author":"trials","version":151},{"n":48,"text":"\t}","atom":"a1518","author":"trials","version":151},{"n":49,"text":"","atom":"a1518","author":"trials","version":151},{"n":50,"text":"\t/** The start note ended without finishing the issue. */","atom":"a1518","author":"trials","version":151},{"n":51,"text":"\tasync unclaim(agent: string, issue: number): Promise<void> {","atom":"a1518","author":"trials","version":151},{"n":52,"text":"\t\tthis.issues.store.unclaim(agent, issue);","atom":"a1518","author":"trials","version":151},{"n":53,"text":"\t}","atom":"a1518","author":"trials","version":151},{"n":54,"text":"","atom":"a1518","author":"trials","version":151},{"n":55,"text":"\t/** publish --done finished the issue in `version`: done, and its news for the project to deliver. */","atom":"a1518","author":"trials","version":151},{"n":56,"text":"\tasync done(agent: string, issue: number, version: number): Promise<{ news?: News }> {","atom":"a1518","author":"trials","version":151},{"n":57,"text":"\t\treturn this.issues.store.done(agent, issue, version);","atom":"a1518","author":"trials","version":151},{"n":58,"text":"\t}","atom":"a1518","author":"trials","version":151},{"n":59,"text":"","atom":"a1518","author":"trials","version":151},{"n":60,"text":"\t/** How many schema migrations this object has run. */","atom":"a1518","author":"trials","version":151},{"n":61,"text":"\tasync schema(): Promise<{ migrations: number }> {","atom":"a1518","author":"trials","version":151},{"n":62,"text":"\t\treturn { migrations: this.issues.migrations() };","atom":"a1518","author":"trials","version":151},{"n":63,"text":"\t}","atom":"a1518","author":"trials","version":151},{"n":64,"text":"}","atom":"a1518","author":"trials","version":151}],"atoms":[{"atom":"a1453","author":"speed","message":"","time":1791906745856,"timeIso":"2026-10-13T15:52:25.856Z","publish":{"draft":null,"version":150,"agent":"speed","message":"Open server: the project Worker, Durable Object and Artifacts (issue 17)","time":1791907522179,"timeIso":"2026-10-13T16:05:22.179Z"}},{"atom":"a1518","author":"trials","message":"","time":1791907770251,"timeIso":"2026-10-13T16:09:30.251Z","publish":{"draft":null,"version":151,"agent":"trials","message":"Open server: issues, asks and news, served at <server>/issues, and the client finds them there when no issues server is named","time":1791907770251,"timeIso":"2026-10-13T16:09:30.251Z"}}]}