@ezpaarse-project/ezreeport-sdk-js 1.0.0-beta.6 → 1.0.0-beta.8
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/dist/browser/ezreeport-sdk-js.mjs +502 -456
- package/dist/browser/ezreeport-sdk-js.mjs.map +1 -1
- package/dist/browser/ezreeport-sdk-js.umd.js +3 -3
- package/dist/browser/ezreeport-sdk-js.umd.js.map +1 -1
- package/dist/node/package.json +10 -6
- package/dist/node/src/index.js +3 -2
- package/dist/node/src/index.js.map +1 -1
- package/dist/node/src/lib/axios.js +5 -1
- package/dist/node/src/lib/axios.js.map +1 -1
- package/dist/node/src/lib/utils.js.map +1 -1
- package/dist/node/src/modules/crons.js +23 -4
- package/dist/node/src/modules/crons.js.map +1 -1
- package/dist/node/src/modules/crons.public.js +2 -1
- package/dist/node/src/modules/crons.public.js.map +1 -1
- package/dist/node/src/modules/queues.js +33 -1
- package/dist/node/src/modules/queues.js.map +1 -1
- package/dist/node/src/modules/queues.public.js +3 -1
- package/dist/node/src/modules/queues.public.js.map +1 -1
- package/dist/node/src/modules/reports.js +4 -4
- package/dist/node/src/modules/reports.js.map +1 -1
- package/dist/node/src/modules/tasks.js +55 -12
- package/dist/node/src/modules/tasks.js.map +1 -1
- package/dist/node/src/modules/tasks.public.js +4 -1
- package/dist/node/src/modules/tasks.public.js.map +1 -1
- package/dist/node/src/modules/templates.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/lib/axios.d.ts +1 -1
- package/dist/types/src/lib/utils.d.ts +0 -5
- package/dist/types/src/modules/crons.d.ts +24 -0
- package/dist/types/src/modules/crons.public.d.ts +1 -1
- package/dist/types/src/modules/queues.d.ts +29 -0
- package/dist/types/src/modules/queues.public.d.ts +1 -1
- package/dist/types/src/modules/reports.d.ts +3 -3
- package/dist/types/src/modules/tasks.d.ts +60 -6
- package/dist/types/src/modules/tasks.public.d.ts +1 -1
- package/dist/types/src/modules/templates.d.ts +27 -6
- package/package.json +7 -7
|
@@ -9,6 +9,8 @@ export interface Cron extends Omit<RawCron, 'nextRun' | 'lastRun'> {
|
|
|
9
9
|
nextRun?: Date;
|
|
10
10
|
lastRun?: Date;
|
|
11
11
|
}
|
|
12
|
+
export interface InputCron extends Pick<Cron, 'running'> {
|
|
13
|
+
}
|
|
12
14
|
/**
|
|
13
15
|
* Get all available crons
|
|
14
16
|
*
|
|
@@ -34,6 +36,8 @@ export declare const getCron: (cronOrName: Cron | Cron['name']) => Promise<ApiRe
|
|
|
34
36
|
*
|
|
35
37
|
* @param cronOrName Cron or Cron name
|
|
36
38
|
*
|
|
39
|
+
* @deprecated Use `updateCron` with body `{ running: true }`
|
|
40
|
+
*
|
|
37
41
|
* @returns Cron's info
|
|
38
42
|
*/
|
|
39
43
|
export declare const startCron: (cronOrName: Cron | Cron['name']) => Promise<{
|
|
@@ -50,6 +54,8 @@ export declare const startCron: (cronOrName: Cron | Cron['name']) => Promise<{
|
|
|
50
54
|
*
|
|
51
55
|
* @param cronOrName Cron or Cron name
|
|
52
56
|
*
|
|
57
|
+
* @deprecated Use `updateCron` with body `{ running: false }`
|
|
58
|
+
*
|
|
53
59
|
* @returns Cron's info
|
|
54
60
|
*/
|
|
55
61
|
export declare const stopCron: (cronOrName: Cron | Cron['name']) => Promise<{
|
|
@@ -59,6 +65,24 @@ export declare const stopCron: (cronOrName: Cron | Cron['name']) => Promise<{
|
|
|
59
65
|
message: string;
|
|
60
66
|
};
|
|
61
67
|
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Update cron
|
|
70
|
+
*
|
|
71
|
+
* Needs `general.crons-patch-cron` permission
|
|
72
|
+
*
|
|
73
|
+
* @param cronOrName Cron or Cron name
|
|
74
|
+
*
|
|
75
|
+
* @returns Cron's info
|
|
76
|
+
*/
|
|
77
|
+
export declare const updateCron: (cron: Partial<InputCron> & {
|
|
78
|
+
name: Cron['name'];
|
|
79
|
+
}) => Promise<{
|
|
80
|
+
content: Cron;
|
|
81
|
+
status: {
|
|
82
|
+
code: number;
|
|
83
|
+
message: string;
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
62
86
|
/**
|
|
63
87
|
* Force cron to run
|
|
64
88
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type Cron, getAllCrons, getCron, startCron, stopCron, forceCron, } from './crons';
|
|
1
|
+
export { type Cron, type InputCron, getAllCrons, getCron, startCron, stopCron, updateCron, forceCron, } from './crons';
|
|
@@ -25,6 +25,9 @@ export interface Queue {
|
|
|
25
25
|
status: 'paused' | 'active';
|
|
26
26
|
name: string;
|
|
27
27
|
}
|
|
28
|
+
export interface InputQueue {
|
|
29
|
+
status: Queue['status'];
|
|
30
|
+
}
|
|
28
31
|
/**
|
|
29
32
|
* Get all available queues
|
|
30
33
|
*
|
|
@@ -33,6 +36,28 @@ export interface Queue {
|
|
|
33
36
|
* @returns All queues' names
|
|
34
37
|
*/
|
|
35
38
|
export declare const getAllQueues: () => Promise<ApiResponse<Queue[]>>;
|
|
39
|
+
/**
|
|
40
|
+
* Get specific queue
|
|
41
|
+
*
|
|
42
|
+
* Needs `general.queues-get-queue` permission
|
|
43
|
+
*
|
|
44
|
+
* @param queueOrName Queue or queue's name
|
|
45
|
+
*
|
|
46
|
+
* @returns queue info
|
|
47
|
+
*/
|
|
48
|
+
export declare const getQueue: (queueOrName: Queue | Queue['name']) => Promise<ApiResponse<Queue>>;
|
|
49
|
+
/**
|
|
50
|
+
* Update specific queue
|
|
51
|
+
*
|
|
52
|
+
* Needs `general.queues-patch-queue` permission
|
|
53
|
+
*
|
|
54
|
+
* @param queueOrName Queue or queue's name
|
|
55
|
+
*
|
|
56
|
+
* @returns queue info
|
|
57
|
+
*/
|
|
58
|
+
export declare const updateQueue: (queue: Partial<InputQueue> & {
|
|
59
|
+
name: Queue['name'];
|
|
60
|
+
}) => Promise<ApiResponse<Queue>>;
|
|
36
61
|
/**
|
|
37
62
|
* Pause queue
|
|
38
63
|
*
|
|
@@ -40,6 +65,8 @@ export declare const getAllQueues: () => Promise<ApiResponse<Queue[]>>;
|
|
|
40
65
|
*
|
|
41
66
|
* @param queueOrName Queue or queue's name
|
|
42
67
|
*
|
|
68
|
+
* @deprecated Use `updateQueue` instead
|
|
69
|
+
*
|
|
43
70
|
* @returns queue info
|
|
44
71
|
*/
|
|
45
72
|
export declare const pauseQueue: (queueOrName: Queue | Queue['name']) => Promise<ApiResponse<Queue>>;
|
|
@@ -50,6 +77,8 @@ export declare const pauseQueue: (queueOrName: Queue | Queue['name']) => Promise
|
|
|
50
77
|
*
|
|
51
78
|
* @param queueOrName Queue or queue's name
|
|
52
79
|
*
|
|
80
|
+
* @deprecated Use `updateQueue` instead
|
|
81
|
+
*
|
|
53
82
|
* @returns queue info
|
|
54
83
|
*/
|
|
55
84
|
export declare const resumeQueue: (queueOrName: Queue | Queue['name']) => Promise<ApiResponse<Queue>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type Job, type FullJob, type Queue, getAllQueues, pauseQueue, resumeQueue, getQueueJobs, getJob, retryJob, } from './queues';
|
|
1
|
+
export { type Job, type FullJob, type Queue, type InputQueue, getAllQueues, getQueue, updateQueue, pauseQueue, resumeQueue, getQueueJobs, getJob, retryJob, } from './queues';
|
|
@@ -53,9 +53,9 @@ type FullReportJob = FullJob<RawReportData, RawReportResult>;
|
|
|
53
53
|
/**
|
|
54
54
|
* Start generation of a report
|
|
55
55
|
*
|
|
56
|
-
* Needs `namespaces[namespaceId].tasks-post-task-
|
|
56
|
+
* Needs `namespaces[namespaceId].tasks-post-task-_run` permission
|
|
57
57
|
*
|
|
58
|
-
* @param taskOrId
|
|
58
|
+
* @param taskOrId Task or id of the task
|
|
59
59
|
* @param params Other params for overriding default
|
|
60
60
|
* @param namespaces
|
|
61
61
|
*
|
|
@@ -90,7 +90,7 @@ type GenerationEvents = {
|
|
|
90
90
|
* Needs `namespaces[namespaceId].tasks-post-task-run`
|
|
91
91
|
* & `namespaces[namespaceId].queues-get-queue-jobs-jobId` permissions
|
|
92
92
|
*
|
|
93
|
-
* @param
|
|
93
|
+
* @param taskOrId Task or id of the task
|
|
94
94
|
* @param params Other params for overriding default
|
|
95
95
|
* @param namespaces
|
|
96
96
|
*
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { type ApiResponse, type PaginatedApiResponse } from '../lib/axios';
|
|
2
|
-
import type { JsonObject } from '../lib/utils';
|
|
3
2
|
import { type Activity, type RawActivity } from './tasksActivity';
|
|
4
3
|
import type { Namespace } from './namespaces';
|
|
5
4
|
import { type Layout, type RawTemplate, type Template } from './templates';
|
|
6
5
|
import { type Task, type RawTaskWithNamespace, type TaskWithNamespace } from './tasks.base';
|
|
7
6
|
interface AdditionalRawTaskData {
|
|
8
7
|
template: {
|
|
9
|
-
fetchOptions?:
|
|
8
|
+
fetchOptions?: {
|
|
9
|
+
filters?: Record<string, any>;
|
|
10
|
+
dateField?: string;
|
|
11
|
+
index: string;
|
|
12
|
+
};
|
|
10
13
|
inserts?: (Layout & {
|
|
11
14
|
at: number;
|
|
12
15
|
})[];
|
|
@@ -55,6 +58,57 @@ export declare const getAllTasks: (paginationOpts?: {
|
|
|
55
58
|
previous?: Task['id'];
|
|
56
59
|
count?: number;
|
|
57
60
|
}, namespaces?: Namespace['id'][]) => Promise<PaginatedApiResponse<TaskList>>;
|
|
61
|
+
/**
|
|
62
|
+
* Get targets of available tasks
|
|
63
|
+
*
|
|
64
|
+
* Needs `namespaces[namespaceId].tasks-get-_targets` permission
|
|
65
|
+
*
|
|
66
|
+
* @param namespaces
|
|
67
|
+
*
|
|
68
|
+
* @returns Targets' email
|
|
69
|
+
*/
|
|
70
|
+
export declare const getAllTargets: (namespaces?: Namespace['id'][]) => Promise<ApiResponse<string[]>>;
|
|
71
|
+
/**
|
|
72
|
+
* Get available tasks of specific target
|
|
73
|
+
*
|
|
74
|
+
* Needs `namespaces[namespaceId].tasks-get-_targets-email-tasks` permission
|
|
75
|
+
*
|
|
76
|
+
* @param email The email of the target
|
|
77
|
+
* @param namespaces
|
|
78
|
+
*
|
|
79
|
+
* @returns Tasks where given email is a target
|
|
80
|
+
*/
|
|
81
|
+
export declare const getTasksOfTarget: (email: string, namespaces?: Namespace['id'][]) => Promise<{
|
|
82
|
+
content: {
|
|
83
|
+
nextRun: Date;
|
|
84
|
+
lastRun?: Date | undefined;
|
|
85
|
+
createdAt: Date;
|
|
86
|
+
updatedAt?: Date | undefined;
|
|
87
|
+
name: string;
|
|
88
|
+
id: string;
|
|
89
|
+
namespaceId: string;
|
|
90
|
+
recurrence: import("./tasks.base").Recurrence;
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
tags: {
|
|
93
|
+
name: string;
|
|
94
|
+
color?: string | undefined;
|
|
95
|
+
}[];
|
|
96
|
+
}[];
|
|
97
|
+
status: {
|
|
98
|
+
code: number;
|
|
99
|
+
message: string;
|
|
100
|
+
};
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Unsubscribe a target from a task
|
|
104
|
+
*
|
|
105
|
+
* Needs `namespaces[namespaceId].tasks-get-_targets-email-tasks` permission
|
|
106
|
+
*
|
|
107
|
+
* @param email The email of the target
|
|
108
|
+
* @param taskOrId Task or Task's id
|
|
109
|
+
* @param namespaces
|
|
110
|
+
*/
|
|
111
|
+
export declare const unsubTargetOfTask: (email: string, taskOrId: Task | Task['id'], namespaces?: Namespace['id'][]) => Promise<void>;
|
|
58
112
|
/**
|
|
59
113
|
* Create a new task
|
|
60
114
|
*
|
|
@@ -117,7 +171,7 @@ export declare const deleteTask: (taskOrId: Task | Task['id'], namespaces?: Name
|
|
|
117
171
|
/**
|
|
118
172
|
* Shorthand to enable task
|
|
119
173
|
*
|
|
120
|
-
* Needs `namespaces[namespaceId].tasks-put-
|
|
174
|
+
* Needs `namespaces[namespaceId].tasks-put-_task-enable` permission
|
|
121
175
|
*
|
|
122
176
|
* @param taskOrId Task or Task's id
|
|
123
177
|
* @param namespaces
|
|
@@ -128,7 +182,7 @@ export declare const enableTask: (taskOrId: Task | Task['id'], namespaces?: Name
|
|
|
128
182
|
/**
|
|
129
183
|
* Shorthand to disable task
|
|
130
184
|
*
|
|
131
|
-
* Needs `namespaces[namespaceId].tasks-put-
|
|
185
|
+
* Needs `namespaces[namespaceId].tasks-put-_task-disable` permission
|
|
132
186
|
*
|
|
133
187
|
* @param taskOrId Task or Task's id
|
|
134
188
|
* @param namespaces
|
|
@@ -139,7 +193,7 @@ export declare const disableTask: (taskOrId: Task | Task['id'], namespaces?: Nam
|
|
|
139
193
|
/**
|
|
140
194
|
* Link a task to a template
|
|
141
195
|
*
|
|
142
|
-
* Needs `namespaces[namespaceId].tasks-put-task-
|
|
196
|
+
* Needs `namespaces[namespaceId].tasks-put-task-_link-template` permission
|
|
143
197
|
*
|
|
144
198
|
* @param taskOrId Task or Task's id
|
|
145
199
|
* @param templateOrId Template or Template's id
|
|
@@ -157,7 +211,7 @@ export declare const linkTaskToTemplate: (taskOrId: Task | Task['id'], templateO
|
|
|
157
211
|
/**
|
|
158
212
|
* Unlink a task to a template
|
|
159
213
|
*
|
|
160
|
-
* Needs `namespaces[namespaceId].tasks-delete-task-
|
|
214
|
+
* Needs `namespaces[namespaceId].tasks-delete-task-_link-template` permission
|
|
161
215
|
*
|
|
162
216
|
* @param taskOrId Task or Task's id
|
|
163
217
|
* @param templateOrId Template or Template's id
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { type FullTask, type InputTask, type TaskList, getAllTasks, getTask, createTask, updateTask, upsertTask, deleteTask, enableTask, disableTask, linkTaskToTemplate, unlinkTaskToTemplate, } from './tasks';
|
|
1
|
+
export { type FullTask, type InputTask, type TaskList, getAllTasks, getAllTargets, getTasksOfTarget, unsubTargetOfTask, getTask, createTask, updateTask, upsertTask, deleteTask, enableTask, disableTask, linkTaskToTemplate, unlinkTaskToTemplate, } from './tasks';
|
|
2
2
|
export { Recurrence, type Task, type TaskWithNamespace, } from './tasks.base';
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
import { type ApiResponse } from '../lib/axios';
|
|
2
|
-
import type { JsonObject } from '../lib/utils';
|
|
3
2
|
import { type RawTask, type Task } from './tasks.base';
|
|
3
|
+
interface FigureFetchOptions {
|
|
4
|
+
fetchCount?: string;
|
|
5
|
+
filters?: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
interface FigureFetchOptionsAggs extends FigureFetchOptions {
|
|
8
|
+
aggs?: Record<string, any>[];
|
|
9
|
+
}
|
|
10
|
+
interface FigureFetchOptionsBuckets extends FigureFetchOptions {
|
|
11
|
+
buckets?: Record<string, any>[];
|
|
12
|
+
metric?: Record<string, any>;
|
|
13
|
+
}
|
|
4
14
|
export interface Figure {
|
|
5
15
|
type: string;
|
|
6
16
|
data?: string | unknown[];
|
|
7
|
-
params:
|
|
17
|
+
params: Record<string, any>;
|
|
18
|
+
fetchOptions?: FigureFetchOptionsAggs | FigureFetchOptionsBuckets;
|
|
8
19
|
slots?: number[];
|
|
9
20
|
}
|
|
10
21
|
export interface Layout {
|
|
11
22
|
data?: unknown;
|
|
12
23
|
fetcher?: string;
|
|
13
|
-
fetchOptions?:
|
|
24
|
+
fetchOptions?: {
|
|
25
|
+
fetchCount?: string;
|
|
26
|
+
filters?: Record<string, any>;
|
|
27
|
+
};
|
|
14
28
|
figures: Figure[];
|
|
15
29
|
}
|
|
16
30
|
export interface RawTemplate {
|
|
17
31
|
id: string;
|
|
18
32
|
name: string;
|
|
19
|
-
renderer: string;
|
|
20
33
|
pageCount: number;
|
|
21
34
|
tags: {
|
|
22
35
|
name: string;
|
|
@@ -40,8 +53,16 @@ export declare const parseTemplate: (template: RawTemplate) => Template;
|
|
|
40
53
|
export interface RawFullTemplate extends RawTemplate {
|
|
41
54
|
body: {
|
|
42
55
|
renderer?: string;
|
|
43
|
-
renderOptions?:
|
|
44
|
-
|
|
56
|
+
renderOptions?: {
|
|
57
|
+
grid?: {
|
|
58
|
+
cols: number;
|
|
59
|
+
rows: number;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
fetchOptions?: {
|
|
63
|
+
filters?: Record<string, any>;
|
|
64
|
+
dateField: string;
|
|
65
|
+
};
|
|
45
66
|
layouts: Layout[];
|
|
46
67
|
};
|
|
47
68
|
tasks: RawTask[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezpaarse-project/ezreeport-sdk-js",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.8",
|
|
4
4
|
"description": "JS SDK to communicate with ezReeport API",
|
|
5
5
|
"homepage": "https://github.com/ezpaarse-project/ezreeport#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "run-s build:web build:node build:
|
|
29
|
+
"build": "run-s build:web build:node build:docs",
|
|
30
30
|
"build:node-vite": "tsc && BUILD_TARGET=node vite build",
|
|
31
31
|
"build:node": "tsc --project tsconfig.node.json",
|
|
32
32
|
"build:web": "tsc && BUILD_TARGET=browser vite build",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"axios": "^1.
|
|
45
|
+
"axios": "^1.5.0",
|
|
46
46
|
"date-fns": "^2.30.0",
|
|
47
47
|
"events": "^3.3.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/node": "^20.
|
|
51
|
-
"typedoc": "^0.
|
|
52
|
-
"typescript": "^5.
|
|
53
|
-
"vite": "^4.4.
|
|
50
|
+
"@types/node": "^20.6.0",
|
|
51
|
+
"typedoc": "^0.25.1",
|
|
52
|
+
"typescript": "^5.2.2",
|
|
53
|
+
"vite": "^4.4.9"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": "^16 || ^18"
|