@start9labs/start-sdk 0.4.0-beta.58 → 0.4.0-beta.59
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 +1 -1
- package/base/lib/osBindings/SetupInfo.d.ts +1 -0
- package/base/lib/util/GetContainerIp.d.ts +13 -0
- package/base/lib/util/GetContainerIp.js +16 -0
- package/base/lib/util/GetContainerIp.js.map +1 -0
- package/base/lib/util/GetHostInfo.d.ts +15 -0
- package/base/lib/util/GetHostInfo.js +16 -0
- package/base/lib/util/GetHostInfo.js.map +1 -0
- package/base/lib/util/GetOutboundGateway.d.ts +4 -27
- package/base/lib/util/GetOutboundGateway.js +6 -82
- package/base/lib/util/GetOutboundGateway.js.map +1 -1
- package/base/lib/util/GetServiceManifest.d.ts +13 -0
- package/base/lib/util/GetServiceManifest.js +16 -0
- package/base/lib/util/GetServiceManifest.js.map +1 -0
- package/base/lib/util/GetSslCertificate.d.ts +14 -0
- package/base/lib/util/GetSslCertificate.js +16 -0
- package/base/lib/util/GetSslCertificate.js.map +1 -0
- package/base/lib/util/GetStatus.d.ts +13 -0
- package/base/lib/util/GetStatus.js +16 -0
- package/base/lib/util/GetStatus.js.map +1 -0
- package/base/lib/util/GetSystemSmtp.d.ts +4 -27
- package/base/lib/util/GetSystemSmtp.js +6 -82
- package/base/lib/util/GetSystemSmtp.js.map +1 -1
- package/base/lib/util/Watchable.d.ts +32 -0
- package/base/lib/util/Watchable.js +87 -0
- package/base/lib/util/Watchable.js.map +1 -0
- package/base/lib/util/getServiceInterface.d.ts +3 -2
- package/base/lib/util/getServiceInterface.js +4 -1
- package/base/lib/util/getServiceInterface.js.map +1 -1
- package/base/lib/util/index.d.ts +6 -0
- package/base/lib/util/index.js +13 -1
- package/base/lib/util/index.js.map +1 -1
- package/package/lib/StartSdk.d.ts +3 -3
- package/package/lib/test/output.sdk.d.ts +3 -3
- package/package/lib/version/VersionGraph.js +3 -0
- package/package/lib/version/VersionGraph.js.map +1 -1
- package/package/package.json +1 -1
- package/package.json +1 -1
- package/base/lib/osBindings/Hostname.d.ts +0 -1
- package/base/lib/osBindings/Hostname.js +0 -4
- package/base/lib/osBindings/Hostname.js.map +0 -1
- package/package/lib/test/output.d.ts +0 -158
- package/package/lib/test/output.js +0 -446
- package/package/lib/test/output.js.map +0 -1
package/base/lib/Effects.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export type Effects = {
|
|
|
46
46
|
getStatus(options: {
|
|
47
47
|
packageId?: PackageId;
|
|
48
48
|
callback?: () => void;
|
|
49
|
-
}): Promise<StatusInfo>;
|
|
49
|
+
}): Promise<StatusInfo | null>;
|
|
50
50
|
/** DEPRECATED: indicate to the host os what runstate the service is in */
|
|
51
51
|
setMainStatus(options: SetMainStatus): Promise<null>;
|
|
52
52
|
/** Set the dependencies of what the service needs, usually run during the inputSpec action as a best practice */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Effects } from '../Effects';
|
|
2
|
+
import { PackageId } from '../osBindings';
|
|
3
|
+
import { Watchable } from './Watchable';
|
|
4
|
+
export declare class GetContainerIp extends Watchable<string> {
|
|
5
|
+
readonly opts: {
|
|
6
|
+
packageId?: PackageId;
|
|
7
|
+
};
|
|
8
|
+
protected readonly label = "GetContainerIp";
|
|
9
|
+
constructor(effects: Effects, opts?: {
|
|
10
|
+
packageId?: PackageId;
|
|
11
|
+
});
|
|
12
|
+
protected call(callback?: () => void): Promise<string>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetContainerIp = void 0;
|
|
4
|
+
const Watchable_1 = require("./Watchable");
|
|
5
|
+
class GetContainerIp extends Watchable_1.Watchable {
|
|
6
|
+
constructor(effects, opts = {}) {
|
|
7
|
+
super(effects);
|
|
8
|
+
this.opts = opts;
|
|
9
|
+
this.label = 'GetContainerIp';
|
|
10
|
+
}
|
|
11
|
+
call(callback) {
|
|
12
|
+
return this.effects.getContainerIp({ ...this.opts, callback });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.GetContainerIp = GetContainerIp;
|
|
16
|
+
//# sourceMappingURL=GetContainerIp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetContainerIp.js","sourceRoot":"","sources":["../../../../base/lib/util/GetContainerIp.ts"],"names":[],"mappings":";;;AAEA,2CAAuC;AAEvC,MAAa,cAAe,SAAQ,qBAAiB;IAGnD,YACE,OAAgB,EACP,OAAkC,EAAE;QAE7C,KAAK,CAAC,OAAO,CAAC,CAAA;QAFL,SAAI,GAAJ,IAAI,CAAgC;QAJ5B,UAAK,GAAG,gBAAgB,CAAA;IAO3C,CAAC;IAES,IAAI,CAAC,QAAqB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IAChE,CAAC;CACF;AAbD,wCAaC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Effects } from '../Effects';
|
|
2
|
+
import { Host, HostId, PackageId } from '../osBindings';
|
|
3
|
+
import { Watchable } from './Watchable';
|
|
4
|
+
export declare class GetHostInfo extends Watchable<Host | null> {
|
|
5
|
+
readonly opts: {
|
|
6
|
+
hostId: HostId;
|
|
7
|
+
packageId?: PackageId;
|
|
8
|
+
};
|
|
9
|
+
protected readonly label = "GetHostInfo";
|
|
10
|
+
constructor(effects: Effects, opts: {
|
|
11
|
+
hostId: HostId;
|
|
12
|
+
packageId?: PackageId;
|
|
13
|
+
});
|
|
14
|
+
protected call(callback?: () => void): Promise<Host | null>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetHostInfo = void 0;
|
|
4
|
+
const Watchable_1 = require("./Watchable");
|
|
5
|
+
class GetHostInfo extends Watchable_1.Watchable {
|
|
6
|
+
constructor(effects, opts) {
|
|
7
|
+
super(effects);
|
|
8
|
+
this.opts = opts;
|
|
9
|
+
this.label = 'GetHostInfo';
|
|
10
|
+
}
|
|
11
|
+
call(callback) {
|
|
12
|
+
return this.effects.getHostInfo({ ...this.opts, callback });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.GetHostInfo = GetHostInfo;
|
|
16
|
+
//# sourceMappingURL=GetHostInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetHostInfo.js","sourceRoot":"","sources":["../../../../base/lib/util/GetHostInfo.ts"],"names":[],"mappings":";;;AAEA,2CAAuC;AAEvC,MAAa,WAAY,SAAQ,qBAAsB;IAGrD,YACE,OAAgB,EACP,IAA+C;QAExD,KAAK,CAAC,OAAO,CAAC,CAAA;QAFL,SAAI,GAAJ,IAAI,CAA2C;QAJvC,UAAK,GAAG,aAAa,CAAA;IAOxC,CAAC;IAES,IAAI,CAAC,QAAqB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC7D,CAAC;CACF;AAbD,kCAaC"}
|
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
import { Effects } from '../Effects';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { Watchable } from './Watchable';
|
|
3
|
+
export declare class GetOutboundGateway extends Watchable<string> {
|
|
4
|
+
protected readonly label = "GetOutboundGateway";
|
|
4
5
|
constructor(effects: Effects);
|
|
5
|
-
|
|
6
|
-
* Returns the effective outbound gateway. Reruns the context from which it has been called if the underlying value changes
|
|
7
|
-
*/
|
|
8
|
-
const(): Promise<string>;
|
|
9
|
-
/**
|
|
10
|
-
* Returns the effective outbound gateway. Does nothing if the value changes
|
|
11
|
-
*/
|
|
12
|
-
once(): Promise<string>;
|
|
13
|
-
private watchGen;
|
|
14
|
-
/**
|
|
15
|
-
* Watches the effective outbound gateway. Returns an async iterator that yields whenever the value changes
|
|
16
|
-
*/
|
|
17
|
-
watch(abort?: AbortSignal): AsyncGenerator<string, never, unknown>;
|
|
18
|
-
/**
|
|
19
|
-
* Watches the effective outbound gateway. Takes a custom callback function to run whenever the value changes
|
|
20
|
-
*/
|
|
21
|
-
onChange(callback: (value: string, error?: Error) => {
|
|
22
|
-
cancel: boolean;
|
|
23
|
-
} | Promise<{
|
|
24
|
-
cancel: boolean;
|
|
25
|
-
}>): void;
|
|
26
|
-
/**
|
|
27
|
-
* Watches the effective outbound gateway. Returns when the predicate is true
|
|
28
|
-
*/
|
|
29
|
-
waitFor(pred: (value: string) => boolean): Promise<string>;
|
|
6
|
+
protected call(callback?: () => void): Promise<string>;
|
|
30
7
|
}
|
|
@@ -1,90 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetOutboundGateway = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
class GetOutboundGateway {
|
|
4
|
+
const Watchable_1 = require("./Watchable");
|
|
5
|
+
class GetOutboundGateway extends Watchable_1.Watchable {
|
|
7
6
|
constructor(effects) {
|
|
8
|
-
|
|
7
|
+
super(effects);
|
|
8
|
+
this.label = 'GetOutboundGateway';
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
const() {
|
|
14
|
-
return this.effects.getOutboundGateway({
|
|
15
|
-
callback: this.effects.constRetry &&
|
|
16
|
-
(() => this.effects.constRetry && this.effects.constRetry()),
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Returns the effective outbound gateway. Does nothing if the value changes
|
|
21
|
-
*/
|
|
22
|
-
once() {
|
|
23
|
-
return this.effects.getOutboundGateway({});
|
|
24
|
-
}
|
|
25
|
-
async *watchGen(abort) {
|
|
26
|
-
const resolveCell = { resolve: () => { } };
|
|
27
|
-
this.effects.onLeaveContext(() => {
|
|
28
|
-
resolveCell.resolve();
|
|
29
|
-
});
|
|
30
|
-
abort?.addEventListener('abort', () => resolveCell.resolve());
|
|
31
|
-
while (this.effects.isInContext && !abort?.aborted) {
|
|
32
|
-
let callback = () => { };
|
|
33
|
-
const waitForNext = new Promise((resolve) => {
|
|
34
|
-
callback = resolve;
|
|
35
|
-
resolveCell.resolve = resolve;
|
|
36
|
-
});
|
|
37
|
-
yield await this.effects.getOutboundGateway({
|
|
38
|
-
callback: () => callback(),
|
|
39
|
-
});
|
|
40
|
-
await waitForNext;
|
|
41
|
-
}
|
|
42
|
-
return new Promise((_, rej) => rej(new AbortedError_1.AbortedError()));
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Watches the effective outbound gateway. Returns an async iterator that yields whenever the value changes
|
|
46
|
-
*/
|
|
47
|
-
watch(abort) {
|
|
48
|
-
const ctrl = new AbortController();
|
|
49
|
-
abort?.addEventListener('abort', () => ctrl.abort());
|
|
50
|
-
return Drop_1.DropGenerator.of(this.watchGen(ctrl.signal), () => ctrl.abort());
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Watches the effective outbound gateway. Takes a custom callback function to run whenever the value changes
|
|
54
|
-
*/
|
|
55
|
-
onChange(callback) {
|
|
56
|
-
;
|
|
57
|
-
(async () => {
|
|
58
|
-
const ctrl = new AbortController();
|
|
59
|
-
for await (const value of this.watch(ctrl.signal)) {
|
|
60
|
-
try {
|
|
61
|
-
const res = await callback(value);
|
|
62
|
-
if (res.cancel) {
|
|
63
|
-
ctrl.abort();
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
console.error('callback function threw an error @ GetOutboundGateway.onChange', e);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})()
|
|
72
|
-
.catch((e) => callback('', e))
|
|
73
|
-
.catch((e) => console.error('callback function threw an error @ GetOutboundGateway.onChange', e));
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Watches the effective outbound gateway. Returns when the predicate is true
|
|
77
|
-
*/
|
|
78
|
-
waitFor(pred) {
|
|
79
|
-
const ctrl = new AbortController();
|
|
80
|
-
return Drop_1.DropPromise.of(Promise.resolve().then(async () => {
|
|
81
|
-
for await (const next of this.watchGen(ctrl.signal)) {
|
|
82
|
-
if (pred(next)) {
|
|
83
|
-
return next;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return '';
|
|
87
|
-
}), () => ctrl.abort());
|
|
10
|
+
call(callback) {
|
|
11
|
+
return this.effects.getOutboundGateway({ callback });
|
|
88
12
|
}
|
|
89
13
|
}
|
|
90
14
|
exports.GetOutboundGateway = GetOutboundGateway;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetOutboundGateway.js","sourceRoot":"","sources":["../../../../base/lib/util/GetOutboundGateway.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"GetOutboundGateway.js","sourceRoot":"","sources":["../../../../base/lib/util/GetOutboundGateway.ts"],"names":[],"mappings":";;;AACA,2CAAuC;AAEvC,MAAa,kBAAmB,SAAQ,qBAAiB;IAGvD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAA;QAHG,UAAK,GAAG,oBAAoB,CAAA;IAI/C,CAAC;IAES,IAAI,CAAC,QAAqB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IACtD,CAAC;CACF;AAVD,gDAUC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Effects } from '../Effects';
|
|
2
|
+
import { Manifest, PackageId } from '../osBindings';
|
|
3
|
+
import { Watchable } from './Watchable';
|
|
4
|
+
export declare class GetServiceManifest extends Watchable<Manifest> {
|
|
5
|
+
readonly opts: {
|
|
6
|
+
packageId: PackageId;
|
|
7
|
+
};
|
|
8
|
+
protected readonly label = "GetServiceManifest";
|
|
9
|
+
constructor(effects: Effects, opts: {
|
|
10
|
+
packageId: PackageId;
|
|
11
|
+
});
|
|
12
|
+
protected call(callback?: () => void): Promise<Manifest>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetServiceManifest = void 0;
|
|
4
|
+
const Watchable_1 = require("./Watchable");
|
|
5
|
+
class GetServiceManifest extends Watchable_1.Watchable {
|
|
6
|
+
constructor(effects, opts) {
|
|
7
|
+
super(effects);
|
|
8
|
+
this.opts = opts;
|
|
9
|
+
this.label = 'GetServiceManifest';
|
|
10
|
+
}
|
|
11
|
+
call(callback) {
|
|
12
|
+
return this.effects.getServiceManifest({ ...this.opts, callback });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.GetServiceManifest = GetServiceManifest;
|
|
16
|
+
//# sourceMappingURL=GetServiceManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetServiceManifest.js","sourceRoot":"","sources":["../../../../base/lib/util/GetServiceManifest.ts"],"names":[],"mappings":";;;AAEA,2CAAuC;AAEvC,MAAa,kBAAmB,SAAQ,qBAAmB;IAGzD,YACE,OAAgB,EACP,IAA8B;QAEvC,KAAK,CAAC,OAAO,CAAC,CAAA;QAFL,SAAI,GAAJ,IAAI,CAA0B;QAJtB,UAAK,GAAG,oBAAoB,CAAA;IAO/C,CAAC;IAES,IAAI,CAAC,QAAqB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IACpE,CAAC;CACF;AAbD,gDAaC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Effects } from '../Effects';
|
|
2
|
+
import { Watchable } from './Watchable';
|
|
3
|
+
export declare class GetSslCertificate extends Watchable<[string, string, string]> {
|
|
4
|
+
readonly opts: {
|
|
5
|
+
hostnames: string[];
|
|
6
|
+
algorithm?: 'ecdsa' | 'ed25519';
|
|
7
|
+
};
|
|
8
|
+
protected readonly label = "GetSslCertificate";
|
|
9
|
+
constructor(effects: Effects, opts: {
|
|
10
|
+
hostnames: string[];
|
|
11
|
+
algorithm?: 'ecdsa' | 'ed25519';
|
|
12
|
+
});
|
|
13
|
+
protected call(callback?: () => void): Promise<[string, string, string]>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetSslCertificate = void 0;
|
|
4
|
+
const Watchable_1 = require("./Watchable");
|
|
5
|
+
class GetSslCertificate extends Watchable_1.Watchable {
|
|
6
|
+
constructor(effects, opts) {
|
|
7
|
+
super(effects);
|
|
8
|
+
this.opts = opts;
|
|
9
|
+
this.label = 'GetSslCertificate';
|
|
10
|
+
}
|
|
11
|
+
call(callback) {
|
|
12
|
+
return this.effects.getSslCertificate({ ...this.opts, callback });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.GetSslCertificate = GetSslCertificate;
|
|
16
|
+
//# sourceMappingURL=GetSslCertificate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetSslCertificate.js","sourceRoot":"","sources":["../../../../base/lib/util/GetSslCertificate.ts"],"names":[],"mappings":";;;AACA,2CAAuC;AAEvC,MAAa,iBAAkB,SAAQ,qBAAmC;IAGxE,YACE,OAAgB,EACP,IAGR;QAED,KAAK,CAAC,OAAO,CAAC,CAAA;QALL,SAAI,GAAJ,IAAI,CAGZ;QAPgB,UAAK,GAAG,mBAAmB,CAAA;IAU9C,CAAC;IAES,IAAI,CAAC,QAAqB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IACnE,CAAC;CACF;AAhBD,8CAgBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Effects } from '../Effects';
|
|
2
|
+
import { PackageId, StatusInfo } from '../osBindings';
|
|
3
|
+
import { Watchable } from './Watchable';
|
|
4
|
+
export declare class GetStatus extends Watchable<StatusInfo | null> {
|
|
5
|
+
readonly opts: {
|
|
6
|
+
packageId?: PackageId;
|
|
7
|
+
};
|
|
8
|
+
protected readonly label = "GetStatus";
|
|
9
|
+
constructor(effects: Effects, opts?: {
|
|
10
|
+
packageId?: PackageId;
|
|
11
|
+
});
|
|
12
|
+
protected call(callback?: () => void): Promise<StatusInfo | null>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetStatus = void 0;
|
|
4
|
+
const Watchable_1 = require("./Watchable");
|
|
5
|
+
class GetStatus extends Watchable_1.Watchable {
|
|
6
|
+
constructor(effects, opts = {}) {
|
|
7
|
+
super(effects);
|
|
8
|
+
this.opts = opts;
|
|
9
|
+
this.label = 'GetStatus';
|
|
10
|
+
}
|
|
11
|
+
call(callback) {
|
|
12
|
+
return this.effects.getStatus({ ...this.opts, callback });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.GetStatus = GetStatus;
|
|
16
|
+
//# sourceMappingURL=GetStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetStatus.js","sourceRoot":"","sources":["../../../../base/lib/util/GetStatus.ts"],"names":[],"mappings":";;;AAEA,2CAAuC;AAEvC,MAAa,SAAU,SAAQ,qBAA4B;IAGzD,YACE,OAAgB,EACP,OAAkC,EAAE;QAE7C,KAAK,CAAC,OAAO,CAAC,CAAA;QAFL,SAAI,GAAJ,IAAI,CAAgC;QAJ5B,UAAK,GAAG,WAAW,CAAA;IAOtC,CAAC;IAES,IAAI,CAAC,QAAqB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC3D,CAAC;CACF;AAbD,8BAaC"}
|
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
import { Effects } from '../Effects';
|
|
2
2
|
import * as T from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { Watchable } from './Watchable';
|
|
4
|
+
export declare class GetSystemSmtp extends Watchable<T.SmtpValue | null> {
|
|
5
|
+
protected readonly label = "GetSystemSmtp";
|
|
5
6
|
constructor(effects: Effects);
|
|
6
|
-
|
|
7
|
-
* Returns the system SMTP credentials. Reruns the context from which it has been called if the underlying value changes
|
|
8
|
-
*/
|
|
9
|
-
const(): Promise<T.SmtpValue | null>;
|
|
10
|
-
/**
|
|
11
|
-
* Returns the system SMTP credentials. Does nothing if the credentials change
|
|
12
|
-
*/
|
|
13
|
-
once(): Promise<T.SmtpValue | null>;
|
|
14
|
-
private watchGen;
|
|
15
|
-
/**
|
|
16
|
-
* Watches the system SMTP credentials. Returns an async iterator that yields whenever the value changes
|
|
17
|
-
*/
|
|
18
|
-
watch(abort?: AbortSignal): AsyncGenerator<T.SmtpValue | null, never, unknown>;
|
|
19
|
-
/**
|
|
20
|
-
* Watches the system SMTP credentials. Takes a custom callback function to run whenever the credentials change
|
|
21
|
-
*/
|
|
22
|
-
onChange(callback: (value: T.SmtpValue | null, error?: Error) => {
|
|
23
|
-
cancel: boolean;
|
|
24
|
-
} | Promise<{
|
|
25
|
-
cancel: boolean;
|
|
26
|
-
}>): void;
|
|
27
|
-
/**
|
|
28
|
-
* Watches the system SMTP credentials. Returns when the predicate is true
|
|
29
|
-
*/
|
|
30
|
-
waitFor(pred: (value: T.SmtpValue | null) => boolean): Promise<T.SmtpValue | null>;
|
|
7
|
+
protected call(callback?: () => void): Promise<T.SmtpValue | null>;
|
|
31
8
|
}
|
|
@@ -1,90 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetSystemSmtp = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
class GetSystemSmtp {
|
|
4
|
+
const Watchable_1 = require("./Watchable");
|
|
5
|
+
class GetSystemSmtp extends Watchable_1.Watchable {
|
|
7
6
|
constructor(effects) {
|
|
8
|
-
|
|
7
|
+
super(effects);
|
|
8
|
+
this.label = 'GetSystemSmtp';
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
const() {
|
|
14
|
-
return this.effects.getSystemSmtp({
|
|
15
|
-
callback: this.effects.constRetry &&
|
|
16
|
-
(() => this.effects.constRetry && this.effects.constRetry()),
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Returns the system SMTP credentials. Does nothing if the credentials change
|
|
21
|
-
*/
|
|
22
|
-
once() {
|
|
23
|
-
return this.effects.getSystemSmtp({});
|
|
24
|
-
}
|
|
25
|
-
async *watchGen(abort) {
|
|
26
|
-
const resolveCell = { resolve: () => { } };
|
|
27
|
-
this.effects.onLeaveContext(() => {
|
|
28
|
-
resolveCell.resolve();
|
|
29
|
-
});
|
|
30
|
-
abort?.addEventListener('abort', () => resolveCell.resolve());
|
|
31
|
-
while (this.effects.isInContext && !abort?.aborted) {
|
|
32
|
-
let callback = () => { };
|
|
33
|
-
const waitForNext = new Promise((resolve) => {
|
|
34
|
-
callback = resolve;
|
|
35
|
-
resolveCell.resolve = resolve;
|
|
36
|
-
});
|
|
37
|
-
yield await this.effects.getSystemSmtp({
|
|
38
|
-
callback: () => callback(),
|
|
39
|
-
});
|
|
40
|
-
await waitForNext;
|
|
41
|
-
}
|
|
42
|
-
return new Promise((_, rej) => rej(new AbortedError_1.AbortedError()));
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Watches the system SMTP credentials. Returns an async iterator that yields whenever the value changes
|
|
46
|
-
*/
|
|
47
|
-
watch(abort) {
|
|
48
|
-
const ctrl = new AbortController();
|
|
49
|
-
abort?.addEventListener('abort', () => ctrl.abort());
|
|
50
|
-
return Drop_1.DropGenerator.of(this.watchGen(ctrl.signal), () => ctrl.abort());
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Watches the system SMTP credentials. Takes a custom callback function to run whenever the credentials change
|
|
54
|
-
*/
|
|
55
|
-
onChange(callback) {
|
|
56
|
-
;
|
|
57
|
-
(async () => {
|
|
58
|
-
const ctrl = new AbortController();
|
|
59
|
-
for await (const value of this.watch(ctrl.signal)) {
|
|
60
|
-
try {
|
|
61
|
-
const res = await callback(value);
|
|
62
|
-
if (res.cancel) {
|
|
63
|
-
ctrl.abort();
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
console.error('callback function threw an error @ GetSystemSmtp.onChange', e);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})()
|
|
72
|
-
.catch((e) => callback(null, e))
|
|
73
|
-
.catch((e) => console.error('callback function threw an error @ GetSystemSmtp.onChange', e));
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Watches the system SMTP credentials. Returns when the predicate is true
|
|
77
|
-
*/
|
|
78
|
-
waitFor(pred) {
|
|
79
|
-
const ctrl = new AbortController();
|
|
80
|
-
return Drop_1.DropPromise.of(Promise.resolve().then(async () => {
|
|
81
|
-
for await (const next of this.watchGen(ctrl.signal)) {
|
|
82
|
-
if (pred(next)) {
|
|
83
|
-
return next;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
}), () => ctrl.abort());
|
|
10
|
+
call(callback) {
|
|
11
|
+
return this.effects.getSystemSmtp({ callback });
|
|
88
12
|
}
|
|
89
13
|
}
|
|
90
14
|
exports.GetSystemSmtp = GetSystemSmtp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetSystemSmtp.js","sourceRoot":"","sources":["../../../../base/lib/util/GetSystemSmtp.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"GetSystemSmtp.js","sourceRoot":"","sources":["../../../../base/lib/util/GetSystemSmtp.ts"],"names":[],"mappings":";;;AAEA,2CAAuC;AAEvC,MAAa,aAAc,SAAQ,qBAA6B;IAG9D,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAA;QAHG,UAAK,GAAG,eAAe,CAAA;IAI1C,CAAC;IAES,IAAI,CAAC,QAAqB;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IACjD,CAAC;CACF;AAVD,sCAUC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Effects } from '../Effects';
|
|
2
|
+
export declare abstract class Watchable<T> {
|
|
3
|
+
readonly effects: Effects;
|
|
4
|
+
constructor(effects: Effects);
|
|
5
|
+
protected abstract call(callback?: () => void): Promise<T>;
|
|
6
|
+
protected abstract readonly label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the value. Reruns the context from which it has been called if the underlying value changes
|
|
9
|
+
*/
|
|
10
|
+
const(): Promise<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the value. Does nothing if the value changes
|
|
13
|
+
*/
|
|
14
|
+
once(): Promise<T>;
|
|
15
|
+
private watchGen;
|
|
16
|
+
/**
|
|
17
|
+
* Watches the value. Returns an async iterator that yields whenever the value changes
|
|
18
|
+
*/
|
|
19
|
+
watch(abort?: AbortSignal): AsyncGenerator<T, never, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Watches the value. Takes a custom callback function to run whenever the value changes
|
|
22
|
+
*/
|
|
23
|
+
onChange(callback: (value: T | undefined, error?: Error) => {
|
|
24
|
+
cancel: boolean;
|
|
25
|
+
} | Promise<{
|
|
26
|
+
cancel: boolean;
|
|
27
|
+
}>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Watches the value. Returns when the predicate is true
|
|
30
|
+
*/
|
|
31
|
+
waitFor(pred: (value: T) => boolean): Promise<T>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Watchable = void 0;
|
|
4
|
+
const AbortedError_1 = require("./AbortedError");
|
|
5
|
+
const Drop_1 = require("./Drop");
|
|
6
|
+
class Watchable {
|
|
7
|
+
constructor(effects) {
|
|
8
|
+
this.effects = effects;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns the value. Reruns the context from which it has been called if the underlying value changes
|
|
12
|
+
*/
|
|
13
|
+
const() {
|
|
14
|
+
return this.call(this.effects.constRetry &&
|
|
15
|
+
(() => this.effects.constRetry && this.effects.constRetry()));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns the value. Does nothing if the value changes
|
|
19
|
+
*/
|
|
20
|
+
once() {
|
|
21
|
+
return this.call();
|
|
22
|
+
}
|
|
23
|
+
async *watchGen(abort) {
|
|
24
|
+
const resolveCell = { resolve: () => { } };
|
|
25
|
+
this.effects.onLeaveContext(() => {
|
|
26
|
+
resolveCell.resolve();
|
|
27
|
+
});
|
|
28
|
+
abort?.addEventListener('abort', () => resolveCell.resolve());
|
|
29
|
+
while (this.effects.isInContext && !abort?.aborted) {
|
|
30
|
+
let callback = () => { };
|
|
31
|
+
const waitForNext = new Promise((resolve) => {
|
|
32
|
+
callback = resolve;
|
|
33
|
+
resolveCell.resolve = resolve;
|
|
34
|
+
});
|
|
35
|
+
yield await this.call(() => callback());
|
|
36
|
+
await waitForNext;
|
|
37
|
+
}
|
|
38
|
+
return new Promise((_, rej) => rej(new AbortedError_1.AbortedError()));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Watches the value. Returns an async iterator that yields whenever the value changes
|
|
42
|
+
*/
|
|
43
|
+
watch(abort) {
|
|
44
|
+
const ctrl = new AbortController();
|
|
45
|
+
abort?.addEventListener('abort', () => ctrl.abort());
|
|
46
|
+
return Drop_1.DropGenerator.of(this.watchGen(ctrl.signal), () => ctrl.abort());
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Watches the value. Takes a custom callback function to run whenever the value changes
|
|
50
|
+
*/
|
|
51
|
+
onChange(callback) {
|
|
52
|
+
;
|
|
53
|
+
(async () => {
|
|
54
|
+
const ctrl = new AbortController();
|
|
55
|
+
for await (const value of this.watch(ctrl.signal)) {
|
|
56
|
+
try {
|
|
57
|
+
const res = await callback(value);
|
|
58
|
+
if (res.cancel) {
|
|
59
|
+
ctrl.abort();
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
console.error(`callback function threw an error @ ${this.label}.onChange`, e);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
})()
|
|
68
|
+
.catch((e) => callback(undefined, e))
|
|
69
|
+
.catch((e) => console.error(`callback function threw an error @ ${this.label}.onChange`, e));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Watches the value. Returns when the predicate is true
|
|
73
|
+
*/
|
|
74
|
+
waitFor(pred) {
|
|
75
|
+
const ctrl = new AbortController();
|
|
76
|
+
return Drop_1.DropPromise.of(Promise.resolve().then(async () => {
|
|
77
|
+
for await (const next of this.watchGen(ctrl.signal)) {
|
|
78
|
+
if (pred(next)) {
|
|
79
|
+
return next;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
throw new AbortedError_1.AbortedError();
|
|
83
|
+
}), () => ctrl.abort());
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.Watchable = Watchable;
|
|
87
|
+
//# sourceMappingURL=Watchable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Watchable.js","sourceRoot":"","sources":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K,WAAW,EAC3D,CAAC,CACF,CACF,CAAA;IACL,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAA2B;QACjC,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAA;QAClC,OAAO,kBAAW,CAAC,EAAE,CACnB,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAChC,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACpD,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACf,OAAO,IAAI,CAAA;gBACb,CAAC;YACH,CAAC;YACD,MAAM,IAAI,2BAAY,EAAE,CAAA;QAC1B,CAAC,CAAC,EACF,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CACnB,CAAA;IACH,CAAC;CACF;AAtGD,8BAsGC"}
|
|
@@ -14,9 +14,10 @@ export declare const getHostname: (url: string) => Hostname | null;
|
|
|
14
14
|
* - `'ipv6'` — IPv6 addresses only
|
|
15
15
|
* - `'localhost'` — loopback addresses (`localhost`, `127.0.0.1`, `::1`)
|
|
16
16
|
* - `'link-local'` — IPv6 link-local addresses (fe80::/10)
|
|
17
|
+
* - `'bridge'` — The LXC bridge interface
|
|
17
18
|
* - `'plugin'` — hostnames provided by a plugin package
|
|
18
19
|
*/
|
|
19
|
-
type FilterKinds = 'mdns' | 'domain' | 'ip' | 'ipv4' | 'ipv6' | 'localhost' | 'link-local' | 'plugin';
|
|
20
|
+
type FilterKinds = 'mdns' | 'domain' | 'ip' | 'ipv4' | 'ipv6' | 'localhost' | 'link-local' | 'bridge' | 'plugin';
|
|
20
21
|
/**
|
|
21
22
|
* Describes which hostnames to include (or exclude) when filtering a `Filled` address.
|
|
22
23
|
*
|
|
@@ -77,7 +78,7 @@ type FilterReturnTy<F extends Filter> = F extends {
|
|
|
77
78
|
} ? HostnameInfo extends FilterReturnTy<E> ? HostnameInfo : Exclude<HostnameInfo, FilterReturnTy<E>> : HostnameInfo;
|
|
78
79
|
declare const nonLocalFilter: {
|
|
79
80
|
readonly exclude: {
|
|
80
|
-
readonly kind: ("localhost" | "link-local")[];
|
|
81
|
+
readonly kind: ("localhost" | "link-local" | "bridge")[];
|
|
81
82
|
};
|
|
82
83
|
};
|
|
83
84
|
declare const publicFilter: {
|