@ctchealth/plato-sdk 0.0.18 → 0.0.19

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 CHANGED
@@ -8,13 +8,7 @@ The Plato SDK provides a simple and type-safe way to integrate with the Plato pl
8
8
 
9
9
  ## Authentication
10
10
 
11
- All API requests require authentication using a Bearer token. Include your JWT token in the `API-AUTH` header:
12
-
13
- ```
14
- API-AUTH: Bearer <your-jwt-token>
15
- ```
16
-
17
- Requests without a valid JWT token will be rejected with a `401 Unauthorized` response.
11
+ All API requests require authentication via a client token. Pass a pre-signed JWT token as `jwtToken` when initializing the client. This is sent as the `x-client-token` header on every request.
18
12
 
19
13
  ## Features
20
14
 
@@ -39,8 +33,8 @@ import { PlatoApiClient, AvatarLanguage } from 'plato-sdk';
39
33
  // Initialize the client
40
34
  const client = new PlatoApiClient({
41
35
  baseUrl: 'https://your-plato-api.com',
42
- token: 'your-api-token',
43
- user: 'test@test.test',
36
+ jwtToken: 'your-jwt-token',
37
+ publicKey: 'your-public-key',
44
38
  });
45
39
 
46
40
  // Get available assistant images
@@ -133,19 +127,17 @@ new PlatoApiClient(config: ApiClientConfig)
133
127
 
134
128
  **Parameters:**
135
129
 
136
- - `config.baseUrl` (string): The base URL of the Plato API
137
- - `config.token` (string): Your API authentication token
138
- - `config.user` (string): Your user identifier
139
- - `config.jwtToken` (string, optional): A per-user JWT token sent as the `x-client-token` header on every request
130
+ - `config.baseUrl` (string, required): The base URL of the Plato API
131
+ - `config.jwtToken` (string, required): A pre-signed JWT token sent as the `x-client-token` header on every request
132
+ - `config.publicKey` (string, required): Your public key for voice call functionality
140
133
 
141
- **Example with JWT token:**
134
+ **Example:**
142
135
 
143
136
  ```typescript
144
137
  const client = new PlatoApiClient({
145
138
  baseUrl: 'https://your-plato-api.com',
146
- token: 'your-api-key',
147
- user: 'user@example.com',
148
- jwtToken: 'eyJhbGciOiJSUzI1NiIs...', // optional, per-user token
139
+ jwtToken: 'eyJhbGciOiJSUzI1NiIs...',
140
+ publicKey: 'your-public-key',
149
141
  });
150
142
  ```
151
143
 
@@ -218,6 +210,24 @@ const callDetails = await client.getCallDetails(call._id);
218
210
  console.log('Call Summary:', callDetails.summary);
219
211
  ```
220
212
 
213
+ ##### deleteCall(callId: string)
214
+
215
+ Deletes a single call and all associated data including messages, recommendations, and the S3 recording. Only the owner of the call (the rep who made it) can delete it.
216
+
217
+ **Parameters:**
218
+
219
+ - `callId` (string): The MongoDB `_id` of the call to delete
220
+
221
+ **Returns:** `Promise<void>`
222
+
223
+ **Example:**
224
+
225
+ ```typescript
226
+ await client.deleteCall('507f1f77bcf86cd799439011');
227
+ ```
228
+
229
+ **Note:** This action is irreversible. The call, its transcript, messages, recording, and any recommendations generated from it will be permanently removed.
230
+
221
231
  ##### getCallRecordings(queryParams: SimulationRecordingsQueryDto)
222
232
 
223
233
  Retrieves a paginated list of call recordings for the authenticated user.
@@ -655,8 +665,8 @@ import { PlatoApiClient } from 'plato-sdk';
655
665
  function TrainingApp() {
656
666
  const [platoClient] = useState(() => new PlatoApiClient({
657
667
  baseUrl: 'https://your-api.com',
658
- token: 'your-token',
659
- user: 'your-user',
668
+ jwtToken: 'your-jwt-token',
669
+ publicKey: 'your-public-key',
660
670
  }));
661
671
 
662
672
  useEffect(() => {
@@ -1393,6 +1403,7 @@ enum AvatarLanguage {
1393
1403
  Italian = 'it',
1394
1404
  French = 'fr',
1395
1405
  Arabic = 'ar',
1406
+ Russian = 'ru',
1396
1407
  }
1397
1408
  ```
