@verdaccio/server 6.0.0-6-next.29 → 6.0.0-6-next.32
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/.babelrc +1 -1
- package/CHANGELOG.md +91 -0
- package/build/debug/index.d.ts +1 -1
- package/build/debug/index.js +1 -1
- package/build/debug/index.js.map +1 -1
- package/build/env.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/server.d.ts +2 -2
- package/build/server.js +5 -3
- package/build/server.js.map +1 -1
- package/build/utils.d.ts +1 -0
- package/build/utils.js +19 -0
- package/build/utils.js.map +1 -0
- package/jest.config.js +7 -2
- package/package.json +70 -71
- package/src/debug/index.ts +2 -2
- package/src/server.ts +8 -7
- package/src/utils.ts +11 -0
- package/test/_helper.ts +29 -0
- package/test/config/conf.yaml +28 -0
- package/test/config/no_debug.yaml +26 -0
- package/test/config/powered-custom.yaml +29 -0
- package/test/config/powered-disabled.yaml +29 -0
- package/test/config/web-disabled.yaml +27 -0
- package/test/server.spec.ts +113 -0
- package/tsconfig.build.json +1 -1
- package/tsconfig.json +14 -14
- package/jest.setup.js +0 -1
- package/test/.eslintrc +0 -8
- package/test/README.md +0 -12
- package/test/api/api.spec.yaml +0 -87
- package/test/api/helpers/publish-api.js +0 -60
- package/test/api/helpers/utils.ts +0 -149
- package/test/api/htpasswd +0 -10
- package/test/api/index.spec.ts +0 -862
- package/test/api/mock/store/@jquery/jquery/jquery-1.5.1.tgz +0 -0
- package/test/api/mock/store/@jquery/jquery/package.json +0 -76
- package/test/api/mock/store/corrupted-package/package.json +0 -12
- package/test/api/mock/store/jquery/jquery-1.5.1.tgz +0 -0
- package/test/api/mock/store/jquery/package.json +0 -4919
- package/test/api/mock/store/npm_test/package.json +0 -75
- package/test/api/mock/store/vue/package.json +0 -25169
- package/test/api/plugin/filter.ts +0 -25
- package/test/basic/basic.yaml +0 -14
- package/test/basic/index.spec.ts +0 -64
- package/test/jwt/index.spec.ts +0 -163
- package/test/jwt/jwt.yaml +0 -35
- package/test/jwt/mock/store/vue/package.json +0 -25169
- package/test/package-access/index.spec.ts +0 -100
- package/test/package-access/mock/store/.gitkeep +0 -0
- package/test/package-access/mock/store/jquery/jquery-1.5.1.tgz +0 -0
- package/test/package-access/mock/store/jquery/package.json +0 -4919
- package/test/package-access/mock/store/vue/package.json +0 -25169
- package/test/package-access/pkg.access.yaml +0 -12
- package/test/profile/index.spec.ts +0 -129
- package/test/profile/mock/store/.gitkeep +0 -0
- package/test/profile/profile.yaml +0 -21
- package/test/storage/index.spec.ts +0 -219
- package/test/storage/mock/store/@jquery/jquery/jquery-1.5.1.tgz +0 -0
- package/test/storage/mock/store/@jquery/jquery/package.json +0 -76
- package/test/storage/mock/store/corrupted-package/package.json +0 -12
- package/test/storage/mock/store/jquery/jquery-1.5.1.tgz +0 -0
- package/test/storage/mock/store/jquery/package.json +0 -4919
- package/test/storage/mock/store/npm_test/package.json +0 -75
- package/test/storage/store.spec.yaml +0 -24
- package/test/token/index.spec.ts +0 -227
- package/test/token/mock/store/.gitkeep +0 -0
- package/test/token/token.spec.yaml +0 -26
- package/test/web/index.spec.ts +0 -157
- package/test/web/mock/store/.gitkeep +0 -0
- package/test/web/partials/forbidden-place.js +0 -50
- package/test/web/partials/publish-api.js +0 -50
- package/test/web/web.yaml +0 -20
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# storage: this is generated on _helper file
|
|
2
|
+
|
|
3
|
+
auth:
|
|
4
|
+
htpasswd:
|
|
5
|
+
file: ./htpasswd-package
|
|
6
|
+
|
|
7
|
+
web:
|
|
8
|
+
enable: true
|
|
9
|
+
|
|
10
|
+
user_agent: 'custom user agent'
|
|
11
|
+
|
|
12
|
+
publish:
|
|
13
|
+
allow_offline: false
|
|
14
|
+
|
|
15
|
+
uplinks:
|
|
16
|
+
|
|
17
|
+
log: { type: stdout, format: pretty, level: trace }
|
|
18
|
+
|
|
19
|
+
packages:
|
|
20
|
+
'@*/*':
|
|
21
|
+
access: $all
|
|
22
|
+
publish: $all
|
|
23
|
+
unpublish: none
|
|
24
|
+
'**':
|
|
25
|
+
access: $all
|
|
26
|
+
publish: $all
|
|
27
|
+
unpublish: none
|
|
28
|
+
|
|
29
|
+
_debug: true
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# storage: this is generated on _helper file
|
|
2
|
+
|
|
3
|
+
auth:
|
|
4
|
+
htpasswd:
|
|
5
|
+
file: ./htpasswd-package
|
|
6
|
+
|
|
7
|
+
web:
|
|
8
|
+
enable: true
|
|
9
|
+
|
|
10
|
+
user_agent: false
|
|
11
|
+
|
|
12
|
+
publish:
|
|
13
|
+
allow_offline: false
|
|
14
|
+
|
|
15
|
+
uplinks:
|
|
16
|
+
|
|
17
|
+
log: { type: stdout, format: pretty, level: trace }
|
|
18
|
+
|
|
19
|
+
packages:
|
|
20
|
+
'@*/*':
|
|
21
|
+
access: $all
|
|
22
|
+
publish: $all
|
|
23
|
+
unpublish: none
|
|
24
|
+
'**':
|
|
25
|
+
access: $all
|
|
26
|
+
publish: $all
|
|
27
|
+
unpublish: none
|
|
28
|
+
|
|
29
|
+
_debug: true
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# storage: this is generated on _helper file
|
|
2
|
+
|
|
3
|
+
auth:
|
|
4
|
+
htpasswd:
|
|
5
|
+
file: ./htpasswd-package
|
|
6
|
+
|
|
7
|
+
web:
|
|
8
|
+
enable: false
|
|
9
|
+
|
|
10
|
+
publish:
|
|
11
|
+
allow_offline: false
|
|
12
|
+
|
|
13
|
+
uplinks:
|
|
14
|
+
|
|
15
|
+
log: { type: stdout, format: pretty, level: trace }
|
|
16
|
+
|
|
17
|
+
packages:
|
|
18
|
+
'@*/*':
|
|
19
|
+
access: $all
|
|
20
|
+
publish: $all
|
|
21
|
+
unpublish: none
|
|
22
|
+
'**':
|
|
23
|
+
access: $all
|
|
24
|
+
publish: $all
|
|
25
|
+
unpublish: none
|
|
26
|
+
|
|
27
|
+
_debug: true
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import supertest from 'supertest';
|
|
2
|
+
|
|
3
|
+
import { API_ERROR, HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
|
|
4
|
+
|
|
5
|
+
import { initializeServer } from './_helper';
|
|
6
|
+
|
|
7
|
+
test('should request any package', async () => {
|
|
8
|
+
const app = await initializeServer('conf.yaml');
|
|
9
|
+
await supertest(app)
|
|
10
|
+
.get('/jquery')
|
|
11
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
|
12
|
+
.expect(HTTP_STATUS.NOT_FOUND);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('should able to catch non defined routes with 404', async () => {
|
|
16
|
+
const app = await initializeServer('conf.yaml');
|
|
17
|
+
await supertest(app)
|
|
18
|
+
.get('/-/this-does-not-exist-anywhere')
|
|
19
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
|
20
|
+
.expect(HTTP_STATUS.NOT_FOUND);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('should return index page if web is enabled', async () => {
|
|
24
|
+
const app = await initializeServer('conf.yaml');
|
|
25
|
+
const response = await supertest(app)
|
|
26
|
+
.get('/')
|
|
27
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_HTML_UTF8)
|
|
28
|
+
.expect(HEADER_TYPE.CONTENT_ENCODING, HEADERS.GZIP)
|
|
29
|
+
.expect(HTTP_STATUS.OK);
|
|
30
|
+
expect(response.text).toMatch('<title>verdaccio</title>');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('should define rate limit headers', async () => {
|
|
34
|
+
const app = await initializeServer('conf.yaml');
|
|
35
|
+
await supertest(app)
|
|
36
|
+
.get('/')
|
|
37
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_HTML_UTF8)
|
|
38
|
+
.expect('x-ratelimit-limit', '10000')
|
|
39
|
+
.expect('x-ratelimit-remaining', '9999')
|
|
40
|
+
.expect(HTTP_STATUS.OK);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('should contains cors headers', async () => {
|
|
44
|
+
const app = await initializeServer('conf.yaml');
|
|
45
|
+
await supertest(app).get('/').expect('access-control-allow-origin', '*').expect(HTTP_STATUS.OK);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('should contains etag', async () => {
|
|
49
|
+
const app = await initializeServer('conf.yaml');
|
|
50
|
+
const response = await supertest(app)
|
|
51
|
+
.get('/')
|
|
52
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_HTML_UTF8)
|
|
53
|
+
.expect(HTTP_STATUS.OK);
|
|
54
|
+
const etag = response.get(HEADERS.ETAG);
|
|
55
|
+
expect(typeof etag === 'string').toBeTruthy();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('should contains powered by header', async () => {
|
|
59
|
+
const app = await initializeServer('conf.yaml');
|
|
60
|
+
const response = await supertest(app)
|
|
61
|
+
.get('/')
|
|
62
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_HTML_UTF8)
|
|
63
|
+
.expect(HTTP_STATUS.OK);
|
|
64
|
+
const powered = response.get('x-powered-by');
|
|
65
|
+
expect(powered).toMatch('verdaccio/6');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('should not contains powered header', async () => {
|
|
69
|
+
const app = await initializeServer('powered-disabled.yaml');
|
|
70
|
+
const response = await supertest(app)
|
|
71
|
+
.get('/')
|
|
72
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_HTML_UTF8)
|
|
73
|
+
.expect(HTTP_STATUS.OK);
|
|
74
|
+
const powered = response.get('x-powered-by');
|
|
75
|
+
expect(powered).toEqual('hidden');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('should contains custom powered header', async () => {
|
|
79
|
+
const app = await initializeServer('powered-custom.yaml');
|
|
80
|
+
const response = await supertest(app)
|
|
81
|
+
.get('/')
|
|
82
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.TEXT_HTML_UTF8)
|
|
83
|
+
.expect(HTTP_STATUS.OK);
|
|
84
|
+
const powered = response.get('x-powered-by');
|
|
85
|
+
expect(powered).toEqual('custom user agent');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('should return 404 if web is disabled', async () => {
|
|
89
|
+
const app = await initializeServer('web-disabled.yaml');
|
|
90
|
+
const response = await supertest(app)
|
|
91
|
+
.get('/')
|
|
92
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
|
93
|
+
.expect(HTTP_STATUS.NOT_FOUND);
|
|
94
|
+
expect(response.body.error).toEqual(API_ERROR.WEB_DISABLED);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('should not display debug hook disabled by default', async () => {
|
|
98
|
+
const app = await initializeServer('no_debug.yaml');
|
|
99
|
+
await supertest(app)
|
|
100
|
+
.get('/-/_debug')
|
|
101
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
|
102
|
+
.expect(HTTP_STATUS.NOT_FOUND);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('should display debug hook if directly enabled', async () => {
|
|
106
|
+
const app = await initializeServer('conf.yaml');
|
|
107
|
+
const res = await supertest(app)
|
|
108
|
+
.get('/-/_debug')
|
|
109
|
+
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
|
110
|
+
.expect(HTTP_STATUS.OK);
|
|
111
|
+
expect(res.body.pid).toEqual(process.pid);
|
|
112
|
+
expect(res.body.mem).toBeDefined();
|
|
113
|
+
});
|
package/tsconfig.build.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "
|
|
2
|
+
"extends": "../../../tsconfig.reference.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"rootDir": "./src",
|
|
5
5
|
"outDir": "./build"
|
|
@@ -8,43 +8,43 @@
|
|
|
8
8
|
"exclude": ["src/**/*.test.ts"],
|
|
9
9
|
"references": [
|
|
10
10
|
{
|
|
11
|
-
"path": "
|
|
11
|
+
"path": "../../api"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
|
-
"path": "
|
|
14
|
+
"path": "../../auth"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
"path": "
|
|
17
|
+
"path": "../../config"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
"path": "
|
|
20
|
+
"path": "../../core/commons-api"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
"path": "
|
|
23
|
+
"path": "../../loaders"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
"path": "
|
|
26
|
+
"path": "../../logger"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
"path": "
|
|
29
|
+
"path": "../../middleware"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"path": "
|
|
32
|
+
"path": "../../mock"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
"path": "
|
|
35
|
+
"path": "../../plugins/audit"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
"path": "
|
|
38
|
+
"path": "../../proxy"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
"path": "
|
|
41
|
+
"path": "../../store"
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
"path": "
|
|
44
|
+
"path": "../../utils"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
"path": "
|
|
47
|
+
"path": "../../web"
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
50
|
}
|
package/jest.setup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
jest.setTimeout(20000);
|
package/test/.eslintrc
DELETED
package/test/README.md
DELETED
package/test/api/api.spec.yaml
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
storage: ./storage_default_storage
|
|
2
|
-
plugins: ./plugins
|
|
3
|
-
|
|
4
|
-
auth:
|
|
5
|
-
htpasswd:
|
|
6
|
-
file: ./htpasswd
|
|
7
|
-
|
|
8
|
-
packages:
|
|
9
|
-
'@public-anyone-can-publish/*':
|
|
10
|
-
access: $anonymous jota_unpublish
|
|
11
|
-
publish: $anonymous jota_unpublish
|
|
12
|
-
unpublish: $anonymous jota_unpublish
|
|
13
|
-
'@scope/deprecate':
|
|
14
|
-
access: $all
|
|
15
|
-
publish:
|
|
16
|
-
- jota_deprecate
|
|
17
|
-
- only_publish
|
|
18
|
-
unpublish:
|
|
19
|
-
- jota_deprecate
|
|
20
|
-
- only_unpublish
|
|
21
|
-
'@scope/starPackage':
|
|
22
|
-
access: $all
|
|
23
|
-
publish: jota_star
|
|
24
|
-
unpublish: jota_star
|
|
25
|
-
'@only-one-can-publish/*':
|
|
26
|
-
access: jota_unpublish
|
|
27
|
-
publish: jota_unpublish
|
|
28
|
-
unpublish: jota_unpublish
|
|
29
|
-
'@jquery/*':
|
|
30
|
-
access: $all
|
|
31
|
-
publish: $all
|
|
32
|
-
proxy: npmjs
|
|
33
|
-
'@scope/*':
|
|
34
|
-
access: test
|
|
35
|
-
publish: dsadsa
|
|
36
|
-
proxy: npmjs
|
|
37
|
-
'@*/*':
|
|
38
|
-
access: $all
|
|
39
|
-
publish: $all
|
|
40
|
-
unpublish: $authenticated
|
|
41
|
-
proxy: npmjs
|
|
42
|
-
'auth-package':
|
|
43
|
-
access: $authenticated
|
|
44
|
-
publish: $authenticated
|
|
45
|
-
'only-you-can-publish':
|
|
46
|
-
access: $authenticated
|
|
47
|
-
publish: you
|
|
48
|
-
unpublish: you
|
|
49
|
-
'non-unpublish':
|
|
50
|
-
access: $authenticated
|
|
51
|
-
publish: jota_unpublish_fail
|
|
52
|
-
# There is some conditions to keep on mind here
|
|
53
|
-
# - If unpublish is empty, fallback with the publish value
|
|
54
|
-
# - If the user has permissions to publish and this empty it will be allowed to unpublish
|
|
55
|
-
# - If we want to forbid anyone to unpublish, just write here any unexisting user
|
|
56
|
-
unpublish: some_unexisting_user_defined_here_might_be_a_hash
|
|
57
|
-
'only-unpublish':
|
|
58
|
-
access: $authenticated
|
|
59
|
-
# comment out is intended, we want to test if publish prop is not defined
|
|
60
|
-
# publish: jota_unpublish_fail
|
|
61
|
-
#
|
|
62
|
-
unpublish:
|
|
63
|
-
'super-admin-can-unpublish':
|
|
64
|
-
access: $authenticated
|
|
65
|
-
publish: super_admin
|
|
66
|
-
unpublish: super_admin
|
|
67
|
-
'all-can-unpublish':
|
|
68
|
-
access: $authenticated
|
|
69
|
-
publish: $all
|
|
70
|
-
unpublish: $all
|
|
71
|
-
'forbidden-place':
|
|
72
|
-
access: nobody
|
|
73
|
-
publish: $all
|
|
74
|
-
'vue':
|
|
75
|
-
access: $authenticated
|
|
76
|
-
publish: $authenticated
|
|
77
|
-
proxy: npmjs
|
|
78
|
-
'jquery':
|
|
79
|
-
access: $all
|
|
80
|
-
publish: $all
|
|
81
|
-
proxy: npmjs
|
|
82
|
-
'*':
|
|
83
|
-
access: $all
|
|
84
|
-
publish: $all
|
|
85
|
-
unpublish: xxx
|
|
86
|
-
proxy: npmjs
|
|
87
|
-
log: { type: stdout, format: pretty, level: error }
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const json = {
|
|
2
|
-
_id: '@scope/pk1-test',
|
|
3
|
-
name: '@scope/pk1-test',
|
|
4
|
-
description: '',
|
|
5
|
-
'dist-tags': {
|
|
6
|
-
latest: '1.0.6',
|
|
7
|
-
},
|
|
8
|
-
versions: {
|
|
9
|
-
'1.0.6': {
|
|
10
|
-
name: '@scope/pk1-test',
|
|
11
|
-
version: '1.0.6',
|
|
12
|
-
description: '',
|
|
13
|
-
main: 'index.js',
|
|
14
|
-
scripts: {
|
|
15
|
-
test: 'echo "Error: no test specified" && exit 1',
|
|
16
|
-
},
|
|
17
|
-
keywords: [],
|
|
18
|
-
author: {
|
|
19
|
-
name: 'User NPM',
|
|
20
|
-
email: 'user@domain.com',
|
|
21
|
-
},
|
|
22
|
-
license: 'ISC',
|
|
23
|
-
dependencies: {
|
|
24
|
-
verdaccio: '^2.7.2',
|
|
25
|
-
},
|
|
26
|
-
readme: '# test',
|
|
27
|
-
readmeFilename: 'README.md',
|
|
28
|
-
_id: '@scope/pk1-test@1.0.6',
|
|
29
|
-
_npmVersion: '5.5.1',
|
|
30
|
-
_nodeVersion: '8.7.0',
|
|
31
|
-
_npmUser: {},
|
|
32
|
-
dist: {
|
|
33
|
-
integrity:
|
|
34
|
-
'sha512-6gHiERpiDgtb3hjqpQH5/i7zRmvYi9pmCjQf2ZMy3QEa9wVk9RgdZaPWUt7ZOnWUPFjc' +
|
|
35
|
-
'r9cmE6dUBf+XoPoH4g==',
|
|
36
|
-
shasum: '2c03764f651a9f016ca0b7620421457b619151b9',
|
|
37
|
-
tarball: 'http://localhost:5555/@scope/pk1-test/-/@scope/pk1-test-1.0.6.tgz',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
readme: '# test',
|
|
42
|
-
_attachments: {
|
|
43
|
-
'@scope/pk1-test-1.0.6.tgz': {
|
|
44
|
-
content_type: 'application/octet-stream',
|
|
45
|
-
data:
|
|
46
|
-
'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlocNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnI' +
|
|
47
|
-
'w5KUDX/9IOvurLuz/DHSjK/YAiY6jcXSKjk6sMqypHWNdtmD6hlBI0wqQmo8nVbVqMR4OsNoVB66kF1a' +
|
|
48
|
-
'W8eML+Vv10m9oF/jP6IfY4QyyTrILlD2eqkcm+gVzpdrJrPz4NuAsULJ4MZFWdBkbcByI7R79CRjx0Sc' +
|
|
49
|
-
'CdnAvf+SkjUFWu8IubzBgXUhDPidQlfZ3BhlLpBUKDiQ1cDFrYDmKkNnZwjuhUM4808+xNVW8P2bMk1Y' +
|
|
50
|
-
'7vJrtLC1u1MmLPjBF40+Cc4ahV6GDmI/DWygVRpMwVX3KtXUCg7Sxp7ff3nbt6TBFy65gK1iffsN41yo' +
|
|
51
|
-
'EHtdFbOiisWMH8bPvXUH0SP3k+KG3UBr+DFy7OGfEJr4x5iWVeS/pLQe+D+FIv/agIWI6GX66kFuIhT+' +
|
|
52
|
-
'1gDjrp/4d7WAvAwEJPh0u14IufWkM0zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhhQ6k' +
|
|
53
|
-
'+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8' +
|
|
54
|
-
'h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=',
|
|
55
|
-
length: 512,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
module.exports = json;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { Package } from '@verdaccio/types';
|
|
2
|
-
|
|
3
|
-
export function generateVersion(pkgName, version) {
|
|
4
|
-
return {
|
|
5
|
-
name: pkgName,
|
|
6
|
-
version: version,
|
|
7
|
-
description: 'some foo dependency',
|
|
8
|
-
main: 'index.js',
|
|
9
|
-
scripts: {
|
|
10
|
-
test: 'echo "Error: no test specified" && exit 1',
|
|
11
|
-
},
|
|
12
|
-
keywords: [],
|
|
13
|
-
author: {
|
|
14
|
-
name: 'User NPM',
|
|
15
|
-
email: 'user@domain.com',
|
|
16
|
-
},
|
|
17
|
-
license: 'ISC',
|
|
18
|
-
dependencies: {
|
|
19
|
-
verdaccio: '^4.0.0',
|
|
20
|
-
},
|
|
21
|
-
readme: '# test',
|
|
22
|
-
readmeFilename: 'README.md',
|
|
23
|
-
_id: `${pkgName}@${version}`,
|
|
24
|
-
_npmVersion: '5.5.1',
|
|
25
|
-
_npmUser: {
|
|
26
|
-
name: 'foo',
|
|
27
|
-
},
|
|
28
|
-
dist: {
|
|
29
|
-
integrity:
|
|
30
|
-
'sha512-6gHiERpiDgtb3hjqpQH5/i7zRmvYi9pmCjQf2ZMy3QEa9wVk9RgdZaPWUt7ZOnWUPFjcr9c' +
|
|
31
|
-
'mE6dUBf+XoPoH4g==',
|
|
32
|
-
shasum: '2c03764f651a9f016ca0b7620421457b619151b9', // pragma: allowlist secret
|
|
33
|
-
tarball: `http:\/\/localhost:5555\/${pkgName}\/-\/${pkgName}-${version}.tgz`,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The metadata that comes from npm unpublish only contains the versions won't be removed and
|
|
40
|
-
* also does not includes any _attachment.
|
|
41
|
-
* @param pkgName
|
|
42
|
-
* @param _versions
|
|
43
|
-
*/
|
|
44
|
-
export function generatePackageUnpublish(
|
|
45
|
-
pkgName: string,
|
|
46
|
-
_versions: string[] = ['1.0.0']
|
|
47
|
-
): Package {
|
|
48
|
-
const latest: string = _versions[_versions.length - 1];
|
|
49
|
-
const versions = _versions.reduce((cat, version) => {
|
|
50
|
-
cat[version] = generateVersion(pkgName, version);
|
|
51
|
-
return cat;
|
|
52
|
-
}, {});
|
|
53
|
-
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
return {
|
|
56
|
-
_id: pkgName,
|
|
57
|
-
name: pkgName,
|
|
58
|
-
readme: '# test',
|
|
59
|
-
// users usually is present when run npm star [pkg]
|
|
60
|
-
users: {},
|
|
61
|
-
'dist-tags': {
|
|
62
|
-
latest: latest,
|
|
63
|
-
},
|
|
64
|
-
versions: versions,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function generateStarMedatada(pkgName: string, users): any {
|
|
69
|
-
return {
|
|
70
|
-
_id: pkgName,
|
|
71
|
-
_rev: '3-b0cdaefc9bdb77c8',
|
|
72
|
-
users: users,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function generatePackageMetadata(pkgName: string, version = '1.0.0'): Package {
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
return {
|
|
79
|
-
_id: pkgName,
|
|
80
|
-
name: pkgName,
|
|
81
|
-
'dist-tags': {
|
|
82
|
-
latest: version,
|
|
83
|
-
},
|
|
84
|
-
versions: {
|
|
85
|
-
[version]: {
|
|
86
|
-
name: pkgName,
|
|
87
|
-
version: version,
|
|
88
|
-
description: '',
|
|
89
|
-
main: 'index.js',
|
|
90
|
-
scripts: {
|
|
91
|
-
test: 'echo "Error: no test specified" && exit 1',
|
|
92
|
-
},
|
|
93
|
-
keywords: [],
|
|
94
|
-
author: {
|
|
95
|
-
name: 'User NPM',
|
|
96
|
-
email: 'user@domain.com',
|
|
97
|
-
},
|
|
98
|
-
license: 'ISC',
|
|
99
|
-
dependencies: {
|
|
100
|
-
verdaccio: '^2.7.2',
|
|
101
|
-
},
|
|
102
|
-
readme: '# test',
|
|
103
|
-
readmeFilename: 'README.md',
|
|
104
|
-
_id: `${pkgName}@${version}`,
|
|
105
|
-
_npmVersion: '5.5.1',
|
|
106
|
-
_npmUser: {
|
|
107
|
-
name: 'foo',
|
|
108
|
-
},
|
|
109
|
-
dist: {
|
|
110
|
-
integrity:
|
|
111
|
-
'sha512-6gHiERpiDgtb3hjqpQH5/i7zRmvYi9pmCjQf2ZMy3QEa9wVk9RgdZaPWUt7ZOnWUPFjcr' +
|
|
112
|
-
'9cmE6dUBf+XoPoH4g==',
|
|
113
|
-
shasum: '2c03764f651a9f016ca0b7620421457b619151b9', // pragma: allowlist secret
|
|
114
|
-
tarball: `http:\/\/localhost:5555\/${pkgName}\/-\/${pkgName}-${version}.tgz`,
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
readme: '# test',
|
|
119
|
-
_attachments: {
|
|
120
|
-
[`${pkgName}-${version}.tgz`]: {
|
|
121
|
-
content_type: 'application/octet-stream',
|
|
122
|
-
data:
|
|
123
|
-
'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlocNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnI' +
|
|
124
|
-
'w5KUDX/9IOvurLuz/DHSjK/YAiY6jcXSKjk6sMqypHWNdtmD6hlBI0wqQmo8nVbVqMR4OsNoVB66kF1a' +
|
|
125
|
-
'W8eML+Vv10m9oF/jP6IfY4QyyTrILlD2eqkcm+gVzpdrJrPz4NuAsULJ4MZFWdBkbcByI7R79CRjx0Sc' +
|
|
126
|
-
'CdnAvf+SkjUFWu8IubzBgXUhDPidQlfZ3BhlLpBUKDiQ1cDFrYDmKkNnZwjuhUM4808+xNVW8P2bMk1Y' +
|
|
127
|
-
'7vJrtLC1u1MmLPjBF40+Cc4ahV6GDmI/DWygVRpMwVX3KtXUCg7Sxp7ff3nbt6TBFy65gK1iffsN41yo' +
|
|
128
|
-
'EHtdFbOiisWMH8bPvXUH0SP3k+KG3UBr+DFy7OGfEJr4x5iWVeS/pLQe+D+FIv/agIWI6GX66kFuIhT+' +
|
|
129
|
-
'1gDjrp/4d7WAvAwEJPh0u14IufWkM0zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhhQ6k' +
|
|
130
|
-
'+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8' +
|
|
131
|
-
'h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=',
|
|
132
|
-
length: 512,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function generateDeprecateMetadata(
|
|
139
|
-
pkgName: string,
|
|
140
|
-
version = '1.0.0',
|
|
141
|
-
deprecated: string = ''
|
|
142
|
-
): Package {
|
|
143
|
-
const res = {
|
|
144
|
-
...generatePackageMetadata(pkgName, version),
|
|
145
|
-
_attachments: {},
|
|
146
|
-
};
|
|
147
|
-
res.versions[version].deprecated = deprecated;
|
|
148
|
-
return res;
|
|
149
|
-
}
|
package/test/api/htpasswd
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
server_user_api_spec:3TdCV4iEpNFsI:autocreated 2020-11-08T10:36:37.581Z
|
|
2
|
-
jota_unpublish:oIj/79.KRKO6Y:autocreated 2020-11-08T10:36:37.881Z
|
|
3
|
-
jota_unpublish_fail:y7dutM1X0pByQ:autocreated 2020-11-08T10:36:37.934Z
|
|
4
|
-
jota_only_unpublish_fail:3rUkLjiXInch.:autocreated 2020-11-08T10:36:37.947Z
|
|
5
|
-
super_admin:yW2wIbTxWW1UA:autocreated 2020-11-08T10:36:37.953Z
|
|
6
|
-
any_user:VBq3LIOEN9VOY:autocreated 2020-11-08T10:36:37.971Z
|
|
7
|
-
jota_star:rp9KgzaAC2Uew:autocreated 2020-11-08T10:36:37.988Z
|
|
8
|
-
jota_deprecate:Q09PY3eVq/L1E:autocreated 2020-11-08T10:36:38.012Z
|
|
9
|
-
only_publish:s2pCXhzEgIupY:autocreated 2020-11-08T10:36:38.040Z
|
|
10
|
-
only_unpublish:+JTPy3GKmGlEE:autocreated 2020-11-08T10:36:38.046Z
|