@verdaccio/hooks 9.0.0-next-9.18 → 9.0.0-next-9.20

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/build/notify.d.ts CHANGED
@@ -1,5 +1,5 @@
1
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<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[]>;
3
+ export declare function handleNotify(metadata: Partial<Manifest>, notifyEntry: any, remoteUser: Partial<RemoteUser>, publishedPackage: string, publishType?: string): Promise<boolean>;
4
+ export declare function sendNotification(metadata: Partial<Manifest>, notify: Notification, remoteUser: Partial<RemoteUser>, publishedPackage: string, publishType?: string): Promise<boolean>;
5
+ export declare function notify(metadata: Partial<Manifest>, config: Config, remoteUser: RemoteUser, publishedPackage: string, publishType?: string): Promise<boolean[]>;
package/build/notify.js CHANGED
@@ -19,7 +19,7 @@ function compileTemplate(content, metadata) {
19
19
  }
20
20
  });
21
21
  }
22
- async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage) {
22
+ async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage, publishType) {
23
23
  let regex;
24
24
  try {
25
25
  if (metadata.name && notifyEntry.packagePattern) {
@@ -36,23 +36,22 @@ async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage)
36
36
  _verdaccio_logger.logger.error("Invalid regex pattern or flags: %o", error?.message);
37
37
  return false;
38
38
  }
39
- let content;
40
- if (typeof metadata?.publisher === "undefined" || metadata?.publisher === null) {
41
- metadata = {
42
- ...metadata,
43
- publishedPackage,
44
- publisher: { name: remoteUser.name }
45
- };
46
- debug$1("template metadata %o", metadata);
47
- content = await compileTemplate(notifyEntry.content, metadata);
48
- }
49
- const options = { body: content };
39
+ const publishMetadata = {
40
+ ...metadata,
41
+ ...typeof metadata.publisher === "undefined" || metadata.publisher === null ? { publisher: {
42
+ name: remoteUser.name,
43
+ groups: remoteUser.groups,
44
+ real_groups: remoteUser.real_groups
45
+ } } : {},
46
+ publishedPackage,
47
+ publishType
48
+ };
49
+ debug$1("template metadata %o", publishMetadata);
50
+ const options = { body: await compileTemplate(notifyEntry.content, publishMetadata) };
50
51
  if (notifyEntry.headers && Array.isArray(notifyEntry.headers)) {
51
52
  const header = {};
52
- notifyEntry.headers.map(function(item) {
53
- if (Object.is(item, item)) {
54
- for (const key in item) if (item.hasOwnProperty(key)) header[key] = item[key];
55
- }
53
+ notifyEntry.headers.forEach((item) => {
54
+ if (item && typeof item === "object") Object.assign(header, item);
56
55
  });
57
56
  options.headers = header;
58
57
  } else if (Object.is(notifyEntry.headers, notifyEntry.headers)) options.headers = notifyEntry.headers;
@@ -65,13 +64,13 @@ async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage)
65
64
  ...options
66
65
  });
67
66
  }
