agendash 4.0.0 → 6.0.1

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 (71) hide show
  1. package/LICENSE.md +25 -0
  2. package/README.md +109 -200
  3. package/dist/AgendashController.d.ts +50 -0
  4. package/dist/AgendashController.js +176 -0
  5. package/dist/AgendashController.js.map +1 -0
  6. package/dist/csp.d.ts +1 -0
  7. package/dist/csp.js +15 -0
  8. package/dist/csp.js.map +1 -0
  9. package/dist/index.d.ts +12 -0
  10. package/dist/index.js +16 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/middlewares/express.d.ts +22 -0
  13. package/dist/middlewares/express.js +119 -0
  14. package/dist/middlewares/express.js.map +1 -0
  15. package/dist/middlewares/fastify.d.ts +18 -0
  16. package/dist/middlewares/fastify.js +129 -0
  17. package/dist/middlewares/fastify.js.map +1 -0
  18. package/dist/middlewares/hapi.d.ts +28 -0
  19. package/dist/middlewares/hapi.js +198 -0
  20. package/dist/middlewares/hapi.js.map +1 -0
  21. package/dist/middlewares/koa.d.ts +25 -0
  22. package/dist/middlewares/koa.js +139 -0
  23. package/dist/middlewares/koa.js.map +1 -0
  24. package/dist/types.d.ts +154 -0
  25. package/dist/types.js +2 -0
  26. package/dist/types.js.map +1 -0
  27. package/package.json +77 -62
  28. package/public/assets/index-CIdOb8D1.css +5 -0
  29. package/public/assets/index-Ct6Ovrls.js +17 -0
  30. package/public/index.html +10 -52
  31. package/Dockerfile +0 -23
  32. package/History.md +0 -118
  33. package/LICENSE +0 -21
  34. package/all-jobs.png +0 -0
  35. package/app.js +0 -23
  36. package/bin/agendash-standalone-fastify.js +0 -61
  37. package/bin/agendash-standalone-hapi.js +0 -60
  38. package/bin/agendash-standalone-koa.js +0 -56
  39. package/bin/agendash-standalone.js +0 -64
  40. package/create-job.png +0 -0
  41. package/entrypoint.sh +0 -5
  42. package/lib/controllers/agendash.js +0 -341
  43. package/lib/csp.js +0 -28
  44. package/lib/middlewares/README.md +0 -59
  45. package/lib/middlewares/express.js +0 -80
  46. package/lib/middlewares/fastify.js +0 -77
  47. package/lib/middlewares/hapi.js +0 -101
  48. package/lib/middlewares/koa.js +0 -77
  49. package/mobile-ui-sm.png +0 -0
  50. package/mobile-ui-xs.png +0 -0
  51. package/public/android-chrome-192x192.png +0 -0
  52. package/public/android-chrome-512x512.png +0 -0
  53. package/public/app/assets/ArgensdashV2Logo.svg +0 -18
  54. package/public/app/css/styles.css +0 -233
  55. package/public/app/js/confirmDelete.js +0 -40
  56. package/public/app/js/confirmDeleteMulti.js +0 -45
  57. package/public/app/js/confirmRequeue.js +0 -40
  58. package/public/app/js/confirmRequeueMulti.js +0 -45
  59. package/public/app/js/confirms.js +0 -8
  60. package/public/app/js/jobdetail.js +0 -48
  61. package/public/app/js/joblist.js +0 -248
  62. package/public/app/js/main.js +0 -283
  63. package/public/app/js/newJob.js +0 -89
  64. package/public/app/js/sidebar.js +0 -121
  65. package/public/app/js/topbar.js +0 -95
  66. package/public/apple-touch-icon.png +0 -0
  67. package/public/favicon-16x16.png +0 -0
  68. package/public/favicon-32x32.png +0 -0
  69. package/public/favicon.ico +0 -0
  70. package/public/site.webmanifest +0 -1
  71. package/search.png +0 -0
