@verdaccio/hooks 6.0.0-6-next.10 → 6.0.0-6-next.13

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # @verdaccio/hooks
2
2
 
3
+ ## 6.0.0-6-next.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [82cb0f2b]
8
+ - Updated dependencies [5167bb52]
9
+ - @verdaccio/core@6.0.0-6-next.5
10
+ - @verdaccio/logger@6.0.0-6-next.11
11
+
12
+ ## 6.0.0-6-next.12
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [b78f3525]
17
+ - @verdaccio/logger@6.0.0-6-next.10
18
+
19
+ ## 6.0.0-6-next.11
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [730b5d8c]
24
+ - @verdaccio/logger@6.0.0-6-next.9
25
+
3
26
  ## 6.0.0-6-next.10
4
27
 
5
28
  ### Patch Changes
@@ -7,6 +7,8 @@ exports.notifyRequest = notifyRequest;
7
7
 
8
8
  var _debug = _interopRequireDefault(require("debug"));
9
9
 
10
+ var _undici = require("undici");
11
+
10
12
  var _core = require("@verdaccio/core");
11
13
 
12
14
  var _logger = require("@verdaccio/logger");
@@ -15,14 +17,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
17
 
16
18
  const debug = (0, _debug.default)('verdaccio:hooks:request');
17
19
 
