@ptkl/sdk 0.9.15 → 0.10.1
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/index.cjs.js +302 -42
- package/dist/index.esm.js +302 -42
- package/dist/index.iife.js +303 -43
- package/dist/monaco.d.ts +341 -13
- package/dist/package.json +1 -1
- package/dist/types/api/integrations/dms.d.ts +60 -20
- package/dist/types/api/ratchet.d.ts +193 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/integrations.d.ts +59 -1
- package/dist/types/types/ratchet.d.ts +38 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -19500,12 +19500,210 @@ class Thunder extends PlatformBaseClient {
|
|
|
19500
19500
|
}
|
|
19501
19501
|
|
|
19502
19502
|
class Ratchet extends PlatformBaseClient {
|
|
19503
|
+
/**
|
|
19504
|
+
* Get all database connections for the current project
|
|
19505
|
+
*
|
|
19506
|
+
* @returns List of all configured ratchet connections
|
|
19507
|
+
*
|
|
19508
|
+
* @example
|
|
19509
|
+
* ```typescript
|
|
19510
|
+
* const ratchet = new Ratchet();
|
|
19511
|
+
* const connections = await ratchet.getConnections();
|
|
19512
|
+
* console.log(connections.data); // Array of connections
|
|
19513
|
+
* ```
|
|
19514
|
+
*/
|
|
19515
|
+
async getConnections() {
|
|
19516
|
+
return await this.client.get("/v1/ratchet/connection");
|
|
19517
|
+
}
|
|
19518
|
+
/**
|
|
19519
|
+
* Get a specific database connection by ID
|
|
19520
|
+
*
|
|
19521
|
+
* @param id - Connection ID
|
|
19522
|
+
* @returns Connection details including queries
|
|
19523
|
+
*
|
|
19524
|
+
* @example
|
|
19525
|
+
* ```typescript
|
|
19526
|
+
* const ratchet = new Ratchet();
|
|
19527
|
+
* const connection = await ratchet.getConnection('users_db');
|
|
19528
|
+
* console.log(connection.data.queries); // Available queries for this connection
|
|
19529
|
+
* ```
|
|
19530
|
+
*/
|
|
19531
|
+
async getConnection(id) {
|
|
19532
|
+
return await this.client.get(`/v1/ratchet/connection/${id}`);
|
|
19533
|
+
}
|
|
19534
|
+
/**
|
|
19535
|
+
* Create a new database connection
|
|
19536
|
+
*
|
|
19537
|
+
* Supports multiple database types:
|
|
19538
|
+
* - MySQL: Use credentials with host, dbname, user, password
|
|
19539
|
+
* - PostgreSQL: Use credentials with host, dbname, user, password
|
|
19540
|
+
* - MongoDB: Use DSN connection string
|
|
19541
|
+
* - BigQuery: Use service_account_json and project_id
|
|
19542
|
+
*
|
|
19543
|
+
* @param connection - Connection configuration
|
|
19544
|
+
* @returns Created connection details
|
|
19545
|
+
*
|
|
19546
|
+
* @example
|
|
19547
|
+
* ```typescript
|
|
19548
|
+
* const ratchet = new Ratchet();
|
|
19549
|
+
*
|
|
19550
|
+
* // MySQL/PostgreSQL connection
|
|
19551
|
+
* await ratchet.createConnection({
|
|
19552
|
+
* id: 'users_db',
|
|
19553
|
+
* type: 'MySQL',
|
|
19554
|
+
* credentials: {
|
|
19555
|
+
* type: 'Credentials',
|
|
19556
|
+
* host: 'localhost',
|
|
19557
|
+
* dbname: 'users',
|
|
19558
|
+
* user: 'admin',
|
|
19559
|
+
* password: 'secret'
|
|
19560
|
+
* }
|
|
19561
|
+
* });
|
|
19562
|
+
*
|
|
19563
|
+
* // MongoDB connection
|
|
19564
|
+
* await ratchet.createConnection({
|
|
19565
|
+
* id: 'mongo_db',
|
|
19566
|
+
* type: 'MongoDB',
|
|
19567
|
+
* credentials: {
|
|
19568
|
+
* type: 'DSN',
|
|
19569
|
+
* dsn: 'mongodb://localhost:27017/mydb'
|
|
19570
|
+
* }
|
|
19571
|
+
* });
|
|
19572
|
+
*
|
|
19573
|
+
* // BigQuery connection
|
|
19574
|
+
* await ratchet.createConnection({
|
|
19575
|
+
* id: 'analytics_bq',
|
|
19576
|
+
* type: 'BigQuery',
|
|
19577
|
+
* credentials: {
|
|
19578
|
+
* type: 'ServiceAccount',
|
|
19579
|
+
* service_account_json: '{"type":"service_account",...}',
|
|
19580
|
+
* project_id: 'my-project-id'
|
|
19581
|
+
* }
|
|
19582
|
+
* });
|
|
19583
|
+
* ```
|
|
19584
|
+
*/
|
|
19585
|
+
async createConnection(connection) {
|
|
19586
|
+
return await this.client.post("/v1/ratchet/connection", connection);
|
|
19587
|
+
}
|
|
19588
|
+
/**
|
|
19589
|
+
* Update an existing database connection
|
|
19590
|
+
*
|
|
19591
|
+
* @param connection - Updated connection configuration
|
|
19592
|
+
* @returns Success status
|
|
19593
|
+
*
|
|
19594
|
+
* @example
|
|
19595
|
+
* ```typescript
|
|
19596
|
+
* const ratchet = new Ratchet();
|
|
19597
|
+
* await ratchet.updateConnection({
|
|
19598
|
+
* id: 'users_db',
|
|
19599
|
+
* type: 'postgres',
|
|
19600
|
+
* credentials: {
|
|
19601
|
+
* type: 'postgres',
|
|
19602
|
+
* host: 'localhost',
|
|
19603
|
+
* dbname: 'users',
|
|
19604
|
+
* user: 'admin',
|
|
19605
|
+
* password: 'new_secret'
|
|
19606
|
+
* },
|
|
19607
|
+
* queries: [
|
|
19608
|
+
* { id: 'get_user', expression: 'SELECT * FROM users WHERE id = $1' }
|
|
19609
|
+
* ]
|
|
19610
|
+
* });
|
|
19611
|
+
* ```
|
|
19612
|
+
*/
|
|
19613
|
+
async updateConnection(connection) {
|
|
19614
|
+
return await this.client.put("/v1/ratchet/connection", connection);
|
|
19615
|
+
}
|
|
19616
|
+
/**
|
|
19617
|
+
* Delete a database connection
|
|
19618
|
+
*
|
|
19619
|
+
* @param id - Connection ID to delete
|
|
19620
|
+
* @returns Success status
|
|
19621
|
+
*
|
|
19622
|
+
* @example
|
|
19623
|
+
* ```typescript
|
|
19624
|
+
* const ratchet = new Ratchet();
|
|
19625
|
+
* await ratchet.deleteConnection('users_db');
|
|
19626
|
+
* ```
|
|
19627
|
+
*/
|
|
19628
|
+
async deleteConnection(id) {
|
|
19629
|
+
return await this.client.delete(`/v1/ratchet/connection/${id}`);
|
|
19630
|
+
}
|
|
19631
|
+
/**
|
|
19632
|
+
* Test a database connection without saving it
|
|
19633
|
+
*
|
|
19634
|
+
* @param connection - Connection configuration to test
|
|
19635
|
+
* @returns Success status if connection is valid
|
|
19636
|
+
*
|
|
19637
|
+
* @example
|
|
19638
|
+
* ```typescript
|
|
19639
|
+
* const ratchet = new Ratchet();
|
|
19640
|
+
* const isValid = await ratchet.testConnection({
|
|
19641
|
+
* id: 'test_db',
|
|
19642
|
+
* type: 'postgres',
|
|
19643
|
+
* credentials: {
|
|
19644
|
+
* type: 'postgres',
|
|
19645
|
+
* host: 'localhost',
|
|
19646
|
+
* dbname: 'test',
|
|
19647
|
+
* user: 'admin',
|
|
19648
|
+
* password: 'secret'
|
|
19649
|
+
* }
|
|
19650
|
+
* });
|
|
19651
|
+
* ```
|
|
19652
|
+
*/
|
|
19653
|
+
async testConnection(connection) {
|
|
19654
|
+
return await this.client.post("/v1/ratchet/test/connection", connection);
|
|
19655
|
+
}
|
|
19656
|
+
/**
|
|
19657
|
+
* Execute a predefined database query
|
|
19658
|
+
*
|
|
19659
|
+
* Runs a query that has been previously configured in a ratchet connection.
|
|
19660
|
+
* The query is identified by a qualified name in the format: `connectionId.queryId`
|
|
19661
|
+
*
|
|
19662
|
+
* @param name - Qualified name of the query (format: `connectionId.queryId`)
|
|
19663
|
+
* @param params - Array of parameters to pass to the query
|
|
19664
|
+
* @returns Query execution results
|
|
19665
|
+
*
|
|
19666
|
+
* @example
|
|
19667
|
+
* ```typescript
|
|
19668
|
+
* const ratchet = new Ratchet();
|
|
19669
|
+
*
|
|
19670
|
+
* // Execute a query with parameters
|
|
19671
|
+
* const result = await ratchet.query('users_db.get_user_by_id', [123]);
|
|
19672
|
+
*
|
|
19673
|
+
* // Execute a query without parameters
|
|
19674
|
+
* const allUsers = await ratchet.query('users_db.get_all_users', []);
|
|
19675
|
+
* ```
|
|
19676
|
+
*/
|
|
19503
19677
|
async query(name, params) {
|
|
19504
|
-
return await this.client.post(
|
|
19678
|
+
return await this.client.post("/v1/ratchet/query", {
|
|
19505
19679
|
name: name,
|
|
19506
|
-
params: params
|
|
19680
|
+
params: params,
|
|
19507
19681
|
});
|
|
19508
19682
|
}
|
|
19683
|
+
/**
|
|
19684
|
+
* Inspect and execute a custom query without saving it
|
|
19685
|
+
*
|
|
19686
|
+
* This allows you to test queries before saving them to a connection.
|
|
19687
|
+
*
|
|
19688
|
+
* @param request - Query inspection request with connection name, query, and params
|
|
19689
|
+
* @returns Query execution results
|
|
19690
|
+
*
|
|
19691
|
+
* @example
|
|
19692
|
+
* ```typescript
|
|
19693
|
+
* const ratchet = new Ratchet();
|
|
19694
|
+
* const result = await ratchet.inspectQuery({
|
|
19695
|
+
* name: 'users_db.test_query',
|
|
19696
|
+
* query: {
|
|
19697
|
+
* id: 'test_query',
|
|
19698
|
+
* expression: 'SELECT * FROM users WHERE email = $1'
|
|
19699
|
+
* },
|
|
19700
|
+
* params: ['user@example.com']
|
|
19701
|
+
* });
|
|
19702
|
+
* ```
|
|
19703
|
+
*/
|
|
19704
|
+
async inspectQuery(request) {
|
|
19705
|
+
return await this.client.post("/v1/ratchet/query/inspect", request);
|
|
19706
|
+
}
|
|
19509
19707
|
}
|
|
19510
19708
|
|
|
19511
19709
|
class Sandbox extends PlatformBaseClient {
|
|
@@ -19965,6 +20163,23 @@ class DMS extends IntegrationsBaseClient {
|
|
|
19965
20163
|
async libraries() {
|
|
19966
20164
|
return await this.requestv1("GET", "media/library/list");
|
|
19967
20165
|
}
|
|
20166
|
+
/**
|
|
20167
|
+
* Upload files using multipart form data
|
|
20168
|
+
*
|
|
20169
|
+
* @param payload - Upload configuration with files, directory, and options
|
|
20170
|
+
* @returns Upload response from the server
|
|
20171
|
+
*
|
|
20172
|
+
* @example
|
|
20173
|
+
* ```typescript
|
|
20174
|
+
* const result = await dms.upload({
|
|
20175
|
+
* files: [file1, file2],
|
|
20176
|
+
* uploadDir: '/documents/invoices',
|
|
20177
|
+
* public: true,
|
|
20178
|
+
* replace: true,
|
|
20179
|
+
* metadata: { category: 'finance' }
|
|
20180
|
+
* });
|
|
20181
|
+
* ```
|
|
20182
|
+
*/
|
|
19968
20183
|
async upload(payload) {
|
|
19969
20184
|
let files = payload.files;
|
|
19970
20185
|
let formData = new FormData();
|
|
@@ -19978,13 +20193,15 @@ class DMS extends IntegrationsBaseClient {
|
|
|
19978
20193
|
});
|
|
19979
20194
|
if (count == files.length) {
|
|
19980
20195
|
formData.append('path', payload.uploadDir);
|
|
19981
|
-
formData.append('ref', payload.uuid);
|
|
19982
20196
|
if (payload.public) {
|
|
19983
20197
|
formData.append('is_public', "true");
|
|
19984
20198
|
}
|
|
20199
|
+
if (payload.replace) {
|
|
20200
|
+
formData.append('replace', "true");
|
|
20201
|
+
}
|
|
19985
20202
|
if (payload.expiresAt)
|
|
19986
20203
|
formData.append('expiresAt', new Date(payload.expiresAt).toISOString());
|
|
19987
|
-
if (Object.keys(payload.metadata).length > 0)
|
|
20204
|
+
if (payload.metadata && Object.keys(payload.metadata).length > 0)
|
|
19988
20205
|
formData.append('metadata', JSON.stringify(payload.metadata));
|
|
19989
20206
|
return await this.request("POST", "media/upload", {
|
|
19990
20207
|
data: formData,
|
|
@@ -19997,6 +20214,28 @@ class DMS extends IntegrationsBaseClient {
|
|
|
19997
20214
|
async delete(data) {
|
|
19998
20215
|
return this.request('POST', 'media/delete', data);
|
|
19999
20216
|
}
|
|
20217
|
+
/**
|
|
20218
|
+
* Upload files using base64-encoded content
|
|
20219
|
+
*
|
|
20220
|
+
* @param data - Upload payload with base64-encoded files
|
|
20221
|
+
* @returns Upload response from the server
|
|
20222
|
+
*
|
|
20223
|
+
* @example
|
|
20224
|
+
* ```typescript
|
|
20225
|
+
* const result = await dms.uploadBase64({
|
|
20226
|
+
* path: '/documents/reports',
|
|
20227
|
+
* is_public: false,
|
|
20228
|
+
* replace: true,
|
|
20229
|
+
* files: [
|
|
20230
|
+
* {
|
|
20231
|
+
* name: 'report.pdf',
|
|
20232
|
+
* content_type: 'application/pdf',
|
|
20233
|
+
* data: 'base64EncodedContent...'
|
|
20234
|
+
* }
|
|
20235
|
+
* ]
|
|
20236
|
+
* });
|
|
20237
|
+
* ```
|
|
20238
|
+
*/
|
|
20000
20239
|
async uploadBase64(data) {
|
|
20001
20240
|
return this.request('POST', `media/upload`, {
|
|
20002
20241
|
data,
|
|
@@ -20005,30 +20244,30 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20005
20244
|
}
|
|
20006
20245
|
});
|
|
20007
20246
|
}
|
|
20008
|
-
async getMedia(
|
|
20009
|
-
return this.request('GET', `media/
|
|
20247
|
+
async getMedia(key, encoding) {
|
|
20248
|
+
return this.request('GET', `media/get/${key}`, {
|
|
20010
20249
|
params: {
|
|
20011
20250
|
encoding
|
|
20012
20251
|
},
|
|
20013
20252
|
responseType: (!encoding) ? 'blob' : null
|
|
20014
20253
|
});
|
|
20015
20254
|
}
|
|
20016
|
-
async download(
|
|
20017
|
-
return this.request('POST', `media/
|
|
20255
|
+
async download(key) {
|
|
20256
|
+
return this.request('POST', `media/download`, {
|
|
20018
20257
|
data: {
|
|
20019
20258
|
key
|
|
20020
20259
|
},
|
|
20021
20260
|
responseType: 'blob'
|
|
20022
20261
|
});
|
|
20023
20262
|
}
|
|
20024
|
-
async getExifData(
|
|
20025
|
-
return this.request('GET', `media/
|
|
20263
|
+
async getExifData(key) {
|
|
20264
|
+
return this.request('GET', `media/exif/${key}`);
|
|
20026
20265
|
}
|
|
20027
|
-
async html2pdf(
|
|
20028
|
-
const { output_pdf = false, input_path, input_html, output_path, output_file_name, output_type, data: templateData } = data;
|
|
20266
|
+
async html2pdf(data) {
|
|
20267
|
+
const { output_pdf = false, input_path, input_html, output_path, output_file_name, output_type, data: templateData, replace, } = data;
|
|
20029
20268
|
const type = output_pdf ? 'arraybuffer' : 'json';
|
|
20030
20269
|
const contentType = output_pdf ? 'application/pdf' : 'application/json';
|
|
20031
|
-
return this.request('POST', `media/
|
|
20270
|
+
return this.request('POST', `media/pdf/html2pdf`, {
|
|
20032
20271
|
data: {
|
|
20033
20272
|
output_pdf,
|
|
20034
20273
|
input_path,
|
|
@@ -20036,7 +20275,27 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20036
20275
|
input_html,
|
|
20037
20276
|
output_file_name,
|
|
20038
20277
|
output_type,
|
|
20039
|
-
data: templateData
|
|
20278
|
+
data: templateData,
|
|
20279
|
+
replace,
|
|
20280
|
+
},
|
|
20281
|
+
headers: {
|
|
20282
|
+
'Content-Type': contentType
|
|
20283
|
+
},
|
|
20284
|
+
responseType: type
|
|
20285
|
+
});
|
|
20286
|
+
}
|
|
20287
|
+
async pdf2html(data) {
|
|
20288
|
+
const { output_html = false, input_path, input_pdf, output_path, output_file_name, replace, } = data;
|
|
20289
|
+
const type = output_html ? 'arraybuffer' : 'json';
|
|
20290
|
+
const contentType = output_html ? 'text/html' : 'application/json';
|
|
20291
|
+
return this.request('POST', `media/pdf/pdf2html`, {
|
|
20292
|
+
data: {
|
|
20293
|
+
output_html,
|
|
20294
|
+
input_path,
|
|
20295
|
+
output_path,
|
|
20296
|
+
input_pdf,
|
|
20297
|
+
output_file_name,
|
|
20298
|
+
replace,
|
|
20040
20299
|
},
|
|
20041
20300
|
headers: {
|
|
20042
20301
|
'Content-Type': contentType
|
|
@@ -20044,20 +20303,20 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20044
20303
|
responseType: type
|
|
20045
20304
|
});
|
|
20046
20305
|
}
|
|
20047
|
-
async createDir(
|
|
20048
|
-
return this.request('POST', `media/library
|
|
20306
|
+
async createDir(path) {
|
|
20307
|
+
return this.request('POST', `media/library/dir`, { data: { path } });
|
|
20049
20308
|
}
|
|
20050
|
-
async deleteDir(
|
|
20051
|
-
return this.request('
|
|
20309
|
+
async deleteDir(path) {
|
|
20310
|
+
return this.request('DELETE', `media/library/dir`, { data: { path } });
|
|
20052
20311
|
}
|
|
20053
|
-
async dirs(
|
|
20054
|
-
return await this.request("POST", `media/library
|
|
20312
|
+
async dirs(data) {
|
|
20313
|
+
return await this.request("POST", `media/library/dirs`, { data });
|
|
20055
20314
|
}
|
|
20056
|
-
async fillPdf(
|
|
20057
|
-
const { input_path, output_path, output_pdf = false, output_type, output_file_name, form_data, forms } = data;
|
|
20315
|
+
async fillPdf(data) {
|
|
20316
|
+
const { input_path, output_path, output_pdf = false, output_type, output_file_name, replace, form_data, forms } = data;
|
|
20058
20317
|
const responseType = output_pdf ? 'arraybuffer' : 'json';
|
|
20059
20318
|
const contentType = output_pdf ? 'application/pdf' : 'application/json';
|
|
20060
|
-
return this.request('POST', `media/
|
|
20319
|
+
return this.request('POST', `media/pdf/fill`, {
|
|
20061
20320
|
data: {
|
|
20062
20321
|
input_path,
|
|
20063
20322
|
output_path,
|
|
@@ -20065,6 +20324,7 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20065
20324
|
output_type,
|
|
20066
20325
|
output_file_name,
|
|
20067
20326
|
form_data,
|
|
20327
|
+
replace,
|
|
20068
20328
|
forms
|
|
20069
20329
|
},
|
|
20070
20330
|
headers: {
|
|
@@ -20142,7 +20402,7 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20142
20402
|
* // excelResult.data is a Blob
|
|
20143
20403
|
* ```
|
|
20144
20404
|
*/
|
|
20145
|
-
async convertData(
|
|
20405
|
+
async convertData(data, params) {
|
|
20146
20406
|
const { from, to, sheet_name, include_header, include_footer, header_as_comment, footer_as_comment, separator_rows, field_order, } = params;
|
|
20147
20407
|
const queryParams = { from, to };
|
|
20148
20408
|
// Add optional parameters if provided
|
|
@@ -20169,7 +20429,7 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20169
20429
|
else if (to === 'excel' || to === 'xlsx') {
|
|
20170
20430
|
responseType = 'blob';
|
|
20171
20431
|
}
|
|
20172
|
-
return this.request('POST', `media/
|
|
20432
|
+
return this.request('POST', `media/convert/data`, {
|
|
20173
20433
|
data,
|
|
20174
20434
|
params: queryParams,
|
|
20175
20435
|
responseType,
|
|
@@ -20209,9 +20469,9 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20209
20469
|
* // }
|
|
20210
20470
|
* ```
|
|
20211
20471
|
*/
|
|
20212
|
-
async getDataInfo(
|
|
20472
|
+
async getDataInfo(data, params) {
|
|
20213
20473
|
const { format } = params;
|
|
20214
|
-
return this.request('POST', `media/
|
|
20474
|
+
return this.request('POST', `media/convert/info`, {
|
|
20215
20475
|
data,
|
|
20216
20476
|
params: { format },
|
|
20217
20477
|
headers: {
|
|
@@ -20253,9 +20513,9 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20253
20513
|
* }
|
|
20254
20514
|
* ```
|
|
20255
20515
|
*/
|
|
20256
|
-
async validateData(
|
|
20516
|
+
async validateData(data, params) {
|
|
20257
20517
|
const { format } = params;
|
|
20258
|
-
return this.request('POST', `media/
|
|
20518
|
+
return this.request('POST', `media/convert/validate`, {
|
|
20259
20519
|
data,
|
|
20260
20520
|
params: { format },
|
|
20261
20521
|
headers: {
|
|
@@ -20301,12 +20561,12 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20301
20561
|
* // Auto-detects header, items, and footer sections
|
|
20302
20562
|
* ```
|
|
20303
20563
|
*/
|
|
20304
|
-
async jsonToCsv(
|
|
20564
|
+
async jsonToCsv(jsonData, options) {
|
|
20305
20565
|
let params = {};
|
|
20306
20566
|
if (options === null || options === void 0 ? void 0 : options.field_order) {
|
|
20307
20567
|
params.field_order = options.field_order.join(',');
|
|
20308
20568
|
}
|
|
20309
|
-
return this.request('POST', `media/
|
|
20569
|
+
return this.request('POST', `media/convert/json-to-csv`, {
|
|
20310
20570
|
params,
|
|
20311
20571
|
data: jsonData,
|
|
20312
20572
|
responseType: 'text',
|
|
@@ -20360,7 +20620,7 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20360
20620
|
* link.click();
|
|
20361
20621
|
* ```
|
|
20362
20622
|
*/
|
|
20363
|
-
async jsonToExcel(
|
|
20623
|
+
async jsonToExcel(jsonData, options) {
|
|
20364
20624
|
const params = {};
|
|
20365
20625
|
if (options === null || options === void 0 ? void 0 : options.sheet_name) {
|
|
20366
20626
|
params.sheet_name = options.sheet_name;
|
|
@@ -20368,7 +20628,7 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20368
20628
|
if (options === null || options === void 0 ? void 0 : options.field_order) {
|
|
20369
20629
|
params.field_order = options.field_order.join(',');
|
|
20370
20630
|
}
|
|
20371
|
-
return this.request('POST', `media/
|
|
20631
|
+
return this.request('POST', `media/convert/json-to-excel`, {
|
|
20372
20632
|
data: jsonData,
|
|
20373
20633
|
params,
|
|
20374
20634
|
responseType: 'blob',
|
|
@@ -20399,8 +20659,8 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20399
20659
|
* // ]
|
|
20400
20660
|
* ```
|
|
20401
20661
|
*/
|
|
20402
|
-
async csvToJson(
|
|
20403
|
-
return this.request('POST', `media/
|
|
20662
|
+
async csvToJson(csvData) {
|
|
20663
|
+
return this.request('POST', `media/convert/csv-to-json`, {
|
|
20404
20664
|
data: csvData,
|
|
20405
20665
|
responseType: 'json',
|
|
20406
20666
|
headers: {
|
|
@@ -20432,12 +20692,12 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20432
20692
|
* // Use url for download or further processing
|
|
20433
20693
|
* ```
|
|
20434
20694
|
*/
|
|
20435
|
-
async csvToExcel(
|
|
20695
|
+
async csvToExcel(csvData, options) {
|
|
20436
20696
|
const params = {};
|
|
20437
20697
|
if (options === null || options === void 0 ? void 0 : options.sheet_name) {
|
|
20438
20698
|
params.sheet_name = options.sheet_name;
|
|
20439
20699
|
}
|
|
20440
|
-
return this.request('POST', `media/
|
|
20700
|
+
return this.request('POST', `media/convert/csv-to-excel`, {
|
|
20441
20701
|
data: csvData,
|
|
20442
20702
|
params,
|
|
20443
20703
|
responseType: 'blob',
|
|
@@ -20472,12 +20732,12 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20472
20732
|
* const jsonFromBuffer = await dms.excelToJson(libraryRef, arrayBuffer);
|
|
20473
20733
|
* ```
|
|
20474
20734
|
*/
|
|
20475
|
-
async excelToJson(
|
|
20735
|
+
async excelToJson(excelData, options) {
|
|
20476
20736
|
const params = {};
|
|
20477
20737
|
if (options === null || options === void 0 ? void 0 : options.sheet_name) {
|
|
20478
20738
|
params.sheet_name = options.sheet_name;
|
|
20479
20739
|
}
|
|
20480
|
-
return this.request('POST', `media/
|
|
20740
|
+
return this.request('POST', `media/convert/excel-to-json`, {
|
|
20481
20741
|
data: excelData,
|
|
20482
20742
|
params,
|
|
20483
20743
|
responseType: 'json',
|
|
@@ -20516,12 +20776,12 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20516
20776
|
* link.click();
|
|
20517
20777
|
* ```
|
|
20518
20778
|
*/
|
|
20519
|
-
async excelToCsv(
|
|
20779
|
+
async excelToCsv(excelData, options) {
|
|
20520
20780
|
const params = {};
|
|
20521
20781
|
if (options === null || options === void 0 ? void 0 : options.sheet_name) {
|
|
20522
20782
|
params.sheet_name = options.sheet_name;
|
|
20523
20783
|
}
|
|
20524
|
-
return this.request('POST', `media/
|
|
20784
|
+
return this.request('POST', `media/convert/excel-to-csv`, {
|
|
20525
20785
|
data: excelData,
|
|
20526
20786
|
params,
|
|
20527
20787
|
responseType: 'text',
|
|
@@ -20533,7 +20793,7 @@ class DMS extends IntegrationsBaseClient {
|
|
|
20533
20793
|
async request(method, endpoint, params) {
|
|
20534
20794
|
return await this.client.request({
|
|
20535
20795
|
method: method,
|
|
20536
|
-
url: `/
|
|
20796
|
+
url: `/v3/dms/${endpoint}`,
|
|
20537
20797
|
...params
|
|
20538
20798
|
});
|
|
20539
20799
|
}
|