@tothalex/cloud 0.0.41 → 0.0.44

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tothalex/cloud",
3
- "version": "0.0.41",
3
+ "version": "0.0.44",
4
4
  "main": "",
5
5
  "types": "./src/index.d.ts",
6
6
  "files": [
@@ -0,0 +1,64 @@
1
+ declare module 'cloud/got' {
2
+ export interface GotOptions {
3
+ /** Request timeout in milliseconds */
4
+ timeout?: number
5
+ /** HTTP headers */
6
+ headers?: Record<string, string>
7
+ /** HTTP method (GET, POST, PUT, DELETE, PATCH, HEAD) */
8
+ method?: string
9
+ /** JSON body (automatically sets Content-Type: application/json) */
10
+ json?: unknown
11
+ /** Raw body string */
12
+ body?: string
13
+ /** Response type: 'json' (default) or 'text' */
14
+ responseType?: 'json' | 'text'
15
+ }
16
+
17
+ export interface GotResponse {
18
+ body: string
19
+ statusCode: number
20
+ headers: Record<string, string>
21
+ }
22
+
23
+ /**
24
+ * Make a GET request and return parsed JSON
25
+ * @param url The URL to request
26
+ * @param options Request options
27
+ * @returns Parsed JSON response (when responseType is 'json') or GotResponse object
28
+ */
29
+ export function get<T = unknown>(url: string, options?: GotOptions): Promise<T>
30
+
31
+ /**
32
+ * Make a POST request and return parsed JSON
33
+ * @param url The URL to request
34
+ * @param options Request options
35
+ * @returns Parsed JSON response (when responseType is 'json') or GotResponse object
36
+ */
37
+ export function post<T = unknown>(url: string, options?: GotOptions): Promise<T>
38
+
39
+ /**
40
+ * Make a PUT request and return parsed JSON
41
+ * @param url The URL to request
42
+ * @param options Request options
43
+ * @returns Parsed JSON response (when responseType is 'json') or GotResponse object
44
+ */
45
+ export function put<T = unknown>(url: string, options?: GotOptions): Promise<T>
46
+
47
+ /**
48
+ * Make a DELETE request and return parsed JSON
49
+ * @param url The URL to request
50
+ * @param options Request options
51
+ * @returns Parsed JSON response (when responseType is 'json') or GotResponse object
52
+ */
53
+ function _delete<T = unknown>(url: string, options?: GotOptions): Promise<T>
54
+ export { _delete as delete }
55
+
56
+ const got: {
57
+ get: typeof get
58
+ post: typeof post
59
+ put: typeof put
60
+ delete: typeof _delete
61
+ }
62
+
63
+ export default got
64
+ }
package/src/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="./cloud/cache.d.ts" />
2
2
  /// <reference types="./cloud/event.d.ts" />
3
+ /// <reference types="./cloud/got.d.ts" />
3
4
  /// <reference types="./cloud/index.d.ts" />
4
5
  /// <reference types="./cloud/postgres.d.ts" />
5
6
  /// <reference types="./cloud/secret.d.ts" />