@verdaccio/api 9.0.0-next-9.2 → 9.0.0-next-9.4

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 (67) hide show
  1. package/build/_virtual/_rolldown/runtime.js +23 -0
  2. package/build/dist-tags.d.ts +4 -4
  3. package/build/dist-tags.js +52 -124
  4. package/build/dist-tags.js.map +1 -1
  5. package/build/dist-tags.mjs +52 -0
  6. package/build/dist-tags.mjs.map +1 -0
  7. package/build/index.d.ts +4 -4
  8. package/build/index.js +61 -78
  9. package/build/index.js.map +1 -1
  10. package/build/index.mjs +59 -0
  11. package/build/index.mjs.map +1 -0
  12. package/build/package.d.ts +3 -3
  13. package/build/package.js +69 -120
  14. package/build/package.js.map +1 -1
  15. package/build/package.mjs +69 -0
  16. package/build/package.mjs.map +1 -0
  17. package/build/ping.d.ts +1 -1
  18. package/build/ping.js +10 -11
  19. package/build/ping.js.map +1 -1
  20. package/build/ping.mjs +11 -0
  21. package/build/ping.mjs.map +1 -0
  22. package/build/publish.d.ts +4 -4
  23. package/build/publish.js +192 -268
  24. package/build/publish.js.map +1 -1
  25. package/build/publish.mjs +196 -0
  26. package/build/publish.mjs.map +1 -0
  27. package/build/search.d.ts +1 -1
  28. package/build/search.js +13 -17
  29. package/build/search.js.map +1 -1
  30. package/build/search.mjs +14 -0
  31. package/build/search.mjs.map +1 -0
  32. package/build/stars.d.ts +2 -2
  33. package/build/stars.js +21 -59
  34. package/build/stars.js.map +1 -1
  35. package/build/stars.mjs +21 -0
  36. package/build/stars.mjs.map +1 -0
  37. package/build/user.d.ts +3 -3
  38. package/build/user.js +106 -188
  39. package/build/user.js.map +1 -1
  40. package/build/user.mjs +106 -0
  41. package/build/user.mjs.map +1 -0
  42. package/build/v1/login.d.ts +4 -4
  43. package/build/v1/login.js +115 -246
  44. package/build/v1/login.js.map +1 -1
  45. package/build/v1/login.mjs +115 -0
  46. package/build/v1/login.mjs.map +1 -0
  47. package/build/v1/profile.d.ts +3 -3
  48. package/build/v1/profile.js +45 -67
  49. package/build/v1/profile.js.map +1 -1
  50. package/build/v1/profile.mjs +45 -0
  51. package/build/v1/profile.mjs.map +1 -0
  52. package/build/v1/search.d.ts +3 -3
  53. package/build/v1/search.js +64 -113
  54. package/build/v1/search.js.map +1 -1
  55. package/build/v1/search.mjs +64 -0
  56. package/build/v1/search.mjs.map +1 -0
  57. package/build/v1/token.d.ts +4 -4
  58. package/build/v1/token.js +100 -201
  59. package/build/v1/token.js.map +1 -1
  60. package/build/v1/token.mjs +102 -0
  61. package/build/v1/token.mjs.map +1 -0
  62. package/build/whoami.d.ts +1 -1
  63. package/build/whoami.js +20 -25
  64. package/build/whoami.js.map +1 -1
  65. package/build/whoami.mjs +20 -0
  66. package/build/whoami.mjs.map +1 -0
  67. package/package.json +25 -14
