-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathmaven-central-snapshots.service.js
46 lines (45 loc) · 1.5 KB
/
maven-central-snapshots.service.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { redirector, pathParam, queryParam } from '../index.js'
import { description } from '../maven-metadata/maven-metadata.js'
export default redirector({
category: 'version',
isDeprecated: false,
route: {
base: 'maven-central-snapshots/v',
pattern: ':groupId/:artifactId/:versionPrefix?',
},
openApi: {
'/maven-central-snapshots/v/{groupId}/{artifactId}': {
get: {
summary: 'Maven Central Snapshots Version',
description,
parameters: [
pathParam({ name: 'groupId', example: 'com.google.guava' }),
pathParam({ name: 'artifactId', example: 'guava' }),
queryParam({
name: 'versionPrefix',
example: '29',
description: 'Filter only versions with this prefix.',
}),
queryParam({
name: 'versionSuffix',
example: '-android',
description: 'Filter only versions with this suffix.',
}),
],
},
},
},
transformPath: () => '/maven-metadata/v',
transformQueryParams: ({ groupId, artifactId, versionPrefix }) => {
const group = encodeURIComponent(groupId).replace(/\./g, '/')
const artifact = encodeURIComponent(artifactId)
const metadataUrl = `https://central.sonatype.com/repository/maven-snapshots/${group}/${artifact}/maven-metadata.xml`
return {
metadataUrl,
label: 'maven-central-snapshots',
versionPrefix,
}
},
overrideTransformedQueryParams: true,
dateAdded: new Date('2021-06-12'),
})