feat(core-dsr): Payload impls, recording doubles, DI binders, contract tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
25
packages/core-dsr/src/in-memory-processing-restriction.ts
Normal file
25
packages/core-dsr/src/in-memory-processing-restriction.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { IProcessingRestriction } from "./processing-restriction.interface";
|
||||
|
||||
/**
|
||||
* Volatile in-memory IProcessingRestriction. Tracks restriction state in
|
||||
* memory; state is lost on process restart.
|
||||
*
|
||||
* Used in dev-seed and storybook contexts where Payload is unavailable.
|
||||
* Not a recording double — use RecordingProcessingRestriction from
|
||||
* @repo/core-testing for call-assertion in unit tests.
|
||||
*/
|
||||
export class InMemoryProcessingRestriction implements IProcessingRestriction {
|
||||
private readonly restricted = new Set<string>();
|
||||
|
||||
async setRestriction(subjectId: string, granted: boolean): Promise<void> {
|
||||
if (granted) {
|
||||
this.restricted.add(subjectId);
|
||||
} else {
|
||||
this.restricted.delete(subjectId);
|
||||
}
|
||||
}
|
||||
|
||||
async isRestricted(subjectId: string): Promise<boolean> {
|
||||
return this.restricted.has(subjectId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user