@ikatec/digisac-api-sdk 4.12.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) 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/creditMovements/CreditMovementsApi.cjs +31 -2
  18. package/dist/apis/creditMovements/CreditMovementsApi.cjs.map +1 -1
  19. package/dist/apis/creditMovements/CreditMovementsApi.d.ts +21 -3
  20. package/dist/apis/creditMovements/CreditMovementsApi.d.ts.map +1 -1
  21. package/dist/apis/creditMovements/CreditMovementsApi.mjs +31 -2
  22. package/dist/apis/creditMovements/CreditMovementsApi.mjs.map +1 -1
  23. package/dist/apis/creditMovements/types.d.ts +73 -2
  24. package/dist/apis/creditMovements/types.d.ts.map +1 -1
  25. package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs +27 -0
  26. package/dist/apis/knowledgeBase/KnowledgeBaseApi.cjs.map +1 -1
  27. package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts +22 -1
  28. package/dist/apis/knowledgeBase/KnowledgeBaseApi.d.ts.map +1 -1
  29. package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs +27 -0
  30. package/dist/apis/knowledgeBase/KnowledgeBaseApi.mjs.map +1 -1
  31. package/dist/apis/knowledgeBase/types.d.ts +56 -2
  32. package/dist/apis/knowledgeBase/types.d.ts.map +1 -1
  33. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs +26 -0
  34. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.cjs.map +1 -1
  35. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts +24 -0
  36. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.d.ts.map +1 -1
  37. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs +26 -0
  38. package/dist/apis/knowledgeBaseItem/KnowledgeBaseItemApi.mjs.map +1 -1
  39. package/dist/apis/knowledgeBaseItem/types.d.ts +23 -6
  40. package/dist/apis/knowledgeBaseItem/types.d.ts.map +1 -1
  41. package/dist/apis/notifications/NotificationsApi.cjs +50 -2
  42. package/dist/apis/notifications/NotificationsApi.cjs.map +1 -1
  43. package/dist/apis/notifications/NotificationsApi.d.ts +41 -3
  44. package/dist/apis/notifications/NotificationsApi.d.ts.map +1 -1
  45. package/dist/apis/notifications/NotificationsApi.mjs +50 -2
  46. package/dist/apis/notifications/NotificationsApi.mjs.map +1 -1
  47. package/dist/apis/notifications/types.d.ts +54 -8
  48. package/dist/apis/notifications/types.d.ts.map +1 -1
  49. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.cjs.map +1 -1
  50. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts +4 -1
  51. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts.map +1 -1
  52. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs.map +1 -1
  53. package/dist/apis/serviceAccessManagement/types.d.ts +3 -0
  54. package/dist/apis/serviceAccessManagement/types.d.ts.map +1 -1
  55. package/dist/apis/stickerUsers/StickerUsersApi.cjs.map +1 -1
  56. package/dist/apis/stickerUsers/StickerUsersApi.d.ts +3 -1
  57. package/dist/apis/stickerUsers/StickerUsersApi.d.ts.map +1 -1
  58. package/dist/apis/stickerUsers/StickerUsersApi.mjs.map +1 -1
  59. package/dist/apis/stickerUsers/types.d.ts +4 -0
  60. package/dist/apis/stickerUsers/types.d.ts.map +1 -1
  61. package/dist/apis/stickers/StickersApi.cjs +27 -3
  62. package/dist/apis/stickers/StickersApi.cjs.map +1 -1
  63. package/dist/apis/stickers/StickersApi.d.ts +24 -4
  64. package/dist/apis/stickers/StickersApi.d.ts.map +1 -1
  65. package/dist/apis/stickers/StickersApi.mjs +27 -3
  66. package/dist/apis/stickers/StickersApi.mjs.map +1 -1
  67. package/dist/apis/stickers/types.d.ts +28 -4
  68. package/dist/apis/stickers/types.d.ts.map +1 -1
  69. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs +1 -2
  70. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.cjs.map +1 -1
  71. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts +1 -2
  72. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.d.ts.map +1 -1
  73. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs +1 -2
  74. package/dist/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.mjs.map +1 -1
  75. package/package.json +1 -1
  76. package/src/apis/absence/AbsenceApi.test.ts +65 -0
  77. package/src/apis/absence/AbsenceApi.ts +77 -4
  78. package/src/apis/absence/types.ts +53 -2
  79. package/src/apis/activityLog/ActivityLogApi.test.ts +44 -0
  80. package/src/apis/activityLog/ActivityLogApi.ts +22 -3
  81. package/src/apis/activityLog/types.ts +47 -8
  82. package/src/apis/creditMovements/CreditMovementsApi.test.ts +88 -0
  83. package/src/apis/creditMovements/CreditMovementsApi.ts +73 -2
  84. package/src/apis/creditMovements/types.ts +74 -2
  85. package/src/apis/knowledgeBase/KnowledgeBaseApi.test.ts +54 -0
  86. package/src/apis/knowledgeBase/KnowledgeBaseApi.ts +61 -1
  87. package/src/apis/knowledgeBase/types.ts +62 -2
  88. package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.test.ts +57 -0
  89. package/src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts +45 -0
  90. package/src/apis/knowledgeBaseItem/types.ts +23 -6
  91. package/src/apis/me/MeApi.test.ts +1 -1
  92. package/src/apis/notifications/NotificationsApi.test.ts +74 -0
  93. package/src/apis/notifications/NotificationsApi.ts +88 -3
  94. package/src/apis/notifications/types.ts +65 -7
  95. package/src/apis/payloads.test-d.ts +46 -0
  96. package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts +4 -1
  97. package/src/apis/serviceAccessManagement/types.ts +3 -0
  98. package/src/apis/stickerUsers/StickerUsersApi.ts +3 -1
  99. package/src/apis/stickerUsers/types.ts +4 -0
  100. package/src/apis/stickers/StickersApi.test.ts +58 -0
  101. package/src/apis/stickers/StickersApi.ts +46 -4
  102. package/src/apis/stickers/types.ts +29 -4
  103. package/src/apis/whatsappBusinessTemplates/WhatsappBusinessTemplatesApi.ts +1 -2
