@ikatec/digisac-api-sdk 4.12.0 → 4.13.0
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/apis/absence/AbsenceApi.cjs +46 -2
- package/dist/apis/absence/AbsenceApi.cjs.map +1 -1
- package/dist/apis/absence/AbsenceApi.d.ts +38 -4
- package/dist/apis/absence/AbsenceApi.d.ts.map +1 -1
- package/dist/apis/absence/AbsenceApi.mjs +46 -2
- package/dist/apis/absence/AbsenceApi.mjs.map +1 -1
- package/dist/apis/absence/types.d.ts +51 -2
- package/dist/apis/absence/types.d.ts.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.cjs +10 -1
- package/dist/apis/activityLog/ActivityLogApi.cjs.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.d.ts +10 -3
- package/dist/apis/activityLog/ActivityLogApi.d.ts.map +1 -1
- package/dist/apis/activityLog/ActivityLogApi.mjs +10 -1
- package/dist/apis/activityLog/ActivityLogApi.mjs.map +1 -1
- package/dist/apis/activityLog/types.d.ts +48 -8
- package/dist/apis/activityLog/types.d.ts.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.cjs +31 -2
- package/dist/apis/creditMovements/CreditMovementsApi.cjs.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.d.ts +21 -3
- package/dist/apis/creditMovements/CreditMovementsApi.d.ts.map +1 -1
- package/dist/apis/creditMovements/CreditMovementsApi.mjs +31 -2
- package/dist/apis/creditMovements/CreditMovementsApi.mjs.map +1 -1
- package/dist/apis/creditMovements/types.d.ts +73 -2
- package/dist/apis/creditMovements/types.d.ts.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs +27 -0
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts +22 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts.map +1 -1
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs +27 -0
- package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs.map +1 -1
- package/dist/apis/knowledgeBase/types.d.ts +56 -2
- package/dist/apis/knowledgeBase/types.d.ts.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs +26 -0
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts +24 -0
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts.map +1 -1
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs +26 -0
- package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs.map +1 -1
- package/dist/apis/knowledgeBaseItem/types.d.ts +23 -6
- package/dist/apis/knowledgeBaseItem/types.d.ts.map +1 -1
- package/dist/apis/notifications/NotificationsApi.cjs +50 -2
- package/dist/apis/notifications/NotificationsApi.cjs.map +1 -1
- package/dist/apis/notifications/NotificationsApi.d.ts +41 -3
- package/dist/apis/notifications/NotificationsApi.d.ts.map +1 -1
- package/dist/apis/notifications/NotificationsApi.mjs +50 -2
- package/dist/apis/notifications/NotificationsApi.mjs.map +1 -1
- package/dist/apis/notifications/types.d.ts +54 -8
- package/dist/apis/notifications/types.d.ts.map +1 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.cjs.map +1 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts +4 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts.map +1 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs.map +1 -1
- package/dist/apis/serviceAccessManagement/types.d.ts +3 -0
- package/dist/apis/serviceAccessManagement/types.d.ts.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.cjs.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.d.ts +3 -1
- package/dist/apis/stickerUsers/StickerUsersApi.d.ts.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.mjs.map +1 -1
- package/dist/apis/stickerUsers/types.d.ts +4 -0
- package/dist/apis/stickerUsers/types.d.ts.map +1 -1
- package/dist/apis/stickers/StickersApi.cjs +27 -3
- package/dist/apis/stickers/StickersApi.cjs.map +1 -1
- package/dist/apis/stickers/StickersApi.d.ts +24 -4
- package/dist/apis/stickers/StickersApi.d.ts.map +1 -1
- package/dist/apis/stickers/StickersApi.mjs +27 -3
- package/dist/apis/stickers/StickersApi.mjs.map +1 -1
- package/dist/apis/stickers/types.d.ts +28 -4
- package/dist/apis/stickers/types.d.ts.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs +1 -2
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts +1 -2
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts.map +1 -1
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs +1 -2
- package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs.map +1 -1
- package/package.json +1 -1
- package/src/apis/absence/AbsenceApi.test.ts +65 -0
- package/src/apis/absence/AbsenceApi.ts +77 -4
- package/src/apis/absence/types.ts +53 -2
- package/src/apis/activityLog/ActivityLogApi.test.ts +44 -0
- package/src/apis/activityLog/ActivityLogApi.ts +22 -3
- package/src/apis/activityLog/types.ts +47 -8
- package/src/apis/creditMovements/CreditMovementsApi.test.ts +88 -0
- package/src/apis/creditMovements/CreditMovementsApi.ts +73 -2
- package/src/apis/creditMovements/types.ts +74 -2
- package/src/apis/knowledgeBase/KnowledgeBaseApi.test.ts +54 -0
- package/src/apis/knowledgeBase/KnowledgeBaseApi.ts +61 -1
- package/src/apis/knowledgeBase/types.ts +62 -2
- package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.test.ts +57 -0
- package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts +45 -0
- package/src/apis/knowledgeBaseItem/types.ts +23 -6
- package/src/apis/me/MeApi.test.ts +1 -1
- package/src/apis/notifications/NotificationsApi.test.ts +74 -0
- package/src/apis/notifications/NotificationsApi.ts +88 -3
- package/src/apis/notifications/types.ts +65 -7
- package/src/apis/payloads.test-d.ts +46 -0
- package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts +4 -1
- package/src/apis/serviceAccessManagement/types.ts +3 -0
- package/src/apis/stickerUsers/StickerUsersApi.ts +3 -1
- package/src/apis/stickerUsers/types.ts +4 -0
- package/src/apis/stickers/StickersApi.test.ts +58 -0
- package/src/apis/stickers/StickersApi.ts +46 -4
- package/src/apis/stickers/types.ts +29 -4
- package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts +1 -2
|
@@ -3,13 +3,57 @@ const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
|
|
|
3
3
|
|
|
4
4
|
//#region src/apis/absence/AbsenceApi.ts
|
|
5
5
|
/**
|
|
6
|
-
* Absences of the users. The backend serves the report (`GET /absence
|
|
7
|
-
* `
|
|
6
|
+
* Absences of the users. The backend serves the report (`GET /absence`, `GET /absence/export-csv`),
|
|
7
|
+
* `GET /absence/find-open-absence`, `POST /absence`, `POST /absence/unlock` and `PUT /absence/:id`; there is
|
|
8
|
+
* no read by id nor delete. Creating an absence sets the status of the user to `away` and `unlock` sets it
|
|
9
|
+
* back to `online` (both emit `user.updated` to the webhooks).
|
|
8
10
|
*/
|
|
9
11
|
var AbsenceApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
10
12
|
constructor(client) {
|
|
11
13
|
super(client, "/absence");
|
|
12
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The absence report of the account (`GET /absence`), always paginated, with its own query (the rows are
|
|
17
|
+
* raw: see `AbsenceReportItem`). Prefer it to `getMany`, whose `where`/`include`/`paginate` the backend
|
|
18
|
+
* ignores. Requires both permissions, always: without them it answers 403
|
|
19
|
+
* `MISSING_ABSENCE_REPORT_PERMISSION`.
|
|
20
|
+
* @permissions overview.absence.view AND myAccount.absence
|
|
21
|
+
*/
|
|
22
|
+
report(query, headers) {
|
|
23
|
+
return this.client.get(`${this.basePath}${this.toQueryString(query)}`, headers);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates an absence for the current user (whatever `userId` says) and sets the user `away`. Resolves the
|
|
27
|
+
* stored absence (raw, without `user`).
|
|
28
|
+
* @permissions myAccount.absence
|
|
29
|
+
*/
|
|
30
|
+
create(body, headers) {
|
|
31
|
+
return super.create(body, headers);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The open absence of the current user, or `null` — also `null` while `settings.absence.enabled` is off.
|
|
35
|
+
* @permissions myAccount.absence
|
|
36
|
+
*/
|
|
37
|
+
findOpenAbsence(headers) {
|
|
38
|
+
return this.client.get(`${this.basePath}/find-open-absence`, headers);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Ends an absence (the open one of the user when `id` is absent) and sets the user `online`. The refusals
|
|
42
|
+
* of `settings.absence` come with status 200 (`INVALID_REASON`, `INVALID_PASSWORD`); without an open
|
|
43
|
+
* absence it answers 500.
|
|
44
|
+
* @permissions myAccount.absence
|
|
45
|
+
*/
|
|
46
|
+
unlock(body, headers) {
|
|
47
|
+
return this.client.post(`${this.basePath}/unlock`, body, headers);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Exports the report as CSV (`Usuário, De, Até, Motivo`; an open absence shows `Em andamento`), sent as
|
|
51
|
+
* the attachment `<yyyy-MM-dd>_absence-control.csv`.
|
|
52
|
+
* @permissions overview.absence.view AND myAccount.absence
|
|
53
|
+
*/
|
|
54
|
+
exportCsv(query, headers) {
|
|
55
|
+
return this.client.get(`${this.basePath}/export-csv${this.toQueryString(query)}`, headers);
|
|
56
|
+
}
|
|
13
57
|
/** @deprecated Not served: the backend has no GET /absence/:id, so this route answers 404. */
|
|
14
58
|
getById(id, query, headers) {
|
|
15
59
|
return super.getById(id, query, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbsenceApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/absence/AbsenceApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { GetByIdQuery } from '../../core/types'\nimport type {
|
|
1
|
+
{"version":3,"file":"AbsenceApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/absence/AbsenceApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { GetByIdQuery, Paginated } from '../../core/types'\nimport type {\n Absence,\n AbsenceReportItem,\n AbsenceReportQuery,\n CreateAbsencePayload,\n UnlockAbsencePayload,\n UnlockAbsenceResponse,\n UpdateAbsencePayload,\n} from './types'\n\n/**\n * Absences of the users. The backend serves the report (`GET /absence`, `GET /absence/export-csv`),\n * `GET /absence/find-open-absence`, `POST /absence`, `POST /absence/unlock` and `PUT /absence/:id`; there is\n * no read by id nor delete. Creating an absence sets the status of the user to `away` and `unlock` sets it\n * back to `online` (both emit `user.updated` to the webhooks).\n */\nexport class AbsenceApi extends BaseCrudApi<Absence, CreateAbsencePayload, UpdateAbsencePayload> {\n constructor(client: ApiClient) {\n super(client, '/absence')\n }\n\n /**\n * The absence report of the account (`GET /absence`), always paginated, with its own query (the rows are\n * raw: see `AbsenceReportItem`). Prefer it to `getMany`, whose `where`/`include`/`paginate` the backend\n * ignores. Requires both permissions, always: without them it answers 403\n * `MISSING_ABSENCE_REPORT_PERMISSION`.\n * @permissions overview.absence.view AND myAccount.absence\n */\n report(\n query?: AbsenceReportQuery,\n headers?: Record<string, string>,\n ): Promise<Paginated<AbsenceReportItem>> {\n return this.client.get<Paginated<AbsenceReportItem>>(\n `${this.basePath}${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Creates an absence for the current user (whatever `userId` says) and sets the user `away`. Resolves the\n * stored absence (raw, without `user`).\n * @permissions myAccount.absence\n */\n override create(body: CreateAbsencePayload, headers?: Record<string, string>): Promise<Absence> {\n return super.create(body, headers)\n }\n\n /**\n * The open absence of the current user, or `null` — also `null` while `settings.absence.enabled` is off.\n * @permissions myAccount.absence\n */\n findOpenAbsence(headers?: Record<string, string>): Promise<AbsenceReportItem | null> {\n return this.client.get<AbsenceReportItem | null>(`${this.basePath}/find-open-absence`, headers)\n }\n\n /**\n * Ends an absence (the open one of the user when `id` is absent) and sets the user `online`. The refusals\n * of `settings.absence` come with status 200 (`INVALID_REASON`, `INVALID_PASSWORD`); without an open\n * absence it answers 500.\n * @permissions myAccount.absence\n */\n unlock(\n body: UnlockAbsencePayload,\n headers?: Record<string, string>,\n ): Promise<UnlockAbsenceResponse> {\n return this.client.post<UnlockAbsenceResponse, UnlockAbsencePayload>(\n `${this.basePath}/unlock`,\n body,\n headers,\n )\n }\n\n /**\n * Exports the report as CSV (`Usuário, De, Até, Motivo`; an open absence shows `Em andamento`), sent as\n * the attachment `<yyyy-MM-dd>_absence-control.csv`.\n * @permissions overview.absence.view AND myAccount.absence\n */\n exportCsv(query?: AbsenceReportQuery, headers?: Record<string, string>): Promise<string> {\n return this.client.get<string>(\n `${this.basePath}/export-csv${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /** @deprecated Not served: the backend has no GET /absence/:id, so this route answers 404. */\n override getById(\n id: string,\n query?: GetByIdQuery<Absence>,\n headers?: Record<string, string>,\n ): Promise<Absence> {\n return super.getById(id, query, headers)\n }\n\n /** @deprecated Not served: the backend has no DELETE /absence/:id, so this route answers 404. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Absence> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;;;;;;;AAmBA,IAAa,aAAb,cAAgCA,qCAAiE;CAC/F,YAAY,QAAmB;AAC7B,QAAM,QAAQ,WAAW;;;;;;;;;CAU3B,OACE,OACA,SACuC;AACvC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,WAAW,KAAK,cAAc,MAAM,IAC5C,QACD;;;;;;;CAQH,AAAS,OAAO,MAA4B,SAAoD;AAC9F,SAAO,MAAM,OAAO,MAAM,QAAQ;;;;;;CAOpC,gBAAgB,SAAqE;AACnF,SAAO,KAAK,OAAO,IAA8B,GAAG,KAAK,SAAS,qBAAqB,QAAQ;;;;;;;;CASjG,OACE,MACA,SACgC;AAChC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,UACjB,MACA,QACD;;;;;;;CAQH,UAAU,OAA4B,SAAmD;AACvF,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,aAAa,KAAK,cAAc,MAAM,IACvD,QACD;;;CAIH,AAAS,QACP,IACA,OACA,SACkB;AAClB,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;CAI1C,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -1,13 +1,47 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
2
|
import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
3
|
-
import type { GetByIdQuery } from '../../core/types';
|
|
4
|
-
import type { Absence, CreateAbsencePayload, UpdateAbsencePayload } from './types';
|
|
3
|
+
import type { GetByIdQuery, Paginated } from '../../core/types';
|
|
4
|
+
import type { Absence, AbsenceReportItem, AbsenceReportQuery, CreateAbsencePayload, UnlockAbsencePayload, UnlockAbsenceResponse, UpdateAbsencePayload } from './types';
|
|
5
5
|
/**
|
|
6
|
-
* Absences of the users. The backend serves the report (`GET /absence
|
|
7
|
-
* `
|
|
6
|
+
* Absences of the users. The backend serves the report (`GET /absence`, `GET /absence/export-csv`),
|
|
7
|
+
* `GET /absence/find-open-absence`, `POST /absence`, `POST /absence/unlock` and `PUT /absence/:id`; there is
|
|
8
|
+
* no read by id nor delete. Creating an absence sets the status of the user to `away` and `unlock` sets it
|
|
9
|
+
* back to `online` (both emit `user.updated` to the webhooks).
|
|
8
10
|
*/
|
|
9
11
|
export declare class AbsenceApi extends BaseCrudApi<Absence, CreateAbsencePayload, UpdateAbsencePayload> {
|
|
10
12
|
constructor(client: ApiClient);
|
|
13
|
+
/**
|
|
14
|
+
* The absence report of the account (`GET /absence`), always paginated, with its own query (the rows are
|
|
15
|
+
* raw: see `AbsenceReportItem`). Prefer it to `getMany`, whose `where`/`include`/`paginate` the backend
|
|
16
|
+
* ignores. Requires both permissions, always: without them it answers 403
|
|
17
|
+
* `MISSING_ABSENCE_REPORT_PERMISSION`.
|
|
18
|
+
* @permissions overview.absence.view AND myAccount.absence
|
|
19
|
+
*/
|
|
20
|
+
report(query?: AbsenceReportQuery, headers?: Record<string, string>): Promise<Paginated<AbsenceReportItem>>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates an absence for the current user (whatever `userId` says) and sets the user `away`. Resolves the
|
|
23
|
+
* stored absence (raw, without `user`).
|
|
24
|
+
* @permissions myAccount.absence
|
|
25
|
+
*/
|
|
26
|
+
create(body: CreateAbsencePayload, headers?: Record<string, string>): Promise<Absence>;
|
|
27
|
+
/**
|
|
28
|
+
* The open absence of the current user, or `null` — also `null` while `settings.absence.enabled` is off.
|
|
29
|
+
* @permissions myAccount.absence
|
|
30
|
+
*/
|
|
31
|
+
findOpenAbsence(headers?: Record<string, string>): Promise<AbsenceReportItem | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Ends an absence (the open one of the user when `id` is absent) and sets the user `online`. The refusals
|
|
34
|
+
* of `settings.absence` come with status 200 (`INVALID_REASON`, `INVALID_PASSWORD`); without an open
|
|
35
|
+
* absence it answers 500.
|
|
36
|
+
* @permissions myAccount.absence
|
|
37
|
+
*/
|
|
38
|
+
unlock(body: UnlockAbsencePayload, headers?: Record<string, string>): Promise<UnlockAbsenceResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Exports the report as CSV (`Usuário, De, Até, Motivo`; an open absence shows `Em andamento`), sent as
|
|
41
|
+
* the attachment `<yyyy-MM-dd>_absence-control.csv`.
|
|
42
|
+
* @permissions overview.absence.view AND myAccount.absence
|
|
43
|
+
*/
|
|
44
|
+
exportCsv(query?: AbsenceReportQuery, headers?: Record<string, string>): Promise<string>;
|
|
11
45
|
/** @deprecated Not served: the backend has no GET /absence/:id, so this route answers 404. */
|
|
12
46
|
getById(id: string, query?: GetByIdQuery<Absence>, headers?: Record<string, string>): Promise<Absence>;
|
|
13
47
|
/** @deprecated Not served: the backend has no DELETE /absence/:id, so this route answers 404. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbsenceApi.d.ts","sourceRoot":"","sources":["../../../src/apis/absence/AbsenceApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"AbsenceApi.d.ts","sourceRoot":"","sources":["../../../src/apis/absence/AbsenceApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,WAAW,CAAC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,CAAC;gBAClF,MAAM,EAAE,SAAS;IAI7B;;;;;;OAMG;IACH,MAAM,CACJ,KAAK,CAAC,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAOxC;;;;OAIG;IACM,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/F;;;OAGG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAIpF;;;;;OAKG;IACH,MAAM,CACJ,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,qBAAqB,CAAC;IAQjC;;;;OAIG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAOxF,8FAA8F;IACrF,OAAO,CACd,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC;IAInB,iGAAiG;IACxF,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAGpF"}
|
|
@@ -2,13 +2,57 @@ import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/apis/absence/AbsenceApi.ts
|
|
4
4
|
/**
|
|
5
|
-
* Absences of the users. The backend serves the report (`GET /absence
|
|
6
|
-
* `
|
|
5
|
+
* Absences of the users. The backend serves the report (`GET /absence`, `GET /absence/export-csv`),
|
|
6
|
+
* `GET /absence/find-open-absence`, `POST /absence`, `POST /absence/unlock` and `PUT /absence/:id`; there is
|
|
7
|
+
* no read by id nor delete. Creating an absence sets the status of the user to `away` and `unlock` sets it
|
|
8
|
+
* back to `online` (both emit `user.updated` to the webhooks).
|
|
7
9
|
*/
|
|
8
10
|
var AbsenceApi = class extends BaseCrudApi {
|
|
9
11
|
constructor(client) {
|
|
10
12
|
super(client, "/absence");
|
|
11
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* The absence report of the account (`GET /absence`), always paginated, with its own query (the rows are
|
|
16
|
+
* raw: see `AbsenceReportItem`). Prefer it to `getMany`, whose `where`/`include`/`paginate` the backend
|
|
17
|
+
* ignores. Requires both permissions, always: without them it answers 403
|
|
18
|
+
* `MISSING_ABSENCE_REPORT_PERMISSION`.
|
|
19
|
+
* @permissions overview.absence.view AND myAccount.absence
|
|
20
|
+
*/
|
|
21
|
+
report(query, headers) {
|
|
22
|
+
return this.client.get(`${this.basePath}${this.toQueryString(query)}`, headers);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates an absence for the current user (whatever `userId` says) and sets the user `away`. Resolves the
|
|
26
|
+
* stored absence (raw, without `user`).
|
|
27
|
+
* @permissions myAccount.absence
|
|
28
|
+
*/
|
|
29
|
+
create(body, headers) {
|
|
30
|
+
return super.create(body, headers);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The open absence of the current user, or `null` — also `null` while `settings.absence.enabled` is off.
|
|
34
|
+
* @permissions myAccount.absence
|
|
35
|
+
*/
|
|
36
|
+
findOpenAbsence(headers) {
|
|
37
|
+
return this.client.get(`${this.basePath}/find-open-absence`, headers);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Ends an absence (the open one of the user when `id` is absent) and sets the user `online`. The refusals
|
|
41
|
+
* of `settings.absence` come with status 200 (`INVALID_REASON`, `INVALID_PASSWORD`); without an open
|
|
42
|
+
* absence it answers 500.
|
|
43
|
+
* @permissions myAccount.absence
|
|
44
|
+
*/
|
|
45
|
+
unlock(body, headers) {
|
|
46
|
+
return this.client.post(`${this.basePath}/unlock`, body, headers);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Exports the report as CSV (`Usuário, De, Até, Motivo`; an open absence shows `Em andamento`), sent as
|
|
50
|
+
* the attachment `<yyyy-MM-dd>_absence-control.csv`.
|
|
51
|
+
* @permissions overview.absence.view AND myAccount.absence
|
|
52
|
+
*/
|
|
53
|
+
exportCsv(query, headers) {
|
|
54
|
+
return this.client.get(`${this.basePath}/export-csv${this.toQueryString(query)}`, headers);
|
|
55
|
+
}
|
|
12
56
|
/** @deprecated Not served: the backend has no GET /absence/:id, so this route answers 404. */
|
|
13
57
|
getById(id, query, headers) {
|
|
14
58
|
return super.getById(id, query, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbsenceApi.mjs","names":[],"sources":["../../../src/apis/absence/AbsenceApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { GetByIdQuery } from '../../core/types'\nimport type {
|
|
1
|
+
{"version":3,"file":"AbsenceApi.mjs","names":[],"sources":["../../../src/apis/absence/AbsenceApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { GetByIdQuery, Paginated } from '../../core/types'\nimport type {\n Absence,\n AbsenceReportItem,\n AbsenceReportQuery,\n CreateAbsencePayload,\n UnlockAbsencePayload,\n UnlockAbsenceResponse,\n UpdateAbsencePayload,\n} from './types'\n\n/**\n * Absences of the users. The backend serves the report (`GET /absence`, `GET /absence/export-csv`),\n * `GET /absence/find-open-absence`, `POST /absence`, `POST /absence/unlock` and `PUT /absence/:id`; there is\n * no read by id nor delete. Creating an absence sets the status of the user to `away` and `unlock` sets it\n * back to `online` (both emit `user.updated` to the webhooks).\n */\nexport class AbsenceApi extends BaseCrudApi<Absence, CreateAbsencePayload, UpdateAbsencePayload> {\n constructor(client: ApiClient) {\n super(client, '/absence')\n }\n\n /**\n * The absence report of the account (`GET /absence`), always paginated, with its own query (the rows are\n * raw: see `AbsenceReportItem`). Prefer it to `getMany`, whose `where`/`include`/`paginate` the backend\n * ignores. Requires both permissions, always: without them it answers 403\n * `MISSING_ABSENCE_REPORT_PERMISSION`.\n * @permissions overview.absence.view AND myAccount.absence\n */\n report(\n query?: AbsenceReportQuery,\n headers?: Record<string, string>,\n ): Promise<Paginated<AbsenceReportItem>> {\n return this.client.get<Paginated<AbsenceReportItem>>(\n `${this.basePath}${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Creates an absence for the current user (whatever `userId` says) and sets the user `away`. Resolves the\n * stored absence (raw, without `user`).\n * @permissions myAccount.absence\n */\n override create(body: CreateAbsencePayload, headers?: Record<string, string>): Promise<Absence> {\n return super.create(body, headers)\n }\n\n /**\n * The open absence of the current user, or `null` — also `null` while `settings.absence.enabled` is off.\n * @permissions myAccount.absence\n */\n findOpenAbsence(headers?: Record<string, string>): Promise<AbsenceReportItem | null> {\n return this.client.get<AbsenceReportItem | null>(`${this.basePath}/find-open-absence`, headers)\n }\n\n /**\n * Ends an absence (the open one of the user when `id` is absent) and sets the user `online`. The refusals\n * of `settings.absence` come with status 200 (`INVALID_REASON`, `INVALID_PASSWORD`); without an open\n * absence it answers 500.\n * @permissions myAccount.absence\n */\n unlock(\n body: UnlockAbsencePayload,\n headers?: Record<string, string>,\n ): Promise<UnlockAbsenceResponse> {\n return this.client.post<UnlockAbsenceResponse, UnlockAbsencePayload>(\n `${this.basePath}/unlock`,\n body,\n headers,\n )\n }\n\n /**\n * Exports the report as CSV (`Usuário, De, Até, Motivo`; an open absence shows `Em andamento`), sent as\n * the attachment `<yyyy-MM-dd>_absence-control.csv`.\n * @permissions overview.absence.view AND myAccount.absence\n */\n exportCsv(query?: AbsenceReportQuery, headers?: Record<string, string>): Promise<string> {\n return this.client.get<string>(\n `${this.basePath}/export-csv${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /** @deprecated Not served: the backend has no GET /absence/:id, so this route answers 404. */\n override getById(\n id: string,\n query?: GetByIdQuery<Absence>,\n headers?: Record<string, string>,\n ): Promise<Absence> {\n return super.getById(id, query, headers)\n }\n\n /** @deprecated Not served: the backend has no DELETE /absence/:id, so this route answers 404. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Absence> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,IAAa,aAAb,cAAgC,YAAiE;CAC/F,YAAY,QAAmB;AAC7B,QAAM,QAAQ,WAAW;;;;;;;;;CAU3B,OACE,OACA,SACuC;AACvC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,WAAW,KAAK,cAAc,MAAM,IAC5C,QACD;;;;;;;CAQH,AAAS,OAAO,MAA4B,SAAoD;AAC9F,SAAO,MAAM,OAAO,MAAM,QAAQ;;;;;;CAOpC,gBAAgB,SAAqE;AACnF,SAAO,KAAK,OAAO,IAA8B,GAAG,KAAK,SAAS,qBAAqB,QAAQ;;;;;;;;CASjG,OACE,MACA,SACgC;AAChC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,UACjB,MACA,QACD;;;;;;;CAQH,UAAU,OAA4B,SAAmD;AACvF,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,aAAa,KAAK,cAAc,MAAM,IACvD,QACD;;;CAIH,AAAS,QACP,IACA,OACA,SACkB;AAClB,SAAO,MAAM,QAAQ,IAAI,OAAO,QAAQ;;;CAI1C,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { User } from '../users';
|
|
2
|
+
/** An absence as `PUT /absence/:id` answers it (the transformer of the backend). */
|
|
2
3
|
export type Absence = {
|
|
3
4
|
id: string;
|
|
4
5
|
accountId: string;
|
|
@@ -7,16 +8,64 @@ export type Absence = {
|
|
|
7
8
|
endedAt: string | null;
|
|
8
9
|
createdAt: string;
|
|
9
10
|
updatedAt: string;
|
|
10
|
-
|
|
11
|
+
/** @deprecated Not a field of the backend: the model has no soft delete. */
|
|
12
|
+
deletedAt?: string | null;
|
|
11
13
|
user?: User;
|
|
12
14
|
};
|
|
13
15
|
export type AbsenceRelationships = 'user';
|
|
14
16
|
export type CreateAbsencePayload = {
|
|
15
|
-
|
|
17
|
+
/** Ignored: the backend creates the absence for the current user. */
|
|
18
|
+
userId?: string;
|
|
19
|
+
/** Up to 255 characters. */
|
|
16
20
|
reason?: string;
|
|
17
21
|
};
|
|
18
22
|
export type UpdateAbsencePayload = {
|
|
19
23
|
reason?: string;
|
|
20
24
|
endedAt?: string | null;
|
|
21
25
|
};
|
|
26
|
+
/** Columns the report can be sorted by (an unknown one falls back to the default order). */
|
|
27
|
+
export type AbsenceReportSortField = 'user' | 'createdAt' | 'endedAt';
|
|
28
|
+
/**
|
|
29
|
+
* Query of the absence report (`GET /absence` and `GET /absence/export-csv`). The backend ignores
|
|
30
|
+
* `where` and `include`: it reads only these fields.
|
|
31
|
+
*/
|
|
32
|
+
export type AbsenceReportQuery = {
|
|
33
|
+
filters?: {
|
|
34
|
+
userId?: string;
|
|
35
|
+
reason?: string;
|
|
36
|
+
/** Absences created at or after this date. An invalid date answers 400 `Invalid date.`. */
|
|
37
|
+
createdAt?: string;
|
|
38
|
+
/** Absences ended at or before this date. */
|
|
39
|
+
endedAt?: string;
|
|
40
|
+
};
|
|
41
|
+
sort?: AbsenceReportSortField;
|
|
42
|
+
/** Only `'ASC'` sorts ascending: any other value sorts descending. */
|
|
43
|
+
order?: 'ASC' | 'DESC';
|
|
44
|
+
page?: number;
|
|
45
|
+
/** Up to 200 (a larger value is clamped, not refused). Defaults to 15. */
|
|
46
|
+
perPage?: number;
|
|
47
|
+
/** IANA zone of the dates of the CSV export (e.g. `America/Sao_Paulo`). */
|
|
48
|
+
timezone?: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A row of the report: the stored absence with its user, both raw (not transformed).
|
|
52
|
+
*/
|
|
53
|
+
export type AbsenceReportItem = Omit<Absence, 'deletedAt' | 'user'> & {
|
|
54
|
+
user?: Record<string, unknown>;
|
|
55
|
+
};
|
|
56
|
+
/** The body of `unlock`: the absence to end (the open one of the user when `id` is absent). */
|
|
57
|
+
export type UnlockAbsencePayload = {
|
|
58
|
+
id?: string;
|
|
59
|
+
/** Required when `settings.absence.reason_required` is on. */
|
|
60
|
+
reason?: string;
|
|
61
|
+
/** Required when `settings.absence.password_required` is on: the password of the user. */
|
|
62
|
+
password?: string;
|
|
63
|
+
};
|
|
64
|
+
/** What `unlock` answers: the business refusals come with status 200. */
|
|
65
|
+
export type UnlockAbsenceResponse = {
|
|
66
|
+
success: true;
|
|
67
|
+
} | {
|
|
68
|
+
success: false;
|
|
69
|
+
message: 'INVALID_REASON' | 'INVALID_PASSWORD';
|
|
70
|
+
};
|
|
22
71
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/absence/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/absence/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,oFAAoF;AACpF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEzB,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB,CAAA;AAED,4FAA4F;AAC5F,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;AAErE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,2FAA2F;QAC3F,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,6CAA6C;QAC7C,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,IAAI,CAAC,EAAE,sBAAsB,CAAA;IAC7B,sEAAsE;IACtE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC,GAAG;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B,CAAA;AAED,+FAA+F;AAC/F,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,yEAAyE;AACzE,MAAM,MAAM,qBAAqB,GAC7B;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GACjB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAA;CAAE,CAAA"}
|
|
@@ -4,12 +4,21 @@ const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
|
|
|
4
4
|
//#region src/apis/activityLog/ActivityLogApi.ts
|
|
5
5
|
/**
|
|
6
6
|
* Activity log of the account (stored in MongoDB: the routes answer 503 when it is unavailable).
|
|
7
|
-
* The backend serves `GET /log`, `GET /log/:id` and `POST /log`; there is no update
|
|
7
|
+
* The backend serves `GET /log`, `GET /log/export-csv`, `GET /log/:id` and `POST /log`; there is no update
|
|
8
|
+
* or delete, so an entry created is permanent. `GET /log/:id` takes a MongoDB
|
|
9
|
+
* id (an UUID answers 500).
|
|
8
10
|
*/
|
|
9
11
|
var ActivityLogApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
10
12
|
constructor(client) {
|
|
11
13
|
super(client, "/log");
|
|
12
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Exports the entries of the period (`filters.from`/`filters.to`) as CSV, sent as the attachment
|
|
17
|
+
* `exportation.csv`.
|
|
18
|
+
*/
|
|
19
|
+
exportCsv(query, headers) {
|
|
20
|
+
return this.client.get(`${this.basePath}/export-csv${this.toQueryString(query)}`, headers);
|
|
21
|
+
}
|
|
13
22
|
/** @deprecated Not served: the backend has no PUT /log/:id, so this route answers 404. */
|
|
14
23
|
updateById(id, body, headers) {
|
|
15
24
|
return super.updateById(id, body, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityLogApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/activityLog/ActivityLogApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {
|
|
1
|
+
{"version":3,"file":"ActivityLogApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/activityLog/ActivityLogApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n ActivityLog,\n ActivityLogListQuery,\n CreateActivityLogPayload,\n UpdateActivityLogPayload,\n} from './types'\n\n/**\n * Activity log of the account (stored in MongoDB: the routes answer 503 when it is unavailable).\n * The backend serves `GET /log`, `GET /log/export-csv`, `GET /log/:id` and `POST /log`; there is no update\n * or delete, so an entry created is permanent. `GET /log/:id` takes a MongoDB\n * id (an UUID answers 500).\n */\nexport class ActivityLogApi extends BaseCrudApi<\n ActivityLog,\n CreateActivityLogPayload,\n UpdateActivityLogPayload,\n ActivityLogListQuery\n> {\n constructor(client: ApiClient) {\n super(client, '/log')\n }\n\n /**\n * Exports the entries of the period (`filters.from`/`filters.to`) as CSV, sent as the attachment\n * `exportation.csv`.\n */\n exportCsv(query: ActivityLogListQuery, headers?: Record<string, string>): Promise<string> {\n return this.client.get<string>(\n `${this.basePath}/export-csv${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /** @deprecated Not served: the backend has no PUT /log/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateActivityLogPayload,\n headers?: Record<string, string>,\n ): Promise<ActivityLog> {\n return super.updateById(id, body, headers)\n }\n\n /** @deprecated Not served: the backend has no DELETE /log/:id, so this route answers 404. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<ActivityLog> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;;;;;;;AAeA,IAAa,iBAAb,cAAoCA,qCAKlC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,OAAO;;;;;;CAOvB,UAAU,OAA6B,SAAmD;AACxF,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,aAAa,KAAK,cAAc,MAAM,IACvD,QACD;;;CAIH,AAAS,WACP,IACA,MACA,SACsB;AACtB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;CAI5C,AAAS,WAAW,IAAY,SAAwD;AACtF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
2
|
import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
3
|
-
import type { ActivityLog, CreateActivityLogPayload, UpdateActivityLogPayload } from './types';
|
|
3
|
+
import type { ActivityLog, ActivityLogListQuery, CreateActivityLogPayload, UpdateActivityLogPayload } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Activity log of the account (stored in MongoDB: the routes answer 503 when it is unavailable).
|
|
6
|
-
* The backend serves `GET /log`, `GET /log/:id` and `POST /log`; there is no update
|
|
6
|
+
* The backend serves `GET /log`, `GET /log/export-csv`, `GET /log/:id` and `POST /log`; there is no update
|
|
7
|
+
* or delete, so an entry created is permanent. `GET /log/:id` takes a MongoDB
|
|
8
|
+
* id (an UUID answers 500).
|
|
7
9
|
*/
|
|
8
|
-
export declare class ActivityLogApi extends BaseCrudApi<ActivityLog, CreateActivityLogPayload, UpdateActivityLogPayload> {
|
|
10
|
+
export declare class ActivityLogApi extends BaseCrudApi<ActivityLog, CreateActivityLogPayload, UpdateActivityLogPayload, ActivityLogListQuery> {
|
|
9
11
|
constructor(client: ApiClient);
|
|
12
|
+
/**
|
|
13
|
+
* Exports the entries of the period (`filters.from`/`filters.to`) as CSV, sent as the attachment
|
|
14
|
+
* `exportation.csv`.
|
|
15
|
+
*/
|
|
16
|
+
exportCsv(query: ActivityLogListQuery, headers?: Record<string, string>): Promise<string>;
|
|
10
17
|
/** @deprecated Not served: the backend has no PUT /log/:id, so this route answers 404. */
|
|
11
18
|
updateById(id: string, body: UpdateActivityLogPayload, headers?: Record<string, string>): Promise<ActivityLog>;
|
|
12
19
|
/** @deprecated Not served: the backend has no DELETE /log/:id, so this route answers 404. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityLogApi.d.ts","sourceRoot":"","sources":["../../../src/apis/activityLog/ActivityLogApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ActivityLogApi.d.ts","sourceRoot":"","sources":["../../../src/apis/activityLog/ActivityLogApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAEhB;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAC7C,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,CACrB;gBACa,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAOzF,0FAA0F;IACjF,UAAU,CACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,WAAW,CAAC;IAIvB,6FAA6F;IACpF,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;CAGxF"}
|
|
@@ -3,12 +3,21 @@ import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
|
|
|
3
3
|
//#region src/apis/activityLog/ActivityLogApi.ts
|
|
4
4
|
/**
|
|
5
5
|
* Activity log of the account (stored in MongoDB: the routes answer 503 when it is unavailable).
|
|
6
|
-
* The backend serves `GET /log`, `GET /log/:id` and `POST /log`; there is no update
|
|
6
|
+
* The backend serves `GET /log`, `GET /log/export-csv`, `GET /log/:id` and `POST /log`; there is no update
|
|
7
|
+
* or delete, so an entry created is permanent. `GET /log/:id` takes a MongoDB
|
|
8
|
+
* id (an UUID answers 500).
|
|
7
9
|
*/
|
|
8
10
|
var ActivityLogApi = class extends BaseCrudApi {
|
|
9
11
|
constructor(client) {
|
|
10
12
|
super(client, "/log");
|
|
11
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Exports the entries of the period (`filters.from`/`filters.to`) as CSV, sent as the attachment
|
|
16
|
+
* `exportation.csv`.
|
|
17
|
+
*/
|
|
18
|
+
exportCsv(query, headers) {
|
|
19
|
+
return this.client.get(`${this.basePath}/export-csv${this.toQueryString(query)}`, headers);
|
|
20
|
+
}
|
|
12
21
|
/** @deprecated Not served: the backend has no PUT /log/:id, so this route answers 404. */
|
|
13
22
|
updateById(id, body, headers) {
|
|
14
23
|
return super.updateById(id, body, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityLogApi.mjs","names":[],"sources":["../../../src/apis/activityLog/ActivityLogApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {
|
|
1
|
+
{"version":3,"file":"ActivityLogApi.mjs","names":[],"sources":["../../../src/apis/activityLog/ActivityLogApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n ActivityLog,\n ActivityLogListQuery,\n CreateActivityLogPayload,\n UpdateActivityLogPayload,\n} from './types'\n\n/**\n * Activity log of the account (stored in MongoDB: the routes answer 503 when it is unavailable).\n * The backend serves `GET /log`, `GET /log/export-csv`, `GET /log/:id` and `POST /log`; there is no update\n * or delete, so an entry created is permanent. `GET /log/:id` takes a MongoDB\n * id (an UUID answers 500).\n */\nexport class ActivityLogApi extends BaseCrudApi<\n ActivityLog,\n CreateActivityLogPayload,\n UpdateActivityLogPayload,\n ActivityLogListQuery\n> {\n constructor(client: ApiClient) {\n super(client, '/log')\n }\n\n /**\n * Exports the entries of the period (`filters.from`/`filters.to`) as CSV, sent as the attachment\n * `exportation.csv`.\n */\n exportCsv(query: ActivityLogListQuery, headers?: Record<string, string>): Promise<string> {\n return this.client.get<string>(\n `${this.basePath}/export-csv${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /** @deprecated Not served: the backend has no PUT /log/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateActivityLogPayload,\n headers?: Record<string, string>,\n ): Promise<ActivityLog> {\n return super.updateById(id, body, headers)\n }\n\n /** @deprecated Not served: the backend has no DELETE /log/:id, so this route answers 404. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<ActivityLog> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;;;;;;AAeA,IAAa,iBAAb,cAAoC,YAKlC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,OAAO;;;;;;CAOvB,UAAU,OAA6B,SAAmD;AACxF,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,aAAa,KAAK,cAAc,MAAM,IACvD,QACD;;;CAIH,AAAS,WACP,IACA,MACA,SACsB;AACtB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;CAI5C,AAAS,WAAW,IAAY,SAAwD;AACtF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
|
|
@@ -1,21 +1,61 @@
|
|
|
1
|
+
import type { ListQuery } from '../../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* An entry of the activity log (MongoDB). The stored fields are `resourceType`, `resourceId`, `event`,
|
|
4
|
+
* `userId`, `accessTokenId` and `data`. `create` and `getById` answer through a transformer that keeps only
|
|
5
|
+
* `id`, `accountId`, `createdAt` and `updatedAt`; the list answers every stored field plus `user`.
|
|
6
|
+
*/
|
|
1
7
|
export type ActivityLog = {
|
|
2
8
|
id: string;
|
|
3
9
|
accountId: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
resourceType?: string;
|
|
11
|
+
resourceId?: string | null;
|
|
12
|
+
event?: string;
|
|
13
|
+
userId?: string | null;
|
|
14
|
+
accessTokenId?: string | null;
|
|
15
|
+
data?: Record<string, unknown>;
|
|
9
16
|
createdAt: string;
|
|
10
17
|
updatedAt: string;
|
|
18
|
+
/** On the list: the user of the entry. */
|
|
19
|
+
user?: {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
};
|
|
23
|
+
/** @deprecated Not a field of the backend (it is dropped on create): use `event`. */
|
|
24
|
+
action?: string;
|
|
25
|
+
/** @deprecated Not a field of the backend (it is dropped on create): use `resourceType`. */
|
|
26
|
+
entity?: string;
|
|
27
|
+
/** @deprecated Not a field of the backend (it is dropped on create): use `resourceId`. */
|
|
28
|
+
entityId?: string | null;
|
|
11
29
|
};
|
|
12
30
|
export type CreateActivityLogPayload = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
resourceType?: string;
|
|
32
|
+
resourceId?: string;
|
|
33
|
+
event?: string;
|
|
34
|
+
userId?: string;
|
|
35
|
+
accessTokenId?: string;
|
|
16
36
|
data?: Record<string, unknown>;
|
|
37
|
+
/** @deprecated Dropped by the backend (not a field of the log): use `event`. */
|
|
38
|
+
action?: string;
|
|
39
|
+
/** @deprecated Dropped by the backend (not a field of the log): use `resourceType`. */
|
|
40
|
+
entity?: string;
|
|
41
|
+
/** @deprecated Dropped by the backend (not a field of the log): use `resourceId`. */
|
|
42
|
+
entityId?: string;
|
|
17
43
|
};
|
|
18
44
|
export type UpdateActivityLogPayload = {
|
|
19
45
|
data?: Record<string, unknown>;
|
|
20
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Query of the list and of the CSV export. The backend requires `filters.from` and `filters.to` (the
|
|
49
|
+
* period of `createdAt`); the other `filters` match the stored fields.
|
|
50
|
+
*/
|
|
51
|
+
export type ActivityLogListQuery = ListQuery<ActivityLog> & {
|
|
52
|
+
filters?: {
|
|
53
|
+
from?: string;
|
|
54
|
+
to?: string;
|
|
55
|
+
resourceType?: string;
|
|
56
|
+
resourceId?: string;
|
|
57
|
+
event?: string;
|
|
58
|
+
userId?: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
21
61
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/activityLog/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/activityLog/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACnC,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG;IAC1D,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA"}
|
|
@@ -4,8 +4,8 @@ const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
|
|
|
4
4
|
//#region src/apis/creditMovements/CreditMovementsApi.ts
|
|
5
5
|
/**
|
|
6
6
|
* Credit movements of the account (SMS and AI credits), only for reading: the writes are super
|
|
7
|
-
* admin routes (`/admin/credit-movements`).
|
|
8
|
-
*
|
|
7
|
+
* admin routes (`/admin/credit-movements`). Besides the list and the read by id, the backend serves the
|
|
8
|
+
* balances, the totals per connection and the xlsx export.
|
|
9
9
|
*/
|
|
10
10
|
var CreditMovementsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
11
11
|
constructor(client) {
|
|
@@ -23,6 +23,35 @@ var CreditMovementsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
23
23
|
deleteById(id, headers) {
|
|
24
24
|
return super.deleteById(id, headers);
|
|
25
25
|
}
|
|
26
|
+
/** The balance of each service type of the account. */
|
|
27
|
+
balances(headers) {
|
|
28
|
+
return this.client.get(`${this.basePath}/balances`, headers);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The balance of one service type (a read, despite the POST). Without `serviceType` the route answers 500.
|
|
32
|
+
*/
|
|
33
|
+
balance(serviceType, headers) {
|
|
34
|
+
return this.client.post(`${this.basePath}/balance`, { serviceType }, headers);
|
|
35
|
+
}
|
|
36
|
+
/** The balances of the period by service type and connection (`ins` without the trial credits). */
|
|
37
|
+
balancesV2(query, headers) {
|
|
38
|
+
return this.client.get(`${this.basePath}/v2/balances${this.toQueryString(query)}`, headers);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The total of credits of each connection in the period (five per page). Resolves `undefined` (no body)
|
|
42
|
+
* when `filters.from`, `filters.to`, `filters.serviceType` or `page` is missing.
|
|
43
|
+
*/
|
|
44
|
+
totalServices(query, headers) {
|
|
45
|
+
return this.client.get(`${this.basePath}/total-services${this.toQueryString(query)}`, headers);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Exports the movements of the period as an xlsx workbook (binary). Needs a client with `requestRaw`.
|
|
49
|
+
* Without `where.$and` the route answers 500.
|
|
50
|
+
*/
|
|
51
|
+
async exportXlsx(query, headers) {
|
|
52
|
+
if (!this.client.requestRaw) throw new Error("exportXlsx needs a client with requestRaw (the answer is a binary xlsx)");
|
|
53
|
+
return (await this.client.requestRaw("GET", `${this.basePath}/export${this.toQueryString(query)}`, void 0, headers)).arrayBuffer();
|
|
54
|
+
}
|
|
26
55
|
};
|
|
27
56
|
|
|
28
57
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreditMovementsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/creditMovements/CreditMovementsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n CreditMovement,\n CreateCreditMovementPayload,\n UpdateCreditMovementPayload,\n} from './types'\n\n/**\n * Credit movements of the account (SMS and AI credits), only for reading: the writes are super\n * admin routes (`/admin/credit-movements`).
|
|
1
|
+
{"version":3,"file":"CreditMovementsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/creditMovements/CreditMovementsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n CreditMovement,\n CreateCreditMovementPayload,\n UpdateCreditMovementPayload,\n CreditBalances,\n CreditBalanceV2,\n CreditBalancesV2Query,\n CreditMovementServiceType,\n CreditMovementsExportQuery,\n CreditTotalServices,\n CreditTotalServicesQuery,\n} from './types'\n\n/**\n * Credit movements of the account (SMS and AI credits), only for reading: the writes are super\n * admin routes (`/admin/credit-movements`). Besides the list and the read by id, the backend serves the\n * balances, the totals per connection and the xlsx export.\n */\nexport class CreditMovementsApi extends BaseCrudApi<\n CreditMovement,\n CreateCreditMovementPayload,\n UpdateCreditMovementPayload\n> {\n constructor(client: ApiClient) {\n super(client, '/credit-movements')\n }\n\n /** @deprecated Not served: the backend has no POST /credit-movements, so this route answers 404. */\n override create(\n body: CreateCreditMovementPayload,\n headers?: Record<string, string>,\n ): Promise<CreditMovement> {\n return super.create(body, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /credit-movements/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateCreditMovementPayload,\n headers?: Record<string, string>,\n ): Promise<CreditMovement> {\n return super.updateById(id, body, headers)\n }\n\n /** @deprecated Not served: the backend has no DELETE /credit-movements/:id, so this route answers 404. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<CreditMovement> {\n return super.deleteById(id, headers)\n }\n\n /** The balance of each service type of the account. */\n balances(headers?: Record<string, string>): Promise<CreditBalances> {\n return this.client.get<CreditBalances>(`${this.basePath}/balances`, headers)\n }\n\n /**\n * The balance of one service type (a read, despite the POST). Without `serviceType` the route answers 500.\n */\n balance(\n serviceType: CreditMovementServiceType,\n headers?: Record<string, string>,\n ): Promise<number> {\n return this.client.post<number, { serviceType: CreditMovementServiceType }>(\n `${this.basePath}/balance`,\n { serviceType },\n headers,\n )\n }\n\n /** The balances of the period by service type and connection (`ins` without the trial credits). */\n balancesV2(\n query?: CreditBalancesV2Query,\n headers?: Record<string, string>,\n ): Promise<Record<CreditMovementServiceType, CreditBalanceV2>> {\n return this.client.get<Record<CreditMovementServiceType, CreditBalanceV2>>(\n `${this.basePath}/v2/balances${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * The total of credits of each connection in the period (five per page). Resolves `undefined` (no body)\n * when `filters.from`, `filters.to`, `filters.serviceType` or `page` is missing.\n */\n totalServices(\n query: CreditTotalServicesQuery,\n headers?: Record<string, string>,\n ): Promise<CreditTotalServices | undefined> {\n return this.client.get<CreditTotalServices | undefined>(\n `${this.basePath}/total-services${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Exports the movements of the period as an xlsx workbook (binary). Needs a client with `requestRaw`.\n * Without `where.$and` the route answers 500.\n */\n async exportXlsx(\n query: CreditMovementsExportQuery,\n headers?: Record<string, string>,\n ): Promise<ArrayBuffer> {\n if (!this.client.requestRaw) {\n throw new Error('exportXlsx needs a client with requestRaw (the answer is a binary xlsx)')\n }\n const response = await this.client.requestRaw(\n 'GET',\n `${this.basePath}/export${this.toQueryString(query)}`,\n undefined,\n headers,\n )\n return response.arrayBuffer()\n }\n}\n"],"mappings":";;;;;;;;;AAoBA,IAAa,qBAAb,cAAwCA,qCAItC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,oBAAoB;;;CAIpC,AAAS,OACP,MACA,SACyB;AACzB,SAAO,MAAM,OAAO,MAAM,QAAQ;;;CAIpC,AAAS,WACP,IACA,MACA,SACyB;AACzB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;CAI5C,AAAS,WAAW,IAAY,SAA2D;AACzF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;CAItC,SAAS,SAA2D;AAClE,SAAO,KAAK,OAAO,IAAoB,GAAG,KAAK,SAAS,YAAY,QAAQ;;;;;CAM9E,QACE,aACA,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,WACjB,EAAE,aAAa,EACf,QACD;;;CAIH,WACE,OACA,SAC6D;AAC7D,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,cAAc,KAAK,cAAc,MAAM,IACxD,QACD;;;;;;CAOH,cACE,OACA,SAC0C;AAC1C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,iBAAiB,KAAK,cAAc,MAAM,IAC3D,QACD;;;;;;CAOH,MAAM,WACJ,OACA,SACsB;AACtB,MAAI,CAAC,KAAK,OAAO,WACf,OAAM,IAAI,MAAM,0EAA0E;AAQ5F,UANiB,MAAM,KAAK,OAAO,WACjC,OACA,GAAG,KAAK,SAAS,SAAS,KAAK,cAAc,MAAM,IACnD,QACA,QACD,EACe,aAAa"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
2
|
import { BaseCrudApi } from '../../core/BaseCrudApi';
|
|
3
|
-
import type { CreditMovement, CreateCreditMovementPayload, UpdateCreditMovementPayload } from './types';
|
|
3
|
+
import type { CreditMovement, CreateCreditMovementPayload, UpdateCreditMovementPayload, CreditBalances, CreditBalanceV2, CreditBalancesV2Query, CreditMovementServiceType, CreditMovementsExportQuery, CreditTotalServices, CreditTotalServicesQuery } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Credit movements of the account (SMS and AI credits), only for reading: the writes are super
|
|
6
|
-
* admin routes (`/admin/credit-movements`).
|
|
7
|
-
*
|
|
6
|
+
* admin routes (`/admin/credit-movements`). Besides the list and the read by id, the backend serves the
|
|
7
|
+
* balances, the totals per connection and the xlsx export.
|
|
8
8
|
*/
|
|
9
9
|
export declare class CreditMovementsApi extends BaseCrudApi<CreditMovement, CreateCreditMovementPayload, UpdateCreditMovementPayload> {
|
|
10
10
|
constructor(client: ApiClient);
|
|
@@ -14,5 +14,23 @@ export declare class CreditMovementsApi extends BaseCrudApi<CreditMovement, Crea
|
|
|
14
14
|
updateById(id: string, body: UpdateCreditMovementPayload, headers?: Record<string, string>): Promise<CreditMovement>;
|
|
15
15
|
/** @deprecated Not served: the backend has no DELETE /credit-movements/:id, so this route answers 404. */
|
|
16
16
|
deleteById(id: string, headers?: Record<string, string>): Promise<CreditMovement>;
|
|
17
|
+
/** The balance of each service type of the account. */
|
|
18
|
+
balances(headers?: Record<string, string>): Promise<CreditBalances>;
|
|
19
|
+
/**
|
|
20
|
+
* The balance of one service type (a read, despite the POST). Without `serviceType` the route answers 500.
|
|
21
|
+
*/
|
|
22
|
+
balance(serviceType: CreditMovementServiceType, headers?: Record<string, string>): Promise<number>;
|
|
23
|
+
/** The balances of the period by service type and connection (`ins` without the trial credits). */
|
|
24
|
+
balancesV2(query?: CreditBalancesV2Query, headers?: Record<string, string>): Promise<Record<CreditMovementServiceType, CreditBalanceV2>>;
|
|
25
|
+
/**
|
|
26
|
+
* The total of credits of each connection in the period (five per page). Resolves `undefined` (no body)
|
|
27
|
+
* when `filters.from`, `filters.to`, `filters.serviceType` or `page` is missing.
|
|
28
|
+
*/
|
|
29
|
+
totalServices(query: CreditTotalServicesQuery, headers?: Record<string, string>): Promise<CreditTotalServices | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* Exports the movements of the period as an xlsx workbook (binary). Needs a client with `requestRaw`.
|
|
32
|
+
* Without `where.$and` the route answers 500.
|
|
33
|
+
*/
|
|
34
|
+
exportXlsx(query: CreditMovementsExportQuery, headers?: Record<string, string>): Promise<ArrayBuffer>;
|
|
17
35
|
}
|
|
18
36
|
//# sourceMappingURL=CreditMovementsApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreditMovementsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/creditMovements/CreditMovementsApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,cAAc,EACd,2BAA2B,EAC3B,2BAA2B,
|
|
1
|
+
{"version":3,"file":"CreditMovementsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/creditMovements/CreditMovementsApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,cAAc,EACd,2BAA2B,EAC3B,2BAA2B,EAC3B,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,WAAW,CACjD,cAAc,EACd,2BAA2B,EAC3B,2BAA2B,CAC5B;gBACa,MAAM,EAAE,SAAS;IAI7B,oGAAoG;IAC3F,MAAM,CACb,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC;IAI1B,uGAAuG;IAC9F,UAAU,CACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC;IAI1B,0GAA0G;IACjG,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAI1F,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAInE;;OAEG;IACH,OAAO,CACL,WAAW,EAAE,yBAAyB,EACtC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC;IAQlB,mGAAmG;IACnG,UAAU,CACR,KAAK,CAAC,EAAE,qBAAqB,EAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;IAO9D;;;OAGG;IACH,aAAa,CACX,KAAK,EAAE,wBAAwB,EAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAO3C;;;OAGG;IACG,UAAU,CACd,KAAK,EAAE,0BAA0B,EACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,WAAW,CAAC;CAYxB"}
|