@spica-devkit/testing 0.18.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,54 @@
1
+ import Docker from 'dockerode';
2
+
3
+ type ImagePullPolicy = "if-not-present" | "always";
4
+ type ResourceModuleName = "bucket" | "function" | "policy" | "env-var" | "secret";
5
+ type ResourceSelection = Partial<Record<ResourceModuleName, true | string[]>>;
6
+ interface StartOptions {
7
+ version?: string;
8
+ mongoVersion?: string;
9
+ resourcePath?: string;
10
+ port?: number;
11
+ name?: string;
12
+ identifier?: string;
13
+ password?: string;
14
+ masterKey?: string;
15
+ apiOptions?: Record<string, string | number | boolean>;
16
+ imagePullPolicy?: ImagePullPolicy;
17
+ installResources?: boolean | ResourceSelection;
18
+ readyTimeoutMs?: number;
19
+ }
20
+ type ResetModule = "bucket-data" | "bucket" | "identity" | "user" | "apikey" | "function" | "storage" | "all";
21
+ interface TeardownOptions {
22
+ retainVolumes?: boolean;
23
+ }
24
+ interface SpicaInstance {
25
+ readonly publicUrl: string;
26
+ waitForReady(timeoutMs?: number): Promise<void>;
27
+ reset(modules?: ResetModule[]): Promise<void>;
28
+ teardown(options?: TeardownOptions): Promise<void>;
29
+ }
30
+
31
+ declare function start(options?: StartOptions): Promise<SpicaInstance>;
32
+
33
+ declare class ImageNotFoundError extends Error {
34
+ constructor(image: string, tag: string);
35
+ }
36
+ declare class DockerOrchestrator {
37
+ private docker;
38
+ constructor(docker?: Docker);
39
+ private label;
40
+ private labelFilter;
41
+ doesImageExist(image: string, tag: string): Promise<boolean>;
42
+ pullImage(image: string, tag: string): Promise<void>;
43
+ ensureImages(version: string, mongoVersion: string, policy: ImagePullPolicy): Promise<void>;
44
+ createNetwork(name: string): Promise<Docker.Network>;
45
+ startMongo(name: string, mongoVersion: string, mongoPort: number, network: Docker.Network): Promise<void>;
46
+ private detectShell;
47
+ initReplicaSet(name: string): Promise<void>;
48
+ private waitReplicaPrimary;
49
+ startApi(name: string, port: number, version: string, args: string[], network: Docker.Network): Promise<void>;
50
+ teardown(name: string, retainVolumes?: boolean): Promise<void>;
51
+ }
52
+
53
+ export { DockerOrchestrator, ImageNotFoundError, start };
54
+ export type { ImagePullPolicy, ResetModule, ResourceModuleName, ResourceSelection, SpicaInstance, StartOptions, TeardownOptions };