package/build/publish.js CHANGED
@@ -1,274 +1,198 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = publish;
7
- exports.publishPackage = publishPackage;
8
- var _debug = _interopRequireDefault(require("debug"));
9
- var _core = require("@verdaccio/core");
10
- var _middleware = require("@verdaccio/middleware");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
13
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
14
- function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
15
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
16
- // import star from './star';
17
-
18
- var debug = (0, _debug["default"])('verdaccio:api:publish');
19
-
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.js");
2
+ let debug = require("debug");
3
+ debug = require_runtime.__toESM(debug);
4
+ let _verdaccio_middleware = require("@verdaccio/middleware");
5
+ let _verdaccio_core = require("@verdaccio/core");
6
+ //#region src/publish.ts
7
+ var debug$1 = (0, debug.default)("verdaccio:api:publish");
20
8
  /**
21
- * Publish a package / update package / un/start a package
22
- *
23
- * There are multiples scenarios here to be considered:
24
- *
25
- * 1. Publish scenario
26
- *
27
- * Publish a package consist of at least 1 step (PUT) with a metadata payload.
28
- * When a package is published, an _attachment property is present that contains the data
29
- * of the tarball.
30
- *
31
- * Example flow of publish.
32
- *
33
- * npm http fetch PUT 201 http://localhost:4873/@scope%2ftest1 9627ms
34
- npm info lifecycle @scope/test1@1.0.1~publish: @scope/test1@1.0.1
35
- npm info lifecycle @scope/test1@1.0.1~postpublish: @scope/test1@1.0.1
36
- + @scope/test1@1.0.1
37
- npm verb exit [ 0, true ]
38
- *
39
- *
40
- * 2. Unpublish scenario
41
- *
42
- * Unpublish consist in 3 steps.
43
- * 1. Try to fetch metadata -> if it fails, return 404
44
- * 2. Compute metadata locally (client side) and send a mutate payload excluding the version to
45
- * be unpublished
46
- * eg: if metadata reflects 1.0.1, 1.0.2 and 1.0.3, the computed metadata won't include 1.0.3.
47
- * 3. Once the second step has been successfully finished, delete the tarball.
48
- *
49
- * All these steps are consecutive and required, there is no transacions here, if step 3 fails,
50
- * metadata might get corrupted.
51
- *
52
- * Note the unpublish call will suffix in the url a /-rev/14-5d500cfce92f90fd revision number,
53
- * this not
54
- * used internally.
55
- *
56
- *
57
- * Example flow of unpublish.
58
- *
59
- * There are two possible flows:
60
- *
61
- * - Remove all packages (entirely)
62
- * eg: npm unpublish package-name@* --force
63
- * eg: npm unpublish package-name --force
64
- *
65
- * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1680ms
66
- * npm http fetch DELETE 201 http://localhost:4873/custom-name/-/test1-1.0.3.tgz/-rev/16-e11c8db282b2d992 19ms
67
- *
68
- * - Remove a specific version
69
- * eg: npm unpublish package-name@1.0.0 --force
70
- *
71
- * Get fresh manifest
72
- * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1680ms
73
- * Update manifest without the version to be unpublished
74
- * npm http fetch PUT 201 http://localhost:4873/custom-name/-rev/14-5d500cfce92f90fd 956606ms
75
- * Get fresh manifest (revision should be different)
76
- * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1601ms
77
- * Remove the tarball
78
- * npm http fetch DELETE 201 http://localhost:4873/custom-name/-/test1-1.0.3.tgz/-rev/16-e11c8db282b2d992 19ms
79
- *
80
- * 3. Star a package
81
- *
82
- * Permissions: staring a package depends of the publish and unpublish permissions, there is no
83
- * specific flag for star or unstar.
84
- * The URL for star is similar to the unpublish (change package format)
85
- *
86
- * npm has no endpoint for staring a package, rather mutate the metadata and acts as, the difference
87
- * is the users property which is part of the payload and the body only includes
88
- *
89
- * {
90
- "_id": pkgName,
91
- "_rev": "3-b0cdaefc9bdb77c8",
92
- "users": {
93
- [username]: boolean value (true, false)
94
- }
95
- }
96
- *
97
- * 4. Change owners of a package
98
- *
99
- * Similar to staring a package, changing owners (maintainers) of a package uses the publish
100
- * endpoint.
101
- *
102
- * The body includes a list of the new owners with the following format
103
- *
104
- * {
105
- "_id": pkgName,
106
- "_rev": "4-b0cdaefc9bdb77c8",
107
- "maintainers": [
108
- { "name": "first owner", "email": "me@verdaccio.org" },
109
- { "name": "second owner", "email": "you@verdaccio.org" },
110
- ...
111
- ]
112
- }
113
- *
114
- */
9
+ * Publish a package / update package / un/start a package
10
+ *
11
+ * There are multiples scenarios here to be considered:
12
+ *
13
+ * 1. Publish scenario
14
+ *
15
+ * Publish a package consist of at least 1 step (PUT) with a metadata payload.
16
+ * When a package is published, an _attachment property is present that contains the data
17
+ * of the tarball.
18
+ *
19
+ * Example flow of publish.
20
+ *
21
+ * npm http fetch PUT 201 http://localhost:4873/@scope%2ftest1 9627ms
22
+ npm info lifecycle @scope/test1@1.0.1~publish: @scope/test1@1.0.1
23
+ npm info lifecycle @scope/test1@1.0.1~postpublish: @scope/test1@1.0.1
24
+ + @scope/test1@1.0.1
25
+ npm verb exit [ 0, true ]
26
+ *
27
+ *
28
+ * 2. Unpublish scenario
29
+ *
30
+ * Unpublish consist in 3 steps.
31
+ * 1. Try to fetch metadata -> if it fails, return 404
32
+ * 2. Compute metadata locally (client side) and send a mutate payload excluding the version to
33
+ * be unpublished
34
+ * eg: if metadata reflects 1.0.1, 1.0.2 and 1.0.3, the computed metadata won't include 1.0.3.
35
+ * 3. Once the second step has been successfully finished, delete the tarball.
36
+ *
37
+ * All these steps are consecutive and required, there is no transacions here, if step 3 fails,
38
+ * metadata might get corrupted.
39
+ *
40
+ * Note the unpublish call will suffix in the url a /-rev/14-5d500cfce92f90fd revision number,
41
+ * this not
42
+ * used internally.
43
+ *
44
+ *
45
+ * Example flow of unpublish.
46
+ *
47
+ * There are two possible flows:
48
+ *
49
+ * - Remove all packages (entirely)
50
+ * eg: npm unpublish package-name@* --force
51
+ * eg: npm unpublish package-name --force
52
+ *
53
+ * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1680ms
54
+ * npm http fetch DELETE 201 http://localhost:4873/custom-name/-/test1-1.0.3.tgz/-rev/16-e11c8db282b2d992 19ms
55
+ *
56
+ * - Remove a specific version
57
+ * eg: npm unpublish package-name@1.0.0 --force
58
+ *
59
+ * Get fresh manifest
60
+ * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1680ms
61
+ * Update manifest without the version to be unpublished
62
+ * npm http fetch PUT 201 http://localhost:4873/custom-name/-rev/14-5d500cfce92f90fd 956606ms
63
+ * Get fresh manifest (revision should be different)
64
+ * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1601ms
65
+ * Remove the tarball
66
+ * npm http fetch DELETE 201 http://localhost:4873/custom-name/-/test1-1.0.3.tgz/-rev/16-e11c8db282b2d992 19ms
67
+ *
68
+ * 3. Star a package
69
+ *
70
+ * Permissions: staring a package depends of the publish and unpublish permissions, there is no
71
+ * specific flag for star or unstar.
72
+ * The URL for star is similar to the unpublish (change package format)
73
+ *
74
+ * npm has no endpoint for staring a package, rather mutate the metadata and acts as, the difference
75
+ * is the users property which is part of the payload and the body only includes
76
+ *
77
+ * {
78
+ "_id": pkgName,
79
+ "_rev": "3-b0cdaefc9bdb77c8",
80
+ "users": {
81
+ [username]: boolean value (true, false)
82
+ }
83
+ }
84
+ *
85
+ * 4. Change owners of a package
86
+ *
87
+ * Similar to staring a package, changing owners (maintainers) of a package uses the publish
88
+ * endpoint.
89
+ *
90
+ * The body includes a list of the new owners with the following format
91
+ *
92
+ * {
93
+ "_id": pkgName,
94
+ "_rev": "4-b0cdaefc9bdb77c8",
95
+ "maintainers": [
96
+ { "name": "first owner", "email": "me@verdaccio.org" },
97
+ { "name": "second owner", "email": "you@verdaccio.org" },
98
+ ...
99
+ ]
100
+ }
101
+ *
102
+ */
115
103
  function publish(router, auth, storage, logger) {
116
- var can = (0, _middleware.allow)(auth, {
117
- beforeAll: function beforeAll(a, b) {
118
- return logger.trace(a, b);
119
- },
120
- afterAll: function afterAll(a, b) {
121
- return logger.trace(a, b);
122
- }
123
- });
124
- router.put(_middleware.PUBLISH_API_ENDPOINTS.add_package, can('publish'), (0, _middleware.media)(_core.HEADERS.JSON), _middleware.expectJson, publishPackage(storage, logger, 'publish one version'));
125
- router.put(_middleware.PUBLISH_API_ENDPOINTS.publish_package, can('unpublish'), (0, _middleware.media)(_core.HEADERS.JSON), _middleware.expectJson, publishPackage(storage, logger, 'publish with revision'));
126
-
127
- /**
128
- * Un-publishing an entire package.
129
- *
130
- * This scenario happens when any of these scenarios happens:
131
- * - the first call detect there is only one version remaining
132
- * - no version is specified in the unpublish call
133
- * - all versions are removed npm unpublish package@*
134
- * - there is no versions on the metadata
135
- * then the client decides to DELETE the resource
136
- * Example:
137
- * Get fresh manifest (write=true is a flag to get the latest revision)
138
- * npm http fetch GET 304 http://localhost:4873/package-name?write=true 1076ms (from cache)
139
- * Send request to delete the package, this includes the revision number that must match
140
- * and the package name, it will delete the entire package and all tarballs (or tarball depends the scenario)
141
- * npm http fetch DELETE 201 http://localhost:4873/package-name/-rev/18-d8ebe3020bd4ac9c 22ms
142
- */
143
- router["delete"](_middleware.PUBLISH_API_ENDPOINTS.publish_package, can('unpublish'), /*#__PURE__*/function () {
144
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(req, res, next) {
145
- var _req$remote_user;
146
- var packageName, rev, username, _t;
147
- return _regenerator().w(function (_context) {
148
- while (1) switch (_context.p = _context.n) {
149
- case 0:
150
- packageName = req.params["package"];
151
- rev = req.params.revision;
152
- username = req === null || req === void 0 || (_req$remote_user = req.remote_user) === null || _req$remote_user === void 0 ? void 0 : _req$remote_user.name;
153
- logger.debug({
154
- packageName: packageName
155
- }, "unpublishing @{packageName}");
156
- _context.p = 1;
157
- _context.n = 2;
158
- return storage.removePackage(packageName, rev, username);
159
- case 2:
160
- debug('package %s unpublished', packageName);
161
- res.status(_core.HTTP_STATUS.CREATED);
162
- return _context.a(2, next({
163
- ok: _core.API_MESSAGE.PKG_REMOVED
164
- }));
165
- case 3:
166
- _context.p = 3;
167
- _t = _context.v;
168
- return _context.a(2, next(_t));
169
- }
170
- }, _callee, null, [[1, 3]]);
171
- }));
172
- return function (_x, _x2, _x3) {
173
- return _ref.apply(this, arguments);
174
- };
175
- }());
176
-
177
- /*
178
- Remove a tarball, this happens when npm unpublish a package unique version.
179
- npm http fetch DELETE 201 http://localhost:4873/package-name/-rev/18-d8ebe3020bd4ac9c 22ms
180
- */
181
- router["delete"](_middleware.PUBLISH_API_ENDPOINTS.remove_tarball, can('unpublish'), /*#__PURE__*/function () {
182
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(req, res, next) {
183
- var _req$remote_user2;
184
- var packageName, _req$params, filename, revision, username, _t2;
185
- return _regenerator().w(function (_context2) {
186
- while (1) switch (_context2.p = _context2.n) {
187
- case 0:
188
- packageName = req.params["package"];
189
- _req$params = req.params, filename = _req$params.filename, revision = _req$params.revision;
190
- username = req === null || req === void 0 || (_req$remote_user2 = req.remote_user) === null || _req$remote_user2 === void 0 ? void 0 : _req$remote_user2.name;
191
- logger.debug({
192
- packageName: packageName,
193
- filename: filename,
194
- revision: revision
195
- }, "removing a tarball for @{packageName}-@{tarballName}-@{revision}");
196
- _context2.p = 1;
197
- _context2.n = 2;
198
- return storage.removeTarball(packageName, filename, revision, username);
199
- case 2:
200
- res.status(_core.HTTP_STATUS.CREATED);
201
- logger.debug({
202
- packageName: packageName,
203
- filename: filename,
204
- revision: revision
205
- }, "success remove tarball for @{packageName}-@{tarballName}-@{revision}");
206
- return _context2.a(2, next({
207
- ok: _core.API_MESSAGE.TARBALL_REMOVED
208
- }));
209
- case 3:
210
- _context2.p = 3;
211
- _t2 = _context2.v;
212
- return _context2.a(2, next(_t2));
213
- }
214
- }, _callee2, null, [[1, 3]]);
215
- }));
216
- return function (_x4, _x5, _x6) {
217
- return _ref2.apply(this, arguments);
218
- };
219
- }());
104
+ const can = (0, _verdaccio_middleware.allow)(auth, {
105
+ beforeAll: (a, b) => logger.trace(a, b),
106
+ afterAll: (a, b) => logger.trace(a, b)
107
+ });
108
+ router.put(_verdaccio_middleware.PUBLISH_API_ENDPOINTS.add_package, can("publish"), (0, _verdaccio_middleware.media)(_verdaccio_core.HEADERS.JSON), _verdaccio_middleware.expectJson, publishPackage(storage, logger, "publish one version"));
109
+ router.put(_verdaccio_middleware.PUBLISH_API_ENDPOINTS.publish_package, can("unpublish"), (0, _verdaccio_middleware.media)(_verdaccio_core.HEADERS.JSON), _verdaccio_middleware.expectJson, publishPackage(storage, logger, "publish with revision"));
110
+ /**
111
+ * Un-publishing an entire package.
112
+ *
113
+ * This scenario happens when any of these scenarios happens:
114
+ * - the first call detect there is only one version remaining
115
+ * - no version is specified in the unpublish call
116
+ * - all versions are removed npm unpublish package@*
117
+ * - there is no versions on the metadata
118
+
119
+ * then the client decides to DELETE the resource
120
+ * Example:
121
+ * Get fresh manifest (write=true is a flag to get the latest revision)
122
+ * npm http fetch GET 304 http://localhost:4873/package-name?write=true 1076ms (from cache)
123
+ * Send request to delete the package, this includes the revision number that must match
124
+ * and the package name, it will delete the entire package and all tarballs (or tarball depends the scenario)
125
+ * npm http fetch DELETE 201 http://localhost:4873/package-name/-rev/18-d8ebe3020bd4ac9c 22ms
126
+ */
127
+ router.delete(_verdaccio_middleware.PUBLISH_API_ENDPOINTS.publish_package, can("unpublish"), async function(req, res, next) {
128
+ const packageName = req.params.package;
129
+ const rev = req.params.revision;
130
+ const username = req?.remote_user?.name;
131
+ logger.debug({ packageName }, `unpublishing @{packageName}`);
132
+ try {
133
+ await storage.removePackage(packageName, rev, username);
134
+ debug$1("package %s unpublished", packageName);
135
+ res.status(_verdaccio_core.HTTP_STATUS.CREATED);
136
+ return next({ ok: _verdaccio_core.API_MESSAGE.PKG_REMOVED });
137
+ } catch (err) {
138
+ return next(err);
139
+ }
140
+ });
141
+ router.delete(_verdaccio_middleware.PUBLISH_API_ENDPOINTS.remove_tarball, can("unpublish"), async function(req, res, next) {
142
+ const packageName = req.params.package;
143
+ const { filename, revision } = req.params;
144
+ const username = req?.remote_user?.name;
145
+ logger.debug({
146
+ packageName,
147
+ filename,
148
+ revision
149
+ }, `removing a tarball for @{packageName}-@{tarballName}-@{revision}`);
150
+ try {
151
+ await storage.removeTarball(packageName, filename, revision, username);
152
+ res.status(_verdaccio_core.HTTP_STATUS.CREATED);
153
+ logger.debug({
154
+ packageName,
155
+ filename,
156
+ revision
157
+ }, `success remove tarball for @{packageName}-@{tarballName}-@{revision}`);
158
+ return next({ ok: _verdaccio_core.API_MESSAGE.TARBALL_REMOVED });
159
+ } catch (err) {
160
+ return next(err);
161
+ }
162
+ });
220
163
  }
