@verdaccio/store 7.0.0-next.5 → 8.0.0-next-8.0
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/CHANGELOG.md +359 -0
- package/LICENSE +1 -1
- package/README.md +24 -57
- package/build/index.d.ts +0 -1
- package/build/index.js +0 -12
- package/build/index.js.map +1 -1
- package/build/lib/star-utils.js.map +1 -1
- package/build/lib/storage-utils.d.ts +3 -0
- package/build/lib/storage-utils.js +35 -2
- package/build/lib/storage-utils.js.map +1 -1
- package/build/lib/versions-utils.d.ts +14 -0
- package/build/lib/versions-utils.js +52 -1
- package/build/lib/versions-utils.js.map +1 -1
- package/build/local-storage.js +3 -3
- package/build/local-storage.js.map +1 -1
- package/build/storage.d.ts +14 -15
- package/build/storage.js +199 -162
- package/build/storage.js.map +1 -1
- package/build/type.d.ts +5 -0
- package/build/type.js.map +1 -1
- package/jest.config.js +2 -2
- package/package.json +18 -17
- package/src/index.ts +0 -1
- package/src/lib/storage-utils.ts +40 -2
- package/src/lib/versions-utils.ts +50 -1
- package/src/local-storage.ts +3 -2
- package/src/storage.ts +230 -150
- package/src/type.ts +6 -0
- package/test/fixtures/config/publishWithOwnerAndCheck.yaml +18 -0
- package/test/fixtures/config/publishWithOwnerDefault.yaml +15 -0
- package/test/fixtures/config/syncDoubleUplinksMetadata.yaml +2 -18
- package/test/search.spec.ts +28 -7
- package/test/storage-utils.spec.ts +1 -0
- package/test/storage.spec.ts +466 -80
- package/test/versions.spec.ts +58 -1
- package/build/lib/TransFormResults.d.ts +0 -15
- package/build/lib/TransFormResults.js +0 -51
- package/build/lib/TransFormResults.js.map +0 -1
- package/build/lib/search-utils.d.ts +0 -4
- package/build/lib/search-utils.js +0 -50
- package/build/lib/search-utils.js.map +0 -1
- package/build/lib/uplink-util.d.ts +0 -10
- package/build/lib/uplink-util.js +0 -43
- package/build/lib/uplink-util.js.map +0 -1
- package/src/lib/TransFormResults.ts +0 -42
- package/src/lib/search-utils.ts +0 -50
- package/src/lib/uplink-util.ts +0 -42
- /package/test/fixtures/config/{getTarballNext-getupstream.yaml → getTarball-getupstream.yaml} +0 -0
package/src/type.ts
CHANGED
|
@@ -62,3 +62,9 @@ export type UpdateManifestOptions = {
|
|
|
62
62
|
* values in the body.
|
|
63
63
|
*/
|
|
64
64
|
export type StarManifestBody = Pick<Manifest, '_id' | 'users' | '_rev'>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* When the command `npm owner add/rm` is executed, the body only contains the following
|
|
68
|
+
* values in the body.
|
|
69
|
+
*/
|
|
70
|
+
export type OwnerManifestBody = Pick<Manifest, '_id' | 'maintainers' | '_rev'>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
packages:
|
|
2
|
+
'@scope/foo':
|
|
3
|
+
access: $all
|
|
4
|
+
publish: $authenticated
|
|
5
|
+
'@*/*':
|
|
6
|
+
access: $all
|
|
7
|
+
publish: $all
|
|
8
|
+
proxy: ver
|
|
9
|
+
'foo':
|
|
10
|
+
access: $all
|
|
11
|
+
publish: $authenticated
|
|
12
|
+
'*':
|
|
13
|
+
access: $all
|
|
14
|
+
publish: $all
|
|
15
|
+
proxy: npmjs
|
|
16
|
+
|
|
17
|
+
publish:
|
|
18
|
+
check_owners: true
|
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
uplinks:
|
|
2
2
|
timeout:
|
|
3
|
-
url: https://registry.
|
|
3
|
+
url: https://registry.domain1.com/
|
|
4
4
|
timeout: 2s
|
|
5
|
-
some:
|
|
6
|
-
url: https://registry.domain.com/
|
|
7
|
-
ver:
|
|
8
|
-
url: https://registry.verdaccio.org/
|
|
9
5
|
packages:
|
|
10
|
-
'@*/*':
|
|
11
|
-
access: $all
|
|
12
|
-
publish: $all
|
|
13
|
-
proxy: some
|
|
14
6
|
'timeout':
|
|
15
7
|
access: $all
|
|
16
8
|
publish: $authenticated
|
|
17
9
|
proxy: timeout
|
|
18
|
-
|
|
19
|
-
access: $all
|
|
20
|
-
publish: $authenticated
|
|
21
|
-
proxy: some ver
|
|
22
|
-
'*':
|
|
23
|
-
access: $all
|
|
24
|
-
publish: $all
|
|
25
|
-
proxy: some
|
|
26
|
-
log: { type: stdout, format: pretty, level: warn }
|
|
10
|
+
log: { type: stdout, format: pretty, level: info }
|
package/test/search.spec.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import nock from 'nock';
|
|
2
2
|
|
|
3
3
|
import { Config, getDefaultConfig } from '@verdaccio/config';
|
|
4
|
-
import { searchUtils } from '@verdaccio/core';
|
|
4
|
+
import { fileUtils, searchUtils } from '@verdaccio/core';
|
|
5
5
|
import { setup } from '@verdaccio/logger';
|
|
6
|
+
import { removeDuplicates } from '@verdaccio/search';
|
|
7
|
+
import { generatePackageMetadata } from '@verdaccio/test-helper';
|
|
6
8
|
|
|
7
|
-
import { Storage
|
|
9
|
+
import { Storage } from '../src';
|
|
8
10
|
|
|
9
|
-
setup({});
|
|
11
|
+
const logger = setup({});
|
|
10
12
|
|
|
11
13
|
describe('search', () => {
|
|
12
14
|
describe('search manager utils', () => {
|
|
@@ -26,18 +28,37 @@ describe('search', () => {
|
|
|
26
28
|
|
|
27
29
|
expect(removeDuplicates([item, item])).toEqual([item]);
|
|
28
30
|
});
|
|
29
|
-
|
|
31
|
+
});
|
|
32
|
+
describe('search manager', () => {
|
|
30
33
|
test('search items', async () => {
|
|
31
|
-
// FIXME: fetch is already part of undici
|
|
32
34
|
const domain = 'https://registry.npmjs.org';
|
|
33
35
|
const url = '/-/v1/search?maintenance=1&popularity=1&quality=1&size=10&text=verdaccio';
|
|
34
36
|
const response = require('./fixtures/search.json');
|
|
35
37
|
nock(domain).get(url).reply(200, response);
|
|
36
|
-
const config = new Config(
|
|
37
|
-
|
|
38
|
+
const config = new Config({
|
|
39
|
+
...getDefaultConfig(),
|
|
40
|
+
storage: await fileUtils.createTempStorageFolder('fix-1'),
|
|
41
|
+
});
|
|
42
|
+
const storage = new Storage(config, logger);
|
|
38
43
|
await storage.init(config);
|
|
39
44
|
const abort = new AbortController();
|
|
45
|
+
const pkgName = 'verdaccio';
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
host: 'localhost',
|
|
48
|
+
protocol: 'http',
|
|
49
|
+
headers: {},
|
|
50
|
+
};
|
|
51
|
+
// create private packages
|
|
52
|
+
const bodyNewManifest = generatePackageMetadata(pkgName, '5.1.2');
|
|
53
|
+
await storage.updateManifest(bodyNewManifest, {
|
|
54
|
+
signal: new AbortController().signal,
|
|
55
|
+
name: pkgName,
|
|
56
|
+
uplinksLook: true,
|
|
57
|
+
revision: '1',
|
|
58
|
+
requestOptions,
|
|
59
|
+
});
|
|
40
60
|
|
|
61
|
+
// @ts-expect-error
|
|
41
62
|
const results = await storage.search({ url, query: { text: 'verdaccio' }, abort });
|
|
42
63
|
expect(results).toHaveLength(4);
|
|
43
64
|
});
|