Interface: FakeStorage
Defined in: packages/testing/src/storage.ts:48
@rasd/storage — the public entry point.
This package owns three things and nothing else: the frozen StorageAdapter
contract, a reference implementation of it, and the suite that proves any
other implementation matches. It deliberately has no dependency on
@rasd/license — that is what makes export() available in every licence
state a property of the module graph rather than a promise (docs/09 §10).
Extends
Properties
attachments
attachments: BlobStore;
Defined in: packages/storage/dist/contract.d.ts:198
Inherited from
calls
readonly calls: readonly string[];
Defined in: packages/testing/src/storage.ts:63
Every repo call made so far, in order — ['submissions.put', …].
datasets
datasets: DatasetRepo;
Defined in: packages/storage/dist/contract.d.ts:199
Inherited from
forms
forms: FormRepo;
Defined in: packages/storage/dist/contract.d.ts:196
Inherited from
kind
readonly kind: string & object | "dexie" | "sqlite" | "memory";
Defined in: packages/storage/dist/contract.d.ts:192
Inherited from
kv
kv: KeyValueStore;
Defined in: packages/storage/dist/contract.d.ts:201
Inherited from
outbox
outbox: OutboxQueue;
Defined in: packages/storage/dist/contract.d.ts:200
Inherited from
state
readonly state: "closed" | "opening" | "open" | "blocked";
Defined in: packages/storage/dist/contract.d.ts:193
Inherited from
submissions
submissions: SubmissionRepo;
Defined in: packages/storage/dist/contract.d.ts:197
Inherited from
Methods
close()
close(): Promise<void>;
Defined in: packages/storage/dist/contract.d.ts:195
Returns
Promise<void>
Inherited from
delay()
delay(method, ms): void;
Defined in: packages/testing/src/storage.ts:58
Delay every call to method by ms. Pass 0 to clear.
Parameters
| Parameter | Type |
|---|---|
method | string |
ms | number |
Returns
void
disconnect()
disconnect(): void;
Defined in: packages/testing/src/storage.ts:60
Every call rejects with RASD_STORAGE_NOT_OPEN until reconnect().
Returns
void
estimate()
estimate(): Promise<RasdStorageEstimate>;
Defined in: packages/storage/dist/contract.d.ts:203
Returns
Promise<RasdStorageEstimate>
Inherited from
export()
export(): AsyncIterable<ExportChunk>;
Defined in: packages/storage/dist/contract.d.ts:207
JSONL + blobs. Must work in every licence state, including limited.
Returns
AsyncIterable<ExportChunk>
Inherited from
failNext()
failNext(method, error): void;
Defined in: packages/testing/src/storage.ts:56
Fail the next call to method with error, then behave normally again.
One-shot on purpose: the interesting question is almost always "does the host recover", and a permanently broken method answers a different, easier one. Call it again for a second failure.
Parameters
| Parameter | Type |
|---|---|
method | string |
error | RasdError |
Returns
void
import()
import(chunks, opts?): Promise<ImportReport>;
Defined in: packages/storage/dist/contract.d.ts:208
Parameters
| Parameter | Type |
|---|---|
chunks | AsyncIterable<ExportChunk> |
opts? | { overwrite?: boolean; } |
opts.overwrite? | boolean |
Returns
Promise<ImportReport>
Inherited from
on()
on(event, handler): Unsubscribe;
Defined in: packages/storage/dist/contract.d.ts:205
Parameters
| Parameter | Type |
|---|---|
event | "error" | "blocked" | "change" | "quota" | "migration" |
handler | (e) => void |
Returns
Inherited from
open()
open(opts): Promise<void>;
Defined in: packages/storage/dist/contract.d.ts:194
Parameters
| Parameter | Type |
|---|---|
opts | OpenOptions |
Returns
Promise<void>
Inherited from
reconnect()
reconnect(): void;
Defined in: packages/testing/src/storage.ts:61
Returns
void
reset()
reset(): void;
Defined in: packages/testing/src/storage.ts:65
Forget recorded calls, pending failures and delays.
Returns
void
securityReport()
securityReport(): Promise<StorageSecurityReport>;
Defined in: packages/storage/dist/contract.d.ts:204
Returns
Promise<StorageSecurityReport>
Inherited from
transaction()
transaction<T>(scopes, fn): Promise<T>;
Defined in: packages/storage/dist/contract.d.ts:202
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
scopes | StorageScope[] |
fn | () => Promise<T> |
Returns
Promise<T>
Inherited from
wipe()
wipe(): Promise<void>;
Defined in: packages/storage/dist/contract.d.ts:211
Returns
Promise<void>