mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 04:01:58 +00:00
Merge branch 'next/minor' of github.com:Start9Labs/start-os into next/major
This commit is contained in:
@@ -131,6 +131,8 @@ export type Effects = {
|
||||
}): Promise<Host | null>
|
||||
/** Returns the IP address of the container */
|
||||
getContainerIp(): Promise<string>
|
||||
/** Returns the IP address of StartOS */
|
||||
getOsIp(): Promise<string>
|
||||
// interface
|
||||
/** Creates an interface bound to a specific host and port to show to the user */
|
||||
exportServiceInterface(options: ExportServiceInterfaceParams): Promise<null>
|
||||
|
||||
@@ -13,7 +13,7 @@ export type Run<
|
||||
| InputSpec<Record<string, never>, never>,
|
||||
> = (options: {
|
||||
effects: T.Effects
|
||||
input: ExtractInputSpecType<A> & Record<string, any>
|
||||
input: ExtractInputSpecType<A>
|
||||
}) => Promise<(T.ActionResult & { version: "1" }) | null | void | undefined>
|
||||
export type GetInput<
|
||||
A extends
|
||||
@@ -22,12 +22,7 @@ export type GetInput<
|
||||
| InputSpec<Record<string, any>, never>,
|
||||
> = (options: {
|
||||
effects: T.Effects
|
||||
}) => Promise<
|
||||
| null
|
||||
| void
|
||||
| undefined
|
||||
| (ExtractPartialInputSpecType<A> & Record<string, any>)
|
||||
>
|
||||
}) => Promise<null | void | undefined | ExtractPartialInputSpecType<A>>
|
||||
|
||||
export type MaybeFn<T> = T | ((options: { effects: T.Effects }) => Promise<T>)
|
||||
function callMaybeFn<T>(
|
||||
@@ -63,8 +58,8 @@ export class Action<
|
||||
readonly id: Id,
|
||||
private readonly metadataFn: MaybeFn<T.ActionMetadata>,
|
||||
private readonly inputSpec: InputSpecType,
|
||||
private readonly getInputFn: GetInput<ExtractInputSpecType<InputSpecType>>,
|
||||
private readonly runFn: Run<ExtractInputSpecType<InputSpecType>>,
|
||||
private readonly getInputFn: GetInput<InputSpecType>,
|
||||
private readonly runFn: Run<InputSpecType>,
|
||||
) {}
|
||||
static withInput<
|
||||
Id extends T.ActionId,
|
||||
@@ -77,8 +72,8 @@ export class Action<
|
||||
id: Id,
|
||||
metadata: MaybeFn<Omit<T.ActionMetadata, "hasInput">>,
|
||||
inputSpec: InputSpecType,
|
||||
getInput: GetInput<ExtractInputSpecType<InputSpecType>>,
|
||||
run: Run<ExtractInputSpecType<InputSpecType>>,
|
||||
getInput: GetInput<InputSpecType>,
|
||||
run: Run<InputSpecType>,
|
||||
): Action<Id, Store, InputSpecType> {
|
||||
return new Action(
|
||||
id,
|
||||
|
||||
@@ -45,8 +45,26 @@ ExtendedVersion
|
||||
return { flavor: flavor || null, upstream, downstream }
|
||||
}
|
||||
|
||||
EmVer
|
||||
= major:Digit "." minor:Digit "." patch:Digit ("." revision:Digit)? {
|
||||
EmverVersionRange
|
||||
= first:EmverVersionRangeAtom rest:(_ ((Or / And) _)? EmverVersionRangeAtom)*
|
||||
|
||||
EmverVersionRangeAtom
|
||||
= EmverParens
|
||||
/ EmverAnchor
|
||||
/ EmverNot
|
||||
/ Any
|
||||
/ None
|
||||
|
||||
EmverParens
|
||||
= "(" _ expr:EmverVersionRange _ ")" { return { type: "Parens", expr } }
|
||||
|
||||
EmverAnchor
|
||||
= operator:CmpOp? _ version:Emver { return { type: "Anchor", operator, version } }
|
||||
|
||||
EmverNot = "!" _ value:EmverVersionRangeAtom { return { type: "Not", value: value }}
|
||||
|
||||
Emver
|
||||
= major:Digit "." minor:Digit "." patch:Digit revision:( "." revision:Digit { return revision } )? {
|
||||
return {
|
||||
flavor: null,
|
||||
upstream: {
|
||||
|
||||
@@ -296,7 +296,7 @@ function peg$parse(input, options) {
|
||||
var peg$source = options.grammarSource;
|
||||
|
||||
// @ts-ignore
|
||||
var peg$startRuleFunctions = { VersionRange: peg$parseVersionRange, Or: peg$parseOr, And: peg$parseAnd, VersionRangeAtom: peg$parseVersionRangeAtom, Parens: peg$parseParens, Anchor: peg$parseAnchor, VersionSpec: peg$parseVersionSpec, Not: peg$parseNot, Any: peg$parseAny, None: peg$parseNone, CmpOp: peg$parseCmpOp, ExtendedVersion: peg$parseExtendedVersion, EmVer: peg$parseEmVer, Flavor: peg$parseFlavor, Lowercase: peg$parseLowercase, String: peg$parseString, Version: peg$parseVersion, PreRelease: peg$parsePreRelease, PreReleaseSegment: peg$parsePreReleaseSegment, VersionNumber: peg$parseVersionNumber, Digit: peg$parseDigit, _: peg$parse_ };
|
||||
var peg$startRuleFunctions = { VersionRange: peg$parseVersionRange, Or: peg$parseOr, And: peg$parseAnd, VersionRangeAtom: peg$parseVersionRangeAtom, Parens: peg$parseParens, Anchor: peg$parseAnchor, VersionSpec: peg$parseVersionSpec, Not: peg$parseNot, Any: peg$parseAny, None: peg$parseNone, CmpOp: peg$parseCmpOp, ExtendedVersion: peg$parseExtendedVersion, EmverVersionRange: peg$parseEmverVersionRange, EmverVersionRangeAtom: peg$parseEmverVersionRangeAtom, EmverParens: peg$parseEmverParens, EmverAnchor: peg$parseEmverAnchor, EmverNot: peg$parseEmverNot, Emver: peg$parseEmver, Flavor: peg$parseFlavor, Lowercase: peg$parseLowercase, String: peg$parseString, Version: peg$parseVersion, PreRelease: peg$parsePreRelease, PreReleaseSegment: peg$parsePreReleaseSegment, VersionNumber: peg$parseVersionNumber, Digit: peg$parseDigit, _: peg$parse_ };
|
||||
// @ts-ignore
|
||||
var peg$startRuleFunction = peg$parseVersionRange;
|
||||
|
||||
@@ -397,7 +397,19 @@ function peg$parse(input, options) {
|
||||
return { flavor: flavor || null, upstream, downstream }
|
||||
};// @ts-ignore
|
||||
|
||||
var peg$f15 = function(major, minor, patch) {
|
||||
var peg$f15 = function(expr) {// @ts-ignore
|
||||
return { type: "Parens", expr } };// @ts-ignore
|
||||
|
||||
var peg$f16 = function(operator, version) {// @ts-ignore
|
||||
return { type: "Anchor", operator, version } };// @ts-ignore
|
||||
|
||||
var peg$f17 = function(value) {// @ts-ignore
|
||||
return { type: "Not", value: value }};// @ts-ignore
|
||||
|
||||
var peg$f18 = function(major, minor, patch, revision) {// @ts-ignore
|
||||
return revision };// @ts-ignore
|
||||
|
||||
var peg$f19 = function(major, minor, patch, revision) {
|
||||
// @ts-ignore
|
||||
return {
|
||||
// @ts-ignore
|
||||
@@ -419,16 +431,16 @@ function peg$parse(input, options) {
|
||||
}
|
||||
};// @ts-ignore
|
||||
|
||||
var peg$f16 = function(flavor) {// @ts-ignore
|
||||
var peg$f20 = function(flavor) {// @ts-ignore
|
||||
return flavor };// @ts-ignore
|
||||
|
||||
var peg$f17 = function() {// @ts-ignore
|
||||
var peg$f21 = function() {// @ts-ignore
|
||||
return text() };// @ts-ignore
|
||||
|
||||
var peg$f18 = function() {// @ts-ignore
|
||||
var peg$f22 = function() {// @ts-ignore
|
||||
return text(); };// @ts-ignore
|
||||
|
||||
var peg$f19 = function(number, prerelease) {
|
||||
var peg$f23 = function(number, prerelease) {
|
||||
// @ts-ignore
|
||||
return {
|
||||
// @ts-ignore
|
||||
@@ -438,22 +450,22 @@ function peg$parse(input, options) {
|
||||
};
|
||||
};// @ts-ignore
|
||||
|
||||
var peg$f20 = function(first, rest) {
|
||||
var peg$f24 = function(first, rest) {
|
||||
// @ts-ignore
|
||||
return [first].concat(rest.map(r => r[1]));
|
||||
};// @ts-ignore
|
||||
|
||||
var peg$f21 = function(segment) {
|
||||
var peg$f25 = function(segment) {
|
||||
// @ts-ignore
|
||||
return segment;
|
||||
};// @ts-ignore
|
||||
|
||||
var peg$f22 = function(first, rest) {
|
||||
var peg$f26 = function(first, rest) {
|
||||
// @ts-ignore
|
||||
return [first].concat(rest.map(r => r[1]));
|
||||
};// @ts-ignore
|
||||
|
||||
var peg$f23 = function() {// @ts-ignore
|
||||
var peg$f27 = function() {// @ts-ignore
|
||||
return parseInt(text(), 10); };
|
||||
// @ts-ignore
|
||||
var peg$currPos = 0;
|
||||
@@ -1533,7 +1545,336 @@ peg$parseExtendedVersion() {
|
||||
|
||||
// @ts-ignore
|
||||
function // @ts-ignore
|
||||
peg$parseEmVer() {
|
||||
peg$parseEmverVersionRange() {
|
||||
// @ts-ignore
|
||||
var s0, s1, s2, s3, s4, s5, s6, s7;
|
||||
|
||||
// @ts-ignore
|
||||
s0 = peg$currPos;
|
||||
// @ts-ignore
|
||||
s1 = peg$parseEmverVersionRangeAtom();
|
||||
// @ts-ignore
|
||||
if (s1 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s2 = [];
|
||||
// @ts-ignore
|
||||
s3 = peg$currPos;
|
||||
// @ts-ignore
|
||||
s4 = peg$parse_();
|
||||
// @ts-ignore
|
||||
s5 = peg$currPos;
|
||||
// @ts-ignore
|
||||
s6 = peg$parseOr();
|
||||
// @ts-ignore
|
||||
if (s6 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s6 = peg$parseAnd();
|
||||
}
|
||||
// @ts-ignore
|
||||
if (s6 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s7 = peg$parse_();
|
||||
// @ts-ignore
|
||||
s6 = [s6, s7];
|
||||
// @ts-ignore
|
||||
s5 = s6;
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s5;
|
||||
// @ts-ignore
|
||||
s5 = peg$FAILED;
|
||||
}
|
||||
// @ts-ignore
|
||||
if (s5 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s5 = null;
|
||||
}
|
||||
// @ts-ignore
|
||||
s6 = peg$parseEmverVersionRangeAtom();
|
||||
// @ts-ignore
|
||||
if (s6 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s4 = [s4, s5, s6];
|
||||
// @ts-ignore
|
||||
s3 = s4;
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s3;
|
||||
// @ts-ignore
|
||||
s3 = peg$FAILED;
|
||||
}
|
||||
// @ts-ignore
|
||||
while (s3 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s2.push(s3);
|
||||
// @ts-ignore
|
||||
s3 = peg$currPos;
|
||||
// @ts-ignore
|
||||
s4 = peg$parse_();
|
||||
// @ts-ignore
|
||||
s5 = peg$currPos;
|
||||
// @ts-ignore
|
||||
s6 = peg$parseOr();
|
||||
// @ts-ignore
|
||||
if (s6 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s6 = peg$parseAnd();
|
||||
}
|
||||
// @ts-ignore
|
||||
if (s6 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s7 = peg$parse_();
|
||||
// @ts-ignore
|
||||
s6 = [s6, s7];
|
||||
// @ts-ignore
|
||||
s5 = s6;
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s5;
|
||||
// @ts-ignore
|
||||
s5 = peg$FAILED;
|
||||
}
|
||||
// @ts-ignore
|
||||
if (s5 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s5 = null;
|
||||
}
|
||||
// @ts-ignore
|
||||
s6 = peg$parseEmverVersionRangeAtom();
|
||||
// @ts-ignore
|
||||
if (s6 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s4 = [s4, s5, s6];
|
||||
// @ts-ignore
|
||||
s3 = s4;
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s3;
|
||||
// @ts-ignore
|
||||
s3 = peg$FAILED;
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
s1 = [s1, s2];
|
||||
// @ts-ignore
|
||||
s0 = s1;
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return s0;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
function // @ts-ignore
|
||||
peg$parseEmverVersionRangeAtom() {
|
||||
// @ts-ignore
|
||||
var s0;
|
||||
|
||||
// @ts-ignore
|
||||
s0 = peg$parseEmverParens();
|
||||
// @ts-ignore
|
||||
if (s0 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s0 = peg$parseEmverAnchor();
|
||||
// @ts-ignore
|
||||
if (s0 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s0 = peg$parseEmverNot();
|
||||
// @ts-ignore
|
||||
if (s0 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s0 = peg$parseAny();
|
||||
// @ts-ignore
|
||||
if (s0 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s0 = peg$parseNone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return s0;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
function // @ts-ignore
|
||||
peg$parseEmverParens() {
|
||||
// @ts-ignore
|
||||
var s0, s1, s2, s3, s4, s5;
|
||||
|
||||
// @ts-ignore
|
||||
s0 = peg$currPos;
|
||||
// @ts-ignore
|
||||
if (input.charCodeAt(peg$currPos) === 40) {
|
||||
// @ts-ignore
|
||||
s1 = peg$c2;
|
||||
// @ts-ignore
|
||||
peg$currPos++;
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
s1 = peg$FAILED;
|
||||
// @ts-ignore
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
||||
}
|
||||
// @ts-ignore
|
||||
if (s1 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s2 = peg$parse_();
|
||||
// @ts-ignore
|
||||
s3 = peg$parseEmverVersionRange();
|
||||
// @ts-ignore
|
||||
if (s3 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s4 = peg$parse_();
|
||||
// @ts-ignore
|
||||
if (input.charCodeAt(peg$currPos) === 41) {
|
||||
// @ts-ignore
|
||||
s5 = peg$c3;
|
||||
// @ts-ignore
|
||||
peg$currPos++;
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
s5 = peg$FAILED;
|
||||
// @ts-ignore
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
||||
}
|
||||
// @ts-ignore
|
||||
if (s5 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f15(s3);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return s0;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
function // @ts-ignore
|
||||
peg$parseEmverAnchor() {
|
||||
// @ts-ignore
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
// @ts-ignore
|
||||
s0 = peg$currPos;
|
||||
// @ts-ignore
|
||||
s1 = peg$parseCmpOp();
|
||||
// @ts-ignore
|
||||
if (s1 === peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s1 = null;
|
||||
}
|
||||
// @ts-ignore
|
||||
s2 = peg$parse_();
|
||||
// @ts-ignore
|
||||
s3 = peg$parseEmver();
|
||||
// @ts-ignore
|
||||
if (s3 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f16(s1, s3);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return s0;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
function // @ts-ignore
|
||||
peg$parseEmverNot() {
|
||||
// @ts-ignore
|
||||
var s0, s1, s2, s3;
|
||||
|
||||
// @ts-ignore
|
||||
s0 = peg$currPos;
|
||||
// @ts-ignore
|
||||
if (input.charCodeAt(peg$currPos) === 33) {
|
||||
// @ts-ignore
|
||||
s1 = peg$c5;
|
||||
// @ts-ignore
|
||||
peg$currPos++;
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
s1 = peg$FAILED;
|
||||
// @ts-ignore
|
||||
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
||||
}
|
||||
// @ts-ignore
|
||||
if (s1 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s2 = peg$parse_();
|
||||
// @ts-ignore
|
||||
s3 = peg$parseEmverVersionRangeAtom();
|
||||
// @ts-ignore
|
||||
if (s3 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f17(s3);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
peg$currPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$FAILED;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return s0;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
function // @ts-ignore
|
||||
peg$parseEmver() {
|
||||
// @ts-ignore
|
||||
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
||||
|
||||
@@ -1603,9 +1944,9 @@ peg$parseEmVer() {
|
||||
// @ts-ignore
|
||||
if (s8 !== peg$FAILED) {
|
||||
// @ts-ignore
|
||||
s7 = [s7, s8];
|
||||
peg$savedPos = s6;
|
||||
// @ts-ignore
|
||||
s6 = s7;
|
||||
s6 = peg$f18(s1, s3, s5, s8);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
@@ -1628,7 +1969,7 @@ peg$parseEmVer() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f15(s1, s3, s5);
|
||||
s0 = peg$f19(s1, s3, s5, s6);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
@@ -1714,7 +2055,7 @@ peg$parseFlavor() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f16(s2);
|
||||
s0 = peg$f20(s2);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
@@ -1794,7 +2135,7 @@ peg$parseLowercase() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s1 = peg$f17();
|
||||
s1 = peg$f21();
|
||||
}
|
||||
// @ts-ignore
|
||||
s0 = s1;
|
||||
@@ -1856,7 +2197,7 @@ peg$parseString() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s1 = peg$f18();
|
||||
s1 = peg$f22();
|
||||
}
|
||||
// @ts-ignore
|
||||
s0 = s1;
|
||||
@@ -1887,7 +2228,7 @@ peg$parseVersion() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f19(s1, s2);
|
||||
s0 = peg$f23(s1, s2);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
@@ -2015,7 +2356,7 @@ peg$parsePreRelease() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f20(s2, s3);
|
||||
s0 = peg$f24(s2, s3);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
@@ -2073,7 +2414,7 @@ peg$parsePreReleaseSegment() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f21(s2);
|
||||
s0 = peg$f25(s2);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
@@ -2186,7 +2527,7 @@ peg$parseVersionNumber() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s0 = peg$f22(s1, s2);
|
||||
s0 = peg$f26(s1, s2);
|
||||
// @ts-ignore
|
||||
} else {
|
||||
// @ts-ignore
|
||||
@@ -2252,7 +2593,7 @@ peg$parseDigit() {
|
||||
// @ts-ignore
|
||||
peg$savedPos = s0;
|
||||
// @ts-ignore
|
||||
s1 = peg$f23();
|
||||
s1 = peg$f27();
|
||||
}
|
||||
// @ts-ignore
|
||||
s0 = s1;
|
||||
@@ -2423,7 +2764,7 @@ peggyParser.SyntaxError.prototype.name = "PeggySyntaxError";
|
||||
|
||||
export interface ParseOptions {
|
||||
filename?: string;
|
||||
startRule?: "VersionRange" | "Or" | "And" | "VersionRangeAtom" | "Parens" | "Anchor" | "VersionSpec" | "Not" | "Any" | "None" | "CmpOp" | "ExtendedVersion" | "EmVer" | "Flavor" | "Lowercase" | "String" | "Version" | "PreRelease" | "PreReleaseSegment" | "VersionNumber" | "Digit" | "_";
|
||||
startRule?: "VersionRange" | "Or" | "And" | "VersionRangeAtom" | "Parens" | "Anchor" | "VersionSpec" | "Not" | "Any" | "None" | "CmpOp" | "ExtendedVersion" | "EmverVersionRange" | "EmverVersionRangeAtom" | "EmverParens" | "EmverAnchor" | "EmverNot" | "Emver" | "Flavor" | "Lowercase" | "String" | "Version" | "PreRelease" | "PreReleaseSegment" | "VersionNumber" | "Digit" | "_";
|
||||
tracer?: any;
|
||||
[key: string]: any;
|
||||
}
|
||||
@@ -2443,7 +2784,12 @@ export type ParseFunction = <Options extends ParseOptions>(
|
||||
StartRule extends "None" ? None :
|
||||
StartRule extends "CmpOp" ? CmpOp :
|
||||
StartRule extends "ExtendedVersion" ? ExtendedVersion :
|
||||
StartRule extends "EmVer" ? EmVer :
|
||||
StartRule extends "EmverVersionRange" ? EmverVersionRange :
|
||||
StartRule extends "EmverVersionRangeAtom" ? EmverVersionRangeAtom :
|
||||
StartRule extends "EmverParens" ? EmverParens :
|
||||
StartRule extends "EmverAnchor" ? EmverAnchor :
|
||||
StartRule extends "EmverNot" ? EmverNot :
|
||||
StartRule extends "Emver" ? Emver :
|
||||
StartRule extends "Flavor" ? Flavor :
|
||||
StartRule extends "Lowercase" ? Lowercase_1 :
|
||||
StartRule extends "String" ? String_1 :
|
||||
@@ -2488,10 +2834,27 @@ export type ExtendedVersion = {
|
||||
upstream: Version;
|
||||
downstream: Version;
|
||||
};
|
||||
export type EmVer = {
|
||||
export type EmverVersionRange = [
|
||||
EmverVersionRangeAtom,
|
||||
[_, [Or | And, _] | null, EmverVersionRangeAtom][]
|
||||
];
|
||||
export type EmverVersionRangeAtom =
|
||||
| EmverParens
|
||||
| EmverAnchor
|
||||
| EmverNot
|
||||
| Any
|
||||
| None;
|
||||
export type EmverParens = { type: "Parens"; expr: EmverVersionRange };
|
||||
export type EmverAnchor = {
|
||||
type: "Anchor";
|
||||
operator: CmpOp | null;
|
||||
version: Emver;
|
||||
};
|
||||
export type EmverNot = { type: "Not"; value: EmverVersionRangeAtom };
|
||||
export type Emver = {
|
||||
flavor: null;
|
||||
upstream: { number: [Digit, Digit, Digit]; prerelease: [] };
|
||||
downstream: { number: [any]; prerelease: [] };
|
||||
downstream: { number: [0 | NonNullable<Digit | null>]; prerelease: [] };
|
||||
};
|
||||
export type Flavor = Lowercase_1;
|
||||
export type Lowercase_1 = string;
|
||||
|
||||
@@ -123,6 +123,12 @@ export class VersionRange {
|
||||
)
|
||||
}
|
||||
|
||||
static parseEmver(range: string): VersionRange {
|
||||
return VersionRange.parseRange(
|
||||
P.parse(range, { startRule: "EmverVersionRange" }),
|
||||
)
|
||||
}
|
||||
|
||||
and(right: VersionRange) {
|
||||
return new VersionRange({ type: "And", left: this, right })
|
||||
}
|
||||
@@ -291,12 +297,19 @@ export class ExtendedVersion {
|
||||
}
|
||||
|
||||
static parseEmver(extendedVersion: string): ExtendedVersion {
|
||||
const parsed = P.parse(extendedVersion, { startRule: "EmVer" })
|
||||
return new ExtendedVersion(
|
||||
parsed.flavor,
|
||||
new Version(parsed.upstream.number, parsed.upstream.prerelease),
|
||||
new Version(parsed.downstream.number, parsed.downstream.prerelease),
|
||||
)
|
||||
try {
|
||||
const parsed = P.parse(extendedVersion, { startRule: "Emver" })
|
||||
return new ExtendedVersion(
|
||||
parsed.flavor,
|
||||
new Version(parsed.upstream.number, parsed.upstream.prerelease),
|
||||
new Version(parsed.downstream.number, parsed.downstream.prerelease),
|
||||
)
|
||||
} catch (e) {
|
||||
if (e instanceof Error) {
|
||||
e.message += ` (${extendedVersion})`
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ImageMetadata = { workdir: string; user: string }
|
||||
export type ImageMetadata = {
|
||||
workdir: string
|
||||
user: string
|
||||
entrypoint: Array<string> | null
|
||||
cmd: Array<string> | null
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ describe("startosTypeValidation ", () => {
|
||||
},
|
||||
getSystemSmtp: {} as WithCallback<GetSystemSmtpParams>,
|
||||
getContainerIp: undefined,
|
||||
getOsIp: undefined,
|
||||
getServicePortForward: {} as GetServicePortForwardParams,
|
||||
clearServiceInterfaces: {} as ClearServiceInterfacesParams,
|
||||
exportServiceInterface: {} as ExportServiceInterfaceParams,
|
||||
|
||||
@@ -127,7 +127,11 @@ export type SmtpValue = {
|
||||
password: string | null | undefined
|
||||
}
|
||||
|
||||
export type CommandType = string | [string, ...string[]]
|
||||
export class UseEntrypoint {
|
||||
constructor(readonly overridCmd?: string[]) {}
|
||||
}
|
||||
|
||||
export type CommandType = string | [string, ...string[]] | UseEntrypoint
|
||||
|
||||
export type DaemonReturned = {
|
||||
wait(): Promise<unknown>
|
||||
|
||||
@@ -48,6 +48,11 @@ export type SDKManifest = {
|
||||
/** Long description to display on the marketplace details page for this service. Max length 500 chars. */
|
||||
readonly long: string
|
||||
}
|
||||
/**
|
||||
* override the StartOS version this package was made for
|
||||
* defaults to the version the SDK was built for
|
||||
*/
|
||||
osVersion?: string
|
||||
/**
|
||||
* @description A mapping of OS images needed to run the container processes. Each image ID is a unique key.
|
||||
* @example
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Effects } from "../Effects"
|
||||
import * as T from "../types"
|
||||
|
||||
export class GetSystemSmtp {
|
||||
constructor(readonly effects: Effects) {}
|
||||
|
||||
/**
|
||||
* Returns the system SMTP credentials. Restarts the service if the credentials change
|
||||
* Returns the system SMTP credentials. Reruns the context from which it has been called if the underlying value changes
|
||||
*/
|
||||
const() {
|
||||
return this.effects.getSystemSmtp({
|
||||
@@ -17,8 +18,9 @@ export class GetSystemSmtp {
|
||||
once() {
|
||||
return this.effects.getSystemSmtp({})
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches the system SMTP credentials. Takes a custom callback function to run whenever the credentials change
|
||||
* Watches the system SMTP credentials. Returns an async iterator that yields whenever the value changes
|
||||
*/
|
||||
async *watch() {
|
||||
while (true) {
|
||||
@@ -32,4 +34,34 @@ export class GetSystemSmtp {
|
||||
await waitForNext
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches the system SMTP credentials. Takes a custom callback function to run whenever the credentials change
|
||||
*/
|
||||
onChange(
|
||||
callback: (
|
||||
value: T.SmtpValue | null,
|
||||
error?: Error,
|
||||
) => void | Promise<void>,
|
||||
) {
|
||||
;(async () => {
|
||||
for await (const value of this.watch()) {
|
||||
try {
|
||||
await callback(value)
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"callback function threw an error @ GetSystemSmtp.onChange",
|
||||
e,
|
||||
)
|
||||
}
|
||||
}
|
||||
})()
|
||||
.catch((e) => callback(null, e))
|
||||
.catch((e) =>
|
||||
console.error(
|
||||
"callback function threw an error @ GetSystemSmtp.onChange",
|
||||
e,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ export const getHostname = (url: string): Hostname | null => {
|
||||
|
||||
export type Filled = {
|
||||
hostnames: HostnameInfo[]
|
||||
publicHostnames: HostnameInfo[]
|
||||
onionHostnames: HostnameInfo[]
|
||||
localHostnames: HostnameInfo[]
|
||||
ipHostnames: HostnameInfo[]
|
||||
@@ -25,6 +26,7 @@ export type Filled = {
|
||||
nonIpHostnames: HostnameInfo[]
|
||||
|
||||
urls: UrlString[]
|
||||
publicUrls: UrlString[]
|
||||
onionUrls: UrlString[]
|
||||
localUrls: UrlString[]
|
||||
ipUrls: UrlString[]
|
||||
@@ -105,6 +107,9 @@ export const filledAddress = (
|
||||
return {
|
||||
...addressInfo,
|
||||
hostnames,
|
||||
get publicHostnames() {
|
||||
return hostnames.filter((h) => h.kind === "onion" || h.public)
|
||||
},
|
||||
get onionHostnames() {
|
||||
return hostnames.filter((h) => h.kind === "onion")
|
||||
},
|
||||
@@ -141,6 +146,9 @@ export const filledAddress = (
|
||||
get urls() {
|
||||
return this.hostnames.flatMap(toUrl)
|
||||
},
|
||||
get publicUrls() {
|
||||
return this.publicHostnames.flatMap(toUrl)
|
||||
},
|
||||
get onionUrls() {
|
||||
return this.onionHostnames.flatMap(toUrl)
|
||||
},
|
||||
@@ -205,7 +213,7 @@ export class GetServiceInterface {
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Returns the value of Store at the provided path. Restart the service if the value changes
|
||||
* Returns the requested service interface. Reruns the context from which it has been called if the underlying value changes
|
||||
*/
|
||||
async const() {
|
||||
const { id, packageId } = this.opts
|
||||
@@ -220,7 +228,7 @@ export class GetServiceInterface {
|
||||
return interfaceFilled
|
||||
}
|
||||
/**
|
||||
* Returns the value of ServiceInterfacesFilled at the provided path. Does nothing if the value changes
|
||||
* Returns the requested service interface. Does nothing if the value changes
|
||||
*/
|
||||
async once() {
|
||||
const { id, packageId } = this.opts
|
||||
@@ -234,7 +242,7 @@ export class GetServiceInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches the value of ServiceInterfacesFilled at the provided path. Takes a custom callback function to run whenever the value changes
|
||||
* Watches the requested service interface. Returns an async iterator that yields whenever the value changes
|
||||
*/
|
||||
async *watch() {
|
||||
const { id, packageId } = this.opts
|
||||
@@ -252,6 +260,36 @@ export class GetServiceInterface {
|
||||
await waitForNext
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches the requested service interface. Takes a custom callback function to run whenever the value changes
|
||||
*/
|
||||
onChange(
|
||||
callback: (
|
||||
value: ServiceInterfaceFilled | null,
|
||||
error?: Error,
|
||||
) => void | Promise<void>,
|
||||
) {
|
||||
;(async () => {
|
||||
for await (const value of this.watch()) {
|
||||
try {
|
||||
await callback(value)
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"callback function threw an error @ GetServiceInterface.onChange",
|
||||
e,
|
||||
)
|
||||
}
|
||||
}
|
||||
})()
|
||||
.catch((e) => callback(null, e))
|
||||
.catch((e) =>
|
||||
console.error(
|
||||
"callback function threw an error @ GetServiceInterface.onChange",
|
||||
e,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
export function getServiceInterface(
|
||||
effects: Effects,
|
||||
|
||||
@@ -47,7 +47,7 @@ export class GetServiceInterfaces {
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Returns the value of Store at the provided path. Restart the service if the value changes
|
||||
* Returns the service interfaces for the package. Reruns the context from which it has been called if the underlying value changes
|
||||
*/
|
||||
async const() {
|
||||
const { packageId } = this.opts
|
||||
@@ -62,7 +62,7 @@ export class GetServiceInterfaces {
|
||||
return interfaceFilled
|
||||
}
|
||||
/**
|
||||
* Returns the value of ServiceInterfacesFilled at the provided path. Does nothing if the value changes
|
||||
* Returns the service interfaces for the package. Does nothing if the value changes
|
||||
*/
|
||||
async once() {
|
||||
const { packageId } = this.opts
|
||||
@@ -76,7 +76,7 @@ export class GetServiceInterfaces {
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches the value of ServiceInterfacesFilled at the provided path. Takes a custom callback function to run whenever the value changes
|
||||
* Watches the service interfaces for the package. Returns an async iterator that yields whenever the value changes
|
||||
*/
|
||||
async *watch() {
|
||||
const { packageId } = this.opts
|
||||
@@ -93,6 +93,36 @@ export class GetServiceInterfaces {
|
||||
await waitForNext
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches the service interfaces for the package. Takes a custom callback function to run whenever the value changes
|
||||
*/
|
||||
onChange(
|
||||
callback: (
|
||||
value: ServiceInterfaceFilled[] | null,
|
||||
error?: Error,
|
||||
) => void | Promise<void>,
|
||||
) {
|
||||
;(async () => {
|
||||
for await (const value of this.watch()) {
|
||||
try {
|
||||
await callback(value)
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"callback function threw an error @ GetServiceInterfaces.onChange",
|
||||
e,
|
||||
)
|
||||
}
|
||||
}
|
||||
})()
|
||||
.catch((e) => callback(null, e))
|
||||
.catch((e) =>
|
||||
console.error(
|
||||
"callback function threw an error @ GetServiceInterfaces.onChange",
|
||||
e,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
export function getServiceInterfaces(
|
||||
effects: Effects,
|
||||
|
||||
Reference in New Issue
Block a user