feat: Remove the vault

This commit is contained in:
Blu-J
2023-05-30 17:36:30 -06:00
parent 613bf74180
commit 3f5dbc6a4b
24 changed files with 308 additions and 515 deletions

View File

@@ -22,9 +22,9 @@ export const authorizationList = List.string({
export const auth = Value.list(authorizationList);
```
*/
export class List<Type, Store, Vault> {
export class List<Type, Store> {
private constructor(
public build: LazyBuild<Store, Vault, ValueSpecList>,
public build: LazyBuild<Store, ValueSpecList>,
public validator: Parser<unknown, Type>,
) {}
static text(
@@ -49,7 +49,7 @@ export class List<Type, Store, Vault> {
generate?: null | RandomString
},
) {
return new List<string[], never, never>(() => {
return new List<string[], never>(() => {
const spec = {
type: "text" as const,
placeholder: null,
@@ -74,10 +74,9 @@ export class List<Type, Store, Vault> {
return built
}, arrayOf(string))
}
static dynamicText<Store = never, Vault = never>(
static dynamicText<Store = never>(
getA: LazyBuild<
Store,
Vault,
{
name: string
description?: string | null
@@ -101,7 +100,7 @@ export class List<Type, Store, Vault> {
}
>,
) {
return new List<string[], Store, Vault>(async (options) => {
return new List<string[], Store>(async (options) => {
const { spec: aSpec, ...a } = await getA(options)
const spec = {
type: "text" as const,
@@ -146,7 +145,7 @@ export class List<Type, Store, Vault> {
placeholder?: string | null
},
) {
return new List<number[], never, never>(() => {
return new List<number[], never>(() => {
const spec = {
type: "number" as const,
placeholder: null,
@@ -170,10 +169,9 @@ export class List<Type, Store, Vault> {
return built
}, arrayOf(number))
}
static dynamicNumber<Store = never, Vault = never>(
static dynamicNumber<Store = never>(
getA: LazyBuild<
Store,
Vault,
{
name: string
description?: string | null
@@ -194,7 +192,7 @@ export class List<Type, Store, Vault> {
}
>,
) {
return new List<number[], Store, Vault>(async (options) => {
return new List<number[], Store>(async (options) => {
const { spec: aSpec, ...a } = await getA(options)
const spec = {
type: "number" as const,
@@ -218,7 +216,7 @@ export class List<Type, Store, Vault> {
}
}, arrayOf(number))
}
static obj<Type extends Record<string, any>, Store, Vault>(
static obj<Type extends Record<string, any>, Store>(
a: {
name: string
description?: string | null
@@ -229,12 +227,12 @@ export class List<Type, Store, Vault> {
maxLength?: number | null
},
aSpec: {
spec: Config<Type, Store, Vault>
spec: Config<Type, Store>
displayAs?: null | string
uniqueBy?: null | UniqueBy
},
) {
return new List<Type[], Store, Vault>(async (options) => {
return new List<Type[], Store>(async (options) => {
const { spec: previousSpecSpec, ...restSpec } = aSpec
const specSpec = await previousSpecSpec.build(options)
const spec = {
@@ -276,6 +274,6 @@ export class List<Type, Store, Vault> {
```
*/
withStore<NewStore extends Store extends never ? any : Store>() {
return this as any as List<Type, NewStore, Vault>
return this as any as List<Type, NewStore>
}
}