mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 12:21:57 +00:00
feat: Add Matcher/ Parser for spec in getConfig
This commit is contained in:
11
util.ts
11
util.ts
@@ -1,5 +1,7 @@
|
||||
import * as T from "./types.ts";
|
||||
|
||||
export { guardAll, typeFromProps } from "./utils/propertiesMatcher.ts";
|
||||
|
||||
export function unwrapResultType<T>(res: T.ResultType<T>): T {
|
||||
if ("error-code" in res) {
|
||||
throw new Error(res["error-code"][1]);
|
||||
@@ -11,10 +13,11 @@ export function unwrapResultType<T>(res: T.ResultType<T>): T {
|
||||
}
|
||||
|
||||
/** Used to check if the file exists before hand */
|
||||
export const exists = (
|
||||
effects: T.Effects,
|
||||
props: { path: string; volumeId: string },
|
||||
) => effects.metadata(props).then((_) => true, (_) => false);
|
||||
export const exists = (effects: T.Effects, props: { path: string; volumeId: string }) =>
|
||||
effects.metadata(props).then(
|
||||
(_) => true,
|
||||
(_) => false
|
||||
);
|
||||
|
||||
export const errorCode = (code: number, error: string) => ({
|
||||
"error-code": [code, error] as const,
|
||||
|
||||
Reference in New Issue
Block a user