(input: { id?: string; title?: string; parentID?: string; directory: string })
| 175 | ) |
| 176 | |
| 177 | export async function createNext(input: { id?: string; title?: string; parentID?: string; directory: string }) { |
| 178 | const result: Info = { |
| 179 | id: Identifier.descending("session", input.id), |
| 180 | version: Installation.VERSION, |
| 181 | projectID: Instance.project.id, |
| 182 | directory: input.directory, |
| 183 | parentID: input.parentID, |
| 184 | title: input.title ?? createDefaultTitle(!!input.parentID), |
| 185 | time: { |
| 186 | created: Date.now(), |
| 187 | updated: Date.now(), |
| 188 | }, |
| 189 | } |
| 190 | log.info("created", result) |
| 191 | await Storage.write(["session", Instance.project.id, result.id], result) |
| 192 | Bus.publish(Event.Created, { |
| 193 | info: result, |
| 194 | }) |
| 195 | Bus.publish(Event.Updated, { |
| 196 | info: result, |
| 197 | }) |
| 198 | Telemetry.sessionStarted() |
| 199 | return result |
| 200 | } |
| 201 | |
| 202 | export const get = fn(Identifier.schema("session"), async (id) => { |
| 203 | const read = await Storage.read<Info>(["session", Instance.project.id, id]) |
no test coverage detected