@ezpaarse-project/ezreeport-sdk-js 1.0.0-beta.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.
- package/CHANGELOG.md +42 -0
- package/README.md +774 -0
- package/dist/browser/ezreeport-sdk-js.mjs +2263 -0
- package/dist/browser/ezreeport-sdk-js.mjs.map +1 -0
- package/dist/browser/ezreeport-sdk-js.umd.js +4 -0
- package/dist/browser/ezreeport-sdk-js.umd.js.map +1 -0
- package/dist/node/package.json +56 -0
- package/dist/types/index.d.ts +24 -0
- package/dist/types/lib/axios.d.ts +51 -0
- package/dist/types/lib/promises.d.ts +18 -0
- package/dist/types/lib/utils.d.ts +22 -0
- package/dist/types/modules/auth.d.ts +90 -0
- package/dist/types/modules/auth.public.d.ts +1 -0
- package/dist/types/modules/crons.d.ts +78 -0
- package/dist/types/modules/crons.public.d.ts +1 -0
- package/dist/types/modules/health.d.ts +53 -0
- package/dist/types/modules/health.public.d.ts +1 -0
- package/dist/types/modules/history.d.ts +38 -0
- package/dist/types/modules/history.public.d.ts +1 -0
- package/dist/types/modules/institutions.d.ts +56 -0
- package/dist/types/modules/namespaces.d.ts +19 -0
- package/dist/types/modules/namespaces.public.d.ts +1 -0
- package/dist/types/modules/queues.d.ts +93 -0
- package/dist/types/modules/queues.public.d.ts +1 -0
- package/dist/types/modules/reports.d.ts +194 -0
- package/dist/types/modules/reports.public.d.ts +1 -0
- package/dist/types/modules/setup.d.ts +17 -0
- package/dist/types/modules/setup.public.d.ts +2 -0
- package/dist/types/modules/tasks.base.d.ts +48 -0
- package/dist/types/modules/tasks.d.ts +124 -0
- package/dist/types/modules/tasks.public.d.ts +2 -0
- package/dist/types/modules/templates.d.ts +120 -0
- package/dist/types/modules/templates.public.d.ts +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ezreeport-sdk-js",
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
|
+
"description": "JS SDK to communicate with ezReeport API",
|
|
5
|
+
"homepage": "https://github.com/ezpaarse-project/ezreeport#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/ezpaarse-project/ezreeport/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@github.com/ezpaarse-project/ezreeport.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "CeCILL",
|
|
14
|
+
"author": "oxypomme",
|
|
15
|
+
"exports": {
|
|
16
|
+
"browser": {
|
|
17
|
+
"import": "./dist/browser/ezreeport-sdk-js.mjs",
|
|
18
|
+
"require": "./dist/browser/ezreeport-sdk-js.umd.js"
|
|
19
|
+
},
|
|
20
|
+
"node": {
|
|
21
|
+
"default": "./dist/node/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"types": "./dist/types/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "run-s build:web build:node build:types",
|
|
30
|
+
"build:node-vite": "tsc && BUILD_TARGET=node vite build",
|
|
31
|
+
"build:node": "tsc --project tsconfig.node.json",
|
|
32
|
+
"build:types": "tsc && BUILD_TARGET=types vite build",
|
|
33
|
+
"build:web": "tsc && BUILD_TARGET=browser vite build",
|
|
34
|
+
"lint": "eslint --fix .",
|
|
35
|
+
"test": "npm run build && npm -w ezreeport-tests run test:sdk"
|
|
36
|
+
},
|
|
37
|
+
"lint-staged": {
|
|
38
|
+
"*.ts": [
|
|
39
|
+
"eslint --fix"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"axios": "^1.3.5",
|
|
44
|
+
"date-fns": "^2.29.3",
|
|
45
|
+
"events": "^3.3.0",
|
|
46
|
+
"typescript": "^5.0.4",
|
|
47
|
+
"vite": "^4.2.1",
|
|
48
|
+
"vite-plugin-dts": "^2.2.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^18.15.11"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": "^16 || ^18"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * as auth from './modules/auth.public';
|
|
2
|
+
export * as crons from './modules/crons.public';
|
|
3
|
+
export * as health from './modules/health.public';
|
|
4
|
+
export * as history from './modules/history.public';
|
|
5
|
+
export * as namespaces from './modules/namespaces.public';
|
|
6
|
+
export * as queues from './modules/queues.public';
|
|
7
|
+
export * as reports from './modules/reports.public';
|
|
8
|
+
export * as setup from './modules/setup.public';
|
|
9
|
+
export * as tasks from './modules/tasks.public';
|
|
10
|
+
export * as templates from './modules/templates.public';
|
|
11
|
+
export { version } from '../package.json';
|
|
12
|
+
export type EzReeportSDK = {
|
|
13
|
+
auth: typeof import('./modules/auth.public');
|
|
14
|
+
crons: typeof import('./modules/crons.public');
|
|
15
|
+
health: typeof import('./modules/health.public');
|
|
16
|
+
history: typeof import('./modules/history.public');
|
|
17
|
+
namespaces: typeof import('./modules/namespaces.public');
|
|
18
|
+
queues: typeof import('./modules/queues.public');
|
|
19
|
+
reports: typeof import('./modules/reports.public');
|
|
20
|
+
setup: typeof import('./modules/setup.public');
|
|
21
|
+
tasks: typeof import('./modules/tasks.public');
|
|
22
|
+
templates: typeof import('./modules/templates.public');
|
|
23
|
+
version: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Axios, AxiosResponse } from 'axios';
|
|
2
|
+
export interface ApiResponse<T> {
|
|
3
|
+
/**
|
|
4
|
+
* HTTP Status
|
|
5
|
+
*/
|
|
6
|
+
status: {
|
|
7
|
+
code: number;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Content of the response
|
|
12
|
+
*/
|
|
13
|
+
content: T;
|
|
14
|
+
}
|
|
15
|
+
export interface PaginatedApiResponse<T> extends ApiResponse<T> {
|
|
16
|
+
meta: {
|
|
17
|
+
/**
|
|
18
|
+
* Count of items in response
|
|
19
|
+
*/
|
|
20
|
+
count: number;
|
|
21
|
+
/**
|
|
22
|
+
* Count of items wanted
|
|
23
|
+
*/
|
|
24
|
+
size: number;
|
|
25
|
+
/**
|
|
26
|
+
* Count of items available
|
|
27
|
+
*/
|
|
28
|
+
total: number;
|
|
29
|
+
/**
|
|
30
|
+
* Id of last item in response
|
|
31
|
+
*/
|
|
32
|
+
lastId?: unknown;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Start axios request with basic error handling
|
|
37
|
+
*
|
|
38
|
+
* @param method The request's method
|
|
39
|
+
* @param params The other params of axios
|
|
40
|
+
*
|
|
41
|
+
* @returns Response
|
|
42
|
+
*/
|
|
43
|
+
export declare const axiosWithErrorFormatter: <T, Method extends "get" | "post" | "put" | "patch" | "delete">(method: Method, ...params: Parameters<Axios[Method]>) => Promise<AxiosResponse<T, any>>;
|
|
44
|
+
declare const _default: import("axios").AxiosInstance & {
|
|
45
|
+
$get: <T>(url: string, config?: import("axios").AxiosRequestConfig<unknown> | undefined) => Promise<ApiResponse<T>>;
|
|
46
|
+
$post: <T_1>(url: string, data?: unknown, config?: import("axios").AxiosRequestConfig<unknown> | undefined) => Promise<ApiResponse<T_1>>;
|
|
47
|
+
$put: <T_2>(url: string, data?: unknown, config?: import("axios").AxiosRequestConfig<unknown> | undefined) => Promise<ApiResponse<T_2>>;
|
|
48
|
+
$patch: <T_3>(url: string, data?: unknown, config?: import("axios").AxiosRequestConfig<unknown> | undefined) => Promise<ApiResponse<T_3>>;
|
|
49
|
+
$delete: <T_4>(url: string, config?: import("axios").AxiosRequestConfig<unknown> | undefined) => Promise<ApiResponse<T_4>>;
|
|
50
|
+
};
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import EventEmitter from 'events';
|
|
2
|
+
interface EventEmitterBase {
|
|
3
|
+
on: (...p: Parameters<EventEmitter['on']>) => this;
|
|
4
|
+
once: (...p: Parameters<EventEmitter['once']>) => this;
|
|
5
|
+
off: (...p: Parameters<EventEmitter['off']>) => this;
|
|
6
|
+
emit: (...p: Parameters<EventEmitter['emit']>) => this;
|
|
7
|
+
}
|
|
8
|
+
export type EventfulPromise<T> = Promise<T> & EventEmitterBase;
|
|
9
|
+
/**
|
|
10
|
+
* Attach a `EventEmitter` to a `Promise` returned by the `executor`
|
|
11
|
+
*
|
|
12
|
+
* @param executor Executor returning the promise. The `emitter` is passed to the executor as param.
|
|
13
|
+
* @param emitter `EventEmitter` attached. By default it's a new instance.
|
|
14
|
+
*
|
|
15
|
+
* @returns The EventfulPromise
|
|
16
|
+
*/
|
|
17
|
+
declare const createEventfulPromise: <T>(executor: (emitter: EventEmitter | EventEmitterBase) => Promise<T>, emitter?: EventEmitter) => EventfulPromise<T>;
|
|
18
|
+
export default createEventfulPromise;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async version of `setTimeout`
|
|
3
|
+
*
|
|
4
|
+
* @param ms Time to wait
|
|
5
|
+
*/
|
|
6
|
+
export declare const setTimeoutAsync: (ms: number) => Promise<unknown>;
|
|
7
|
+
export interface RawPeriod {
|
|
8
|
+
start: string;
|
|
9
|
+
end: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Period extends Omit<RawPeriod, 'start' | 'end'> {
|
|
12
|
+
start: Date;
|
|
13
|
+
end: Date;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Transform raw data from JSON, to JS usable data
|
|
17
|
+
*
|
|
18
|
+
* @param period Raw period
|
|
19
|
+
*
|
|
20
|
+
* @returns Parsed period
|
|
21
|
+
*/
|
|
22
|
+
export declare const parsePeriod: (period: RawPeriod) => Period;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ApiResponse } from '../lib/axios';
|
|
2
|
+
import { type Namespace, type RawNamespace } from './namespaces';
|
|
3
|
+
export declare enum Access {
|
|
4
|
+
READ = "READ",
|
|
5
|
+
READ_WRITE = "READ_WRITE",
|
|
6
|
+
SUPER_USER = "SUPER_USER"
|
|
7
|
+
}
|
|
8
|
+
interface RawMembership {
|
|
9
|
+
access: Access;
|
|
10
|
+
namespace: RawNamespace;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Membership extends Omit<RawMembership, 'namespace' | 'createdAt' | 'updatedAt'> {
|
|
15
|
+
namespace: Namespace;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt?: Date;
|
|
18
|
+
}
|
|
19
|
+
interface RawUser {
|
|
20
|
+
username: string;
|
|
21
|
+
token: string;
|
|
22
|
+
isAdmin: true;
|
|
23
|
+
memberships: RawMembership[];
|
|
24
|
+
createdAt: string;
|
|
25
|
+
updatedAt?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface User extends Omit<RawUser, 'memberships' | 'createdAt' | 'updatedAt'> {
|
|
28
|
+
memberships: Membership[];
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
updatedAt?: Date;
|
|
31
|
+
}
|
|
32
|
+
export type Permissions = {
|
|
33
|
+
/**
|
|
34
|
+
* General routes independent of namespaces
|
|
35
|
+
*/
|
|
36
|
+
general: {
|
|
37
|
+
[routeId: string]: boolean;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Routes who are dependent of namespaces
|
|
41
|
+
*
|
|
42
|
+
* If wanted namespace isn't present, then user doesn't have access
|
|
43
|
+
*/
|
|
44
|
+
namespaces: {
|
|
45
|
+
[namespaceId: string]: {
|
|
46
|
+
[routeId: string]: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Set auth token to axios
|
|
52
|
+
*
|
|
53
|
+
* @param token The auth token
|
|
54
|
+
*/
|
|
55
|
+
export declare const login: (token: string) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Unset auth token from axios
|
|
58
|
+
*/
|
|
59
|
+
export declare const logout: () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Check if auth token is setup in axios. **DOESN'T CHECK IF TOKEN IS VALID !**
|
|
62
|
+
*
|
|
63
|
+
* @returns If auth token is setup
|
|
64
|
+
*/
|
|
65
|
+
export declare const isLogged: () => boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Get logged user info
|
|
68
|
+
*
|
|
69
|
+
* Needs `general.auth-get` permission
|
|
70
|
+
*
|
|
71
|
+
* @returns The logged user info
|
|
72
|
+
*/
|
|
73
|
+
export declare const getCurrentUser: () => Promise<ApiResponse<User>>;
|
|
74
|
+
/**
|
|
75
|
+
* Get logged user permissions
|
|
76
|
+
*
|
|
77
|
+
* Needs `namespaces[namespaceId].auth-get-permissions` permission
|
|
78
|
+
*
|
|
79
|
+
* @returns Permissions
|
|
80
|
+
*/
|
|
81
|
+
export declare const getCurrentPermissions: () => Promise<ApiResponse<Permissions>>;
|
|
82
|
+
/**
|
|
83
|
+
* Get logged user accessible namespaces
|
|
84
|
+
*
|
|
85
|
+
* Needs `namespaces[namespaceId].auth-get-namespaces` permission
|
|
86
|
+
*
|
|
87
|
+
* @returns Permissions
|
|
88
|
+
*/
|
|
89
|
+
export declare const getCurrentNamespaces: () => Promise<ApiResponse<Namespace[]>>;
|
|
90
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Access, type Membership, type User, type Permissions, login, logout, isLogged, getCurrentUser, getCurrentNamespaces, getCurrentPermissions, } from './auth';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type ApiResponse } from '../lib/axios';
|
|
2
|
+
interface RawCron {
|
|
3
|
+
name: string;
|
|
4
|
+
running: boolean;
|
|
5
|
+
nextRun?: string;
|
|
6
|
+
lastRun?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Cron extends Omit<RawCron, 'nextRun' | 'lastRun'> {
|
|
9
|
+
nextRun?: Date;
|
|
10
|
+
lastRun?: Date;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get all available crons
|
|
14
|
+
*
|
|
15
|
+
* Needs `general.crons-get` permission
|
|
16
|
+
*
|
|
17
|
+
* @returns All crons' info
|
|
18
|
+
*/
|
|
19
|
+
export declare const getAllCrons: () => Promise<ApiResponse<Cron[]>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get cron info
|
|
22
|
+
*
|
|
23
|
+
* Needs `general.crons-get-cron` permission
|
|
24
|
+
*
|
|
25
|
+
* @param name Cron name
|
|
26
|
+
*
|
|
27
|
+
* @returns Cron's info
|
|
28
|
+
*/
|
|
29
|
+
export declare const getCron: (name: Cron['name']) => Promise<ApiResponse<Cron>>;
|
|
30
|
+
/**
|
|
31
|
+
* Start cron
|
|
32
|
+
*
|
|
33
|
+
* Needs `general.crons-put-cron-start` permission
|
|
34
|
+
*
|
|
35
|
+
* @param name Cron name
|
|
36
|
+
*
|
|
37
|
+
* @returns Cron's info
|
|
38
|
+
*/
|
|
39
|
+
export declare const startCron: (name: Cron['name']) => Promise<{
|
|
40
|
+
content: Cron;
|
|
41
|
+
status: {
|
|
42
|
+
code: number;
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Stop cron
|
|
48
|
+
*
|
|
49
|
+
* Needs `general.crons-put-cron-stop` permission
|
|
50
|
+
*
|
|
51
|
+
* @param name Cron name
|
|
52
|
+
*
|
|
53
|
+
* @returns Cron's info
|
|
54
|
+
*/
|
|
55
|
+
export declare const stopCron: (name: Cron['name']) => Promise<{
|
|
56
|
+
content: Cron;
|
|
57
|
+
status: {
|
|
58
|
+
code: number;
|
|
59
|
+
message: string;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Force cron to run
|
|
64
|
+
*
|
|
65
|
+
* Needs `general.crons-post-cron-force` permission
|
|
66
|
+
*
|
|
67
|
+
* @param name Cron name
|
|
68
|
+
*
|
|
69
|
+
* @returns Cron's info
|
|
70
|
+
*/
|
|
71
|
+
export declare const forceCron: (name: Cron['name']) => Promise<{
|
|
72
|
+
content: Cron;
|
|
73
|
+
status: {
|
|
74
|
+
code: number;
|
|
75
|
+
message: string;
|
|
76
|
+
};
|
|
77
|
+
}>;
|
|
78
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Cron, getAllCrons, getCron, startCron, stopCron, forceCron, } from './crons';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
interface PingResultSuccess {
|
|
2
|
+
name: string;
|
|
3
|
+
status: true;
|
|
4
|
+
elapsedTime: number;
|
|
5
|
+
statusCode: number;
|
|
6
|
+
}
|
|
7
|
+
interface PingResultFail {
|
|
8
|
+
name: string;
|
|
9
|
+
status: false;
|
|
10
|
+
error: string;
|
|
11
|
+
}
|
|
12
|
+
export type PingResult = PingResultSuccess | PingResultFail;
|
|
13
|
+
/**
|
|
14
|
+
* Get all services connected to current
|
|
15
|
+
*
|
|
16
|
+
* Needs `general.health-get` permission
|
|
17
|
+
*
|
|
18
|
+
* @returns The current service & the name of connected ones
|
|
19
|
+
*/
|
|
20
|
+
export declare const getAllConnectedServices: () => Promise<import("../lib/axios").ApiResponse<{
|
|
21
|
+
current: string;
|
|
22
|
+
currentVersion: string;
|
|
23
|
+
services: PingResult['name'][];
|
|
24
|
+
}>>;
|
|
25
|
+
/**
|
|
26
|
+
* Check connection for all connected service from current
|
|
27
|
+
*
|
|
28
|
+
* Needs `general.health-get-all` permission
|
|
29
|
+
*
|
|
30
|
+
* @returns The connection status for all services
|
|
31
|
+
*/
|
|
32
|
+
export declare const checkAllConnectedService: () => Promise<import("../lib/axios").ApiResponse<PingResult[]>>;
|
|
33
|
+
/**
|
|
34
|
+
* Check connection of a specific service from current
|
|
35
|
+
*
|
|
36
|
+
* Needs `general.health-get-service` permission
|
|
37
|
+
*
|
|
38
|
+
* @param service The name of the service
|
|
39
|
+
*
|
|
40
|
+
* @returns The connection status of the service from current
|
|
41
|
+
*/
|
|
42
|
+
export declare const checkConnectedService: (service: PingResult['name']) => Promise<import("../lib/axios").ApiResponse<PingResult>>;
|
|
43
|
+
/**
|
|
44
|
+
* Check connection of current service
|
|
45
|
+
*
|
|
46
|
+
* It's useful when the app will have limited connection, or if you just want the processing time.
|
|
47
|
+
*
|
|
48
|
+
* Needs `general.health-get-all` & `general.health-get-service` permission
|
|
49
|
+
*
|
|
50
|
+
* @returns The connection status of current service
|
|
51
|
+
*/
|
|
52
|
+
export declare const checkCurrentService: () => Promise<import("../lib/axios").ApiResponse<PingResult>>;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type PingResult, getAllConnectedServices, checkAllConnectedService, checkConnectedService, checkCurrentService, } from './health';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type PaginatedApiResponse } from '../lib/axios';
|
|
2
|
+
import { type TaskWithNamespace } from './tasks.base';
|
|
3
|
+
export interface RawHistory {
|
|
4
|
+
id: string;
|
|
5
|
+
taskId: string;
|
|
6
|
+
type: string;
|
|
7
|
+
message: string;
|
|
8
|
+
data?: object;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
}
|
|
11
|
+
export interface History extends Omit<RawHistory, 'createdAt'> {
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
}
|
|
14
|
+
export interface HistoryWithTask extends Omit<History, 'taskId'> {
|
|
15
|
+
task: TaskWithNamespace;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Transform raw data from JSON, to JS usable data
|
|
19
|
+
*
|
|
20
|
+
* @param entry Raw history entry
|
|
21
|
+
*
|
|
22
|
+
* @returns Parsed history entry
|
|
23
|
+
*/
|
|
24
|
+
export declare const parseHistory: (entry: RawHistory) => History;
|
|
25
|
+
/**
|
|
26
|
+
* Get all available history entries
|
|
27
|
+
*
|
|
28
|
+
* Needs `namespaces[namespaceId].history-get` permission
|
|
29
|
+
*
|
|
30
|
+
* @param paginationOpts Options for pagination
|
|
31
|
+
* @param namespaces
|
|
32
|
+
*
|
|
33
|
+
* @returns All history entries' info
|
|
34
|
+
*/
|
|
35
|
+
export declare const getAllEntries: (paginationOpts?: {
|
|
36
|
+
previous?: History['id'];
|
|
37
|
+
count?: number;
|
|
38
|
+
}, namespaces?: string[]) => Promise<PaginatedApiResponse<HistoryWithTask[]>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type History, type HistoryWithTask, getAllEntries, } from './history';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ApiResponse } from '../lib/axios';
|
|
2
|
+
interface RawInstitution {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
website?: string;
|
|
6
|
+
uai?: string;
|
|
7
|
+
auto: {
|
|
8
|
+
ezmesure: boolean;
|
|
9
|
+
ezpaarse: boolean;
|
|
10
|
+
report: boolean;
|
|
11
|
+
sushi?: boolean;
|
|
12
|
+
};
|
|
13
|
+
validated?: boolean;
|
|
14
|
+
indexCount?: number;
|
|
15
|
+
domains?: string[];
|
|
16
|
+
logoId?: string;
|
|
17
|
+
updatedAt?: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
acronym?: string;
|
|
20
|
+
city?: string;
|
|
21
|
+
type?: string;
|
|
22
|
+
linkedinUrl?: string;
|
|
23
|
+
facebookUrl?: string;
|
|
24
|
+
twitterUrl?: string;
|
|
25
|
+
creator?: string;
|
|
26
|
+
youtubeUrl?: string;
|
|
27
|
+
indexPrefix?: string;
|
|
28
|
+
role?: string;
|
|
29
|
+
space?: string;
|
|
30
|
+
docContactName?: string;
|
|
31
|
+
techContactName?: string;
|
|
32
|
+
hidePartner?: boolean;
|
|
33
|
+
sushiReadySince?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface Institution extends Omit<RawInstitution, 'updatedAt' | 'createdAt' | 'sushiReadySince'> {
|
|
36
|
+
updatedAt?: Date;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
sushiReadySince?: Date;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get all available institutions for authed user
|
|
42
|
+
*
|
|
43
|
+
* Needs `institutions-get` permission
|
|
44
|
+
*
|
|
45
|
+
* @returns Available institutions
|
|
46
|
+
*/
|
|
47
|
+
export declare const getInstitutions: () => Promise<ApiResponse<Institution[]>>;
|
|
48
|
+
/**
|
|
49
|
+
* Get specific institution that is available for authed user
|
|
50
|
+
*
|
|
51
|
+
* Needs `institutions-get-id` permission
|
|
52
|
+
*
|
|
53
|
+
* @returns Available institution
|
|
54
|
+
*/
|
|
55
|
+
export declare const getInstitution: (id: Institution['id']) => Promise<ApiResponse<Institution>>;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface RawNamespace {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
logoId?: string;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
updatedAt?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Namespace extends Omit<RawNamespace, 'createdAt' | 'updatedAt'> {
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt?: Date;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Transform raw data from JSON, to JS usable data
|
|
14
|
+
*
|
|
15
|
+
* @param namespace Raw namespace
|
|
16
|
+
*
|
|
17
|
+
* @returns Parsed namespace
|
|
18
|
+
*/
|
|
19
|
+
export declare const parseNamespace: (namespace: RawNamespace) => Namespace;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Namespace, } from './namespaces';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type PaginatedApiResponse, type ApiResponse } from '../lib/axios';
|
|
2
|
+
export interface Job<Data> {
|
|
3
|
+
id: number | string;
|
|
4
|
+
queue: string;
|
|
5
|
+
data: Data;
|
|
6
|
+
}
|
|
7
|
+
type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed' | 'paused' | 'stuck';
|
|
8
|
+
interface RawFullJob<Data, Result> {
|
|
9
|
+
id: Job<Data>['id'];
|
|
10
|
+
data: Job<Data>['data'];
|
|
11
|
+
result?: Result;
|
|
12
|
+
progress: number;
|
|
13
|
+
added: string;
|
|
14
|
+
started?: string;
|
|
15
|
+
ended?: string;
|
|
16
|
+
attempts: number;
|
|
17
|
+
status: JobStatus;
|
|
18
|
+
}
|
|
19
|
+
export interface FullJob<Data, Result> extends Omit<RawFullJob<Data, Result>, 'added' | 'started' | 'ended'> {
|
|
20
|
+
added: Date;
|
|
21
|
+
started?: Date;
|
|
22
|
+
ended?: Date;
|
|
23
|
+
}
|
|
24
|
+
export interface Queue {
|
|
25
|
+
status: 'paused' | 'active';
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get all available queues
|
|
30
|
+
*
|
|
31
|
+
* Needs `general.queues-get` permission
|
|
32
|
+
*
|
|
33
|
+
* @returns All queues' names
|
|
34
|
+
*/
|
|
35
|
+
export declare const getAllQueues: () => Promise<ApiResponse<Queue[]>>;
|
|
36
|
+
/**
|
|
37
|
+
* Pause queue
|
|
38
|
+
*
|
|
39
|
+
* Needs `general.queues-put-queue-pause` permission
|
|
40
|
+
*
|
|
41
|
+
* @param queueName Name of the queue
|
|
42
|
+
*
|
|
43
|
+
* @returns queue info
|
|
44
|
+
*/
|
|
45
|
+
export declare const pauseQueue: (queueName: string) => Promise<ApiResponse<Queue>>;
|
|
46
|
+
/**
|
|
47
|
+
* Resume queue
|
|
48
|
+
*
|
|
49
|
+
* Needs `general.queues-put-queue-resume` permission
|
|
50
|
+
*
|
|
51
|
+
* @param queueName Name of the queue
|
|
52
|
+
*
|
|
53
|
+
* @returns queue info
|
|
54
|
+
*/
|
|
55
|
+
export declare const resumeQueue: (queueName: string) => Promise<ApiResponse<Queue>>;
|
|
56
|
+
/**
|
|
57
|
+
* Get queue info
|
|
58
|
+
*
|
|
59
|
+
* Needs `general.queues-get-queue-jobs` permission
|
|
60
|
+
*
|
|
61
|
+
* @param queueName Name of the queue
|
|
62
|
+
*
|
|
63
|
+
* @returns queue info
|
|
64
|
+
*/
|
|
65
|
+
export declare const getQueueJobs: <Data, Result>(queueName: string, paginationOpts?: {
|
|
66
|
+
previous?: string | number | undefined;
|
|
67
|
+
count?: number | undefined;
|
|
68
|
+
} | undefined) => Promise<PaginatedApiResponse<FullJob<Data, Result>[]>>;
|
|
69
|
+
/**
|
|
70
|
+
* Get job info
|
|
71
|
+
*
|
|
72
|
+
* Needs `namespaces[namespaceId].queues-get-queue-jobs-jobId` permission
|
|
73
|
+
*
|
|
74
|
+
* @param queueName Name of queue where job is
|
|
75
|
+
* @param jobId Id of the job in queue
|
|
76
|
+
* @param namespaces
|
|
77
|
+
*
|
|
78
|
+
* @returns Job full info
|
|
79
|
+
*/
|
|
80
|
+
export declare const getJob: <Data, Result>(queueName: string, jobId: string | number, namespaces?: string[]) => Promise<ApiResponse<FullJob<Data, Result>>>;
|
|
81
|
+
/**
|
|
82
|
+
* Retry job that failed
|
|
83
|
+
*
|
|
84
|
+
* Needs `namespaces[namespaceId].queues-post-queue-jobs-jobId-retry` permission
|
|
85
|
+
*
|
|
86
|
+
* @param queueName Name of queue where job is
|
|
87
|
+
* @param jobId Id of the job in queue
|
|
88
|
+
* @param namespaces
|
|
89
|
+
*
|
|
90
|
+
* @returns queue info
|
|
91
|
+
*/
|
|
92
|
+
export declare const retryJob: <Data, Result>(queueName: string, jobId: string | number, namespaces?: string[]) => Promise<ApiResponse<FullJob<Data, Result>>>;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Job, type FullJob, type Queue, getAllQueues, pauseQueue, resumeQueue, getQueueJobs, getJob, retryJob, } from './queues';
|