68
- function sendNotification(metadata, notify, remoteUser, publishedPackage) {
69
- return handleNotify(metadata, notify, remoteUser, publishedPackage);
67
+ function sendNotification(metadata, notify, remoteUser, publishedPackage, publishType) {
68
+ return handleNotify(metadata, notify, remoteUser, publishedPackage, publishType);
70
69
  }
71
70
  function isHasNotification(value) {
72
71
  return value && typeof value === "object" && "endpoint" in value && "content" in value;
73
72
  }
74
- async function notify(metadata, config, remoteUser, publishedPackage) {
73
+ async function notify(metadata, config, remoteUser, publishedPackage, publishType) {
75
74
  debug$1("init send notification");
76
75
  const notification = config?.notify;
77
76
  if (!notification) {
@@ -83,7 +82,7 @@ async function notify(metadata, config, remoteUser, publishedPackage) {
83
82
  if (isSingle) {
84
83
  debug$1("send single notification");
85
84
  try {
86
- return [await sendNotification(metadata, config.notify, remoteUser, publishedPackage)];
85
+ return [await sendNotification(metadata, config.notify, remoteUser, publishedPackage, publishType)];
87
86
  } catch {
88
87
  debug$1("error on sending single notification");
89
88
  return [false];
@@ -94,7 +93,7 @@ async function notify(metadata, config, remoteUser, publishedPackage) {
94
93
  debug$1("valid notification entries %o", notificationEntries.length);
95
94
  if (notificationEntries.length === 0) return Object.keys(notification).map(() => false);
96
95
  debug$1("sending %o notifications", notificationEntries.length);
97
- const results = await Promise.allSettled(notificationEntries.map(([, item]) => sendNotification(metadata, item, remoteUser, publishedPackage))).catch((error) => {
96
+ const results = await Promise.allSettled(notificationEntries.map(([, item]) => sendNotification(metadata, item, remoteUser, publishedPackage, publishType))).catch((error) => {
98
97
  _verdaccio_logger.logger.error({ error }, "notify request has failed: @error");
99
98
  });
100
99
  if (!results) return [];
@@ -1 +1 @@
1
- {"version":3,"file":"notify.js","names":[],"sources":["../src/notify.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport Handlebars from 'handlebars';\n\nimport { logger } from '@verdaccio/logger';\nimport type { Config, Manifest, Notification, RemoteUser } from '@verdaccio/types';\n\nimport type { FetchOptions } from './notify-request';\nimport { 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":";;;;;;;;AASA,IAAM,WAAA,GAAA,MAAA,SAAmB,iBAAiB;AAE1C,SAAgB,gBAAgB,SAAS,UAAU;CAEjD,OAAO,IAAI,SAAS,SAAS,WAAW;EAEtC,IAAI;GAEA,QAAM,uCAAuC,OAAO;GAEpD,OAAO,QADsC,WAAA,QAAW,QAAQ,OACjD,EAAS,QAAQ,CAAC;EAErC,SAAS,OAAY;GACnB,QAAM,8BAA8B,OAAO,OAAO;GAClD,kBAAA,OAAO,MACL,EAAE,OAAO,MAAM,QAAQ,GACvB,wDACF;GACA,OAAO,KAAK;EACd;CACF,CAAC;AACH;AAEA,eAAsB,aACpB,UACA,aACA,YACA,kBACkB;CAClB,IAAI;CACJ,IAAI;EACF,IAAI,SAAS,QAAQ,YAAY,gBAAgB;GAC/C,QAAM,+BAA+B,YAAY,cAAc;GAC/D,QAAM,qCAAqC,YAAY,mBAAmB;GAC1E,QAAQ,IAAI,OAAO,YAAY,gBAAgB,YAAY,uBAAuB,EAAE;GACpF,IAAI,CAAC,MAAM,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AC9B,MAAM,eAAe,QAAQ;CAC7B,IAAI,CAAC,cAAc;EACjB,QAAM,kCAAkC;EACxC,OAAO,CAAC,KAAK;CACf;CAEA,MAAM,WAAW,kBAAkB,YAAY;CAC/C,QAAM,uBAAuB,QAAQ;CACrC,IAAI,UAAU;EACZ,QAAM,0BAA0B;EAChC,IAAI;GAOF,OAAO,CAAC,MANe,iBACrB,UACA,OAAO,QACP,YACA,gBACF,CACgB;EAClB,QAAQ;GACN,QAAM,sCAAsC;GAC5C,OAAO,CAAC,KAAK;EACf;CACF,OACE,IAAI;EACF,QAAM,6BAA6B;EACnC,MAAM,sBAAsB,OAAO,QAAQ,YAAY,EAAE,QAAQ,GAAG,UAClE,kBAAkB,IAAI,CACxB;EACA,QAAM,iCAAiC,oBAAoB,MAAM;EACjE,IAAI,oBAAoB,WAAW,GAEjC,OAAO,OAAO,KAAK,YAAY,EAAE,UAAU,KAAK;EAElD,QAAM,4BAA4B,oBAAoB,MAAM;EAC5D,MAAM,UAAU,MAAM,QAAQ,WAC5B,oBAAoB,KAAK,GAAG,UAC1B,iBAAiB,UAAU,MAAM,YAAY,gBAAgB,CAC/D,CACF,EAAE,OAAO,UAAU;GACjB,kBAAA,OAAO,MAAM,EAAE,MAAM,GAAG,mCAAmC;EAC7D,CAAC;EACD,IAAI,CAAC,SACH,OAAO,CAAC;EAEV,OAAO,QAAQ,KAAK,WAAY,OAAO,WAAW,cAAc,OAAO,QAAQ,KAAM;CACvF,SAAS,OAAO;EACd,QAAM,6CAA6C,KAAK;EACxD,OAAO,OAAO,KAAK,YAAY,EAAE,UAAU,KAAK;CAClD;AAEJ"}
1
+ {"version":3,"file":"notify.js","names":[],"sources":["../src/notify.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport Handlebars from 'handlebars';\n\nimport { logger } from '@verdaccio/logger';\nimport type { Config, Manifest, Notification, RemoteUser } from '@verdaccio/types';\n\nimport type { FetchOptions } from './notify-request';\nimport { 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 // eslint-disable-next-line no-unassigned-vars\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 publishType?: 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 const publishMetadata = {\n ...metadata,\n ...(typeof metadata.publisher === 'undefined' || metadata.publisher === null\n ? {\n // only expose the documented publisher fields, never the full remote\n // user object (it may carry the auth token, which must not leak to the\n // notification endpoint)\n publisher: {\n name: remoteUser.name,\n groups: remoteUser.groups,\n real_groups: remoteUser.real_groups,\n },\n }\n : {}),\n publishedPackage,\n publishType,\n };\n debug('template metadata %o', publishMetadata);\n const content = (await compileTemplate(notifyEntry.content, publishMetadata)) as string;\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 notifyEntry.headers.forEach((item): void => {\n if (item && typeof item === 'object') {\n Object.assign(header, item);\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<Manifest>,\n notify: Notification,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string,\n publishType?: string\n): Promise<boolean> {\n return handleNotify(metadata, notify, remoteUser, publishedPackage, publishType) 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: Partial<Manifest>,\n config: Config,\n remoteUser: RemoteUser,\n publishedPackage: string,\n publishType?: 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 publishType\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, publishType)\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":";;;;;;;;AASA,IAAM,WAAA,GAAA,MAAA,SAAmB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AoB,KAAK,GAAG,UAC1B,iBAAiB,UAAU,MAAM,YAAY,kBAAkB,WAAW,CAC5E,CACF,EAAE,OAAO,UAAU;GACjB,kBAAA,OAAO,MAAM,EAAE,MAAM,GAAG,mCAAmC;EAC7D,CAAC;EACD,IAAI,CAAC,SACH,OAAO,CAAC;EAEV,OAAO,QAAQ,KAAK,WAAY,OAAO,WAAW,cAAc,OAAO,QAAQ,KAAM;CACvF,SAAS,OAAO;EACd,QAAM,6CAA6C,KAAK;EACxD,OAAO,OAAO,KAAK,YAAY,EAAE,UAAU,KAAK;CAClD;AAEJ"}
package/build/notify.mjs CHANGED
@@ -16,7 +16,7 @@ function compileTemplate(content, metadata) {
16
16
  }
17
17
  });
18
18
  }
19
- async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage) {
19
+ async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage, publishType) {
20
20
  let regex;
21
21
  try {
22
22
  if (metadata.name && notifyEntry.packagePattern) {
@@ -33,23 +33,22 @@ async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage)
33
33
  logger.error("Invalid regex pattern or flags: %o", error?.message);
34
34
  return false;
35
35
  }
36
- let content;
37
- if (typeof metadata?.publisher === "undefined" || metadata?.publisher === null) {
38
- metadata = {
39
- ...metadata,
40
- publishedPackage,
41
- publisher: { name: remoteUser.name }
42
- };
43
- debug("template metadata %o", metadata);
44
- content = await compileTemplate(notifyEntry.content, metadata);
45
- }
46
- const options = { body: content };
36
+ const publishMetadata = {
37
+ ...metadata,
38
+ ...typeof metadata.publisher === "undefined" || metadata.publisher === null ? { publisher: {
39
+ name: remoteUser.name,
40
+ groups: remoteUser.groups,
41
+ real_groups: remoteUser.real_groups
42
+ } } : {},
43
+ publishedPackage,
44
+ publishType
45
+ };
46
+ debug("template metadata %o", publishMetadata);
47
+ const options = { body: await compileTemplate(notifyEntry.content, publishMetadata) };
47
48
  if (notifyEntry.headers && Array.isArray(notifyEntry.headers)) {
48
49
  const header = {};
49
- notifyEntry.headers.map(function(item) {
50
- if (Object.is(item, item)) {
51
- for (const key in item) if (item.hasOwnProperty(key)) header[key] = item[key];
52
- }
50
+ notifyEntry.headers.forEach((item) => {
51
+ if (item && typeof item === "object") Object.assign(header, item);
53
52
  });
54
53
  options.headers = header;
55
54
  } else if (Object.is(notifyEntry.headers, notifyEntry.headers)) options.headers = notifyEntry.headers;
@@ -62,13 +61,13 @@ async function handleNotify(metadata, notifyEntry, remoteUser, publishedPackage)
62
61
  ...options
63
62
  });
64
63
  }
65
- function sendNotification(metadata, notify, remoteUser, publishedPackage) {
66
- return handleNotify(metadata, notify, remoteUser, publishedPackage);
64
+ function sendNotification(metadata, notify, remoteUser, publishedPackage, publishType) {
65
+ return handleNotify(metadata, notify, remoteUser, publishedPackage, publishType);
67
66
  }
68
67
  function isHasNotification(value) {
69
68
  return value && typeof value === "object" && "endpoint" in value && "content" in value;
70
69
  }
71
- async function notify(metadata, config, remoteUser, publishedPackage) {
70
+ async function notify(metadata, config, remoteUser, publishedPackage, publishType) {
72
71
  debug("init send notification");
73
72
  const notification = config?.notify;
74
73
  if (!notification) {
@@ -80,7 +79,7 @@ async function notify(metadata, config, remoteUser, publishedPackage) {
80
79
  if (isSingle) {
81
80
  debug("send single notification");
82
81
  try {
83
- return [await sendNotification(metadata, config.notify, remoteUser, publishedPackage)];
82
+ return [await sendNotification(metadata, config.notify, remoteUser, publishedPackage, publishType)];
84
83
  } catch {
85
84
  debug("error on sending single notification");
86
85
  return [false];
@@ -91,7 +90,7 @@ async function notify(metadata, config, remoteUser, publishedPackage) {
91
90
  debug("valid notification entries %o", notificationEntries.length);
92
91
  if (notificationEntries.length === 0) return Object.keys(notification).map(() => false);
93
92
  debug("sending %o notifications", notificationEntries.length);
94
- const results = await Promise.allSettled(notificationEntries.map(([, item]) => sendNotification(metadata, item, remoteUser, publishedPackage))).catch((error) => {
93
+ const results = await Promise.allSettled(notificationEntries.map(([, item]) => sendNotification(metadata, item, remoteUser, publishedPackage, publishType))).catch((error) => {
95
94
  logger.error({ error }, "notify request has failed: @error");
96
95
  });
97
96
  if (!results) return [];
@@ -1 +1 @@
1
- {"version":3,"file":"notify.mjs","names":[],"sources":["../src/notify.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport Handlebars from 'handlebars';\n\nimport { logger } from '@verdaccio/logger';\nimport type { Config, Manifest, Notification, RemoteUser } from '@verdaccio/types';\n\nimport type { FetchOptions } from './notify-request';\nimport { 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":";;;;;AASA,IAAM,QAAQ,WAAW,iBAAiB;AAE1C,SAAgB,gBAAgB,SAAS,UAAU;CAEjD,OAAO,IAAI,SAAS,SAAS,WAAW;EAEtC,IAAI;GAEA,MAAM,uCAAuC,OAAO;GAEpD,OAAO,QADsC,WAAW,QAAQ,OACjD,EAAS,QAAQ,CAAC;EAErC,SAAS,OAAY;GACnB,MAAM,8BAA8B,OAAO,OAAO;GAClD,OAAO,MACL,EAAE,OAAO,MAAM,QAAQ,GACvB,wDACF;GACA,OAAO,KAAK;EACd;CACF,CAAC;AACH;AAEA,eAAsB,aACpB,UACA,aACA,YACA,kBACkB;CAClB,IAAI;CACJ,IAAI;EACF,IAAI,SAAS,QAAQ,YAAY,gBAAgB;GAC/C,MAAM,+BAA+B,YAAY,cAAc;GAC/D,MAAM,qCAAqC,YAAY,mBAAmB;GAC1E,QAAQ,IAAI,OAAO,YAAY,gBAAgB,YAAY,uBAAuB,EAAE;GACpF,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG;IAC9B,OAAO,MAAM,0CAA0C,SAAS,IAAI;IACpE,OAAO;GACT;GACA,MAAM,8BAA8B,SAAS,IAAI;EACnD;CACF,SAAS,OAAY;EACnB,OAAO,MAAM,sCAAsC,OAAO,OAAO;EACjE,OAAO;CACT;CAEA,IAAI;CAGJ,IAAI,OAAO,UAAU,cAAc,eAAe,UAAU,cAAc,MAAM;EAE9E,WAAW;GAAE,GAAG;GAAU;GAAkB,WAAW,EAAE,MAAM,WAAW,KAAe;EAAE;EAC3F,MAAM,wBAAwB,QAAQ;EACtC,UAAU,MAAM,gBAAgB,YAAY,SAAS,QAAQ;CAC/D;CAEA,MAAM,UAAwB,EAC5B,MAAM,QACR;CAGA,IAAI,YAA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M;EACjE,IAAI,oBAAoB,WAAW,GAEjC,OAAO,OAAO,KAAK,YAAY,EAAE,UAAU,KAAK;EAElD,MAAM,4BAA4B,oBAAoB,MAAM;EAC5D,MAAM,UAAU,MAAM,QAAQ,WAC5B,oBAAoB,KAAK,GAAG,UAC1B,iBAAiB,UAAU,MAAM,YAAY,gBAAgB,CAC/D,CACF,EAAE,OAAO,UAAU;GACjB,OAAO,MAAM,EAAE,MAAM,GAAG,mCAAmC;EAC7D,CAAC;EACD,IAAI,CAAC,SACH,OAAO,CAAC;EAEV,OAAO,QAAQ,KAAK,WAAY,OAAO,WAAW,cAAc,OAAO,QAAQ,KAAM;CACvF,SAAS,OAAO;EACd,MAAM,6CAA6C,KAAK;EACxD,OAAO,OAAO,KAAK,YAAY,EAAE,UAAU,KAAK;CAClD;AAEJ"}
1
+ {"version":3,"file":"notify.mjs","names":[],"sources":["../src/notify.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport Handlebars from 'handlebars';\n\nimport { logger } from '@verdaccio/logger';\nimport type { Config, Manifest, Notification, RemoteUser } from '@verdaccio/types';\n\nimport type { FetchOptions } from './notify-request';\nimport { 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 // eslint-disable-next-line no-unassigned-vars\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 publishType?: 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 const publishMetadata = {\n ...metadata,\n ...(typeof metadata.publisher === 'undefined' || metadata.publisher === null\n ? {\n // only expose the documented publisher fields, never the full remote\n // user object (it may carry the auth token, which must not leak to the\n // notification endpoint)\n publisher: {\n name: remoteUser.name,\n groups: remoteUser.groups,\n real_groups: remoteUser.real_groups,\n },\n }\n : {}),\n publishedPackage,\n publishType,\n };\n debug('template metadata %o', publishMetadata);\n const content = (await compileTemplate(notifyEntry.content, publishMetadata)) as string;\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 notifyEntry.headers.forEach((item): void => {\n if (item && typeof item === 'object') {\n Object.assign(header, item);\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<Manifest>,\n notify: Notification,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string,\n publishType?: string\n): Promise<boolean> {\n return handleNotify(metadata, notify, remoteUser, publishedPackage, publishType) 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: Partial<Manifest>,\n config: Config,\n remoteUser: RemoteUser,\n publishedPackage: string,\n publishType?: 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 publishType\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, publishType)\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":";;;;;AASA,IAAM,QAAQ,WAAW,iBAAiB;AAE1C,SAAgB,gBAAgB,SAAS,UAAU;CAEjD,OAAO,IAAI,SAAS,SAAS,WAAW;EAGtC,IAAI;GAEA,MAAM,uCAAuC,OAAO;GAEpD,OAAO,QADsC,WAAW,QAAQ,OACjD,EAAS,QAAQ,CAAC;EAErC,SAAS,OAAY;GACnB,MAAM,8BAA8B,OAAO,OAAO;GAClD,OAAO,MACL,EAAE,OAAO,MAAM,QAAQ,GACvB,wDACF;GACA,OAAO,KAAK;EACd;CACF,CAAC;AACH;AAEA,eAAsB,aACpB,UACA,aACA,YACA,kBACA,aACkB;CAClB,IAAI;CACJ,IAAI;EACF,IAAI,SAAS,QAAQ,YAAY,gBAAgB;GAC/C,MAAM,+BAA+B,YAAY,cAAc;GAC/D,MAAM,qCAAqC,YAAY,mBAAmB;GAC1E,QA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ACA,kBACA,aACoB;CACpB,MAAM,wBAAwB;CAC9B,MAAM,eAAe,QAAQ;CAC7B,IAAI,CAAC,cAAc;EACjB,MAAM,kCAAkC;EACxC,OAAO,CAAC,KAAK;CACf;CAEA,MAAM,WAAW,kBAAkB,YAAY;CAC/C,MAAM,uBAAuB,QAAQ;CACrC,IAAI,UAAU;EACZ,MAAM,0BAA0B;EAChC,IAAI;GAQF,OAAO,CAAC,MAPe,iBACrB,UACA,OAAO,QACP,YACA,kBACA,WACF,CACgB;EAClB,QAAQ;GACN,MAAM,sCAAsC;GAC5C,OAAO,CAAC,KAAK;EACf;CACF,OACE,IAAI;EACF,MAAM,6BAA6B;EACnC,MAAM,sBAAsB,OAAO,QAAQ,YAAY,EAAE,QAAQ,GAAG,UAClE,kBAAkB,IAAI,CACxB;EACA,MAAM,iCAAiC,oBAAoB,MAAM;EACjE,IAAI,oBAAoB,WAAW,GAEjC,OAAO,OAAO,KAAK,YAAY,EAAE,UAAU,KAAK;EAElD,MAAM,4BAA4B,oBAAoB,MAAM;EAC5D,MAAM,UAAU,MAAM,QAAQ,WAC5B,oBAAoB,KAAK,GAAG,UAC1B,iBAAiB,UAAU,MAAM,YAAY,kBAAkB,WAAW,CAC5E,CACF,EAAE,OAAO,UAAU;GACjB,OAAO,MAAM,EAAE,MAAM,GAAG,mCAAmC;EAC7D,CAAC;EACD,IAAI,CAAC,SACH,OAAO,CAAC;EAEV,OAAO,QAAQ,KAAK,WAAY,OAAO,WAAW,cAAc,OAAO,QAAQ,KAAM;CACvF,SAAS,OAAO;EACd,MAAM,6CAA6C,KAAK;EACxD,OAAO,OAAO,KAAK,YAAY,EAAE,UAAU,KAAK;CAClD;AAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/hooks",
3
- "version": "9.0.0-next-9.18",
3
+ "version": "9.0.0-next-9.20",
4
4
  "description": "Verdaccio Hooks",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -33,17 +33,19 @@
33
33
  "node": ">=24"
34
34
  },
35
35
  "dependencies": {
36
- "@verdaccio/core": "9.0.0-next-9.18",
37
- "@verdaccio/logger": "9.0.0-next-9.18",
36
+ "@verdaccio/core": "9.0.0-next-9.20",
37
+ "@verdaccio/logger": "9.0.0-next-9.20",
38
38
  "debug": "4.4.3",
39
39
  "got": "14.6.6",
40
40
  "handlebars": "4.7.9"
41
41
  },
42
42
  "devDependencies": {
43
- "@verdaccio/config": "9.0.0-next-9.18",
44
- "@verdaccio/test-helper": "5.0.0-next-9.19",
45
- "@verdaccio/types": "14.0.0-next-9.9",
43
+ "@verdaccio/config": "9.0.0-next-9.20",
44
+ "@verdaccio/test-helper": "5.0.0-next-9.21",
45
+ "@verdaccio/types": "14.0.0-next-9.11",
46
46
  "nock": "13.5.6",
47
+ "rimraf": "6.1.3",
48
+ "vite": "8.0.14",
47
49
  "vitest": "4.1.7"
48
50
  },
49
51
  "funding": {