@tailor-platform/function-types 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tailor.d.ts +69 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/function-types",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "TypeScript types for Tailor Platform Function service",
5
5
  "repository": {
6
6
  "type": "git",
package/tailor.d.ts CHANGED
@@ -31,8 +31,73 @@ declare const tailordb: {
31
31
  };
32
32
 
33
33
  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>
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
+ }
55
+
56
+ declare namespace tailor.iconv {
57
+ /**
58
+ * Convert string from one encoding to another
59
+ */
60
+ function convert<T extends string>(
61
+ str: string | Uint8Array | ArrayBuffer,
62
+ fromEncoding: string,
63
+ toEncoding: T
64
+ ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array;
65
+
66
+ /**
67
+ * Convert buffer from one encoding to another
68
+ */
69
+ function convertBuffer<T extends string>(
70
+ buffer: Uint8Array | ArrayBuffer,
71
+ fromEncoding: string,
72
+ toEncoding: T
73
+ ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array;
74
+
75
+ /**
76
+ * Decode buffer to string
77
+ */
78
+ function decode<T extends string>(
79
+ buffer: Uint8Array | ArrayBuffer,
80
+ encoding: T
81
+ ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array;
82
+
83
+ /**
84
+ * Encode string to buffer
85
+ */
86
+ function encode<T extends string>(
87
+ str: string,
88
+ encoding: T
89
+ ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array;
90
+
91
+ /**
92
+ * Get list of supported encodings
93
+ */
94
+ function encodings(): string[];
95
+
96
+ /**
97
+ * Iconv class for compatibility with node-iconv
98
+ */
99
+ class Iconv {
100
+ constructor(fromEncoding: string, toEncoding: string);
101
+ convert(input: string | Uint8Array | ArrayBuffer): string | Uint8Array;
102
+ }
38
103
  }