@@ -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
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/creditMovements/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,KAAK,CAAA;AAE7C,MAA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,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,sGAAsG;AACtG,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAAE,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,kBAAkB,CAAA;IACxB,WAAW,EAAE,yBAAyB,CAAA;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,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,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,EAAE,aAAa,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAEpG,qBAAa,gBAAiB,SAAQ,WAAW,CAC/C,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,EAC1B,SAAS,CAAC,aAAa,CAAC,EACxB,KAAK,CACN;gBACa,MAAM,EAAE,SAAS;IAI7B;;;;OAIG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;CAGlF"}
1
+ {"version":3,"file":"KnowledgeBaseApi.d.ts","sourceRoot":"","sources":["../../../src/apis/knowledgeBase/KnowledgeBaseApi.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,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,iCAAiC,EACjC,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,WAAW,CAC/C,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,EAC1B,SAAS,CAAC,aAAa,CAAC,EACxB,KAAK,CACN;gBACa,MAAM,EAAE,SAAS;IAI7B;;;;OAIG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,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":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IAExB,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAA;AAEhD,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/knowledgeBase/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,uGAAuG;AACvG,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEzB,KAAK,CAAC,EA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,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,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
@@ -1 +1 @@
1
- {"version":3,"file":"KnowledgeBaseItemApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n} from './types'\n\nexport class KnowledgeBaseItemApi extends BaseCrudApi<\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n ListQuery<KnowledgeBaseItem>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base-item')\n }\n\n /**\n * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when\n * it deleted (the backend answers nothing from the deletion), so do not read it as the result:\n * check with `getById`.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;;AASA,IAAa,uBAAb,cAA0CA,qCAMxC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,uBAAuB;;;;;;;CAQvC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"KnowledgeBaseItemApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n} from './types'\n\n/**\n * Items of the knowledge bases. Creating an item VECTORIZES its content in the AI service; reading the\n * `docs` (include, `fetchMany`) reads them from it.\n */\nexport class KnowledgeBaseItemApi extends BaseCrudApi<\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n ListQuery<KnowledgeBaseItem>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base-item')\n }\n\n /**\n * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when\n * it deleted (the backend answers nothing from the deletion), so do not read it as the result:\n * check with `getById`.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:\n * unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`\n * answers 400 `Invalid knowledge base item ids`.\n */\n fetchMany(ids: string[], headers?: Record<string, string>): Promise<KnowledgeBaseItem[]> {\n return this.client.post<KnowledgeBaseItem[], { ids: string[] }>(\n `${this.basePath}/fetch-many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).\n * Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it\n * resolves `{ hasText: false }`.\n */\n checkPdfText(\n body: { fileId?: string },\n headers?: Record<string, string>,\n ): Promise<{ hasText: boolean }> {\n return this.client.post<{ hasText: boolean }, { fileId?: string }>(\n `${this.basePath}/check-pdf-text`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,uBAAb,cAA0CA,qCAMxC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,uBAAuB;;;;;;;CAQvC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,UAAU,KAAe,SAAgE;AACvF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,cACjB,EAAE,KAAK,EACP,QACD;;;;;;CAOH,WAAW,KAAe,SAAiD;AACzE,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,QACjB,EAAE,KAAK,EACP,QACD;;;;;;CAOH,aACE,MACA,SAC+B;AAC/B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,kBACjB,MACA,QACD"}
@@ -2,6 +2,10 @@ import type { ApiClient } from '../../core/ApiClient';
2
2
  import type { ListQuery } from '../../core/types';
3
3
  import { BaseCrudApi } from '../../core/BaseCrudApi';
4
4
  import type { KnowledgeBaseItem, CreateKnowledgeBaseItemPayload, UpdateKnowledgeBaseItemPayload } from './types';
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
  export declare class KnowledgeBaseItemApi extends BaseCrudApi<KnowledgeBaseItem, CreateKnowledgeBaseItemPayload, UpdateKnowledgeBaseItemPayload, ListQuery<KnowledgeBaseItem>, false> {
6
10
  constructor(client: ApiClient);
7
11
  /**
@@ -10,5 +14,25 @@ export declare class KnowledgeBaseItemApi extends BaseCrudApi<KnowledgeBaseItem,
10
14
  * check with `getById`.
11
15
  */
12
16
  deleteById(id: string, headers?: Record<string, string>): Promise<false>;
17
+ /**
18
+ * Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:
19
+ * unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`
20
+ * answers 400 `Invalid knowledge base item ids`.
21
+ */
22
+ fetchMany(ids: string[], headers?: Record<string, string>): Promise<KnowledgeBaseItem[]>;
23
+ /**
24
+ * Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).
25
+ * Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.
26
+ */
27
+ deleteMany(ids: string[], headers?: Record<string, string>): Promise<true>;
28
+ /**
29
+ * Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it
30
+ * resolves `{ hasText: false }`.
31
+ */
32
+ checkPdfText(body: {
33
+ fileId?: string;
34
+ }, headers?: Record<string, string>): Promise<{
35
+ hasText: boolean;
36
+ }>;
13
37
  }
14
38
  //# sourceMappingURL=KnowledgeBaseItemApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KnowledgeBaseItemApi.d.ts","sourceRoot":"","sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.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,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,SAAS,CAAA;AAEhB,qBAAa,oBAAqB,SAAQ,WAAW,CACnD,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC9B,SAAS,CAAC,iBAAiB,CAAC,EAC5B,KAAK,CACN;gBACa,MAAM,EAAE,SAAS;IAI7B;;;;OAIG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;CAGlF"}
1
+ {"version":3,"file":"KnowledgeBase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2
 
3
3
  //#region src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts
4
+ /**
5
+ * Items of the knowledge bases. Creating an item VECTORIZES its content in the AI service; reading the
6
+ * `docs` (include, `fetchMany`) reads them from it.
7
+ */
4
8
  var KnowledgeBaseItemApi = class extends BaseCrudApi {
5
9
  constructor(client) {
6
10
  super(client, "/knowledge-base-item");
@@ -13,6 +17,28 @@ var KnowledgeBaseItemApi = class extends BaseCrudApi {
13
17
  deleteById(id, headers) {
14
18
  return super.deleteById(id, headers);
15
19
  }
20
+ /**
21
+ * Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:
22
+ * unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`
23
+ * answers 400 `Invalid knowledge base item ids`.
24
+ */
25
+ fetchMany(ids, headers) {
26
+ return this.client.post(`${this.basePath}/fetch-many`, { ids }, headers);
27
+ }
28
+ /**
29
+ * Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).
30
+ * Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.
31
+ */
32
+ deleteMany(ids, headers) {
33
+ return this.client.request("DELETE", `${this.basePath}/many`, { ids }, headers);
34
+ }
35
+ /**
36
+ * Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it
37
+ * resolves `{ hasText: false }`.
38
+ */
39
+ checkPdfText(body, headers) {
40
+ return this.client.post(`${this.basePath}/check-pdf-text`, body, headers);
41
+ }
16
42
  };
17
43
 
18
44
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"KnowledgeBaseItemApi.mjs","names":[],"sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n} from './types'\n\nexport class KnowledgeBaseItemApi extends BaseCrudApi<\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n ListQuery<KnowledgeBaseItem>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base-item')\n }\n\n /**\n * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when\n * it deleted (the backend answers nothing from the deletion), so do not read it as the result:\n * check with `getById`.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n}\n"],"mappings":";;;AASA,IAAa,uBAAb,cAA0C,YAMxC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,uBAAuB;;;;;;;CAQvC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ"}
1
+ {"version":3,"file":"KnowledgeBaseItemApi.mjs","names":[],"sources":["../../../src/apis/knowledgeBaseItem/KnowledgeBaseItemApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery } from '../../core/types'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n} from './types'\n\n/**\n * Items of the knowledge bases. Creating an item VECTORIZES its content in the AI service; reading the\n * `docs` (include, `fetchMany`) reads them from it.\n */\nexport class KnowledgeBaseItemApi extends BaseCrudApi<\n KnowledgeBaseItem,\n CreateKnowledgeBaseItemPayload,\n UpdateKnowledgeBaseItemPayload,\n ListQuery<KnowledgeBaseItem>,\n false\n> {\n constructor(client: ApiClient) {\n super(client, '/knowledge-base-item')\n }\n\n /**\n * Deletes a knowledge base item (and its documents in the AI service). Resolves `false` even when\n * it deleted (the backend answers nothing from the deletion), so do not read it as the result:\n * check with `getById`.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<false> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Reads the items of `ids` with their documents (read from the AI service). Resolves the stored items, raw:\n * unlike the other reads they carry `knowledgeBaseId`, `fileId` and `deletedAt`. An empty or absent `ids`\n * answers 400 `Invalid knowledge base item ids`.\n */\n fetchMany(ids: string[], headers?: Record<string, string>): Promise<KnowledgeBaseItem[]> {\n return this.client.post<KnowledgeBaseItem[], { ids: string[] }>(\n `${this.basePath}/fetch-many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Deletes the items of `ids` of the account (soft delete; their documents stay in the AI service).\n * Resolves `true`; an empty or absent `ids` answers 400 `Invalid knowledge base item ids`.\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Tells whether the PDF of `fileId` has text to be vectorized (read locally, no AI). Without `fileId` it\n * resolves `{ hasText: false }`.\n */\n checkPdfText(\n body: { fileId?: string },\n headers?: Record<string, string>,\n ): Promise<{ hasText: boolean }> {\n return this.client.post<{ hasText: boolean }, { fileId?: string }>(\n `${this.basePath}/check-pdf-text`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;AAaA,IAAa,uBAAb,cAA0C,YAMxC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,uBAAuB;;;;;;;CAQvC,AAAS,WAAW,IAAY,SAAkD;AAChF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;CAQtC,UAAU,KAAe,SAAgE;AACvF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,cACjB,EAAE,KAAK,EACP,QACD;;;;;;CAOH,WAAW,KAAe,SAAiD;AACzE,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,QACjB,EAAE,KAAK,EACP,QACD;;;;;;CAOH,aACE,MACA,SAC+B;AAC/B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,kBACjB,MACA,QACD"}
@@ -1,30 +1,47 @@
1
1
  import type { File } from '../files/types';
2
2
  import type { KnowledgeBase } from '../knowledgeBase/types';
3
+ /** An item as the transformer answers it (no `knowledgeBaseId`, `fileId` nor `deletedAt`). */
3
4
  export type KnowledgeBaseItem = {
4
5
  id: string;
5
6
  name: string;
6
- type: string;
7
+ type: 'urls' | 'files' | 'messages' | (string & {});
7
8
  sourceId: string | null;
8
9
  url: string | null;
9
10
  accountId: string;
10
- knowledgeBaseId: string;
11
- fileId: string | null;
11
+ /** @deprecated Not answered: the transformer of the backend does not send it. */
12
+ knowledgeBaseId?: string;
13
+ /** @deprecated Not answered: the transformer of the backend does not send it. */
14
+ fileId?: string | null;
12
15
  createdAt: string;
13
16
  updatedAt: string;
14
- deletedAt: string | null;
17
+ /** @deprecated Not answered: the transformer of the backend does not send it. */
18
+ deletedAt?: string | null;
19
+ /** @deprecated Not served: the include is dropped by the backend. */
15
20
  knowledgeBase?: KnowledgeBase;
16
21
  file?: File | null;
22
+ /** The vectorized documents (the include reads them from the AI service). */
23
+ docs?: Record<string, unknown>[];
24
+ account?: Record<string, unknown>;
17
25
  };
18
- export type KnowledgeBaseItemRelationships = 'knowledgeBase' | 'file';
26
+ export type KnowledgeBaseItemRelationships = 'knowledgeBase' | 'file' | 'docs' | 'account';
27
+ /**
28
+ * Creates an item and VECTORIZES its content in the AI service right away: `text` (type `messages`), `url`
29
+ * (type `urls`, the service fetches the page) or `fileId` (type `files`). Without any of the three it
30
+ * answers 400 `You must provide fileId, text, or url`.
31
+ */
19
32
  export type CreateKnowledgeBaseItemPayload = {
20
33
  name: string;
21
- type: string;
34
+ type: 'urls' | 'files' | 'messages' | (string & {});
22
35
  knowledgeBaseId: string;
36
+ /** @deprecated Ignored by the backend. */
23
37
  sourceId?: string;
38
+ text?: string;
24
39
  url?: string;
25
40
  fileId?: string;
26
41
  };
42
+ /** The backend requires `name`, `type` and `knowledgeBaseId` on the update too (400 without them). */
27
43
  export type UpdateKnowledgeBaseItemPayload = {
44
+ knowledgeBaseId?: string;
28
45
  name?: string;
29
46
  type?: string;
30
47
  sourceId?: string | null;