totalum-api-sdk 3.0.2 → 3.0.3

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
@@ -1,4 +1,4 @@
1
- ## Totalum API SDK (v3.0.1)
1
+ ## Totalum API SDK (v3.0.2)
2
2
 
3
3
  Official TypeScript/JavaScript SDK for the Totalum API. This library provides a fully typed, modern interface to interact with all Totalum endpoints.
4
4
 
@@ -48,7 +48,7 @@ await totalumClient.crud.getManyToManyReferencesRecords(table, id, prop, query);
48
48
  ```javascript
49
49
  // v2.x (using axios)
50
50
  const result = await totalumClient.crud.getItems(table, {});
51
- const items = result.data.data; // Double .data because of axios wrapper
51
+ const items = result.data; // Double .data because of axios wrapper
52
52
 
53
53
  // v3.0 (using fetch)
54
54
  const result = await totalumClient.crud.getRecords(table, {});
@@ -64,7 +64,7 @@ const records = result.data; // Direct access to data
64
64
  // v2.x (axios throws errors)
65
65
  try {
66
66
  const result = await totalumClient.crud.getItems(table, {});
67
- const items = result.data.data;
67
+ const items = result.data;
68
68
  } catch (error) {
69
69
  console.error('Error:', error.message);
70
70
  }
@@ -178,7 +178,7 @@ const result = await totalumClient.crud.getRecords('your_table_name', {});
178
178
 
179
179
  ```html
180
180
  <head>
181
- <script src="https://cdn.jsdelivr.net/npm/totalum-api-sdk@3.0.1/dist/totalum-sdk.min.js"></script>
181
+ <script src="https://cdn.jsdelivr.net/npm/totalum-api-sdk@3.0.2/dist/totalum-sdk.min.js"></script>
182
182
  </head>
183
183
  <script>
184
184
  //Example of use TotalumSdk in your custom html page
@@ -414,7 +414,7 @@ const tableNameToGet = 'client';
414
414
 
415
415
  const result = await totalumClient.filter.nestedFilter(nestedFilter, tableNameToGet, filterOptions);
416
416
 
417
- const clients = result.data.data;
417
+ const clients = result.data;
418
418
 
419
419
  ```
420
420
 
@@ -461,7 +461,7 @@ const tableNameToGet = 'product';
461
461
 
462
462
  const result = await totalumClient.filter.nestedFilter(nestedFilter, tableNameToGet, filterOptions);
463
463
 
464
- const products = result.data.data;
464
+ const products = result.data;
465
465
 
466
466
  ```
467
467
 
@@ -911,7 +911,7 @@ Depending on the platform you are using, you will need to transform the file to
911
911
  'api-key': 'your api key here', // replace 'your api key here' with your api key
912
912
  }
913
913
  });
