What a source is (0037-planningFR-013, FR-030, FR-032): a typed lens over one kind of place with a name, its capabilities and a place; acquire reads the place and returns its observations and findings; preview gives the plan a patch would carry out; write carries a plan out and returns what the place now holds. defineSource makes one from a typed record and refuses a record that says one thing of what it can write and does another; applyPatch is the one way a patch reaches a source, a dry run unless it names the hash of the preview, refusing a hash that is not the plan's, and sending a patch the source cannot apply to the outbox.
typeSource= {
readonlyname:string;
readonlyplace:string;
readonlycapabilities:ReadonlySet<Capability>;
acquire():Promise<Result<Acquired, SourceProblem>>;
/** The plan a patch would carry out, or why this place cannot say it. Present when the source can write. */preview?(patch:Patch):Promise<Result<Plan, SourceProblem>>;
/** Carries a plan out and returns what the place now holds. Present when the source can write. */write?(plan:Plan):Promise<Result<Acquired, SourceProblem>>;
};
A source from a typed record: a record whose preview or write is present while its capabilities say it cannot write, or absent while they say it can, is refused.
The one way a patch reaches a source. A patch for another source or place than the source's own is refused (a write needs an explicit target); a patch the source cannot apply, or that its place cannot say, is an outbox entry; otherwise the plan is made and the write is a dry run unless hash is the hash of its preview.
typeSource= {
readonlyname:string;
readonlyplace:string;
readonlycapabilities:ReadonlySet<Capability>;
acquire():Promise<Result<Acquired, SourceProblem>>;
/** The plan a patch would carry out, or why this place cannot say it. Present when the source can write. */preview?(patch:Patch):Promise<Result<Plan, SourceProblem>>;
/** Carries a plan out and returns what the place now holds. Present when the source can write. */write?(plan:Plan):Promise<Result<Acquired, SourceProblem>>;
};
A source from a typed record: a record whose preview or write is present while its capabilities say it cannot write, or absent while they say it can, is refused.
The one way a patch reaches a source. A patch for another source or place than the source's own is refused (a write needs an explicit target); a patch the source cannot apply, or that its place cannot say, is an outbox entry; otherwise the plan is made and the write is a dry run unless hash is the hash of its preview.