221
164
  function publishPackage(storage, logger, origin) {
222
- return /*#__PURE__*/function () {
223
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(req, res, next) {
224
- var ac, packageName, revision, metadata, requestOptions, message, _t3;
225
- return _regenerator().w(function (_context3) {
226
- while (1) switch (_context3.p = _context3.n) {
227
- case 0:
228
- debug(origin);
229
- ac = new AbortController();
230
- packageName = req.params["package"];
231
- revision = req.params.revision;
232
- debug('publishing package %s', packageName);
233
- debug('revision %s', revision);
234
- if (debug.enabled) {
235
- debug('body %o', req.body);
236
- }
237
- metadata = req.body;
238
- logger.debug({
239
- packageName: packageName
240
- }, "publishing package @{packageName}");
241
- requestOptions = (0, _middleware.getRequestOptions)(req);
242
- _context3.p = 1;
243
- _context3.n = 2;
244
- return storage.updateManifest(metadata, {
245
- name: packageName,
246
- revision: revision,
247
- signal: ac.signal,
248
- requestOptions: requestOptions,
249
- uplinksLook: false
250
- });
251
- case 2:
252
- message = _context3.v;
253
- debug('package %s published', packageName);
254
- res.status(_core.HTTP_STATUS.CREATED);
255
- return _context3.a(2, next({
256
- success: true,
257
- ok: message
258
- }));
259
- case 3:
260
- _context3.p = 3;
261
- _t3 = _context3.v;
262
- // TODO: review if we need the abort controller here
263
- next(_t3);
264
- case 4:
265
- return _context3.a(2);
266
- }
267
- }, _callee3, null, [[1, 3]]);
268
- }));
269
- return function (_x7, _x8, _x9) {
270
- return _ref3.apply(this, arguments);
271
- };
272
- }();
165
+ return async function(req, res, next) {
166
+ debug$1(origin);
167
+ const ac = new AbortController();
168
+ const packageName = req.params.package;
169
+ const { revision } = req.params;
170
+ debug$1("publishing package %s", packageName);
171
+ debug$1("revision %s", revision);
172
+ if (debug$1.enabled) debug$1("body %o", req.body);
173
+ const metadata = req.body;
174
+ logger.debug({ packageName }, `publishing package @{packageName}`);
175
+ const requestOptions = (0, _verdaccio_middleware.getRequestOptions)(req);
176
+ try {
177
+ const message = await storage.updateManifest(metadata, {
178
+ name: packageName,
179
+ revision,
180
+ signal: ac.signal,
181
+ requestOptions,
182
+ uplinksLook: false
183
+ });
184
+ debug$1("package %s published", packageName);
185
+ res.status(_verdaccio_core.HTTP_STATUS.CREATED);
186
+ return next({
187
+ success: true,
188
+ ok: message
189
+ });
190
+ } catch (err) {
191
+ next(err);
192
+ }
193
+ };
273
194
  }
