mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 02:11:56 +00:00
feat: File
This commit is contained in:
@@ -628,6 +628,50 @@ export class Value<Type, Store, Vault> {
|
||||
}
|
||||
}, previousSpec.validator)
|
||||
}
|
||||
static file<Required extends boolean, Store, Vault>(a: {
|
||||
name: string
|
||||
description?: string | null
|
||||
warning?: string | null
|
||||
extensions: string[]
|
||||
required: Required
|
||||
}) {
|
||||
const buildValue = {
|
||||
type: "file" as const,
|
||||
description: null,
|
||||
warning: null,
|
||||
...a,
|
||||
}
|
||||
if (a.required) {
|
||||
return new Value<string, Store, Vault>(() => buildValue, string)
|
||||
}
|
||||
return new Value<string | null | undefined, Store, Vault>(
|
||||
() => buildValue,
|
||||
string.optional(),
|
||||
)
|
||||
}
|
||||
static dynamicFile<Required extends boolean, Store, Vault>(
|
||||
a: LazyBuild<
|
||||
Store,
|
||||
Vault,
|
||||
{
|
||||
name: string
|
||||
description?: string | null
|
||||
warning?: string | null
|
||||
extensions: string[]
|
||||
required: Required
|
||||
}
|
||||
>,
|
||||
) {
|
||||
return new Value<string | null | undefined, Store, Vault>(
|
||||
async (options) => ({
|
||||
type: "file" as const,
|
||||
description: null,
|
||||
warning: null,
|
||||
...(await a(options)),
|
||||
}),
|
||||
string.optional(),
|
||||
)
|
||||
}
|
||||
static union<Required extends RequiredDefault<string>, Type, Store, Vault>(
|
||||
a: {
|
||||
name: string
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.4.0-rev0.lib0.rc1",
|
||||
"version": "0.4.0-rev0.lib0.rc2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.4.0-rev0.lib0.rc1",
|
||||
"version": "0.4.0-rev0.lib0.rc2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@iarna/toml": "^2.2.5",
|
||||
|
||||
Reference in New Issue
Block a user