@verdaccio/store 7.0.0-next.6 → 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.
Files changed (47) hide show
  1. package/CHANGELOG.md +340 -0
  2. package/README.md +24 -57
  3. package/build/index.d.ts +0 -1
  4. package/build/index.js +0 -12
  5. package/build/index.js.map +1 -1
  6. package/build/lib/star-utils.js.map +1 -1
  7. package/build/lib/storage-utils.d.ts +3 -0
  8. package/build/lib/storage-utils.js +35 -2
  9. package/build/lib/storage-utils.js.map +1 -1
  10. package/build/lib/versions-utils.d.ts +14 -0
  11. package/build/lib/versions-utils.js +52 -1
  12. package/build/lib/versions-utils.js.map +1 -1
  13. package/build/local-storage.js +3 -3
  14. package/build/local-storage.js.map +1 -1
  15. package/build/storage.d.ts +14 -15
  16. package/build/storage.js +198 -161
  17. package/build/storage.js.map +1 -1
  18. package/build/type.d.ts +5 -0
  19. package/build/type.js.map +1 -1
  20. package/jest.config.js +2 -2
  21. package/package.json +17 -16
  22. package/src/index.ts +0 -1
  23. package/src/lib/storage-utils.ts +40 -2
  24. package/src/lib/versions-utils.ts +50 -1
  25. package/src/local-storage.ts +3 -2
  26. package/src/storage.ts +228 -149
  27. package/src/type.ts +6 -0
  28. package/test/fixtures/config/publishWithOwnerAndCheck.yaml +18 -0
  29. package/test/fixtures/config/publishWithOwnerDefault.yaml +15 -0
  30. package/test/fixtures/config/syncDoubleUplinksMetadata.yaml +2 -18
  31. package/test/search.spec.ts +28 -7
  32. package/test/storage-utils.spec.ts +1 -0
  33. package/test/storage.spec.ts +466 -80
  34. package/test/versions.spec.ts +58 -1
  35. package/build/lib/TransFormResults.d.ts +0 -15
  36. package/build/lib/TransFormResults.js +0 -51
  37. package/build/lib/TransFormResults.js.map +0 -1
  38. package/build/lib/search-utils.d.ts +0 -4
  39. package/build/lib/search-utils.js +0 -50
  40. package/build/lib/search-utils.js.map +0 -1
  41. package/build/lib/uplink-util.d.ts +0 -10
  42. package/build/lib/uplink-util.js +0 -43
  43. package/build/lib/uplink-util.js.map +0 -1
  44. package/src/lib/TransFormResults.ts +0 -42
  45. package/src/lib/search-utils.ts +0 -50
  46. package/src/lib/uplink-util.ts +0 -42
  47. /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
@@ -0,0 +1,15 @@
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
@@ -1,26 +1,10 @@
1
1
  uplinks:
2
2
  timeout:
3
- url: https://registry.domain.com/
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
- 'foo':
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 }
@@ -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, removeDuplicates } from '../src';
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(getDefaultConfig());
37
- const storage = new Storage(config);
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
  });
@@ -225,6 +225,7 @@ describe('Storage Utils', () => {
225
225
  _uplinks: {},
226
226
  name: '',
227
227
  versions: {},
228
+ time: {},
228
229
  [DIST_TAGS]: {},
229
230
  };
230
231
  const mergedPkg = mergeUplinkTimeIntoLocal(pkg1, pkg2);