@@ -0,0 +1,139 @@
1
+ import { join, dirname } from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ import { AgendashController } from '../AgendashController.js';
4
+ import { cspHeader } from '../csp.js';
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ /**
7
+ * Create Koa middleware array for Agendash (sync version)
8
+ * Note: This returns only the CSP middleware. Use createKoaMiddlewareAsync for full setup.
9
+ *
10
+ * @deprecated Use createKoaMiddlewareAsync instead for complete middleware setup
11
+ * @example
12
+ * ```typescript
13
+ * import Koa from 'koa';
14
+ * import { Agenda } from 'agenda';
15
+ * import { createKoaMiddlewareAsync } from 'agendash';
16
+ *
17
+ * const app = new Koa();
18
+ * const agenda = new Agenda({ db: { address: 'mongodb://localhost/agenda' } });
19
+ *
20
+ * const middlewares = await createKoaMiddlewareAsync(agenda);
21
+ * middlewares.forEach(mw => app.use(mw));
22
+ * ```
23
+ */
24
+ export function createKoaMiddleware(_agenda) {
25
+ const middlewares = [];
26
+ // CSP header middleware
27
+ middlewares.push(async (ctx, next) => {
28
+ await next();
29
+ ctx.set('Content-Security-Policy', cspHeader);
30
+ });
31
+ // Return initial middleware; use createKoaMiddlewareAsync for full setup
32
+ return middlewares;
33
+ }
34
+ /**
35
+ * Async version that fully sets up all middlewares
36
+ */
37
+ export async function createKoaMiddlewareAsync(agenda) {
38
+ const controller = new AgendashController(agenda);
39
+ const middlewares = [];
40
+ // CSP header middleware
41
+ middlewares.push(async (ctx, next) => {
42
+ await next();
43
+ ctx.set('Content-Security-Policy', cspHeader);
44
+ });
45
+ const [{ default: koaStatic }, { default: bodyParser }, { default: Router }] = await Promise.all([
46
+ import('koa-static'),
47
+ import('koa-bodyparser'),
48
+ import('koa-router')
49
+ ]);
50
+ // Static files (deferred to run after routes)
51
+ middlewares.push(koaStatic(join(__dirname, '../../public'), { defer: true }));
52
+ // Body parser
53
+ middlewares.push(bodyParser());
54
+ // API routes
55
+ const router = new Router();
56
+ router.get('/api', async (ctx) => {
57
+ const query = ctx.query;
58
+ try {
59
+ const params = {
60
+ name: query.job,
61
+ state: query.state,
62
+ search: query.q,
63
+ property: query.property,
64
+ isObjectId: query.isObjectId,
65
+ skip: query.skip ? parseInt(query.skip, 10) : 0,
66
+ limit: query.limit ? parseInt(query.limit, 10) : 50
67
+ };
68
+ ctx.body = await controller.getJobs(params);
69
+ }
70
+ catch (error) {
71
+ ctx.status = 400;
72
+ ctx.body = { error: error instanceof Error ? error.message : 'Unknown error' };
73
+ }
74
+ });
75
+ router.post('/api/jobs/requeue', async (ctx) => {
76
+ try {
77
+ const { jobIds } = ctx.request.body;
78
+ ctx.body = await controller.requeueJobs(jobIds);
79
+ }
80
+ catch (error) {
81
+ ctx.status = 404;
82
+ ctx.body = { error: error instanceof Error ? error.message : 'Unknown error' };
83
+ }
84
+ });
85
+ router.post('/api/jobs/delete', async (ctx) => {
86
+ try {
87
+ const { jobIds } = ctx.request.body;
88
+ ctx.body = await controller.deleteJobs(jobIds);
89
+ }
90
+ catch (error) {
91
+ ctx.status = 404;
92
+ ctx.body = { error: error instanceof Error ? error.message : 'Unknown error' };
93
+ }
94
+ });
95
+ router.post('/api/jobs/create', async (ctx) => {
96
+ try {
97
+ const options = ctx.request.body;
98
+ ctx.body = await controller.createJob(options);
99
+ }
100
+ catch (error) {
101
+ ctx.status = 400;
102
+ ctx.body = { error: error instanceof Error ? error.message : 'Unknown error' };
103
+ }
104
+ });
105
+ router.post('/api/jobs/pause', async (ctx) => {
106
+ try {
107
+ const { jobIds } = ctx.request.body;
108
+ ctx.body = await controller.pauseJobs(jobIds);
109
+ }
110
+ catch (error) {
111
+ ctx.status = 400;
112
+ ctx.body = { error: error instanceof Error ? error.message : 'Unknown error' };
113
+ }
114
+ });
115
+ router.post('/api/jobs/resume', async (ctx) => {
116
+ try {
117
+ const { jobIds } = ctx.request.body;
118
+ ctx.body = await controller.resumeJobs(jobIds);
119
+ }
120
+ catch (error) {
121
+ ctx.status = 400;
122
+ ctx.body = { error: error instanceof Error ? error.message : 'Unknown error' };
123
+ }
124
+ });
125
+ router.get('/api/stats', async (ctx) => {
126
+ try {
127
+ const fullDetails = ctx.query.fullDetails === 'true';
128
+ ctx.body = await controller.getStats(fullDetails);
129
+ }
130
+ catch (error) {
131
+ ctx.status = 500;
132
+ ctx.body = { error: error instanceof Error ? error.message : 'Unknown error' };
133
+ }
134
+ });
135
+ middlewares.push(router.routes());
136
+ middlewares.push(router.allowedMethods());
137
+ return middlewares;
138
+ }
139
+ //# sourceMappingURL=koa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"koa.js","sourceRoot":"","sources":["../../src/middlewares/koa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO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AAe,EAAE,CAAC;QAChF,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACtC,IAAI,CAAC;YACJ,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,KAAK,MAAM,CAAC;YACrD,GAAG,CAAC,IAAI,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;YACjB,GAAG,CAAC,IAAI,GAAG,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;QAChF,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAgB,CAAC,CAAC;IAChD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAgB,CAAC,CAAC;IAExD,OAAO,WAAW,CAAC;AACpB,CAAC"}
@@ -0,0 +1,154 @@
1
+ import type { Agenda } from 'agenda';
2
+ /**
3
+ * Query parameters for the API
4
+ */
5
+ export interface ApiQueryParams {
6
+ /** Filter by job name */
7
+ name?: string;
8
+ /** Filter by computed state */
9
+ state?: string;
10
+ /** Text to search in job name */
11
+ search?: string;
12
+ /** Property to search in (deprecated, kept for compatibility) */
13
+ property?: string;
14
+ /** Whether search is for ObjectId (deprecated) */
15
+ isObjectId?: string;
16
+ /** Number of jobs to skip (pagination) */
17
+ skip?: number;
18
+ /** Maximum number of jobs to return */
19
+ limit?: number;
20
+ }
21
+ /**
22
+ * Frontend job data structure (nested under 'job' key)
23
+ */
24
+ export interface FrontendJobData {
25
+ _id: string;
26
+ name: string;
27
+ data?: unknown;
28
+ priority?: number;
29
+ nextRunAt?: Date | null;
30
+ lastRunAt?: Date | null;
31
+ lastFinishedAt?: Date | null;
32
+ lockedAt?: Date | null;
33
+ failedAt?: Date | null;
34
+ failCount?: number;
35
+ failReason?: string;
36
+ repeatInterval?: string | number;
37
+ repeatTimezone?: string;
38
+ disabled?: boolean;
39
+ }
40
+ /**
41
+ * Frontend job structure with state flags
42
+ */
43
+ export interface FrontendJob {
44
+ job: FrontendJobData;
45
+ running: boolean;
46
+ scheduled: boolean;
47
+ queued: boolean;
48
+ completed: boolean;
49
+ failed: boolean;
50
+ repeating: boolean;
51
+ paused: boolean;
52
+ }
53
+ /**
54
+ * Frontend overview structure with displayName
55
+ */
56
+ export interface FrontendOverview {
57
+ displayName: string;
58
+ total: number;
59
+ running: number;
60
+ scheduled: number;
61
+ queued: number;
62
+ completed: number;
63
+ failed: number;
64
+ repeating: number;
65
+ paused: number;
66
+ }
67
+ /**
68
+ * Response from the API
69
+ */
70
+ export interface ApiResponse {
71
+ overview: FrontendOverview[];
72
+ jobs: FrontendJob[];
73
+ total: number;
74
+ totalPages: number;
75
+ }
76
+ /**
77
+ * Options for requeuing jobs
78
+ */
79
+ export interface RequeueRequest {
80
+ jobIds: string[];
81
+ }
82
+ /**
83
+ * Response from requeue operation
84
+ */
85
+ export interface RequeueResponse {
86
+ requeuedCount: number;
87
+ }
88
+ /**
89
+ * Options for deleting jobs
90
+ */
91
+ export interface DeleteRequest {
92
+ jobIds: string[];
93
+ }
94
+ /**
95
+ * Response from delete operation
96
+ */
97
+ export interface DeleteResponse {
98
+ deleted: boolean;
99
+ deletedCount?: number;
100
+ }
101
+ /**
102
+ * Options for creating a job
103
+ */
104
+ export interface CreateJobRequest {
105
+ jobName: string;
106
+ jobSchedule?: string;
107
+ jobRepeatEvery?: string;
108
+ jobData?: unknown;
109
+ }
110
+ /**
111
+ * Response from create operation
112
+ */
113
+ export interface CreateJobResponse {
114
+ created: boolean;
115
+ }
116
+ /**
117
+ * Options for pausing jobs
118
+ */
119
+ export interface PauseRequest {
120
+ jobIds: string[];
121
+ }
122
+ /**
123
+ * Response from pause operation
124
+ */
125
+ export interface PauseResponse {
126
+ pausedCount: number;
127
+ }
128
+ /**
129
+ * Options for resuming jobs
130
+ */
131
+ export interface ResumeRequest {
132
+ jobIds: string[];
133
+ }
134
+ /**
135
+ * Response from resume operation
136
+ */
137
+ export interface ResumeResponse {
138
+ resumedCount: number;
139
+ }
140
+ /**
141
+ * Agendash controller interface
142
+ */
143
+ export interface AgendashController {
144
+ getJobs(params: ApiQueryParams): Promise<ApiResponse>;
145
+ requeueJobs(ids: string[]): Promise<RequeueResponse>;
146
+ deleteJobs(ids: string[]): Promise<DeleteResponse>;
147
+ createJob(options: CreateJobRequest): Promise<CreateJobResponse>;
148
+ pauseJobs(ids: string[]): Promise<PauseResponse>;
149
+ resumeJobs(ids: string[]): Promise<ResumeResponse>;
150
+ }
151
+ /**
152
+ * Factory type for creating Agendash middleware
153
+ */
154
+ export type AgendashMiddlewareFactory<T> = (agenda: Agenda) => T;
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,75 +1,90 @@
1
1
  {
2
2
  "name": "agendash",
3
- "version": "4.0.0",
4
- "description": "A modern dashboard for Agenda.js with Pagination and Search capabilities",
5
- "main": "app.js",
6
- "bin": "bin/agendash-standalone.js",
3
+ "version": "6.0.1",
4
+ "description": "Dashboard for Agenda job scheduler",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "public"
20
+ ],
7
21
  "engines": {
8
- "node": ">=14.0.0"
22
+ "node": ">=18.0.0"
9
23
  },
