@envelop/persisted-operations
Version:
This plugin allow you to enforce execution of persisted (hashed) operation, using a custom store.
15 lines (14 loc) • 381 B
JavaScript
export class InMemoryStore {
constructor(options) {
this.storeData = options?.initialData ?? new Map();
}
get(operationId) {
return this.storeData.get(operationId) || undefined;
}
prime(operationId, document) {
this.storeData.set(operationId, document);
}
clear(operationId) {
this.storeData.delete(operationId);
}
}