@botpress/client 0.14.2 → 0.16.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/dist/bundle.cjs +10 -10
- package/dist/bundle.cjs.map +3 -3
- package/dist/gen/api.d.ts +203 -235
- package/dist/gen/base.d.ts +1 -1
- package/dist/gen/client.d.ts +5 -7
- package/dist/gen/common.d.ts +1 -1
- package/dist/gen/configuration.d.ts +1 -1
- package/dist/gen/index.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +23 -35
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/package.json +6 -4
- package/{e2e → tests/e2e}/browser/script.ts +1 -1
- package/{e2e → tests/e2e}/node.ts +1 -1
- package/tests/manual/file-upload.test.ts +29 -0
- /package/{e2e → tests/e2e}/browser/index.ts +0 -0
- /package/{e2e → tests/e2e}/consts.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Botpress Client",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"build": "pnpm build:type && pnpm build:node && pnpm build:browser && pnpm build:bundle",
|
|
21
21
|
"generate": "ts-node ./openapi.ts",
|
|
22
22
|
"test": "pnpm run e2e:test",
|
|
23
|
-
"
|
|
23
|
+
"test:manual": "vitest tests/manual/file-upload",
|
|
24
|
+
"e2e:test": "ts-node -T ./tests/e2e/node.ts && ts-node -T ./tests/e2e/browser"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"axios": "^1.6.1",
|
|
@@ -28,11 +29,12 @@
|
|
|
28
29
|
"type-fest": "^3.4.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@botpress/api": "0.
|
|
32
|
+
"@botpress/api": "0.27.7",
|
|
32
33
|
"esbuild": "^0.16.12",
|
|
33
34
|
"lodash": "^4.17.21",
|
|
34
35
|
"puppeteer": "^22.0.0",
|
|
35
36
|
"ts-node": "^10.9.2",
|
|
36
|
-
"typescript": "^4.9.4"
|
|
37
|
+
"typescript": "^4.9.4",
|
|
38
|
+
"vitest": "^0.33.0"
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This a test to be run manually to test the custom file creation/upload method added in the client.
|
|
5
|
+
*
|
|
6
|
+
* Follow these steps to run it:
|
|
7
|
+
* 1. Run Tilt on the Skynet repository using the `files-api` mode and make sure a "DEV_BYPASS_USAGE_CHECKS" env var with a string value of "true" is passed to the `files-api` Tilt resource so that we can use the predefined bot ID below.
|
|
8
|
+
* 2. Then run `pnpm test:manual` in the terminal to run this test.
|
|
9
|
+
*/
|
|
10
|
+
import { Client } from '../../src'
|
|
11
|
+
|
|
12
|
+
describe('createAndUploadFile', () => {
|
|
13
|
+
it('works as expected', async () => {
|
|
14
|
+
const client = new Client({
|
|
15
|
+
apiUrl: 'http://localhost:5986',
|
|
16
|
+
botId: '87e67c78-e5d3-4cf7-97de-82b1f3907879',
|
|
17
|
+
token: 'bp_pat_abcdefghijklmnopqrstuvwxyz0123456789',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const response = await client.createAndUploadFile({
|
|
21
|
+
name: 'test.txt',
|
|
22
|
+
data: Buffer.from('aaa'),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
expect(response.file.name).toBe('test.txt')
|
|
26
|
+
expect(response.file.status).toBe('UPLOAD_COMPLETED')
|
|
27
|
+
expect(response.file.url, 'File URL should have been returned').toBeTruthy()
|
|
28
|
+
})
|
|
29
|
+
})
|
|
File without changes
|
|
File without changes
|