10
- "scripts": {
11
- "test": "run-p lint ava",
12
- "lint": "eslint ./",
13
- "ava": "ava -v -c 1"
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git://github.com/agenda/agenda"
14
27
  },
15
28
  "keywords": [
16
29
  "agenda",
17
- "agendash",
18
30
  "dashboard",
19
- "job-queues"
31
+ "job",
32
+ "scheduler",
33
+ "admin"
20
34
  ],
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/agenda/agendash.git"
24
- },
25
- "bugs": {
26
- "url": "https://github.com/agenda/agendash/issues"
27
- },
28
- "homepage": "https://github.com/agenda/agendash#readme",
29
35
  "license": "MIT",
30
- "files": [
31
- "bin",
32
- "lib",
33
- "public",
34
- "app.js",
35
- "*.png",
36
- "Dockerfile",
37
- "entrypoint.sh"
38
- ],
39
- "dependencies": {
40
- "agenda": "^4.2.1",
41
- "body-parser": "^1.19.2",
42
- "commander": "^2.9.0",
43
- "express": "^4.17.3",
44
- "mongodb": "*",
45
- "semver": "^7.3.4"
36
+ "peerDependencies": {
37
+ "agenda": "6.0.0"
46
38
  },
47
- "devDependencies": {
48
- "@fastify/static": "^6.5.0",
49
- "@hapi/hapi": "^20.2.1",
50
- "@hapi/inert": "^6.0.5",
51
- "ava": "3.15.0",
52
- "eslint": "7.19.0",
53
- "fastify": "^4.9.2",
54
- "koa": "2.13.1",
55
- "koa-bodyparser": "4.3.0",
56
- "koa-router": "10.0.0",
57
- "koa-static": "5.0.0",
58
- "npm-run-all": "4.1.5",
59
- "prettier": "2.2.1",
60
- "supertest": "^6.2.2"
39
+ "optionalDependencies": {
40
+ "express": "^4.18.0 || ^5.0.0",
41
+ "koa": "^2.14.0",
42
+ "koa-router": "^12.0.0 || ^13.0.0",
43
+ "koa-static": "^5.0.0",
44
+ "koa-bodyparser": "^4.4.0",
45
+ "fastify": "^4.0.0 || ^5.0.0",
46
+ "@fastify/static": "^6.0.0 || ^7.0.0 || ^8.0.0",
47
+ "@hapi/hapi": "^21.0.0",
48
+ "@hapi/inert": "^7.0.0"
61
49
  },
62
- "eslintConfig": {
63
- "parserOptions": {
64
- "ecmaVersion": 2019
65
- },
66
- "env": {
67
- "es6": true,
68
- "node": true
69
- },
70
- "extends": "eslint:recommended"
50
+ "devDependencies": {
51
+ "@types/express": "^4.17.21",
52
+ "@types/koa": "^2.15.0",
53
+ "@types/koa-bodyparser": "^4.3.12",
54
+ "@types/koa-router": "^7.4.8",
55
+ "@types/koa-static": "^4.0.4",
56
+ "@types/node": "^22.0.0",
57
+ "@types/supertest": "^6.0.2",
58
+ "@vitejs/plugin-vue": "^5.2.0",
59
+ "bootstrap": "^5.3.0",
60
+ "date-fns": "^4.1.0",
61
+ "express": "^4.21.2",
62
+ "fastify": "^5.0.0",
63
+ "@fastify/static": "^8.0.0",
64
+ "@hapi/hapi": "^21.0.0",
65
+ "@hapi/inert": "^7.0.0",
66
+ "koa": "^2.15.0",
67
+ "koa-bodyparser": "^4.4.0",
68
+ "koa-router": "^13.0.0",
69
+ "koa-static": "^5.0.0",
70
+ "mongodb": "^6.12.0",
71
+ "mongodb-memory-server": "^10.0.0",
72
+ "supertest": "^7.0.0",
73
+ "tsx": "^4.19.0",
74
+ "typescript": "^5.7.0",
75
+ "vite": "^6.0.0",
76
+ "vitest": "^3.1.0",
77
+ "vue": "^3.5.0",
78
+ "vue-tsc": "^2.2.0",
79
+ "agenda": "6.0.0",
80
+ "@agendajs/mongo-backend": "1.0.0"
71
81
  },
72
- "eslintIgnore": [
73
- "public"
74
- ]
75
- }
82
+ "scripts": {
83
+ "build": "tsc -b && vite build --config client/vite.config.ts",
84
+ "build:client": "vite build --config client/vite.config.ts",
85
+ "dev": "tsx dev-server.ts",
86
+ "dev:client": "vite --config client/vite.config.ts",
87
+ "test": "vitest run",
88
+ "test:watch": "vitest"
89
+ }
90
+ }