@ikatec/digisac-api-sdk 4.11.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/apis/absence/AbsenceApi.cjs +46 -2
  2. package/dist/apis/absence/AbsenceApi.cjs.map +1 -1
  3. package/dist/apis/absence/AbsenceApi.d.ts +38 -4
  4. package/dist/apis/absence/AbsenceApi.d.ts.map +1 -1
  5. package/dist/apis/absence/AbsenceApi.mjs +46 -2
  6. package/dist/apis/absence/AbsenceApi.mjs.map +1 -1
  7. package/dist/apis/absence/types.d.ts +51 -2
  8. package/dist/apis/absence/types.d.ts.map +1 -1
  9. package/dist/apis/activityLog/ActivityLogApi.cjs +10 -1
  10. package/dist/apis/activityLog/ActivityLogApi.cjs.map +1 -1
  11. package/dist/apis/activityLog/ActivityLogApi.d.ts +10 -3
  12. package/dist/apis/activityLog/ActivityLogApi.d.ts.map +1 -1
  13. package/dist/apis/activityLog/ActivityLogApi.mjs +10 -1
  14. package/dist/apis/activityLog/ActivityLogApi.mjs.map +1 -1
  15. package/dist/apis/activityLog/types.d.ts +48 -8
  16. package/dist/apis/activityLog/types.d.ts.map +1 -1
  17. package/dist/apis/categories/types.d.ts +1 -0
  18. package/dist/apis/categories/types.d.ts.map +1 -1
  19. package/dist/apis/creditMovements/CreditMovementsApi.cjs +31 -2
  20. package/dist/apis/creditMovements/CreditMovementsApi.cjs.map +1 -1
  21. package/dist/apis/creditMovements/CreditMovementsApi.d.ts +21 -3
  22. package/dist/apis/creditMovements/CreditMovementsApi.d.ts.map +1 -1
  23. package/dist/apis/creditMovements/CreditMovementsApi.mjs +31 -2
  24. package/dist/apis/creditMovements/CreditMovementsApi.mjs.map +1 -1
  25. package/dist/apis/creditMovements/types.d.ts +73 -2
  26. package/dist/apis/creditMovements/types.d.ts.map +1 -1
  27. package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs +15 -0
  28. package/dist/apis/interactiveMessages/InteractiveMessagesApi.cjs.map +1 -1
  29. package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts +13 -0
  30. package/dist/apis/interactiveMessages/InteractiveMessagesApi.d.ts.map +1 -1
  31. package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs +15 -0
  32. package/dist/apis/interactiveMessages/InteractiveMessagesApi.mjs.map +1 -1
  33. package/dist/apis/interactiveMessages/types.d.ts +8 -2
  34. package/dist/apis/interactiveMessages/types.d.ts.map +1 -1
  35. package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs +27 -0
  36. package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs.map +1 -1
  37. package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts +22 -1
  38. package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts.map +1 -1
  39. package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs +27 -0
  40. package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs.map +1 -1
  41. package/dist/apis/knowledgeBase/types.d.ts +56 -2
  42. package/dist/apis/knowledgeBase/types.d.ts.map +1 -1
  43. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs +26 -0
  44. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs.map +1 -1
  45. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts +24 -0
  46. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts.map +1 -1
  47. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs +26 -0
  48. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs.map +1 -1
  49. package/dist/apis/knowledgeBaseItem/types.d.ts +23 -6
  50. package/dist/apis/knowledgeBaseItem/types.d.ts.map +1 -1
  51. package/dist/apis/me/MeApi.cjs +36 -29
  52. package/dist/apis/me/MeApi.cjs.map +1 -1
  53. package/dist/apis/me/MeApi.d.ts +33 -22
  54. package/dist/apis/me/MeApi.d.ts.map +1 -1
  55. package/dist/apis/me/MeApi.mjs +36 -29
  56. package/dist/apis/me/MeApi.mjs.map +1 -1
  57. package/dist/apis/me/types.d.ts +67 -4
  58. package/dist/apis/me/types.d.ts.map +1 -1
  59. package/dist/apis/notifications/NotificationsApi.cjs +50 -2
  60. package/dist/apis/notifications/NotificationsApi.cjs.map +1 -1
  61. package/dist/apis/notifications/NotificationsApi.d.ts +41 -3
  62. package/dist/apis/notifications/NotificationsApi.d.ts.map +1 -1
  63. package/dist/apis/notifications/NotificationsApi.mjs +50 -2
  64. package/dist/apis/notifications/NotificationsApi.mjs.map +1 -1
  65. package/dist/apis/notifications/types.d.ts +54 -8
  66. package/dist/apis/notifications/types.d.ts.map +1 -1
  67. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.cjs.map +1 -1
  68. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts +4 -1
  69. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts.map +1 -1
  70. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs.map +1 -1
  71. package/dist/apis/serviceAccessManagement/types.d.ts +3 -0
  72. package/dist/apis/serviceAccessManagement/types.d.ts.map +1 -1
  73. package/dist/apis/stickerUsers/StickerUsersApi.cjs.map +1 -1
  74. package/dist/apis/stickerUsers/StickerUsersApi.d.ts +3 -1
  75. package/dist/apis/stickerUsers/StickerUsersApi.d.ts.map +1 -1
  76. package/dist/apis/stickerUsers/StickerUsersApi.mjs.map +1 -1
  77. package/dist/apis/stickerUsers/types.d.ts +4 -0
  78. package/dist/apis/stickerUsers/types.d.ts.map +1 -1
  79. package/dist/apis/stickers/StickersApi.cjs +27 -3
  80. package/dist/apis/stickers/StickersApi.cjs.map +1 -1
  81. package/dist/apis/stickers/StickersApi.d.ts +24 -4
  82. package/dist/apis/stickers/StickersApi.d.ts.map +1 -1
  83. package/dist/apis/stickers/StickersApi.mjs +27 -3
  84. package/dist/apis/stickers/StickersApi.mjs.map +1 -1
  85. package/dist/apis/stickers/types.d.ts +28 -4
  86. package/dist/apis/stickers/types.d.ts.map +1 -1
  87. package/dist/apis/transcripts/TranscriptsApi.cjs +12 -2
  88. package/dist/apis/transcripts/TranscriptsApi.cjs.map +1 -1
  89. package/dist/apis/transcripts/TranscriptsApi.d.ts +11 -5
  90. package/dist/apis/transcripts/TranscriptsApi.d.ts.map +1 -1
  91. package/dist/apis/transcripts/TranscriptsApi.mjs +12 -2
  92. package/dist/apis/transcripts/TranscriptsApi.mjs.map +1 -1
  93. package/dist/apis/transcripts/types.d.ts +4 -0
  94. package/dist/apis/transcripts/types.d.ts.map +1 -1
  95. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs +51 -0
  96. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs.map +1 -1
  97. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts +44 -2
  98. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts.map +1 -1
  99. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs +51 -0
  100. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs.map +1 -1
  101. package/dist/apis/whatsappBusinessTemplates/types.d.ts +34 -1
  102. package/dist/apis/whatsappBusinessTemplates/types.d.ts.map +1 -1
  103. package/package.json +1 -1
  104. package/src/apis/absence/AbsenceApi.test.ts +65 -0
  105. package/src/apis/absence/AbsenceApi.ts +77 -4
  106. package/src/apis/absence/types.ts +53 -2
  107. package/src/apis/activityLog/ActivityLogApi.test.ts +44 -0
  108. package/src/apis/activityLog/ActivityLogApi.ts +22 -3
  109. package/src/apis/activityLog/types.ts +47 -8
  110. package/src/apis/categories/types.ts +1 -0
  111. package/src/apis/creditMovements/CreditMovementsApi.test.ts +88 -0
  112. package/src/apis/creditMovements/CreditMovementsApi.ts +73 -2
  113. package/src/apis/creditMovements/types.ts +74 -2
  114. package/src/apis/interactiveMessages/InteractiveMessagesApi.test.ts +59 -0
  115. package/src/apis/interactiveMessages/InteractiveMessagesApi.ts +26 -0
  116. package/src/apis/interactiveMessages/types.ts +8 -2
  117. package/src/apis/knowledgeBase/KnowledgeBaseApi.test.ts +54 -0
  118. package/src/apis/knowledgeBase/KnowledgeBaseApi.ts +61 -1
  119. package/src/apis/knowledgeBase/types.ts +62 -2
  120. package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.test.ts +57 -0
  121. package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts +45 -0
  122. package/src/apis/knowledgeBaseItem/types.ts +23 -6
  123. package/src/apis/me/MeApi.test.ts +45 -1
  124. package/src/apis/me/MeApi.ts +83 -28
  125. package/src/apis/me/types.ts +75 -4
  126. package/src/apis/notifications/NotificationsApi.test.ts +74 -0
  127. package/src/apis/notifications/NotificationsApi.ts +88 -3
  128. package/src/apis/notifications/types.ts +65 -7
  129. package/src/apis/payloads.test-d.ts +82 -2
  130. package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts +4 -1
  131. package/src/apis/serviceAccessManagement/types.ts +3 -0
  132. package/src/apis/stickerUsers/StickerUsersApi.ts +3 -1
  133. package/src/apis/stickerUsers/types.ts +4 -0
  134. package/src/apis/stickers/StickersApi.test.ts +58 -0
  135. package/src/apis/stickers/StickersApi.ts +46 -4
  136. package/src/apis/stickers/types.ts +29 -4
  137. package/src/apis/transcripts/TranscriptsApi.test.ts +14 -21
  138. package/src/apis/transcripts/TranscriptsApi.ts +15 -6
  139. package/src/apis/transcripts/types.ts +4 -0
  140. package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.test.ts +86 -0
  141. package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts +74 -1
  142. package/src/apis/whatsappBusinessTemplates/types.ts +38 -1
