mirror of
https://github.com/bitbaum/writingkit.git
synced 2026-12-04 03:57:14 +01:00
Moved from bitbaum/orangecat packages/writingkit at 0e410b309710e7c558ada4c5903b3b5bb10e24a4; the history before this commit is there. Created by bitbaum/fleet scripts/packages/create-package-repos.mjs from registers/package-repos.json.
25 lines
804 B
TypeScript
25 lines
804 B
TypeScript
import { WritingSession, type WritingOutcome } from '@bitbaum/writingkit';
|
|
|
|
/** Compile the installed public surface as an adapter would use it. */
|
|
export async function publicContract(): Promise<WritingOutcome> {
|
|
const session = new WritingSession({ documentId: 'owned-draft', revision: 'etag-1' });
|
|
const result = await session.run(
|
|
async ({ signal, base }) => {
|
|
signal.throwIfAborted();
|
|
// @ts-expect-error A captured revision is immutable.
|
|
base.revision = 'changed';
|
|
return { text: 'Proposed text' };
|
|
},
|
|
proposal => {
|
|
const text: string = proposal.text;
|
|
void text;
|
|
}
|
|
);
|
|
void session.run(
|
|
async () => 'draft',
|
|
// @ts-expect-error Async application leaves an await after the revision check.
|
|
async () => {}
|
|
);
|
|
return result;
|
|
}
|