914
- const fileNameId = result.data.data;
914
+ const fileNameId = result.data;
915
915
  ```
916
916
 
917
917
 
@@ -1082,7 +1082,7 @@ if (result.errors) {
1082
1082
  return;
1083
1083
  }
1084
1084
 
1085
- const invoiceData = result.data.data;
1085
+ const invoiceData = result.data;
1086
1086
  const metadata = result.data.metadata;
1087
1087
 
1088
1088
  console.log('Invoice data:', invoiceData);
@@ -1136,7 +1136,7 @@ if (result.errors) {
1136
1136
  return;
1137
1137
  }
1138
1138
 
1139
- const documentData = result.data.data;
1139
+ const documentData = result.data;
1140
1140
  const metadata = result.data.metadata;
1141
1141
 
1142
1142
  console.log('Extracted data:', documentData);
@@ -10,6 +10,7 @@ export interface ErrorResult {
10
10
  export interface TotalumApiResponse<T> {
11
11
  data?: T;
12
12
  errors?: ErrorResult | null;
13
+ metadata?: any;
13
14
  }
14
15
  export interface StructureLevels {
15
16
  id: string;
@@ -17,12 +17,6 @@ export interface DeleteObjectResponse {
17
17
  /** The number of documents that were deleted */
18
18
  deletedCount: number;
19
19
  }
20
- export interface GetObjectsResponse<T = DataValues> {
21
- data: T[];
22
- metadata?: {
23
- count?: number;
24
- };
25
- }
26
20
  export interface FileUploadResponse {
27
21
  fileName: string;
28
22
  }
@@ -74,23 +68,6 @@ export interface ScanInvoiceData {
74
68
  [key: string]: any;
75
69
  };
76
70
  }
77
- export interface ScanInvoiceResponse {
78
- data: ScanInvoiceData;
79
- metadata: {
80
- ocrFullResult?: any;
81
- usageUnits: number;
82
- exactUsageUnits: number;
83
- };
84
- }
85
- export interface ScanDocumentResponse {
86
- data: any;
87
- metadata: {
88
- ocrFullResult?: any;
89
- ocrFullResultText?: string;
90
- usageUnits: number;
91
- exactUsageUnits: number;
92
- };
93
- }
94
71
  export interface PdfGenerationResponse {
95
72
  fileName: string;
96
73
  }
@@ -143,12 +120,6 @@ export interface LookupFilterResult {
143
120
  result: DataValues[] | number;
144
121
  count?: number;
145
122
  }
146
- export interface NestedFilterResponse {
147
- data: DataValues[];
148
- metadata?: {
149
- count?: number;
150
- };
151
- }
152
123
  export type CustomAggregationResponse = any;
153
124
  export interface NotificationVisibility {
154
125
  sendTo: "all" | "admins" | "specificUsers";
@@ -1,5 +1,5 @@
1
1
  import { TotalumApiResponse } from "../common/interfaces";
2
- import { FileDeleteResponse, OcrImageResponse, OcrPdfResponse, ScanInvoiceResponse, ScanDocumentResponse } from "../common/response-types";
2
+ import { FileDeleteResponse, OcrImageResponse, OcrPdfResponse, ScanInvoiceData } from "../common/response-types";
3
3
  import { FetchClient } from "../common/fetch-client";
4
4
  export declare class FilesService {
5
5
  private client;
@@ -71,9 +71,9 @@ export declare class FilesService {
71
71
  * The response includes both data and metadata with OCR details and usage tracking.
72
72
  * @param {string} fileName - The file name of the uploaded invoice
73
73
  * @param {any} options - Optional scanning options
74
- * @returns {Promise<TotalumApiResponse<ScanInvoiceResponse>>}
74
+ * @returns {Promise<TotalumApiResponse<ScanInvoiceData>>}
75
75
  */
76
- scanInvoice(fileName: string, options?: any): Promise<TotalumApiResponse<ScanInvoiceResponse>>;
76
+ scanInvoice(fileName: string, options?: any): Promise<TotalumApiResponse<ScanInvoiceData>>;
77
77
  /**
78
78
  * Scans a document and extracts specified properties.
79
79
  * The response includes both data (based on provided schema) and metadata with OCR details.
@@ -82,5 +82,5 @@ export declare class FilesService {
82
82
  * @param {any} options - Optional scanning options
83
83
  * @returns {Promise<TotalumApiResponse<ScanDocumentResponse>>}
84
84
  */
85
- scanDocument(fileName: string, properties: any, options?: any): Promise<TotalumApiResponse<ScanDocumentResponse>>;
85
+ scanDocument(fileName: string, properties: any, options?: any): Promise<TotalumApiResponse<any>>;
86
86
  }
@@ -118,7 +118,7 @@ class FilesService {
118
118
  * The response includes both data and metadata with OCR details and usage tracking.
119
119
  * @param {string} fileName - The file name of the uploaded invoice
120
120
  * @param {any} options - Optional scanning options
121
- * @returns {Promise<TotalumApiResponse<ScanInvoiceResponse>>}
121
+ * @returns {Promise<TotalumApiResponse<ScanInvoiceData>>}
122
122
  */
123
123
  scanInvoice(fileName, options) {
124
124
  return __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totalum-api-sdk",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Totalum sdk wrapper and utils of totalum api",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",