18
- const fetch = require('undici-fetch');
19
-
20
20
  async function notifyRequest(url, options) {
21
21
  let response;
22
22
 
23
23
  try {
24
24
  debug('uri %o', url);
25
- response = await fetch(url, {
25
+ response = await (0, _undici.fetch)(url, {
26
26
  body: JSON.stringify(options.body),
27
27
  method: 'POST',
28
28
  headers: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/notify-request.ts"],"names":["debug","fetch","require","notifyRequest","url","options","response","body","JSON","stringify","method","headers","status","json","HTTP_STATUS","BAD_REQUEST","Error","logger","info","content","err","error","errorMessage","message"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;AAEA,MAAMA,KAAK,GAAG,oBAAW,yBAAX,CAAd;;AACA,MAAMC,KAAK,GAAGC,OAAO,CAAC,cAAD,CAArB;;AAQO,eAAeC,aAAf,CAA6BC,GAA7B,EAA0CC,OAA1C,EAAmF;AACxF,MAAIC,QAAJ;;AACA,MAAI;AACFN,IAAAA,KAAK,CAAC,QAAD,EAAWI,GAAX,CAAL;AACAE,IAAAA,QAAQ,GAAG,MAAML,KAAK,CAACG,GAAD,EAAM;AAC1BG,MAAAA,IAAI,EAAEC,IAAI,CAACC,SAAL,CAAeJ,OAAO,CAACE,IAAvB,CADoB;AAE1BG,MAAAA,MAAM,EAAE,MAFkB;AAG1BC,MAAAA,OAAO,EAAE;AAAE,wBAAgB;AAAlB;AAHiB,KAAN,CAAtB;AAKAX,IAAAA,KAAK,CAAC,qBAAD,EAAwBM,QAAQ,CAACM,MAAjC,CAAL;AACA,UAAML,IAAI,GAAG,MAAMD,QAAQ,CAACO,IAAT,EAAnB;;AACA,QAAIP,QAAQ,CAACM,MAAT,IAAmBE,kBAAYC,WAAnC,EAAgD;AAC9C,YAAM,IAAIC,KAAJ,CAAUT,IAAV,CAAN;AACD;;AAEDU,mBAAOC,IAAP,CACE;AAAEC,MAAAA,OAAO,EAAEd,OAAO,CAACE;AAAnB,KADF,EAEE,8DAFF;;AAIA,WAAO,IAAP;AACD,GAlBD,CAkBE,OAAOa,GAAP,EAAiB;AACjBpB,IAAAA,KAAK,CAAC,kBAAD,EAAqBoB,GAArB,CAAL;;AACAH,mBAAOI,KAAP,CACE;AAAEC,MAAAA,YAAY,EAAEF,GAAF,aAAEA,GAAF,uBAAEA,GAAG,CAAEG;AAArB,KADF,EAEE,qDAFF;;AAIA,WAAO,KAAP;AACD;AACF","sourcesContent":["import buildDebug from 'debug';\n\nimport { HTTP_STATUS } from '@verdaccio/core';\nimport { logger } from '@verdaccio/logger';\n\nconst debug = buildDebug('verdaccio:hooks:request');\nconst fetch = require('undici-fetch');\n\nexport type FetchOptions = {\n body: string;\n headers?: {};\n method?: string;\n};\n\nexport async function notifyRequest(url: string, options: FetchOptions): Promise<boolean> {\n let response;\n try {\n debug('uri %o', url);\n response = await fetch(url, {\n body: JSON.stringify(options.body),\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n });\n debug('response.status %o', response.status);\n const body = await response.json();\n if (response.status >= HTTP_STATUS.BAD_REQUEST) {\n throw new Error(body);\n }\n\n logger.info(\n { content: options.body },\n 'The notification @{content} has been successfully dispatched'\n );\n return true;\n } catch (err: any) {\n debug('request error %o', err);\n logger.error(\n { errorMessage: err?.message },\n 'notify service has thrown an error: @{errorMessage}'\n );\n return false;\n }\n}\n"],"file":"notify-request.js"}
1
+ {"version":3,"sources":["../src/notify-request.ts"],"names":["debug","notifyRequest","url","options","response","body","JSON","stringify","method","headers","status","json","HTTP_STATUS","BAD_REQUEST","Error","logger","info","content","err","error","errorMessage","message"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;AAEA,MAAMA,KAAK,GAAG,oBAAW,yBAAX,CAAd;;AAQO,eAAeC,aAAf,CAA6BC,GAA7B,EAA0CC,OAA1C,EAAmF;AACxF,MAAIC,QAAJ;;AACA,MAAI;AACFJ,IAAAA,KAAK,CAAC,QAAD,EAAWE,GAAX,CAAL;AACAE,IAAAA,QAAQ,GAAG,MAAM,mBAAMF,GAAN,EAAW;AAC1BG,MAAAA,IAAI,EAAEC,IAAI,CAACC,SAAL,CAAeJ,OAAO,CAACE,IAAvB,CADoB;AAE1BG,MAAAA,MAAM,EAAE,MAFkB;AAG1BC,MAAAA,OAAO,EAAE;AAAE,wBAAgB;AAAlB;AAHiB,KAAX,CAAjB;AAKAT,IAAAA,KAAK,CAAC,qBAAD,EAAwBI,QAAQ,CAACM,MAAjC,CAAL;AACA,UAAML,IAAI,GAAG,MAAMD,QAAQ,CAACO,IAAT,EAAnB;;AACA,QAAIP,QAAQ,CAACM,MAAT,IAAmBE,kBAAYC,WAAnC,EAAgD;AAC9C,YAAM,IAAIC,KAAJ,CAAUT,IAAV,CAAN;AACD;;AAEDU,mBAAOC,IAAP,CACE;AAAEC,MAAAA,OAAO,EAAEd,OAAO,CAACE;AAAnB,KADF,EAEE,8DAFF;;AAIA,WAAO,IAAP;AACD,GAlBD,CAkBE,OAAOa,GAAP,EAAiB;AACjBlB,IAAAA,KAAK,CAAC,kBAAD,EAAqBkB,GAArB,CAAL;;AACAH,mBAAOI,KAAP,CACE;AAAEC,MAAAA,YAAY,EAAEF,GAAF,aAAEA,GAAF,uBAAEA,GAAG,CAAEG;AAArB,KADF,EAEE,qDAFF;;AAIA,WAAO,KAAP;AACD;AACF","sourcesContent":["import buildDebug from 'debug';\nimport { fetch } from 'undici';\n\nimport { HTTP_STATUS } from '@verdaccio/core';\nimport { logger } from '@verdaccio/logger';\n\nconst debug = buildDebug('verdaccio:hooks:request');\n\nexport type FetchOptions = {\n body: string;\n headers?: {};\n method?: string;\n};\n\nexport async function notifyRequest(url: string, options: FetchOptions): Promise<boolean> {\n let response;\n try {\n debug('uri %o', url);\n response = await fetch(url, {\n body: JSON.stringify(options.body),\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n });\n debug('response.status %o', response.status);\n const body = await response.json();\n if (response.status >= HTTP_STATUS.BAD_REQUEST) {\n throw new Error(body);\n }\n\n logger.info(\n { content: options.body },\n 'The notification @{content} has been successfully dispatched'\n );\n return true;\n } catch (err: any) {\n debug('request error %o', err);\n logger.error(\n { errorMessage: err?.message },\n 'notify service has thrown an error: @{errorMessage}'\n );\n return false;\n }\n}\n"],"file":"notify-request.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/hooks",
3
- "version": "6.0.0-6-next.10",
3
+ "version": "6.0.0-6-next.13",
4
4
  "description": "loaders logic",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -30,19 +30,18 @@
30
30
  "npm": ">=6"
31
31
  },
32
32
  "dependencies": {
33
- "@verdaccio/core": "6.0.0-6-next.4",
34
- "@verdaccio/logger": "6.0.0-6-next.8",
35
- "core-js": "3.17.2",
33
+ "@verdaccio/core": "6.0.0-6-next.5",
34
+ "@verdaccio/logger": "6.0.0-6-next.11",
35
+ "core-js": "3.20.3",
36
36
  "debug": "4.3.3",
37
37
  "handlebars": "4.7.7",
38
- "undici": "4.7.3",
39
- "undici-fetch": "1.0.0-rc.4"
38
+ "undici": "4.15.0"
40
39
  },
41
40
  "devDependencies": {
42
- "@types/node": "16.11.12",
43
- "@verdaccio/auth": "6.0.0-6-next.16",
44
- "@verdaccio/config": "6.0.0-6-next.12",
45
- "@verdaccio/types": "11.0.0-6-next.10"
41
+ "@types/node": "16.11.21",
42
+ "@verdaccio/auth": "6.0.0-6-next.21",
43
+ "@verdaccio/config": "6.0.0-6-next.13",
44
+ "@verdaccio/types": "11.0.0-6-next.11"
46
45
  },
47
46
  "funding": {
48
47
  "type": "opencollective",
@@ -1,10 +1,10 @@
1
1
  import buildDebug from 'debug';
2
+ import { fetch } from 'undici';
2
3
 
3
4
  import { HTTP_STATUS } from '@verdaccio/core';
4
5
  import { logger } from '@verdaccio/logger';
5
6
 
6
7
  const debug = buildDebug('verdaccio:hooks:request');
7
- const fetch = require('undici-fetch');
8
8
 
9
9
  export type FetchOptions = {
10
10
  body: string;
@@ -1,3 +1,5 @@
1
+ import { MockAgent, setGlobalDispatcher } from 'undici';
2
+
1
3
  import { createRemoteUser, parseConfigFile } from '@verdaccio/config';
2
4
  import { setup } from '@verdaccio/logger';
3
5
  import { Config } from '@verdaccio/types';
@@ -16,8 +18,6 @@ const multiNotificationConfig = parseConfigFile(parseConfigurationNotifyFile('mu
16
18
  setup([]);
17
19
 
18
20
  const domain = 'http://slack-service';
19
- const { MockAgent } = require('undici');
20
- const { setGlobalDispatcher } = require('undici-fetch');
21
21
 
22
22
  const options = {
23
23
  path: '/foo?auth_token=mySecretToken',