@verdaccio/store 6.0.0-6-next.21 → 6.0.0-6-next.24

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 (72) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/build/index.d.ts +5 -4
  3. package/build/index.js +31 -15
  4. package/build/index.js.map +1 -1
  5. package/build/lib/TransFormResults.d.ts +15 -0
  6. package/build/lib/TransFormResults.js +61 -0
  7. package/build/lib/TransFormResults.js.map +1 -0
  8. package/build/lib/search-utils.d.ts +4 -0
  9. package/build/lib/search-utils.js +59 -0
  10. package/build/lib/search-utils.js.map +1 -0
  11. package/build/lib/star-utils.d.ts +14 -0
  12. package/build/{star-utils.js → lib/star-utils.js} +16 -2
  13. package/build/lib/star-utils.js.map +1 -0
  14. package/build/lib/storage-utils.d.ts +82 -0
  15. package/build/{storage-utils.js → lib/storage-utils.js} +173 -60
  16. package/build/lib/storage-utils.js.map +1 -0
  17. package/build/lib/uplink-util.d.ts +10 -0
  18. package/build/lib/uplink-util.js +49 -0
  19. package/build/lib/uplink-util.js.map +1 -0
  20. package/build/lib/versions-utils.d.ts +28 -0
  21. package/build/lib/versions-utils.js +104 -0
  22. package/build/lib/versions-utils.js.map +1 -0
  23. package/build/local-storage.d.ts +3 -165
  24. package/build/local-storage.js +6 -1166
  25. package/build/local-storage.js.map +1 -1
  26. package/build/storage.d.ts +242 -86
  27. package/build/storage.js +1681 -548
  28. package/build/storage.js.map +1 -1
  29. package/build/type.d.ts +42 -19
  30. package/build/type.js.map +1 -1
  31. package/jest.config.js +8 -2
  32. package/package.json +71 -71
  33. package/src/index.ts +5 -4
  34. package/src/lib/TransFormResults.ts +42 -0
  35. package/src/lib/search-utils.ts +50 -0
  36. package/src/{star-utils.ts → lib/star-utils.ts} +16 -5
  37. package/src/lib/storage-utils.ts +362 -0
  38. package/src/lib/uplink-util.ts +41 -0
  39. package/src/lib/versions-utils.ts +87 -0
  40. package/src/local-storage.ts +7 -1217
  41. package/src/storage.ts +1683 -635
  42. package/src/type.ts +47 -21
  43. package/test/fixtures/config/getTarballNext-getupstream.yaml +17 -0
  44. package/test/fixtures/config/syncDoubleUplinksMetadata.yaml +25 -0
  45. package/test/fixtures/config/syncNoUplinksMetadata.yaml +17 -0
  46. package/test/fixtures/config/syncSingleUplinksMetadata.yaml +21 -0
  47. package/test/fixtures/config/updateManifest-1.yaml +16 -0
  48. package/test/fixtures/manifests/foo-npmjs.json +253 -0
  49. package/test/fixtures/manifests/foo-verdaccio.json +253 -0
  50. package/test/fixtures/tarball.tgz +0 -0
  51. package/test/helpers.ts +22 -0
  52. package/test/local-store.__disabled__.ts +553 -0
  53. package/test/search.spec.ts +4 -5
  54. package/test/star.spec.ts +31 -0
  55. package/test/storage-utils.spec.ts +129 -42
  56. package/test/storage.spec.ts +943 -33
  57. package/test/versions.spec.ts +109 -0
  58. package/tsconfig.json +6 -3
  59. package/build/search.d.ts +0 -35
  60. package/build/search.js +0 -198
  61. package/build/search.js.map +0 -1
  62. package/build/star-utils.d.ts +0 -9
  63. package/build/star-utils.js.map +0 -1
  64. package/build/storage-utils.d.ts +0 -39
  65. package/build/storage-utils.js.map +0 -1
  66. package/build/uplink-util.d.ts +0 -7
  67. package/build/uplink-util.js +0 -38
  68. package/build/uplink-util.js.map +0 -1
  69. package/src/search.ts +0 -175
  70. package/src/storage-utils.ts +0 -263
  71. package/src/uplink-util.ts +0 -32
  72. package/test/local-storage.spec.ts +0 -583
@@ -1,12 +1,8 @@
1
- /// <reference types="node" />
2
- import { PassThrough } from 'stream';
3
- import { pluginUtils, searchUtils } from '@verdaccio/core';
4
- import { Callback, CallbackAction, Config, IReadTarball, IUploadTarball, Logger, MergeTags, Package, StringValue, Token, TokenFilter, Version } from '@verdaccio/types';
1
+ import { pluginUtils } from '@verdaccio/core';
2
+ import { Config, Logger } from '@verdaccio/types';
5
3
  export declare const noSuchFile = "ENOENT";
6
4
  export declare const resourceNotAvailable = "EAGAIN";
7
5
  export declare type IPluginStorage = pluginUtils.IPluginStorage<Config>;
8
- export declare function normalizeSearchPackage(pkg: Package, searchItem: searchUtils.SearchItem): searchUtils.SearchPackageBody;
9
- export declare const PROTO_NAME = "__proto__";
10
6
  /**
11
7
  * Implements Storage interface (same for storage.js, local-storage.js, up-storage.js).
12
8
  */
