@verdaccio/hooks 8.0.0-next-8.25 → 8.0.0-next-8.27

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.
@@ -1,6 +1,8 @@
1
+ import { Method } from 'got-cjs';
1
2
  export type FetchOptions = {
2
3
  body: string;
3
4
  headers?: {};
4
5
  method?: string;
5
6
  };
7
+ export declare function verifyMethod(value: any): Method;
6
8
  export declare function notifyRequest(url: string, options: FetchOptions): Promise<boolean>;
@@ -4,26 +4,74 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.notifyRequest = notifyRequest;
7
+ exports.verifyMethod = verifyMethod;
7
8
  var _debug = _interopRequireDefault(require("debug"));
8
9
  var _gotCjs = _interopRequireDefault(require("got-cjs"));
9
10
  var _core = require("@verdaccio/core");
10
11
  var _logger = require("@verdaccio/logger");
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
13
  const debug = (0, _debug.default)('verdaccio:hooks:request');
14
+ function verifyMethod(value) {
15
+ const valid = ['GET', 'POST', 'PUT'];
16
+ if (typeof value === 'string') {
17
+ const upper = value.toUpperCase();
18
+ if (valid.includes(upper)) {
19
+ return upper;
20
+ } else {
21
+ _logger.logger.warn({
22
+ method: value
23
+ }, 'The notification method @{method} is not valid, using default POST method');
24
+ }
25
+ }
26
+ return 'POST';
27
+ }
28
+ const baseHeaders = {
29
+ 'Content-Type': 'application/json'
30
+ };
13
31
  async function notifyRequest(url, options) {
14
32
  let response;
15
33
  try {
34
+ const method = verifyMethod(options.method);
16
35
  debug('uri %o', url);
17
- response = _gotCjs.default.post(url, {
18
- body: JSON.stringify(options.body),
19
- method: 'POST',
20
- headers: {
21
- 'Content-Type': 'application/json'
36
+ debug('headers %o', options.headers);
37
+ debug('method %o', method);
38
+ let userHeaders = {};
39
+ if (options.headers) {
40
+ if (typeof options.headers === 'string') {
41
+ userHeaders = JSON.parse(options.headers);
42
+ } else if (typeof options.headers === 'object') {
43
+ userHeaders = options.headers;
22
44
  }
45
+ }
46
+ const headers = {
47
+ ...baseHeaders,
48
+ ...userHeaders
49
+ };
50
+ const requestOptions = {
51
+ method,
52
+ headers
53
+ };
54
+ let finalUrl = url;
55
+ if (method === 'GET') {
56
+ debug('using GET with query params');
57
+ const urlObj = new URL(url);
58
+ const params = new URLSearchParams(options.body);
59
+ params.set('body', options.body);
60
+ urlObj.search = params.toString();
61
+ finalUrl = urlObj.toString();
62
+ debug('final url with search params %o', finalUrl);
63
+ } else if (options.body !== undefined) {
64
+ requestOptions.body = options.body;
65
+ } else {
66
+ throw new Error('Notification body is undefined');
67
+ }
68
+ response = await (0, _gotCjs.default)(finalUrl, {
69
+ ...requestOptions,
70
+ responseType: 'json'
23
71
  });
24
- debug('response.status %o', response.status);
25
- const body = await response.json();
26
- if (response.status >= _core.HTTP_STATUS.BAD_REQUEST) {
72
+ const body = await response.body;
73
+ debug('response.status %o', body.statusCode);
74
+ if (body.statusCode >= _core.HTTP_STATUS.BAD_REQUEST) {
27
75
  throw new Error(body);
28
76
  }
29
77
  _logger.logger.info({
@@ -31,7 +79,7 @@ async function notifyRequest(url, options) {
31
79
  }, 'The notification @{content} has been successfully dispatched');
32
80
  return true;
33
81
  } catch (err) {
34
- debug('request error %o', err);
82
+ debug('request error %o:', err?.message);
35
83
  _logger.logger.error({
36
84
  errorMessage: err?.message
37
85
  }, 'notify service has thrown an error: @{errorMessage}');
@@ -1 +1 @@
1
- {"version":3,"file":"notify-request.js","names":["_debug","_interopRequireDefault","require","_gotCjs","_core","_logger","e","__esModule","default","debug","buildDebug","notifyRequest","url","options","response","got","post","body","JSON","stringify","method","headers","status","json","HTTP_STATUS","BAD_REQUEST","Error","logger","info","content","err","error","errorMessage","message"],"sources":["../src/notify-request.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport got from 'got-cjs';\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 = got.post(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"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAA2C,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3C,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,yBAAyB,CAAC;AAQ5C,eAAeC,aAAaA,CAACC,GAAW,EAAEC,OAAqB,EAAoB;EACxF,IAAIC,QAAQ;EACZ,IAAI;IACFL,KAAK,CAAC,QAAQ,EAAEG,GAAG,CAAC;IACpBE,QAAQ,GAAGC,eAAG,CAACC,IAAI,CAACJ,GAAG,EAAE;MACvBK,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACN,OAAO,CAACI,IAAI,CAAC;MAClCG,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QAAE,cAAc,EAAE;MAAmB;IAChD,CAAC,CAAC;IACFZ,KAAK,CAAC,qBAAqB,EAAEK,QAAQ,CAACQ,MAAM,CAAC;IAC7C,MAAML,IAAI,GAAG,MAAMH,QAAQ,CAACS,IAAI,CAAC,CAAC;IAClC,IAAIT,QAAQ,CAACQ,MAAM,IAAIE,iBAAW,CAACC,WAAW,EAAE;MAC9C,MAAM,IAAIC,KAAK,CAACT,IAAI,CAAC;IACvB;IAEAU,cAAM,CAACC,IAAI,CACT;MAAEC,OAAO,EAAEhB,OAAO,CAACI;IAAK,CAAC,EACzB,8DACF,CAAC;IACD,OAAO,IAAI;EACb,CAAC,CAAC,OAAOa,GAAQ,EAAE;IACjBrB,KAAK,CAAC,kBAAkB,EAAEqB,GAAG,CAAC;IAC9BH,cAAM,CAACI,KAAK,CACV;MAAEC,YAAY,EAAEF,GAAG,EAAEG;IAAQ,CAAC,EAC9B,qDACF,CAAC;IACD,OAAO,KAAK;EACd;AACF","ignoreList":[]}
1
+ {"version":3,"file":"notify-request.js","names":["_debug","_interopRequireDefault","require","_gotCjs","_core","_logger","e","__esModule","default","debug","buildDebug","verifyMethod","value","valid","upper","toUpperCase","includes","logger","warn","method","baseHeaders","notifyRequest","url","options","response","headers","userHeaders","JSON","parse","requestOptions","finalUrl","urlObj","URL","params","URLSearchParams","body","set","search","toString","undefined","Error","got","responseType","statusCode","HTTP_STATUS","BAD_REQUEST","info","content","err","message","error","errorMessage"],"sources":["../src/notify-request.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport got, { Method } from 'got-cjs';\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 function verifyMethod(value: any): Method {\n const valid: Method[] = ['GET', 'POST', 'PUT'];\n\n if (typeof value === 'string') {\n const upper = value.toUpperCase() as Method;\n\n if (valid.includes(upper)) {\n return upper;\n } else {\n logger.warn(\n { method: value },\n 'The notification method @{method} is not valid, using default POST method'\n );\n }\n }\n\n return 'POST';\n}\n\nconst baseHeaders = { 'Content-Type': 'application/json' };\nexport async function notifyRequest(url: string, options: FetchOptions): Promise<boolean> {\n let response;\n try {\n const method: Method = verifyMethod(options.method);\n debug('uri %o', url);\n debug('headers %o', options.headers);\n debug('method %o', method);\n\n let userHeaders: Record<string, any> = {};\n\n if (options.headers) {\n if (typeof options.headers === 'string') {\n userHeaders = JSON.parse(options.headers);\n } else if (typeof options.headers === 'object') {\n userHeaders = options.headers;\n }\n }\n\n const headers = { ...baseHeaders, ...userHeaders };\n const requestOptions: any = {\n method,\n headers,\n };\n\n let finalUrl = url;\n if (method === 'GET') {\n debug('using GET with query params');\n const urlObj = new URL(url);\n const params = new URLSearchParams(options.body);\n params.set('body', options.body);\n urlObj.search = params.toString();\n finalUrl = urlObj.toString();\n debug('final url with search params %o', finalUrl);\n } else if (options.body !== undefined) {\n requestOptions.body = options.body;\n } else {\n throw new Error('Notification body is undefined');\n }\n\n response = await got(finalUrl, {\n ...requestOptions,\n responseType: 'json',\n });\n\n const body = await response.body;\n debug('response.status %o', body.statusCode);\n\n if (body.statusCode >= 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?.message);\n logger.error(\n { errorMessage: err?.message },\n 'notify service has thrown an error: @{errorMessage}'\n );\n return false;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAA2C,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3C,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,yBAAyB,CAAC;AAQ5C,SAASC,YAAYA,CAACC,KAAU,EAAU;EAC/C,MAAMC,KAAe,GAAG,CAAC,KAAK,EAAE,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AK;EACd;AACF","ignoreList":[]}
package/build/notify.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Config, Notification, Package, RemoteUser } from '@verdaccio/types';
1
+ import { Config, Manifest, Notification, RemoteUser } from '@verdaccio/types';
2
2
  export declare function compileTemplate(content: any, metadata: any): Promise<unknown>;
3
- export declare function handleNotify(metadata: Partial<Package>, notifyEntry: any, remoteUser: Partial<RemoteUser>, publishedPackage: string): Promise<boolean>;
4
- export declare function sendNotification(metadata: Partial<Package>, notify: Notification, remoteUser: Partial<RemoteUser>, publishedPackage: string): Promise<boolean>;
5
- export declare function notify(metadata: Partial<Package>, config: Partial<Config>, remoteUser: Partial<RemoteUser>, publishedPackage: string): Promise<boolean[]>;
3
+ export declare function handleNotify(metadata: Partial<Manifest>, notifyEntry: any, remoteUser: Partial<RemoteUser>, publishedPackage: string): Promise<boolean>;
4
+ export declare function sendNotification(metadata: Manifest, notify: Notification, remoteUser: Partial<RemoteUser>, publishedPackage: string): Promise<boolean>;
5
+ export declare function notify(metadata: Manifest, config: Config, remoteUser: RemoteUser, publishedPackage: string): Promise<boolean[]>;
package/build/notify.js CHANGED
@@ -26,18 +26,30 @@ function compileTemplate(content, metadata) {
26
26
  return resolve(template(metadata));
27
27
  }
28
28
  } catch (error) {
29
- debug('error template handler %o', error);
29
+ debug('error template handler %o', error?.message);
30
+ _logger.logger.error({
31
+ error: error.message
32
+ }, 'notification template compilation has failed: @{error}');
30
33
  reject(error);
31
34
  }
32
35
  });
33
36
  }
34
37
  async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage) {
35
38
  let regex;
36
- if (metadata.name && notifyEntry.packagePattern) {
37
- regex = new RegExp(notifyEntry.packagePattern, notifyEntry.packagePatternFlags || '');
38
- if (!regex.test(metadata.name)) {
39
- return false;
39
+ try {
40
+ if (metadata.name && notifyEntry.packagePattern) {
41
+ debug('checking package pattern %o', notifyEntry.packagePattern);
42
+ debug('checking package pattern flags %o', notifyEntry.packagePatternFlags);
43
+ regex = new RegExp(notifyEntry.packagePattern, notifyEntry.packagePatternFlags ?? '');
44
+ if (!regex.test(metadata.name)) {
45
+ _logger.logger.debug('Notification exclude does not match %o', metadata.name);
46
+ return false;
47
+ }
48
+ debug('package pattern matched %o', metadata.name);
40
49
  }
50
+ } catch (error) {
51
+ _logger.logger.error('Invalid regex pattern or flags: %o', error?.message);
52
+ return false;
41
53
  }
42
54
  let content;
43
55
  // FIXME: publisher is not part of the expected types metadata
@@ -55,7 +67,7 @@ async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage)
55
67
  content = await compileTemplate(notifyEntry.content, metadata);
56
68
  }
57
69
  const options = {
58
- body: JSON.stringify(content)
70
+ body: content
59
71
  };
60
72
 
61
73
  // provides fallback support, it's accept an Object {} and Array of {}
@@ -88,38 +100,50 @@ async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage)
88
100
  function sendNotification(metadata, notify, remoteUser, publishedPackage) {
89
101
  return handleNotify(metadata, notify, remoteUser, publishedPackage);
90
102
  }
103
+ function isHasNotification(value) {
104
+ return value && typeof value === 'object' && 'endpoint' in value && 'content' in value;
105
+ }
91
106
  async function notify(metadata, config, remoteUser, publishedPackage) {
92
107
  debug('init send notification');
93
- if (config.notify) {
94
- const isSingle = Object.keys(config.notify).includes('method');
95
- if (isSingle) {
96
- debug('send single notification');
97
- try {
98
- const response = await sendNotification(metadata, config.notify, remoteUser, publishedPackage);
99
- return [response];
100
- } catch {
101
- debug('error on sending single notification');
102
- return [false];
103
- }
104
- } else {
108
+ const notification = config?.notify;
109
+ if (!notification) {
110
+ debug('no notify configuration detected');
111
+ return [false];
112
+ }
113
+ const isSingle = isHasNotification(notification);
114
+ debug('is single notify %o', isSingle);
115
+ if (isSingle) {
116
+ debug('send single notification');
117
+ try {
118
+ const response = await sendNotification(metadata, config.notify, remoteUser, publishedPackage);
119
+ return [response];
120
+ } catch {
121
+ debug('error on sending single notification');
122
+ return [false];
123
+ }
124
+ } else {
125
+ try {
105
126
  debug('send multiples notification');
106
- const results = await Promise.allSettled(Object.keys(config.notify).map(keyId => {
107
- // @ts-ignore
108
- const item = config.notify[keyId];
109
- debug('send item %o', item);
110
- return sendNotification(metadata, item, remoteUser, publishedPackage);
111
- })).catch(error => {
127
+ const notificationEntries = Object.entries(notification).filter(([, item]) => isHasNotification(item));
128
+ debug('valid notification entries %o', notificationEntries.length);
129
+ if (notificationEntries.length === 0) {
130
+ // No valid notifications, return false for each entry
131
+ return Object.keys(notification).map(() => false);
132
+ }
133
+ debug('sending %o notifications', notificationEntries.length);
134
+ const results = await Promise.allSettled(notificationEntries.map(([, item]) => sendNotification(metadata, item, remoteUser, publishedPackage))).catch(error => {
112
135
  _logger.logger.error({
113
136
  error
114
137
  }, 'notify request has failed: @error');
115
138
  });
116
-
117
- // @ts-ignore
118
- return Object.keys(results).map(promiseValue => results[promiseValue].value);
139
+ if (!results) {
140
+ return [];
141
+ }
142
+ return results.map(result => result.status === 'fulfilled' ? result.value : false);
143
+ } catch (error) {
144
+ debug('error on sending multiple notification %o', error);
145
+ return Object.keys(notification).map(() => false);
119
146
  }
120
- } else {
121
- debug('no notifications configuration detected');
122
- return [false];
123
147
  }
124
148
  }
125
149
  //# sourceMappingURL=notify.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notify.js","names":["_debug","_interopRequireDefault","require","_handlebars","_logger","_notifyRequest","e","__esModule","default","debug","buildDebug","compileTemplate","content","metadata","Promise","resolve","reject","handler","template","Handlebars","compile","error","handleNotify","notifyEntry","remoteUser","publishedPackage","regex","name","packagePattern","RegExp","packagePatternFlags","test","publisher","options","body","JSON","stringify","headers","Array","isArray","header","map","item","Object","is","key","hasOwnProperty","endpoint","Error","notifyRequest","method","sendNotification","notify","config","isSingle","keys","includes","response","results","allSettled","keyId","catch","logger","promiseValue","value"],"sources":["../src/notify.ts"],"sourcesContent":["/* eslint-disable no-undef */\nimport buildDebug from 'debug';\nimport Handlebars from 'handlebars';\n\nimport { logger } from '@verdaccio/logger';\nimport { Config, Notification, Package, RemoteUser } from '@verdaccio/types';\n\nimport { FetchOptions, notifyRequest } from './notify-request';\n\nconst debug = buildDebug('verdaccio:hooks');\n\nexport function compileTemplate(content, metadata) {\n // FUTURE: multiple handlers\n return new Promise((resolve, reject) => {\n let handler;\n try {\n if (!handler) {\n debug('compile default template handler %o', content);\n const template: HandlebarsTemplateDelegate = Handlebars.compile(content);\n return resolve(template(metadata));\n }\n } catch (error: any) {\n debug('error template handler %o', error);\n reject(error);\n }\n });\n}\n\nexport async function handleNotify(\n metadata: Partial<Package>,\n notifyEntry,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean> {\n let regex;\n if (metadata.name && notifyEntry.packagePattern) {\n regex = new RegExp(notifyEntry.packagePattern, notifyEntry.packagePatternFlags || '');\n if (!regex.test(metadata.name)) {\n return false;\n }\n }\n\n let content;\n // FIXME: publisher is not part of the expected types metadata\n // @ts-ignore\n if (typeof metadata?.publisher === 'undefined' || metadata?.publisher === null) {\n // @ts-ignore\n metadata = { ...metadata, publishedPackage, publisher: { name: remoteUser.name as string } };\n debug('template metadata %o', metadata);\n content = await compileTemplate(notifyEntry.content, metadata);\n }\n\n const options: FetchOptions = {\n body: JSON.stringify(content),\n };\n\n // provides fallback support, it's accept an Object {} and Array of {}\n if (notifyEntry.headers && Array.isArray(notifyEntry.headers)) {\n const header = {};\n // FIXME: we can simplify this\n notifyEntry.headers.map(function (item): void {\n if (Object.is(item, item)) {\n for (const key in item) {\n /* eslint no-prototype-builtins: 0 */\n if (item.hasOwnProperty(key)) {\n header[key] = item[key];\n }\n }\n }\n });\n options.headers = header;\n } else if (Object.is(notifyEntry.headers, notifyEntry.headers)) {\n options.headers = notifyEntry.headers;\n }\n\n if (!notifyEntry.endpoint) {\n debug('error due endpoint is missing');\n throw new Error('missing parameter');\n }\n\n return notifyRequest(notifyEntry.endpoint, {\n method: notifyEntry.method,\n ...options,\n });\n}\n\nexport function sendNotification(\n metadata: Partial<Package>,\n notify: Notification,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean> {\n return handleNotify(metadata, notify, remoteUser, publishedPackage) as Promise<any>;\n}\n\nexport async function notify(\n metadata: Partial<Package>,\n config: Partial<Config>,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean[]> {\n debug('init send notification');\n if (config.notify) {\n const isSingle = Object.keys(config.notify).includes('method');\n if (isSingle) {\n debug('send single notification');\n try {\n const response = await sendNotification(\n metadata,\n config.notify as Notification,\n remoteUser,\n publishedPackage\n );\n return [response];\n } catch {\n debug('error on sending single notification');\n return [false];\n }\n } else {\n debug('send multiples notification');\n const results = await Promise.allSettled(\n Object.keys(config.notify).map((keyId: string) => {\n // @ts-ignore\n const item = config.notify[keyId];\n debug('send item %o', item);\n return sendNotification(metadata, item, remoteUser, publishedPackage);\n })\n ).catch((error) => {\n logger.error({ error }, 'notify request has failed: @error');\n });\n\n // @ts-ignore\n return Object.keys(results).map((promiseValue) => results[promiseValue].value);\n }\n } else {\n debug('no notifications configuration detected');\n return [false];\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AAA+D,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAP/D;;AASA,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,iBAAiB,CAAC;AAEpC,SAASC,eAAeA,CAACC,OAAO,EAAEC,QAAQ,EAAE;EACjD;EACA,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC,IAAIC,OAAO;IACX,IAAI;MACF,IAAI,CAACA,OAAO,EAAE;QACZR,KAAK,CAAC,qCAAqC,EAAEG,OAAO,CAAC;QACrD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GX,MAAM,CAACY,IAAI,CAACF,MAAM,CAACD,MAAM,CAAC,CAACI,QAAQ,CAAC,QAAQ,CAAC;IAC9D,IAAIF,QAAQ,EAAE;MACZ7C,KAAK,CAAC,0BAA0B,CAAC;MACjC,IAAI;QACF,MAAMgD,QAAQ,GAAG,MAAMN,gBAAgB,CACrCtC,QAAQ,EACRwC,MAAM,CAACD,MAAM,EACb5B,UAAU,EACVC,gBACF,CAAC;QACD,OAAO,CAACgC,QAAQ,CAAC;MACnB,CAAC,CAAC,MAAM;QACNhD,KAAK,CAAC,sCAAsC,CAAC;QAC7C,OAAO,CAAC,KAAK,CAAC;MAChB;IACF,CAAC,MAAM;MACLA,KAAK,CAAC,6BAA6B,CAAC;MACpC,MAAMiD,OAAO,GAAG,MAAM5C,OAAO,CAAC6C,UAAU,CACtChB,MAAM,CAACY,IAAI,CAACF,MAAM,CAACD,MAAM,CAAC,CAACX,GAAG,CAAEmB,KAAa,IAAK;QAChD;QACA,MAAMlB,IAAI,GAAGW,MAAM,CAACD,MAAM,CAACQ,KAAK,CAAC;QACjCnD,KAAK,CAAC,cAAc,EAAEiC,IAAI,CAAC;QAC3B,OAAOS,gBAAgB,CAACtC,QAAQ,EAAE6B,IAAI,EAAElB,UAAU,EAAEC,gBAAgB,CAAC;MACvE,CAAC,CACH,CAAC,CAACoC,KAAK,CAAExC,KAAK,IAAK;QACjByC,cAAM,CAACzC,KAAK,CAAC;UAAEA;QAAM,CAAC,EAAE,mCAAmC,CAAC;MAC9D,CAAC,CAAC;;MAEF;MACA,OAAOsB,MAAM,CAACY,IAAI,CAACG,OAAO,CAAC,CAACjB,GAAG,CAAEsB,YAAY,IAAKL,OAAO,CAACK,YAAY,CAAC,CAACC,KAAK,CAAC;IAChF;EACF,CAAC,MAAM;IACLvD,KAAK,CAAC,yCAAyC,CAAC;IAChD,OAAO,CAAC,KAAK,CAAC;EAChB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"notify.js","names":["_debug","_interopRequireDefault","require","_handlebars","_logger","_notifyRequest","e","__esModule","default","debug","buildDebug","compileTemplate","content","metadata","Promise","resolve","reject","handler","template","Handlebars","compile","error","message","logger","handleNotify","notifyEntry","remoteUser","publishedPackage","regex","name","packagePattern","packagePatternFlags","RegExp","test","publisher","options","body","headers","Array","isArray","header","map","item","Object","is","key","hasOwnProperty","endpoint","Error","notifyRequest","method","sendNotification","notify","isHasNotification","value","config","notification","isSingle","response","notificationEntries","entries","filter","length","keys","results","allSettled","catch","result","status"],"sources":["../src/notify.ts"],"sourcesContent":["/* eslint-disable no-undef */\nimport buildDebug from 'debug';\nimport Handlebars from 'handlebars';\n\nimport { logger } from '@verdaccio/logger';\nimport { Config, Manifest, Notification, RemoteUser } from '@verdaccio/types';\n\nimport { FetchOptions, notifyRequest } from './notify-request';\n\nconst debug = buildDebug('verdaccio:hooks');\n\nexport function compileTemplate(content, metadata) {\n // FUTURE: multiple handlers\n return new Promise((resolve, reject) => {\n let handler;\n try {\n if (!handler) {\n debug('compile default template handler %o', content);\n const template: HandlebarsTemplateDelegate = Handlebars.compile(content);\n return resolve(template(metadata));\n }\n } catch (error: any) {\n debug('error template handler %o', error?.message);\n logger.error(\n { error: error.message },\n 'notification template compilation has failed: @{error}'\n );\n reject(error);\n }\n });\n}\n\nexport async function handleNotify(\n metadata: Partial<Manifest>,\n notifyEntry,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean> {\n let regex;\n try {\n if (metadata.name && notifyEntry.packagePattern) {\n debug('checking package pattern %o', notifyEntry.packagePattern);\n debug('checking package pattern flags %o', notifyEntry.packagePatternFlags);\n regex = new RegExp(notifyEntry.packagePattern, notifyEntry.packagePatternFlags ?? '');\n if (!regex.test(metadata.name)) {\n logger.debug('Notification exclude does not match %o', metadata.name);\n return false;\n }\n debug('package pattern matched %o', metadata.name);\n }\n } catch (error: any) {\n logger.error('Invalid regex pattern or flags: %o', error?.message);\n return false;\n }\n\n let content;\n // FIXME: publisher is not part of the expected types metadata\n // @ts-ignore\n if (typeof metadata?.publisher === 'undefined' || metadata?.publisher === null) {\n // @ts-ignore\n metadata = { ...metadata, publishedPackage, publisher: { name: remoteUser.name as string } };\n debug('template metadata %o', metadata);\n content = await compileTemplate(notifyEntry.content, metadata);\n }\n\n const options: FetchOptions = {\n body: content,\n };\n\n // provides fallback support, it's accept an Object {} and Array of {}\n if (notifyEntry.headers && Array.isArray(notifyEntry.headers)) {\n const header = {};\n // FIXME: we can simplify this\n notifyEntry.headers.map(function (item): void {\n if (Object.is(item, item)) {\n for (const key in item) {\n /* eslint no-prototype-builtins: 0 */\n if (item.hasOwnProperty(key)) {\n header[key] = item[key];\n }\n }\n }\n });\n options.headers = header;\n } else if (Object.is(notifyEntry.headers, notifyEntry.headers)) {\n options.headers = notifyEntry.headers;\n }\n\n if (!notifyEntry.endpoint) {\n debug('error due endpoint is missing');\n throw new Error('missing parameter');\n }\n\n return notifyRequest(notifyEntry.endpoint, {\n method: notifyEntry.method,\n ...options,\n });\n}\n\nexport function sendNotification(\n metadata: Manifest,\n notify: Notification,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean> {\n return handleNotify(metadata, notify, remoteUser, publishedPackage) as Promise<any>;\n}\n\nfunction isHasNotification(value: any): value is Notification {\n return value && typeof value === 'object' && 'endpoint' in value && 'content' in value;\n}\n\nexport async function notify(\n metadata: Manifest,\n config: Config,\n remoteUser: RemoteUser,\n publishedPackage: string\n): Promise<boolean[]> {\n debug('init send notification');\n const notification = config?.notify;\n if (!notification) {\n debug('no notify configuration detected');\n return [false];\n }\n\n const isSingle = isHasNotification(notification);\n debug('is single notify %o', isSingle);\n if (isSingle) {\n debug('send single notification');\n try {\n const response = await sendNotification(\n metadata,\n config.notify as Notification,\n remoteUser,\n publishedPackage\n );\n return [response];\n } catch {\n debug('error on sending single notification');\n return [false];\n }\n } else {\n try {\n debug('send multiples notification');\n const notificationEntries = Object.entries(notification).filter(([, item]) =>\n isHasNotification(item)\n );\n debug('valid notification entries %o', notificationEntries.length);\n if (notificationEntries.length === 0) {\n // No valid notifications, return false for each entry\n return Object.keys(notification).map(() => false);\n }\n debug('sending %o notifications', notificationEntries.length);\n const results = await Promise.allSettled(\n notificationEntries.map(([, item]) =>\n sendNotification(metadata, item, remoteUser, publishedPackage)\n )\n ).catch((error) => {\n logger.error({ error }, 'notify request has failed: @error');\n });\n if (!results) {\n return [];\n }\n return results.map((result) => (result.status === 'fulfilled' ? result.value : false));\n } catch (error) {\n debug('error on sending multiple notification %o', error);\n return Object.keys(notification).map(() => false);\n }\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AAA+D,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAP/D;;AASA,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,iBAAiB,CAAC;AAEpC,SAASC,eAAeA,CAACC,OAAO,EAAEC,QAAQ,EAAE;EACjD;EACA,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC,IAAIC,OAAO;IACX,IAAI;MACF,IAAI,CAACA,OAAO,EAAE;QACZR,KAAK,CAAC,qCAAqC,EAAEG,OAAO,CAAC;QACrD,MAAMM,QAAoC,GAAGC,mBAAU,CAACC,OAAO,CAACR,OAAO,CAAC;QACxE,OAAOG,OAAO,CAACG,QAAQ,CAACL,QAAQ,CAAC,CAAC;MACpC;IACF,CAAC,CAAC,OAAOQ,KAAU,EAAE;MACnBZ,KAAK,CAAC,4BAA4B,EAAEY,KAAK,EAAEC,OAAO,CAAC;MACnDC,cAAM,CAACF,KAAK,CACV;QAAEA,KAAK,EAAEA,KAAK,CAACC;MAAQ,CAAC,EACxB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,CAAC;MACnD;MACAhC,KAAK,CAAC,0BAA0B,EAAEkD,mBAAmB,CAACG,MAAM,CAAC;MAC7D,MAAME,OAAO,GAAG,MAAMlD,OAAO,CAACmD,UAAU,CACtCN,mBAAmB,CAAClB,GAAG,CAAC,CAAC,GAAGC,IAAI,CAAC,KAC/BS,gBAAgB,CAACtC,QAAQ,EAAE6B,IAAI,EAAEhB,UAAU,EAAEC,gBAAgB,CAC/D,CACF,CAAC,CAACuC,KAAK,CAAE7C,KAAK,IAAK;QACjBE,cAAM,CAACF,KAAK,CAAC;UAAEA;QAAM,CAAC,EAAE,mCAAmC,CAAC;MAC9D,CAAC,CAAC;MACF,IAAI,CAAC2C,OAAO,EAAE;QACZ,OAAO,EAAE;MACX;MACA,OAAOA,OAAO,CAACvB,GAAG,CAAE0B,MAAM,IAAMA,MAAM,CAACC,MAAM,KAAK,WAAW,GAAGD,MAAM,CAACb,KAAK,GAAG,KAAM,CAAC;IACxF,CAAC,CAAC,OAAOjC,KAAK,EAAE;MACdZ,KAAK,CAAC,2CAA2C,EAAEY,KAAK,CAAC;MACzD,OAAOsB,MAAM,CAACoB,IAAI,CAACP,YAAY,CAAC,CAACf,GAAG,CAAC,MAAM,KAAK,CAAC;IACnD;EACF;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/hooks",
3
- "version": "8.0.0-next-8.25",
3
+ "version": "8.0.0-next-8.27",
4
4
  "description": "Verdaccio Hooks",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -33,17 +33,18 @@
33
33
  "node": ">=18"
34
34
  },
35
35
  "dependencies": {
36
- "@verdaccio/core": "8.0.0-next-8.25",
37
- "@verdaccio/logger": "8.0.0-next-8.25",
36
+ "@verdaccio/core": "8.0.0-next-8.27",
37
+ "@verdaccio/logger": "8.0.0-next-8.27",
38
38
  "debug": "4.4.3",
39
39
  "got-cjs": "12.5.4",
40
40
  "handlebars": "4.7.8"
41
41
  },
42
42
  "devDependencies": {
43
- "@verdaccio/config": "8.0.0-next-8.25",
44
- "@verdaccio/types": "13.0.0-next-8.8",
43
+ "@verdaccio/config": "8.0.0-next-8.27",
44
+ "@verdaccio/types": "13.0.0-next-8.10",
45
45
  "nock": "13.5.6",
46
- "vitest": "3.2.4"
46
+ "vitest": "3.2.4",
47
+ "@verdaccio/test-helper": "4.0.0-next-8.11"
47
48
  },
48
49
  "funding": {
49
50
  "type": "opencollective",