diff --git a/lib/backup/index.ts b/lib/backup/index.ts
index e6a4026..32ccd1a 100644
--- a/lib/backup/index.ts
+++ b/lib/backup/index.ts
@@ -40,7 +40,7 @@ export class Backups {
constructor(
private options = DEFAULT_OPTIONS,
- private backupSet = [] as BackupSet[],
+ private backupSet = [] as BackupSet[]
) {}
static volumes(...volumeNames: string[]) {
return new Backups().addSets(
@@ -49,7 +49,7 @@ export class Backups {
srcPath: "./",
dstPath: `./${srcVolume}/`,
dstVolume: Backups.BACKUP,
- })),
+ }))
);
}
static addSets(...options: BackupSet[]) {
@@ -72,12 +72,12 @@ export class Backups {
srcPath: "./",
dstPath: `./${srcVolume}/`,
dstVolume: Backups.BACKUP,
- })),
+ }))
);
}
addSets(...options: BackupSet[]) {
options.forEach((x) =>
- this.backupSet.push({ ...x, options: { ...this.options, ...x.options } }),
+ this.backupSet.push({ ...x, options: { ...this.options, ...x.options } })
);
return this;
}
@@ -98,7 +98,7 @@ export class Backups {
.map((x) => x.dstPath)
.map((x) => x.replace(/\.\/([^]*)\//, "$1"));
const filteredItems = previousItems.filter(
- (x) => backupPaths.indexOf(x) === -1,
+ (x) => backupPaths.indexOf(x) === -1
);
for (const itemToRemove of filteredItems) {
effects.error(`Trying to remove ${itemToRemove}`);
@@ -111,7 +111,7 @@ export class Backups {
effects.removeFile({
volumeId: Backups.BACKUP,
path: itemToRemove,
- }),
+ })
)
.catch(() => {
effects.warn(`Failed to remove ${itemToRemove} from backup volume`);
diff --git a/lib/config/builder/config.ts b/lib/config/builder/config.ts
index 721248e..d76d10d 100644
--- a/lib/config/builder/config.ts
+++ b/lib/config/builder/config.ts
@@ -489,13 +489,13 @@ export class Config extends IBuilder {
}
static withValue(
key: K,
- value: Value,
+ value: Value
) {
return Config.empty().withValue(key, value);
}
static addValue(
key: K,
- value: Value,
+ value: Value
) {
return Config.empty().withValue(key, value);
}
diff --git a/lib/config/builder/list.ts b/lib/config/builder/list.ts
index fdc9878..84c47ea 100644
--- a/lib/config/builder/list.ts
+++ b/lib/config/builder/list.ts
@@ -38,7 +38,7 @@ export class List extends IBuilder {
Default & {
range: string;
spec: StringSpec;
- },
+ }
>(a: A) {
return new List({
type: "list" as const,
@@ -51,7 +51,7 @@ export class List extends IBuilder {
Default & {
range: string;
spec: NumberSpec;
- },
+ }
>(a: A) {
return new List({
type: "list" as const,
@@ -69,7 +69,7 @@ export class List extends IBuilder {
[key: string]: string;
};
};
- },
+ }
>(a: A) {
return new List({
type: "list" as const,
@@ -86,7 +86,7 @@ export class List extends IBuilder {
"display-as": null | string;
"unique-by": null | UniqueBy;
};
- },
+ }
>(a: A) {
const { spec: previousSpec, ...rest } = a;
const { spec: previousSpecSpec, ...restSpec } = previousSpec;
@@ -127,7 +127,7 @@ export class List extends IBuilder {
default: string;
};
},
- B extends string,
+ B extends string
>(a: A) {
const { spec: previousSpec, ...rest } = a;
const { variants: previousVariants, ...restSpec } = previousSpec;
diff --git a/lib/config/builder/value.ts b/lib/config/builder/value.ts
index c85335a..cde5804 100644
--- a/lib/config/builder/value.ts
+++ b/lib/config/builder/value.ts
@@ -80,7 +80,7 @@ export class Value extends IBuilder {
A extends Description &
NullableDefault &
Nullable &
- StringSpec,
+ StringSpec
>(a: A) {
return new Value({
type: "string" as const,
@@ -88,7 +88,7 @@ export class Value extends IBuilder {
} as ValueSpecString);
}
static number<
- A extends Description & NullableDefault & Nullable & NumberSpec,
+ A extends Description & NullableDefault & Nullable & NumberSpec
>(a: A) {
return new Value({
type: "number" as const,
@@ -100,7 +100,7 @@ export class Value extends IBuilder {
Default & {
values: readonly string[] | string[];
"value-names": Record;
- },
+ }
>(a: A) {
return new Value({
type: "enum" as const,
@@ -117,7 +117,7 @@ export class Value extends IBuilder {
"unique-by": null | string;
spec: Config;
"value-names": Record;
- },
+ }
>(a: A) {
const { spec: previousSpec, ...rest } = a;
const spec = previousSpec.build() as BuilderExtract;
@@ -143,7 +143,7 @@ export class Value extends IBuilder {
"display-as": string | null;
"unique-by": UniqueBy;
},
- B extends string,
+ B extends string
>(a: A) {
const { variants: previousVariants, ...rest } = a;
const variants = previousVariants.build() as BuilderExtract;
diff --git a/lib/config/builder/variants.ts b/lib/config/builder/variants.ts
index e1a9fb3..c689b2e 100644
--- a/lib/config/builder/variants.ts
+++ b/lib/config/builder/variants.ts
@@ -39,12 +39,12 @@ import { Config } from ".";
```
*/
export class Variants<
- A extends { [key: string]: InputSpec },
+ A extends { [key: string]: InputSpec }
> extends IBuilder {
static of<
A extends {
[key: string]: Config;
- },
+ }
>(a: A) {
const variants: { [K in keyof A]: BuilderExtract } = {} as any;
for (const key in a) {
@@ -58,7 +58,7 @@ export class Variants<
}
static withVariant(
key: K,
- value: Config,
+ value: Config
) {
return Variants.empty().withVariant(key, value);
}
diff --git a/lib/health/util.ts b/lib/health/util.ts
index 9f4e6e2..e8a5d1c 100644
--- a/lib/health/util.ts
+++ b/lib/health/util.ts
@@ -10,10 +10,10 @@ import { HealthResult } from "./healthRunner";
*/
export const checkWebUrl: (
url: string,
- createSuccess?: null | ((response?: string | null) => string),
+ createSuccess?: null | ((response?: string | null) => string)
) => (effects: Effects, duration: number) => Promise = (
url,
- createSuccess = null,
+ createSuccess = null
) => {
return async (effects, duration) => {
const errorValue = guardDurationAboveMinimum({
diff --git a/lib/scripts/oldSpecToBuilder.ts b/lib/scripts/oldSpecToBuilder.ts
index b896818..75e31f0 100644
--- a/lib/scripts/oldSpecToBuilder.ts
+++ b/lib/scripts/oldSpecToBuilder.ts
@@ -4,16 +4,16 @@ import * as fs from "fs";
export async function writeConvertedFile(
file: string,
inputData: Promise | any,
- options: Parameters[1],
+ options: Parameters[1]
) {
await fs.writeFile(file, await makeFileContent(inputData, options), (err) =>
- console.error(err),
+ console.error(err)
);
}
export default async function makeFileContent(
inputData: Promise | any,
- { startSdk = "start-sdk" } = {},
+ { startSdk = "start-sdk" } = {}
) {
const outputLines: string[] = [];
outputLines.push(`
@@ -25,10 +25,10 @@ export default async function makeFileContent(
const configName = newConst("InputSpec", convertInputSpec(data));
const configMatcherName = newConst(
"matchInputSpec",
- `${configName}.validator()`,
+ `${configName}.validator()`
);
outputLines.push(
- `export type InputSpec = typeof ${configMatcherName}._TYPE;`,
+ `export type InputSpec = typeof ${configMatcherName}._TYPE;`
);
return outputLines.join("\n");
@@ -64,7 +64,7 @@ export default async function makeFileContent(
textarea: value.textarea || null,
},
null,
- 2,
+ 2
)})`;
}
case "number": {
@@ -81,7 +81,7 @@ export default async function makeFileContent(
placeholder: value.placeholder || null,
},
null,
- 2,
+ 2
)})`;
}
case "boolean": {
@@ -93,7 +93,7 @@ export default async function makeFileContent(
warning: value.warning || null,
},
null,
- 2,
+ 2
)})`;
}
case "enum": {
@@ -107,13 +107,13 @@ export default async function makeFileContent(
"value-names": value["value-names"] || null,
},
null,
- 2,
+ 2
)})`;
}
case "object": {
const specName = newConst(
value.name + "_spec",
- convertInputSpec(value.spec),
+ convertInputSpec(value.spec)
);
return `Value.object({
name: ${JSON.stringify(value.name || null)},
@@ -129,7 +129,7 @@ export default async function makeFileContent(
case "union": {
const variants = newConst(
value.name + "_variants",
- convertVariants(value.variants),
+ convertVariants(value.variants)
);
return `Value.union({
name: ${JSON.stringify(value.name || null)},
@@ -147,7 +147,7 @@ export default async function makeFileContent(
"display-as": ${JSON.stringify(value["display-as"] || null)},
"unique-by": ${JSON.stringify(value["unique-by"] || null)},
"variant-names": ${JSON.stringify(
- (value["variant-names"] as any) || null,
+ (value["variant-names"] as any) || null
)},
})`;
}
@@ -182,7 +182,7 @@ export default async function makeFileContent(
warning: value.warning || null,
},
null,
- 2,
+ 2
)})`;
}
case "number": {
@@ -201,7 +201,7 @@ export default async function makeFileContent(
warning: value.warning || null,
},
null,
- 2,
+ 2
)})`;
}
case "enum": {
@@ -218,13 +218,13 @@ export default async function makeFileContent(
warning: value.warning || null,
},
null,
- 2,
+ 2
)})`;
}
case "object": {
const specName = newConst(
value.name + "_spec",
- convertInputSpec(value.spec.spec),
+ convertInputSpec(value.spec.spec)
);
return `List.obj({
name: ${JSON.stringify(value.name || null)},
@@ -232,7 +232,7 @@ export default async function makeFileContent(
spec: {
spec: ${specName},
"display-as": ${JSON.stringify(
- value?.spec?.["display-as"] || null,
+ value?.spec?.["display-as"] || null
)},
"unique-by": ${JSON.stringify(value?.spec?.["unique-by"] || null)},
},
@@ -244,7 +244,7 @@ export default async function makeFileContent(
case "union": {
const variants = newConst(
value.name + "_variants",
- convertInputSpec(value.spec.variants),
+ convertInputSpec(value.spec.variants)
);
return `List.union(
{
@@ -254,24 +254,24 @@ export default async function makeFileContent(
tag: {
"id":${JSON.stringify(value?.spec?.tag?.["id"] || null)},
"name": ${JSON.stringify(
- value?.spec?.tag?.["name"] || null,
+ value?.spec?.tag?.["name"] || null
)},
"description": ${JSON.stringify(
- value?.spec?.tag?.["description"] || null,
+ value?.spec?.tag?.["description"] || null
)},
"warning": ${JSON.stringify(
- value?.spec?.tag?.["warning"] || null,
+ value?.spec?.tag?.["warning"] || null
)},
"variant-names": ${JSON.stringify(
- value?.spec?.tag?.["variant-names"] || {},
+ value?.spec?.tag?.["variant-names"] || {}
)},
},
variants: ${variants},
"display-as": ${JSON.stringify(
- value?.spec?.["display-as"] || null,
+ value?.spec?.["display-as"] || null
)},
"unique-by": ${JSON.stringify(
- value?.spec?.["unique-by"] || null,
+ value?.spec?.["unique-by"] || null
)},
default: ${JSON.stringify(value?.spec?.["default"] || null)},
},
diff --git a/lib/types.ts b/lib/types.ts
index 343d495..9b88aaa 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -269,6 +269,19 @@ export type Effects = {
* @param configured
*/
setConfigured(configured: boolean): Promise;
+
+ /**
+ *
+ * @returns PEM encoded fullchain (ecdsa)
+ */
+ getSslCertificate: (
+ packageId: string,
+ algorithm?: "ecdsa" | "ed25519",
+ ) => [string, string, string];
+ /**
+ * @returns PEM encoded ssl key (ecdsa)
+ */
+ getSslKey: (packageId: string, algorithm?: "ecdsa" | "ed25519") => string;
};
/* rsync options: https://linux.die.net/man/1/rsync
diff --git a/lib/types/config-types.ts b/lib/types/config-types.ts
index 6d2a824..c7cff0e 100644
--- a/lib/types/config-types.ts
+++ b/lib/types/config-types.ts
@@ -111,7 +111,7 @@ export interface ValueSpecListOf
// sometimes the type checker needs just a little bit of help
export function isValueSpecListOf(
t: ValueSpecList,
- s: S,
+ s: S
): t is ValueSpecListOf {
return t.subtype === s;
}
diff --git a/lib/util/fileHelper.ts b/lib/util/fileHelper.ts
index 787caec..e03a526 100644
--- a/lib/util/fileHelper.ts
+++ b/lib/util/fileHelper.ts
@@ -56,7 +56,7 @@ export class FileHelper {
readonly path: string,
readonly volume: string,
readonly writeData: (dataIn: A) => string,
- readonly readData: (stringValue: string) => A,
+ readonly readData: (stringValue: string) => A
) {}
async write(data: A, effects: T.Effects) {
let matched;
@@ -86,21 +86,21 @@ export class FileHelper {
await effects.readFile({
path: this.path,
volumeId: this.volume,
- }),
+ })
);
}
static raw(
path: string,
volume: string,
toFile: (dataIn: A) => string,
- fromFile: (rawData: string) => A,
+ fromFile: (rawData: string) => A
) {
return new FileHelper(path, volume, toFile, fromFile);
}
static json(
path: string,
volume: string,
- shape: matches.Validator,
+ shape: matches.Validator
) {
return new FileHelper(
path,
@@ -110,13 +110,13 @@ export class FileHelper {
},
(inString) => {
return shape.unsafeCast(JSON.parse(inString));
- },
+ }
);
}
static toml>(
path: string,
volume: string,
- shape: matches.Validator,
+ shape: matches.Validator
) {
return new FileHelper(
path,
@@ -126,13 +126,13 @@ export class FileHelper {
},
(inString) => {
return shape.unsafeCast(TOML.parse(inString));
- },
+ }
);
}
static yaml>(
path: string,
volume: string,
- shape: matches.Validator,
+ shape: matches.Validator
) {
return new FileHelper(
path,
@@ -142,7 +142,7 @@ export class FileHelper {
},
(inString) => {
return shape.unsafeCast(YAML.parse(inString));
- },
+ }
);
}
}
diff --git a/lib/util/index.ts b/lib/util/index.ts
index 3d88ee6..7ecfe55 100644
--- a/lib/util/index.ts
+++ b/lib/util/index.ts
@@ -7,11 +7,11 @@ export { FileHelper } from "./fileHelper";
/** Used to check if the file exists before hand */
export const exists = (
effects: T.Effects,
- props: { path: string; volumeId: string },
+ props: { path: string; volumeId: string }
) =>
effects.metadata(props).then(
(_) => true,
- (_) => false,
+ (_) => false
);
export const isKnownError = (e: unknown): e is T.KnownError =>
diff --git a/lib/util/propertiesMatcher.ts b/lib/util/propertiesMatcher.ts
index f9e07cd..40e9cdf 100644
--- a/lib/util/propertiesMatcher.ts
+++ b/lib/util/propertiesMatcher.ts
@@ -107,7 +107,7 @@ function charRange(value = "") {
*/
export function generateDefault(
generate: { charset: string; len: number },
- { random = () => Math.random() } = {},
+ { random = () => Math.random() } = {}
) {
const validCharSets: number[][] = generate.charset
.split(",")
@@ -118,7 +118,7 @@ export function generateDefault(
}
const max = validCharSets.reduce(
(acc, x) => x.reduce((x, y) => Math.max(x, y), acc),
- 0,
+ 0
);
let i = 0;
const answer: string[] = Array(generate.len);
@@ -127,7 +127,7 @@ export function generateDefault(
const inRange = validCharSets.reduce(
(acc, [lower, upper]) =>
acc || (nextValue >= lower && nextValue <= upper),
- false,
+ false
);
if (!inRange) continue;
answer[i] = String.fromCharCode(nextValue);
@@ -155,7 +155,7 @@ export function matchNumberWithRange(range: string) {
? "any"
: left === "["
? `greaterThanOrEqualTo${leftValue}`
- : `greaterThan${leftValue}`,
+ : `greaterThan${leftValue}`
)
.validate(
// prettier-ignore
@@ -165,7 +165,7 @@ export function matchNumberWithRange(range: string) {
// prettier-ignore
rightValue === "*" ? "any" :
right === "]" ? `lessThanOrEqualTo${rightValue}` :
- `lessThan${rightValue}`,
+ `lessThan${rightValue}`
);
}
function withIntegral(parser: matches.Parser, value: unknown) {
@@ -186,12 +186,12 @@ const isGenerator = matches.shape({
}).test;
function defaultNullable(
parser: matches.Parser,
- value: unknown,
+ value: unknown
) {
if (matchDefault.test(value)) {
if (isGenerator(value.default)) {
return parser.defaultTo(
- parser.unsafeCast(generateDefault(value.default)),
+ parser.unsafeCast(generateDefault(value.default))
);
}
return parser.defaultTo(value.default);
@@ -209,7 +209,7 @@ function defaultNullable(
* @returns
*/
export function guardAll(
- value: A,
+ value: A
): matches.Parser> {
if (!isType.test(value)) {
return matches.unknown as any;
@@ -224,7 +224,7 @@ export function guardAll(
case "number":
return defaultNullable(
withIntegral(withRange(value), value),
- value,
+ value
) as any;
case "object":
@@ -244,14 +244,14 @@ export function guardAll(
matches
.arrayOf(guardAll({ type: subtype, ...spec } as any))
.validate((x) => rangeValidate(x.length), "valid length"),
- value,
+ value
) as any;
}
case "enum":
if (matchValues.test(value)) {
return defaultNullable(
matches.literals(value.values[0], ...value.values),
- value,
+ value
) as any;
}
return matches.unknown as any;
@@ -261,8 +261,8 @@ export function guardAll(
...Object.entries(value.variants).map(([variant, spec]) =>
matches
.shape({ [value.tag.id]: matches.literal(variant) })
- .concat(typeFromProps(spec)),
- ),
+ .concat(typeFromProps(spec))
+ )
) as any;
}
return matches.unknown as any;
@@ -279,7 +279,7 @@ export function guardAll(
* @returns
*/
export function typeFromProps(
- valueDictionary: A,
+ valueDictionary: A
): matches.Parser> {
if (!recordString.test(valueDictionary)) return matches.unknown as any;
return matches.shape(
@@ -287,7 +287,7 @@ export function typeFromProps(
Object.entries(valueDictionary).map(([key, value]) => [
key,
guardAll(value),
- ]),
- ),
+ ])
+ )
) as any;
}
diff --git a/package-lock.json b/package-lock.json
index fa104ad..db1d8af 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "start-sdk",
- "version": "0.4.0-lib0.alpha5",
+ "version": "0.4.0-lib0.alpha6",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "start-sdk",
- "version": "0.4.0-lib0.alpha5",
+ "version": "0.4.0-lib0.alpha6",
"license": "MIT",
"dependencies": {
"@iarna/toml": "^2.2.5",