-
Notifications
You must be signed in to change notification settings - Fork 84
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
feat: proxy mode [sql changed] #571
Merged
Merged
Changes from 51 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
151369f
feat: add proxy service.
hezhengxu2018 8899223
feat: create task when proxy.
hezhengxu2018 7480e60
fix: revert npmRegistry.
hezhengxu2018 f3ef419
fix: npm registry adapter.
hezhengxu2018 03b10cc
feat: init proxy mode sql.
hezhengxu2018 be7c244
fix: not allow check update.
hezhengxu2018 c05faa7
feat: init proxy file repo.
hezhengxu2018 ce74646
fix: add config limit.
hezhengxu2018 09eedcc
refactor: rename function.
hezhengxu2018 c264260
feat: init schedule.
hezhengxu2018 1529ba9
feat: init task.
hezhengxu2018 d7e6c8c
feat: init task type.
hezhengxu2018 5fd1b14
feat: rename model.
hezhengxu2018 ee6beac
wip: proxy contorller.
hezhengxu2018 c50b0a8
wip: modify entity.
hezhengxu2018 186e60c
feat: realize basic func.
hezhengxu2018 02b30f2
fix: fix type.
hezhengxu2018 c3fb522
fix: fix intarval.
hezhengxu2018 7025d4d
test: add service test.
hezhengxu2018 9d2d231
test: fix test
hezhengxu2018 68cf8c9
test: add schedule & controller test.
hezhengxu2018 8fc57ec
test: fix test.
hezhengxu2018 aae817c
style: rename sql file.
hezhengxu2018 af7007d
fix: use buffer instead of TextDecoder.
hezhengxu2018 0776afc
feat: support clear cache.
hezhengxu2018 bb6159a
test: add proxy cache controller test.
hezhengxu2018 393d260
fix: fix update proxy cache interval
hezhengxu2018 fca9459
fix: unnecessary slash.
hezhengxu2018 ea40dba
chore: rename constant, improve type infer.
hezhengxu2018 dbe07d7
feat: use proxy instead of downloadToTempfile
hezhengxu2018 4435779
feat: add remote auth token.
hezhengxu2018 77285f3
feat: try remove cache dir.
hezhengxu2018 c5bc58d
feat: improve perf.
hezhengxu2018 0576532
test: improve test.
hezhengxu2018 e59ab0d
fix: use run in background.
hezhengxu2018 f2f85fe
fix: rename constant
hezhengxu2018 1d5a9f7
fix: rollback to temp tgz file.
hezhengxu2018 9526880
fix: remove unused value.
hezhengxu2018 42bff6a
feat: use stream instead of temp file.
hezhengxu2018 09a9304
refactor: package version controller in proxy mode.
hezhengxu2018 6e11691
refactor: package controller & package version controller.
hezhengxu2018 42c5f97
test: fix proxy controller test.
hezhengxu2018 176d336
fix: fix error proxy header.
hezhengxu2018 8e64b36
test: fix download package version tar controller.
hezhengxu2018 ca5b91c
refactor: rename function
hezhengxu2018 fe1c16c
fix: set version default value to null
hezhengxu2018 19b348d
test: improve unit test cov.
hezhengxu2018 f2c84ed
test: improve unit test cov.
hezhengxu2018 732be72
refactor: rename function
hezhengxu2018 63d610b
fix: convert stream
hezhengxu2018 ce71b9f
fix: stream type error.
hezhengxu2018 1ce994c
fix: enlarge retry times
hezhengxu2018 b07a17a
Rename 3.47.0.sql to 3.67.0.sql
fengmk2 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
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,42 @@ | ||
import { Entity, EntityData } from './Entity'; | ||
import { EasyData } from '../util/EntityUtil'; | ||
import { DIST_NAMES } from './Package'; | ||
import { isPkgManifest } from '../service/ProxyCacheService'; | ||
import { PROXY_CACHE_DIR_NAME } from '../../common/constants'; | ||
interface ProxyCacheData extends EntityData { | ||
fullname: string; | ||
fileType: DIST_NAMES; | ||
version?: string; | ||
} | ||
|
||
export type CreateProxyCacheData = Omit<EasyData<ProxyCacheData, 'id'>, 'id'| 'filePath'>; | ||
|
||
export class ProxyCache extends Entity { | ||
readonly fullname: string; | ||
readonly fileType: DIST_NAMES; | ||
readonly filePath: string; | ||
readonly version?: string; | ||
|
||
constructor(data: ProxyCacheData) { | ||
super(data); | ||
this.fullname = data.fullname; | ||
this.fileType = data.fileType; | ||
this.version = data.version; | ||
if (isPkgManifest(data.fileType)) { | ||
this.filePath = `/${PROXY_CACHE_DIR_NAME}/${data.fullname}/${data.fileType}`; | ||
} else { | ||
this.filePath = `/${PROXY_CACHE_DIR_NAME}/${data.fullname}/${data.version}/${data.fileType}`; | ||
} | ||
} | ||
|
||
public static create(data: CreateProxyCacheData): ProxyCache { | ||
const newData = { ...data, createdAt: new Date(), updatedAt: new Date() }; | ||
return new ProxyCache(newData); | ||
} | ||
|
||
public static update(data: ProxyCache): ProxyCache { | ||
data.updatedAt = new Date(); | ||
return data; | ||
} | ||
|
||
} |
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
Oops, something went wrong.
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.
Tip
Codebase Verification
Add test coverage for the new task creation logic.
The logic in
createUpdateProxyCache
for throwing an error when the file type is not a package manifest is not covered by tests. Ensuring this logic is tested will prevent future regressions.createUpdateProxyCache
orInternalServerError
related to this logic were found in the test files.Please add test cases to cover this scenario.
Analysis chain
Add test coverage for the new task creation logic.
The new logic in
createUpdateProxyCache
for throwing an error when the file type is not a package manifest is not covered by tests. Ensuring this logic is tested will prevent future regressions.Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 83
Script:
Length of output: 84
Script:
Length of output: 358
Script:
Length of output: 144
Script:
Length of output: 741
Script:
Length of output: 33
Script:
Length of output: 30
Tools
GitHub Check: codecov/patch