jfrog-workers 0.17.0 → 0.19.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.
- package/dist/index.d.ts +66 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
import { AxiosInstance } from "axios";
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
2
|
+
export interface ExtendedAxios {
|
|
3
|
+
/**
|
|
4
|
+
* Triggers an HTTP GET request and does not wait for the response (fire-and-forget).
|
|
5
|
+
* Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects.
|
|
6
|
+
*/
|
|
7
|
+
getAndForget: <D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P>) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Triggers an HTTP PUT request and does not wait for the response (fire-and-forget).
|
|
10
|
+
* Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects.
|
|
11
|
+
*/
|
|
12
|
+
putAndForget: <D = any, P = any>(url: string, data?: D, config?: AxiosRequestConfig<D, P>) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Triggers an HTTP POST request and does not wait for the response (fire-and-forget).
|
|
15
|
+
* Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects.
|
|
16
|
+
*/
|
|
17
|
+
postAndForget: <D = any, P = any>(url: string, data?: D, config?: AxiosRequestConfig<D, P>) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Triggers an HTTP DELETE request and does not wait for the response (fire-and-forget).
|
|
20
|
+
* Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects.
|
|
21
|
+
*/
|
|
22
|
+
deleteAndForget: <D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P>) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Triggers an HTTP HEAD request and does not wait for the response (fire-and-forget).
|
|
25
|
+
* Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects.
|
|
26
|
+
*/
|
|
27
|
+
headAndForget: <D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P>) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Triggers an HTTP PATCH request and does not wait for the response (fire-and-forget).
|
|
30
|
+
* Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects.
|
|
31
|
+
*/
|
|
32
|
+
patchAndForget: <D = any, P = any>(url: string, data?: D, config?: AxiosRequestConfig<D, P>) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Triggers an HTTP REQUEST and does not wait for the response (fire-and-forget).
|
|
35
|
+
* Note: completion is not guaranteed. If the target server ties request processing to the client connection, it may abort the work when the client disconnects.
|
|
36
|
+
*/
|
|
37
|
+
requestAndForget: <D = any, P = any>(config: AxiosRequestConfig<D, P>) => void;
|
|
38
|
+
}
|
|
2
39
|
/**
|
|
3
40
|
* Response returned by JFrog platform API
|
|
4
41
|
*/
|
|
@@ -73,7 +110,7 @@ export interface PlatformClients {
|
|
|
73
110
|
/**
|
|
74
111
|
* HTTP client (axios) to perform requests to the outside
|
|
75
112
|
*/
|
|
76
|
-
axios: Pick<AxiosInstance, 'get' | 'put' | 'post' | 'delete' | 'head' | 'patch' | 'request'
|
|
113
|
+
axios: Pick<AxiosInstance, 'get' | 'put' | 'post' | 'delete' | 'head' | 'patch' | 'request'> & ExtendedAxios;
|
|
77
114
|
}
|
|
78
115
|
export interface PlatformSecrets {
|
|
79
116
|
/**
|
|
@@ -132,6 +169,29 @@ export interface PlatformHttpClientError {
|
|
|
132
169
|
*/
|
|
133
170
|
status: number;
|
|
134
171
|
}
|
|
172
|
+
export interface PlatformCrypto {
|
|
173
|
+
/**
|
|
174
|
+
* Computes a cryptographic hash of the given data
|
|
175
|
+
* @param {string} algorithm - The hash algorithm to use. Supported: 'sha256', 'sha512'
|
|
176
|
+
* @param {string} data - The data to hash
|
|
177
|
+
* @param {string} encoding - The output encoding. Defaults to 'hex'
|
|
178
|
+
*/
|
|
179
|
+
hash(algorithm: 'sha256' | 'sha512', data: string, encoding?: 'hex' | 'base64'): string;
|
|
180
|
+
/**
|
|
181
|
+
* Computes an HMAC of the given data using the given key
|
|
182
|
+
* @param {string} algorithm - The hash algorithm to use. Supported: 'sha256', 'sha512'
|
|
183
|
+
* @param {string} key - The HMAC key
|
|
184
|
+
* @param {string} data - The data to authenticate
|
|
185
|
+
* @param {string} encoding - The output encoding. Defaults to 'hex'
|
|
186
|
+
*/
|
|
187
|
+
hmac(algorithm: 'sha256' | 'sha512', key: string, data: string, encoding?: 'hex' | 'base64'): string;
|
|
188
|
+
/**
|
|
189
|
+
* Generates cryptographically secure random bytes
|
|
190
|
+
* @param {number} size - The number of random bytes to generate
|
|
191
|
+
* @param {string} encoding - The output encoding. Defaults to 'hex'
|
|
192
|
+
*/
|
|
193
|
+
randomBytes(size: number, encoding?: 'hex' | 'base64'): string;
|
|
194
|
+
}
|
|
135
195
|
export interface PlatformContext {
|
|
136
196
|
/**
|
|
137
197
|
* HTTP clients to perform requests to your JFrog platform or to the outside
|
|
@@ -160,6 +220,10 @@ export interface PlatformContext {
|
|
|
160
220
|
* NOTE: The state is limited in size and number of items. Check the Worker documentation for more details.
|
|
161
221
|
*/
|
|
162
222
|
state: StateManager;
|
|
223
|
+
/**
|
|
224
|
+
* Utility to compute cryptographic hashes, HMACs, and generate random bytes
|
|
225
|
+
*/
|
|
226
|
+
crypto: PlatformCrypto;
|
|
163
227
|
/**
|
|
164
228
|
* Will wait for the number of millisecond.
|
|
165
229
|
* The waiting time is limited by the execution time of the function.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jfrog-workers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "JFrog workers interfaces",
|
|
5
5
|
"homepage": "https://github.com/jfrog/workers-sample",
|
|
6
6
|
"contributors": [
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"url": "git+https://github.com/jfrog/workers-sample.git"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"axios": "1.
|
|
36
|
+
"axios": "1.20.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"typescript": "^
|
|
39
|
+
"typescript": "^7.0.2"
|
|
40
40
|
}
|
|
41
41
|
}
|