-
Notifications
You must be signed in to change notification settings - Fork 0
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
✨🔧 452 - [Feature branch] - Add ega permissions integration #457
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
49b0512
Update docker-compose, .env.example files. add axios dep
anncatton 4227b2b
Update config, secrets values. Create egaClient with token fetch
anncatton 0e06d57
initial refresh token logic
anncatton cfa6d35
add ega endpoint constants
anncatton ce6d8a7
add section for env vars in readme
anncatton 912e16a
remove logs
anncatton 83be068
remove public key reference
anncatton aa42318
Add zod, update ts. Add expiry to approved app list data
anncatton 870ba74
Add api response types, permissions and users get funcs
anncatton 6162104
Add safe parsing for api list results. Add dacId to config
anncatton 3570e4a
add tsdocs
anncatton 76a740e
Add safeParse checks to ega client calls.
anncatton f62d34b
Add failure returns to ega client calls, restructure types
anncatton 14d35f4
remove empty file
anncatton 12bb890
move failure types to separate file, add appId to approved users data
anncatton e995c79
modify list response types
anncatton 965f0bb
Create ega permissions main job function, add happy path flow
anncatton e866b2b
move safeParseArray to own file, update imports
anncatton ab2e9bc
Merge pull request #458 from icgc-argo/453-ega-api-funcs
anncatton cacf7cb
Merge branch '452-ega-auth-client' into 454-implement-job-flow
anncatton ef48443
WIP - fix for pagination when checking permissions
anncatton 04879b4
Expand tsdocs
anncatton 951bebc
add comment for api bug, reorg ega services
anncatton f4be3e8
move custom errors to types dir
anncatton 816df19
➕ Add pThrottle dependency as source code, rate limit ega client func…
anncatton 9476767
rename types + util functions for clarity
anncatton 81d23b6
remove unneeded fields from EgaPermissionRequest response schema
anncatton 5bbda86
Add refresh token logic for 401 errors. Fetch all user permissions in…
anncatton db89e47
Merge pull request #460 from icgc-argo/454-implement-job-flow
anncatton e92dab7
Add ega public key fetch to secrets
anncatton b25cca9
Split clients into separate files. Fix error handling order
anncatton 9cb3949
Adds ega job report data. Adds job to main batch job, with feature fl…
anncatton 041962a
add newline, cleanup
anncatton d7e93d1
add axios-retry to egaClient
anncatton 4d3a9d1
improve ega report structure, add example report to tsdoc
anncatton 7880d28
remove unnecessary comments
anncatton 5a1d79b
reject promise when max retry limit exceeded, add retry limits to con…
anncatton afbb2c0
Merge pull request #463 from icgc-argo/455-implement-error-retry
anncatton a227b1e
Merge pull request #462 from icgc-argo/add-refresh-token-flow
anncatton 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 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 |
---|---|---|
|
@@ -26,7 +26,7 @@ JWT_TOKEN_PUBLIC_KEY= | |
############ | ||
# true or false | ||
VAULT_ENABLED=false | ||
VAULT_SECRETS_PATH=/service/secrets_v1 | ||
VAULT_SECRETS_PATH= | ||
VAULT_URL= | ||
VAULT_ROLE= | ||
# for local development/testing | ||
|
@@ -48,34 +48,34 @@ DACO_REVIEW_POLICY_NAME=DACO-REVIEW | |
############ | ||
# Storage # | ||
############ | ||
OBJECT_STORAGE_ENDPOINT=https://object.cancercollaboratory.org:9080 | ||
OBJECT_STORAGE_REGION= | ||
OBJECT_STORAGE_BUCKET= | ||
OBJECT_STORAGE_KEY= | ||
OBJECT_STORAGE_SECRET= | ||
OBJECT_STORAGE_ENDPOINT=http://localhost:8085 | ||
OBJECT_STORAGE_REGION=nova | ||
OBJECT_STORAGE_BUCKET=daco | ||
OBJECT_STORAGE_KEY=minio | ||
OBJECT_STORAGE_SECRET=minio123 | ||
OBJECT_STORAGE_TIMEOUT_MILLIS=5000 | ||
|
||
|
||
############ | ||
# EMAIL # | ||
############ | ||
EMAIL_HOST=smtp.gmail.com | ||
EMAIL_PORT=587 | ||
EMAIL_HOST=localhost | ||
EMAIL_PORT=1025 | ||
EMAIL_USER= | ||
EMAIL_PASSWORD= | ||
EMAIL_FROM_ADDRESS= | ||
EMAIL_FROM_NAME= | ||
EMAIL_DACO_ADDRESS= | ||
EMAIL_FROM_ADDRESS=[email protected] | ||
EMAIL_FROM_NAME=DacoAdmin | ||
EMAIL_DACO_ADDRESS=[email protected] | ||
# for emails directed to daco reviewers | ||
EMAIL_REVIEWER_FIRSTNAME= | ||
EMAIL_REVIEWER_LASTNAME= | ||
EMAIL_REVIEWER_FIRSTNAME=DACO | ||
EMAIL_REVIEWER_LASTNAME=ADMIN | ||
DCC_MAILING_LIST= | ||
DACO_SURVEY_URL= | ||
|
||
############## | ||
# UI # | ||
############## | ||
DACO_UI_BASE_URL=https://dac.dev.argo.cancercollaboratory.org | ||
DACO_UI_BASE_URL=http://localhost:3000 | ||
DACO_UI_APPLICATION_SECTION_PATH=/applications/{id}?section={section} | ||
|
||
############## | ||
|
@@ -88,16 +88,16 @@ FILE_UPLOAD_LIMIT=#in bytes x * 1024 * 1024 | |
############## | ||
|
||
# ATTESTATION | ||
ATTESTATION_UNIT_COUNT= | ||
ATTESTATION_UNIT_OF_TIME= | ||
DAYS_TO_ATTESTATION= | ||
ATTESTATION_UNIT_COUNT=1 | ||
ATTESTATION_UNIT_OF_TIME=years | ||
DAYS_TO_ATTESTATION=45 | ||
|
||
# EXPIRY | ||
DAYS_TO_EXPIRY_1= | ||
DAYS_TO_EXPIRY_2= | ||
DAYS_POST_EXPIRY= | ||
EXPIRY_UNIT_COUNT= | ||
EXPIRY_UNIT_OF_TIME= | ||
DAYS_TO_EXPIRY_1=90 | ||
DAYS_TO_EXPIRY_2=45 | ||
DAYS_POST_EXPIRY=90 | ||
EXPIRY_UNIT_COUNT=2 | ||
EXPIRY_UNIT_OF_TIME=years | ||
|
||
############# | ||
# Daco Encryption | ||
|
@@ -109,3 +109,19 @@ DACO_ENCRYPTION_KEY= | |
############# | ||
FEATURE_RENEWAL_ENABLED=false | ||
FEATURE_ADMIN_PAUSE_ENABLED=false | ||
FEATURE_EGA_RECONCILIATION_ENABLED=false | ||
|
||
############# | ||
# EGA | ||
############# | ||
EGA_CLIENT_ID= | ||
EGA_AUTH_HOST= | ||
EGA_AUTH_REALM_NAME= | ||
EGA_API_URL= | ||
EGA_USERNAME= | ||
EGA_PASSWORD= | ||
DAC_ID= | ||
EGA_MAX_REQUEST_LIMIT=3; | ||
EGA_MAX_REQUEST_INTERVAL=1000; # in milliseconds | ||
EGA_MAX_REQUEST_RETRIES=3 | ||
EGA_MAX_ACCESS_TOKEN_REQUEST_RETRIES=5 |
This file contains 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 |
---|---|---|
|
@@ -62,4 +62,5 @@ typings/ | |
dist/ | ||
|
||
# misc | ||
.DS_Store | ||
.DS_Store | ||
.vscode/settings.json |
This file contains 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 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 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 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,119 @@ | ||
export class AbortError extends Error { | ||
readonly name: 'AbortError'; | ||
|
||
private constructor(); | ||
} | ||
|
||
type AnyFunction = (...arguments_: readonly any[]) => unknown; | ||
|
||
export type ThrottledFunction<F extends AnyFunction> = F & { | ||
/** | ||
Whether future function calls should be throttled or count towards throttling thresholds. | ||
|
||
@default true | ||
*/ | ||
isEnabled: boolean; | ||
|
||
/** | ||
The number of queued items waiting to be executed. | ||
*/ | ||
readonly queueSize: number; | ||
|
||
/** | ||
Abort pending executions. All unresolved promises are rejected with a `pThrottle.AbortError` error. | ||
*/ | ||
abort(): void; | ||
}; | ||
|
||
export type Options = { | ||
/** | ||
The maximum number of calls within an `interval`. | ||
*/ | ||
readonly limit: number; | ||
|
||
/** | ||
The timespan for `limit` in milliseconds. | ||
*/ | ||
readonly interval: number; | ||
|
||
/** | ||
Use a strict, more resource intensive, throttling algorithm. The default algorithm uses a windowed approach that will work correctly in most cases, limiting the total number of calls at the specified limit per interval window. The strict algorithm throttles each call individually, ensuring the limit is not exceeded for any interval. | ||
|
||
@default false | ||
*/ | ||
readonly strict?: boolean; | ||
|
||
/** | ||
Get notified when function calls are delayed due to exceeding the `limit` of allowed calls within the given `interval`. The delayed call arguments are passed to the `onDelay` callback. | ||
|
||
Can be useful for monitoring the throttling efficiency. | ||
|
||
@example | ||
``` | ||
import pThrottle from 'p-throttle'; | ||
|
||
const throttle = pThrottle({ | ||
limit: 2, | ||
interval: 1000, | ||
onDelay: (a, b) => { | ||
console.log(`Reached interval limit, call is delayed for ${a} ${b}`); | ||
}, | ||
}); | ||
|
||
const throttled = throttle((a, b) => { | ||
console.log(`Executing with ${a} ${b}...`); | ||
}); | ||
|
||
await throttled(1, 2); | ||
await throttled(3, 4); | ||
await throttled(5, 6); | ||
//=> Executing with 1 2... | ||
//=> Executing with 3 4... | ||
//=> Reached interval limit, call is delayed for 5 6 | ||
//=> Executing with 5 6... | ||
``` | ||
*/ | ||
readonly onDelay?: (...arguments_: readonly any[]) => void; | ||
}; | ||
|
||
/** | ||
Throttle promise-returning/async/normal functions. | ||
|
||
It rate-limits function calls without discarding them, making it ideal for external API interactions where avoiding call loss is crucial. | ||
|
||
@returns A throttle function. | ||
|
||
Both the `limit` and `interval` options must be specified. | ||
|
||
@example | ||
``` | ||
import pThrottle from 'p-throttle'; | ||
|
||
const now = Date.now(); | ||
|
||
const throttle = pThrottle({ | ||
limit: 2, | ||
interval: 1000 | ||
}); | ||
|
||
const throttled = throttle(async index => { | ||
const secDiff = ((Date.now() - now) / 1000).toFixed(); | ||
return `${index}: ${secDiff}s`; | ||
}); | ||
|
||
for (let index = 1; index <= 6; index++) { | ||
(async () => { | ||
console.log(await throttled(index)); | ||
})(); | ||
} | ||
//=> 1: 0s | ||
//=> 2: 0s | ||
//=> 3: 1s | ||
//=> 4: 1s | ||
//=> 5: 2s | ||
//=> 6: 2s | ||
``` | ||
*/ | ||
export default function pThrottle( | ||
options: Options, | ||
): <F extends AnyFunction>(function_: F) => ThrottledFunction<F>; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for removing specific system references.