@copera.ai/sdk 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -0
- package/dist/index.cjs +31 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -1
- package/dist/index.d.mts +58 -1
- package/dist/index.mjs +31 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -238,6 +238,54 @@ if ('error' in row) {
|
|
|
238
238
|
- `400 Bad Request` - No row found with the provided identifier
|
|
239
239
|
- `401 Unauthorized` - Invalid password
|
|
240
240
|
|
|
241
|
+
#### `listRowComments(params)`
|
|
242
|
+
|
|
243
|
+
List comments on a specific row. Supports cursor-based pagination and visibility filtering.
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
const comments = await copera.board.listRowComments({
|
|
247
|
+
boardId: 'board-id',
|
|
248
|
+
tableId: 'table-id',
|
|
249
|
+
rowId: 'row-id',
|
|
250
|
+
visibility: 'all', // optional: "all" | "internal" | "external"
|
|
251
|
+
after: 'cursor-id', // optional: forward pagination cursor
|
|
252
|
+
before: 'cursor-id' // optional: backward pagination cursor
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Parameters:**
|
|
257
|
+
- `boardId` (string, required) - The board ID
|
|
258
|
+
- `tableId` (string, required) - The table ID
|
|
259
|
+
- `rowId` (string, required) - The row ID
|
|
260
|
+
- `visibility` (string, optional) - Filter by visibility: `"all"`, `"internal"`, or `"external"`. Defaults to `"all"`
|
|
261
|
+
- `after` (string, optional) - Comment ID cursor for forward pagination
|
|
262
|
+
- `before` (string, optional) - Comment ID cursor for backward pagination
|
|
263
|
+
|
|
264
|
+
**Returns:** `Promise<RowCommentPagination>`
|
|
265
|
+
|
|
266
|
+
#### `createRowComment(params)`
|
|
267
|
+
|
|
268
|
+
Create a new comment on a specific row. Supports HTML content.
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
const comment = await copera.board.createRowComment({
|
|
272
|
+
boardId: 'board-id',
|
|
273
|
+
tableId: 'table-id',
|
|
274
|
+
rowId: 'row-id',
|
|
275
|
+
content: '<p>This task needs review</p>',
|
|
276
|
+
visibility: 'internal' // optional: "internal" | "external"
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**Parameters:**
|
|
281
|
+
- `boardId` (string, required) - The board ID
|
|
282
|
+
- `tableId` (string, required) - The table ID
|
|
283
|
+
- `rowId` (string, required) - The row ID
|
|
284
|
+
- `content` (string, required) - Comment text content (HTML supported)
|
|
285
|
+
- `visibility` (string, optional) - Comment visibility: `"internal"` or `"external"`. Defaults to `"internal"`
|
|
286
|
+
|
|
287
|
+
**Returns:** `Promise<RowComment>`
|
|
288
|
+
|
|
241
289
|
### Channel Methods
|
|
242
290
|
|
|
243
291
|
#### `sendMessage(params)`
|
|
@@ -270,6 +318,12 @@ import {
|
|
|
270
318
|
Row,
|
|
271
319
|
Column,
|
|
272
320
|
ColumnValue,
|
|
321
|
+
RowComment,
|
|
322
|
+
RowCommentPagination,
|
|
323
|
+
CommentAuthor,
|
|
324
|
+
PageInfo,
|
|
325
|
+
ListRowCommentsParams,
|
|
326
|
+
CreateRowCommentParams,
|
|
273
327
|
SendMessageParams,
|
|
274
328
|
AuthenticateTableRowParams,
|
|
275
329
|
CoperaAIError
|
|
@@ -318,6 +372,35 @@ interface ColumnValue {
|
|
|
318
372
|
columnId: string;
|
|
319
373
|
value: unknown;
|
|
320
374
|
}
|
|
375
|
+
|
|
376
|
+
interface RowComment {
|
|
377
|
+
_id: string;
|
|
378
|
+
content: string | null;
|
|
379
|
+
contentType: string;
|
|
380
|
+
visibility: "internal" | "external";
|
|
381
|
+
author: CommentAuthor;
|
|
382
|
+
createdAt: string;
|
|
383
|
+
updatedAt: string;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
interface CommentAuthor {
|
|
387
|
+
_id: string;
|
|
388
|
+
name: string | null;
|
|
389
|
+
picture: string | null;
|
|
390
|
+
email: string | null;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
interface PageInfo {
|
|
394
|
+
endCursor: string | null;
|
|
395
|
+
startCursor: string | null;
|
|
396
|
+
hasNextPage: boolean;
|
|
397
|
+
hasPreviousPage: boolean;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
interface RowCommentPagination {
|
|
401
|
+
items: RowComment[];
|
|
402
|
+
pageInfo: PageInfo;
|
|
403
|
+
}
|
|
321
404
|
```
|
|
322
405
|
|
|
323
406
|
## Error Handling
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
|
|
3
3
|
//#region src/version.ts
|
|
4
|
-
const COPERA_SDK_VERSION = "2.
|
|
4
|
+
const COPERA_SDK_VERSION = "2.3.0";
|
|
5
5
|
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/constants.ts
|
|
@@ -80,6 +80,20 @@ function createAuthenticateTableRow(request) {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/services/board/create-row-comment.ts
|
|
85
|
+
function createCreateRowComment(request) {
|
|
86
|
+
return async function createRowComment({ boardId, tableId, rowId, content, visibility }) {
|
|
87
|
+
return request(`/board/${boardId}/table/${tableId}/row/${rowId}/comment`, {
|
|
88
|
+
method: "POST",
|
|
89
|
+
body: JSON.stringify({
|
|
90
|
+
content,
|
|
91
|
+
visibility
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
83
97
|
//#endregion
|
|
84
98
|
//#region src/services/board/create-table-row.ts
|
|
85
99
|
function createCreateTableRow(request) {
|
|
@@ -134,6 +148,19 @@ function createListBoards(request) {
|
|
|
134
148
|
};
|
|
135
149
|
}
|
|
136
150
|
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/services/board/list-row-comments.ts
|
|
153
|
+
function createListRowComments(request) {
|
|
154
|
+
return async function listRowComments({ boardId, tableId, rowId, visibility, after, before }) {
|
|
155
|
+
const params = new URLSearchParams();
|
|
156
|
+
if (visibility !== void 0) params.set("visibility", visibility);
|
|
157
|
+
if (after !== void 0) params.set("after", after);
|
|
158
|
+
if (before !== void 0) params.set("before", before);
|
|
159
|
+
const query = params.toString();
|
|
160
|
+
return request(`/board/${boardId}/table/${tableId}/row/${rowId}/comments${query ? `?${query}` : ""}`, { method: "GET" });
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
137
164
|
//#endregion
|
|
138
165
|
//#region src/services/board/list-table-rows.ts
|
|
139
166
|
function createListTableRows(request) {
|
|
@@ -153,7 +180,9 @@ function createBoardHandlers(request) {
|
|
|
153
180
|
listTableRows: createListTableRows(request),
|
|
154
181
|
getTableRow: createGetTableRow(request),
|
|
155
182
|
createTableRow: createCreateTableRow(request),
|
|
156
|
-
authenticateTableRow: createAuthenticateTableRow(request)
|
|
183
|
+
authenticateTableRow: createAuthenticateTableRow(request),
|
|
184
|
+
listRowComments: createListRowComments(request),
|
|
185
|
+
createRowComment: createCreateRowComment(request)
|
|
157
186
|
};
|
|
158
187
|
}
|
|
159
188
|
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../src/version.ts","../src/constants.ts","../src/exceptions.ts","../src/requests.ts","../src/services/board/authenticate-table-row.ts","../src/services/board/create-table-row.ts","../src/services/board/get-board-details.ts","../src/services/board/get-board-table.ts","../src/services/board/get-table-row.ts","../src/services/board/list-board-tables.ts","../src/services/board/list-boards.ts","../src/services/board/list-table-rows.ts","../src/services/board/index.ts","../src/services/channel/send-message.ts","../src/services/channel/index.ts","../src/services/index.ts","../src/index.ts"],"sourcesContent":["/*This file is auto generated during build, DO NOT CHANGE OR MODIFY */\n\nexport const COPERA_SDK_VERSION = \"2.2.1\";\n","import { COPERA_SDK_VERSION } from \"./version.js\";\n\nexport const BASE_URL = \"https://api.copera.ai/public/v1\";\nexport const BASE_URL_DEV = \"https://api-dev.copera.ai/public/v1\";\n\nexport const COPERA_DOCS = \"https://developers.copera.ai\";\n\nexport function getHeaders(apiKey: string) {\n return {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `NodeJS SDK ${COPERA_SDK_VERSION}`,\n };\n}\n","import { COPERA_DOCS } from \"./constants.js\";\n\n/**\n * Default class for CoperaAI exceptions and errors.\n *\n * It can be serialized to JSON through the `toJSON` method.\n */\nexport class CoperaAIError extends Error {\n constructor(message: string) {\n super(\n `CoperaAI SDK Error: ${message}\\n\\nPlease, refer to the documentation at: ${COPERA_DOCS}`,\n );\n this.name = \"CoperaAIError\";\n }\n\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n };\n }\n}\n","import { BASE_URL, BASE_URL_DEV, getHeaders } from \"./constants.js\";\n\nexport function createRequest(\n apiKey: string,\n sandbox: boolean = false,\n): <TResponse>(path: string, options: RequestInit) => Promise<TResponse> {\n const defaultHeaders = getHeaders(apiKey);\n\n const baseUrl = sandbox ? BASE_URL_DEV : BASE_URL;\n\n return async <TResponse>(\n path: string,\n options: RequestInit,\n ): Promise<TResponse> => {\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n ...options,\n headers: { ...defaultHeaders, ...options?.headers },\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n ...data,\n responseCode: response.status,\n responseStatus: response.statusText,\n error: data.error || data.message,\n } as TResponse;\n }\n\n return data;\n } catch (error) {\n return { error: (error as Error).message } as TResponse;\n }\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { AuthenticateTableRowParams, Row } from \"../../types.js\";\n\nexport function createAuthenticateTableRow(\n request: ReturnType<typeof createRequest>,\n) {\n return async function authenticateTableRow({\n boardId,\n tableId,\n identifierColumnId,\n identifierColumnValue,\n passwordColumnId,\n passwordColumnValue,\n }: AuthenticateTableRowParams) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row/authenticate`, {\n method: \"POST\",\n body: JSON.stringify({\n identifierColumnId,\n identifierColumnValue,\n passwordColumnId,\n passwordColumnValue,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { ColumnValue, Row } from \"../../types.js\";\n\nexport function createCreateTableRow(\n request: ReturnType<typeof createRequest>,\n) {\n return async function createTableRow({\n boardId,\n tableId,\n description,\n columns,\n }: {\n boardId: string;\n tableId: string;\n description?: string;\n columns: ColumnValue[];\n }) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row`, {\n method: \"POST\",\n body: JSON.stringify({\n description,\n columns,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Board } from \"../../types.js\";\n\nexport function createGetBoardDetails(\n request: ReturnType<typeof createRequest>,\n) {\n return async function getBoardDetails({ boardId }: { boardId: string }) {\n return request<Board>(`/board/${boardId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Table } from \"../../types.js\";\n\nexport function createGetBoardTable(request: ReturnType<typeof createRequest>) {\n return async function getBoardTable({\n boardId,\n tableId,\n }: {\n boardId: string;\n tableId: string;\n }) {\n return request<Table>(`/board/${boardId}/table/${tableId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Row } from \"../../types.js\";\n\nexport function createGetTableRow(request: ReturnType<typeof createRequest>) {\n return async function getTableRow({\n boardId,\n tableId,\n rowId,\n }: {\n boardId: string;\n tableId: string;\n rowId: string;\n }) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row/${rowId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Table } from \"../../types.js\";\n\nexport function createListBoardTables(\n request: ReturnType<typeof createRequest>,\n) {\n return async function listBoardTables({ boardId }: { boardId: string }) {\n return request<Table[]>(`/board/${boardId}/tables`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Board } from \"../../types.js\";\n\nexport function createListBoards(request: ReturnType<typeof createRequest>) {\n return async function listBoards() {\n return request<Board[]>(\"/board/list-boards\", {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Row } from \"../../types.js\";\n\nexport function createListTableRows(request: ReturnType<typeof createRequest>) {\n return async function listTableRows({\n boardId,\n tableId,\n }: {\n boardId: string;\n tableId: string;\n }) {\n return request<Row[]>(`/board/${boardId}/table/${tableId}/rows`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport { createAuthenticateTableRow } from \"./authenticate-table-row.js\";\nimport { createCreateTableRow } from \"./create-table-row.js\";\nimport { createGetBoardDetails } from \"./get-board-details.js\";\nimport { createGetBoardTable } from \"./get-board-table.js\";\nimport { createGetTableRow } from \"./get-table-row.js\";\nimport { createListBoardTables } from \"./list-board-tables.js\";\nimport { createListBoards } from \"./list-boards.js\";\nimport { createListTableRows } from \"./list-table-rows.js\";\n\nexport function createBoardHandlers(request: ReturnType<typeof createRequest>) {\n return {\n listBoards: createListBoards(request),\n getBoardDetails: createGetBoardDetails(request),\n listBoardTables: createListBoardTables(request),\n getBoardTable: createGetBoardTable(request),\n listTableRows: createListTableRows(request),\n getTableRow: createGetTableRow(request),\n createTableRow: createCreateTableRow(request),\n authenticateTableRow: createAuthenticateTableRow(request),\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { SendMessageParams } from \"../../types.js\";\n\nexport function createSendMessage(request: ReturnType<typeof createRequest>) {\n return async function sendMessage({\n channelId,\n message,\n name,\n }: SendMessageParams) {\n return request<void>(`/chat/channel/${channelId}/send-message`, {\n method: \"POST\",\n body: JSON.stringify({\n message,\n name,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport { createSendMessage } from \"./send-message.js\";\n\nexport function createChannelHandlers(\n request: ReturnType<typeof createRequest>,\n) {\n return {\n sendMessage: createSendMessage(request),\n };\n}\n","import type { createRequest } from \"../requests.js\";\nimport { createBoardHandlers } from \"./board/index.js\";\nimport { createChannelHandlers } from \"./channel/index.js\";\n\nexport function getHandlers(request: ReturnType<typeof createRequest>) {\n return {\n board: createBoardHandlers(request),\n channel: createChannelHandlers(request),\n };\n}\n","import { CoperaAIError } from \"./exceptions.js\";\nimport { createRequest } from \"./requests.js\";\nimport { getHandlers } from \"./services/index.js\";\n\ninterface CoperaAIOptions {\n apiKey: string;\n sandbox?: boolean;\n}\nexport function CoperaAI({ apiKey, sandbox = false }: CoperaAIOptions) {\n if (!apiKey) throw new CoperaAIError(\"API key is required!\");\n const request = createRequest(apiKey, sandbox);\n\n return getHandlers(request);\n}\n\nexport { CoperaAIError };\n\nexport * from \"./types.js\";\n\nexport default CoperaAI;\n"],"mappings":";;;AAEA,MAAa,qBAAqB;;;;ACAlC,MAAa,WAAW;AACxB,MAAa,eAAe;AAE5B,MAAa,cAAc;AAE3B,SAAgB,WAAW,QAAgB;AACzC,QAAO;EACL,eAAe,UAAU;EACzB,gBAAgB;EAChB,cAAc,cAAc;EAC7B;;;;;;;;;;ACLH,IAAa,gBAAb,cAAmC,MAAM;CACvC,YAAY,SAAiB;AAC3B,QACE,uBAAuB,QAAQ,6CAA6C,cAC7E;AACD,OAAK,OAAO;;CAGd,SAAS;AACP,SAAO;GACL,MAAM,KAAK;GACX,SAAS,KAAK;GACf;;;;;;ACjBL,SAAgB,cACd,QACA,UAAmB,OACoD;CACvE,MAAM,iBAAiB,WAAW,OAAO;CAEzC,MAAM,UAAU,UAAU,eAAe;AAEzC,QAAO,OACL,MACA,YACuB;AACvB,MAAI;GACF,MAAM,WAAW,MAAM,MAAM,GAAG,UAAU,QAAQ;IAChD,GAAG;IACH,SAAS;KAAE,GAAG;KAAgB,GAAG,SAAS;KAAS;IACpD,CAAC;GAEF,MAAM,OAAO,MAAM,SAAS,MAAM;AAElC,OAAI,CAAC,SAA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,sBAAsB,EAC5C,QAAQ,OACT,CAAC;;;;;;ACJN,SAAgB,oBAAoB,SAA2C;AAC7E,QAAO,eAAe,cAAc,EAClC,SACA,WAIC;AACD,SAAO,QAAe,UAAU,QAAQ,SAAS,QAAQ,QAAQ,EAC/D,QAAQ,OACT,CAAC;;;;;;ACHN,SAAgB,oBAAoB,SAA2C;AAC7E,QAAO;EACL,YAAY,iBAAiB,QAAQ;EACrC,iBAAiB,sBAAsB,QAAQ;EAC/C,iBAAiB,sBAAsB,QAAQ;EAC/C,eAAe,oBAAoB,QAAQ;EAC3C,eAAe,oBAAoB,QAAQ;EAC3C,aAAa,kBAAkB,QAAQ;EACvC,gBAAgB,qBAAqB,QAAQ;EAC7C,sBAAsB,2BAA2B,QAAQ;EAC1D;;;;;ACjBH,SAAgB,kBAAkB,SAA2C;AAC3E,QAAO,eAAe,YAAY,EAChC,WACA,SACA,QACoB;AACpB,SAAO,QAAc,iBAAiB,UAAU,gBAAgB;GAC9D,QAAQ;GACR,MAAM,KAAK,UAAU;IACnB;IACA;IACD,CAAC;GACH,CAAC;;;;;;ACZN,SAAgB,sBACd,SACA;AACA,QAAO,EACL,aAAa,kBAAkB,QAAQ,EACxC;;;;;ACJH,SAAgB,YAAY,SAA2C;AACrE,QAAO;EACL,OAAO,oBAAoB,QAAQ;EACnC,SAAS,sBAAsB,QAAQ;EACxC;;;;;ACAH,SAAgB,SAAS,EAAE,QAAQ,UAAU,SAA0B;AACrE,KAAI,CAAC,OAAQ,OAAM,IAAI,cAAc,uBAAuB;AAG5D,QAAO,YAFS,cAAc,QAAQ,QAAQ,CAEnB;;AAO7B,kBAAe"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/version.ts","../src/constants.ts","../src/exceptions.ts","../src/requests.ts","../src/services/board/authenticate-table-row.ts","../src/services/board/create-row-comment.ts","../src/services/board/create-table-row.ts","../src/services/board/get-board-details.ts","../src/services/board/get-board-table.ts","../src/services/board/get-table-row.ts","../src/services/board/list-board-tables.ts","../src/services/board/list-boards.ts","../src/services/board/list-row-comments.ts","../src/services/board/list-table-rows.ts","../src/services/board/index.ts","../src/services/channel/send-message.ts","../src/services/channel/index.ts","../src/services/index.ts","../src/index.ts"],"sourcesContent":["/*This file is auto generated during build, DO NOT CHANGE OR MODIFY */\n\nexport const COPERA_SDK_VERSION = \"2.3.0\";\n","import { COPERA_SDK_VERSION } from \"./version.js\";\n\nexport const BASE_URL = \"https://api.copera.ai/public/v1\";\nexport const BASE_URL_DEV = \"https://api-dev.copera.ai/public/v1\";\n\nexport const COPERA_DOCS = \"https://developers.copera.ai\";\n\nexport function getHeaders(apiKey: string) {\n return {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `NodeJS SDK ${COPERA_SDK_VERSION}`,\n };\n}\n","import { COPERA_DOCS } from \"./constants.js\";\n\n/**\n * Default class for CoperaAI exceptions and errors.\n *\n * It can be serialized to JSON through the `toJSON` method.\n */\nexport class CoperaAIError extends Error {\n constructor(message: string) {\n super(\n `CoperaAI SDK Error: ${message}\\n\\nPlease, refer to the documentation at: ${COPERA_DOCS}`,\n );\n this.name = \"CoperaAIError\";\n }\n\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n };\n }\n}\n","import { BASE_URL, BASE_URL_DEV, getHeaders } from \"./constants.js\";\n\nexport function createRequest(\n apiKey: string,\n sandbox: boolean = false,\n): <TResponse>(path: string, options: RequestInit) => Promise<TResponse> {\n const defaultHeaders = getHeaders(apiKey);\n\n const baseUrl = sandbox ? BASE_URL_DEV : BASE_URL;\n\n return async <TResponse>(\n path: string,\n options: RequestInit,\n ): Promise<TResponse> => {\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n ...options,\n headers: { ...defaultHeaders, ...options?.headers },\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n ...data,\n responseCode: response.status,\n responseStatus: response.statusText,\n error: data.error || data.message,\n } as TResponse;\n }\n\n return data;\n } catch (error) {\n return { error: (error as Error).message } as TResponse;\n }\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { AuthenticateTableRowParams, Row } from \"../../types.js\";\n\nexport function createAuthenticateTableRow(\n request: ReturnType<typeof createRequest>,\n) {\n return async function authenticateTableRow({\n boardId,\n tableId,\n identifierColumnId,\n identifierColumnValue,\n passwordColumnId,\n passwordColumnValue,\n }: AuthenticateTableRowParams) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row/authenticate`, {\n method: \"POST\",\n body: JSON.stringify({\n identifierColumnId,\n identifierColumnValue,\n passwordColumnId,\n passwordColumnValue,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { CreateRowCommentParams, RowComment } from \"../../types.js\";\n\nexport function createCreateRowComment(\n request: ReturnType<typeof createRequest>,\n) {\n return async function createRowComment({\n boardId,\n tableId,\n rowId,\n content,\n visibility,\n }: CreateRowCommentParams) {\n return request<RowComment>(\n `/board/${boardId}/table/${tableId}/row/${rowId}/comment`,\n {\n method: \"POST\",\n body: JSON.stringify({\n content,\n visibility,\n }),\n },\n );\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { ColumnValue, Row } from \"../../types.js\";\n\nexport function createCreateTableRow(\n request: ReturnType<typeof createRequest>,\n) {\n return async function createTableRow({\n boardId,\n tableId,\n description,\n columns,\n }: {\n boardId: string;\n tableId: string;\n description?: string;\n columns: ColumnValue[];\n }) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row`, {\n method: \"POST\",\n body: JSON.stringify({\n description,\n columns,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Board } from \"../../types.js\";\n\nexport function createGetBoardDetails(\n request: ReturnType<typeof createRequest>,\n) {\n return async function getBoardDetails({ boardId }: { boardId: string }) {\n return request<Board>(`/board/${boardId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Table } from \"../../types.js\";\n\nexport function createGetBoardTable(request: ReturnType<typeof createRequest>) {\n return async function getBoardTable({\n boardId,\n tableId,\n }: {\n boardId: string;\n tableId: string;\n }) {\n return request<Table>(`/board/${boardId}/table/${tableId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Row } from \"../../types.js\";\n\nexport function createGetTableRow(request: ReturnType<typeof createRequest>) {\n return async function getTableRow({\n boardId,\n tableId,\n rowId,\n }: {\n boardId: string;\n tableId: string;\n rowId: string;\n }) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row/${rowId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Table } from \"../../types.js\";\n\nexport function createListBoardTables(\n request: ReturnType<typeof createRequest>,\n) {\n return async function listBoardTables({ boardId }: { boardId: string }) {\n return request<Table[]>(`/board/${boardId}/tables`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Board } from \"../../types.js\";\n\nexport function createListBoards(request: ReturnType<typeof createRequest>) {\n return async function listBoards() {\n return request<Board[]>(\"/board/list-boards\", {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type {\n ListRowCommentsParams,\n RowCommentPagination,\n} from \"../../types.js\";\n\nexport function createListRowComments(\n request: ReturnType<typeof createRequest>,\n) {\n return async function listRowComments({\n boardId,\n tableId,\n rowId,\n visibility,\n after,\n before,\n }: ListRowCommentsParams) {\n const params = new URLSearchParams();\n if (visibility !== undefined) params.set(\"visibility\", visibility);\n if (after !== undefined) params.set(\"after\", after);\n if (before !== undefined) params.set(\"before\", before);\n const query = params.toString();\n const path = `/board/${boardId}/table/${tableId}/row/${rowId}/comments${query ? `?${query}` : \"\"}`;\n return request<RowCommentPagination>(path, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Row } from \"../../types.js\";\n\nexport function createListTableRows(request: ReturnType<typeof createRequest>) {\n return async function listTableRows({\n boardId,\n tableId,\n }: {\n boardId: string;\n tableId: string;\n }) {\n return request<Row[]>(`/board/${boardId}/table/${tableId}/rows`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport { createAuthenticateTableRow } from \"./authenticate-table-row.js\";\nimport { createCreateRowComment } from \"./create-row-comment.js\";\nimport { createCreateTableRow } from \"./create-table-row.js\";\nimport { createGetBoardDetails } from \"./get-board-details.js\";\nimport { createGetBoardTable } from \"./get-board-table.js\";\nimport { createGetTableRow } from \"./get-table-row.js\";\nimport { createListBoardTables } from \"./list-board-tables.js\";\nimport { createListBoards } from \"./list-boards.js\";\nimport { createListRowComments } from \"./list-row-comments.js\";\nimport { createListTableRows } from \"./list-table-rows.js\";\n\nexport function createBoardHandlers(request: ReturnType<typeof createRequest>) {\n return {\n listBoards: createListBoards(request),\n getBoardDetails: createGetBoardDetails(request),\n listBoardTables: createListBoardTables(request),\n getBoardTable: createGetBoardTable(request),\n listTableRows: createListTableRows(request),\n getTableRow: createGetTableRow(request),\n createTableRow: createCreateTableRow(request),\n authenticateTableRow: createAuthenticateTableRow(request),\n listRowComments: createListRowComments(request),\n createRowComment: createCreateRowComment(request),\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { SendMessageParams } from \"../../types.js\";\n\nexport function createSendMessage(request: ReturnType<typeof createRequest>) {\n return async function sendMessage({\n channelId,\n message,\n name,\n }: SendMessageParams) {\n return request<void>(`/chat/channel/${channelId}/send-message`, {\n method: \"POST\",\n body: JSON.stringify({\n message,\n name,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport { createSendMessage } from \"./send-message.js\";\n\nexport function createChannelHandlers(\n request: ReturnType<typeof createRequest>,\n) {\n return {\n sendMessage: createSendMessage(request),\n };\n}\n","import type { createRequest } from \"../requests.js\";\nimport { createBoardHandlers } from \"./board/index.js\";\nimport { createChannelHandlers } from \"./channel/index.js\";\n\nexport function getHandlers(request: ReturnType<typeof createRequest>) {\n return {\n board: createBoardHandlers(request),\n channel: createChannelHandlers(request),\n };\n}\n","import { CoperaAIError } from \"./exceptions.js\";\nimport { createRequest } from \"./requests.js\";\nimport { getHandlers } from \"./services/index.js\";\n\ninterface CoperaAIOptions {\n apiKey: string;\n sandbox?: boolean;\n}\nexport function CoperaAI({ apiKey, sandbox = false }: CoperaAIOptions) {\n if (!apiKey) throw new CoperaAIError(\"API key is required!\");\n const request = createRequest(apiKey, sandbox);\n\n return getHandlers(request);\n}\n\nexport { CoperaAIError };\n\nexport * from \"./types.js\";\n\nexport default CoperaAI;\n"],"mappings":";;;AAEA,MAAa,qBAAqB;;;;ACAlC,MAAa,WAAW;AACxB,MAAa,eAAe;AAE5B,MAAa,cAAc;AAE3B,SAAgB,WAAW,QAAgB;AACzC,QAAO;EACL,eAAe,UAAU;EACzB,gBAAgB;EAChB,cAAc,cAAc;EAC7B;;;;;;;;;;ACLH,IAAa,gBAAb,cAAmC,MAAM;CACvC,YAAY,SAAiB;AAC3B,QACE,uBAAuB,QAAQ,6CAA6C,cAC7E;AACD,OAAK,OAAO;;CAGd,SAAS;AACP,SAAO;GACL,MAAM,KAAK;GACX,SAAS,KAAK;GACf;;;;;;ACjBL,SAAgB,cACd,QACA,UAAmB,OACoD;CACvE,MAAM,iBAAiB,WAAW,OAAO;CAEzC,MAAM,UAAU,UAAU,eAAe;AAEzC,QAAO,OACL,MACA,YACuB;AACvB,MAAI;GACF,MAAM,WAAW,MAAM,MAAM,GAAG,UAAU,QAAQ;IAChD,GAAG;IACH,SAAS;KAAE,GAAG;KAAgB,GAAG,SAAS;KAAS;IACpD,CAAC;GAEF,MAAM,OAAO,MAAM,SAAS,MAAM;AAElC,OAAI,CAAC,SAAS,GACZ,QAAO;IACL,GAAG;IACH,cAAc,SAAS;IACvB,gBAAgB,SAAS;IACzB,OAAO,KAAK,SAAS,KAAK;IAC3B;AAGH,UAAO;WACA,OAAO;AACd,UAAO,EAAE,OAAQ,MAAgB,SAAS;;;;;;;AC9BhD,SAAgB,2BACd,SACA;AACA,QAAO,eAAe,q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SAAgB,YAAY,SAA2C;AACrE,QAAO;EACL,OAAO,oBAAoB,QAAQ;EACnC,SAAS,sBAAsB,QAAQ;EACxC;;;;;ACAH,SAAgB,SAAS,EAAE,QAAQ,UAAU,SAA0B;AACrE,KAAI,CAAC,OAAQ,OAAM,IAAI,cAAc,uBAAuB;AAG5D,QAAO,YAFS,cAAc,QAAQ,QAAQ,CAEnB;;AAO7B,kBAAe"}
|
package/dist/index.d.cts
CHANGED
|
@@ -64,6 +64,48 @@ interface AuthenticateTableRowParams {
|
|
|
64
64
|
interface ApiError {
|
|
65
65
|
error: string;
|
|
66
66
|
}
|
|
67
|
+
type CommentVisibility = "internal" | "external";
|
|
68
|
+
type CommentVisibilityFilter = "all" | "internal" | "external";
|
|
69
|
+
interface CommentAuthor {
|
|
70
|
+
_id: string;
|
|
71
|
+
name: string | null;
|
|
72
|
+
picture: string | null;
|
|
73
|
+
email: string | null;
|
|
74
|
+
}
|
|
75
|
+
interface RowComment {
|
|
76
|
+
_id: string;
|
|
77
|
+
content: string | null;
|
|
78
|
+
contentType: string;
|
|
79
|
+
visibility: CommentVisibility;
|
|
80
|
+
author: CommentAuthor;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
updatedAt: string;
|
|
83
|
+
}
|
|
84
|
+
interface PageInfo {
|
|
85
|
+
endCursor: string | null;
|
|
86
|
+
startCursor: string | null;
|
|
87
|
+
hasNextPage: boolean;
|
|
88
|
+
hasPreviousPage: boolean;
|
|
89
|
+
}
|
|
90
|
+
interface RowCommentPagination {
|
|
91
|
+
items: RowComment[];
|
|
92
|
+
pageInfo: PageInfo;
|
|
93
|
+
}
|
|
94
|
+
interface ListRowCommentsParams {
|
|
95
|
+
boardId: string;
|
|
96
|
+
tableId: string;
|
|
97
|
+
rowId: string;
|
|
98
|
+
visibility?: CommentVisibilityFilter;
|
|
99
|
+
after?: string;
|
|
100
|
+
before?: string;
|
|
101
|
+
}
|
|
102
|
+
interface CreateRowCommentParams {
|
|
103
|
+
boardId: string;
|
|
104
|
+
tableId: string;
|
|
105
|
+
rowId: string;
|
|
106
|
+
content: string;
|
|
107
|
+
visibility?: CommentVisibility;
|
|
108
|
+
}
|
|
67
109
|
//#endregion
|
|
68
110
|
//#region src/exceptions.d.ts
|
|
69
111
|
/**
|
|
@@ -142,6 +184,21 @@ declare function CoperaAI({
|
|
|
142
184
|
passwordColumnId,
|
|
143
185
|
passwordColumnValue
|
|
144
186
|
}: AuthenticateTableRowParams) => Promise<Row>;
|
|
187
|
+
listRowComments: ({
|
|
188
|
+
boardId,
|
|
189
|
+
tableId,
|
|
190
|
+
rowId,
|
|
191
|
+
visibility,
|
|
192
|
+
after,
|
|
193
|
+
before
|
|
194
|
+
}: ListRowCommentsParams) => Promise<RowCommentPagination>;
|
|
195
|
+
createRowComment: ({
|
|
196
|
+
boardId,
|
|
197
|
+
tableId,
|
|
198
|
+
rowId,
|
|
199
|
+
content,
|
|
200
|
+
visibility
|
|
201
|
+
}: CreateRowCommentParams) => Promise<RowComment>;
|
|
145
202
|
};
|
|
146
203
|
channel: {
|
|
147
204
|
sendMessage: ({
|
|
@@ -152,5 +209,5 @@ declare function CoperaAI({
|
|
|
152
209
|
};
|
|
153
210
|
};
|
|
154
211
|
//#endregion
|
|
155
|
-
export { ApiError, AuthenticateTableRowParams, Board, Column, ColumnOption, ColumnValue, CoperaAI, CoperaAI as default, CoperaAIError, CreateRowParams, Row, SendMessageParams, Table };
|
|
212
|
+
export { ApiError, AuthenticateTableRowParams, Board, Column, ColumnOption, ColumnValue, CommentAuthor, CommentVisibility, CommentVisibilityFilter, CoperaAI, CoperaAI as default, CoperaAIError, CreateRowCommentParams, CreateRowParams, ListRowCommentsParams, PageInfo, Row, RowComment, RowCommentPagination, SendMessageParams, Table };
|
|
156
213
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -64,6 +64,48 @@ interface AuthenticateTableRowParams {
|
|
|
64
64
|
interface ApiError {
|
|
65
65
|
error: string;
|
|
66
66
|
}
|
|
67
|
+
type CommentVisibility = "internal" | "external";
|
|
68
|
+
type CommentVisibilityFilter = "all" | "internal" | "external";
|
|
69
|
+
interface CommentAuthor {
|
|
70
|
+
_id: string;
|
|
71
|
+
name: string | null;
|
|
72
|
+
picture: string | null;
|
|
73
|
+
email: string | null;
|
|
74
|
+
}
|
|
75
|
+
interface RowComment {
|
|
76
|
+
_id: string;
|
|
77
|
+
content: string | null;
|
|
78
|
+
contentType: string;
|
|
79
|
+
visibility: CommentVisibility;
|
|
80
|
+
author: CommentAuthor;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
updatedAt: string;
|
|
83
|
+
}
|
|
84
|
+
interface PageInfo {
|
|
85
|
+
endCursor: string | null;
|
|
86
|
+
startCursor: string | null;
|
|
87
|
+
hasNextPage: boolean;
|
|
88
|
+
hasPreviousPage: boolean;
|
|
89
|
+
}
|
|
90
|
+
interface RowCommentPagination {
|
|
91
|
+
items: RowComment[];
|
|
92
|
+
pageInfo: PageInfo;
|
|
93
|
+
}
|
|
94
|
+
interface ListRowCommentsParams {
|
|
95
|
+
boardId: string;
|
|
96
|
+
tableId: string;
|
|
97
|
+
rowId: string;
|
|
98
|
+
visibility?: CommentVisibilityFilter;
|
|
99
|
+
after?: string;
|
|
100
|
+
before?: string;
|
|
101
|
+
}
|
|
102
|
+
interface CreateRowCommentParams {
|
|
103
|
+
boardId: string;
|
|
104
|
+
tableId: string;
|
|
105
|
+
rowId: string;
|
|
106
|
+
content: string;
|
|
107
|
+
visibility?: CommentVisibility;
|
|
108
|
+
}
|
|
67
109
|
//#endregion
|
|
68
110
|
//#region src/exceptions.d.ts
|
|
69
111
|
/**
|
|
@@ -142,6 +184,21 @@ declare function CoperaAI({
|
|
|
142
184
|
passwordColumnId,
|
|
143
185
|
passwordColumnValue
|
|
144
186
|
}: AuthenticateTableRowParams) => Promise<Row>;
|
|
187
|
+
listRowComments: ({
|
|
188
|
+
boardId,
|
|
189
|
+
tableId,
|
|
190
|
+
rowId,
|
|
191
|
+
visibility,
|
|
192
|
+
after,
|
|
193
|
+
before
|
|
194
|
+
}: ListRowCommentsParams) => Promise<RowCommentPagination>;
|
|
195
|
+
createRowComment: ({
|
|
196
|
+
boardId,
|
|
197
|
+
tableId,
|
|
198
|
+
rowId,
|
|
199
|
+
content,
|
|
200
|
+
visibility
|
|
201
|
+
}: CreateRowCommentParams) => Promise<RowComment>;
|
|
145
202
|
};
|
|
146
203
|
channel: {
|
|
147
204
|
sendMessage: ({
|
|
@@ -152,5 +209,5 @@ declare function CoperaAI({
|
|
|
152
209
|
};
|
|
153
210
|
};
|
|
154
211
|
//#endregion
|
|
155
|
-
export { ApiError, AuthenticateTableRowParams, Board, Column, ColumnOption, ColumnValue, CoperaAI, CoperaAI as default, CoperaAIError, CreateRowParams, Row, SendMessageParams, Table };
|
|
212
|
+
export { ApiError, AuthenticateTableRowParams, Board, Column, ColumnOption, ColumnValue, CommentAuthor, CommentVisibility, CommentVisibilityFilter, CoperaAI, CoperaAI as default, CoperaAIError, CreateRowCommentParams, CreateRowParams, ListRowCommentsParams, PageInfo, Row, RowComment, RowCommentPagination, SendMessageParams, Table };
|
|
156
213
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/version.ts
|
|
2
|
-
const COPERA_SDK_VERSION = "2.
|
|
2
|
+
const COPERA_SDK_VERSION = "2.3.0";
|
|
3
3
|
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/constants.ts
|
|
@@ -78,6 +78,20 @@ function createAuthenticateTableRow(request) {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/services/board/create-row-comment.ts
|
|
83
|
+
function createCreateRowComment(request) {
|
|
84
|
+
return async function createRowComment({ boardId, tableId, rowId, content, visibility }) {
|
|
85
|
+
return request(`/board/${boardId}/table/${tableId}/row/${rowId}/comment`, {
|
|
86
|
+
method: "POST",
|
|
87
|
+
body: JSON.stringify({
|
|
88
|
+
content,
|
|
89
|
+
visibility
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
81
95
|
//#endregion
|
|
82
96
|
//#region src/services/board/create-table-row.ts
|
|
83
97
|
function createCreateTableRow(request) {
|
|
@@ -132,6 +146,19 @@ function createListBoards(request) {
|
|
|
132
146
|
};
|
|
133
147
|
}
|
|
134
148
|
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/services/board/list-row-comments.ts
|
|
151
|
+
function createListRowComments(request) {
|
|
152
|
+
return async function listRowComments({ boardId, tableId, rowId, visibility, after, before }) {
|
|
153
|
+
const params = new URLSearchParams();
|
|
154
|
+
if (visibility !== void 0) params.set("visibility", visibility);
|
|
155
|
+
if (after !== void 0) params.set("after", after);
|
|
156
|
+
if (before !== void 0) params.set("before", before);
|
|
157
|
+
const query = params.toString();
|
|
158
|
+
return request(`/board/${boardId}/table/${tableId}/row/${rowId}/comments${query ? `?${query}` : ""}`, { method: "GET" });
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
135
162
|
//#endregion
|
|
136
163
|
//#region src/services/board/list-table-rows.ts
|
|
137
164
|
function createListTableRows(request) {
|
|
@@ -151,7 +178,9 @@ function createBoardHandlers(request) {
|
|
|
151
178
|
listTableRows: createListTableRows(request),
|
|
152
179
|
getTableRow: createGetTableRow(request),
|
|
153
180
|
createTableRow: createCreateTableRow(request),
|
|
154
|
-
authenticateTableRow: createAuthenticateTableRow(request)
|
|
181
|
+
authenticateTableRow: createAuthenticateTableRow(request),
|
|
182
|
+
listRowComments: createListRowComments(request),
|
|
183
|
+
createRowComment: createCreateRowComment(request)
|
|
155
184
|
};
|
|
156
185
|
}
|
|
157
186
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/version.ts","../src/constants.ts","../src/exceptions.ts","../src/requests.ts","../src/services/board/authenticate-table-row.ts","../src/services/board/create-table-row.ts","../src/services/board/get-board-details.ts","../src/services/board/get-board-table.ts","../src/services/board/get-table-row.ts","../src/services/board/list-board-tables.ts","../src/services/board/list-boards.ts","../src/services/board/list-table-rows.ts","../src/services/board/index.ts","../src/services/channel/send-message.ts","../src/services/channel/index.ts","../src/services/index.ts","../src/index.ts"],"sourcesContent":["/*This file is auto generated during build, DO NOT CHANGE OR MODIFY */\n\nexport const COPERA_SDK_VERSION = \"2.2.1\";\n","import { COPERA_SDK_VERSION } from \"./version.js\";\n\nexport const BASE_URL = \"https://api.copera.ai/public/v1\";\nexport const BASE_URL_DEV = \"https://api-dev.copera.ai/public/v1\";\n\nexport const COPERA_DOCS = \"https://developers.copera.ai\";\n\nexport function getHeaders(apiKey: string) {\n return {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `NodeJS SDK ${COPERA_SDK_VERSION}`,\n };\n}\n","import { COPERA_DOCS } from \"./constants.js\";\n\n/**\n * Default class for CoperaAI exceptions and errors.\n *\n * It can be serialized to JSON through the `toJSON` method.\n */\nexport class CoperaAIError extends Error {\n constructor(message: string) {\n super(\n `CoperaAI SDK Error: ${message}\\n\\nPlease, refer to the documentation at: ${COPERA_DOCS}`,\n );\n this.name = \"CoperaAIError\";\n }\n\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n };\n }\n}\n","import { BASE_URL, BASE_URL_DEV, getHeaders } from \"./constants.js\";\n\nexport function createRequest(\n apiKey: string,\n sandbox: boolean = false,\n): <TResponse>(path: string, options: RequestInit) => Promise<TResponse> {\n const defaultHeaders = getHeaders(apiKey);\n\n const baseUrl = sandbox ? BASE_URL_DEV : BASE_URL;\n\n return async <TResponse>(\n path: string,\n options: RequestInit,\n ): Promise<TResponse> => {\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n ...options,\n headers: { ...defaultHeaders, ...options?.headers },\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n ...data,\n responseCode: response.status,\n responseStatus: response.statusText,\n error: data.error || data.message,\n } as TResponse;\n }\n\n return data;\n } catch (error) {\n return { error: (error as Error).message } as TResponse;\n }\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { AuthenticateTableRowParams, Row } from \"../../types.js\";\n\nexport function createAuthenticateTableRow(\n request: ReturnType<typeof createRequest>,\n) {\n return async function authenticateTableRow({\n boardId,\n tableId,\n identifierColumnId,\n identifierColumnValue,\n passwordColumnId,\n passwordColumnValue,\n }: AuthenticateTableRowParams) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row/authenticate`, {\n method: \"POST\",\n body: JSON.stringify({\n identifierColumnId,\n identifierColumnValue,\n passwordColumnId,\n passwordColumnValue,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { ColumnValue, Row } from \"../../types.js\";\n\nexport function createCreateTableRow(\n request: ReturnType<typeof createRequest>,\n) {\n return async function createTableRow({\n boardId,\n tableId,\n description,\n columns,\n }: {\n boardId: string;\n tableId: string;\n description?: string;\n columns: ColumnValue[];\n }) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row`, {\n method: \"POST\",\n body: JSON.stringify({\n description,\n columns,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Board } from \"../../types.js\";\n\nexport function createGetBoardDetails(\n request: ReturnType<typeof createRequest>,\n) {\n return async function getBoardDetails({ boardId }: { boardId: string }) {\n return request<Board>(`/board/${boardId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Table } from \"../../types.js\";\n\nexport function createGetBoardTable(request: ReturnType<typeof createRequest>) {\n return async function getBoardTable({\n boardId,\n tableId,\n }: {\n boardId: string;\n tableId: string;\n }) {\n return request<Table>(`/board/${boardId}/table/${tableId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Row } from \"../../types.js\";\n\nexport function createGetTableRow(request: ReturnType<typeof createRequest>) {\n return async function getTableRow({\n boardId,\n tableId,\n rowId,\n }: {\n boardId: string;\n tableId: string;\n rowId: string;\n }) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row/${rowId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Table } from \"../../types.js\";\n\nexport function createListBoardTables(\n request: ReturnType<typeof createRequest>,\n) {\n return async function listBoardTables({ boardId }: { boardId: string }) {\n return request<Table[]>(`/board/${boardId}/tables`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Board } from \"../../types.js\";\n\nexport function createListBoards(request: ReturnType<typeof createRequest>) {\n return async function listBoards() {\n return request<Board[]>(\"/board/list-boards\", {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Row } from \"../../types.js\";\n\nexport function createListTableRows(request: ReturnType<typeof createRequest>) {\n return async function listTableRows({\n boardId,\n tableId,\n }: {\n boardId: string;\n tableId: string;\n }) {\n return request<Row[]>(`/board/${boardId}/table/${tableId}/rows`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport { createAuthenticateTableRow } from \"./authenticate-table-row.js\";\nimport { createCreateTableRow } from \"./create-table-row.js\";\nimport { createGetBoardDetails } from \"./get-board-details.js\";\nimport { createGetBoardTable } from \"./get-board-table.js\";\nimport { createGetTableRow } from \"./get-table-row.js\";\nimport { createListBoardTables } from \"./list-board-tables.js\";\nimport { createListBoards } from \"./list-boards.js\";\nimport { createListTableRows } from \"./list-table-rows.js\";\n\nexport function createBoardHandlers(request: ReturnType<typeof createRequest>) {\n return {\n listBoards: createListBoards(request),\n getBoardDetails: createGetBoardDetails(request),\n listBoardTables: createListBoardTables(request),\n getBoardTable: createGetBoardTable(request),\n listTableRows: createListTableRows(request),\n getTableRow: createGetTableRow(request),\n createTableRow: createCreateTableRow(request),\n authenticateTableRow: createAuthenticateTableRow(request),\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { SendMessageParams } from \"../../types.js\";\n\nexport function createSendMessage(request: ReturnType<typeof createRequest>) {\n return async function sendMessage({\n channelId,\n message,\n name,\n }: SendMessageParams) {\n return request<void>(`/chat/channel/${channelId}/send-message`, {\n method: \"POST\",\n body: JSON.stringify({\n message,\n name,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport { createSendMessage } from \"./send-message.js\";\n\nexport function createChannelHandlers(\n request: ReturnType<typeof createRequest>,\n) {\n return {\n sendMessage: createSendMessage(request),\n };\n}\n","import type { createRequest } from \"../requests.js\";\nimport { createBoardHandlers } from \"./board/index.js\";\nimport { createChannelHandlers } from \"./channel/index.js\";\n\nexport function getHandlers(request: ReturnType<typeof createRequest>) {\n return {\n board: createBoardHandlers(request),\n channel: createChannelHandlers(request),\n };\n}\n","import { CoperaAIError } from \"./exceptions.js\";\nimport { createRequest } from \"./requests.js\";\nimport { getHandlers } from \"./services/index.js\";\n\ninterface CoperaAIOptions {\n apiKey: string;\n sandbox?: boolean;\n}\nexport function CoperaAI({ apiKey, sandbox = false }: CoperaAIOptions) {\n if (!apiKey) throw new CoperaAIError(\"API key is required!\");\n const request = createRequest(apiKey, sandbox);\n\n return getHandlers(request);\n}\n\nexport { CoperaAIError };\n\nexport * from \"./types.js\";\n\nexport default CoperaAI;\n"],"mappings":";AAEA,MAAa,qBAAqB;;;;ACAlC,MAAa,WAAW;AACxB,MAAa,eAAe;AAE5B,MAAa,cAAc;AAE3B,SAAgB,WAAW,QAAgB;AACzC,QAAO;EACL,eAAe,UAAU;EACzB,gBAAgB;EAChB,cAAc,cAAc;EAC7B;;;;;;;;;;ACLH,IAAa,gBAAb,cAAmC,MAAM;CACvC,YAAY,SAAiB;AAC3B,QACE,uBAAuB,QAAQ,6CAA6C,cAC7E;AACD,OAAK,OAAO;;CAGd,SAAS;AACP,SAAO;GACL,MAAM,KAAK;GACX,SAAS,KAAK;GACf;;;;;;ACjBL,SAAgB,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AM,IAAI,cAAc,uBAAuB;AAG5D,QAAO,YAFS,cAAc,QAAQ,QAAQ,CAEnB;;AAO7B,kBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/version.ts","../src/constants.ts","../src/exceptions.ts","../src/requests.ts","../src/services/board/authenticate-table-row.ts","../src/services/board/create-row-comment.ts","../src/services/board/create-table-row.ts","../src/services/board/get-board-details.ts","../src/services/board/get-board-table.ts","../src/services/board/get-table-row.ts","../src/services/board/list-board-tables.ts","../src/services/board/list-boards.ts","../src/services/board/list-row-comments.ts","../src/services/board/list-table-rows.ts","../src/services/board/index.ts","../src/services/channel/send-message.ts","../src/services/channel/index.ts","../src/services/index.ts","../src/index.ts"],"sourcesContent":["/*This file is auto generated during build, DO NOT CHANGE OR MODIFY */\n\nexport const COPERA_SDK_VERSION = \"2.3.0\";\n","import { COPERA_SDK_VERSION } from \"./version.js\";\n\nexport const BASE_URL = \"https://api.copera.ai/public/v1\";\nexport const BASE_URL_DEV = \"https://api-dev.copera.ai/public/v1\";\n\nexport const COPERA_DOCS = \"https://developers.copera.ai\";\n\nexport function getHeaders(apiKey: string) {\n return {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `NodeJS SDK ${COPERA_SDK_VERSION}`,\n };\n}\n","import { COPERA_DOCS } from \"./constants.js\";\n\n/**\n * Default class for CoperaAI exceptions and errors.\n *\n * It can be serialized to JSON through the `toJSON` method.\n */\nexport class CoperaAIError extends Error {\n constructor(message: string) {\n super(\n `CoperaAI SDK Error: ${message}\\n\\nPlease, refer to the documentation at: ${COPERA_DOCS}`,\n );\n this.name = \"CoperaAIError\";\n }\n\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n };\n }\n}\n","import { BASE_URL, BASE_URL_DEV, getHeaders } from \"./constants.js\";\n\nexport function createRequest(\n apiKey: string,\n sandbox: boolean = false,\n): <TResponse>(path: string, options: RequestInit) => Promise<TResponse> {\n const defaultHeaders = getHeaders(apiKey);\n\n const baseUrl = sandbox ? BASE_URL_DEV : BASE_URL;\n\n return async <TResponse>(\n path: string,\n options: RequestInit,\n ): Promise<TResponse> => {\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n ...options,\n headers: { ...defaultHeaders, ...options?.headers },\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n ...data,\n responseCode: response.status,\n responseStatus: response.statusText,\n error: data.error || data.message,\n } as TResponse;\n }\n\n return data;\n } catch (error) {\n return { error: (error as Error).message } as TResponse;\n }\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { AuthenticateTableRowParams, Row } from \"../../types.js\";\n\nexport function createAuthenticateTableRow(\n request: ReturnType<typeof createRequest>,\n) {\n return async function authenticateTableRow({\n boardId,\n tableId,\n identifierColumnId,\n identifierColumnValue,\n passwordColumnId,\n passwordColumnValue,\n }: AuthenticateTableRowParams) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row/authenticate`, {\n method: \"POST\",\n body: JSON.stringify({\n identifierColumnId,\n identifierColumnValue,\n passwordColumnId,\n passwordColumnValue,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { CreateRowCommentParams, RowComment } from \"../../types.js\";\n\nexport function createCreateRowComment(\n request: ReturnType<typeof createRequest>,\n) {\n return async function createRowComment({\n boardId,\n tableId,\n rowId,\n content,\n visibility,\n }: CreateRowCommentParams) {\n return request<RowComment>(\n `/board/${boardId}/table/${tableId}/row/${rowId}/comment`,\n {\n method: \"POST\",\n body: JSON.stringify({\n content,\n visibility,\n }),\n },\n );\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { ColumnValue, Row } from \"../../types.js\";\n\nexport function createCreateTableRow(\n request: ReturnType<typeof createRequest>,\n) {\n return async function createTableRow({\n boardId,\n tableId,\n description,\n columns,\n }: {\n boardId: string;\n tableId: string;\n description?: string;\n columns: ColumnValue[];\n }) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row`, {\n method: \"POST\",\n body: JSON.stringify({\n description,\n columns,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Board } from \"../../types.js\";\n\nexport function createGetBoardDetails(\n request: ReturnType<typeof createRequest>,\n) {\n return async function getBoardDetails({ boardId }: { boardId: string }) {\n return request<Board>(`/board/${boardId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Table } from \"../../types.js\";\n\nexport function createGetBoardTable(request: ReturnType<typeof createRequest>) {\n return async function getBoardTable({\n boardId,\n tableId,\n }: {\n boardId: string;\n tableId: string;\n }) {\n return request<Table>(`/board/${boardId}/table/${tableId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Row } from \"../../types.js\";\n\nexport function createGetTableRow(request: ReturnType<typeof createRequest>) {\n return async function getTableRow({\n boardId,\n tableId,\n rowId,\n }: {\n boardId: string;\n tableId: string;\n rowId: string;\n }) {\n return request<Row>(`/board/${boardId}/table/${tableId}/row/${rowId}`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Table } from \"../../types.js\";\n\nexport function createListBoardTables(\n request: ReturnType<typeof createRequest>,\n) {\n return async function listBoardTables({ boardId }: { boardId: string }) {\n return request<Table[]>(`/board/${boardId}/tables`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Board } from \"../../types.js\";\n\nexport function createListBoards(request: ReturnType<typeof createRequest>) {\n return async function listBoards() {\n return request<Board[]>(\"/board/list-boards\", {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type {\n ListRowCommentsParams,\n RowCommentPagination,\n} from \"../../types.js\";\n\nexport function createListRowComments(\n request: ReturnType<typeof createRequest>,\n) {\n return async function listRowComments({\n boardId,\n tableId,\n rowId,\n visibility,\n after,\n before,\n }: ListRowCommentsParams) {\n const params = new URLSearchParams();\n if (visibility !== undefined) params.set(\"visibility\", visibility);\n if (after !== undefined) params.set(\"after\", after);\n if (before !== undefined) params.set(\"before\", before);\n const query = params.toString();\n const path = `/board/${boardId}/table/${tableId}/row/${rowId}/comments${query ? `?${query}` : \"\"}`;\n return request<RowCommentPagination>(path, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { Row } from \"../../types.js\";\n\nexport function createListTableRows(request: ReturnType<typeof createRequest>) {\n return async function listTableRows({\n boardId,\n tableId,\n }: {\n boardId: string;\n tableId: string;\n }) {\n return request<Row[]>(`/board/${boardId}/table/${tableId}/rows`, {\n method: \"GET\",\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport { createAuthenticateTableRow } from \"./authenticate-table-row.js\";\nimport { createCreateRowComment } from \"./create-row-comment.js\";\nimport { createCreateTableRow } from \"./create-table-row.js\";\nimport { createGetBoardDetails } from \"./get-board-details.js\";\nimport { createGetBoardTable } from \"./get-board-table.js\";\nimport { createGetTableRow } from \"./get-table-row.js\";\nimport { createListBoardTables } from \"./list-board-tables.js\";\nimport { createListBoards } from \"./list-boards.js\";\nimport { createListRowComments } from \"./list-row-comments.js\";\nimport { createListTableRows } from \"./list-table-rows.js\";\n\nexport function createBoardHandlers(request: ReturnType<typeof createRequest>) {\n return {\n listBoards: createListBoards(request),\n getBoardDetails: createGetBoardDetails(request),\n listBoardTables: createListBoardTables(request),\n getBoardTable: createGetBoardTable(request),\n listTableRows: createListTableRows(request),\n getTableRow: createGetTableRow(request),\n createTableRow: createCreateTableRow(request),\n authenticateTableRow: createAuthenticateTableRow(request),\n listRowComments: createListRowComments(request),\n createRowComment: createCreateRowComment(request),\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport type { SendMessageParams } from \"../../types.js\";\n\nexport function createSendMessage(request: ReturnType<typeof createRequest>) {\n return async function sendMessage({\n channelId,\n message,\n name,\n }: SendMessageParams) {\n return request<void>(`/chat/channel/${channelId}/send-message`, {\n method: \"POST\",\n body: JSON.stringify({\n message,\n name,\n }),\n });\n };\n}\n","import type { createRequest } from \"../../requests.js\";\nimport { createSendMessage } from \"./send-message.js\";\n\nexport function createChannelHandlers(\n request: ReturnType<typeof createRequest>,\n) {\n return {\n sendMessage: createSendMessage(request),\n };\n}\n","import type { createRequest } from \"../requests.js\";\nimport { createBoardHandlers } from \"./board/index.js\";\nimport { createChannelHandlers } from \"./channel/index.js\";\n\nexport function getHandlers(request: ReturnType<typeof createRequest>) {\n return {\n board: createBoardHandlers(request),\n channel: createChannelHandlers(request),\n };\n}\n","import { CoperaAIError } from \"./exceptions.js\";\nimport { createRequest } from \"./requests.js\";\nimport { getHandlers } from \"./services/index.js\";\n\ninterface CoperaAIOptions {\n apiKey: string;\n sandbox?: boolean;\n}\nexport function CoperaAI({ apiKey, sandbox = false }: CoperaAIOptions) {\n if (!apiKey) throw new CoperaAIError(\"API key is required!\");\n const request = createRequest(apiKey, sandbox);\n\n return getHandlers(request);\n}\n\nexport { CoperaAIError };\n\nexport * from \"./types.js\";\n\nexport default CoperaAI;\n"],"mappings":";AAEA,MAAa,qBAAqB;;;;ACAlC,MAAa,WAAW;AACxB,MAAa,eAAe;AAE5B,MAAa,cAAc;AAE3B,SAAgB,WAAW,QAAgB;AACzC,QAAO;EACL,eAAe,UAAU;EACzB,gBAAgB;EAChB,cAAc,cAAc;EAC7B;;;;;;;;;;ACLH,IAAa,gBAAb,cAAmC,MAAM;CACvC,YAAY,SAAiB;AAC3B,QACE,uBAAuB,QAAQ,6CAA6C,cAC7E;AACD,OAAK,OAAO;;CAGd,SAAS;AACP,SAAO;GACL,MAAM,KAAK;GACX,SAAS,KAAK;GACf;;;;;;ACjBL,SAAgB,cACd,QACA,UAAmB,OACoD;CACvE,MAAM,iBAAiB,WAAW,OAAO;CAEzC,MAAM,UAAU,UAAU,eAAe;AAEzC,QAAO,OACL,MACA,YACuB;AACvB,MAAI;GACF,MAAM,WAAW,MAAM,MAAM,GAAG,UAAU,QAAQ;IAChD,GAAG;IACH,SAAS;KAAE,GAAG;KAA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