@ezpaarse-project/ezreeport-sdk-js 1.3.0 → 2.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/README.md +9 -10
- package/dist/api-C_g0ldUn.d.ts +24 -0
- package/dist/api-D8l8Ds3U.mjs +19 -0
- package/dist/api-D8l8Ds3U.mjs.map +1 -0
- package/dist/api-DVzOqMA2.js +2 -0
- package/dist/api-DVzOqMA2.js.map +1 -0
- package/dist/auth.d.ts +47 -0
- package/dist/auth.js +2 -0
- package/dist/auth.js.map +1 -0
- package/dist/auth.mjs +7 -0
- package/dist/auth.mjs.map +1 -0
- package/dist/body-BqAn9vHJ.d.ts +16 -0
- package/dist/crons.d.ts +16 -0
- package/dist/crons.js +2 -0
- package/dist/crons.js.map +1 -0
- package/dist/crons.mjs +90 -0
- package/dist/crons.mjs.map +1 -0
- package/dist/decorator-C2gcn2rK.js +2 -0
- package/dist/decorator-C2gcn2rK.js.map +1 -0
- package/dist/decorator-DBkj--6g.mjs +26 -0
- package/dist/decorator-DBkj--6g.mjs.map +1 -0
- package/dist/elastic.d.ts +26 -0
- package/dist/elastic.js +2 -0
- package/dist/elastic.js.map +1 -0
- package/dist/elastic.mjs +45 -0
- package/dist/elastic.mjs.map +1 -0
- package/dist/fetch-Hd-ajPIl.js +2 -0
- package/dist/fetch-Hd-ajPIl.js.map +1 -0
- package/dist/fetch-xZFTa3q1.mjs +16 -0
- package/dist/fetch-xZFTa3q1.mjs.map +1 -0
- package/dist/health.d.ts +47 -0
- package/dist/health.js +2 -0
- package/dist/health.js.map +1 -0
- package/dist/health.mjs +41 -0
- package/dist/health.mjs.map +1 -0
- package/dist/helpers/aggregations.d.ts +109 -0
- package/dist/helpers/aggregations.js +2 -0
- package/dist/helpers/aggregations.js.map +1 -0
- package/dist/helpers/aggregations.mjs +42 -0
- package/dist/helpers/aggregations.mjs.map +1 -0
- package/dist/helpers/figures.d.ts +221 -0
- package/dist/helpers/figures.js +2 -0
- package/dist/helpers/figures.js.map +1 -0
- package/dist/helpers/figures.mjs +33 -0
- package/dist/helpers/figures.mjs.map +1 -0
- package/dist/helpers/filters.d.ts +8 -0
- package/dist/helpers/filters.js +2 -0
- package/dist/helpers/filters.js.map +1 -0
- package/dist/helpers/filters.mjs +7 -0
- package/dist/helpers/filters.mjs.map +1 -0
- package/dist/helpers/jobs.d.ts +109 -0
- package/dist/helpers/jobs.js +2 -0
- package/dist/helpers/jobs.js.map +1 -0
- package/dist/helpers/jobs.mjs +390 -0
- package/dist/helpers/jobs.mjs.map +1 -0
- package/dist/helpers/layouts.d.ts +19 -0
- package/dist/helpers/layouts.js +2 -0
- package/dist/helpers/layouts.js.map +1 -0
- package/dist/helpers/layouts.mjs +44 -0
- package/dist/helpers/layouts.mjs.map +1 -0
- package/dist/helpers/permissions.d.ts +15 -0
- package/dist/helpers/permissions.js +2 -0
- package/dist/helpers/permissions.js.map +1 -0
- package/dist/helpers/permissions.mjs +40 -0
- package/dist/helpers/permissions.mjs.map +1 -0
- package/dist/helpers/task-presets.d.ts +16 -0
- package/dist/helpers/task-presets.js +2 -0
- package/dist/helpers/task-presets.js.map +1 -0
- package/dist/helpers/task-presets.mjs +36 -0
- package/dist/helpers/task-presets.mjs.map +1 -0
- package/dist/helpers/tasks.d.ts +55 -0
- package/dist/helpers/tasks.js +2 -0
- package/dist/helpers/tasks.js.map +1 -0
- package/dist/helpers/tasks.mjs +191 -0
- package/dist/helpers/tasks.mjs.map +1 -0
- package/dist/helpers/templates.d.ts +34 -0
- package/dist/helpers/templates.js +2 -0
- package/dist/helpers/templates.js.map +1 -0
- package/dist/helpers/templates.mjs +130 -0
- package/dist/helpers/templates.mjs.map +1 -0
- package/dist/index-CWHjM0a3.d.ts +109 -0
- package/dist/index-btsFMVmd.js +2 -0
- package/dist/index-btsFMVmd.js.map +1 -0
- package/dist/index-niBfS4wD.mjs +331 -0
- package/dist/index-niBfS4wD.mjs.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/methods-BBsb3M5p.mjs +142 -0
- package/dist/methods-BBsb3M5p.mjs.map +1 -0
- package/dist/methods-BJfwYB1p.mjs +126 -0
- package/dist/methods-BJfwYB1p.mjs.map +1 -0
- package/dist/methods-CGdoP4Hi.js +2 -0
- package/dist/methods-CGdoP4Hi.js.map +1 -0
- package/dist/methods-CO0p8irP.js +2 -0
- package/dist/methods-CO0p8irP.js.map +1 -0
- package/dist/methods-DOB4Ry8E.mjs +147 -0
- package/dist/methods-DOB4Ry8E.mjs.map +1 -0
- package/dist/methods-DU5cbtLn.js +2 -0
- package/dist/methods-DU5cbtLn.js.map +1 -0
- package/dist/methods-DUqC5qzU.mjs +146 -0
- package/dist/methods-DUqC5qzU.mjs.map +1 -0
- package/dist/methods-DY2VLwGd.mjs +116 -0
- package/dist/methods-DY2VLwGd.mjs.map +1 -0
- package/dist/methods-Jar1Wkpj.js +2 -0
- package/dist/methods-Jar1Wkpj.js.map +1 -0
- package/dist/methods-M4GU2OL5.mjs +51 -0
- package/dist/methods-M4GU2OL5.mjs.map +1 -0
- package/dist/methods-cUjyNkoK.js +2 -0
- package/dist/methods-cUjyNkoK.js.map +1 -0
- package/dist/methods-uWDk6_pk.js +2 -0
- package/dist/methods-uWDk6_pk.js.map +1 -0
- package/dist/namespaces.d.ts +28 -0
- package/dist/namespaces.js +2 -0
- package/dist/namespaces.js.map +1 -0
- package/dist/namespaces.mjs +2 -0
- package/dist/namespaces.mjs.map +1 -0
- package/dist/queues.d.ts +6 -0
- package/dist/queues.js +2 -0
- package/dist/queues.js.map +1 -0
- package/dist/queues.mjs +10 -0
- package/dist/queues.mjs.map +1 -0
- package/dist/reports.d.ts +85 -0
- package/dist/reports.js +2 -0
- package/dist/reports.js.map +1 -0
- package/dist/reports.mjs +12 -0
- package/dist/reports.mjs.map +1 -0
- package/dist/task-activity.d.ts +33 -0
- package/dist/task-activity.js +2 -0
- package/dist/task-activity.js.map +1 -0
- package/dist/task-activity.mjs +66 -0
- package/dist/task-activity.mjs.map +1 -0
- package/dist/task-presets.d.ts +61 -0
- package/dist/task-presets.js +2 -0
- package/dist/task-presets.js.map +1 -0
- package/dist/task-presets.mjs +10 -0
- package/dist/task-presets.mjs.map +1 -0
- package/dist/tasks-1x680qAf.mjs +34 -0
- package/dist/tasks-1x680qAf.mjs.map +1 -0
- package/dist/tasks-CYqJgTvz.d.ts +12 -0
- package/dist/tasks-hn70eL7B.js +2 -0
- package/dist/tasks-hn70eL7B.js.map +1 -0
- package/dist/tasks.d.ts +60 -0
- package/dist/tasks.js +2 -0
- package/dist/tasks.js.map +1 -0
- package/dist/tasks.mjs +10 -0
- package/dist/tasks.mjs.map +1 -0
- package/dist/templates-BgRTZc5c.d.ts +14 -0
- package/dist/templates-yZjsVuN9.js +2 -0
- package/dist/templates-yZjsVuN9.js.map +1 -0
- package/dist/templates-zMmVXt6k.mjs +30 -0
- package/dist/templates-zMmVXt6k.mjs.map +1 -0
- package/dist/templates.d.ts +51 -0
- package/dist/templates.js +2 -0
- package/dist/templates.js.map +1 -0
- package/dist/templates.mjs +9 -0
- package/dist/templates.mjs.map +1 -0
- package/dist/transform-DzLAfSJo.js +2 -0
- package/dist/transform-DzLAfSJo.js.map +1 -0
- package/dist/transform-EpMTJExd.mjs +26 -0
- package/dist/transform-EpMTJExd.mjs.map +1 -0
- package/dist/types-CpDGJRQw.d.ts +48 -0
- package/dist/types-DcoMmjs3.d.ts +101 -0
- package/dist/types-jXqGnCKQ.d.ts +79 -0
- package/dist/types-y2f9Jb4M.d.ts +75 -0
- package/package.json +126 -25
- package/dist/browser/ezreeport-sdk-js.mjs +0 -979
- package/dist/browser/ezreeport-sdk-js.mjs.map +0 -1
- package/dist/browser/ezreeport-sdk-js.umd.js +0 -2
- package/dist/browser/ezreeport-sdk-js.umd.js.map +0 -1
- package/dist/node/ezreeport-sdk-js.js +0 -2
- package/dist/node/ezreeport-sdk-js.js.map +0 -1
- package/dist/node/ezreeport-sdk-js.mjs +0 -979
- package/dist/node/ezreeport-sdk-js.mjs.map +0 -1
- package/dist/types/index.d.ts +0 -32
- package/dist/types/lib/axios.d.ts +0 -51
- package/dist/types/lib/promises.d.ts +0 -21
- package/dist/types/lib/utils.d.ts +0 -27
- package/dist/types/modules/auth.d.ts +0 -90
- package/dist/types/modules/auth.public.d.ts +0 -1
- package/dist/types/modules/crons.d.ts +0 -102
- package/dist/types/modules/crons.public.d.ts +0 -1
- package/dist/types/modules/elastic.d.ts +0 -33
- package/dist/types/modules/elastic.public.d.ts +0 -1
- package/dist/types/modules/health.d.ts +0 -53
- package/dist/types/modules/health.public.d.ts +0 -1
- package/dist/types/modules/namespaces.d.ts +0 -29
- package/dist/types/modules/namespaces.public.d.ts +0 -1
- package/dist/types/modules/queues.d.ts +0 -120
- package/dist/types/modules/queues.public.d.ts +0 -1
- package/dist/types/modules/reports.d.ts +0 -204
- package/dist/types/modules/reports.public.d.ts +0 -1
- package/dist/types/modules/setup.d.ts +0 -17
- package/dist/types/modules/setup.public.d.ts +0 -2
- package/dist/types/modules/tasks.base.d.ts +0 -48
- package/dist/types/modules/tasks.d.ts +0 -249
- package/dist/types/modules/tasks.public.d.ts +0 -2
- package/dist/types/modules/tasksActivity.d.ts +0 -36
- package/dist/types/modules/tasksActivity.public.d.ts +0 -5
- package/dist/types/modules/tasksPresets.d.ts +0 -87
- package/dist/types/modules/tasksPresets.public.d.ts +0 -1
- package/dist/types/modules/templates.d.ts +0 -155
- package/dist/types/modules/templates.public.d.ts +0 -1
package/README.md
CHANGED
|
@@ -17,25 +17,24 @@ npm i --save @ezpaarse-project/ezreeport-sdk-js
|
|
|
17
17
|
|
|
18
18
|
## First Usage
|
|
19
19
|
|
|
20
|
-
You will need to wrap your app with the `<ezr-provider>` and give some parameters :
|
|
21
|
-
|
|
22
20
|
```js
|
|
23
|
-
import
|
|
21
|
+
import { prepareClient } from '@ezpaarse-project/ezreeport-sdk-js';
|
|
22
|
+
import { getCurrentUser } from '@ezpaarse-project/ezreeport-sdk-js/auth';
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// Set token of current user
|
|
28
|
-
|
|
24
|
+
prepareClient(
|
|
25
|
+
'https://url-to-ezreeport.api/', // Set URL to ezREEPORT API
|
|
26
|
+
{ token: 'mySuperSecretToken' }, // Set token of current user
|
|
27
|
+
);
|
|
29
28
|
|
|
30
29
|
// You can now use sdk
|
|
31
30
|
|
|
32
31
|
// Log current user
|
|
33
|
-
|
|
34
|
-
.then((
|
|
32
|
+
getCurrentUser()
|
|
33
|
+
.then((user) => { console.log(user); }),
|
|
35
34
|
```
|
|
36
35
|
|
|
37
36
|
## Documentation
|
|
38
37
|
|
|
39
38
|
The documentation is available at <https://ezpaarse-project.github.io/ezreeport/sdk-js>
|
|
40
39
|
|
|
41
|
-
You can also run `
|
|
40
|
+
You can also run `pnpm run preview` to run it on a local server.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface ApiRequestPagination {
|
|
2
|
+
/** Count wanted in response, 0 to show all (15 by default) */
|
|
3
|
+
count?: number;
|
|
4
|
+
/** Page number (1 by default) */
|
|
5
|
+
page?: number;
|
|
6
|
+
/** Field to sort */
|
|
7
|
+
sort?: string;
|
|
8
|
+
/** Order of sort (asc by default) */
|
|
9
|
+
order?: 'asc' | 'desc';
|
|
10
|
+
}
|
|
11
|
+
type PrimitiveType = number | string | boolean;
|
|
12
|
+
type ApiRequestFilters = Record<string, PrimitiveType | PrimitiveType[] | undefined>;
|
|
13
|
+
interface ApiRequestOptions {
|
|
14
|
+
filters?: ApiRequestFilters;
|
|
15
|
+
pagination?: ApiRequestPagination;
|
|
16
|
+
}
|
|
17
|
+
interface SdkPaginated<T> {
|
|
18
|
+
items: T[];
|
|
19
|
+
total: number;
|
|
20
|
+
count: number;
|
|
21
|
+
page: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type { ApiRequestOptions as A, SdkPaginated as S };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var r = Object.getOwnPropertySymbols;
|
|
3
|
+
var c = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var u = (e, i, n) => i in e ? f(e, i, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[i] = n, a = (e, i) => {
|
|
5
|
+
for (var n in i || (i = {}))
|
|
6
|
+
c.call(i, n) && u(e, n, i[n]);
|
|
7
|
+
if (r)
|
|
8
|
+
for (var n of r(i))
|
|
9
|
+
g.call(i, n) && u(e, n, i[n]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
function q(e) {
|
|
13
|
+
var i, n;
|
|
14
|
+
return a(a({}, (i = e == null ? void 0 : e.filters) != null ? i : {}), (n = e == null ? void 0 : e.pagination) != null ? n : {});
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
q as a
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=api-D8l8Ds3U.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-D8l8Ds3U.mjs","sources":["../src/lib/api.ts"],"sourcesContent":["export interface ApiResponse<T> {\n /** API version */\n apiVersion: number;\n /** HTTP status */\n status: {\n code: number;\n message: string;\n };\n /** Content of response */\n content: T;\n}\n\nexport interface ApiResponsePaginated<\n T,\n M extends Record<string, unknown> = {},\n> extends ApiResponse<T[]> {\n /** Meta about data */\n meta: M & {\n /** Total number of items */\n total: number,\n /** Current page */\n page: number,\n /** Count in page */\n count: number,\n };\n}\n\nexport type ApiDeletedResponse = ApiResponse<{ deleted: boolean }>;\n\ninterface ApiRequestPagination {\n /** Count wanted in response, 0 to show all (15 by default) */\n count?: number,\n /** Page number (1 by default) */\n page?: number,\n /** Field to sort */\n sort?: string,\n /** Order of sort (asc by default) */\n order?: 'asc' | 'desc',\n}\n\ntype PrimitiveType = number | string | boolean;\n\ntype ApiRequestFilters = Record<string, PrimitiveType | PrimitiveType[] | undefined>;\n\nexport interface ApiRequestOptions {\n filters?: ApiRequestFilters;\n pagination?: ApiRequestPagination;\n}\n\nexport function apiRequestOptionsToQuery(opts?: ApiRequestOptions) {\n return {\n ...(opts?.filters ?? {}),\n ...(opts?.pagination ?? {}),\n };\n}\n\nexport interface SdkPaginated<T> {\n items: T[];\n total: number;\n count: number;\n page: number;\n}\n"],"names":["apiRequestOptionsToQuery","opts","_a","_b","__spreadValues"],"mappings":";;;;;;;;;;;AAiDO,SAASA,EAAyBC,GAA0B;AAA5D,MAAAC,GAAAC;AACE,SAAAC,IAAA,KACDF,IAAAD,KAAA,gBAAAA,EAAM,YAAN,OAAAC,IAAiB,CAAC,KAClBC,IAAAF,KAAA,gBAAAA,EAAM,eAAN,OAAAE,IAAoB,CAAA;AAE5B;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var r=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var a=(e,i,n)=>i in e?c(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,u=(e,i)=>{for(var n in i||(i={}))f.call(i,n)&&a(e,n,i[n]);if(r)for(var n of r(i))q.call(i,n)&&a(e,n,i[n]);return e};function y(e){var i,n;return u(u({},(i=e==null?void 0:e.filters)!=null?i:{}),(n=e==null?void 0:e.pagination)!=null?n:{})}exports.apiRequestOptionsToQuery=y;
|
|
2
|
+
//# sourceMappingURL=api-DVzOqMA2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-DVzOqMA2.js","sources":["../src/lib/api.ts"],"sourcesContent":["export interface ApiResponse<T> {\n /** API version */\n apiVersion: number;\n /** HTTP status */\n status: {\n code: number;\n message: string;\n };\n /** Content of response */\n content: T;\n}\n\nexport interface ApiResponsePaginated<\n T,\n M extends Record<string, unknown> = {},\n> extends ApiResponse<T[]> {\n /** Meta about data */\n meta: M & {\n /** Total number of items */\n total: number,\n /** Current page */\n page: number,\n /** Count in page */\n count: number,\n };\n}\n\nexport type ApiDeletedResponse = ApiResponse<{ deleted: boolean }>;\n\ninterface ApiRequestPagination {\n /** Count wanted in response, 0 to show all (15 by default) */\n count?: number,\n /** Page number (1 by default) */\n page?: number,\n /** Field to sort */\n sort?: string,\n /** Order of sort (asc by default) */\n order?: 'asc' | 'desc',\n}\n\ntype PrimitiveType = number | string | boolean;\n\ntype ApiRequestFilters = Record<string, PrimitiveType | PrimitiveType[] | undefined>;\n\nexport interface ApiRequestOptions {\n filters?: ApiRequestFilters;\n pagination?: ApiRequestPagination;\n}\n\nexport function apiRequestOptionsToQuery(opts?: ApiRequestOptions) {\n return {\n ...(opts?.filters ?? {}),\n ...(opts?.pagination ?? {}),\n };\n}\n\nexport interface SdkPaginated<T> {\n items: T[];\n total: number;\n count: number;\n page: number;\n}\n"],"names":["apiRequestOptionsToQuery","opts","__spreadValues","_a","_b"],"mappings":"sWAiDO,SAASA,EAAyBC,EAA0B,SAC1D,OAAAC,IAAA,IACDC,EAAAF,GAAA,YAAAA,EAAM,UAAN,KAAAE,EAAiB,CAAC,IAClBC,EAAAH,GAAA,YAAAA,EAAM,aAAN,KAAAG,EAAoB,CAAA,EAE5B"}
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Namespace } from './namespaces.js';
|
|
2
|
+
|
|
3
|
+
interface User {
|
|
4
|
+
/** Username */
|
|
5
|
+
username: string;
|
|
6
|
+
/** Token used to authenticate user */
|
|
7
|
+
token: string;
|
|
8
|
+
/** If user is an admin */
|
|
9
|
+
isAdmin: boolean;
|
|
10
|
+
/** Creation date */
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
/** Last update date */
|
|
13
|
+
updatedAt?: Date | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface GeneralPermissions {
|
|
17
|
+
[routeId: string]: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface NamespacePermissions {
|
|
20
|
+
[namespaceId: string]: GeneralPermissions;
|
|
21
|
+
}
|
|
22
|
+
interface UserPermissions {
|
|
23
|
+
general: GeneralPermissions;
|
|
24
|
+
namespaces: NamespacePermissions;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get logged user info
|
|
29
|
+
*
|
|
30
|
+
*
|
|
31
|
+
* @returns The logged user info
|
|
32
|
+
*/
|
|
33
|
+
declare function getCurrentUser(): Promise<User>;
|
|
34
|
+
/**
|
|
35
|
+
* Get logged user accessible namespaces
|
|
36
|
+
*
|
|
37
|
+
* @returns Namespaces
|
|
38
|
+
*/
|
|
39
|
+
declare function getCurrentNamespaces(): Promise<Omit<Namespace, 'fetchLogin' | 'fetchOptions'>[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Get logged user permissions
|
|
42
|
+
*
|
|
43
|
+
* @returns Permissions
|
|
44
|
+
*/
|
|
45
|
+
declare function getCurrentPermissions(): Promise<UserPermissions>;
|
|
46
|
+
|
|
47
|
+
export { type GeneralPermissions, type NamespacePermissions, type UserPermissions, getCurrentNamespaces, getCurrentPermissions, getCurrentUser };
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./methods-Jar1Wkpj.js");exports.getCurrentNamespaces=e.getCurrentNamespaces;exports.getCurrentPermissions=e.getCurrentPermissions;exports.getCurrentUser=e.getCurrentUser;
|
|
2
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/auth.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { c as TemplateFilter, g as TemplateBodyGrid } from './types-DcoMmjs3.js';
|
|
2
|
+
import { L as LayoutHelper } from './templates-BgRTZc5c.js';
|
|
3
|
+
|
|
4
|
+
interface TemplateBodyHelper {
|
|
5
|
+
readonly version: number;
|
|
6
|
+
filters: Map<string, TemplateFilter>;
|
|
7
|
+
index?: string;
|
|
8
|
+
dateField: string;
|
|
9
|
+
layouts: LayoutHelper[];
|
|
10
|
+
grid?: TemplateBodyGrid;
|
|
11
|
+
}
|
|
12
|
+
declare function addLayoutOfHelper(body: TemplateBodyHelper, layout: LayoutHelper, index?: number): TemplateBodyHelper;
|
|
13
|
+
declare function removeLayoutOfHelper(body: TemplateBodyHelper, layout: LayoutHelper): TemplateBodyHelper;
|
|
14
|
+
declare function updateLayoutOfHelper(body: TemplateBodyHelper, oldLayout: LayoutHelper, newLayout: LayoutHelper): TemplateBodyHelper;
|
|
15
|
+
|
|
16
|
+
export { type TemplateBodyHelper as T, addLayoutOfHelper as a, removeLayoutOfHelper as r, updateLayoutOfHelper as u };
|
package/dist/crons.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Cron {
|
|
2
|
+
name: string;
|
|
3
|
+
running: boolean;
|
|
4
|
+
lastRun?: Date;
|
|
5
|
+
nextRun?: Date;
|
|
6
|
+
}
|
|
7
|
+
type InputCron = Omit<Cron, 'name' | 'lastRun' | 'nextRun'>;
|
|
8
|
+
|
|
9
|
+
declare function getAllCrons(): Promise<Cron[]>;
|
|
10
|
+
declare function getCron(cronOrName: Cron | string): Promise<Cron>;
|
|
11
|
+
declare function updateCron(cron: InputCron & {
|
|
12
|
+
name: string;
|
|
13
|
+
}): Promise<Cron>;
|
|
14
|
+
declare function forceCron(cronOrName: Cron | string): Promise<Cron>;
|
|
15
|
+
|
|
16
|
+
export { type Cron, type InputCron, forceCron, getAllCrons, getCron, updateCron };
|
package/dist/crons.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var q=Object.defineProperty,v=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var d=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var m=(n,e,t)=>e in n?q(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y=(n,e)=>{for(var t in e||(e={}))d.call(e,t)&&m(n,t,e[t]);if(a)for(var t of a(e))C.call(e,t)&&m(n,t,e[t]);return n},p=(n,e)=>v(n,x(e));var P=(n,e)=>{var t={};for(var s in n)d.call(n,s)&&e.indexOf(s)<0&&(t[s]=n[s]);if(n!=null&&a)for(var s of a(n))e.indexOf(s)<0&&C.call(n,s)&&(t[s]=n[s]);return t};var r=(n,e,t)=>new Promise((s,c)=>{var A=o=>{try{l(t.next(o))}catch(g){c(g)}},b=o=>{try{l(t.throw(o))}catch(g){c(g)}},l=o=>o.done?s(o.value):Promise.resolve(o.value).then(A,b);l((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("date-fns"),i=require("./fetch-Hd-ajPIl.js"),u=require("./decorator-C2gcn2rK.js"),f=n=>p(y({},n),{lastRun:n.lastRun?h.parseISO(n.lastRun):void 0,nextRun:n.nextRun?h.parseISO(n.nextRun):void 0});function R(){return r(this,null,function*(){const{content:n}=yield i.client.fetch("/crons");return n.map(f)})}u.assignPermission(R,"GET /crons");function T(n){return r(this,null,function*(){const e=typeof n=="string"?n:n.name,{content:t}=yield i.client.fetch(`/crons/${e}`);return f(t)})}u.assignPermission(T,"GET /crons/:name");function S(n){return r(this,null,function*(){const c=n,{name:e}=c,t=P(c,["name"]),{content:s}=yield i.client.fetch(`/crons/${e}`,{method:"PATCH",body:t});return f(s)})}u.assignPermission(S,"PATCH /crons/:name");function w(n){return r(this,null,function*(){const e=typeof n=="string"?n:n.name,{content:t}=yield i.client.fetch(`/crons/${e}`);return f(t)})}u.assignPermission(w,"POST /crons/:name");exports.forceCron=w;exports.getAllCrons=R;exports.getCron=T;exports.updateCron=S;
|
|
2
|
+
//# sourceMappingURL=crons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crons.js","sources":["../src/modules/crons/methods.ts"],"sourcesContent":["import { parseISO } from 'date-fns';\n\nimport { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport type { RawCron, Cron, InputCron } from './types';\n\nconst transformCron = (cron: RawCron): Cron => ({\n ...cron,\n lastRun: cron.lastRun ? parseISO(cron.lastRun) : undefined,\n nextRun: cron.nextRun ? parseISO(cron.nextRun) : undefined,\n});\n\nexport async function getAllCrons(): Promise<Cron[]> {\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron[]>>('/crons');\n\n return content.map(transformCron);\n}\nassignPermission(getAllCrons, 'GET /crons');\n\nexport async function getCron(\n cronOrName: Cron | string,\n): Promise<Cron> {\n const name = typeof cronOrName === 'string' ? cronOrName : cronOrName.name;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`);\n\n return transformCron(content);\n}\nassignPermission(getCron, 'GET /crons/:name');\n\nexport async function updateCron(\n cron: InputCron & { name: string },\n): Promise<Cron> {\n const { name, ...data } = cron;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`, {\n method: 'PATCH',\n body: data,\n });\n\n return transformCron(content);\n}\nassignPermission(updateCron, 'PATCH /crons/:name');\n\nexport async function forceCron(\n cronOrName: Cron | string,\n): Promise<Cron> {\n const name = typeof cronOrName === 'string' ? cronOrName : cronOrName.name;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`);\n\n return transformCron(content);\n}\nassignPermission(forceCron, 'POST /crons/:name');\n"],"names":["transformCron","cron","__spreadProps","__spreadValues","parseISO","getAllCrons","__async","content","client","assignPermission","getCron","cronOrName","name","updateCron","_a","data","__objRest","forceCron"],"mappings":"88BASMA,EAAiBC,GAAyBC,EAAAC,EAAA,GAC3CF,GAD2C,CAE9C,QAASA,EAAK,QAAUG,EAAAA,SAASH,EAAK,OAAO,EAAI,OACjD,QAASA,EAAK,QAAUG,EAAS,SAAAH,EAAK,OAAO,EAAI,MACnD,GAEA,SAAsBI,GAA+B,QAAAC,EAAA,sBAC7C,KAAA,CACJ,QAAAC,CAAA,EACE,MAAMC,EAAAA,OAAO,MAA8B,QAAQ,EAEhD,OAAAD,EAAQ,IAAIP,CAAa,CAClC,GACAS,EAAAA,iBAAiBJ,EAAa,YAAY,EAE1C,SAAsBK,EACpBC,EACe,QAAAL,EAAA,sBACf,MAAMM,EAAO,OAAOD,GAAe,SAAWA,EAAaA,EAAW,KAEhE,CACJ,QAAAJ,CAAA,EACE,MAAMC,EAAA,OAAO,MAA4B,UAAUI,CAAI,EAAE,EAE7D,OAAOZ,EAAcO,CAAO,CAC9B,GACAE,EAAAA,iBAAiBC,EAAS,kBAAkB,EAE5C,SAAsBG,EACpBZ,EACe,QAAAK,EAAA,sBACf,MAA0BQ,EAAAb,EAAlB,MAAAW,GAAkBE,EAATC,EAAAC,EAASF,EAAT,CAAT,SAEF,CACJ,QAAAP,CAAA,EACE,MAAMC,EAAA,OAAO,MAA4B,UAAUI,CAAI,GAAI,CAC7D,OAAQ,QACR,KAAMG,CAAA,CACP,EAED,OAAOf,EAAcO,CAAO,CAC9B,GACAE,EAAAA,iBAAiBI,EAAY,oBAAoB,EAEjD,SAAsBI,EACpBN,EACe,QAAAL,EAAA,sBACf,MAAMM,EAAO,OAAOD,GAAe,SAAWA,EAAaA,EAAW,KAEhE,CACJ,QAAAJ,CAAA,EACE,MAAMC,EAAA,OAAO,MAA4B,UAAUI,CAAI,EAAE,EAE7D,OAAOZ,EAAcO,CAAO,CAC9B,GACAE,EAAAA,iBAAiBQ,EAAW,mBAAmB"}
|
package/dist/crons.mjs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var x = Object.defineProperty, P = Object.defineProperties;
|
|
2
|
+
var A = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var r = Object.getOwnPropertySymbols;
|
|
4
|
+
var C = Object.prototype.hasOwnProperty, d = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var y = (n, o, t) => o in n ? x(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t, l = (n, o) => {
|
|
6
|
+
for (var t in o || (o = {}))
|
|
7
|
+
C.call(o, t) && y(n, t, o[t]);
|
|
8
|
+
if (r)
|
|
9
|
+
for (var t of r(o))
|
|
10
|
+
d.call(o, t) && y(n, t, o[t]);
|
|
11
|
+
return n;
|
|
12
|
+
}, R = (n, o) => P(n, A(o));
|
|
13
|
+
var g = (n, o) => {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var s in n)
|
|
16
|
+
C.call(n, s) && o.indexOf(s) < 0 && (t[s] = n[s]);
|
|
17
|
+
if (n != null && r)
|
|
18
|
+
for (var s of r(n))
|
|
19
|
+
o.indexOf(s) < 0 && d.call(n, s) && (t[s] = n[s]);
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var c = (n, o, t) => new Promise((s, a) => {
|
|
23
|
+
var T = (e) => {
|
|
24
|
+
try {
|
|
25
|
+
m(t.next(e));
|
|
26
|
+
} catch (p) {
|
|
27
|
+
a(p);
|
|
28
|
+
}
|
|
29
|
+
}, w = (e) => {
|
|
30
|
+
try {
|
|
31
|
+
m(t.throw(e));
|
|
32
|
+
} catch (p) {
|
|
33
|
+
a(p);
|
|
34
|
+
}
|
|
35
|
+
}, m = (e) => e.done ? s(e.value) : Promise.resolve(e.value).then(T, w);
|
|
36
|
+
m((t = t.apply(n, o)).next());
|
|
37
|
+
});
|
|
38
|
+
import { parseISO as h } from "date-fns";
|
|
39
|
+
import { c as i } from "./fetch-xZFTa3q1.mjs";
|
|
40
|
+
import { a as f } from "./decorator-DBkj--6g.mjs";
|
|
41
|
+
const u = (n) => R(l({}, n), {
|
|
42
|
+
lastRun: n.lastRun ? h(n.lastRun) : void 0,
|
|
43
|
+
nextRun: n.nextRun ? h(n.nextRun) : void 0
|
|
44
|
+
});
|
|
45
|
+
function $() {
|
|
46
|
+
return c(this, null, function* () {
|
|
47
|
+
const {
|
|
48
|
+
content: n
|
|
49
|
+
} = yield i.fetch("/crons");
|
|
50
|
+
return n.map(u);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
f($, "GET /crons");
|
|
54
|
+
function v(n) {
|
|
55
|
+
return c(this, null, function* () {
|
|
56
|
+
const o = typeof n == "string" ? n : n.name, {
|
|
57
|
+
content: t
|
|
58
|
+
} = yield i.fetch(`/crons/${o}`);
|
|
59
|
+
return u(t);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
f(v, "GET /crons/:name");
|
|
63
|
+
function E(n) {
|
|
64
|
+
return c(this, null, function* () {
|
|
65
|
+
const a = n, { name: o } = a, t = g(a, ["name"]), {
|
|
66
|
+
content: s
|
|
67
|
+
} = yield i.fetch(`/crons/${o}`, {
|
|
68
|
+
method: "PATCH",
|
|
69
|
+
body: t
|
|
70
|
+
});
|
|
71
|
+
return u(s);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
f(E, "PATCH /crons/:name");
|
|
75
|
+
function G(n) {
|
|
76
|
+
return c(this, null, function* () {
|
|
77
|
+
const o = typeof n == "string" ? n : n.name, {
|
|
78
|
+
content: t
|
|
79
|
+
} = yield i.fetch(`/crons/${o}`);
|
|
80
|
+
return u(t);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
f(G, "POST /crons/:name");
|
|
84
|
+
export {
|
|
85
|
+
G as forceCron,
|
|
86
|
+
$ as getAllCrons,
|
|
87
|
+
v as getCron,
|
|
88
|
+
E as updateCron
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=crons.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crons.mjs","sources":["../src/modules/crons/methods.ts"],"sourcesContent":["import { parseISO } from 'date-fns';\n\nimport { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport type { RawCron, Cron, InputCron } from './types';\n\nconst transformCron = (cron: RawCron): Cron => ({\n ...cron,\n lastRun: cron.lastRun ? parseISO(cron.lastRun) : undefined,\n nextRun: cron.nextRun ? parseISO(cron.nextRun) : undefined,\n});\n\nexport async function getAllCrons(): Promise<Cron[]> {\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron[]>>('/crons');\n\n return content.map(transformCron);\n}\nassignPermission(getAllCrons, 'GET /crons');\n\nexport async function getCron(\n cronOrName: Cron | string,\n): Promise<Cron> {\n const name = typeof cronOrName === 'string' ? cronOrName : cronOrName.name;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`);\n\n return transformCron(content);\n}\nassignPermission(getCron, 'GET /crons/:name');\n\nexport async function updateCron(\n cron: InputCron & { name: string },\n): Promise<Cron> {\n const { name, ...data } = cron;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`, {\n method: 'PATCH',\n body: data,\n });\n\n return transformCron(content);\n}\nassignPermission(updateCron, 'PATCH /crons/:name');\n\nexport async function forceCron(\n cronOrName: Cron | string,\n): Promise<Cron> {\n const name = typeof cronOrName === 'string' ? cronOrName : cronOrName.name;\n\n const {\n content,\n } = await client.fetch<ApiResponse<RawCron>>(`/crons/${name}`);\n\n return transformCron(content);\n}\nassignPermission(forceCron, 'POST /crons/:name');\n"],"names":["transformCron","cron","__spreadProps","__spreadValues","parseISO","getAllCrons","__async","content","client","assignPermission","getCron","cronOrName","name","updateCron","_a","data","__objRest","forceCron"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAMA,IAAgB,CAACC,MAAyBC,EAAAC,EAAA,IAC3CF,IAD2C;AAAA,EAE9C,SAASA,EAAK,UAAUG,EAASH,EAAK,OAAO,IAAI;AAAA,EACjD,SAASA,EAAK,UAAUG,EAASH,EAAK,OAAO,IAAI;AACnD;AAEA,SAAsBI,IAA+B;AAAA,SAAAC,EAAA;AAC7C,UAAA;AAAA,MACJ,SAAAC;AAAA,IAAA,IACE,MAAMC,EAAO,MAA8B,QAAQ;AAEhD,WAAAD,EAAQ,IAAIP,CAAa;AAAA,EAClC;AAAA;AACAS,EAAiBJ,GAAa,YAAY;AAE1C,SAAsBK,EACpBC,GACe;AAAA,SAAAL,EAAA;AACf,UAAMM,IAAO,OAAOD,KAAe,WAAWA,IAAaA,EAAW,MAEhE;AAAA,MACJ,SAAAJ;AAAA,IAAA,IACE,MAAMC,EAAO,MAA4B,UAAUI,CAAI,EAAE;AAE7D,WAAOZ,EAAcO,CAAO;AAAA,EAC9B;AAAA;AACAE,EAAiBC,GAAS,kBAAkB;AAE5C,SAAsBG,EACpBZ,GACe;AAAA,SAAAK,EAAA;AACf,UAA0BQ,IAAAb,GAAlB,QAAAW,MAAkBE,GAATC,IAAAC,EAASF,GAAT,CAAT,UAEF;AAAA,MACJ,SAAAP;AAAA,IAAA,IACE,MAAMC,EAAO,MAA4B,UAAUI,CAAI,IAAI;AAAA,MAC7D,QAAQ;AAAA,MACR,MAAMG;AAAA,IAAA,CACP;AAED,WAAOf,EAAcO,CAAO;AAAA,EAC9B;AAAA;AACAE,EAAiBI,GAAY,oBAAoB;AAEjD,SAAsBI,EACpBN,GACe;AAAA,SAAAL,EAAA;AACf,UAAMM,IAAO,OAAOD,KAAe,WAAWA,IAAaA,EAAW,MAEhE;AAAA,MACJ,SAAAJ;AAAA,IAAA,IACE,MAAMC,EAAO,MAA4B,UAAUI,CAAI,EAAE;AAE7D,WAAOZ,EAAcO,CAAO;AAAA,EAC9B;AAAA;AACAE,EAAiBQ,GAAW,mBAAmB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function r(e){return"ezrPermissions"in e}function t(e,s,n=!1){Object.defineProperty(e,"ezrPermissions",{value:[{permission:s,isNamespaced:n}],writable:!1,enumerable:!1})}function o(e,s,n,c=!1){const a=s.filter(i=>r(i)).flatMap(i=>i.ezrPermissions);Object.defineProperty(e,"ezrPermissions",{value:a,writable:!1,enumerable:!1})}exports.assignDependencies=o;exports.assignPermission=t;exports.isSDKFunction=r;
|
|
2
|
+
//# sourceMappingURL=decorator-C2gcn2rK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-C2gcn2rK.js","sources":["../src/helpers/permissions/decorator.ts"],"sourcesContent":["type SDKFunctionAddition = {\n ezrPermissions: { permission: string, isNamespaced: boolean }[];\n};\n\nexport type SDKFunction = Function & SDKFunctionAddition;\n\nexport function isSDKFunction(fnc: Function): fnc is SDKFunction {\n return 'ezrPermissions' in fnc;\n}\n\n/**\n * Assign a permission name to a SDK function, used to check if the user have the permission\n *\n * @param fnc The function to decorate\n * @param permission The permission name (cf. /auth/me/permissions)\n * @param isNamespaced If the permission is namespaced (cf. /auth/me/permissions)\n */\nexport function assignPermission(\n fnc: Function,\n permission: string,\n isNamespaced = false,\n): void {\n Object.defineProperty(fnc, 'ezrPermissions', {\n value: [\n { permission, isNamespaced },\n ],\n writable: false,\n enumerable: false,\n });\n}\n\n/**\n * Assign permission names of its dependencies to a SDK function, used to check if the user have\n * the permission\n *\n * @param fnc The function to decorate\n * @param deps The dependencies\n * @param permission The additional permission name (cf. /auth/me/permissions)\n * @param isNamespaced If the additional permission is namespaced (cf. /auth/me/permissions)\n */\nexport function assignDependencies(\n fnc: Function,\n deps: Function[],\n permission?: string,\n isNamespaced = false,\n): void {\n const dependencies = deps.filter((dep) => isSDKFunction(dep));\n const permissions = dependencies.flatMap((dep) => dep.ezrPermissions);\n\n if (permission) {\n permissions.unshift({ permission, isNamespaced });\n }\n\n Object.defineProperty(fnc, 'ezrPermissions', {\n value: permissions,\n writable: false,\n enumerable: false,\n });\n}\n"],"names":["isSDKFunction","fnc","assignPermission","permission","isNamespaced","assignDependencies","deps","permissions","dep"],"mappings":"aAMO,SAASA,EAAcC,EAAmC,CAC/D,MAAO,mBAAoBA,CAC7B,CASO,SAASC,EACdD,EACAE,EACAC,EAAe,GACT,CACC,OAAA,eAAeH,EAAK,iBAAkB,CAC3C,MAAO,CACL,CAAE,WAAAE,EAAY,aAAAC,CAAa,CAC7B,EACA,SAAU,GACV,WAAY,EAAA,CACb,CACH,CAWO,SAASC,EACdJ,EACAK,EACAH,EACAC,EAAe,GACT,CAEN,MAAMG,EADeD,EAAK,OAAQE,GAAQR,EAAcQ,CAAG,CAAC,EAC3B,QAASA,GAAQA,EAAI,cAAc,EAM7D,OAAA,eAAeP,EAAK,iBAAkB,CAC3C,MAAOM,EACP,SAAU,GACV,WAAY,EAAA,CACb,CACH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function a(e) {
|
|
2
|
+
return "ezrPermissions" in e;
|
|
3
|
+
}
|
|
4
|
+
function l(e, s, n = !1) {
|
|
5
|
+
Object.defineProperty(e, "ezrPermissions", {
|
|
6
|
+
value: [
|
|
7
|
+
{ permission: s, isNamespaced: n }
|
|
8
|
+
],
|
|
9
|
+
writable: !1,
|
|
10
|
+
enumerable: !1
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function f(e, s, n, o = !1) {
|
|
14
|
+
const r = s.filter((i) => a(i)).flatMap((i) => i.ezrPermissions);
|
|
15
|
+
Object.defineProperty(e, "ezrPermissions", {
|
|
16
|
+
value: r,
|
|
17
|
+
writable: !1,
|
|
18
|
+
enumerable: !1
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
l as a,
|
|
23
|
+
f as b,
|
|
24
|
+
a as i
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=decorator-DBkj--6g.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-DBkj--6g.mjs","sources":["../src/helpers/permissions/decorator.ts"],"sourcesContent":["type SDKFunctionAddition = {\n ezrPermissions: { permission: string, isNamespaced: boolean }[];\n};\n\nexport type SDKFunction = Function & SDKFunctionAddition;\n\nexport function isSDKFunction(fnc: Function): fnc is SDKFunction {\n return 'ezrPermissions' in fnc;\n}\n\n/**\n * Assign a permission name to a SDK function, used to check if the user have the permission\n *\n * @param fnc The function to decorate\n * @param permission The permission name (cf. /auth/me/permissions)\n * @param isNamespaced If the permission is namespaced (cf. /auth/me/permissions)\n */\nexport function assignPermission(\n fnc: Function,\n permission: string,\n isNamespaced = false,\n): void {\n Object.defineProperty(fnc, 'ezrPermissions', {\n value: [\n { permission, isNamespaced },\n ],\n writable: false,\n enumerable: false,\n });\n}\n\n/**\n * Assign permission names of its dependencies to a SDK function, used to check if the user have\n * the permission\n *\n * @param fnc The function to decorate\n * @param deps The dependencies\n * @param permission The additional permission name (cf. /auth/me/permissions)\n * @param isNamespaced If the additional permission is namespaced (cf. /auth/me/permissions)\n */\nexport function assignDependencies(\n fnc: Function,\n deps: Function[],\n permission?: string,\n isNamespaced = false,\n): void {\n const dependencies = deps.filter((dep) => isSDKFunction(dep));\n const permissions = dependencies.flatMap((dep) => dep.ezrPermissions);\n\n if (permission) {\n permissions.unshift({ permission, isNamespaced });\n }\n\n Object.defineProperty(fnc, 'ezrPermissions', {\n value: permissions,\n writable: false,\n enumerable: false,\n });\n}\n"],"names":["isSDKFunction","fnc","assignPermission","permission","isNamespaced","assignDependencies","deps","permissions","dep"],"mappings":"AAMO,SAASA,EAAcC,GAAmC;AAC/D,SAAO,oBAAoBA;AAC7B;AASO,SAASC,EACdD,GACAE,GACAC,IAAe,IACT;AACC,SAAA,eAAeH,GAAK,kBAAkB;AAAA,IAC3C,OAAO;AAAA,MACL,EAAE,YAAAE,GAAY,cAAAC,EAAa;AAAA,IAC7B;AAAA,IACA,UAAU;AAAA,IACV,YAAY;AAAA,EAAA,CACb;AACH;AAWO,SAASC,EACdJ,GACAK,GACAH,GACAC,IAAe,IACT;AAEN,QAAMG,IADeD,EAAK,OAAO,CAACE,MAAQR,EAAcQ,CAAG,CAAC,EAC3B,QAAQ,CAACA,MAAQA,EAAI,cAAc;AAM7D,SAAA,eAAeP,GAAK,kBAAkB;AAAA,IAC3C,OAAOM;AAAA,IACP,UAAU;AAAA,IACV,YAAY;AAAA,EAAA,CACb;AACH;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Namespace } from './namespaces.js';
|
|
2
|
+
|
|
3
|
+
type Mapping = Record<string, string>;
|
|
4
|
+
type Index = string;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* List all available indices
|
|
8
|
+
*
|
|
9
|
+
* Providing a query will resolve it
|
|
10
|
+
*
|
|
11
|
+
* @param namespace The concerned namespace. **Needed if not admin**
|
|
12
|
+
*
|
|
13
|
+
* @returns The list of available indices
|
|
14
|
+
*/
|
|
15
|
+
declare function getAllIndices(namespaceOrId?: Namespace | string, query?: string): Promise<Index[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Get mapping of an specific index
|
|
18
|
+
*
|
|
19
|
+
* @param index The index (can be a wildcard)
|
|
20
|
+
* @param namespace The concerned namespace. **Needed if not admin**
|
|
21
|
+
*
|
|
22
|
+
* @returns The list of available indices
|
|
23
|
+
*/
|
|
24
|
+
declare function getIndexMapping(index: string, namespaceOrId?: Namespace | string): Promise<Mapping>;
|
|
25
|
+
|
|
26
|
+
export { type Index, type Mapping, getAllIndices, getIndexMapping };
|
package/dist/elastic.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var u=(t,i,e)=>new Promise((o,l)=>{var f=n=>{try{c(e.next(n))}catch(s){l(s)}},q=n=>{try{c(e.throw(n))}catch(s){l(s)}},c=n=>n.done?o(n.value):Promise.resolve(n.value).then(f,q);c((e=e.apply(t,i)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./fetch-Hd-ajPIl.js"),r=require("./decorator-C2gcn2rK.js");function d(t,i){return u(this,null,function*(){const e=typeof t=="string"?t:t==null?void 0:t.id,{content:o}=yield g.client.fetch("/elastic/indices",{query:{query:i||void 0,namespaceId:e||void 0}});return o})}r.assignPermission(d,"GET /elastic/indices",!0);function y(t,i){return u(this,null,function*(){const e=typeof i=="string"?i:i==null?void 0:i.id,{content:o}=yield g.client.fetch(`/elastic/indices/${t}`,{query:{namespaceId:e||void 0}});return o})}r.assignPermission(y,"GET /elastic/indices/:index",!0);exports.getAllIndices=d;exports.getIndexMapping=y;
|
|
2
|
+
//# sourceMappingURL=elastic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elastic.js","sources":["../src/modules/elastic/methods.ts"],"sourcesContent":["import { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport { Namespace } from '~/modules/namespaces/types';\n\nimport { Index, Mapping } from './types';\n\n/**\n * List all available indices\n *\n * Providing a query will resolve it\n *\n * @param namespace The concerned namespace. **Needed if not admin**\n *\n * @returns The list of available indices\n */\nexport async function getAllIndices(\n namespaceOrId?: Namespace | string,\n query?: string,\n): Promise<Index[]> {\n const namespaceId = typeof namespaceOrId === 'string' ? namespaceOrId : namespaceOrId?.id;\n\n const {\n content,\n } = await client.fetch<ApiResponse<Index[]>>('/elastic/indices', {\n query: { query: query || undefined, namespaceId: namespaceId || undefined },\n });\n\n return content;\n}\nassignPermission(getAllIndices, 'GET /elastic/indices', true);\n\n/**\n * Get mapping of an specific index\n *\n * @param index The index (can be a wildcard)\n * @param namespace The concerned namespace. **Needed if not admin**\n *\n * @returns The list of available indices\n */\n\nexport async function getIndexMapping(\n index: string,\n namespaceOrId?: Namespace | string,\n): Promise<Mapping> {\n const namespaceId = typeof namespaceOrId === 'string' ? namespaceOrId : namespaceOrId?.id;\n\n const {\n content,\n } = await client.fetch<ApiResponse<Mapping>>(`/elastic/indices/${index}`, {\n query: { namespaceId: namespaceId || undefined },\n });\n\n return content;\n}\nassignPermission(getIndexMapping, 'GET /elastic/indices/:index', true);\n"],"names":["getAllIndices","namespaceOrId","query","__async","namespaceId","content","client","assignPermission","getIndexMapping","index"],"mappings":"yWAkBsB,SAAAA,EACpBC,EACAC,EACkB,QAAAC,EAAA,sBAClB,MAAMC,EAAc,OAAOH,GAAkB,SAAWA,EAAgBA,GAAA,YAAAA,EAAe,GAEjF,CACJ,QAAAI,CAAA,EACE,MAAMC,EAAAA,OAAO,MAA4B,mBAAoB,CAC/D,MAAO,CAAE,MAAOJ,GAAS,OAAW,YAAaE,GAAe,MAAU,CAAA,CAC3E,EAEM,OAAAC,CACT,GACAE,EAAAA,iBAAiBP,EAAe,uBAAwB,EAAI,EAWtC,SAAAQ,EACpBC,EACAR,EACkB,QAAAE,EAAA,sBAClB,MAAMC,EAAc,OAAOH,GAAkB,SAAWA,EAAgBA,GAAA,YAAAA,EAAe,GAEjF,CACJ,QAAAI,CAAA,EACE,MAAMC,EAAA,OAAO,MAA4B,oBAAoBG,CAAK,GAAI,CACxE,MAAO,CAAE,YAAaL,GAAe,MAAU,CAAA,CAChD,EAEM,OAAAC,CACT,GACAE,EAAAA,iBAAiBC,EAAiB,8BAA+B,EAAI"}
|
package/dist/elastic.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var u = (i, t, n) => new Promise((c, f) => {
|
|
2
|
+
var g = (o) => {
|
|
3
|
+
try {
|
|
4
|
+
s(n.next(o));
|
|
5
|
+
} catch (e) {
|
|
6
|
+
f(e);
|
|
7
|
+
}
|
|
8
|
+
}, r = (o) => {
|
|
9
|
+
try {
|
|
10
|
+
s(n.throw(o));
|
|
11
|
+
} catch (e) {
|
|
12
|
+
f(e);
|
|
13
|
+
}
|
|
14
|
+
}, s = (o) => o.done ? c(o.value) : Promise.resolve(o.value).then(g, r);
|
|
15
|
+
s((n = n.apply(i, t)).next());
|
|
16
|
+
});
|
|
17
|
+
import { c as l } from "./fetch-xZFTa3q1.mjs";
|
|
18
|
+
import { a as y } from "./decorator-DBkj--6g.mjs";
|
|
19
|
+
function d(i, t) {
|
|
20
|
+
return u(this, null, function* () {
|
|
21
|
+
const n = typeof i == "string" ? i : i == null ? void 0 : i.id, {
|
|
22
|
+
content: c
|
|
23
|
+
} = yield l.fetch("/elastic/indices", {
|
|
24
|
+
query: { query: t || void 0, namespaceId: n || void 0 }
|
|
25
|
+
});
|
|
26
|
+
return c;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
y(d, "GET /elastic/indices", !0);
|
|
30
|
+
function q(i, t) {
|
|
31
|
+
return u(this, null, function* () {
|
|
32
|
+
const n = typeof t == "string" ? t : t == null ? void 0 : t.id, {
|
|
33
|
+
content: c
|
|
34
|
+
} = yield l.fetch(`/elastic/indices/${i}`, {
|
|
35
|
+
query: { namespaceId: n || void 0 }
|
|
36
|
+
});
|
|
37
|
+
return c;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
y(q, "GET /elastic/indices/:index", !0);
|
|
41
|
+
export {
|
|
42
|
+
d as getAllIndices,
|
|
43
|
+
q as getIndexMapping
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=elastic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elastic.mjs","sources":["../src/modules/elastic/methods.ts"],"sourcesContent":["import { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport { assignPermission } from '~/helpers/permissions/decorator';\n\nimport { Namespace } from '~/modules/namespaces/types';\n\nimport { Index, Mapping } from './types';\n\n/**\n * List all available indices\n *\n * Providing a query will resolve it\n *\n * @param namespace The concerned namespace. **Needed if not admin**\n *\n * @returns The list of available indices\n */\nexport async function getAllIndices(\n namespaceOrId?: Namespace | string,\n query?: string,\n): Promise<Index[]> {\n const namespaceId = typeof namespaceOrId === 'string' ? namespaceOrId : namespaceOrId?.id;\n\n const {\n content,\n } = await client.fetch<ApiResponse<Index[]>>('/elastic/indices', {\n query: { query: query || undefined, namespaceId: namespaceId || undefined },\n });\n\n return content;\n}\nassignPermission(getAllIndices, 'GET /elastic/indices', true);\n\n/**\n * Get mapping of an specific index\n *\n * @param index The index (can be a wildcard)\n * @param namespace The concerned namespace. **Needed if not admin**\n *\n * @returns The list of available indices\n */\n\nexport async function getIndexMapping(\n index: string,\n namespaceOrId?: Namespace | string,\n): Promise<Mapping> {\n const namespaceId = typeof namespaceOrId === 'string' ? namespaceOrId : namespaceOrId?.id;\n\n const {\n content,\n } = await client.fetch<ApiResponse<Mapping>>(`/elastic/indices/${index}`, {\n query: { namespaceId: namespaceId || undefined },\n });\n\n return content;\n}\nassignPermission(getIndexMapping, 'GET /elastic/indices/:index', true);\n"],"names":["getAllIndices","namespaceOrId","query","__async","namespaceId","content","client","assignPermission","getIndexMapping","index"],"mappings":";;;;;;;;;;;;;;;;;;AAkBsB,SAAAA,EACpBC,GACAC,GACkB;AAAA,SAAAC,EAAA;AAClB,UAAMC,IAAc,OAAOH,KAAkB,WAAWA,IAAgBA,KAAA,gBAAAA,EAAe,IAEjF;AAAA,MACJ,SAAAI;AAAA,IAAA,IACE,MAAMC,EAAO,MAA4B,oBAAoB;AAAA,MAC/D,OAAO,EAAE,OAAOJ,KAAS,QAAW,aAAaE,KAAe,OAAU;AAAA,IAAA,CAC3E;AAEM,WAAAC;AAAA,EACT;AAAA;AACAE,EAAiBP,GAAe,wBAAwB,EAAI;AAWtC,SAAAQ,EACpBC,GACAR,GACkB;AAAA,SAAAE,EAAA;AAClB,UAAMC,IAAc,OAAOH,KAAkB,WAAWA,IAAgBA,KAAA,gBAAAA,EAAe,IAEjF;AAAA,MACJ,SAAAI;AAAA,IAAA,IACE,MAAMC,EAAO,MAA4B,oBAAoBG,CAAK,IAAI;AAAA,MACxE,OAAO,EAAE,aAAaL,KAAe,OAAU;AAAA,IAAA,CAChD;AAEM,WAAAC;AAAA,EACT;AAAA;AACAE,EAAiBC,GAAiB,+BAA+B,EAAI;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const c=require("ofetch"),r={fetch:c.ofetch.create({})};function o(n,e){const t={};e!=null&&e.token&&(t.Authorization=`Bearer ${e.token}`),r.fetch=c.ofetch.create({baseURL:n,headers:t})}exports.client=r;exports.prepareClient=o;
|
|
2
|
+
//# sourceMappingURL=fetch-Hd-ajPIl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-Hd-ajPIl.js","sources":["../src/lib/fetch.ts"],"sourcesContent":["import { ofetch } from 'ofetch';\n\nexport type ApiAuthOptions = {\n token?: string;\n // apiKey?: string;\n};\n\n/**\n * Client for the API\n */\nexport const client = {\n fetch: ofetch.create({}),\n};\n\n/**\n * Prepare the client for the rest of the SDK, will update config if needed\n *\n * @param baseURL Base URL of the API\n * @param auth Auth options to be authenticated\n */\nexport function prepareClient(\n baseURL: string,\n auth?: ApiAuthOptions,\n) {\n const headers: Record<string, string> = {};\n\n if (auth?.token) {\n headers.Authorization = `Bearer ${auth.token}`;\n }\n // if (auth?.apiKey) {\n // headers['X-Api-Key'] = auth.apiKey;\n // }\n\n client.fetch = ofetch.create({\n baseURL,\n headers,\n });\n}\n"],"names":["client","ofetch","prepareClient","baseURL","auth","headers"],"mappings":"uCAUaA,EAAS,CACpB,MAAOC,EAAAA,OAAO,OAAO,CAAE,CAAA,CACzB,EAQgB,SAAAC,EACdC,EACAC,EACA,CACA,MAAMC,EAAkC,CAAC,EAErCD,GAAA,MAAAA,EAAM,QACAC,EAAA,cAAgB,UAAUD,EAAK,KAAK,IAMvCJ,EAAA,MAAQC,SAAO,OAAO,CAC3B,QAAAE,EACA,QAAAE,CAAA,CACD,CACH"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ofetch as r } from "ofetch";
|
|
2
|
+
const c = {
|
|
3
|
+
fetch: r.create({})
|
|
4
|
+
};
|
|
5
|
+
function i(t, e) {
|
|
6
|
+
const o = {};
|
|
7
|
+
e != null && e.token && (o.Authorization = `Bearer ${e.token}`), c.fetch = r.create({
|
|
8
|
+
baseURL: t,
|
|
9
|
+
headers: o
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
c,
|
|
14
|
+
i as p
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=fetch-xZFTa3q1.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-xZFTa3q1.mjs","sources":["../src/lib/fetch.ts"],"sourcesContent":["import { ofetch } from 'ofetch';\n\nexport type ApiAuthOptions = {\n token?: string;\n // apiKey?: string;\n};\n\n/**\n * Client for the API\n */\nexport const client = {\n fetch: ofetch.create({}),\n};\n\n/**\n * Prepare the client for the rest of the SDK, will update config if needed\n *\n * @param baseURL Base URL of the API\n * @param auth Auth options to be authenticated\n */\nexport function prepareClient(\n baseURL: string,\n auth?: ApiAuthOptions,\n) {\n const headers: Record<string, string> = {};\n\n if (auth?.token) {\n headers.Authorization = `Bearer ${auth.token}`;\n }\n // if (auth?.apiKey) {\n // headers['X-Api-Key'] = auth.apiKey;\n // }\n\n client.fetch = ofetch.create({\n baseURL,\n headers,\n });\n}\n"],"names":["client","ofetch","prepareClient","baseURL","auth","headers"],"mappings":";AAUO,MAAMA,IAAS;AAAA,EACpB,OAAOC,EAAO,OAAO,CAAE,CAAA;AACzB;AAQgB,SAAAC,EACdC,GACAC,GACA;AACA,QAAMC,IAAkC,CAAC;AAEzC,EAAID,KAAA,QAAAA,EAAM,UACAC,EAAA,gBAAgB,UAAUD,EAAK,KAAK,KAMvCJ,EAAA,QAAQC,EAAO,OAAO;AAAA,IAC3B,SAAAE;AAAA,IACA,SAAAE;AAAA,EAAA,CACD;AACH;"}
|
package/dist/health.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
interface ApiStatus {
|
|
2
|
+
/** Current service */
|
|
3
|
+
current: string;
|
|
4
|
+
/** Current version */
|
|
5
|
+
version: string;
|
|
6
|
+
/** Services connected to current */
|
|
7
|
+
services: string[];
|
|
8
|
+
}
|
|
9
|
+
type Pong = {
|
|
10
|
+
/** Service name */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Service status */
|
|
13
|
+
status: boolean;
|
|
14
|
+
/** Time taken to respond */
|
|
15
|
+
elapsedTime: number;
|
|
16
|
+
/** HTTP status code */
|
|
17
|
+
statusCode?: number | undefined;
|
|
18
|
+
} | {
|
|
19
|
+
/** Service name */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Service status */
|
|
22
|
+
status: false;
|
|
23
|
+
/** Error message */
|
|
24
|
+
error: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get status of service
|
|
29
|
+
*
|
|
30
|
+
* @returns The current service
|
|
31
|
+
*/
|
|
32
|
+
declare function getStatus(): Promise<ApiStatus>;
|
|
33
|
+
/**
|
|
34
|
+
* Ping all connected services at once
|
|
35
|
+
*
|
|
36
|
+
* @returns Result of pings
|
|
37
|
+
*/
|
|
38
|
+
declare function pingAllServices(): Promise<Pong[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Ping connected services
|
|
41
|
+
* @param service The name of the service
|
|
42
|
+
*
|
|
43
|
+
* @returns Result of ping
|
|
44
|
+
*/
|
|
45
|
+
declare function pingService(service: string): Promise<Pong>;
|
|
46
|
+
|
|
47
|
+
export { type ApiStatus, type Pong, getStatus, pingAllServices, pingService };
|
package/dist/health.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var c=(t,i,n)=>new Promise((l,o)=>{var u=e=>{try{r(n.next(e))}catch(s){o(s)}},h=e=>{try{r(n.throw(e))}catch(s){o(s)}},r=e=>e.done?l(e.value):Promise.resolve(e.value).then(u,h);r((n=n.apply(t,i)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./fetch-Hd-ajPIl.js");function f(){return c(this,null,function*(){const{content:t}=yield a.client.fetch("/health");return t})}function g(){return c(this,null,function*(){const{content:t}=yield a.client.fetch("/health/services");return t})}function S(t){return c(this,null,function*(){const{content:i}=yield a.client.fetch(`/health/services/${t}`);return i})}exports.getStatus=f;exports.pingAllServices=g;exports.pingService=S;
|
|
2
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sources":["../src/modules/health/methods.ts"],"sourcesContent":["import { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport type { ApiStatus, Pong } from './types';\n\n/**\n * Get status of service\n *\n * @returns The current service\n */\nexport async function getStatus() {\n const { content } = await client.fetch<ApiResponse<ApiStatus>>('/health');\n return content;\n}\n\n/**\n * Ping all connected services at once\n *\n * @returns Result of pings\n */\nexport async function pingAllServices() {\n const { content } = await client.fetch<ApiResponse<Pong[]>>('/health/services');\n return content;\n}\n\n/**\n * Ping connected services\n * @param service The name of the service\n *\n * @returns Result of ping\n */\nexport async function pingService(service: string) {\n const { content } = await client.fetch<ApiResponse<Pong>>(`/health/services/${service}`);\n return content;\n}\n"],"names":["getStatus","__async","content","client","pingAllServices","pingService","service"],"mappings":"oUAUA,SAAsBA,GAAY,QAAAC,EAAA,sBAChC,KAAM,CAAE,QAAAC,CAAQ,EAAI,MAAMC,EAAAA,OAAO,MAA8B,SAAS,EACjE,OAAAD,CACT,GAOA,SAAsBE,GAAkB,QAAAH,EAAA,sBACtC,KAAM,CAAE,QAAAC,CAAQ,EAAI,MAAMC,EAAAA,OAAO,MAA2B,kBAAkB,EACvE,OAAAD,CACT,GAQA,SAAsBG,EAAYC,EAAiB,QAAAL,EAAA,sBAC3C,KAAA,CAAE,QAAAC,CAAY,EAAA,MAAMC,SAAO,MAAyB,oBAAoBG,CAAO,EAAE,EAChF,OAAAJ,CACT"}
|
package/dist/health.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var c = (t, a, e) => new Promise((h, o) => {
|
|
2
|
+
var f = (n) => {
|
|
3
|
+
try {
|
|
4
|
+
i(e.next(n));
|
|
5
|
+
} catch (r) {
|
|
6
|
+
o(r);
|
|
7
|
+
}
|
|
8
|
+
}, u = (n) => {
|
|
9
|
+
try {
|
|
10
|
+
i(e.throw(n));
|
|
11
|
+
} catch (r) {
|
|
12
|
+
o(r);
|
|
13
|
+
}
|
|
14
|
+
}, i = (n) => n.done ? h(n.value) : Promise.resolve(n.value).then(f, u);
|
|
15
|
+
i((e = e.apply(t, a)).next());
|
|
16
|
+
});
|
|
17
|
+
import { c as s } from "./fetch-xZFTa3q1.mjs";
|
|
18
|
+
function v() {
|
|
19
|
+
return c(this, null, function* () {
|
|
20
|
+
const { content: t } = yield s.fetch("/health");
|
|
21
|
+
return t;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function g() {
|
|
25
|
+
return c(this, null, function* () {
|
|
26
|
+
const { content: t } = yield s.fetch("/health/services");
|
|
27
|
+
return t;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function w(t) {
|
|
31
|
+
return c(this, null, function* () {
|
|
32
|
+
const { content: a } = yield s.fetch(`/health/services/${t}`);
|
|
33
|
+
return a;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
v as getStatus,
|
|
38
|
+
g as pingAllServices,
|
|
39
|
+
w as pingService
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=health.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.mjs","sources":["../src/modules/health/methods.ts"],"sourcesContent":["import { client } from '~/lib/fetch';\nimport type { ApiResponse } from '~/lib/api';\n\nimport type { ApiStatus, Pong } from './types';\n\n/**\n * Get status of service\n *\n * @returns The current service\n */\nexport async function getStatus() {\n const { content } = await client.fetch<ApiResponse<ApiStatus>>('/health');\n return content;\n}\n\n/**\n * Ping all connected services at once\n *\n * @returns Result of pings\n */\nexport async function pingAllServices() {\n const { content } = await client.fetch<ApiResponse<Pong[]>>('/health/services');\n return content;\n}\n\n/**\n * Ping connected services\n * @param service The name of the service\n *\n * @returns Result of ping\n */\nexport async function pingService(service: string) {\n const { content } = await client.fetch<ApiResponse<Pong>>(`/health/services/${service}`);\n return content;\n}\n"],"names":["getStatus","__async","content","client","pingAllServices","pingService","service"],"mappings":";;;;;;;;;;;;;;;;;AAUA,SAAsBA,IAAY;AAAA,SAAAC,EAAA;AAChC,UAAM,EAAE,SAAAC,EAAQ,IAAI,MAAMC,EAAO,MAA8B,SAAS;AACjE,WAAAD;AAAA,EACT;AAAA;AAOA,SAAsBE,IAAkB;AAAA,SAAAH,EAAA;AACtC,UAAM,EAAE,SAAAC,EAAQ,IAAI,MAAMC,EAAO,MAA2B,kBAAkB;AACvE,WAAAD;AAAA,EACT;AAAA;AAQA,SAAsBG,EAAYC,GAAiB;AAAA,SAAAL,EAAA;AAC3C,UAAA,EAAE,SAAAC,EAAY,IAAA,MAAMC,EAAO,MAAyB,oBAAoBG,CAAO,EAAE;AAChF,WAAAJ;AAAA,EACT;AAAA;"}
|