195
+ //#endregion
196
+ exports.default = publish;
197
+
274
198
  //# sourceMappingURL=publish.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"publish.js","names":["_debug","_interopRequireDefault","require","_core","_middleware","e","__esModule","_regenerator","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","w","m","defineProperty","_regeneratorDefine","_invoke","enumerable","configurable","writable","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","debug","buildDebug","publish","router","auth","storage","logger","can","allow","beforeAll","b","trace","afterAll","put","PUBLISH_API_ENDPOINTS","add_package","media","HEADERS","JSON","expectJson","publishPackage","publish_package","_ref","_callee","req","res","next","_req$remote_user","packageName","rev","username","_t","_context","params","revision","remote_user","name","removePackage","status","HTTP_STATUS","CREATED","ok","API_MESSAGE","PKG_REMOVED","_x","_x2","_x3","remove_tarball","_ref2","_callee2","_req$remote_user2","_req$params","filename","_t2","_context2","removeTarball","TARBALL_REMOVED","_x4","_x5","_x6","origin","_ref3","_callee3","ac","metadata","requestOptions","message","_t3","_context3","AbortController","enabled","body","getRequestOptions","updateManifest","signal","uplinksLook","success","_x7","_x8","_x9"],"sources":["../src/publish.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport type { Router } from 'express';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { API_MESSAGE, HEADERS, HTTP_STATUS } from '@verdaccio/core';\nimport {\n PUBLISH_API_ENDPOINTS,\n allow,\n expectJson,\n getRequestOptions,\n media,\n} from '@verdaccio/middleware';\n// import star from './star';\nimport type { Storage } from '@verdaccio/store';\nimport type { Logger } from '@verdaccio/types';\n\nimport type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';\n\nconst debug = buildDebug('verdaccio:api:publish');\n\n/**\n * Publish a package / update package / un/start a package\n *\n * There are multiples scenarios here to be considered:\n *\n * 1. Publish scenario\n *\n * Publish a package consist of at least 1 step (PUT) with a metadata payload.\n * When a package is published, an _attachment property is present that contains the data\n * of the tarball.\n *\n * Example flow of publish.\n *\n * npm http fetch PUT 201 http://localhost:4873/@scope%2ftest1 9627ms\n npm info lifecycle @scope/test1@1.0.1~publish: @scope/test1@1.0.1\n npm info lifecycle @scope/test1@1.0.1~postpublish: @scope/test1@1.0.1\n + @scope/test1@1.0.1\n npm verb exit [ 0, true ]\n *\n *\n * 2. Unpublish scenario\n *\n * Unpublish consist in 3 steps.\n * 1. Try to fetch metadata -> if it fails, return 404\n * 2. Compute metadata locally (client side) and send a mutate payload excluding the version to\n * be unpublished\n * eg: if metadata reflects 1.0.1, 1.0.2 and 1.0.3, the computed metadata won't include 1.0.3.\n * 3. Once the second step has been successfully finished, delete the tarball.\n *\n * All these steps are consecutive and required, there is no transacions here, if step 3 fails,\n * metadata might get corrupted.\n *\n * Note the unpublish call will suffix in the url a /-rev/14-5d500cfce92f90fd revision number,\n * this not\n * used internally.\n *\n *\n * Example flow of unpublish.\n *\n * There are two possible flows:\n *\n * - Remove all packages (entirely)\n * eg: npm unpublish package-name@* --force\n * eg: npm unpublish package-name --force\n *\n * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1680ms\n * npm http fetch DELETE 201 http://localhost:4873/custom-name/-/test1-1.0.3.tgz/-rev/16-e11c8db282b2d992 19ms\n *\n * - Remove a specific version\n * eg: npm unpublish package-name@1.0.0 --force\n *\n * Get fresh manifest\n * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1680ms\n * Update manifest without the version to be unpublished\n * npm http fetch PUT 201 http://localhost:4873/custom-name/-rev/14-5d500cfce92f90fd 956606ms\n * Get fresh manifest (revision should be different)\n * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1601ms\n * Remove the tarball\n * npm http fetch DELETE 201 http://localhost:4873/custom-name/-/test1-1.0.3.tgz/-rev/16-e11c8db282b2d992 19ms\n *\n * 3. Star a package\n *\n * Permissions: staring a package depends of the publish and unpublish permissions, there is no\n * specific flag for star or unstar.\n * The URL for star is similar to the unpublish (change package format)\n *\n * npm has no endpoint for staring a package, rather mutate the metadata and acts as, the difference\n * is the users property which is part of the payload and the body only includes\n *\n * {\n \"_id\": pkgName,\n \"_rev\": \"3-b0cdaefc9bdb77c8\",\n \"users\": {\n [username]: boolean value (true, false)\n }\n }\n *\n * 4. Change owners of a package\n *\n * Similar to staring a package, changing owners (maintainers) of a package uses the publish\n * endpoint.\n *\n * The body includes a list of the new owners with the following format\n *\n * {\n \"_id\": pkgName,\n \"_rev\": \"4-b0cdaefc9bdb77c8\",\n \"maintainers\": [\n { \"name\": \"first owner\", \"email\": \"me@verdaccio.org\" },\n { \"name\": \"second owner\", \"email\": \"you@verdaccio.org\" },\n ...\n ]\n }\n *\n */\nexport default function publish(\n router: Router,\n auth: Auth,\n storage: Storage,\n logger: Logger\n): void {\n const can = allow(auth, {\n beforeAll: (a, b) => logger.trace(a, b),\n afterAll: (a, b) => logger.trace(a, b),\n });\n router.put(\n PUBLISH_API_ENDPOINTS.add_package,\n can('publish'),\n media(HEADERS.JSON),\n expectJson,\n publishPackage(storage, logger, 'publish one version')\n );\n\n router.put(\n PUBLISH_API_ENDPOINTS.publish_package,\n can('unpublish'),\n media(HEADERS.JSON),\n expectJson,\n publishPackage(storage, logger, 'publish with revision')\n );\n\n /**\n * Un-publishing an entire package.\n *\n * This scenario happens when any of these scenarios happens:\n * - the first call detect there is only one version remaining\n * - no version is specified in the unpublish call\n * - all versions are removed npm unpublish package@*\n * - there is no versions on the metadata\n\n * then the client decides to DELETE the resource\n * Example:\n * Get fresh manifest (write=true is a flag to get the latest revision)\n * npm http fetch GET 304 http://localhost:4873/package-name?write=true 1076ms (from cache)\n * Send request to delete the package, this includes the revision number that must match\n * and the package name, it will delete the entire package and all tarballs (or tarball depends the scenario)\n * npm http fetch DELETE 201 http://localhost:4873/package-name/-rev/18-d8ebe3020bd4ac9c 22ms\n */\n router.delete(\n PUBLISH_API_ENDPOINTS.publish_package,\n can('unpublish'),\n async function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n const packageName = req.params.package;\n const rev = req.params.revision;\n const username = req?.remote_user?.name;\n\n logger.debug({ packageName }, `unpublishing @{packageName}`);\n try {\n await storage.removePackage(packageName, rev, username);\n debug('package %s unpublished', packageName);\n res.status(HTTP_STATUS.CREATED);\n return next({ ok: API_MESSAGE.PKG_REMOVED });\n } catch (err) {\n return next(err);\n }\n }\n );\n\n /*\n Remove a tarball, this happens when npm unpublish a package unique version.\n npm http fetch DELETE 201 http://localhost:4873/package-name/-rev/18-d8ebe3020bd4ac9c 22ms\n */\n router.delete(\n PUBLISH_API_ENDPOINTS.remove_tarball,\n can('unpublish'),\n async function (\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ): Promise<void> {\n const packageName = req.params.package;\n const { filename, revision } = req.params;\n const username = req?.remote_user?.name;\n\n logger.debug(\n { packageName, filename, revision },\n `removing a tarball for @{packageName}-@{tarballName}-@{revision}`\n );\n try {\n await storage.removeTarball(packageName, filename, revision, username);\n res.status(HTTP_STATUS.CREATED);\n\n logger.debug(\n { packageName, filename, revision },\n `success remove tarball for @{packageName}-@{tarballName}-@{revision}`\n );\n return next({ ok: API_MESSAGE.TARBALL_REMOVED });\n } catch (err) {\n return next(err);\n }\n }\n );\n}\n\nexport function publishPackage(storage: Storage, logger: Logger, origin: string): any {\n return async function (\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ): Promise<void> {\n debug(origin);\n const ac = new AbortController();\n const packageName = req.params.package;\n const { revision } = req.params;\n debug('publishing package %s', packageName);\n debug('revision %s', revision);\n if (debug.enabled) {\n debug('body %o', req.body);\n }\n const metadata = req.body;\n\n logger.debug({ packageName }, `publishing package @{packageName}`);\n\n const requestOptions = getRequestOptions(req);\n\n try {\n const message = await storage.updateManifest(metadata, {\n name: packageName,\n revision,\n signal: ac.signal,\n requestOptions,\n uplinksLook: false,\n });\n debug('package %s published', packageName);\n\n res.status(HTTP_STATUS.CREATED);\n\n return next({\n success: true,\n ok: message,\n });\n } catch (err: any) {\n // TODO: review if we need the abort controller here\n next(err);\n }\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAM+B,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAE,aAAA,IAV/B,uKAAAF,CAAA,EAAAG,CAAA,EAAAC,CA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AAA4C,SAAA,CAAAxG,CAAA;YAAAwG,SAAA,CAAArH,CAAA;YAAA,OAGrBsD,OAAO,CAACoE,cAAc,CAACT,QAAQ,EAAE;cACrD5B,IAAI,EAAER,WAAW;cACjBM,QAAQ,EAARA,QAAQ;cACRwC,MAAM,EAAEX,EAAE,CAACW,MAAM;cACjBT,cAAc,EAAdA,cAAc;cACdU,WAAW,EAAE;YACf,CAAC,CAAC;UAAA;YANIT,OAAO,GAAAE,SAAA,CAAArG,CAAA;YAObiC,KAAK,CAAC,sBAAsB,EAAE4B,WAAW,CAAC;YAE1CH,GAAG,CAACa,MAAM,CAACC,iBAAW,CAACC,OAAO,CAAC;YAAC,OAAA4B,SAAA,CAAApG,CAAA,IAEzB0D,IAAI,CAAC;cACVkD,OAAO,EAAE,IAAI;cACbnC,EAAE,EAAEyB;YACN,CAAC,CAAC;UAAA;YAAAE,SAAA,CAAAxG,CAAA;YAAAuG,GAAA,GAAAC,SAAA,CAAArG,CAAA;YAEF;YACA2D,IAAI,CAAAyC,GAAI,CAAC;UAAC;YAAA,OAAAC,SAAA,CAAApG,CAAA;QAAA;MAAA,GAAA8F,QAAA;IAAA,CAEb;IAAA,iBAAAe,GAAA,EAAAC,GAAA,EAAAC,GAAA;MAAA,OAAAlB,KAAA,CAAAhE,KAAA,OAAAD,SAAA;IAAA;EAAA;AACH","ignoreList":[]}
