Skip to content

Commit fa4134d

Browse files
fix: secrete manager may return undefined (#45)
1 parent dcb78e8 commit fa4134d

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

packages/types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tailor-platform/function-types",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "TypeScript types for Tailor Platform Function service",
55
"repository": {
66
"type": "git",

packages/types/tailor.d.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,24 @@ declare const tailordb: {
3131
};
3232

3333
declare namespace tailor.secretmanager {
34-
// getSecrets returns multiple secret objects(key=name, value=secret) at once according to vault, names
35-
function getSecrets(vault: string, names: string[]): Promise<Record<string, string>>
36-
// getSecret returns a secret according to vault, name
37-
function getSecret(vault: string, name: string): Promise<string>
38-
}
34+
/**
35+
* getSecrets returns multiple secret objects (key = name, value = secret)
36+
* at once according to vault and secret names.
37+
*
38+
* If a secret does not exist, it will not be included in the result.
39+
*/
40+
function getSecrets<const T extends readonly string[]>(
41+
vault: string,
42+
names: T
43+
): Promise<Partial<Record<T[number], string>>>;
44+
45+
/**
46+
* getSecret returns a secret according to vault and name.
47+
*
48+
* If the secret does not exist, undefined is returned.
49+
*/
50+
function getSecret(
51+
vault: string,
52+
name: string
53+
): Promise<string | undefined>;
54+
}

0 commit comments

Comments
 (0)