@socketsecurity/sdk 1.11.2 → 2.0.2
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/CHANGELOG.md +42 -0
- package/README.md +53 -81
- package/dist/constants.d.ts +9 -1
- package/dist/http-client.d.ts +3 -1
- package/dist/socket-sdk-class.d.ts +25 -0
- package/dist/types.d.ts +10 -4
- package/package.json +48 -85
- package/types/api-helpers.d.ts +61 -53
- package/types/api.d.ts +1584 -926
- package/dist/constants.js +0 -30
- package/dist/file-upload.js +0 -142
- package/dist/http-client.js +0 -405
- package/dist/index.js +0 -47
- package/dist/package.json.js +0 -207
- package/dist/quota-utils.js +0 -175
- package/dist/socket-sdk-class.js +0 -1511
- package/dist/testing.js +0 -387
- package/dist/user-agent.js +0 -21
- package/dist/utils.js +0 -101
- /package/{requirements.json → data/api-method-quota-and-permissions.json} +0 -0
package/types/api-helpers.d.ts
CHANGED
|
@@ -1,61 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview
|
|
3
|
-
* Utility types for extracting return types and error types from OpenAPI operations.
|
|
4
|
-
* Based on openapi-typescript-fetch patterns.
|
|
2
|
+
* @fileoverview Helper types for working with generated OpenAPI types.
|
|
5
3
|
*/
|
|
6
|
-
declare type ValueOf<
|
|
7
|
-
ObjectType,
|
|
8
|
-
ValueType extends keyof ObjectType = keyof ObjectType,
|
|
9
|
-
> = ObjectType[ValueType]
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Extract the successful response type from an operation.
|
|
7
|
+
* Maps to the data property of the success result.
|
|
8
|
+
*/
|
|
9
|
+
export type OpReturnType<T> = T extends {
|
|
10
|
+
responses: {
|
|
11
|
+
200?: { content?: { 'application/json': infer U } }
|
|
12
|
+
}
|
|
19
13
|
}
|
|
20
|
-
?
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
? U
|
|
15
|
+
: T extends {
|
|
16
|
+
responses: {
|
|
17
|
+
201?: { content?: { 'application/json': infer U } }
|
|
18
|
+
}
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
: S extends 'default'
|
|
32
|
-
? R[S]
|
|
33
|
-
: unknown
|
|
34
|
-
}
|
|
35
|
-
: never
|
|
36
|
-
|
|
37
|
-
declare type _OpReturnType<T> = 200 extends keyof T
|
|
38
|
-
? T[200]
|
|
39
|
-
: 201 extends keyof T
|
|
40
|
-
? T[201]
|
|
41
|
-
: 'default' extends keyof T
|
|
42
|
-
? T['default']
|
|
20
|
+
? U
|
|
21
|
+
: T extends {
|
|
22
|
+
responses: {
|
|
23
|
+
204?: unknown
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
? undefined
|
|
43
27
|
: unknown
|
|
44
28
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export declare type OpReturnType<OP> = {
|
|
53
|
-
success: true
|
|
54
|
-
status: 200
|
|
55
|
-
data: _OpReturnType<OpResponseTypes<OP>>
|
|
29
|
+
/**
|
|
30
|
+
* Extract the error response type from an operation.
|
|
31
|
+
* Maps to the error structure of the error result.
|
|
32
|
+
*/
|
|
33
|
+
export type OpErrorType<T> = T extends {
|
|
34
|
+
responses: infer R
|
|
56
35
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
36
|
+
? R extends Record<string | number, unknown>
|
|
37
|
+
? {
|
|
38
|
+
[K in keyof R as K extends
|
|
39
|
+
| 400
|
|
40
|
+
| 401
|
|
41
|
+
| 403
|
|
42
|
+
| 404
|
|
43
|
+
| 409
|
|
44
|
+
| 422
|
|
45
|
+
| 429
|
|
46
|
+
| 500
|
|
47
|
+
| 502
|
|
48
|
+
| 503
|
|
49
|
+
? K
|
|
50
|
+
: never]: R[K]
|
|
51
|
+
}[keyof {
|
|
52
|
+
[K in keyof R as K extends
|
|
53
|
+
| 400
|
|
54
|
+
| 401
|
|
55
|
+
| 403
|
|
56
|
+
| 404
|
|
57
|
+
| 409
|
|
58
|
+
| 422
|
|
59
|
+
| 429
|
|
60
|
+
| 500
|
|
61
|
+
| 502
|
|
62
|
+
| 503
|
|
63
|
+
? K
|
|
64
|
+
: never]: R[K]
|
|
65
|
+
}] extends { content?: { 'application/json': infer E } }
|
|
66
|
+
? E
|
|
67
|
+
: { error?: string }
|
|
68
|
+
: { error?: string }
|
|
69
|
+
: { error?: string }
|