1
+ {"version":3,"file":"publish.js","names":[],"sources":["../src/publish.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport type { Router } from 'express';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { API_MESSAGE, HEADERS, HTTP_STATUS } from '@verdaccio/core';\nimport {\n PUBLISH_API_ENDPOINTS,\n allow,\n expectJson,\n getRequestOptions,\n media,\n} from '@verdaccio/middleware';\n// import star from './star';\nimport type { Storage } from '@verdaccio/store';\nimport type { Logger } from '@verdaccio/types';\n\nimport type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';\n\nconst debug = buildDebug('verdaccio:api:publish');\n\n/**\n * Publish a package / update package / un/start a package\n *\n * There are multiples scenarios here to be considered:\n *\n * 1. Publish scenario\n *\n * Publish a package consist of at least 1 step (PUT) with a metadata payload.\n * When a package is published, an _attachment property is present that contains the data\n * of the tarball.\n *\n * Example flow of publish.\n *\n * npm http fetch PUT 201 http://localhost:4873/@scope%2ftest1 9627ms\n npm info lifecycle @scope/test1@1.0.1~publish: @scope/test1@1.0.1\n npm info lifecycle @scope/test1@1.0.1~postpublish: @scope/test1@1.0.1\n + @scope/test1@1.0.1\n npm verb exit [ 0, true ]\n *\n *\n * 2. Unpublish scenario\n *\n * Unpublish consist in 3 steps.\n * 1. Try to fetch metadata -> if it fails, return 404\n * 2. Compute metadata locally (client side) and send a mutate payload excluding the version to\n * be unpublished\n * eg: if metadata reflects 1.0.1, 1.0.2 and 1.0.3, the computed metadata won't include 1.0.3.\n * 3. Once the second step has been successfully finished, delete the tarball.\n *\n * All these steps are consecutive and required, there is no transacions here, if step 3 fails,\n * metadata might get corrupted.\n *\n * Note the unpublish call will suffix in the url a /-rev/14-5d500cfce92f90fd revision number,\n * this not\n * used internally.\n *\n *\n * Example flow of unpublish.\n *\n * There are two possible flows:\n *\n * - Remove all packages (entirely)\n * eg: npm unpublish package-name@* --force\n * eg: npm unpublish package-name --force\n *\n * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1680ms\n * npm http fetch DELETE 201 http://localhost:4873/custom-name/-/test1-1.0.3.tgz/-rev/16-e11c8db282b2d992 19ms\n *\n * - Remove a specific version\n * eg: npm unpublish package-name@1.0.0 --force\n *\n * Get fresh manifest\n * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1680ms\n * Update manifest without the version to be unpublished\n * npm http fetch PUT 201 http://localhost:4873/custom-name/-rev/14-5d500cfce92f90fd 956606ms\n * Get fresh manifest (revision should be different)\n * npm http fetch GET 200 http://localhost:4873/custom-name?write=true 1601ms\n * Remove the tarball\n * npm http fetch DELETE 201 http://localhost:4873/custom-name/-/test1-1.0.3.tgz/-rev/16-e11c8db282b2d992 19ms\n *\n * 3. Star a package\n *\n * Permissions: staring a package depends of the publish and unpublish permissions, there is no\n * specific flag for star or unstar.\n * The URL for star is similar to the unpublish (change package format)\n *\n * npm has no endpoint for staring a package, rather mutate the metadata and acts as, the difference\n * is the users property which is part of the payload and the body only includes\n *\n * {\n \"_id\": pkgName,\n \"_rev\": \"3-b0cdaefc9bdb77c8\",\n \"users\": {\n [username]: boolean value (true, false)\n }\n }\n *\n * 4. Change owners of a package\n *\n * Similar to staring a package, changing owners (maintainers) of a package uses the publish\n * endpoint.\n *\n * The body includes a list of the new owners with the following format\n *\n * {\n \"_id\": pkgName,\n \"_rev\": \"4-b0cdaefc9bdb77c8\",\n \"maintainers\": [\n { \"name\": \"first owner\", \"email\": \"me@verdaccio.org\" },\n { \"name\": \"second owner\", \"email\": \"you@verdaccio.org\" },\n ...\n ]\n }\n *\n */\nexport default function publish(\n router: Router,\n auth: Auth,\n storage: Storage,\n logger: Logger\n): void {\n const can = allow(auth, {\n beforeAll: (a, b) => logger.trace(a, b),\n afterAll: (a, b) => logger.trace(a, b),\n });\n router.put(\n PUBLISH_API_ENDPOINTS.add_package,\n can('publish'),\n media(HEADERS.JSON),\n expectJson,\n publishPackage(storage, logger, 'publish one version')\n );\n\n router.put(\n PUBLISH_API_ENDPOINTS.publish_package,\n can('unpublish'),\n media(HEADERS.JSON),\n expectJson,\n publishPackage(storage, logger, 'publish with revision')\n );\n\n /**\n * Un-publishing an entire package.\n *\n * This scenario happens when any of these scenarios happens:\n * - the first call detect there is only one version remaining\n * - no version is specified in the unpublish call\n * - all versions are removed npm unpublish package@*\n * - there is no versions on the metadata\n\n * then the client decides to DELETE the resource\n * Example:\n * Get fresh manifest (write=true is a flag to get the latest revision)\n * npm http fetch GET 304 http://localhost:4873/package-name?write=true 1076ms (from cache)\n * Send request to delete the package, this includes the revision number that must match\n * and the package name, it will delete the entire package and all tarballs (or tarball depends the scenario)\n * npm http fetch DELETE 201 http://localhost:4873/package-name/-rev/18-d8ebe3020bd4ac9c 22ms\n */\n router.delete(\n PUBLISH_API_ENDPOINTS.publish_package,\n can('unpublish'),\n async function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n const packageName = req.params.package;\n const rev = req.params.revision;\n const username = req?.remote_user?.name;\n\n logger.debug({ packageName }, `unpublishing @{packageName}`);\n try {\n await storage.removePackage(packageName, rev, username);\n debug('package %s unpublished', packageName);\n res.status(HTTP_STATUS.CREATED);\n return next({ ok: API_MESSAGE.PKG_REMOVED });\n } catch (err) {\n return next(err);\n }\n }\n );\n\n /*\n Remove a tarball, this happens when npm unpublish a package unique version.\n npm http fetch DELETE 201 http://localhost:4873/package-name/-rev/18-d8ebe3020bd4ac9c 22ms\n */\n router.delete(\n PUBLISH_API_ENDPOINTS.remove_tarball,\n can('unpublish'),\n async function (\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ): Promise<void> {\n const packageName = req.params.package;\n const { filename, revision } = req.params;\n const username = req?.remote_user?.name;\n\n logger.debug(\n { packageName, filename, revision },\n `removing a tarball for @{packageName}-@{tarballName}-@{revision}`\n );\n try {\n await storage.removeTarball(packageName, filename, revision, username);\n res.status(HTTP_STATUS.CREATED);\n\n logger.debug(\n { packageName, filename, revision },\n `success remove tarball for @{packageName}-@{tarballName}-@{revision}`\n );\n return next({ ok: API_MESSAGE.TARBALL_REMOVED });\n } catch (err) {\n return next(err);\n }\n }\n );\n}\n\nexport function publishPackage(storage: Storage, logger: Logger, origin: string): any {\n return async function (\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ): Promise<void> {\n debug(origin);\n const ac = new AbortController();\n const packageName = req.params.package;\n const { revision } = req.params;\n debug('publishing package %s', packageName);\n debug('revision %s', revision);\n if (debug.enabled) {\n debug('body %o', req.body);\n }\n const metadata = req.body;\n\n logger.debug({ packageName }, `publishing package @{packageName}`);\n\n const requestOptions = getRequestOptions(req);\n\n try {\n const message = await storage.updateManifest(metadata, {\n name: packageName,\n revision,\n signal: ac.signal,\n requestOptions,\n uplinksLook: false,\n });\n debug('package %s published', packageName);\n\n res.status(HTTP_STATUS.CREATED);\n\n return next({\n success: true,\n ok: message,\n });\n } catch (err: any) {\n // TODO: review if we need the abort controller here\n next(err);\n }\n };\n}\n"],"mappings":";;;;;;AAkBA,IAAM,WAAA,GAAA,MAAA,SAAmB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGjD,SAAwB,QACtB,QACA,MACA,SACA,QACM;CACN,MAAM,OAAA,GAAA,sBAAA,OAAY,MAAM;EACtB,YAAY,GAAG,MAAM,OAAO,MAAM,GAAG,EAAE;EACvC,WAAW,GAAG,MAAM,OAAO,MAAM,GAAG,EAAE;EACvC,CAAC;AACF,QAAO,IACL,sBAAA,sBAAsB,aACtB,IAAI,UAAU,GAAA,GAAA,sBAAA,OACR,gBAAA,QAAQ,KAAK,EACnB,sBAAA,YACA,eAAe,SAAS,QAAQ,sBAAsB,CACvD;AAED,QAAO,IACL,sBAAA,sBAAsB,iBACtB,IAAI,YAAY,GAAA,GAAA,sBAAA,OACV,gBAAA,QAAQ,KAAK,EACnB,sBAAA,YACA,eAAe,SAAS,QAAQ,wBAAwB,CACzD;;;;;;;;;;;;;;;;;;AAmBD,QAAO,OACL,sBAAA,sBAAsB,iBACtB,IAAI,YAAY,EAChB,eAAgB,KAAqB,KAAsB,MAAwB;EACjF,MAAM,cAAc,IAAI,OAAO;EAC/B,MAAM,MAAM,IAAI,OAAO;EACvB,MAAM,WAAW,KAAK,aAAa;AAEnC,SAAO,MAAM,EAAE,aAAa,EAAE,8BAA8B;AAC5D,MAAI;AACF,SAAM,QAAQ,cAAc,aAAa,KAAK,SAAS;AACvD,WAAM,0BAA0B,YAAY;AAC5C,OAAI,OAAO,gBAAA,YAAY,QAAQ;AAC/B,UA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