jfrog-workers 0.6.0 → 0.8.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 +91 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,13 @@ export interface PlatformHttpClient {
|
|
|
58
58
|
delete(endpoint: string, headers?: Record<string, string>): Promise<IPlatformHttpResponse>;
|
|
59
59
|
}
|
|
60
60
|
export interface PlatformClients {
|
|
61
|
+
/**
|
|
62
|
+
* HTTP client to perform requests to your JFrog platform
|
|
63
|
+
*/
|
|
61
64
|
platformHttp: PlatformHttpClient;
|
|
65
|
+
/**
|
|
66
|
+
* HTTP client (axios) to perform requests to the outside
|
|
67
|
+
*/
|
|
62
68
|
axios: Pick<AxiosInstance, 'get' | 'put' | 'post' | 'delete' | 'head' | 'patch' | 'request'>;
|
|
63
69
|
}
|
|
64
70
|
export interface PlatformSecrets {
|
|
@@ -68,8 +74,92 @@ export interface PlatformSecrets {
|
|
|
68
74
|
*/
|
|
69
75
|
get(secretKey: string): string;
|
|
70
76
|
}
|
|
77
|
+
export interface PlatformProperties {
|
|
78
|
+
/**
|
|
79
|
+
* Retrieves a Worker's property by its key
|
|
80
|
+
* @param {string} propertyKey - The property key
|
|
81
|
+
*/
|
|
82
|
+
get(propertyKey: string): string;
|
|
83
|
+
}
|
|
84
|
+
export interface StateManager {
|
|
85
|
+
/**
|
|
86
|
+
* Retrieves a value from the state by its key
|
|
87
|
+
* @param {string} key - The key of the value to retrieve
|
|
88
|
+
*/
|
|
89
|
+
get(key: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Sets a value in the state by its key
|
|
92
|
+
* @param {string} key - The key of the value to set
|
|
93
|
+
* @param {any} value - The value to set. If the value is not a string, it will be converted to a JSON string.
|
|
94
|
+
*/
|
|
95
|
+
set(key: string, value: any): void;
|
|
96
|
+
/**
|
|
97
|
+
* Checks if a value exists in the state by its key
|
|
98
|
+
* @param {string} key - The key of the value to check
|
|
99
|
+
* @returns {boolean} - True if the value exists, false otherwise
|
|
100
|
+
*/
|
|
101
|
+
has(key: string): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Deletes a value from the state by its key.
|
|
104
|
+
* If it does not exist, it does nothing.
|
|
105
|
+
* @param {string} key - The key of the value to delete
|
|
106
|
+
*/
|
|
107
|
+
delete(key: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* Clears the entire state
|
|
110
|
+
*/
|
|
111
|
+
clear(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Returns a copy of the entire state
|
|
114
|
+
*/
|
|
115
|
+
getAll(): Record<string, string>;
|
|
116
|
+
}
|
|
117
|
+
export interface PlatformHttpClientError {
|
|
118
|
+
/**
|
|
119
|
+
* The reason of the error
|
|
120
|
+
*/
|
|
121
|
+
message: string;
|
|
122
|
+
/**
|
|
123
|
+
* Http status
|
|
124
|
+
*/
|
|
125
|
+
status: number;
|
|
126
|
+
}
|
|
71
127
|
export interface PlatformContext {
|
|
72
|
-
|
|
128
|
+
/**
|
|
129
|
+
* HTTP clients to perform requests to your JFrog platform or to the outside
|
|
130
|
+
*/
|
|
73
131
|
clients: PlatformClients;
|
|
132
|
+
/**
|
|
133
|
+
* Utility to get access to your Worker's secrets
|
|
134
|
+
*/
|
|
74
135
|
secrets: PlatformSecrets;
|
|
136
|
+
/**
|
|
137
|
+
* Utility to get access to your Worker's properties
|
|
138
|
+
*/
|
|
139
|
+
properties: PlatformProperties;
|
|
140
|
+
/**
|
|
141
|
+
* The base URL of the JFrog platform
|
|
142
|
+
*/
|
|
143
|
+
baseUrl: string;
|
|
144
|
+
/**
|
|
145
|
+
* Token used when communicating with the JFrog platform
|
|
146
|
+
*/
|
|
147
|
+
platformToken: string;
|
|
148
|
+
/**
|
|
149
|
+
* State manager to store and retrieve state for this Worker between executions.
|
|
150
|
+
* NOTE: This state is not safe against concurrent executions of the same Worker.
|
|
151
|
+
* NOTE: The state will not be saved in case of execution failure.
|
|
152
|
+
* NOTE: The state is limited in size and number of items. Check the Worker documentation for more details.
|
|
153
|
+
*/
|
|
154
|
+
state: StateManager;
|
|
155
|
+
/**
|
|
156
|
+
* Will wait for the number of millisecond.
|
|
157
|
+
* The waiting time is limited by the execution time of the function.
|
|
158
|
+
* @param {number} delayMs - The number of milliseconds to wait
|
|
159
|
+
*/
|
|
160
|
+
wait(delayMs: number): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Will return the remaining execution time in milliseconds
|
|
163
|
+
*/
|
|
164
|
+
getRemainingExecutionTime(): number;
|
|
75
165
|
}
|