@@ -3,8 +3,8 @@ import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
3
3
  //#region src/apis/creditMovements/CreditMovementsApi.ts
4
4
  /**
5
5
  * Credit movements of the account (SMS and AI credits), only for reading: the writes are super
6
- * admin routes (`/admin/credit-movements`). The backend serves only `GET /credit-movements` and
7
- * `GET /credit-movements/:id`.
6
+ * admin routes (`/admin/credit-movements`). Besides the list and the read by id, the backend serves the
7
+ * balances, the totals per connection and the xlsx export.
8
8
  */
9
9
  var CreditMovementsApi = class extends BaseCrudApi {
10
10
  constructor(client) {
@@ -22,6 +22,35 @@ var CreditMovementsApi = class extends BaseCrudApi {
22
22
  deleteById(id, headers) {
23
23
  return super.deleteById(id, headers);
24
24
  }
25
+ /** The balance of each service type of the account. */
26
+ balances(headers) {
27
+ return this.client.get(`${this.basePath}/balances`, headers);
28
+ }
29
+ /**
30
+ * The balance of one service type (a read, despite the POST). Without `serviceType` the route answers 500.
31
+ */
32
+ balance(serviceType, headers) {
33
+ return this.client.post(`${this.basePath}/balance`, { serviceType }, headers);
34
+ }
35
+ /** The balances of the period by service type and connection (`ins` without the trial credits). */
36
+ balancesV2(query, headers) {
37
+ return this.client.get(`${this.basePath}/v2/balances${this.toQueryString(query)}`, headers);
38
+ }
39
+ /**
40
+ * The total of credits of each connection in the period (five per page). Resolves `undefined` (no body)
41
+ * when `filters.from`, `filters.to`, `filters.serviceType` or `page` is missing.
42
+ */
43
+ totalServices(query, headers) {
44
+ return this.client.get(`${this.basePath}/total-services${this.toQueryString(query)}`, headers);
45
+ }
46
+ /**
47
+ * Exports the movements of the period as an xlsx workbook (binary). Needs a client with `requestRaw`.
48
+ * Without `where.$and` the route answers 500.
49
+ */
50
+ async exportXlsx(query, headers) {
51
+ if (!this.client.requestRaw) throw new Error("exportXlsx needs a client with requestRaw (the answer is a binary xlsx)");
52
+ return (await this.client.requestRaw("GET", `${this.basePath}/export${this.toQueryString(query)}`, void 0, headers)).arrayBuffer();
53
+ }
25
54
  };
26
55
 
27
56
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"CreditMovementsApi.mjs","names":[],"sources":["../../../src/apis/creditMovements/CreditMovementsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n CreditMovement,\n CreateCreditMovementPayload,\n UpdateCreditMovementPayload,\n} from './types'\n\n/**\n * Credit movements of the account (SMS and AI credits), only for reading: the writes are super\n * admin routes (`/admin/credit-movements`). The backend serves only `GET /credit-movements` and\n * `GET /credit-movements/:id`.\n */\nexport class CreditMovementsApi extends BaseCrudApi<\n CreditMovement,\n CreateCreditMovementPayload,\n UpdateCreditMovementPayload\n> {\n constructor(client: ApiClient) {\n super(client, '/credit-movements')\n }\n\n /** @deprecated Not served: the backend has no POST /credit-movements, so this route answers 404. */\n override create(\n body: CreateCreditMovementPayload,\n headers?: Record<string, string>,\n ): Promise<CreditMovement> {\n return super.create(body, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /credit-movements/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateCreditMovementPayload,\n headers?: Record<string, string>,\n ): Promise<CreditMovement> {\n return super.updateById(id, body, headers)\n }\n\n /** @deprecated Not served: the backend has no DELETE /credit-movements/:id, so this route answers 404. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<CreditMovement> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,qBAAb,cAAwC,YAItC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,oBAAoB;;;CAIpC,AAAS,OACP,MACA,SACyB;AACzB,SAAO,MAAM,OAAO,MAAM,QAAQ;;;CAIpC,AAAS,WACP,IACA,MACA,SACyB;AACzB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;CAI5C,AAAS,WAAW,IAAY,SAA2D;AACzF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"CreditMovementsApi.mjs","names":[],"sources":["../../../src/apis/creditMovements/CreditMovementsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n CreditMovement,\n CreateCreditMovementPayload,\n UpdateCreditMovementPayload,\n CreditBalances,\n CreditBalanceV2,\n CreditBalancesV2Query,\n CreditMovementServiceType,\n CreditMovementsExportQuery,\n CreditTotalServices,\n CreditTotalServicesQuery,\n} from './types'\n\n/**\n * Credit movements of the account (SMS and AI credits), only for reading: the writes are super\n * admin routes (`/admin/credit-movements`). Besides the list and the read by id, the backend serves the\n * balances, the totals per connection and the xlsx export.\n */\nexport class CreditMovementsApi extends BaseCrudApi<\n CreditMovement,\n CreateCreditMovementPayload,\n UpdateCreditMovementPayload\n> {\n constructor(client: ApiClient) {\n super(client, '/credit-movements')\n }\n\n /** @deprecated Not served: the backend has no POST /credit-movements, so this route answers 404. */\n override create(\n body: CreateCreditMovementPayload,\n headers?: Record<string, string>,\n ): Promise<CreditMovement> {\n return super.create(body, headers)\n }\n\n /** @deprecated Not served: the backend has no PUT /credit-movements/:id, so this route answers 404. */\n override updateById(\n id: string,\n body: UpdateCreditMovementPayload,\n headers?: Record<string, string>,\n ): Promise<CreditMovement> {\n return super.updateById(id, body, headers)\n }\n\n /** @deprecated Not served: the backend has no DELETE /credit-movements/:id, so this route answers 404. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<CreditMovement> {\n return super.deleteById(id, headers)\n }\n\n /** The balance of each service type of the account. */\n balances(headers?: Record<string, string>): Promise<CreditBalances> {\n return this.client.get<CreditBalances>(`${this.basePath}/balances`, headers)\n }\n\n /**\n * The balance of one service type (a read, despite the POST). Without `serviceType` the route answers 500.\n */\n balance(\n serviceType: CreditMovementServiceType,\n headers?: Record<string, string>,\n ): Promise<number> {\n return this.client.post<number, { serviceType: CreditMovementServiceType }>(\n `${this.basePath}/balance`,\n { serviceType },\n headers,\n )\n }\n\n /** The balances of the period by service type and connection (`ins` without the trial credits). */\n balancesV2(\n query?: CreditBalancesV2Query,\n headers?: Record<string, string>,\n ): Promise<Record<CreditMovementServiceType, CreditBalanceV2>> {\n return this.client.get<Record<CreditMovementServiceType, CreditBalanceV2>>(\n `${this.basePath}/v2/balances${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * The total of credits of each connection in the period (five per page). Resolves `undefined` (no body)\n * when `filters.from`, `filters.to`, `filters.serviceType` or `page` is missing.\n */\n totalServices(\n query: CreditTotalServicesQuery,\n headers?: Record<string, string>,\n ): Promise<CreditTotalServices | undefined> {\n return this.client.get<CreditTotalServices | undefined>(\n `${this.basePath}/total-services${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Exports the movements of the period as an xlsx workbook (binary). Needs a client with `requestRaw`.\n * Without `where.$and` the route answers 500.\n */\n async exportXlsx(\n query: CreditMovementsExportQuery,\n headers?: Record<string, string>,\n ): Promise<ArrayBuffer> {\n if (!this.client.requestRaw) {\n throw new Error('exportXlsx needs a client with requestRaw (the answer is a binary xlsx)')\n }\n const response = await this.client.requestRaw(\n 'GET',\n `${this.basePath}/export${this.toQueryString(query)}`,\n undefined,\n headers,\n )\n return response.arrayBuffer()\n }\n}\n"],"mappings":";;;;;;;;AAoBA,IAAa,qBAAb,cAAwC,YAItC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,oBAAoB;;;CAIpC,AAAS,OACP,MACA,SACyB;AACzB,SAAO,MAAM,OAAO,MAAM,QAAQ;;;CAIpC,AAAS,WACP,IACA,MACA,SACyB;AACzB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;CAI5C,AAAS,WAAW,IAAY,SAA2D;AACzF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;CAItC,SAAS,SAA2D;AAClE,SAAO,KAAK,OAAO,IAAoB,GAAG,KAAK,SAAS,YAAY,QAAQ;;;;;CAM9E,QACE,aACA,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,WACjB,EAAE,aAAa,EACf,QACD;;;CAIH,WACE,OACA,SAC6D;AAC7D,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,cAAc,KAAK,cAAc,MAAM,IACxD,QACD;;;;;;CAOH,cACE,OACA,SAC0C;AAC1C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,iBAAiB,KAAK,cAAc,MAAM,IAC3D,QACD;;;;;;CAOH,MAAM,WACJ,OACA,SACsB;AACtB,MAAI,CAAC,KAAK,OAAO,WACf,OAAM,IAAI,MAAM,0EAA0E;AAQ5F,UANiB,MAAM,KAAK,OAAO,WACjC,OACA,GAAG,KAAK,SAAS,SAAS,KAAK,cAAc,MAAM,IACnD,QACA,QACD,EACe,aAAa"}
@@ -4,6 +4,7 @@ import type { User } from '../users/types';
4
4
  export type CreditMovementType = 'in' | 'out';
5
5
  export type CreditMovementServiceType = 'sms-wavy' | 'transcription' | 'summary' | 'magic-text' | 'copilot' | 'csat' | 'agent';
6
6
  export type CreditMovementOrigin = 'trial' | 'single' | 'bulk' | 'chargeback' | 'renewal' | 'reset' | 'agnus' | 'marketplace' | 'copilot' | 'additional' | 'agent';
7
+ /** A movement as the transformer answers it (no `userId`; the relations are never served). */
7
8
  export type CreditMovement = {
8
9
  id: string;
9
10
  type: CreditMovementType;
@@ -11,16 +12,86 @@ export type CreditMovement = {
11
12
  serviceType: CreditMovementServiceType;
12
13
  origin: CreditMovementOrigin | null;
13
14
  accountId: string;
14
- serviceId: string;
15
- userId: string | null;
15
+ /** `null` on the movements of the account (e.g. the trial SMS credits of a new account). */
16
+ serviceId: string | null;
17
+ /** @deprecated Not answered: the transformer of the backend does not send it. */
18
+ userId?: string | null;
16
19
  campaignId: string | null;
17
20
  createdAt: string;
18
21
  updatedAt: string;
22
+ /** @deprecated Not served: the include is dropped by the backend. */
19
23
  service?: Service;
24
+ /** @deprecated Not served: the include is dropped by the backend. */
20
25
  user?: User | null;
26
+ /** @deprecated Not served: the include is dropped by the backend. */
21
27
  campaign?: Campaign | null;
22
28
  };
29
+ /** None is served: the backend drops every include of this route. */
23
30
  export type CreditMovementRelationships = 'service' | 'user' | 'campaign';
31
+ /** The balance of each service type (`balances`): the movements in minus the movements out. */
32
+ export type CreditBalances = Record<CreditMovementServiceType, number>;
33
+ /** The totals of a service type in `balancesV2`. */
34
+ export type CreditBalanceTotals = {
35
+ ins: number;
36
+ outs: number;
37
+ balance: number;
38
+ used: number;
39
+ contractedCredits?: number;
40
+ additionalCredits?: number;
41
+ realConsumption?: number;
42
+ };
43
+ /**
44
+ * A service type in `balancesV2`: `all` with the totals, `history` with the rows of the period, and one
45
+ * key per connection name with its totals. The `ins` count the credits of the plan (`plan.ai`) and the
46
+ * additional ones: the trial SMS credits are not counted (they show in `balances`).
47
+ */
48
+ export type CreditBalanceV2 = {
49
+ all: CreditBalanceTotals;
50
+ history?: Record<string, unknown>[];
51
+ [serviceName: string]: unknown;
52
+ };
53
+ export type CreditBalancesV2Query = {
54
+ from?: string;
55
+ to?: string;
56
+ serviceId?: string;
57
+ };
58
+ /**
59
+ * Query of `totalServices`: without `filters.from`, `filters.to`, `filters.serviceType` and `page` the route
60
+ * answers 200 with no body.
61
+ */
62
+ export type CreditTotalServicesQuery = {
63
+ filters: {
64
+ from: string;
65
+ to: string;
66
+ serviceType: CreditMovementServiceType;
67
+ servicesIds?: string[];
68
+ };
69
+ /** From 1 (`0` answers 500 `Invalid param`). Five connections per page. */
70
+ page: number;
71
+ };
72
+ /** The total of credits of each connection in the period, five per page (the counts come as text). */
73
+ export type CreditTotalServices = {
74
+ data: {
75
+ id: string;
76
+ name: string;
77
+ total: string;
78
+ }[];
79
+ total: string;
80
+ limit: number;
81
+ skip: number;
82
+ currentPage: string | number;
83
+ lastPage: number;
84
+ from: number;
85
+ to: number;
86
+ };
87
+ /** Query of `exportXlsx`: the period and the conditions in `where.$and` (required by the backend). */
88
+ export type CreditMovementsExportQuery = {
89
+ from: string;
90
+ to: string;
91
+ where: {
92
+ $and: Record<string, unknown>[];
93
+ };
94
+ };
24
95
  export type CreateCreditMovementPayload = {
25
96
  type: CreditMovementType;
26
97
  serviceType: CreditMovementServiceType;
@@ -1 +1 @@
1
- {"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class extends require_core_BaseCrudApi.BaseCrudApi
7
7
  super(client, "/interactive-messages");
8
8
  }
9
9
  /**
10
+ * Counts the interactive messages matching the query.
11
+ * @permissions interactive-messages.view OR interactive-messages.management.all.departments
12
+ */
13
+ count(query, headers) {
14
+ return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
15
+ }
16
+ /**
17
+ * Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as
18
+ * sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.
19
+ * @permissions interactive-messages.create OR interactive-messages.management.all.departments
20
+ */
21
+ create(body, headers) {
22
+ return super.create(body, headers);
23
+ }
24
+ /**
10
25
  * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.
11
26
  * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments
12
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"InteractiveMessagesApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n} from './types'\n\nexport class InteractiveMessagesApi extends BaseCrudApi<\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n ListQuery<InteractiveMessage>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/interactive-messages')\n }\n\n /**\n * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;AASA,IAAa,yBAAb,cAA4CA,qCAM1C;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,wBAAwB;;;;;;CAOxC,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"InteractiveMessagesApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n} from './types'\n\nexport class InteractiveMessagesApi extends BaseCrudApi<\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n ListQuery<InteractiveMessage>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/interactive-messages')\n }\n\n /**\n * Counts the interactive messages matching the query.\n * @permissions interactive-messages.view OR interactive-messages.management.all.departments\n */\n count(\n query?: ListQuery<InteractiveMessage>,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.get<{ count: number }>(\n `${this.basePath}/count${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as\n * sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.\n * @permissions interactive-messages.create OR interactive-messages.management.all.departments\n */\n override create(\n body: CreateInteractiveMessagePayload,\n headers?: Record<string, string>,\n ): Promise<InteractiveMessage> {\n return super.create(body, headers)\n }\n\n /**\n * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;AASA,IAAa,yBAAb,cAA4CA,qCAM1C;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,wBAAwB;;;;;;CAOxC,MACE,OACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;;;;;;CAQH,AAAS,OACP,MACA,SAC6B;AAC7B,SAAO,MAAM,OAAO,MAAM,QAAQ;;;;;;CAOpC,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
@@ -4,6 +4,19 @@ import { BaseCrudApi } from '../../core/BaseCrudApi';
4
4
  import type { InteractiveMessage, CreateInteractiveMessagePayload, UpdateInteractiveMessagePayload } from './types';
5
5
  export declare class InteractiveMessagesApi extends BaseCrudApi<InteractiveMessage, CreateInteractiveMessagePayload, UpdateInteractiveMessagePayload, ListQuery<InteractiveMessage>, 'OK'> {
6
6
  constructor(client: ApiClient);
7
+ /**
8
+ * Counts the interactive messages matching the query.
9
+ * @permissions interactive-messages.view OR interactive-messages.management.all.departments
10
+ */
11
+ count(query?: ListQuery<InteractiveMessage>, headers?: Record<string, string>): Promise<{
12
+ count: number;
13
+ }>;
14
+ /**
15
+ * Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as
16
+ * sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.
17
+ * @permissions interactive-messages.create OR interactive-messages.management.all.departments
18
+ */
19
+ create(body: CreateInteractiveMessagePayload, headers?: Record<string, string>): Promise<InteractiveMessage>;
7
20
  /**
8
21
  * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.
9
22
  * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments
@@ -1 +1 @@
1
- {"version":3,"file":"InteractiveMessagesApi.d.ts","sourceRoot":"","sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,SAAS,CAAA;AAEhB,qBAAa,sBAAuB,SAAQ,WAAW,CACrD,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,SAAS,CAAC,kBAAkB,CAAC,EAC7B,IAAI,CACL;gBACa,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjF"}
1
+ {"version":3,"file":"InteractiveMessagesApi.d.ts","sourceRoot":"","sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,SAAS,CAAA;AAEhB,qBAAa,sBAAuB,SAAQ,WAAW,CACrD,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,SAAS,CAAC,kBAAkB,CAAC,EAC7B,IAAI,CACL;gBACa,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACH,KAAK,CACH,KAAK,CAAC,EAAE,SAAS,CAAC,kBAAkB,CAAC,EACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAO7B;;;;OAIG;IACM,MAAM,CACb,IAAI,EAAE,+BAA+B,EACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,kBAAkB,CAAC;IAI9B;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjF"}
@@ -6,6 +6,21 @@ var InteractiveMessagesApi = class extends BaseCrudApi {
6
6
  super(client, "/interactive-messages");
7
7
  }
8
8
  /**
9
+ * Counts the interactive messages matching the query.
10
+ * @permissions interactive-messages.view OR interactive-messages.management.all.departments
11
+ */
12
+ count(query, headers) {
13
+ return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
14
+ }
15
+ /**
16
+ * Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as
17
+ * sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.
18
+ * @permissions interactive-messages.create OR interactive-messages.management.all.departments
19
+ */
20
+ create(body, headers) {
21
+ return super.create(body, headers);
22
+ }
23
+ /**
9
24
  * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.
10
25
  * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments
11
26
  */
@@ -1 +1 @@
1
- {"version":3,"file":"InteractiveMessagesApi.mjs","names":[],"sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n} from './types'\n\nexport class InteractiveMessagesApi extends BaseCrudApi<\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n ListQuery<InteractiveMessage>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/interactive-messages')\n }\n\n /**\n * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;AASA,IAAa,yBAAb,cAA4C,YAM1C;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,wBAAwB;;;;;;CAOxC,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"InteractiveMessagesApi.mjs","names":[],"sources":["../../../src/apis/interactiveMessages/InteractiveMessagesApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n} from './types'\n\nexport class InteractiveMessagesApi extends BaseCrudApi<\n InteractiveMessage,\n CreateInteractiveMessagePayload,\n UpdateInteractiveMessagePayload,\n ListQuery<InteractiveMessage>,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/interactive-messages')\n }\n\n /**\n * Counts the interactive messages matching the query.\n * @permissions interactive-messages.view OR interactive-messages.management.all.departments\n */\n count(\n query?: ListQuery<InteractiveMessage>,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.get<{ count: number }>(\n `${this.basePath}/count${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Creates an interactive message. Only `cta_url` is validated by the backend (the other types are stored as\n * sent). The answer has no `departments` nor `file`: read them with `getById` and `include`.\n * @permissions interactive-messages.create OR interactive-messages.management.all.departments\n */\n override create(\n body: CreateInteractiveMessagePayload,\n headers?: Record<string, string>,\n ): Promise<InteractiveMessage> {\n return super.create(body, headers)\n }\n\n /**\n * Deletes an interactive message. Resolves the text `'OK'`; an unknown id answers 500.\n * @permissions interactive-messages.destroy OR interactive-messages.management.all.departments\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<'OK'> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;AASA,IAAa,yBAAb,cAA4C,YAM1C;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,wBAAwB;;;;;;CAOxC,MACE,OACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;;;;;;CAQH,AAAS,OACP,MACA,SAC6B;AAC7B,SAAO,MAAM,OAAO,MAAM,QAAQ;;;;;;CAOpC,AAAS,WAAW,IAAY,SAAiD;AAC/E,SAAO,MAAM,WAAW,IAAI,QAAQ"}
@@ -154,7 +154,8 @@ type InteractiveMessageFilePayload = {
154
154
  export type InteractiveMessage = {
155
155
  id: string;
156
156
  name: string;
157
- type: 'list' | 'button' | 'cta_url' | 'request_contact_info';
157
+ /** @deprecated Not a field of the backend (no such column): the type is `interactive.type`. */
158
+ type?: 'list' | 'button' | 'cta_url' | 'request_contact_info';
158
159
  interactive: InteractiveMessageContent;
159
160
  archivedAt: string | null;
160
161
  accountId: string;
@@ -163,8 +164,9 @@ export type InteractiveMessage = {
163
164
  deletedAt: string | null;
164
165
  file?: File | null;
165
166
  departments?: Department[];
167
+ account?: Record<string, unknown>;
166
168
  };
167
- export type InteractiveMessageRelationships = 'file' | 'departments';
169
+ export type InteractiveMessageRelationships = 'file' | 'departments' | 'account';
168
170
  export type CreateInteractiveMessagePayload = {
169
171
  name: string;
170
172
  interactive: InteractiveMessageContentInput;
@@ -174,6 +176,10 @@ export type CreateInteractiveMessagePayload = {
174
176
  }[];
175
177
  file?: InteractiveMessageFilePayload;
176
178
  };
179
+ /**
180
+ * The backend requires `name` and `interactive` on the update too. It replaces the departments: omitting
181
+ * `departmentIds`/`departments` clears them. Only `file.base64Url` is read (a `file.id` is ignored).
182
+ */
177
183
  export type UpdateInteractiveMessagePayload = {
178
184
  name?: string;
179
185
  interactive?: InteractiveMessageContentInput;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/interactiveMessages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB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CAAA;IAExB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,CAAA;AAEhF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,8BAA8B,CAAA;IAC3C,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC9B,IAAI,CAAC,EAAE,6BAA6B,CAAA;CACrC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,8BAA8B,CAAA;IAC5C,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC9B,IAAI,CAAC,EAAE,6BAA6B,CAAA;CACrC,CAAA"}
@@ -2,6 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
3
3
 
4
4
  //#region src/apis/knowledgeBase/KnowledgeBaseApi.ts
5
+ /**
6
+ * Knowledge bases of the AI (copilot). The CRUD of a base without items only touches the database; an item
7
+ * VECTORIZES its content in the AI service, and the suggestions call the AI and DEBIT the copilot credits of
8
+ * the account.
9
+ */
5
10
  var KnowledgeBaseApi = class extends require_core_BaseCrudApi.BaseCrudApi {
6
11
  constructor(client) {
7
12
  super(client, "/knowledge-base");
@@ -14,6 +19,28 @@ var KnowledgeBaseApi = class extends require_core_BaseCrudApi.BaseCrudApi {
14
19
  deleteById(id, headers) {
15
20
  return super.deleteById(id, headers);
16
21
  }
22
+ /**
23
+ * Creates a base, or updates the one of `id`, with its items, in a transaction. Each item VECTORIZES its
24
+ * content in the AI service (with `items: []` only the database is touched). Resolves the stored base
25
+ * (raw). A body out of the schema answers 500 with the issues of the validation.
26
+ */
27
+ saveWithItems(body, headers) {
28
+ return this.client.post(`${this.basePath}/save-with-items`, body, headers);
29
+ }
30
+ /**
31
+ * Suggests an answer to a message with the AI (copilot) and DEBITS the copilot credits of the account; an
32
+ * audio is transcribed first (charged too).
33
+ */
34
+ suggestByMessage(body, headers) {
35
+ return this.client.post(`${this.basePath}/suggest-by-message`, body, headers);
36
+ }
37
+ /**
38
+ * Suggests an answer to a ticket with the AI (copilot) and DEBITS the copilot credits of the account; the
39
+ * audios of the ticket are transcribed first (charged too).
40
+ */
41
+ suggestByTicket(body, headers) {
42
+ return this.client.post(`${this.basePath}/suggest-by-ticket`, body, headers);
43
+ }
17
44
  };
18
45
 
19
46
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"KnowledgeBaseApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/knowledgeBase/KnowledgeBaseApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { KnowledgeBase, CreateKnowledgeBasePayload, UpdateKnowledgeBasePayload } from './types'\n\nexport class KnowledgeBaseApi extends BaseCrudApi<\n KnowledgeBase,\n CreateKnowledgeBasePayload,\n UpdateKnowledgeBasePayload,\n ListQuery<KnowledgeBase>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base')\n }\n\n /**\n * Deletes a knowledge base. Resolves `false` even when it deleted (the backend answers nothing\n * from the deletion), so do not read it as the result: check with `getById`. An unknown id\n * answers 500.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;AAKA,IAAa,mBAAb,cAAsCA,qCAMpC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,kBAAkB;;;;;;;CAQlC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"KnowledgeBaseApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/knowledgeBase/KnowledgeBaseApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBase,\n CreateKnowledgeBasePayload,\n UpdateKnowledgeBasePayload,\n KnowledgeBaseSuggestion,\n SaveKnowledgeBaseWithItemsPayload,\n SavedKnowledgeBase,\n SuggestByMessagePayload,\n SuggestByTicketPayload,\n} from './types'\n\n/**\n * Knowledge bases of the AI (copilot). The CRUD of a base without items only touches the database; an item\n * VECTORIZES its content in the AI service, and the suggestions call the AI and DEBIT the copilot credits of\n * the account.\n */\nexport class KnowledgeBaseApi extends BaseCrudApi<\n KnowledgeBase,\n CreateKnowledgeBasePayload,\n UpdateKnowledgeBasePayload,\n ListQuery<KnowledgeBase>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base')\n }\n\n /**\n * Deletes a knowledge base. Resolves `false` even when it deleted (the backend answers nothing\n * from the deletion), so do not read it as the result: check with `getById`. An unknown id\n * answers 500.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Creates a base, or updates the one of `id`, with its items, in a transaction. Each item VECTORIZES its\n * content in the AI service (with `items: []` only the database is touched). Resolves the stored base\n * (raw). A body out of the schema answers 500 with the issues of the validation.\n */\n saveWithItems(\n body: SaveKnowledgeBaseWithItemsPayload,\n headers?: Record<string, string>,\n ): Promise<SavedKnowledgeBase> {\n return this.client.post<SavedKnowledgeBase, SaveKnowledgeBaseWithItemsPayload>(\n `${this.basePath}/save-with-items`,\n body,\n headers,\n )\n }\n\n /**\n * Suggests an answer to a message with the AI (copilot) and DEBITS the copilot credits of the account; an\n * audio is transcribed first (charged too).\n */\n suggestByMessage(\n body: SuggestByMessagePayload,\n headers?: Record<string, string>,\n ): Promise<KnowledgeBaseSuggestion> {\n return this.client.post<KnowledgeBaseSuggestion, SuggestByMessagePayload>(\n `${this.basePath}/suggest-by-message`,\n body,\n headers,\n )\n }\n\n /**\n * Suggests an answer to a ticket with the AI (copilot) and DEBITS the copilot credits of the account; the\n * audios of the ticket are transcribed first (charged too).\n */\n suggestByTicket(\n body: SuggestByTicketPayload,\n headers?: Record<string, string>,\n ): Promise<KnowledgeBaseSuggestion> {\n return this.client.post<KnowledgeBaseSuggestion, SuggestByTicketPayload>(\n `${this.basePath}/suggest-by-ticket`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,IAAa,mBAAb,cAAsCA,qCAMpC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,kBAAkB;;;;;;;CAQlC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,cACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,iBACE,MACA,SACkC;AAClC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,sBACjB,MACA,QACD;;;;;;CAOH,gBACE,MACA,SACkC;AAClC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,qBACjB,MACA,QACD"}
@@ -1,7 +1,12 @@
1
1
  import type { ApiClient } from '../../core/ApiClient';
2
2
  import type { ListQuery } from '../../core/types';
3
3
  import { BaseCrudApi } from '../../core/BaseCrudApi';
4
- import type { KnowledgeBase, CreateKnowledgeBasePayload, UpdateKnowledgeBasePayload } from './types';
4
+ import type { KnowledgeBase, CreateKnowledgeBasePayload, UpdateKnowledgeBasePayload, KnowledgeBaseSuggestion, SaveKnowledgeBaseWithItemsPayload, SavedKnowledgeBase, SuggestByMessagePayload, SuggestByTicketPayload } from './types';
5
+ /**
6
+ * Knowledge bases of the AI (copilot). The CRUD of a base without items only touches the database; an item
7
+ * VECTORIZES its content in the AI service, and the suggestions call the AI and DEBIT the copilot credits of
8
+ * the account.
9
+ */
5
10
  export declare class KnowledgeBaseApi extends BaseCrudApi<KnowledgeBase, CreateKnowledgeBasePayload, UpdateKnowledgeBasePayload, ListQuery<KnowledgeBase>, false> {
6
11
  constructor(client: ApiClient);
7
12
  /**
@@ -10,5 +15,21 @@ export declare class KnowledgeBaseApi extends BaseCrudApi<KnowledgeBase, CreateK
10
15
  * answers 500.
11
16
  */
12
17
  deleteById(id: string, headers?: Record<string, string>): Promise<false>;
18
+ /**
19
+ * Creates a base, or updates the one of `id`, with its items, in a transaction. Each item VECTORIZES its
20
+ * content in the AI service (with `items: []` only the database is touched). Resolves the stored base
21
+ * (raw). A body out of the schema answers 500 with the issues of the validation.
22
+ */
23
+ saveWithItems(body: SaveKnowledgeBaseWithItemsPayload, headers?: Record<string, string>): Promise<SavedKnowledgeBase>;
24
+ /**
25
+ * Suggests an answer to a message with the AI (copilot) and DEBITS the copilot credits of the account; an
26
+ * audio is transcribed first (charged too).
27
+ */
28
+ suggestByMessage(body: SuggestByMessagePayload, headers?: Record<string, string>): Promise<KnowledgeBaseSuggestion>;
29
+ /**
30
+ * Suggests an answer to a ticket with the AI (copilot) and DEBITS the copilot credits of the account; the
31
+ * audios of the ticket are transcribed first (charged too).
32
+ */
33
+ suggestByTicket(body: SuggestByTicketPayload, headers?: Record<string, string>): Promise<KnowledgeBaseSuggestion>;
13
34
  }
14
35
  //# sourceMappingURL=KnowledgeBaseApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KnowledgeBaseApi.d.ts","sourceRoot":"","sources":["../../../src/apis/knowledgeBase/KnowledgeBaseApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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,OAAO,CAAC,KAAK,CAAC;IAIjF;;;;OAIG;IACH,aAAa,CACX,IAAI,EAAE,iCAAiC,EACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,kBAAkB,CAAC;IAQ9B;;;OAGG;IACH,gBAAgB,CACd,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,uBAAuB,CAAC;IAQnC;;;OAGG;IACH,eAAe,CACb,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,uBAAuB,CAAC;CAOpC"}
@@ -1,6 +1,11 @@
1
1
  import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
2
2
 
3
3
  //#region src/apis/knowledgeBase/KnowledgeBaseApi.ts
4
+ /**
5
+ * Knowledge bases of the AI (copilot). The CRUD of a base without items only touches the database; an item
6
+ * VECTORIZES its content in the AI service, and the suggestions call the AI and DEBIT the copilot credits of
7
+ * the account.
8
+ */
4
9
  var KnowledgeBaseApi = class extends BaseCrudApi {
5
10
  constructor(client) {
6
11
  super(client, "/knowledge-base");
@@ -13,6 +18,28 @@ var KnowledgeBaseApi = class extends BaseCrudApi {
13
18
  deleteById(id, headers) {
14
19
  return super.deleteById(id, headers);
15
20
  }
21
+ /**
22
+ * Creates a base, or updates the one of `id`, with its items, in a transaction. Each item VECTORIZES its
23
+ * content in the AI service (with `items: []` only the database is touched). Resolves the stored base
24
+ * (raw). A body out of the schema answers 500 with the issues of the validation.
25
+ */
26
+ saveWithItems(body, headers) {
27
+ return this.client.post(`${this.basePath}/save-with-items`, body, headers);
28
+ }
29
+ /**
30
+ * Suggests an answer to a message with the AI (copilot) and DEBITS the copilot credits of the account; an
31
+ * audio is transcribed first (charged too).
32
+ */
33
+ suggestByMessage(body, headers) {
34
+ return this.client.post(`${this.basePath}/suggest-by-message`, body, headers);
35
+ }
36
+ /**
37
+ * Suggests an answer to a ticket with the AI (copilot) and DEBITS the copilot credits of the account; the
38
+ * audios of the ticket are transcribed first (charged too).
39
+ */
40
+ suggestByTicket(body, headers) {
41
+ return this.client.post(`${this.basePath}/suggest-by-ticket`, body, headers);
42
+ }
16
43
  };
17
44
 
18
45
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"KnowledgeBaseApi.mjs","names":[],"sources":["../../../src/apis/knowledgeBase/KnowledgeBaseApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { KnowledgeBase, CreateKnowledgeBasePayload, UpdateKnowledgeBasePayload } from './types'\n\nexport class KnowledgeBaseApi extends BaseCrudApi<\n KnowledgeBase,\n CreateKnowledgeBasePayload,\n UpdateKnowledgeBasePayload,\n ListQuery<KnowledgeBase>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base')\n }\n\n /**\n * Deletes a knowledge base. Resolves `false` even when it deleted (the backend answers nothing\n * from the deletion), so do not read it as the result: check with `getById`. An unknown id\n * answers 500.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;AAKA,IAAa,mBAAb,cAAsC,YAMpC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,kBAAkB;;;;;;;CAQlC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"KnowledgeBaseApi.mjs","names":[],"sources":["../../../src/apis/knowledgeBase/KnowledgeBaseApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBase,\n CreateKnowledgeBasePayload,\n UpdateKnowledgeBasePayload,\n KnowledgeBaseSuggestion,\n SaveKnowledgeBaseWithItemsPayload,\n SavedKnowledgeBase,\n SuggestByMessagePayload,\n SuggestByTicketPayload,\n} from './types'\n\n/**\n * Knowledge bases of the AI (copilot). The CRUD of a base without items only touches the database; an item\n * VECTORIZES its content in the AI service, and the suggestions call the AI and DEBIT the copilot credits of\n * the account.\n */\nexport class KnowledgeBaseApi extends BaseCrudApi<\n KnowledgeBase,\n CreateKnowledgeBasePayload,\n UpdateKnowledgeBasePayload,\n ListQuery<KnowledgeBase>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base')\n }\n\n /**\n * Deletes a knowledge base. Resolves `false` even when it deleted (the backend answers nothing\n * from the deletion), so do not read it as the result: check with `getById`. An unknown id\n * answers 500.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Creates a base, or updates the one of `id`, with its items, in a transaction. Each item VECTORIZES its\n * content in the AI service (with `items: []` only the database is touched). Resolves the stored base\n * (raw). A body out of the schema answers 500 with the issues of the validation.\n */\n saveWithItems(\n body: SaveKnowledgeBaseWithItemsPayload,\n headers?: Record<string, string>,\n ): Promise<SavedKnowledgeBase> {\n return this.client.post<SavedKnowledgeBase, SaveKnowledgeBaseWithItemsPayload>(\n `${this.basePath}/save-with-items`,\n body,\n headers,\n )\n }\n\n /**\n * Suggests an answer to a message with the AI (copilot) and DEBITS the copilot credits of the account; an\n * audio is transcribed first (charged too).\n */\n suggestByMessage(\n body: SuggestByMessagePayload,\n headers?: Record<string, string>,\n ): Promise<KnowledgeBaseSuggestion> {\n return this.client.post<KnowledgeBaseSuggestion, SuggestByMessagePayload>(\n `${this.basePath}/suggest-by-message`,\n body,\n headers,\n )\n }\n\n /**\n * Suggests an answer to a ticket with the AI (copilot) and DEBITS the copilot credits of the account; the\n * audios of the ticket are transcribed first (charged too).\n */\n suggestByTicket(\n body: SuggestByTicketPayload,\n headers?: Record<string, string>,\n ): Promise<KnowledgeBaseSuggestion> {\n return this.client.post<KnowledgeBaseSuggestion, SuggestByTicketPayload>(\n `${this.basePath}/suggest-by-ticket`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;AAmBA,IAAa,mBAAb,cAAsC,YAMpC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,kBAAkB;;;;;;;CAQlC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,cACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,iBACE,MACA,SACkC;AAClC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,sBACjB,MACA,QACD;;;;;;CAOH,gBACE,MACA,SACkC;AAClC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,qBACjB,MACA,QACD"}
@@ -1,4 +1,5 @@
1
1
  import type { KnowledgeBaseItem } from '../knowledgeBaseItem/types';
2
+ /** A knowledge base as the transformer answers it (`items` always comes: `[]` without the include). */
2
3
  export type KnowledgeBase = {
3
4
  id: string;
4
5
  name: string;
@@ -6,16 +7,69 @@ export type KnowledgeBase = {
6
7
  accountId: string;
7
8
  createdAt: string;
8
9
  updatedAt: string;
9
- deletedAt: string | null;
10
+ /** @deprecated Not answered: the transformer of the backend does not send it. */
11
+ deletedAt?: string | null;
10
12
  items?: KnowledgeBaseItem[];
13
+ account?: Record<string, unknown>;
11
14
  };
12
- export type KnowledgeBaseRelationships = 'items';
15
+ export type KnowledgeBaseRelationships = 'items' | 'account';
13
16
  export type CreateKnowledgeBasePayload = {
17
+ /** Up to 60 characters. */
14
18
  name: string;
19
+ /** Up to 600 characters. */
15
20
  description?: string;
16
21
  };
22
+ /** The backend requires `name` on the update too (400 without it). */
17
23
  export type UpdateKnowledgeBasePayload = {
18
24
  name?: string;
19
25
  description?: string | null;
20
26
  };
27
+ /**
28
+ * An item of `saveWithItems`. Any item VECTORIZES its content in the AI service (Haystack) on the save:
29
+ * `text` for `messages`, `url` for `urls` (the service fetches the page), `fileId` for `files`.
30
+ */
31
+ export type SaveKnowledgeBaseItemInput = {
32
+ name: string;
33
+ type: 'urls' | 'files' | 'messages';
34
+ url?: string;
35
+ fileId?: string;
36
+ text?: string;
37
+ };
38
+ /** The body of `saveWithItems`: creates the base, or updates the one of `id`, with its items. */
39
+ export type SaveKnowledgeBaseWithItemsPayload = {
40
+ /** 1 to 60 characters. */
41
+ name: string;
42
+ /** Up to 600 characters. */
43
+ description?: string;
44
+ /** The base to update (absent: a new base). */
45
+ id?: string;
46
+ items?: SaveKnowledgeBaseItemInput[];
47
+ /** Items of the base to delete. */
48
+ deleteItemIds?: string[];
49
+ };
50
+ /** The stored base answered by `saveWithItems` (raw: with `synchronized`, without `items`). */
51
+ export type SavedKnowledgeBase = Omit<KnowledgeBase, 'items' | 'account' | 'deletedAt'> & {
52
+ synchronized: boolean | null;
53
+ deletedAt: string | null;
54
+ };
55
+ /**
56
+ * What the suggestions answer: the suggested text, or a `message` code when nothing was suggested (e.g.
57
+ * `COPILOT_LIMIT_REACHED`, `COPILOT_TRANSCRIPTION_NOT_ENABLED`, `TRANSCRIBING_AUDIO_MESSAGES`).
58
+ */
59
+ export type KnowledgeBaseSuggestion = {
60
+ message: string;
61
+ hasAudioMessage?: boolean;
62
+ hadEnoughCreditsToTranscribe?: boolean;
63
+ [key: string]: unknown;
64
+ };
65
+ export type SuggestByMessagePayload = {
66
+ messageId: string;
67
+ /** Lets the AI answer beyond the knowledge base. */
68
+ outsideTheKnowledgeBase?: boolean;
69
+ };
70
+ export type SuggestByTicketPayload = {
71
+ ticketId: string;
72
+ /** Lets the AI answer beyond the knowledge base. */
73
+ outsideTheKnowledgeBase?: boolean;
74
+ };
21
75
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/knowledgeBase/types.ts"],"names":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B,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,oDAAoD;IACpD,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC,CAAA"}
@@ -2,6 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
3
3
 
4
4
  //#region src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts
5
+ /**
6
+ * Items of the knowledge bases. Creating an item VECTORIZES its content in the AI service; reading the
7
+ * `docs` (include, `fetchMany`) reads them from it.
8
+ */
5
9
  var KnowledgeBaseItemApi = class extends require_core_BaseCrudApi.BaseCrudApi {
6
10
  constructor(client) {
7
11
  super(client, "/knowledge-base-item");
@@ -14,6 +18,28 @@ var KnowledgeBaseItemApi = class extends require_core_BaseCrudApi.BaseCrudApi {
14
18
  deleteById(id, headers) {
15
19
  return super.deleteById(id, headers);
16
20
  }
21
+ /**
22
+ * Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:
23
+ * unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`
24
+ * answers 400 `Invalid knowledge base item ids`.
25
+ */
26
+ fetchMany(ids, headers) {
27
+ return this.client.post(`${this.basePath}/fetch-many`, { ids }, headers);
28
+ }
29
+ /**
30
+ * Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).
31
+ * Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.
32
+ */
33
+ deleteMany(ids, headers) {
34
+ return this.client.request("DELETE", `${this.basePath}/many`, { ids }, headers);
35
+ }
36
+ /**
37
+ * Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it
38
+ * resolves `{ hasText: false }`.
39
+ */
40
+ checkPdfText(body, headers) {
41
+ return this.client.post(`${this.basePath}/check-pdf-text`, body, headers);
42
+ }
17
43
  };
18
44
 
19
45
  //#endregion