-
Notifications
You must be signed in to change notification settings - Fork 23
Add Workers tools #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
christophermiJfrog
wants to merge
1
commit into
jfrog:main
Choose a base branch
from
christophermiJfrog:workers-tools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| interface PlatformContext { | ||
| /** | ||
| * HTTP clients to perform requests to your JFrog platform or to the outside | ||
| */ | ||
| clients: PlatformClients; | ||
| /** | ||
| * Utility to get access to your Worker's secrets | ||
| */ | ||
| secrets: PlatformSecrets; | ||
| /** | ||
| * Utility to get access to your Worker's properties | ||
| */ | ||
| properties: PlatformProperties; | ||
| /** | ||
| * Token used when communicating with the JFrog platform | ||
| */ | ||
| platformToken: string; | ||
| /** | ||
| * Will wait for the number of millisecond. | ||
| * The waiting time is limited by the execution time of the function. | ||
| * @param {number} delayMs - The number of milliseconds to wait | ||
| */ | ||
| wait(delayMs: number): Promise<void>; | ||
| } | ||
|
|
||
| interface PlatformClients { | ||
| /** | ||
| * HTTP client to perform requests to your JFrog platform | ||
| */ | ||
| platformHttp: PlatformHttpClient | ||
| /** | ||
| * HTTP client (axios) to perform requests to the outside | ||
| */ | ||
| axios: AxiosInstance | ||
| } | ||
|
|
||
| interface PlatformSecrets { | ||
| /** | ||
| * Retrieves a secret by its key | ||
| * @param {string} secretKey - The secret key | ||
| */ | ||
| get(secretKey: string): string; | ||
| } | ||
|
|
||
| interface PlatformProperties { | ||
| /** | ||
| * Retrieves a Worker's property by its key | ||
| * @param {string} propertyKey - The property key | ||
| */ | ||
| get(propertyKey: string): string; | ||
| } | ||
|
|
||
| interface PlatformHttpClient { | ||
| /** | ||
| * Perform http GET request to JFrog platform | ||
| * @param {string} endpoint - API endpoint. E.g. /artifactory/api/repositories | ||
| * @param {Record<string, string>} headers - additional headers used in the request | ||
| */ | ||
| get(endpoint: string, headers?: Record<string, string>): Promise<IPlatformHttpResponse>; | ||
|
|
||
| /** | ||
| * Perform http POST request to JFrog platform | ||
| * @param {string} endpoint - API endpoint. E.g. /artifactory/api/repositories | ||
| * @param {any} requestData - data sent in request body | ||
| * @param {Record<string, string>} headers - additional headers used in the request | ||
| */ | ||
| post(endpoint: string, requestData?: any, headers?: Record<string, string>): Promise<IPlatformHttpResponse>; | ||
|
|
||
| /** | ||
| * Perform http PUT request to JFrog platform | ||
| * @param {string} endpoint - API endpoint. E.g. /artifactory/api/repositories | ||
| * @param {any} requestData - data sent in request body | ||
| * @param {Record<string, string>} headers - additional headers used in the request | ||
| */ | ||
| put(endpoint: string, requestData?: any, headers?: Record<string, string>): Promise<IPlatformHttpResponse>; | ||
|
|
||
| /** | ||
| * Perform http PATCH request to JFrog platform | ||
| * @param {string} endpoint - API endpoint. E.g. /artifactory/api/repositories | ||
| * @param {any} requestData - data sent in request body | ||
| * @param {Record<string, string>} headers - additional headers used in the request | ||
| */ | ||
| patch(endpoint: string, requestData?: any, headers?: Record<string, string>): Promise<IPlatformHttpResponse>; | ||
|
|
||
| /** | ||
| * Perform http DELETE request to JFrog platform | ||
| * @param {string} endpoint - API endpoint. E.g. /artifactory/api/repositories | ||
| * @param {Record<string, string>} headers - additional headers used in the request | ||
| */ | ||
| delete(endpoint: string, headers?: Record<string, string>): Promise<IPlatformHttpResponse>; | ||
| } | ||
|
|
||
| interface IPlatformHttpResponse { | ||
| /** | ||
| * Http status | ||
| */ | ||
| status: number; | ||
| /** | ||
| * Response headers | ||
| */ | ||
| headers: Record<string, string>; | ||
| /** | ||
| * Parsed response body (as json) | ||
| */ | ||
| data: any; | ||
| } | ||
|
|
||
| interface PlatformHttpClientError { | ||
| /** | ||
| * The reason of the error | ||
| */ | ||
| message: string; | ||
|
|
||
| /** | ||
| * Http status | ||
| */ | ||
| status: number; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.