@start9labs/start-sdk 0.4.0-beta.1 → 0.4.0-beta.11
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/base/lib/Effects.d.ts +3 -0
- package/base/lib/actions/setupActions.js +7 -7
- package/base/lib/actions/setupActions.js.map +1 -1
- package/base/lib/dependencies/dependencies.js +4 -2
- package/base/lib/dependencies/dependencies.js.map +1 -1
- package/base/lib/dependencies/setupDependencies.js +5 -7
- package/base/lib/dependencies/setupDependencies.js.map +1 -1
- package/base/lib/interfaces/setupInterfaces.js +7 -9
- package/base/lib/interfaces/setupInterfaces.js.map +1 -1
- package/base/lib/osBindings/index.d.ts +16 -16
- package/base/lib/types.d.ts +11 -0
- package/base/lib/types.js +8 -0
- package/base/lib/types.js.map +1 -1
- package/base/lib/util/GetSystemSmtp.js +7 -2
- package/base/lib/util/GetSystemSmtp.js.map +1 -1
- package/base/lib/util/getServiceInterface.d.ts +10 -0
- package/base/lib/util/getServiceInterface.js +41 -1
- package/base/lib/util/getServiceInterface.js.map +1 -1
- package/base/lib/util/getServiceInterfaces.js +6 -1
- package/base/lib/util/getServiceInterfaces.js.map +1 -1
- package/package/lib/StartSdk.d.ts +21 -19
- package/package/lib/StartSdk.js +26 -14
- package/package/lib/StartSdk.js.map +1 -1
- package/package/lib/backup/Backups.d.ts +12 -2
- package/package/lib/backup/Backups.js +51 -3
- package/package/lib/backup/Backups.js.map +1 -1
- package/package/lib/backup/setupBackups.js +2 -2
- package/package/lib/backup/setupBackups.js.map +1 -1
- package/package/lib/health/checkFns/runHealthScript.d.ts +2 -1
- package/package/lib/health/checkFns/runHealthScript.js +1 -1
- package/package/lib/health/checkFns/runHealthScript.js.map +1 -1
- package/package/lib/mainFn/CommandController.d.ts +8 -14
- package/package/lib/mainFn/CommandController.js +33 -48
- package/package/lib/mainFn/CommandController.js.map +1 -1
- package/package/lib/mainFn/Daemon.d.ts +5 -13
- package/package/lib/mainFn/Daemon.js +9 -5
- package/package/lib/mainFn/Daemon.js.map +1 -1
- package/package/lib/mainFn/Daemons.d.ts +6 -25
- package/package/lib/mainFn/Daemons.js +1 -3
- package/package/lib/mainFn/Daemons.js.map +1 -1
- package/package/lib/mainFn/HealthDaemon.d.ts +4 -3
- package/package/lib/mainFn/HealthDaemon.js +11 -0
- package/package/lib/mainFn/HealthDaemon.js.map +1 -1
- package/package/lib/mainFn/Mounts.d.ts +13 -5
- package/package/lib/mainFn/Mounts.js +35 -22
- package/package/lib/mainFn/Mounts.js.map +1 -1
- package/package/lib/store/getStore.js +7 -2
- package/package/lib/store/getStore.js.map +1 -1
- package/package/lib/test/output.sdk.d.ts +128 -58
- package/package/lib/util/Drop.d.ts +1 -0
- package/package/lib/util/Drop.js +17 -4
- package/package/lib/util/Drop.js.map +1 -1
- package/package/lib/util/GetSslCertificate.js +7 -2
- package/package/lib/util/GetSslCertificate.js.map +1 -1
- package/package/lib/util/SubContainer.d.ts +62 -13
- package/package/lib/util/SubContainer.js +115 -81
- package/package/lib/util/SubContainer.js.map +1 -1
- package/package/lib/util/fileHelper.d.ts +7 -4
- package/package/lib/util/fileHelper.js +20 -7
- package/package/lib/util/fileHelper.js.map +1 -1
- package/package.json +10 -10
- package/base/lib/osBindings/NetworkInterfaceSetPublicParams.d.ts +0 -4
- package/base/lib/osBindings/NetworkInterfaceSetPublicParams.js +0 -4
- package/base/lib/osBindings/NetworkInterfaceSetPublicParams.js.map +0 -1
- package/base/lib/osBindings/UnsetPublicParams.d.ts +0 -3
- package/base/lib/osBindings/UnsetPublicParams.js +0 -4
- package/base/lib/osBindings/UnsetPublicParams.js.map +0 -1
|
@@ -68,56 +68,6 @@ export declare const sdk: {
|
|
|
68
68
|
};
|
|
69
69
|
nullIfEmpty: typeof import("../util").nullIfEmpty;
|
|
70
70
|
useEntrypoint: (overrideCmd?: string[]) => import("../types").UseEntrypoint;
|
|
71
|
-
runCommand: <A extends string>(effects: import("../types").Effects, image: {
|
|
72
|
-
imageId: "main";
|
|
73
|
-
sharedRun?: boolean;
|
|
74
|
-
}, command: import("../types").CommandType, options: import("../util/SubContainer").CommandOptions & {
|
|
75
|
-
mounts: import("../mainFn/Mounts").Mounts<{
|
|
76
|
-
id: "testOutput";
|
|
77
|
-
title: string;
|
|
78
|
-
license: string;
|
|
79
|
-
replaces: never[];
|
|
80
|
-
wrapperRepo: string;
|
|
81
|
-
upstreamRepo: string;
|
|
82
|
-
supportSite: string;
|
|
83
|
-
marketingSite: string;
|
|
84
|
-
donationUrl: null;
|
|
85
|
-
description: {
|
|
86
|
-
short: string;
|
|
87
|
-
long: string;
|
|
88
|
-
};
|
|
89
|
-
containers: {};
|
|
90
|
-
images: {
|
|
91
|
-
main: {
|
|
92
|
-
source: {
|
|
93
|
-
dockerTag: string;
|
|
94
|
-
};
|
|
95
|
-
arch: ["aarch64", "x86_64"];
|
|
96
|
-
emulateMissingAs: "aarch64";
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
volumes: never[];
|
|
100
|
-
assets: never[];
|
|
101
|
-
alerts: {
|
|
102
|
-
install: null;
|
|
103
|
-
update: null;
|
|
104
|
-
uninstall: null;
|
|
105
|
-
restore: null;
|
|
106
|
-
start: null;
|
|
107
|
-
stop: null;
|
|
108
|
-
};
|
|
109
|
-
dependencies: {
|
|
110
|
-
"remote-test": {
|
|
111
|
-
description: string;
|
|
112
|
-
optional: false;
|
|
113
|
-
s9pk: string;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
}>;
|
|
117
|
-
}, name?: string) => Promise<{
|
|
118
|
-
stdout: string | Buffer;
|
|
119
|
-
stderr: string | Buffer;
|
|
120
|
-
}>;
|
|
121
71
|
Action: {
|
|
122
72
|
withInput: <Id extends import("../types").ActionId, InputSpecType extends Record<string, any> | import("../../../base/lib/actions/input/builder").InputSpec<any, any> | import("../../../base/lib/actions/input/builder").InputSpec<any, never>>(id: Id, metadata: import("../../../base/lib/actions/setupActions").MaybeFn<Omit<import("../types").ActionMetadata, "hasInput">>, inputSpec: InputSpecType, getInput: import("../../../base/lib/actions/setupActions").GetInput<InputSpecType>, run: import("../../../base/lib/actions/setupActions").Run<InputSpecType>) => import("../../../base/lib/actions/setupActions").Action<Id, unknown, InputSpecType>;
|
|
123
73
|
withoutInput: <Id extends import("../types").ActionId>(id: Id, metadata: import("../../../base/lib/actions/setupActions").MaybeFn<Omit<import("../types").ActionMetadata, "hasInput">>, run: import("../../../base/lib/actions/setupActions").Run<{}>) => import("../../../base/lib/actions/setupActions").Action<Id, unknown, {}>;
|
|
@@ -170,7 +120,7 @@ export declare const sdk: {
|
|
|
170
120
|
successMessage?: string | undefined;
|
|
171
121
|
errorMessage?: string | undefined;
|
|
172
122
|
}) => Promise<import("../health/checkFns").HealthCheckResult>;
|
|
173
|
-
runHealthScript: (runCommand: string[], subcontainer: import("..").SubContainer
|
|
123
|
+
runHealthScript: <Manifest extends import("../types").SDKManifest>(runCommand: string[], subcontainer: import("..").SubContainer<Manifest>, { timeout, errorMessage, message, }?: {
|
|
174
124
|
timeout?: number | undefined;
|
|
175
125
|
errorMessage?: string | undefined;
|
|
176
126
|
message?: ((res: string) => string) | undefined;
|
|
@@ -796,7 +746,7 @@ export declare const sdk: {
|
|
|
796
746
|
s9pk: string;
|
|
797
747
|
};
|
|
798
748
|
};
|
|
799
|
-
}>;
|
|
749
|
+
}, never>;
|
|
800
750
|
};
|
|
801
751
|
Backups: {
|
|
802
752
|
volumes: (...volumeNames: never[]) => import("../backup/Backups").Backups<{
|
|
@@ -989,14 +939,134 @@ export declare const sdk: {
|
|
|
989
939
|
of(effects: import("../types").Effects, image: {
|
|
990
940
|
imageId: "main";
|
|
991
941
|
sharedRun?: boolean;
|
|
992
|
-
},
|
|
993
|
-
|
|
942
|
+
}, mounts: import("../mainFn/Mounts").Mounts<{
|
|
943
|
+
id: "testOutput";
|
|
944
|
+
title: string;
|
|
945
|
+
license: string;
|
|
946
|
+
replaces: never[];
|
|
947
|
+
wrapperRepo: string;
|
|
948
|
+
upstreamRepo: string;
|
|
949
|
+
supportSite: string;
|
|
950
|
+
marketingSite: string;
|
|
951
|
+
donationUrl: null;
|
|
952
|
+
description: {
|
|
953
|
+
short: string;
|
|
954
|
+
long: string;
|
|
955
|
+
};
|
|
956
|
+
containers: {};
|
|
957
|
+
images: {
|
|
958
|
+
main: {
|
|
959
|
+
source: {
|
|
960
|
+
dockerTag: string;
|
|
961
|
+
};
|
|
962
|
+
arch: ["aarch64", "x86_64"];
|
|
963
|
+
emulateMissingAs: "aarch64";
|
|
964
|
+
};
|
|
965
|
+
};
|
|
966
|
+
volumes: never[];
|
|
967
|
+
assets: never[];
|
|
968
|
+
alerts: {
|
|
969
|
+
install: null;
|
|
970
|
+
update: null;
|
|
971
|
+
uninstall: null;
|
|
972
|
+
restore: null;
|
|
973
|
+
start: null;
|
|
974
|
+
stop: null;
|
|
975
|
+
};
|
|
976
|
+
dependencies: {
|
|
977
|
+
"remote-test": {
|
|
978
|
+
description: string;
|
|
979
|
+
optional: false;
|
|
980
|
+
s9pk: string;
|
|
981
|
+
};
|
|
982
|
+
};
|
|
983
|
+
}, never> | null, name: string): Promise<import("..").SubContainer<import("../types").SDKManifest, import("../types").Effects>>;
|
|
984
|
+
withTemp<T>(effects: import("../types").Effects, image: {
|
|
994
985
|
imageId: "main";
|
|
995
986
|
sharedRun?: boolean;
|
|
996
|
-
}, mounts: {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
987
|
+
}, mounts: import("../mainFn/Mounts").Mounts<{
|
|
988
|
+
id: "testOutput";
|
|
989
|
+
title: string;
|
|
990
|
+
license: string;
|
|
991
|
+
replaces: never[];
|
|
992
|
+
wrapperRepo: string;
|
|
993
|
+
upstreamRepo: string;
|
|
994
|
+
supportSite: string;
|
|
995
|
+
marketingSite: string;
|
|
996
|
+
donationUrl: null;
|
|
997
|
+
description: {
|
|
998
|
+
short: string;
|
|
999
|
+
long: string;
|
|
1000
|
+
};
|
|
1001
|
+
containers: {};
|
|
1002
|
+
images: {
|
|
1003
|
+
main: {
|
|
1004
|
+
source: {
|
|
1005
|
+
dockerTag: string;
|
|
1006
|
+
};
|
|
1007
|
+
arch: ["aarch64", "x86_64"];
|
|
1008
|
+
emulateMissingAs: "aarch64";
|
|
1009
|
+
};
|
|
1010
|
+
};
|
|
1011
|
+
volumes: never[];
|
|
1012
|
+
assets: never[];
|
|
1013
|
+
alerts: {
|
|
1014
|
+
install: null;
|
|
1015
|
+
update: null;
|
|
1016
|
+
uninstall: null;
|
|
1017
|
+
restore: null;
|
|
1018
|
+
start: null;
|
|
1019
|
+
stop: null;
|
|
1020
|
+
};
|
|
1021
|
+
dependencies: {
|
|
1022
|
+
"remote-test": {
|
|
1023
|
+
description: string;
|
|
1024
|
+
optional: false;
|
|
1025
|
+
s9pk: string;
|
|
1026
|
+
};
|
|
1027
|
+
};
|
|
1028
|
+
}, never> | null, name: string, fn: (subContainer: import("..").SubContainer<{
|
|
1029
|
+
id: "testOutput";
|
|
1030
|
+
title: string;
|
|
1031
|
+
license: string;
|
|
1032
|
+
replaces: never[];
|
|
1033
|
+
wrapperRepo: string;
|
|
1034
|
+
upstreamRepo: string;
|
|
1035
|
+
supportSite: string;
|
|
1036
|
+
marketingSite: string;
|
|
1037
|
+
donationUrl: null;
|
|
1038
|
+
description: {
|
|
1039
|
+
short: string;
|
|
1040
|
+
long: string;
|
|
1041
|
+
};
|
|
1042
|
+
containers: {};
|
|
1043
|
+
images: {
|
|
1044
|
+
main: {
|
|
1045
|
+
source: {
|
|
1046
|
+
dockerTag: string;
|
|
1047
|
+
};
|
|
1048
|
+
arch: ["aarch64", "x86_64"];
|
|
1049
|
+
emulateMissingAs: "aarch64";
|
|
1050
|
+
};
|
|
1051
|
+
};
|
|
1052
|
+
volumes: never[];
|
|
1053
|
+
assets: never[];
|
|
1054
|
+
alerts: {
|
|
1055
|
+
install: null;
|
|
1056
|
+
update: null;
|
|
1057
|
+
uninstall: null;
|
|
1058
|
+
restore: null;
|
|
1059
|
+
start: null;
|
|
1060
|
+
stop: null;
|
|
1061
|
+
};
|
|
1062
|
+
dependencies: {
|
|
1063
|
+
"remote-test": {
|
|
1064
|
+
description: string;
|
|
1065
|
+
optional: false;
|
|
1066
|
+
s9pk: string;
|
|
1067
|
+
};
|
|
1068
|
+
};
|
|
1069
|
+
}, import("../types").Effects>) => Promise<T>): Promise<T>;
|
|
1000
1070
|
};
|
|
1001
1071
|
List: {
|
|
1002
1072
|
text: typeof import("../../../base/lib/actions/input/builder").List.text;
|
package/package/lib/util/Drop.js
CHANGED
|
@@ -5,9 +5,20 @@ class Drop {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
this.id = Drop.idCtr++;
|
|
7
7
|
this.ref = { id: this.id };
|
|
8
|
-
|
|
9
|
-
Drop.
|
|
8
|
+
const weak = this.weak();
|
|
9
|
+
Drop.weak[this.id] = weak;
|
|
10
|
+
Drop.registry.register(this.ref, this.id, this.ref);
|
|
11
|
+
return new Proxy(this, {
|
|
12
|
+
set(target, prop, value) {
|
|
13
|
+
if (prop === "ref")
|
|
14
|
+
return false;
|
|
15
|
+
target[prop] = value;
|
|
16
|
+
weak[prop] = value;
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
10
20
|
}
|
|
21
|
+
register() { }
|
|
11
22
|
weak() {
|
|
12
23
|
const weak = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
13
24
|
weak.ref = new WeakRef(this.ref);
|
|
@@ -15,14 +26,16 @@ class Drop {
|
|
|
15
26
|
}
|
|
16
27
|
drop() {
|
|
17
28
|
this.onDrop();
|
|
18
|
-
Drop.registry.unregister(this);
|
|
29
|
+
Drop.registry.unregister(this.ref);
|
|
19
30
|
delete Drop.weak[this.id];
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
33
|
exports.Drop = Drop;
|
|
23
34
|
Drop.weak = {};
|
|
24
35
|
Drop.registry = new FinalizationRegistry((id) => {
|
|
25
|
-
Drop.weak[id]
|
|
36
|
+
const weak = Drop.weak[id];
|
|
37
|
+
if (weak)
|
|
38
|
+
weak.drop();
|
|
26
39
|
});
|
|
27
40
|
Drop.idCtr = 0;
|
|
28
41
|
//# sourceMappingURL=Drop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drop.js","sourceRoot":"","sources":["../../../../package/lib/util/Drop.ts"],"names":[],"mappings":";;;AAAA,MAAsB,IAAI;
|
|
1
|
+
{"version":3,"file":"Drop.js","sourceRoot":"","sources":["../../../../package/lib/util/Drop.ts"],"names":[],"mappings":";;;AAAA,MAAsB,IAAI;IASxB;QACE,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QACtB,IAAI,CAAC,GAAG,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAA;QAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;QACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;QACzB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;QAEnD,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;YACrB,GAAG,CAAC,MAAW,EAAE,IAAI,EAAE,KAAK;gBAC1B,IAAI,IAAI,KAAK,KAAK;oBAAE,OAAO,KAAK,CAAA;gBAChC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CACnB;gBAAC,IAAY,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;gBAC5B,OAAO,IAAI,CAAA;YACb,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;IACS,QAAQ,KAAI,CAAC;IACb,IAAI;QACZ,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;QAC5E,IAAI,CAAC,GAAG,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI;QACF,IAAI,CAAC,MAAM,EAAE,CAAA;QACb,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;;AApCH,oBAqCC;AApCgB,SAAI,GAA2B,EAAE,CAAA;AACjC,aAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,EAAU,EAAE,EAAE;IAChE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1B,IAAI,IAAI;QAAE,IAAI,CAAC,IAAI,EAAE,CAAA;AACvB,CAAC,CAAC,CAAA;AACa,UAAK,GAAW,CAAC,CAAA"}
|
|
@@ -31,10 +31,15 @@ class GetSslCertificate {
|
|
|
31
31
|
* Watches the SSL Certificate for the given hostnames if permitted. Returns an async iterator that yields whenever the value changes
|
|
32
32
|
*/
|
|
33
33
|
async *watch() {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const resolveCell = { resolve: () => { } };
|
|
35
|
+
this.effects.onLeaveContext(() => {
|
|
36
|
+
resolveCell.resolve();
|
|
37
|
+
});
|
|
38
|
+
while (this.effects.isInContext) {
|
|
39
|
+
let callback = () => { };
|
|
36
40
|
const waitForNext = new Promise((resolve) => {
|
|
37
41
|
callback = resolve;
|
|
42
|
+
resolveCell.resolve = resolve;
|
|
38
43
|
});
|
|
39
44
|
yield await this.effects.getSslCertificate({
|
|
40
45
|
hostnames: this.hostnames,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetSslCertificate.js","sourceRoot":"","sources":["../../../../package/lib/util/GetSslCertificate.ts"],"names":[],"mappings":";;;AAGA,MAAa,iBAAiB;IAC5B,YACW,OAAgB,EAChB,SAAmB,EACnB,SAAuB;QAFvB,YAAO,GAAP,OAAO,CAAS;QAChB,cAAS,GAAT,SAAS,CAAU;QACnB,cAAS,GAAT,SAAS,CAAc;IAC/B,CAAC;IAEJ;;OAEG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;YACpC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EACN,IAAI,CAAC,OAAO,CAAC,UAAU;gBACvB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;SAC/D,CAAC,CAAA;IACJ,CAAC;IACD;;OAEG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;YACpC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,CAAC,KAAK;QACV,OAAO,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"GetSslCertificate.js","sourceRoot":"","sources":["../../../../package/lib/util/GetSslCertificate.ts"],"names":[],"mappings":";;;AAGA,MAAa,iBAAiB;IAC5B,YACW,OAAgB,EAChB,SAAmB,EACnB,SAAuB;QAFvB,YAAO,GAAP,OAAO,CAAS;QAChB,cAAS,GAAT,SAAS,CAAU;QACnB,cAAS,GAAT,SAAS,CAAc;IAC/B,CAAC;IAEJ;;OAEG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;YACpC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EACN,IAAI,CAAC,OAAO,CAAC,UAAU;gBACvB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;SAC/D,CAAC,CAAA;IACJ,CAAC;IACD;;OAEG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;YACpC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,CAAC,KAAK;QACV,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAA;QACzC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE;YAC/B,WAAW,CAAC,OAAO,EAAE,CAAA;QACvB,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAChC,IAAI,QAAQ,GAAe,GAAG,EAAE,GAAE,CAAC,CAAA;YACnC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBAChD,QAAQ,GAAG,OAAO,CAAA;gBAClB,WAAW,CAAC,OAAO,GAAG,OAAO,CAAA;YAC/B,CAAC,CAAC,CAAA;YACF,MAAM,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;gBACzC,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE;aAC3B,CAAC,CAAA;YACF,MAAM,WAAW,CAAA;QACnB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,QAGyB;QAEzB,CAAC;QAAA,CAAC,KAAK,IAAI,EAAE;YACX,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;gBACvC,IAAI,CAAC;oBACH,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAA;gBACvB,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CACX,+DAA+D,EAC/D,CAAC,CACF,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC,EAAE;aACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;aAC/B,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CACX,OAAO,CAAC,KAAK,CACX,+DAA+D,EAC/D,CAAC,CACF,CACF,CAAA;IACL,CAAC;CACF;AAjFD,8CAiFC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as T from "../../../base/lib/types";
|
|
2
2
|
import * as cp from "child_process";
|
|
3
3
|
import { Buffer } from "node:buffer";
|
|
4
|
+
import { Drop } from "./Drop";
|
|
5
|
+
import { Mounts } from "../mainFn/Mounts";
|
|
6
|
+
import { BackupEffects } from "../backup/Backups";
|
|
4
7
|
export declare const execFile: typeof cp.execFile.__promisify__;
|
|
5
8
|
type ExecResults = {
|
|
6
9
|
exitCode: number | null;
|
|
@@ -20,6 +23,10 @@ export type ExecOptions = {
|
|
|
20
23
|
export interface ExecSpawnable {
|
|
21
24
|
get destroy(): undefined | (() => Promise<null>);
|
|
22
25
|
exec(command: string[], options?: CommandOptions & ExecOptions, timeoutMs?: number | null): Promise<ExecResults>;
|
|
26
|
+
execFail(command: string[], options?: CommandOptions & ExecOptions, timeoutMs?: number | null): Promise<{
|
|
27
|
+
stdout: string | Buffer;
|
|
28
|
+
stderr: string | Buffer;
|
|
29
|
+
}>;
|
|
23
30
|
spawn(command: string[], options?: CommandOptions & StdioOptions): Promise<cp.ChildProcess>;
|
|
24
31
|
}
|
|
25
32
|
/**
|
|
@@ -28,37 +35,66 @@ export interface ExecSpawnable {
|
|
|
28
35
|
* Implements:
|
|
29
36
|
* @see {@link ExecSpawnable}
|
|
30
37
|
*/
|
|
31
|
-
export declare class SubContainer implements ExecSpawnable {
|
|
32
|
-
readonly effects:
|
|
38
|
+
export declare class SubContainer<Manifest extends T.SDKManifest, Effects extends T.Effects = T.Effects> extends Drop implements ExecSpawnable {
|
|
39
|
+
readonly effects: Effects;
|
|
33
40
|
readonly imageId: T.ImageId;
|
|
34
41
|
readonly rootfs: string;
|
|
35
42
|
readonly guid: T.Guid;
|
|
36
|
-
private
|
|
37
|
-
private static registry;
|
|
43
|
+
private destroyed;
|
|
38
44
|
private leader;
|
|
39
45
|
private leaderExited;
|
|
40
46
|
private waitProc;
|
|
41
47
|
private constructor();
|
|
42
|
-
static of(effects:
|
|
43
|
-
imageId: T.ImageId;
|
|
48
|
+
static of<Manifest extends T.SDKManifest, Effects extends T.Effects>(effects: Effects, image: {
|
|
49
|
+
imageId: keyof Manifest["images"] & T.ImageId;
|
|
44
50
|
sharedRun?: boolean;
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
}, mounts: (Effects extends BackupEffects ? Mounts<Manifest, {
|
|
52
|
+
subpath: string | null;
|
|
53
|
+
mountpoint: string;
|
|
54
|
+
}> : Mounts<Manifest, never>) | null, name: string): Promise<SubContainer<T.SDKManifest, Effects>>;
|
|
55
|
+
static withTemp<Manifest extends T.SDKManifest, T, Effects extends T.Effects>(effects: Effects, image: {
|
|
56
|
+
imageId: keyof Manifest["images"] & T.ImageId;
|
|
48
57
|
sharedRun?: boolean;
|
|
49
|
-
}, mounts: {
|
|
50
|
-
|
|
58
|
+
}, mounts: (Effects extends BackupEffects ? Mounts<Manifest, {
|
|
59
|
+
subpath: string | null;
|
|
60
|
+
mountpoint: string;
|
|
61
|
+
}> : Mounts<Manifest, never>) | null, name: string, fn: (subContainer: SubContainer<Manifest, Effects>) => Promise<T>): Promise<T>;
|
|
62
|
+
mount(mounts: Effects extends BackupEffects ? Mounts<Manifest, {
|
|
63
|
+
subpath: string | null;
|
|
51
64
|
mountpoint: string;
|
|
52
|
-
}
|
|
53
|
-
mount(options: MountOptions, path: string): Promise<SubContainer>;
|
|
65
|
+
}> : Mounts<Manifest, never>): Promise<SubContainer<Manifest, Effects>>;
|
|
54
66
|
private killLeader;
|
|
55
67
|
get destroy(): () => Promise<null>;
|
|
68
|
+
onDrop(): void;
|
|
69
|
+
/**
|
|
70
|
+
* @description run a command inside this subcontainer
|
|
71
|
+
* DOES NOT THROW ON NONZERO EXIT CODE (see execFail)
|
|
72
|
+
* @param commands an array representing the command and args to execute
|
|
73
|
+
* @param options
|
|
74
|
+
* @param timeoutMs how long to wait before killing the command in ms
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
56
77
|
exec(command: string[], options?: CommandOptions & ExecOptions, timeoutMs?: number | null): Promise<{
|
|
78
|
+
throw: () => {
|
|
79
|
+
stdout: string | Buffer;
|
|
80
|
+
stderr: string | Buffer;
|
|
81
|
+
};
|
|
57
82
|
exitCode: number | null;
|
|
58
83
|
exitSignal: NodeJS.Signals | null;
|
|
59
84
|
stdout: string | Buffer;
|
|
60
85
|
stderr: string | Buffer;
|
|
61
86
|
}>;
|
|
87
|
+
/**
|
|
88
|
+
* @description run a command inside this subcontainer, throwing on non-zero exit status
|
|
89
|
+
* @param commands an array representing the command and args to execute
|
|
90
|
+
* @param options
|
|
91
|
+
* @param timeoutMs how long to wait before killing the command in ms
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
94
|
+
execFail(command: string[], options?: CommandOptions & ExecOptions, timeoutMs?: number | null): Promise<{
|
|
95
|
+
stdout: string | Buffer;
|
|
96
|
+
stderr: string | Buffer;
|
|
97
|
+
}>;
|
|
62
98
|
launch(command: string[], options?: CommandOptions): Promise<cp.ChildProcessWithoutNullStreams>;
|
|
63
99
|
spawn(command: string[], options?: CommandOptions & StdioOptions): Promise<cp.ChildProcess>;
|
|
64
100
|
}
|
|
@@ -72,13 +108,26 @@ export declare class SubContainerHandle implements ExecSpawnable {
|
|
|
72
108
|
constructor(subContainer: ExecSpawnable);
|
|
73
109
|
get destroy(): undefined;
|
|
74
110
|
exec(command: string[], options?: CommandOptions, timeoutMs?: number | null): Promise<ExecResults>;
|
|
111
|
+
execFail(command: string[], options?: CommandOptions & ExecOptions, timeoutMs?: number | null): Promise<{
|
|
112
|
+
stdout: string | Buffer;
|
|
113
|
+
stderr: string | Buffer;
|
|
114
|
+
}>;
|
|
75
115
|
spawn(command: string[], options?: CommandOptions & StdioOptions): Promise<cp.ChildProcess>;
|
|
76
116
|
}
|
|
77
117
|
export type CommandOptions = {
|
|
118
|
+
/**
|
|
119
|
+
* Environment variables to set for this command
|
|
120
|
+
*/
|
|
78
121
|
env?: {
|
|
79
122
|
[variable: string]: string;
|
|
80
123
|
};
|
|
124
|
+
/**
|
|
125
|
+
* the working directory to run this command in
|
|
126
|
+
*/
|
|
81
127
|
cwd?: string;
|
|
128
|
+
/**
|
|
129
|
+
* the user to run this command as
|
|
130
|
+
*/
|
|
82
131
|
user?: string;
|
|
83
132
|
};
|
|
84
133
|
export type StdioOptions = {
|