@@ -16,167 +12,9 @@ declare class LocalStorage {
16
12
  logger: Logger;
17
13
  constructor(config: Config, logger: Logger);
18
14
  init(): Promise<void>;
19
- addPackage(name: string, pkg: Package, callback: Callback): void;
20
- /**
21
- * Remove package with all it contents.
22
- */
23
- removePackage(name: string): Promise<void>;
24
- /**
25
- * Synchronize remote package info with the local one
26
- * @param {*} name
27
- * @param {*} packageInfo
28
- * @param {*} callback
29
- */
30
- updateVersions(name: string, packageInfo: Package, callback: Callback): void;
31
- /**
32
- * Add a new version to a previous local package.
33
- * @param {*} name
34
- * @param {*} version
35
- * @param {*} metadata
36
- * @param {*} tag
37
- * @param {*} callback
38
- */
39
- addVersion(name: string, version: string, metadata: Version, tag: StringValue, callback: Callback): void;
40
- addVersionNext(name: string, version: string, metadata: Version, tag: StringValue): Promise<void>;
41
- /**
42
- * Merge a new list of tags for a local packages with the existing one.
43
- * @param {*} pkgName
44
- * @param {*} tags
45
- * @param {*} callback
46
- */
47
- mergeTags(pkgName: string, tags: MergeTags, callback: Callback): void;
48
- /**
49
- * Update the package metadata, tags and attachments (tarballs).
50
- * Note: Currently supports unpublishing and deprecation.
51
- * @param {*} name
52
- * @param {*} incomingPkg
53
- * @param {*} revision
54
- * @param {*} callback
55
- * @return {Function}
56
- */
57
- changePackage(name: string, incomingPkg: Package, revision: string | undefined, callback: Callback): void;
58
- /**
59
- * Update the package metadata, tags and attachments (tarballs).
60
- * Note: Currently supports unpublishing and deprecation.
61
- * @param {*} name
62
- * @param {*} incomingPkg
63
- * @param {*} revision
64
- * @param {*} callback
65
- * @return {Function}
66
- */
67
- changePackageNext(name: string, incomingPkg: Package, revision: string | undefined): Promise<void>;
68
- /**
69
- * Remove a tarball.
70
- * @param {*} name
71
- * @param {*} filename
72
- * @param {*} revision
73
- * @param {*} callback
74
- */
75
- removeTarball(name: string, filename: string, revision: string, callback: CallbackAction): void;
76
- /**
77
- * Add a tarball.
78
- * @param {String} name
79
- * @param {String} filename
80
- * @return {Stream}
81
- */
82
- addTarball(name: string, filename: string): IUploadTarball;
83
- /**
84
- * Get a tarball.
85
- * @param {*} name
86
- * @param {*} filename
87
- * @return {ReadTarball}
88
- */
89
- getTarball(name: string, filename: string): IReadTarball;
90
- /**
91
- * Return a stream that emits a read failure.
92
- * @private
93
- * @return {ReadTarball}
94
- */
95
- private _createFailureStreamResponse;
96
- /**
97
- * Return a stream that emits the tarball data
98
- * @param {Object} storage
99
- * @param {String} filename
100
- * @private
101
- * @return {ReadTarball}
102
- */
103
- private _streamSuccessReadTarBall;
104
- getPackageMetadataNext(name: string): Promise<Package>;
105
- /**
106
- * Retrieve a package by name.
107
- * @param {*} name
108
- * @param {*} callback
109
- * @return {Function}
110
- * @deprecated
111
- */
112
- getPackageMetadata(name: string, callback?: Callback): void;
113
- search(searchStream: PassThrough, query: searchUtils.SearchQuery): Promise<void>;
114
- /**
115
- * Retrieve a wrapper that provide access to the package location.
116
- * @param {Object} pkgName package name.
117
- * @return {Object}
118
- */
119
- private _getLocalStorage;
120
- /**
121
- * Read a json file from storage.
122
- * @param {Object} storage
123
- * @param {Function} callback
124
- * @deprecated
125
- */
126
- private _readPackage;
127
- private _readPackageNext;
128
- /**
129
- * Retrieve either a previous created local package or a boilerplate.
130
- * @param {*} pkgName
131
- * @param {*} callback
132
- * @return {Function}
133
- */
134
- private _readCreatePackage;
135
- private _createNewPackage;
136
- /**
137
- * Handle internal error
138
- * @param {*} err
139
- * @param {*} file
140
- * @param {*} message
141
- * @return {Object} Error instance
142
- */
143
- private _internalError;
144
- /**
145
- * @param {*} name package name
146
- * @param {*} updateHandler function(package, cb) - update function
147
- * @param {*} callback callback that gets invoked after it's all updated
148
- * @return {Function}
149
- */
150
- private _updatePackage;
151
- /**
152
- * @param {*} name package name
153
- * @param {*} updateHandler function(package, cb) - update function
154
- * @param {*} callback callback that gets invoked after it's all updated
155
- * @return {Function}
156
- */
157
- private updatePackageNext;
158
- /**
159
- * Update the revision (_rev) string for a package.
160
- * @param {*} name
161
- * @param {*} json
162
- * @param {*} callback
163
- * @return {Function}
164
- */
165
- private _writePackage;
166
- private writePackageNext;
167
- private _setDefaultRevision;
168
- /**
169
- * Ensure the dist file remains as the same protocol
170
- * @param {Object} hash metadata
171
- * @param {String} upLinkKey registry key
172
- * @private
173
- */
174
- private _updateUplinkToRemoteProtocol;
15
+ getStoragePlugin(): IPluginStorage;
175
16
  getSecret(config: Config): Promise<void>;
176
17
  private _loadStorage;
177
18
  private _loadStorePlugin;
178
- saveToken(token: Token): Promise<any>;
179
- deleteToken(user: string, tokenKey: string): Promise<any>;
180
- readTokens(filter: TokenFilter): Promise<Token[]>;
181
19
  }
182
20
  export { LocalStorage };