@ikatec/digisac-api-sdk 4.0.0 → 4.2.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 +34 -4
- package/dist/apis/authHistory/AuthHistoryApi.cjs +11 -17
- package/dist/apis/authHistory/AuthHistoryApi.cjs.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.d.ts +10 -18
- package/dist/apis/authHistory/AuthHistoryApi.d.ts.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.mjs +11 -15
- 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/clientFeedback/ClientFeedbackApi.cjs +2 -5
- package/dist/apis/clientFeedback/ClientFeedbackApi.cjs.map +1 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts +2 -4
- package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts.map +1 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.mjs +3 -5
- package/dist/apis/clientFeedback/ClientFeedbackApi.mjs.map +1 -1
- package/dist/apis/contacts/ContactsApi.cjs +2 -2
- package/dist/apis/contacts/ContactsApi.cjs.map +1 -1
- package/dist/apis/contacts/ContactsApi.mjs +2 -2
- package/dist/apis/contacts/ContactsApi.mjs.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 +19 -0
- package/dist/apis/dashboard/DashboardApi.cjs.map +1 -0
- package/dist/apis/dashboard/DashboardApi.d.ts +12 -0
- package/dist/apis/dashboard/DashboardApi.d.ts.map +1 -0
- package/dist/apis/dashboard/DashboardApi.mjs +18 -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 +53 -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/me/MeApi.cjs +2 -5
- package/dist/apis/me/MeApi.cjs.map +1 -1
- package/dist/apis/me/MeApi.d.ts +2 -4
- package/dist/apis/me/MeApi.d.ts.map +1 -1
- package/dist/apis/me/MeApi.mjs +3 -5
- package/dist/apis/me/MeApi.mjs.map +1 -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/serviceAccessManagement/ServiceAccessManagementApi.cjs +3 -9
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.cjs.map +1 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts +3 -4
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts.map +1 -1
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs +3 -7
- package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.cjs +3 -9
- package/dist/apis/stickerUsers/StickerUsersApi.cjs.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.d.ts +3 -4
- package/dist/apis/stickerUsers/StickerUsersApi.d.ts.map +1 -1
- package/dist/apis/stickerUsers/StickerUsersApi.mjs +3 -7
- package/dist/apis/stickerUsers/StickerUsersApi.mjs.map +1 -1
- package/dist/apis/terms/TermsApi.cjs +7 -13
- package/dist/apis/terms/TermsApi.cjs.map +1 -1
- package/dist/apis/terms/TermsApi.d.ts +6 -5
- package/dist/apis/terms/TermsApi.d.ts.map +1 -1
- package/dist/apis/terms/TermsApi.mjs +7 -11
- 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/apis/transcripts/TranscriptsApi.cjs +2 -5
- package/dist/apis/transcripts/TranscriptsApi.cjs.map +1 -1
- package/dist/apis/transcripts/TranscriptsApi.d.ts +2 -4
- package/dist/apis/transcripts/TranscriptsApi.d.ts.map +1 -1
- package/dist/apis/transcripts/TranscriptsApi.mjs +3 -5
- package/dist/apis/transcripts/TranscriptsApi.mjs.map +1 -1
- package/dist/core/ApiClient.d.ts +3 -0
- package/dist/core/ApiClient.d.ts.map +1 -1
- package/dist/core/ArchivableCrudApi.cjs +0 -2
- package/dist/core/ArchivableCrudApi.cjs.map +1 -1
- package/dist/core/ArchivableCrudApi.d.ts.map +1 -1
- package/dist/core/ArchivableCrudApi.mjs +0 -2
- package/dist/core/ArchivableCrudApi.mjs.map +1 -1
- package/dist/core/BaseApi.cjs +34 -0
- package/dist/core/BaseApi.cjs.map +1 -0
- package/dist/core/BaseApi.d.ts +20 -0
- package/dist/core/BaseApi.d.ts.map +1 -0
- package/dist/core/BaseApi.mjs +33 -0
- package/dist/core/BaseApi.mjs.map +1 -0
- package/dist/core/BaseApiClient.cjs +4 -1
- package/dist/core/BaseApiClient.cjs.map +1 -1
- package/dist/core/BaseApiClient.d.ts +7 -1
- package/dist/core/BaseApiClient.d.ts.map +1 -1
- package/dist/core/BaseApiClient.mjs +4 -1
- package/dist/core/BaseApiClient.mjs.map +1 -1
- package/dist/core/BaseCrudApi.cjs +3 -40
- package/dist/core/BaseCrudApi.cjs.map +1 -1
- package/dist/core/BaseCrudApi.d.ts +4 -23
- package/dist/core/BaseCrudApi.d.ts.map +1 -1
- package/dist/core/BaseCrudApi.mjs +3 -38
- 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/bindMethods.cjs +24 -0
- package/dist/core/bindMethods.cjs.map +1 -0
- package/dist/core/bindMethods.d.ts +7 -0
- package/dist/core/bindMethods.d.ts.map +1 -0
- package/dist/core/bindMethods.mjs +22 -0
- package/dist/core/bindMethods.mjs.map +1 -0
- package/dist/core/index.cjs +4 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.mjs +3 -1
- package/dist/core/queryString.cjs +22 -0
- package/dist/core/queryString.cjs.map +1 -0
- package/dist/core/queryString.d.ts +14 -0
- package/dist/core/queryString.d.ts.map +1 -0
- package/dist/core/queryString.mjs +18 -0
- package/dist/core/queryString.mjs.map +1 -0
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/withQueryFormat.cjs +42 -0
- package/dist/core/withQueryFormat.cjs.map +1 -0
- package/dist/core/withQueryFormat.d.ts +10 -0
- package/dist/core/withQueryFormat.d.ts.map +1 -0
- package/dist/core/withQueryFormat.mjs +40 -0
- package/dist/core/withQueryFormat.mjs.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
- package/src/apis/authHistory/AuthHistoryApi.test.ts +11 -3
- package/src/apis/authHistory/AuthHistoryApi.ts +11 -37
- package/src/apis/authHistory/types.ts +4 -3
- package/src/apis/campaigns/CampaignsApi.test.ts +1 -1
- package/src/apis/clientFeedback/ClientFeedbackApi.ts +5 -7
- package/src/apis/contacts/ContactsApi.test.ts +1 -1
- package/src/apis/contacts/ContactsApi.ts +2 -2
- package/src/apis/customFields/types.ts +21 -25
- package/src/apis/dashboard/DashboardApi.test.ts +82 -0
- package/src/apis/dashboard/DashboardApi.ts +18 -0
- package/src/apis/dashboard/index.ts +2 -0
- package/src/apis/dashboard/types.ts +53 -0
- package/src/apis/holiday/types.ts +36 -8
- package/src/apis/index.ts +2 -0
- package/src/apis/me/MeApi.ts +2 -8
- package/src/apis/messages/MessagesApi.test.ts +2 -2
- 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 +273 -0
- package/src/apis/roles/RolesApi.ts +7 -2
- package/src/apis/roles/types.ts +27 -4
- package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.test.ts +2 -2
- package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts +10 -10
- package/src/apis/stickerUsers/StickerUsersApi.test.ts +1 -1
- package/src/apis/stickerUsers/StickerUsersApi.ts +7 -10
- package/src/apis/terms/TermsApi.ts +7 -13
- package/src/apis/timetable/types.ts +13 -7
- package/src/apis/transcripts/TranscriptsApi.ts +2 -7
- package/src/core/ApiClient.ts +4 -0
- package/src/core/ArchivableCrudApi.ts +0 -2
- package/src/core/BaseApi.test.ts +164 -0
- package/src/core/BaseApi.ts +32 -0
- package/src/core/BaseApiClient.test.ts +10 -0
- package/src/core/BaseApiClient.ts +9 -1
- package/src/core/BaseCrudApi.test-d.ts +9 -0
- package/src/core/BaseCrudApi.test.ts +131 -60
- package/src/core/BaseCrudApi.ts +7 -63
- package/src/core/BaseReadApi.ts +70 -0
- package/src/core/bindMethods.ts +26 -0
- package/src/core/index.ts +4 -0
- package/src/core/queryString.test.ts +71 -0
- package/src/core/queryString.ts +30 -0
- package/src/core/types.ts +5 -0
- package/src/core/withQueryFormat.test.ts +136 -0
- package/src/core/withQueryFormat.ts +47 -0
package/README.md
CHANGED
|
@@ -54,13 +54,15 @@ The SDK is structured in two layers:
|
|
|
54
54
|
|---|---|
|
|
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
|
+
| `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` |
|
|
58
60
|
| `types.ts` | Shared types: `WhereClause<T>`, `ListQuery<T>`, `Paginated<T>`, `IncludeItem<T>` |
|
|
59
61
|
|
|
60
62
|
### API Resources (`src/apis/<resource>/`)
|
|
61
63
|
|
|
62
64
|
Each resource has its own folder with:
|
|
63
|
-
- `<Resource>Api.ts` — extends `BaseCrudApi` with the resource path and type parameters
|
|
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)
|
|
64
66
|
- `types.ts` — TypeScript types for the resource model, create payload, and update payload
|
|
65
67
|
- `index.ts` — barrel file re-exporting the API class and all types
|
|
66
68
|
|
|
@@ -79,7 +81,7 @@ Available resources:
|
|
|
79
81
|
| Accounts | `AccountsApi` | `/accounts` |
|
|
80
82
|
| Activity Log | `ActivityLogApi` | `/activity-log` |
|
|
81
83
|
| Answers | `AnswersApi` | `/answers` |
|
|
82
|
-
| Auth History | `AuthHistoryApi` | `/auth-history` |
|
|
84
|
+
| Auth History (read-only) | `AuthHistoryApi` | `/auth-history` |
|
|
83
85
|
| Bot Versions | `BotVersionsApi` | `/bot-versions` |
|
|
84
86
|
| Bots | `BotsApi` | `/bots` |
|
|
85
87
|
| Campaigns | `CampaignsApi` | `/campaigns` |
|
|
@@ -91,6 +93,7 @@ Available resources:
|
|
|
91
93
|
| Contacts | `ContactsApi` | `/contacts` |
|
|
92
94
|
| Credit Movements | `CreditMovementsApi` | `/credit-movements` |
|
|
93
95
|
| Custom Fields | `CustomFieldsApi` | `/custom-fields` |
|
|
96
|
+
| Dashboard | `DashboardApi` | `/dashboard` |
|
|
94
97
|
| Departments | `DepartmentsApi` | `/departments` |
|
|
95
98
|
| Distribution | `DistributionApi` | `/distribution` |
|
|
96
99
|
| Files | `FilesApi` | `/files` |
|
|
@@ -105,9 +108,10 @@ Available resources:
|
|
|
105
108
|
| Me | `MeApi` | `/me` |
|
|
106
109
|
| Messages | `MessagesApi` | `/messages` |
|
|
107
110
|
| Notifications | `NotificationsApi` | `/notifications` |
|
|
111
|
+
| Now ("Agora") | `NowApi` | `/now` |
|
|
108
112
|
| Organizations | `OrganizationsApi` | `/organizations` |
|
|
109
113
|
| People | `PeopleApi` | `/people` |
|
|
110
|
-
| Permissions | `PermissionsApi` | `/permissions` |
|
|
114
|
+
| Permissions (read-only) | `PermissionsApi` | `/permissions` |
|
|
111
115
|
| Personal Access Tokens | `PersonalAccessTokensApi` | `/personal-access-tokens` |
|
|
112
116
|
| Pipelines | `PipelineApi` | `/pipelines` |
|
|
113
117
|
| Plan AI History | `PlanAiHistoryApi` | `/plan-ai-history` |
|
|
@@ -163,6 +167,31 @@ const result = await people.getMany({
|
|
|
163
167
|
| `$between`, `$notBetween` | Range checks |
|
|
164
168
|
| `$and`, `$or` | Logical combinators |
|
|
165
169
|
|
|
170
|
+
### Query format
|
|
171
|
+
|
|
172
|
+
The client decides how list/get queries (`getMany`, `getOne`, `getById`, ...) are put in the URL:
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
const client = new BaseApiClient('https://api.digisac.com/v1', token, { queryFormat: 'qs' })
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
| `queryFormat` | URL | Notes |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| `'json'` (default) | `?query=%7B%22where%22...` (`?query=<JSON>`) | Keeps `null`, booleans and numbers typed; no nesting limit. Same format as the Digisac web app. |
|
|
181
|
+
| `'qs'` | `?where[name]=x&page=2` | Readable, but the backend reads `null` as `''`, booleans/numbers as strings, and mangles objects nested deeper than 5 levels (e.g. an `include` inside an `include` with a `where`). |
|
|
182
|
+
|
|
183
|
+
To override it for some calls, `withQueryFormat` returns a copy of an API that uses another format (the original is not changed):
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
const contacts = new ContactsApi(client) // uses the client's format
|
|
187
|
+
|
|
188
|
+
await contacts.withQueryFormat('qs').getMany({ where: { name: 'John' } })
|
|
189
|
+
|
|
190
|
+
const qsContacts = contacts.withQueryFormat('qs') // keep it for several calls
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The copy shares the client, so a token set later with `client.setAccessToken()` applies to it too.
|
|
194
|
+
|
|
166
195
|
## Error Handling
|
|
167
196
|
|
|
168
197
|
Every error thrown by the SDK extends `DigisacError`:
|
|
@@ -315,6 +344,7 @@ import type { ApiClient } from '@ikatec/digisac-api-sdk'
|
|
|
315
344
|
|
|
316
345
|
class MyApiClient implements ApiClient {
|
|
317
346
|
// Implement setAccessToken, get, post, put, patch, delete, request
|
|
347
|
+
// Optionally set `queryFormat` ('json' when absent)
|
|
318
348
|
}
|
|
319
349
|
```
|
|
320
350
|
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
let qs = require("qs");
|
|
4
|
-
qs = require_chunk.__toESM(qs);
|
|
2
|
+
const require_core_BaseReadApi = require('../../core/BaseReadApi.cjs');
|
|
5
3
|
|
|
6
4
|
//#region src/apis/authHistory/AuthHistoryApi.ts
|
|
7
|
-
|
|
8
|
-
|
|
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 {
|
|
9
14
|
constructor(client) {
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
getMany(query, headers) {
|
|
13
|
-
const queryString = query ? `?${qs.default.stringify(query)}` : "";
|
|
14
|
-
return this.client.get(`/auth-history${queryString}`, headers);
|
|
15
|
-
}
|
|
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, headers) {
|
|
21
|
-
return this.client.get(`/auth-history/${id}`, headers);
|
|
15
|
+
super(client, "/auth-history");
|
|
22
16
|
}
|
|
23
17
|
};
|
|
24
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHistoryApi.cjs","names":[],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import
|
|
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,23 +1,15 @@
|
|
|
1
1
|
import type { ApiClient } from '../../core/ApiClient';
|
|
2
|
-
import
|
|
2
|
+
import { BaseReadApi } from '../../core/BaseReadApi';
|
|
3
3
|
import type { AuthHistory } from './types';
|
|
4
|
-
|
|
5
|
-
|
|
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> {
|
|
6
13
|
constructor(client: ApiClient);
|
|
7
|
-
/**
|
|
8
|
-
* Returns a paginated list of authentication events (auth, password_change, logout). Non-admin users can only see their own records.
|
|
9
|
-
* @permissions authHistory.view
|
|
10
|
-
*/
|
|
11
|
-
getMany(query: ListQuery<AuthHistory> & {
|
|
12
|
-
paginate: false;
|
|
13
|
-
}, headers?: Record<string, string>): Promise<AuthHistory[]>;
|
|
14
|
-
getMany(query?: ListQuery<AuthHistory> & {
|
|
15
|
-
paginate?: true;
|
|
16
|
-
}, headers?: Record<string, string>): Promise<Paginated<AuthHistory>>;
|
|
17
|
-
/**
|
|
18
|
-
* Returns a single authentication event by its ID. Non-admin users can only access their own records.
|
|
19
|
-
* @permissions authHistory.view
|
|
20
|
-
*/
|
|
21
|
-
getById(id: string, headers?: Record<string, string>): Promise<AuthHistory>;
|
|
22
14
|
}
|
|
23
15
|
//# sourceMappingURL=AuthHistoryApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHistoryApi.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"names":[],"mappings":"
|
|
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,21 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseReadApi } from "../../core/BaseReadApi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/apis/authHistory/AuthHistoryApi.ts
|
|
4
|
-
|
|
5
|
-
|
|
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 {
|
|
6
13
|
constructor(client) {
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
getMany(query, headers) {
|
|
10
|
-
const queryString = query ? `?${qs.stringify(query)}` : "";
|
|
11
|
-
return this.client.get(`/auth-history${queryString}`, headers);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Returns a single authentication event by its ID. Non-admin users can only access their own records.
|
|
15
|
-
* @permissions authHistory.view
|
|
16
|
-
*/
|
|
17
|
-
getById(id, headers) {
|
|
18
|
-
return this.client.get(`/auth-history/${id}`, headers);
|
|
14
|
+
super(client, "/auth-history");
|
|
19
15
|
}
|
|
20
16
|
};
|
|
21
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,12 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_core_BaseApi = require('../../core/BaseApi.cjs');
|
|
2
3
|
|
|
3
4
|
//#region src/apis/clientFeedback/ClientFeedbackApi.ts
|
|
4
|
-
var ClientFeedbackApi = class {
|
|
5
|
-
client;
|
|
5
|
+
var ClientFeedbackApi = class extends require_core_BaseApi.BaseApi {
|
|
6
6
|
basePath = "/client-feedback";
|
|
7
|
-
constructor(client) {
|
|
8
|
-
this.client = client;
|
|
9
|
-
}
|
|
10
7
|
/** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */
|
|
11
8
|
create(body, headers) {
|
|
12
9
|
return this.client.post(this.basePath, body, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientFeedbackApi.cjs","names":[],"sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"ClientFeedbackApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { HasCreate } from '../../core/types'\nimport type { ClientFeedback, CreateClientFeedbackPayload } from './types'\n\nexport class ClientFeedbackApi\n extends BaseApi\n implements HasCreate<ClientFeedback, CreateClientFeedbackPayload>\n{\n private readonly basePath = '/client-feedback'\n\n /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */\n create(\n body: CreateClientFeedbackPayload,\n headers?: Record<string, string>,\n ): Promise<ClientFeedback> {\n return this.client.post<ClientFeedback, CreateClientFeedbackPayload>(\n this.basePath,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAIA,IAAa,oBAAb,cACUA,6BAEV;CACE,AAAiB,WAAW;;CAG5B,OACE,MACA,SACyB;AACzB,SAAO,KAAK,OAAO,KACjB,KAAK,UACL,MACA,QACD"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseApi } from '../../core/BaseApi';
|
|
2
2
|
import type { HasCreate } from '../../core/types';
|
|
3
3
|
import type { ClientFeedback, CreateClientFeedbackPayload } from './types';
|
|
4
|
-
export declare class ClientFeedbackApi implements HasCreate<ClientFeedback, CreateClientFeedbackPayload> {
|
|
5
|
-
private readonly client;
|
|
4
|
+
export declare class ClientFeedbackApi extends BaseApi implements HasCreate<ClientFeedback, CreateClientFeedbackPayload> {
|
|
6
5
|
private readonly basePath;
|
|
7
|
-
constructor(client: ApiClient);
|
|
8
6
|
/** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */
|
|
9
7
|
create(body: CreateClientFeedbackPayload, headers?: Record<string, string>): Promise<ClientFeedback>;
|
|
10
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientFeedbackApi.d.ts","sourceRoot":"","sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ClientFeedbackApi.d.ts","sourceRoot":"","sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1E,qBAAa,iBACX,SAAQ,OACR,YAAW,SAAS,CAAC,cAAc,EAAE,2BAA2B,CAAC;IAEjE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C,2GAA2G;IAC3G,MAAM,CACJ,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC;CAO3B"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
import { BaseApi } from "../../core/BaseApi.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/apis/clientFeedback/ClientFeedbackApi.ts
|
|
2
|
-
var ClientFeedbackApi = class {
|
|
3
|
-
client;
|
|
4
|
+
var ClientFeedbackApi = class extends BaseApi {
|
|
4
5
|
basePath = "/client-feedback";
|
|
5
|
-
constructor(client) {
|
|
6
|
-
this.client = client;
|
|
7
|
-
}
|
|
8
6
|
/** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */
|
|
9
7
|
create(body, headers) {
|
|
10
8
|
return this.client.post(this.basePath, body, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientFeedbackApi.mjs","names":[],"sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"ClientFeedbackApi.mjs","names":[],"sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { HasCreate } from '../../core/types'\nimport type { ClientFeedback, CreateClientFeedbackPayload } from './types'\n\nexport class ClientFeedbackApi\n extends BaseApi\n implements HasCreate<ClientFeedback, CreateClientFeedbackPayload>\n{\n private readonly basePath = '/client-feedback'\n\n /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */\n create(\n body: CreateClientFeedbackPayload,\n headers?: Record<string, string>,\n ): Promise<ClientFeedback> {\n return this.client.post<ClientFeedback, CreateClientFeedbackPayload>(\n this.basePath,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;AAIA,IAAa,oBAAb,cACU,QAEV;CACE,AAAiB,WAAW;;CAG5B,OACE,MACA,SACyB;AACzB,SAAO,KAAK,OAAO,KACjB,KAAK,UACL,MACA,QACD"}
|
|
@@ -21,7 +21,7 @@ var ContactsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
21
21
|
* @permissions contacts.view
|
|
22
22
|
*/
|
|
23
23
|
count(query, headers) {
|
|
24
|
-
const queryString =
|
|
24
|
+
const queryString = this.toQueryString(query);
|
|
25
25
|
return this.client.get(`${this.basePath}/count${queryString}`, headers);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -36,7 +36,7 @@ var ContactsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
36
36
|
* @permissions contacts.view
|
|
37
37
|
*/
|
|
38
38
|
forward(query, headers) {
|
|
39
|
-
const queryString =
|
|
39
|
+
const queryString = this.toQueryString(query);
|
|
40
40
|
return this.client.get(`${this.basePath}/forward${queryString}`, headers);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString =
|
|
1
|
+
{"version":3,"file":"ContactsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = this.toQueryString(query)\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;AAeA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,WAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD"}
|
|
@@ -18,7 +18,7 @@ var ContactsApi = class extends BaseCrudApi {
|
|
|
18
18
|
* @permissions contacts.view
|
|
19
19
|
*/
|
|
20
20
|
count(query, headers) {
|
|
21
|
-
const queryString =
|
|
21
|
+
const queryString = this.toQueryString(query);
|
|
22
22
|
return this.client.get(`${this.basePath}/count${queryString}`, headers);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
@@ -33,7 +33,7 @@ var ContactsApi = class extends BaseCrudApi {
|
|
|
33
33
|
* @permissions contacts.view
|
|
34
34
|
*/
|
|
35
35
|
forward(query, headers) {
|
|
36
|
-
const queryString =
|
|
36
|
+
const queryString = this.toQueryString(query);
|
|
37
37
|
return this.client.get(`${this.basePath}/forward${queryString}`, headers);
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsApi.mjs","names":[],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString =
|
|
1
|
+
{"version":3,"file":"ContactsApi.mjs","names":[],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = this.toQueryString(query)\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAeA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,GAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD"}
|
|
@@ -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,GAAG;IAChC,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,eAAe,CAAA;IACrB,OAAO,EAAE,UAAU,CAAA;IACnB,cAAc,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,eAAe,CAAA;IACrB,OAAO,EAAE,UAAU,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;CACtC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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).
|
|
8
|
+
*/
|
|
9
|
+
var DashboardApi = class extends require_core_BaseApi.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
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.DashboardApi = DashboardApi;
|
|
19
|
+
//# 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 { DashboardGeneral, DashboardQuery } from './types'\n\n/**\n * Service statistics (\"Estatísticas de atendimento\"). The `/dashboard` routes only require an\n * authenticated user (no permission check).\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"],"mappings":";;;;;;;;AAOA,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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseApi } from '../../core/BaseApi';
|
|
2
|
+
import type { DashboardGeneral, DashboardQuery } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Service statistics ("Estatísticas de atendimento"). The `/dashboard` routes only require an
|
|
5
|
+
* authenticated user (no permission check).
|
|
6
|
+
*/
|
|
7
|
+
export declare class DashboardApi extends BaseApi {
|
|
8
|
+
readonly basePath = "/dashboard";
|
|
9
|
+
/** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */
|
|
10
|
+
getGeneral(query?: DashboardQuery, headers?: Record<string, string>): Promise<DashboardGeneral>;
|
|
11
|
+
}
|
|
12
|
+
//# 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,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE/D;;;GAGG;AACH,qBAAa,YAAa,SAAQ,OAAO;IACvC,SAAgB,QAAQ,gBAAe;IAEvC,yFAAyF;IACzF,UAAU,CAAC,KAAK,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAMhG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseApi } from "../../core/BaseApi.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/apis/dashboard/DashboardApi.ts
|
|
4
|
+
/**
|
|
5
|
+
* Service statistics ("Estatísticas de atendimento"). The `/dashboard` routes only require an
|
|
6
|
+
* authenticated user (no permission check).
|
|
7
|
+
*/
|
|
8
|
+
var DashboardApi = class extends BaseApi {
|
|
9
|
+
basePath = "/dashboard";
|
|
10
|
+
/** Message, ticket, contact and time counts of the period (`GET /dashboard/general`). */
|
|
11
|
+
getGeneral(query, headers) {
|
|
12
|
+
return this.client.get(`${this.basePath}/general${this.toQueryString(query)}`, headers);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { DashboardApi };
|
|
18
|
+
//# 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 { DashboardGeneral, DashboardQuery } from './types'\n\n/**\n * Service statistics (\"Estatísticas de atendimento\"). The `/dashboard` routes only require an\n * authenticated user (no permission check).\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"],"mappings":";;;;;;;AAOA,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"}
|
|
@@ -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
|