mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 02:11:56 +00:00
fix: Create or update Vault:
Updating the thing to always return a string. Make sure the key is in the vault
This commit is contained in:
@@ -63,10 +63,10 @@ export type Utils<Store, Vault, WrapperOverWrite = { const: never }> = {
|
|||||||
search: Record<string, string>
|
search: Record<string, string>
|
||||||
}) => NetworkInterfaceBuilder
|
}) => NetworkInterfaceBuilder
|
||||||
createOrUpdateVault: (opts: {
|
createOrUpdateVault: (opts: {
|
||||||
key: string
|
key: keyof Vault & string
|
||||||
value: string | null | undefined
|
value: string | null | undefined
|
||||||
generator: DefaultString
|
generator: DefaultString
|
||||||
}) => Promise<null | string>
|
}) => Promise<string>
|
||||||
getSystemSmtp: () => GetSystemSmtp & WrapperOverWrite
|
getSystemSmtp: () => GetSystemSmtp & WrapperOverWrite
|
||||||
host: {
|
host: {
|
||||||
static: (id: string) => StaticHost
|
static: (id: string) => StaticHost
|
||||||
@@ -129,7 +129,7 @@ export const utils = <
|
|||||||
value,
|
value,
|
||||||
generator,
|
generator,
|
||||||
}: {
|
}: {
|
||||||
key: string
|
key: keyof Vault & string
|
||||||
value: string | null | undefined
|
value: string | null | undefined
|
||||||
generator: DefaultString
|
generator: DefaultString
|
||||||
}) => {
|
}) => {
|
||||||
@@ -137,8 +137,9 @@ export const utils = <
|
|||||||
await effects.vault.set({ key, value })
|
await effects.vault.set({ key, value })
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
if (await effects.vault.get({ key, callback: noop })) {
|
const oldValue = await effects.vault.get({ key, callback: noop })
|
||||||
return null
|
if (oldValue) {
|
||||||
|
return oldValue
|
||||||
}
|
}
|
||||||
const newValue = getDefaultString(generator)
|
const newValue = getDefaultString(generator)
|
||||||
await effects.vault.set({ key, value: newValue })
|
await effects.vault.set({ key, value: newValue })
|
||||||
|
|||||||
Reference in New Issue
Block a user