verdaccio-stats 0.3.0 → 0.3.2

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 (3) hide show
  1. package/lib/index.js +40 -28
  2. package/lib/index.mjs +40 -28
  3. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -15,7 +15,7 @@ var buildDebug = require('debug');
15
15
  var umzug = require('umzug');
16
16
 
17
17
  var name = "verdaccio-stats";
18
- var version = "0.3.0";
18
+ var version = "0.3.2";
19
19
 
20
20
  const plugin = {
21
21
  name,
@@ -404,7 +404,21 @@ class UI {
404
404
  {
405
405
  resource: Package,
406
406
  options: {
407
- actions: { ...defaultActions },
407
+ actions: {
408
+ ...defaultActions,
409
+ search: {
410
+ before: (request) => {
411
+ if (request.params.action !== "search") {
412
+ return request;
413
+ }
414
+ request.query = {
415
+ ...request.query,
416
+ searchProperty: "name",
417
+ };
418
+ return request;
419
+ },
420
+ },
421
+ },
408
422
  titleProperty: "displayName",
409
423
  listProperties: ["id", "name", "version", "createdAt"],
410
424
  showProperties: ["id", "name", "version", "createdAt"],
@@ -412,38 +426,36 @@ class UI {
412
426
  sort: { sortBy: "createdAt", direction: "desc" },
413
427
  },
414
428
  },
415
- this.config.countDownloads &&
416
- {
417
- resource: DownloadStats,
418
- options: {
419
- actions: { ...defaultActions },
420
- properties: {
421
- periodType: {
422
- availableValues: PERIOD_TYPES.map((type) => ({ value: type, label: type })),
423
- },
429
+ this.config.countDownloads && {
430
+ resource: DownloadStats,
431
+ options: {
432
+ actions: { ...defaultActions },
433
+ properties: {
434
+ periodType: {
435
+ availableValues: PERIOD_TYPES.map((type) => ({ value: type, label: type })),
424
436
  },
425
- listProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
426
- showProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
427
- filterProperties: ["packageId", "periodType", "periodValue", "createdAt", "updatedAt"],
428
- sort: { sortBy: "updatedAt", direction: "desc" },
429
437
  },
438
+ listProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
439
+ showProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
440
+ filterProperties: ["packageId", "periodType", "periodValue", "createdAt", "updatedAt"],
441
+ sort: { sortBy: "updatedAt", direction: "desc" },
430
442
  },
431
- this.config.countManifestViews &&
432
- {
433
- resource: ManifestViewStats,
434
- options: {
435
- actions: { ...defaultActions },
436
- properties: {
437
- periodType: {
438
- availableValues: PERIOD_TYPES.map((type) => ({ value: type, label: type })),
439
- },
443
+ },
444
+ this.config.countManifestViews && {
445
+ resource: ManifestViewStats,
446
+ options: {
447
+ actions: { ...defaultActions },
448
+ properties: {
449
+ periodType: {
450
+ availableValues: PERIOD_TYPES.map((type) => ({ value: type, label: type })),
440
451
  },
441
- listProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
442
- showProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
443
- filterProperties: ["packageId", "periodType", "periodValue", "createdAt", "updatedAt"],
444
- sort: { sortBy: "updatedAt", direction: "desc" },
445
452
  },
453
+ listProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
454
+ showProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
455
+ filterProperties: ["packageId", "periodType", "periodValue", "createdAt", "updatedAt"],
456
+ sort: { sortBy: "updatedAt", direction: "desc" },
446
457
  },
458
+ },
447
459
  ].filter(Boolean),
448
460
  rootPath: rootPath,
449
461
  branding: {
package/lib/index.mjs CHANGED
@@ -11,7 +11,7 @@ import buildDebug from 'debug';
11
11
  import { Umzug, SequelizeStorage } from 'umzug';
12
12
 
13
13
  var name = "verdaccio-stats";
14
- var version = "0.3.0";
14
+ var version = "0.3.2";
15
15
 
16
16
  const plugin = {
17
17
  name,
@@ -400,7 +400,21 @@ class UI {
400
400
  {
401
401
  resource: Package,
402
402
  options: {
403
- actions: { ...defaultActions },
403
+ actions: {
404
+ ...defaultActions,
405
+ search: {
406
+ before: (request) => {
407
+ if (request.params.action !== "search") {
408
+ return request;
409
+ }
410
+ request.query = {
411
+ ...request.query,
412
+ searchProperty: "name",
413
+ };
414
+ return request;
415
+ },
416
+ },
417
+ },
404
418
  titleProperty: "displayName",
405
419
  listProperties: ["id", "name", "version", "createdAt"],
406
420
  showProperties: ["id", "name", "version", "createdAt"],
@@ -408,38 +422,36 @@ class UI {
408
422
  sort: { sortBy: "createdAt", direction: "desc" },
409
423
  },
410
424
  },
411
- this.config.countDownloads &&
412
- {
413
- resource: DownloadStats,
414
- options: {
415
- actions: { ...defaultActions },
416
- properties: {
417
- periodType: {
418
- availableValues: PERIOD_TYPES.map((type) => ({ value: type, label: type })),
419
- },
425
+ this.config.countDownloads && {
426
+ resource: DownloadStats,
427
+ options: {
428
+ actions: { ...defaultActions },
429
+ properties: {
430
+ periodType: {
431
+ availableValues: PERIOD_TYPES.map((type) => ({ value: type, label: type })),
420
432
  },
421
- listProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
422
- showProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
423
- filterProperties: ["packageId", "periodType", "periodValue", "createdAt", "updatedAt"],
424
- sort: { sortBy: "updatedAt", direction: "desc" },
425
433
  },
434
+ listProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
435
+ showProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
436
+ filterProperties: ["packageId", "periodType", "periodValue", "createdAt", "updatedAt"],
437
+ sort: { sortBy: "updatedAt", direction: "desc" },
426
438
  },
427
- this.config.countManifestViews &&
428
- {
429
- resource: ManifestViewStats,
430
- options: {
431
- actions: { ...defaultActions },
432
- properties: {
433
- periodType: {
434
- availableValues: PERIOD_TYPES.map((type) => ({ value: type, label: type })),
435
- },
439
+ },
440
+ this.config.countManifestViews && {
441
+ resource: ManifestViewStats,
442
+ options: {
443
+ actions: { ...defaultActions },
444
+ properties: {
445
+ periodType: {
446
+ availableValues: PERIOD_TYPES.map((type) => ({ value: type, label: type })),
436
447
  },
437
- listProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
438
- showProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
439
- filterProperties: ["packageId", "periodType", "periodValue", "createdAt", "updatedAt"],
440
- sort: { sortBy: "updatedAt", direction: "desc" },
441
448
  },
449
+ listProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
450
+ showProperties: ["id", "packageId", "periodType", "periodValue", "count", "createdAt", "updatedAt"],
451
+ filterProperties: ["packageId", "periodType", "periodValue", "createdAt", "updatedAt"],
452
+ sort: { sortBy: "updatedAt", direction: "desc" },
442
453
  },
454
+ },
443
455
  ].filter(Boolean),
444
456
  rootPath: rootPath,
445
457
  branding: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verdaccio-stats",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "The stats plugin for Verdaccio",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.mjs",
@@ -20,7 +20,7 @@
20
20
  "@eslint/js": "^9.22.0",
21
21
  "@rollup/plugin-commonjs": "^28.0.3",
22
22
  "@rollup/plugin-json": "^6.1.0",
23
- "@rollup/plugin-node-resolve": "^16.0.0",
23
+ "@rollup/plugin-node-resolve": "^16.0.1",
24
24
  "@rollup/plugin-replace": "^6.0.2",
25
25
  "@rollup/plugin-typescript": "^12.1.2",
26
26
  "@types/debug": "^4.1.12",
@@ -36,7 +36,7 @@
36
36
  "eslint-plugin-unicorn": "^57.0.0",
37
37
  "express": "^4.21.2",
38
38
  "globals": "^16.0.0",
39
- "pg": "^8.13.3",
39
+ "pg": "^8.14.0",
40
40
  "pg-hstore": "^2.3.4",
41
41
  "prettier": "^3.5.3",
42
42
  "rimraf": "^6.0.1",
@@ -45,7 +45,7 @@
45
45
  "sqlite3": "^5.1.7",
46
46
  "tslib": "^2.8.1",
47
47
  "typescript": "^5.8.2",
48
- "typescript-eslint": "^8.26.0",
48
+ "typescript-eslint": "^8.26.1",
49
49
  "verdaccio": "^6.0.5",
50
50
  "verdaccio-stats": "file:",
51
51
  "vitest": "^3.0.8"
@@ -59,7 +59,7 @@
59
59
  "dependencies": {
60
60
  "@adminjs/express": "^6.1.1",
61
61
  "@adminjs/sequelize": "^4.1.1",
62
- "@verdaccio/core": "8.0.0-next-8.10",
62
+ "@verdaccio/core": "8.0.0-next-8.12",
63
63
  "adminjs": "^7.8.15",
64
64
  "dayjs": "^1.11.13",
65
65
  "debug": "^4.4.0",