@ikatec/digisac-api-sdk 4.1.0 → 4.3.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/README.md +7 -4
- package/dist/apis/authHistory/AuthHistoryApi.cjs +12 -12
- package/dist/apis/authHistory/AuthHistoryApi.cjs.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.d.ts +12 -19
- package/dist/apis/authHistory/AuthHistoryApi.d.ts.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.mjs +12 -12
- package/dist/apis/authHistory/AuthHistoryApi.mjs.map +1 -1
- package/dist/apis/authHistory/types.d.ts +4 -3
- package/dist/apis/authHistory/types.d.ts.map +1 -1
- package/dist/apis/customFields/types.d.ts +21 -19
- package/dist/apis/customFields/types.d.ts.map +1 -1
- package/dist/apis/dashboard/DashboardApi.cjs +54 -0
- package/dist/apis/dashboard/DashboardApi.cjs.map +1 -0
- package/dist/apis/dashboard/DashboardApi.d.ts +65 -0
- package/dist/apis/dashboard/DashboardApi.d.ts.map +1 -0
- package/dist/apis/dashboard/DashboardApi.mjs +53 -0
- package/dist/apis/dashboard/DashboardApi.mjs.map +1 -0
- package/dist/apis/dashboard/index.cjs +4 -0
- package/dist/apis/dashboard/index.d.ts +3 -0
- package/dist/apis/dashboard/index.d.ts.map +1 -0
- package/dist/apis/dashboard/index.mjs +3 -0
- package/dist/apis/dashboard/types.cjs +0 -0
- package/dist/apis/dashboard/types.d.ts +124 -0
- package/dist/apis/dashboard/types.d.ts.map +1 -0
- package/dist/apis/dashboard/types.mjs +0 -0
- package/dist/apis/holiday/types.d.ts +34 -8
- package/dist/apis/holiday/types.d.ts.map +1 -1
- package/dist/apis/index.cjs +6 -0
- package/dist/apis/index.d.ts +2 -0
- package/dist/apis/index.d.ts.map +1 -1
- package/dist/apis/index.mjs +5 -1
- package/dist/apis/now/NowApi.cjs +37 -0
- package/dist/apis/now/NowApi.cjs.map +1 -0
- package/dist/apis/now/NowApi.d.ts +26 -0
- package/dist/apis/now/NowApi.d.ts.map +1 -0
- package/dist/apis/now/NowApi.mjs +36 -0
- package/dist/apis/now/NowApi.mjs.map +1 -0
- package/dist/apis/now/index.cjs +4 -0
- package/dist/apis/now/index.d.ts +3 -0
- package/dist/apis/now/index.d.ts.map +1 -0
- package/dist/apis/now/index.mjs +3 -0
- package/dist/apis/now/types.cjs +0 -0
- package/dist/apis/now/types.d.ts +45 -0
- package/dist/apis/now/types.d.ts.map +1 -0
- package/dist/apis/now/types.mjs +0 -0
- package/dist/apis/people/types.d.ts +7 -2
- package/dist/apis/people/types.d.ts.map +1 -1
- package/dist/apis/permissions/PermissionsApi.cjs +6 -2
- package/dist/apis/permissions/PermissionsApi.cjs.map +1 -1
- package/dist/apis/permissions/PermissionsApi.d.ts +7 -3
- package/dist/apis/permissions/PermissionsApi.d.ts.map +1 -1
- package/dist/apis/permissions/PermissionsApi.mjs +6 -2
- package/dist/apis/permissions/PermissionsApi.mjs.map +1 -1
- package/dist/apis/permissions/types.d.ts +4 -14
- package/dist/apis/permissions/types.d.ts.map +1 -1
- package/dist/apis/personalAccessTokens/PersonalAccessTokensApi.cjs +5 -0
- package/dist/apis/personalAccessTokens/PersonalAccessTokensApi.cjs.map +1 -1
- package/dist/apis/personalAccessTokens/PersonalAccessTokensApi.d.ts +5 -0
- package/dist/apis/personalAccessTokens/PersonalAccessTokensApi.d.ts.map +1 -1
- package/dist/apis/personalAccessTokens/PersonalAccessTokensApi.mjs +5 -0
- package/dist/apis/personalAccessTokens/PersonalAccessTokensApi.mjs.map +1 -1
- package/dist/apis/personalAccessTokens/types.d.ts +23 -4
- package/dist/apis/personalAccessTokens/types.d.ts.map +1 -1
- package/dist/apis/roles/RolesApi.cjs.map +1 -1
- package/dist/apis/roles/RolesApi.d.ts +2 -2
- package/dist/apis/roles/RolesApi.d.ts.map +1 -1
- package/dist/apis/roles/RolesApi.mjs.map +1 -1
- package/dist/apis/roles/types.d.ts +27 -4
- package/dist/apis/roles/types.d.ts.map +1 -1
- package/dist/apis/terms/TermsApi.cjs +4 -1
- package/dist/apis/terms/TermsApi.cjs.map +1 -1
- package/dist/apis/terms/TermsApi.d.ts +4 -1
- package/dist/apis/terms/TermsApi.d.ts.map +1 -1
- package/dist/apis/terms/TermsApi.mjs +4 -1
- package/dist/apis/terms/TermsApi.mjs.map +1 -1
- package/dist/apis/timetable/types.d.ts +12 -7
- package/dist/apis/timetable/types.d.ts.map +1 -1
- package/dist/core/BaseCrudApi.cjs +3 -30
- package/dist/core/BaseCrudApi.cjs.map +1 -1
- package/dist/core/BaseCrudApi.d.ts +4 -24
- package/dist/core/BaseCrudApi.d.ts.map +1 -1
- package/dist/core/BaseCrudApi.mjs +3 -30
- package/dist/core/BaseCrudApi.mjs.map +1 -1
- package/dist/core/BaseReadApi.cjs +44 -0
- package/dist/core/BaseReadApi.cjs.map +1 -0
- package/dist/core/BaseReadApi.d.ts +32 -0
- package/dist/core/BaseReadApi.d.ts.map +1 -0
- package/dist/core/BaseReadApi.mjs +43 -0
- package/dist/core/BaseReadApi.mjs.map +1 -0
- package/dist/core/index.cjs +2 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.mjs +2 -1
- package/dist/index.cjs +2 -0
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
- package/src/apis/authHistory/AuthHistoryApi.test.ts +10 -2
- package/src/apis/authHistory/AuthHistoryApi.ts +13 -39
- package/src/apis/authHistory/types.ts +4 -3
- package/src/apis/customFields/types.ts +21 -25
- package/src/apis/dashboard/DashboardApi.test-d.ts +49 -0
- package/src/apis/dashboard/DashboardApi.test.ts +270 -0
- package/src/apis/dashboard/DashboardApi.ts +146 -0
- package/src/apis/dashboard/index.ts +2 -0
- package/src/apis/dashboard/types.ts +131 -0
- package/src/apis/holiday/types.ts +36 -8
- package/src/apis/index.ts +2 -0
- package/src/apis/now/NowApi.test.ts +125 -0
- package/src/apis/now/NowApi.ts +59 -0
- package/src/apis/now/index.ts +2 -0
- package/src/apis/now/types.ts +47 -0
- package/src/apis/payloads.test-d.ts +39 -0
- package/src/apis/payloads.test.ts +81 -0
- package/src/apis/people/types.ts +7 -2
- package/src/apis/permissions/PermissionsApi.test.ts +93 -0
- package/src/apis/permissions/PermissionsApi.ts +7 -7
- package/src/apis/permissions/types.ts +4 -16
- package/src/apis/personalAccessTokens/PersonalAccessTokensApi.ts +5 -0
- package/src/apis/personalAccessTokens/types.ts +25 -4
- package/src/apis/queryFormat.test.ts +139 -0
- package/src/apis/roles/RolesApi.ts +7 -2
- package/src/apis/roles/types.ts +27 -4
- package/src/apis/terms/TermsApi.ts +4 -1
- package/src/apis/timetable/types.ts +13 -7
- package/src/core/BaseCrudApi.ts +4 -60
- package/src/core/BaseReadApi.ts +70 -0
- package/src/core/index.ts +1 -0
package/README.md
CHANGED
|
@@ -55,13 +55,14 @@ The SDK is structured in two layers:
|
|
|
55
55
|
| `ApiClient.ts` | Interface defining `setAccessToken` and HTTP methods (`get`, `post`, `put`, `patch`, `delete`, `request`) |
|
|
56
56
|
| `BaseApiClient.ts` | `fetch`-based implementation of `ApiClient`. Handles JSON serialization and error parsing into `ApiError`. Automatically injects `Authorization: Bearer` header when an access token is set |
|
|
57
57
|
| `BaseApi.ts` | Base of every API class: holds the `client`, binds the methods to the instance (so they can be destructured) and provides `withQueryFormat` |
|
|
58
|
-
| `
|
|
58
|
+
| `BaseReadApi.ts` | Generic read-only class (extends `BaseApi`) providing `basePath`, `getMany`, `getOne`, `getById`. Base of the resources the backend only serves for reading |
|
|
59
|
+
| `BaseCrudApi.ts` | Generic class (extends `BaseReadApi`) adding `create`, `updateById`, `deleteById` |
|
|
59
60
|
| `types.ts` | Shared types: `WhereClause<T>`, `ListQuery<T>`, `Paginated<T>`, `IncludeItem<T>` |
|
|
60
61
|
|
|
61
62
|
### API Resources (`src/apis/<resource>/`)
|
|
62
63
|
|
|
63
64
|
Each resource has its own folder with:
|
|
64
|
-
- `<Resource>Api.ts` — extends `BaseCrudApi` with the resource path and type parameters (or `BaseApi` for resources without CRUD routes)
|
|
65
|
+
- `<Resource>Api.ts` — extends `BaseCrudApi` with the resource path and type parameters (`BaseReadApi` for read-only resources, or `BaseApi` for resources without CRUD routes)
|
|
65
66
|
- `types.ts` — TypeScript types for the resource model, create payload, and update payload
|
|
66
67
|
- `index.ts` — barrel file re-exporting the API class and all types
|
|
67
68
|
|
|
@@ -80,7 +81,7 @@ Available resources:
|
|
|
80
81
|
| Accounts | `AccountsApi` | `/accounts` |
|
|
81
82
|
| Activity Log | `ActivityLogApi` | `/activity-log` |
|
|
82
83
|
| Answers | `AnswersApi` | `/answers` |
|
|
83
|
-
| Auth History | `AuthHistoryApi` | `/auth-history` |
|
|
84
|
+
| Auth History (read-only) | `AuthHistoryApi` | `/auth-history` |
|
|
84
85
|
| Bot Versions | `BotVersionsApi` | `/bot-versions` |
|
|
85
86
|
| Bots | `BotsApi` | `/bots` |
|
|
86
87
|
| Campaigns | `CampaignsApi` | `/campaigns` |
|
|
@@ -92,6 +93,7 @@ Available resources:
|
|
|
92
93
|
| Contacts | `ContactsApi` | `/contacts` |
|
|
93
94
|
| Credit Movements | `CreditMovementsApi` | `/credit-movements` |
|
|
94
95
|
| Custom Fields | `CustomFieldsApi` | `/custom-fields` |
|
|
96
|
+
| Dashboard | `DashboardApi` | `/dashboard` |
|
|
95
97
|
| Departments | `DepartmentsApi` | `/departments` |
|
|
96
98
|
| Distribution | `DistributionApi` | `/distribution` |
|
|
97
99
|
| Files | `FilesApi` | `/files` |
|
|
@@ -106,9 +108,10 @@ Available resources:
|
|
|
106
108
|
| Me | `MeApi` | `/me` |
|
|
107
109
|
| Messages | `MessagesApi` | `/messages` |
|
|
108
110
|
| Notifications | `NotificationsApi` | `/notifications` |
|
|
111
|
+
| Now ("Agora") | `NowApi` | `/now` |
|
|
109
112
|
| Organizations | `OrganizationsApi` | `/organizations` |
|
|
110
113
|
| People | `PeopleApi` | `/people` |
|
|
111
|
-
| Permissions | `PermissionsApi` | `/permissions` |
|
|
114
|
+
| Permissions (read-only) | `PermissionsApi` | `/permissions` |
|
|
112
115
|
| Personal Access Tokens | `PersonalAccessTokensApi` | `/personal-access-tokens` |
|
|
113
116
|
| Pipelines | `PipelineApi` | `/pipelines` |
|
|
114
117
|
| Plan AI History | `PlanAiHistoryApi` | `/plan-ai-history` |
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_core_BaseReadApi = require('../../core/BaseReadApi.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/apis/authHistory/AuthHistoryApi.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Authentication events (auth, password_change, logout), read-only (guarded by
|
|
7
|
+
* `authHistory.view`). Non-admin users can only see and access their own records.
|
|
8
|
+
*
|
|
9
|
+
* Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as
|
|
10
|
+
* `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent
|
|
11
|
+
* as the query string — move them to the third argument.
|
|
12
|
+
*/
|
|
13
|
+
var AuthHistoryApi = class extends require_core_BaseReadApi.BaseReadApi {
|
|
14
|
+
constructor(client) {
|
|
15
|
+
super(client, "/auth-history");
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHistoryApi.cjs","names":["
|
|
1
|
+
{"version":3,"file":"AuthHistoryApi.cjs","names":["BaseReadApi"],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseReadApi } from '../../core/BaseReadApi'\nimport type { AuthHistory } from './types'\n\n/**\n * Authentication events (auth, password_change, logout), read-only (guarded by\n * `authHistory.view`). Non-admin users can only see and access their own records.\n *\n * Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as\n * `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent\n * as the query string — move them to the third argument.\n */\nexport class AuthHistoryApi extends BaseReadApi<AuthHistory> {\n constructor(client: ApiClient) {\n super(client, '/auth-history')\n }\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IAAa,iBAAb,cAAoCA,qCAAyB;CAC3D,YAAY,QAAmB;AAC7B,QAAM,QAAQ,gBAAgB"}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { ApiClient } from '../../core/ApiClient';
|
|
2
|
+
import { BaseReadApi } from '../../core/BaseReadApi';
|
|
3
3
|
import type { AuthHistory } from './types';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}, headers?: Record<string, string>): Promise<Paginated<AuthHistory>>;
|
|
15
|
-
getMany(query?: ListQuery<AuthHistory>, headers?: Record<string, string>): Promise<Paginated<AuthHistory> | AuthHistory[]>;
|
|
16
|
-
/**
|
|
17
|
-
* Returns a single authentication event by its ID. Non-admin users can only access their own records.
|
|
18
|
-
* @permissions authHistory.view
|
|
19
|
-
*/
|
|
20
|
-
getById(id: string, headers?: Record<string, string>): Promise<AuthHistory>;
|
|
4
|
+
/**
|
|
5
|
+
* Authentication events (auth, password_change, logout), read-only (guarded by
|
|
6
|
+
* `authHistory.view`). Non-admin users can only see and access their own records.
|
|
7
|
+
*
|
|
8
|
+
* Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as
|
|
9
|
+
* `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent
|
|
10
|
+
* as the query string — move them to the third argument.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AuthHistoryApi extends BaseReadApi<AuthHistory> {
|
|
13
|
+
constructor(client: ApiClient);
|
|
21
14
|
}
|
|
22
15
|
//# sourceMappingURL=AuthHistoryApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHistoryApi.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AuthHistoryApi.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,WAAW,CAAC;gBAC9C,MAAM,EAAE,SAAS;CAG9B"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseReadApi } from "../../core/BaseReadApi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/apis/authHistory/AuthHistoryApi.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Authentication events (auth, password_change, logout), read-only (guarded by
|
|
6
|
+
* `authHistory.view`). Non-admin users can only see and access their own records.
|
|
7
|
+
*
|
|
8
|
+
* Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as
|
|
9
|
+
* `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent
|
|
10
|
+
* as the query string — move them to the third argument.
|
|
11
|
+
*/
|
|
12
|
+
var AuthHistoryApi = class extends BaseReadApi {
|
|
13
|
+
constructor(client) {
|
|
14
|
+
super(client, "/auth-history");
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHistoryApi.mjs","names":[],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"AuthHistoryApi.mjs","names":[],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseReadApi } from '../../core/BaseReadApi'\nimport type { AuthHistory } from './types'\n\n/**\n * Authentication events (auth, password_change, logout), read-only (guarded by\n * `authHistory.view`). Non-admin users can only see and access their own records.\n *\n * Since 4.2 `getById` has the base signature `(id, query?, headers?)`: a call written as\n * `getById(id, headers)` with the headers in a variable still compiles, but the headers are sent\n * as the query string — move them to the third argument.\n */\nexport class AuthHistoryApi extends BaseReadApi<AuthHistory> {\n constructor(client: ApiClient) {\n super(client, '/auth-history')\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAa,iBAAb,cAAoC,YAAyB;CAC3D,YAAY,QAAmB;AAC7B,QAAM,QAAQ,gBAAgB"}
|
|
@@ -6,9 +6,10 @@ export type AuthHistory = {
|
|
|
6
6
|
event: AuthHistoryEvent;
|
|
7
7
|
userId: string;
|
|
8
8
|
accountId: string;
|
|
9
|
-
|
|
10
|
-
originIP: string;
|
|
11
|
-
|
|
9
|
+
/** Nullable in the database. */
|
|
10
|
+
originIP: string | null;
|
|
11
|
+
/** Nullable in the database. */
|
|
12
|
+
originUA: string | null;
|
|
12
13
|
createdAt: string;
|
|
13
14
|
updatedAt: string;
|
|
14
15
|
account?: Account;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,iBAAiB,GAAG,QAAQ,CAAA;AAEpE,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,gBAAgB,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,iBAAiB,GAAG,QAAQ,CAAA;AAEpE,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,gBAAgB,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IAEjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,MAAM,CAAA"}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
export type CustomFieldType = 'cpf' | 'cnpj' | 'email' | 'date' | 'date-range' | 'hour' | 'hour-range' | 'type' | 'text' | 'long-text' | 'numeric' | 'monetary' | 'phone' | 'postal-code' | 'checkbox' | 'list';
|
|
2
2
|
export type CustomFieldOption = {
|
|
3
|
-
id?: string;
|
|
4
|
-
label?: string;
|
|
3
|
+
id?: string | null;
|
|
4
|
+
label?: string | null;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Settings of a custom field — a free JSONB the backend does not validate, echoed back as sent.
|
|
8
|
+
* The fields below are the ones the web app form sends (`front/src/pages/custom-fields/components/
|
|
9
|
+
* form.tsx`): `options` for the `list` and `checkbox` types, `min`/`max` for `numeric` and `monetary`,
|
|
10
|
+
* `currency` for `monetary`, `maxLength` for `text` and `long-text`, and `placeholder` for the inputs.
|
|
11
|
+
*/
|
|
12
|
+
export type CustomFieldSettings = {
|
|
13
|
+
options?: CustomFieldOption[];
|
|
14
|
+
placeholder?: string | null;
|
|
15
|
+
currency?: string | null;
|
|
16
|
+
maxLength?: number | null;
|
|
17
|
+
min?: string | null;
|
|
18
|
+
max?: string | null;
|
|
9
19
|
};
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
max?: string;
|
|
15
|
-
};
|
|
16
|
-
/** Settings for `text` and `long-text` types: optional max length constraint. */
|
|
17
|
-
export type CustomFieldTextSettings = {
|
|
18
|
-
options: CustomFieldOption[];
|
|
19
|
-
maxLength?: number;
|
|
20
|
-
};
|
|
21
|
-
export type CustomFieldSettings = CustomFieldListSettings | CustomFieldMonetarySettings | CustomFieldTextSettings;
|
|
20
|
+
/**
|
|
21
|
+
* A custom field of the account. Custom fields are soft-deleted, but `deletedAt` is never returned
|
|
22
|
+
* (customFieldsTransformer).
|
|
23
|
+
*/
|
|
22
24
|
export type CustomField = {
|
|
23
25
|
id: string;
|
|
24
26
|
name: string;
|
|
@@ -30,7 +32,6 @@ export type CustomField = {
|
|
|
30
32
|
accountId: string;
|
|
31
33
|
createdAt: string;
|
|
32
34
|
updatedAt: string;
|
|
33
|
-
deletedAt: string | null;
|
|
34
35
|
};
|
|
35
36
|
export type CreateCustomFieldPayload = {
|
|
36
37
|
name: string;
|
|
@@ -38,11 +39,12 @@ export type CreateCustomFieldPayload = {
|
|
|
38
39
|
allowed: 'contacts';
|
|
39
40
|
showOnRegister?: boolean;
|
|
40
41
|
required?: boolean;
|
|
41
|
-
settings?: CustomFieldSettings;
|
|
42
|
+
settings?: CustomFieldSettings | null;
|
|
42
43
|
};
|
|
43
44
|
export type UpdateCustomFieldPayload = {
|
|
44
45
|
name?: string;
|
|
45
46
|
type?: CustomFieldType;
|
|
47
|
+
allowed?: 'contacts';
|
|
46
48
|
showOnRegister?: boolean;
|
|
47
49
|
required?: boolean;
|
|
48
50
|
settings?: CustomFieldSettings | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/customFields/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,KAAK,GACL,MAAM,GACN,OAAO,GACP,MAAM,GACN,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,MAAM,GACN,MAAM,GACN,WAAW,GACX,SAAS,GACT,UAAU,GACV,OAAO,GACP,aAAa,GACb,UAAU,GACV,MAAM,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/customFields/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,KAAK,GACL,MAAM,GACN,OAAO,GACP,MAAM,GACN,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,MAAM,GACN,MAAM,GACN,WAAW,GACX,SAAS,GACT,UAAU,GACV,OAAO,GACP,aAAa,GACb,UAAU,GACV,MAAM,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,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54 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_core_BaseApi = require('../../core/BaseApi.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/apis/dashboard/DashboardApi.ts
|
|
5
|
+
/**
|
|
6
|
+
* Service statistics ("Estatísticas de atendimento"). The `/dashboard` routes only require an
|
|
7
|
+
* authenticated user (no permission check). Every route takes the same {@link DashboardQuery}
|
|
8
|
+
* filters; the grouped routes answer one item per day, user, department, topic or connection.
|
|
9
|
+
*/
|
|
10
|
+
var DashboardApi = class extends require_core_BaseApi.BaseApi {
|
|
11
|
+
basePath = "/dashboard";
|
|
12
|
+
/** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */
|
|
13
|
+
getGeneral(query, headers) {
|
|
14
|
+
return this.client.get(`${this.basePath}/general${this.toQueryString(query)}`, headers);
|
|
15
|
+
}
|
|
16
|
+
getByPeriod(query, headers) {
|
|
17
|
+
return this.getGrouped("by-period", query, headers);
|
|
18
|
+
}
|
|
19
|
+
getByUser(query, headers) {
|
|
20
|
+
return this.getGrouped("by-user", query, headers);
|
|
21
|
+
}
|
|
22
|
+
getByDepartment(query, headers) {
|
|
23
|
+
return this.getGrouped("by-department", query, headers);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The counts of each ticket topic of the period (`GET /dashboard/by-topic`). Does not take
|
|
27
|
+
* `withTotals` (the backend ignores it).
|
|
28
|
+
*/
|
|
29
|
+
getByTopic(query, headers) {
|
|
30
|
+
return this.client.get(`${this.basePath}/by-topic${this.toQueryString(query)}`, headers);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The counts of each connection of the period (`GET /dashboard/by-service`). Does not take
|
|
34
|
+
* `withTotals` (the backend ignores it).
|
|
35
|
+
*/
|
|
36
|
+
getByService(query, headers) {
|
|
37
|
+
return this.client.get(`${this.basePath}/by-service${this.toQueryString(query)}`, headers);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* `withTotals` is only sent when `true`: the backend reads it with a truthiness check, so in the
|
|
41
|
+
* `qs` format a serialized `withTotals=false` (the string `'false'`) would wrap the answer anyway.
|
|
42
|
+
*/
|
|
43
|
+
getGrouped(route, query, headers) {
|
|
44
|
+
const { withTotals, ...filters } = query ?? {};
|
|
45
|
+
return this.client.get(`${this.basePath}/${route}${this.toQueryString(withTotals ? {
|
|
46
|
+
...filters,
|
|
47
|
+
withTotals: true
|
|
48
|
+
} : filters)}`, headers);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.DashboardApi = DashboardApi;
|
|
54
|
+
//# sourceMappingURL=DashboardApi.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/dashboard/DashboardApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type {\n DashboardDepartmentItem,\n DashboardGeneral,\n DashboardGrouped,\n DashboardPeriodItem,\n DashboardQuery,\n DashboardServiceItem,\n DashboardTopicItem,\n DashboardUserItem,\n DashboardWithTotals,\n} from './types'\n\n/**\n * Service statistics (\"Estatísticas de atendimento\"). The `/dashboard` routes only require an\n * authenticated user (no permission check). Every route takes the same {@link DashboardQuery}\n * filters; the grouped routes answer one item per day, user, department, topic or connection.\n */\nexport class DashboardApi extends BaseApi {\n public readonly basePath = '/dashboard'\n\n /** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */\n getGeneral(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardGeneral> {\n return this.client.get<DashboardGeneral>(\n `${this.basePath}/general${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * The counts of each bucket of the period (`GET /dashboard/by-period`): one item per day by default,\n * or per `grouping` (hour, week, month, year). With `withTotals: true` the answer is\n * `{ totals, items }`.\n */\n getByPeriod(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardPeriodItem>>\n getByPeriod(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByPeriod(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[] | DashboardGrouped<DashboardPeriodItem>>\n getByPeriod(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[] | DashboardGrouped<DashboardPeriodItem>> {\n return this.getGrouped<DashboardPeriodItem>('by-period', query, headers)\n }\n\n /**\n * The counts of each user of the period (`GET /dashboard/by-user`). With `withTotals: true` the\n * answer is `{ totals, items }`.\n */\n getByUser(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardUserItem>>\n getByUser(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByUser(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[] | DashboardGrouped<DashboardUserItem>>\n getByUser(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[] | DashboardGrouped<DashboardUserItem>> {\n return this.getGrouped<DashboardUserItem>('by-user', query, headers)\n }\n\n /**\n * The counts of each department of the period (`GET /dashboard/by-department`). With\n * `withTotals: true` the answer is `{ totals, items }`.\n */\n getByDepartment(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardDepartmentItem>>\n getByDepartment(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByDepartment(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[] | DashboardGrouped<DashboardDepartmentItem>>\n getByDepartment(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[] | DashboardGrouped<DashboardDepartmentItem>> {\n return this.getGrouped<DashboardDepartmentItem>('by-department', query, headers)\n }\n\n /**\n * The counts of each ticket topic of the period (`GET /dashboard/by-topic`). Does not take\n * `withTotals` (the backend ignores it).\n */\n getByTopic(\n query?: DashboardQuery,\n headers?: Record<string, string>,\n ): Promise<DashboardTopicItem[]> {\n return this.client.get<DashboardTopicItem[]>(\n `${this.basePath}/by-topic${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * The counts of each connection of the period (`GET /dashboard/by-service`). Does not take\n * `withTotals` (the backend ignores it).\n */\n getByService(\n query?: DashboardQuery,\n headers?: Record<string, string>,\n ): Promise<DashboardServiceItem[]> {\n return this.client.get<DashboardServiceItem[]>(\n `${this.basePath}/by-service${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * `withTotals` is only sent when `true`: the backend reads it with a truthiness check, so in the\n * `qs` format a serialized `withTotals=false` (the string `'false'`) would wrap the answer anyway.\n */\n private getGrouped<TItem>(\n route: string,\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<TItem[] | DashboardGrouped<TItem>> {\n const { withTotals, ...filters } = query ?? {}\n return this.client.get<TItem[] | DashboardGrouped<TItem>>(\n `${this.basePath}/${route}${this.toQueryString(withTotals ? { ...filters, withTotals: true } : filters)}`,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAa,eAAb,cAAkCA,6BAAQ;CACxC,AAAgB,WAAW;;CAG3B,WAAW,OAAwB,SAA6D;AAC9F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,UAAU,KAAK,cAAc,MAAM,IACpD,QACD;;CAqBH,YACE,OACA,SACwE;AACxE,SAAO,KAAK,WAAgC,aAAa,OAAO,QAAQ;;CAoB1E,UACE,OACA,SACoE;AACpE,SAAO,KAAK,WAA8B,WAAW,OAAO,QAAQ;;CAoBtE,gBACE,OACA,SACgF;AAChF,SAAO,KAAK,WAAoC,iBAAiB,OAAO,QAAQ;;;;;;CAOlF,WACE,OACA,SAC+B;AAC/B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,WAAW,KAAK,cAAc,MAAM,IACrD,QACD;;;;;;CAOH,aACE,OACA,SACiC;AACjC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,aAAa,KAAK,cAAc,MAAM,IACvD,QACD;;;;;;CAOH,AAAQ,WACN,OACA,OACA,SAC4C;EAC5C,MAAM,EAAE,YAAY,GAAG,YAAY,SAAS,EAAE;AAC9C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,QAAQ,KAAK,cAAc,aAAa;GAAE,GAAG;GAAS,YAAY;GAAM,GAAG,QAAQ,IACvG,QACD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { BaseApi } from '../../core/BaseApi';
|
|
2
|
+
import type { DashboardDepartmentItem, DashboardGeneral, DashboardGrouped, DashboardPeriodItem, DashboardQuery, DashboardServiceItem, DashboardTopicItem, DashboardUserItem, DashboardWithTotals } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Service statistics ("Estatísticas de atendimento"). The `/dashboard` routes only require an
|
|
5
|
+
* authenticated user (no permission check). Every route takes the same {@link DashboardQuery}
|
|
6
|
+
* filters; the grouped routes answer one item per day, user, department, topic or connection.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DashboardApi extends BaseApi {
|
|
9
|
+
readonly basePath = "/dashboard";
|
|
10
|
+
/** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */
|
|
11
|
+
getGeneral(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardGeneral>;
|
|
12
|
+
/**
|
|
13
|
+
* The counts of each bucket of the period (`GET /dashboard/by-period`): one item per day by default,
|
|
14
|
+
* or per `grouping` (hour, week, month, year). With `withTotals: true` the answer is
|
|
15
|
+
* `{ totals, items }`.
|
|
16
|
+
*/
|
|
17
|
+
getByPeriod(query: DashboardQuery & {
|
|
18
|
+
withTotals: true;
|
|
19
|
+
}, headers?: Record<string, string>): Promise<DashboardGrouped<DashboardPeriodItem>>;
|
|
20
|
+
getByPeriod(query?: DashboardQuery & {
|
|
21
|
+
withTotals?: false;
|
|
22
|
+
}, headers?: Record<string, string>): Promise<DashboardPeriodItem[]>;
|
|
23
|
+
/** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */
|
|
24
|
+
getByPeriod(query?: DashboardQuery & DashboardWithTotals, headers?: Record<string, string>): Promise<DashboardPeriodItem[] | DashboardGrouped<DashboardPeriodItem>>;
|
|
25
|
+
/**
|
|
26
|
+
* The counts of each user of the period (`GET /dashboard/by-user`). With `withTotals: true` the
|
|
27
|
+
* answer is `{ totals, items }`.
|
|
28
|
+
*/
|
|
29
|
+
getByUser(query: DashboardQuery & {
|
|
30
|
+
withTotals: true;
|
|
31
|
+
}, headers?: Record<string, string>): Promise<DashboardGrouped<DashboardUserItem>>;
|
|
32
|
+
getByUser(query?: DashboardQuery & {
|
|
33
|
+
withTotals?: false;
|
|
34
|
+
}, headers?: Record<string, string>): Promise<DashboardUserItem[]>;
|
|
35
|
+
/** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */
|
|
36
|
+
getByUser(query?: DashboardQuery & DashboardWithTotals, headers?: Record<string, string>): Promise<DashboardUserItem[] | DashboardGrouped<DashboardUserItem>>;
|
|
37
|
+
/**
|
|
38
|
+
* The counts of each department of the period (`GET /dashboard/by-department`). With
|
|
39
|
+
* `withTotals: true` the answer is `{ totals, items }`.
|
|
40
|
+
*/
|
|
41
|
+
getByDepartment(query: DashboardQuery & {
|
|
42
|
+
withTotals: true;
|
|
43
|
+
}, headers?: Record<string, string>): Promise<DashboardGrouped<DashboardDepartmentItem>>;
|
|
44
|
+
getByDepartment(query?: DashboardQuery & {
|
|
45
|
+
withTotals?: false;
|
|
46
|
+
}, headers?: Record<string, string>): Promise<DashboardDepartmentItem[]>;
|
|
47
|
+
/** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */
|
|
48
|
+
getByDepartment(query?: DashboardQuery & DashboardWithTotals, headers?: Record<string, string>): Promise<DashboardDepartmentItem[] | DashboardGrouped<DashboardDepartmentItem>>;
|
|
49
|
+
/**
|
|
50
|
+
* The counts of each ticket topic of the period (`GET /dashboard/by-topic`). Does not take
|
|
51
|
+
* `withTotals` (the backend ignores it).
|
|
52
|
+
*/
|
|
53
|
+
getByTopic(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardTopicItem[]>;
|
|
54
|
+
/**
|
|
55
|
+
* The counts of each connection of the period (`GET /dashboard/by-service`). Does not take
|
|
56
|
+
* `withTotals` (the backend ignores it).
|
|
57
|
+
*/
|
|
58
|
+
getByService(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardServiceItem[]>;
|
|
59
|
+
/**
|
|
60
|
+
* `withTotals` is only sent when `true`: the backend reads it with a truthiness check, so in the
|
|
61
|
+
* `qs` format a serialized `withTotals=false` (the string `'false'`) would wrap the answer anyway.
|
|
62
|
+
*/
|
|
63
|
+
private getGrouped;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=DashboardApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardApi.d.ts","sourceRoot":"","sources":["../../../src/apis/dashboard/DashboardApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,OAA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ashboardApi.ts
|
|
4
|
+
/**
|
|
5
|
+
* Service statistics ("Estatísticas de atendimento"). The `/dashboard` routes only require an
|
|
6
|
+
* authenticated user (no permission check). Every route takes the same {@link DashboardQuery}
|
|
7
|
+
* filters; the grouped routes answer one item per day, user, department, topic or connection.
|
|
8
|
+
*/
|
|
9
|
+
var DashboardApi = class extends BaseApi {
|
|
10
|
+
basePath = "/dashboard";
|
|
11
|
+
/** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */
|
|
12
|
+
getGeneral(query, headers) {
|
|
13
|
+
return this.client.get(`${this.basePath}/general${this.toQueryString(query)}`, headers);
|
|
14
|
+
}
|
|
15
|
+
getByPeriod(query, headers) {
|
|
16
|
+
return this.getGrouped("by-period", query, headers);
|
|
17
|
+
}
|
|
18
|
+
getByUser(query, headers) {
|
|
19
|
+
return this.getGrouped("by-user", query, headers);
|
|
20
|
+
}
|
|
21
|
+
getByDepartment(query, headers) {
|
|
22
|
+
return this.getGrouped("by-department", query, headers);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The counts of each ticket topic of the period (`GET /dashboard/by-topic`). Does not take
|
|
26
|
+
* `withTotals` (the backend ignores it).
|
|
27
|
+
*/
|
|
28
|
+
getByTopic(query, headers) {
|
|
29
|
+
return this.client.get(`${this.basePath}/by-topic${this.toQueryString(query)}`, headers);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The counts of each connection of the period (`GET /dashboard/by-service`). Does not take
|
|
33
|
+
* `withTotals` (the backend ignores it).
|
|
34
|
+
*/
|
|
35
|
+
getByService(query, headers) {
|
|
36
|
+
return this.client.get(`${this.basePath}/by-service${this.toQueryString(query)}`, headers);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* `withTotals` is only sent when `true`: the backend reads it with a truthiness check, so in the
|
|
40
|
+
* `qs` format a serialized `withTotals=false` (the string `'false'`) would wrap the answer anyway.
|
|
41
|
+
*/
|
|
42
|
+
getGrouped(route, query, headers) {
|
|
43
|
+
const { withTotals, ...filters } = query ?? {};
|
|
44
|
+
return this.client.get(`${this.basePath}/${route}${this.toQueryString(withTotals ? {
|
|
45
|
+
...filters,
|
|
46
|
+
withTotals: true
|
|
47
|
+
} : filters)}`, headers);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { DashboardApi };
|
|
53
|
+
//# sourceMappingURL=DashboardApi.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardApi.mjs","names":[],"sources":["../../../src/apis/dashboard/DashboardApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type {\n DashboardDepartmentItem,\n DashboardGeneral,\n DashboardGrouped,\n DashboardPeriodItem,\n DashboardQuery,\n DashboardServiceItem,\n DashboardTopicItem,\n DashboardUserItem,\n DashboardWithTotals,\n} from './types'\n\n/**\n * Service statistics (\"Estatísticas de atendimento\"). The `/dashboard` routes only require an\n * authenticated user (no permission check). Every route takes the same {@link DashboardQuery}\n * filters; the grouped routes answer one item per day, user, department, topic or connection.\n */\nexport class DashboardApi extends BaseApi {\n public readonly basePath = '/dashboard'\n\n /** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */\n getGeneral(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardGeneral> {\n return this.client.get<DashboardGeneral>(\n `${this.basePath}/general${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * The counts of each bucket of the period (`GET /dashboard/by-period`): one item per day by default,\n * or per `grouping` (hour, week, month, year). With `withTotals: true` the answer is\n * `{ totals, items }`.\n */\n getByPeriod(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardPeriodItem>>\n getByPeriod(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByPeriod(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[] | DashboardGrouped<DashboardPeriodItem>>\n getByPeriod(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardPeriodItem[] | DashboardGrouped<DashboardPeriodItem>> {\n return this.getGrouped<DashboardPeriodItem>('by-period', query, headers)\n }\n\n /**\n * The counts of each user of the period (`GET /dashboard/by-user`). With `withTotals: true` the\n * answer is `{ totals, items }`.\n */\n getByUser(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardUserItem>>\n getByUser(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByUser(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[] | DashboardGrouped<DashboardUserItem>>\n getByUser(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardUserItem[] | DashboardGrouped<DashboardUserItem>> {\n return this.getGrouped<DashboardUserItem>('by-user', query, headers)\n }\n\n /**\n * The counts of each department of the period (`GET /dashboard/by-department`). With\n * `withTotals: true` the answer is `{ totals, items }`.\n */\n getByDepartment(\n query: DashboardQuery & { withTotals: true },\n headers?: Record<string, string>,\n ): Promise<DashboardGrouped<DashboardDepartmentItem>>\n getByDepartment(\n query?: DashboardQuery & { withTotals?: false },\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[]>\n /** When `withTotals` is only known at runtime (e.g. a `boolean` variable). */\n getByDepartment(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[] | DashboardGrouped<DashboardDepartmentItem>>\n getByDepartment(\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<DashboardDepartmentItem[] | DashboardGrouped<DashboardDepartmentItem>> {\n return this.getGrouped<DashboardDepartmentItem>('by-department', query, headers)\n }\n\n /**\n * The counts of each ticket topic of the period (`GET /dashboard/by-topic`). Does not take\n * `withTotals` (the backend ignores it).\n */\n getByTopic(\n query?: DashboardQuery,\n headers?: Record<string, string>,\n ): Promise<DashboardTopicItem[]> {\n return this.client.get<DashboardTopicItem[]>(\n `${this.basePath}/by-topic${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * The counts of each connection of the period (`GET /dashboard/by-service`). Does not take\n * `withTotals` (the backend ignores it).\n */\n getByService(\n query?: DashboardQuery,\n headers?: Record<string, string>,\n ): Promise<DashboardServiceItem[]> {\n return this.client.get<DashboardServiceItem[]>(\n `${this.basePath}/by-service${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * `withTotals` is only sent when `true`: the backend reads it with a truthiness check, so in the\n * `qs` format a serialized `withTotals=false` (the string `'false'`) would wrap the answer anyway.\n */\n private getGrouped<TItem>(\n route: string,\n query?: DashboardQuery & DashboardWithTotals,\n headers?: Record<string, string>,\n ): Promise<TItem[] | DashboardGrouped<TItem>> {\n const { withTotals, ...filters } = query ?? {}\n return this.client.get<TItem[] | DashboardGrouped<TItem>>(\n `${this.basePath}/${route}${this.toQueryString(withTotals ? { ...filters, withTotals: true } : filters)}`,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;AAkBA,IAAa,eAAb,cAAkC,QAAQ;CACxC,AAAgB,WAAW;;CAG3B,WAAW,OAAwB,SAA6D;AAC9F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,UAAU,KAAK,cAAc,MAAM,IACpD,QACD;;CAqBH,YACE,OACA,SACwE;AACxE,SAAO,KAAK,WAAgC,aAAa,OAAO,QAAQ;;CAoB1E,UACE,OACA,SACoE;AACpE,SAAO,KAAK,WAA8B,WAAW,OAAO,QAAQ;;CAoBtE,gBACE,OACA,SACgF;AAChF,SAAO,KAAK,WAAoC,iBAAiB,OAAO,QAAQ;;;;;;CAOlF,WACE,OACA,SAC+B;AAC/B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,WAAW,KAAK,cAAc,MAAM,IACrD,QACD;;;;;;CAOH,aACE,OACA,SACiC;AACjC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,aAAa,KAAK,cAAc,MAAM,IACvD,QACD;;;;;;CAOH,AAAQ,WACN,OACA,OACA,SAC4C;EAC5C,MAAM,EAAE,YAAY,GAAG,YAAY,SAAS,EAAE;AAC9C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,QAAQ,KAAK,cAAc,aAAa;GAAE,GAAG;GAAS,YAAY;GAAM,GAAG,QAAQ,IACvG,QACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/apis/dashboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,mBAAmB,SAAS,CAAA"}
|
|
File without changes
|