1398
1409
 
@@ -1404,8 +1415,8 @@ The SDK throws errors for invalid configurations and API failures:
1404
1415
  try {
1405
1416
  const client = new PlatoApiClient({
1406
1417
  baseUrl: 'https://api.plato.com',
1407
- token: 'your-token',
1408
- user: 'your-user',
1418
+ jwtToken: 'your-jwt-token',
1419
+ publicKey: 'your-public-key',
1409
1420
  });
1410
1421
 
1411
1422
  const simulation = await client.createSimulation(simulationConfig);
@@ -0,0 +1,121 @@
1
+ const { defineConfig, globalIgnores } = require('eslint/config');
2
+ const path = require('path');
3
+
4
+ const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin');
5
+ const globals = require('globals');
6
+ const tsParser = require('@typescript-eslint/parser');
7
+ const jest = require('eslint-plugin-jest');
8
+ const js = require('@eslint/js');
9
+ const headers = require('eslint-plugin-headers');
10
+ const { FlatCompat } = require('@eslint/eslintrc');
11
+ const baseRules = require('../../eslint-config-base.cjs');
12
+
13
+ const compat = new FlatCompat({
14
+ baseDirectory: __dirname,
15
+ recommendedConfig: js.configs.recommended,
16
+ allConfig: js.configs.all,
17
+ });
18
+
19
+ module.exports = defineConfig([
20
+ globalIgnores([
21
+ '**/.eslintrc.js',
22
+ 'src/index.d.ts',
23
+ 'scripts/db-migrations/archived/**/*',
24
+ '**/*.spec.ts',
25
+ '**/*.config.js',
26
+ '**/*.config.cjs',
27
+ '**/jest.config.ts',
28
+ ]),
29
+ {
30
+ files: ['**/*.ts'],
31
+ plugins: {
32
+ headers,
33
+ },
34
+ rules: {
35
+ 'headers/header-format': [
36
+ 'error',
37
+ {
38
+ source: 'string',
39
+ content: `Copyright (c) 2025 ctcHealth. All rights reserved.
40
+
41
+ This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
42
+
43
+ This source code and all related materials are confidential and proprietary to ctcHealth.
44
+ Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
45
+ and may result in disciplinary action and civil and/or criminal penalties.
46
+
47
+ This software is intended solely for authorized use within ctcHealth and its designated partners.
48
+
49
+ For internal use only.`,
50
+ style: 'jsdoc',
51
+ trailingNewlines: 1,
52
+ preservePragmas: false,
53
+ },
54
+ ],
55
+ },
56
+ },
57
+ {
58
+ extends: compat.extends(
59
+ 'plugin:@typescript-eslint/recommended',
60
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
61
+ 'plugin:@typescript-eslint/strict'
62
+ ),
63
+
64
+ files: ['**/*.ts'],
65
+ ignores: ['**/*.json', '**/*.spec.ts'],
66
+
67
+ plugins: {
68
+ '@typescript-eslint': typescriptEslintEslintPlugin,
69
+ },
70
+
71
+ languageOptions: {
72
+ globals: {
73
+ ...globals.node,
74
+ ...globals.jest,
75
+ },
76
+
77
+ parser: tsParser,
78
+ ecmaVersion: 10,
79
+ sourceType: 'module',
80
+
81
+ parserOptions: {
82
+ project: path.join(__dirname, 'tsconfig.lib.json'),
83
+ },
84
+ },
85
+
86
+ rules: {
87
+ ...baseRules.rules, // shared rules
88
+ // project-specific rules
89
+ '@typescript-eslint/ban-ts-comment': 'warn',
90
+ '@typescript-eslint/interface-name-prefix': 'off',
91
+ '@typescript-eslint/explicit-function-return-type': 'warn',
92
+ '@typescript-eslint/promise-function-async': ['error'],
93
+ '@typescript-eslint/no-floating-promises': 'error',
94
+ '@typescript-eslint/await-thenable': 'error',
95
+ semi: ['error', 'always'],
96
+ '@typescript-eslint/unbound-method': 'error',
97
+ 'keyword-spacing': ['error'],
98
+ '@typescript-eslint/restrict-template-expressions': 'error',
99
+ '@typescript-eslint/prefer-regexp-exec': 'warn',
100
+ '@typescript-eslint/require-await': 'warn',
101
+ '@typescript-eslint/no-non-null-assertion': 'error',
102
+ '@typescript-eslint/no-unnecessary-condition': 'warn',
103
+ '@typescript-eslint/prefer-ts-expect-error': 'warn',
104
+ '@typescript-eslint/prefer-nullish-coalescing': 'off',
105
+ 'space-infix-ops': 'off',
106
+ },
107
+ },
108
+ {
109
+ files: ['**/*.spec.ts'],
110
+ extends: compat.extends('plugin:jest/recommended'),
111
+
112
+ plugins: {
113
+ jest,
114
+ },
115
+
116
+ rules: {
117
+ '@typescript-eslint/unbound-method': 'off',
118
+ 'jest/unbound-method': 'error',
119
+ },
120
+ },
121
+ ]);
package/jest.config.ts ADDED
@@ -0,0 +1,10 @@
1
+ export default {
2
+ displayName: 'plato-sdk',
3
+ preset: '../../jest.preset.js',
4
+ testEnvironment: 'node',
5
+ transform: {
6
+ '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
7
+ },
8
+ moduleFileExtensions: ['ts', 'js', 'html'],
9
+ coverageDirectory: '../../coverage/libs/plato-sdk',
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctchealth/plato-sdk",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "@vapi-ai/web": "2.1.8",
@@ -12,6 +12,5 @@
12
12
  "typings": "./src/index.d.ts",
13
13
  "publishConfig": {
14
14
  "access": "public"
15
- },
16
- "types": "./src/index.d.ts"
17
- }
15
+ }
16
+ }
package/project.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "plato-sdk",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "libs/plato-sdk/src",
5
+ "projectType": "library",
6
+ "tags": [],
7
+ "targets": {
8
+ "build": {
9
+ "executor": "@nx/js:tsc",
10
+ "outputs": ["{options.outputPath}"],
11
+ "options": {
12
+ "outputPath": "dist/libs/plato-sdk",
13
+ "main": "libs/plato-sdk/src/index.ts",
14
+ "tsConfig": "libs/plato-sdk/tsconfig.lib.json",
15
+ "assets": ["libs/plato-sdk/*.md"]
16
+ }
17
+ },
18
+ "nx-release-publish": {
19
+ "options": {
20
+ "packageRoot": "dist/{projectRoot}"
21
+ }
22
+ }
23
+ }
24
+ }
@@ -11,6 +11,6 @@
11
11
  *
12
12
  * For internal use only.
13
13
  */
14
- export declare const MAX_PDF_FILE_SIZE: number;
15
- export declare const ALLOWED_PDF_MIME_TYPES: string[];
16
- export declare const MAX_PDF_PAGES = 100;
14
+ export const MAX_PDF_FILE_SIZE = 20 * 1024 * 1024; // 20MB
15
+ export const ALLOWED_PDF_MIME_TYPES = ['application/pdf'];
16
+ export const MAX_PDF_PAGES = 100;