totalum-api-sdk 3.0.7 → 3.0.8

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.
@@ -24,6 +24,7 @@ export declare const endpoints: {
24
24
  ocrOfPdf: string;
25
25
  scanInvoice: string;
26
26
  scanDocument: string;
27
+ transcribeAudio: string;
27
28
  };
28
29
  filter: {
29
30
  lookUpFilter: string;
@@ -46,6 +47,9 @@ export declare const endpoints: {
46
47
  generateImage: string;
47
48
  editImage: string;
48
49
  };
50
+ gemini: {
51
+ analyzeVideo: string;
52
+ };
49
53
  notifications: {
50
54
  createNotification: string;
51
55
  };
@@ -27,7 +27,8 @@ exports.endpoints = {
27
27
  ocrOfImage: 'api/v1/files/ocr/image',
28
28
  ocrOfPdf: 'api/v1/files/ocr/pdf',
29
29
  scanInvoice: 'api/v1/files/scan-invoice',
30
- scanDocument: 'api/v1/files/scan-document'
30
+ scanDocument: 'api/v1/files/scan-document',
31
+ transcribeAudio: 'api/v1/files/transcribe-audio-pro'
31
32
  },
32
33
  filter: {
33
34
  lookUpFilter: 'api/v1/filter/:idPage',
@@ -50,6 +51,9 @@ exports.endpoints = {
50
51
  generateImage: 'api/v1/openai/image',
51
52
  editImage: 'api/v1/openai/image-edit',
52
53
  },
54
+ gemini: {
55
+ analyzeVideo: 'api/v1/gemini/analyze-video',
56
+ },
53
57
  notifications: {
54
58
  createNotification: 'api/v1/notifications',
55
59
  },
@@ -71,6 +71,9 @@ export interface ScanInvoiceData {
71
71
  export interface PdfGenerationResponse {
72
72
  fileName: string;
73
73
  }
74
+ export interface TranscribeAudioResponse {
75
+ text: string;
76
+ }
74
77
  export interface EmailSendResponse {
75
78
  success: true;
76
79
  message: string;
@@ -117,6 +120,32 @@ export interface ImageGenerationResponse {
117
120
  fileName: string;
118
121
  imageUrl: string;
119
122
  }
123
+ export interface GeminiContentPart {
124
+ text?: string;
125
+ functionCall?: {
126
+ name: string;
127
+ args: any;
128
+ };
129
+ }
130
+ export interface GeminiCandidate {
131
+ content: {
132
+ role: string;
133
+ parts: GeminiContentPart[];
134
+ };
135
+ finishReason?: string;
136
+ safetyRatings?: any[];
137
+ }
138
+ export interface GeminiPromptFeedback {
139
+ safetyRatings?: any[];
140
+ blockReason?: string;
141
+ }
142
+ export interface GeminiAnalyzeVideoResponse {
143
+ model: string;
144
+ response: {
145
+ candidates: GeminiCandidate[];
146
+ promptFeedback?: GeminiPromptFeedback;
147
+ };
148
+ }
120
149
  export interface LookupFilterResult {
121
150
  result: DataValues[] | number;
122
151
  count?: number;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AuthOptions } from './common/interfaces';
2
2
  import { OpenaiService } from './services/OpenaiService';
3
+ import { GeminiService } from './services/GeminiService';
3
4
  import { FilterService } from './services/FilterService';
4
5
  import { FilesService } from './services/FilesService';
5
6
  import { CrudService } from './services/CrudService';
@@ -18,6 +19,7 @@ export declare class TotalumApiSdk {
18
19
  private _headers;
19
20
  private client;
20
21
  openai: OpenaiService;
22
+ gemini: GeminiService;
21
23
  files: FilesService;
22
24
  filter: FilterService;
23
25
  crud: CrudService;
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.TotalumApiSdk = exports.TotalumError = void 0;
18
18
  const fetch_client_1 = require("./common/fetch-client");
19
19
  const OpenaiService_1 = require("./services/OpenaiService");
20
+ const GeminiService_1 = require("./services/GeminiService");
20
21
  const FilterService_1 = require("./services/FilterService");
21
22
  const FilesService_1 = require("./services/FilesService");
22
23
  const CrudService_1 = require("./services/CrudService");
@@ -65,6 +66,7 @@ class TotalumApiSdk {
65
66
  // Initialize all services with the fetch client
66
67
  this.crud = new CrudService_1.CrudService(this.client);
67
68
  this.openai = new OpenaiService_1.OpenaiService(this.client);
69
+ this.gemini = new GeminiService_1.GeminiService(this.client);
68
70
  this.files = new FilesService_1.FilesService(this.client);
69
71
  this.filter = new FilterService_1.FilterService(this.client);
70
72
  this.notification = new NotificationService_1.NotificationService(this.client);
@@ -1,5 +1,5 @@
1
1
  import { TotalumApiResponse } from "../common/interfaces";
2
- import { FileDeleteResponse, OcrImageResponse, OcrPdfResponse, ScanInvoiceData } from "../common/response-types";
2
+ import { FileDeleteResponse, OcrImageResponse, OcrPdfResponse, ScanInvoiceData, TranscribeAudioResponse } from "../common/response-types";
3
3
  import { FetchClient } from "../common/fetch-client";
4
4
  export declare class FilesService {
5
5
  private client;
@@ -83,4 +83,21 @@ export declare class FilesService {
83
83
  * @returns {Promise<TotalumApiResponse<ScanDocumentResponse>>}
84
84
  */
85
85
  scanDocument(fileName: string, properties: any, options?: any): Promise<TotalumApiResponse<any>>;
86
+ /**
87
+ * Transcribes audio to text using OpenAI Whisper.
88
+ * Counts against the audioTranscriptions plan limit and falls back to credits when exceeded
89
+ * (1 credit per transcription).
90
+ *
91
+ * Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm, ogg, opus, flac.
92
+ * Max file size: 5MB.
93
+ *
94
+ * @param {object} body - Transcription parameters
95
+ * @param {string} body.audioBase64 - Audio file content encoded in base64 (no data: prefix)
96
+ * @param {string} body.filename - Original filename including extension (e.g. "recording.mp3"); used to detect format
97
+ * @returns {Promise<TotalumApiResponse<TranscribeAudioResponse>>} - { text: string } with the transcribed audio
98
+ */
99
+ transcribeAudio(body: {
100
+ audioBase64: string;
101
+ filename: string;
102
+ }): Promise<TotalumApiResponse<TranscribeAudioResponse>>;
86
103
  }
@@ -140,5 +140,24 @@ class FilesService {
140
140
  return this.client.post(url, { fileName, properties, options });
141
141
  });
142
142
  }
143
+ /**
144
+ * Transcribes audio to text using OpenAI Whisper.
145
+ * Counts against the audioTranscriptions plan limit and falls back to credits when exceeded
146
+ * (1 credit per transcription).
147
+ *
148
+ * Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm, ogg, opus, flac.
149
+ * Max file size: 5MB.
150
+ *
151
+ * @param {object} body - Transcription parameters
152
+ * @param {string} body.audioBase64 - Audio file content encoded in base64 (no data: prefix)
153
+ * @param {string} body.filename - Original filename including extension (e.g. "recording.mp3"); used to detect format
154
+ * @returns {Promise<TotalumApiResponse<TranscribeAudioResponse>>} - { text: string } with the transcribed audio
155
+ */
156
+ transcribeAudio(body) {
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ const url = utils_1.UtilsService.getUrl('', endpoints_1.endpoints.files.transcribeAudio);
159
+ return this.client.post(url, body);
160
+ });
161
+ }
143
162
  }
144
163
  exports.FilesService = FilesService;
@@ -0,0 +1,25 @@
1
+ import { TotalumApiResponse } from "../common/interfaces";
2
+ import { GeminiAnalyzeVideoResponse } from "../common/response-types";
3
+ import { FetchClient } from "../common/fetch-client";
4
+ export declare class GeminiService {
5
+ private client;
6
+ constructor(client: FetchClient);
7
+ /**
8
+ * Analyzes a video using Google Gemini and returns the model's response.
9
+ * Default model: gemini-3-flash-preview (with automatic fallback to gemini-2.5-flash on failure).
10
+ * Set highQuality=true to use gemini-3.1-pro-preview for harder reasoning tasks (~4x cost).
11
+ *
12
+ * @param {object} body - The video analysis parameters
13
+ * @param {string} body.videoUrl - Public or signed URL of the video to analyze. Max 100 MB.
14
+ * @param {string} body.prompt - Free-form instruction for Gemini (e.g. "Summarize this video", "What products appear?")
15
+ * @param {boolean} [body.highQuality] - Use gemini-3.1-pro-preview instead of flash. Default: false.
16
+ * @param {string} [body.mimeType] - MIME type hint (e.g. "video/mp4"). Auto-detected if omitted.
17
+ * @returns {Promise<TotalumApiResponse<GeminiAnalyzeVideoResponse>>} - The Gemini response with the model used and candidates
18
+ */
19
+ analyzeVideo(body: {
20
+ videoUrl: string;
21
+ prompt: string;
22
+ highQuality?: boolean;
23
+ mimeType?: string;
24
+ }): Promise<TotalumApiResponse<GeminiAnalyzeVideoResponse>>;
25
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GeminiService = void 0;
13
+ const utils_1 = require("../utils");
14
+ const endpoints_1 = require("../common/endpoints");
15
+ class GeminiService {
16
+ constructor(client) {
17
+ this.client = client;
18
+ }
19
+ /**
20
+ * Analyzes a video using Google Gemini and returns the model's response.
21
+ * Default model: gemini-3-flash-preview (with automatic fallback to gemini-2.5-flash on failure).
22
+ * Set highQuality=true to use gemini-3.1-pro-preview for harder reasoning tasks (~4x cost).
23
+ *
24
+ * @param {object} body - The video analysis parameters
25
+ * @param {string} body.videoUrl - Public or signed URL of the video to analyze. Max 100 MB.
26
+ * @param {string} body.prompt - Free-form instruction for Gemini (e.g. "Summarize this video", "What products appear?")
27
+ * @param {boolean} [body.highQuality] - Use gemini-3.1-pro-preview instead of flash. Default: false.
28
+ * @param {string} [body.mimeType] - MIME type hint (e.g. "video/mp4"). Auto-detected if omitted.
29
+ * @returns {Promise<TotalumApiResponse<GeminiAnalyzeVideoResponse>>} - The Gemini response with the model used and candidates
30
+ */
31
+ analyzeVideo(body) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ const url = utils_1.UtilsService.getUrl('', endpoints_1.endpoints.gemini.analyzeVideo);
34
+ return this.client.post(url, body);
35
+ });
36
+ }
37
+ }
38
+ exports.GeminiService = GeminiService;
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.totalumSdk=t():e.totalumSdk=t()}(this,(()=>(()=>{"use strict";var e={429:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.endpoints=void 0,t.endpoints={crud:{getObjectById:"api/v1/crud/:typeId/:id",getObjects:"api/v1/crud/query/:typeId",getNestedData:"api/v1/crud/nested",query:"api/v1/crud/advanced-query",createObject:"api/v1/crud/:typeId",editObjectProperties:"api/v1/crud/:typeId/:id",deleteObject:"api/v1/crud/:typeId/:id",deleteObjectAndSubElements:"api/v1/crud/:typeId/:id/:pageId/subelements",updateLastUsersActions:"api/v1/crud/:typeId/:id/lastUsersActions",addManyToManyReference:"api/v1/crud/:typeId/:id/add-many-to-many-reference",dropManyToManyReference:"api/v1/crud/:typeId/:id/drop-many-to-many-reference",getManyToManyReferencesItems:"api/v1/crud/:typeId/:id/:propertyName"},updatesRecord:{getUpdateRecordByObjectId:"api/v1/updates-record/:objectId"},files:{uploadFile:"api/v1/files/upload",getDownloadUrl:"api/v1/files/download/:fileName",deleteFile:"api/v1/files/:fileName",ocrOfImage:"api/v1/files/ocr/image",ocrOfPdf:"api/v1/files/ocr/pdf",scanInvoice:"api/v1/files/scan-invoice",scanDocument:"api/v1/files/scan-document"},filter:{lookUpFilter:"api/v1/filter/:idPage",nestedFilter:"api/v1/filter/nested-filter",runCustomAggregationQuery:"api/v1/filter/custom-mongo-aggregation-query"},pdfTemplate:{generatePdfByTemplate:"api/v1/pdf-template/generatePdfByTemplate/:id",createPdfFromHtml:"api/v1/pdf-template/createPdfFromHtml"},googleIntegration:{getEmails:"api/v1/google-integration/get-emails",sendEmail:"api/v1/google-integration/send-email",getCalendarEvents:"api/v1/google-integration/get-calendar-events",createCalendarEvent:"api/v1/google-integration/create-calendar-event"},openai:{createCompletion:"api/v1/openai/completion",createChatCompletion:"api/v1/openai/chat-completion",generateImage:"api/v1/openai/image",editImage:"api/v1/openai/image-edit"},notifications:{createNotification:"api/v1/notifications"},statistics:{getStatistic:"api/v1/statistics/get-statistic"},email:{sendEmail:"api/v1/startum/send-email-with-default-domain"},webScraper:{scrape:"api/v1/web-scraper/scrape",extract:"api/v1/web-scraper/extract",screenshot:"api/v1/web-scraper/screenshot",searchAndExtract:"api/v1/web-scraper/search-and-extract"}}},731:function(e,t){var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.FetchClient=t.TotalumError=void 0;class n extends Error{constructor(e){super(e.errorMessage),this.errorCode=e.errorCode,this.errorMessage=e.errorMessage,this.hasManyErrors=e.hasManyErrors||!1,this.multipleErrors=e.multipleErrors||[],this.name="TotalumError",Object.setPrototypeOf(this,n.prototype)}toJSON(){return{errorCode:this.errorCode,errorMessage:this.errorMessage,hasManyErrors:this.hasManyErrors,multipleErrors:this.multipleErrors}}}t.TotalumError=n,t.FetchClient=class{constructor(e,t){this.baseUrl=e,this.headers=t}handleResponse(e){return i(this,void 0,void 0,(function*(){let t;try{t=yield e.json()}catch(t){return{errors:{errorCode:"RESPONSE_PARSE_ERROR",errorMessage:`Failed to parse response: ${e.statusText}`},data:null}}return t}))}request(e,t){return i(this,void 0,void 0,(function*(){const i=this.baseUrl+e;try{const e=yield fetch(i,Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},this.headers),null==t?void 0:t.headers)}));return this.handleResponse(e)}catch(e){return{errors:{errorCode:"NETWORK_ERROR",errorMessage:e instanceof Error?e.message:"Network request failed"},data:null}}}))}get(e,t){return i(this,void 0,void 0,(function*(){let i=e;if(t){const e=new URLSearchParams(Object.entries(t).reduce(((e,[t,i])=>(null!=i&&(e[t]=String(i)),e)),{})).toString();e&&(i+="?"+e)}return this.request(i,{method:"GET"})}))}post(e,t){return i(this,void 0,void 0,(function*(){const i=t instanceof FormData;return this.request(e,{method:"POST",headers:i?{}:{"Content-Type":"application/json"},body:i?t:JSON.stringify(t)})}))}patch(e,t){return i(this,void 0,void 0,(function*(){return this.request(e,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}))}delete(e){return i(this,void 0,void 0,(function*(){return this.request(e,{method:"DELETE"})}))}put(e,t){return i(this,void 0,void 0,(function*(){return this.request(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}))}}},999:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},879:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},492:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.TotalumApiSdk=t.TotalumError=void 0;const o=i(731),s=i(730),c=i(675),a=i(589),d=i(882),l=i(386),u=i(706),p=i(279),h=i(183);r(i(999),t),r(i(879),t);var v=i(731);Object.defineProperty(t,"TotalumError",{enumerable:!0,get:function(){return v.TotalumError}}),t.TotalumApiSdk=class{constructor(e){var t,i;if(this._baseUrl="https://api.totalum.app/",this.authOptions=e,this._headers={},null===(t=this.authOptions.token)||void 0===t?void 0:t.accessToken)this._headers.authorization=this.authOptions.token.accessToken;else{if(!(null===(i=this.authOptions.apiKey)||void 0===i?void 0:i["api-key"]))throw new Error("Error: invalid auth options");this._headers["api-key"]=this.authOptions.apiKey["api-key"]}this.authOptions.baseUrl&&(this._baseUrl=this.authOptions.baseUrl),this.authOptions.fromEvent&&(this._headers.fromEvent="true"),this.setRequestData()}changeBaseUrl(e){this._baseUrl=e,this.setRequestData()}setRequestData(){this.client=new o.FetchClient(this._baseUrl,this._headers),this.crud=new d.CrudService(this.client),this.openai=new s.OpenaiService(this.client),this.files=new a.FilesService(this.client),this.filter=new c.FilterService(this.client),this.notification=new l.NotificationService(this.client),this.statistic=new u.StatisticService(this.client),this.email=new p.EmailService(this.client),this.scrapping=new h.ScrappingService(this.client)}}},882:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CrudService=void 0;const r=i(591),o=i(429);t.CrudService=class{constructor(e){this.client=e}getRecordById(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.getObjectById,{typeId:e,id:t});return this.client.get(i)}))}getHistoricRecordUpdatesById(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.updatesRecord.getUpdateRecordByObjectId,{objectId:e});return this.client.get(t)}))}getRecords(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.getObjects,{typeId:e});return this.client.post(i,t)}))}getNestedData(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.getNestedData);return this.client.post(i,{nestedQuery:e,options:t})}))}query(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.query),n=t?this.encodeSortKeys(t):{};return this.client.post(i,{tableName:e,queryOptions:n})}))}encodeSortKeys(e){if(!e||"object"!=typeof e)return e;const t={};for(const i of Object.keys(e))if("_sort"===i&&"object"==typeof e[i]){const n={};for(const t of Object.keys(e[i]))n[t.replace(/\./g,"@")]=e[i][t];t[i]=n}else"object"!=typeof e[i]||null===e[i]||Array.isArray(e[i])?t[i]=e[i]:t[i]=this.encodeSortKeys(e[i]);return t}deleteRecordById(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.deleteObject,{typeId:e,id:t});return this.client.delete(i)}))}editRecordById(e,t,i){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.crud.editObjectProperties,{typeId:e,id:t});return this.client.request(n,{method:"PATCH",headers:{"Content-Type":"application/json",returnoption:"fullrecord"},body:JSON.stringify(i)})}))}createRecord(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.createObject,{typeId:e});return this.client.request(i,{method:"POST",headers:{"Content-Type":"application/json",returnoption:"fullrecord"},body:JSON.stringify(t)})}))}addManyToManyReferenceRecord(e,t,i,s){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.crud.addManyToManyReference,{typeId:e,id:t});return this.client.patch(n,{propertyId:i,referenceId:s})}))}dropManyToManyReferenceRecord(e,t,i,s){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.crud.dropManyToManyReference,{typeId:e,id:t});return this.client.patch(n,{propertyId:i,referenceId:s})}))}getManyToManyReferencesRecords(e,t,i,s){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.crud.getManyToManyReferencesItems,{typeId:e,id:t,propertyName:i});return this.client.get(n,s)}))}}},279:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailService=void 0;const r=i(429),o=i(591);t.EmailService=class{constructor(e){this.client=e}sendEmail(e){return n(this,void 0,void 0,(function*(){if(e.attachments&&e.attachments.length>10)return{errors:{errorCode:"TOO_MANY_ATTACHMENTS",errorMessage:`Maximum number of attachments is 10. Received ${e.attachments.length}.`},data:null};if(e.attachments)for(const t of e.attachments){if(!t.url||"string"!=typeof t.url)return{errors:{errorCode:"INVALID_ATTACHMENT_URL",errorMessage:`Attachment ${t.filename} must have a valid URL`},data:null};if(!t.url.startsWith("http://")&&!t.url.startsWith("https://"))return{errors:{errorCode:"INVALID_ATTACHMENT_URL",errorMessage:`Attachment ${t.filename} must have a valid HTTP/HTTPS URL`},data:null}}return this.sendEmailWithDefaultDomain(e)}))}sendEmailWithDefaultDomain(e){return n(this,void 0,void 0,(function*(){const t=o.UtilsService.getUrl("",r.endpoints.email.sendEmail,{});return this.client.post(t,e)}))}}},589:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.FilesService=void 0;const r=i(591),o=i(429);t.FilesService=class{constructor(e){this.client=e}uploadFile(e,t){return n(this,void 0,void 0,(function*(){let i=r.UtilsService.getUrl("",o.endpoints.files.uploadFile);return(null==t?void 0:t.compressFile)&&(i+="?compressFile=true"),this.client.post(i,e)}))}deleteFile(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.files.deleteFile,{fileName:e});return this.client.delete(t)}))}getDownloadUrl(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.files.getDownloadUrl,{fileName:e});return this.client.get(i,t)}))}generatePdfByTemplate(e,t,i){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.pdfTemplate.generatePdfByTemplate,{id:e});return this.client.post(n,{templateId:e,variables:t,name:i})}))}createPdfFromHtml(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.pdfTemplate.createPdfFromHtml);let i;return i="undefined"==typeof window?Buffer.from(e.html,"utf-8").toString("base64"):btoa(unescape(encodeURIComponent(e.html))),this.client.post(t,{base64HtmlString:i,name:e.name})}))}ocrOfImage(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.files.ocrOfImage);return this.client.post(t,{fileName:e})}))}ocrOfPdf(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.files.ocrOfPdf);return this.client.post(t,{fileName:e})}))}scanInvoice(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.files.scanInvoice);return this.client.post(i,{fileName:e,options:t})}))}scanDocument(e,t,i){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.files.scanDocument);return this.client.post(n,{fileName:e,properties:t,options:i})}))}}},675:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.FilterService=void 0;const r=i(429),o=i(591);t.FilterService=class{constructor(e){this.client=e}lookUpFilter(e,t,i,s){return n(this,void 0,void 0,(function*(){const n=o.UtilsService.getUrl("",r.endpoints.filter.lookUpFilter,{idPage:e}),c={query:encodeURIComponent(JSON.stringify(t)),idsOfMultipleNodesToSearch:i?encodeURIComponent(JSON.stringify(i)):void 0,returnCount:null==s?void 0:s.toString()};return this.client.get(n,c)}))}nestedFilter(e,t,i){return n(this,void 0,void 0,(function*(){const n=o.UtilsService.getUrl("",r.endpoints.filter.nestedFilter,{}),s={nestedFilter:e,tableNameToGetResults:t,filterOptions:i};return this.client.post(n,s)}))}runCustomMongoAggregationQuery(e,t){return n(this,void 0,void 0,(function*(){const i=o.UtilsService.getUrl("",r.endpoints.filter.runCustomAggregationQuery),n={customMongoQuery:t,type:e};return this.client.post(i,n)}))}}},386:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationService=void 0;const r=i(429),o=i(591);t.NotificationService=class{constructor(e){this.client=e}createNotification(e){return n(this,void 0,void 0,(function*(){const t=o.UtilsService.getUrl("",r.endpoints.notifications.createNotification,{});return this.client.post(t,{notification:e})}))}}},730:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OpenaiService=void 0;const r=i(591),o=i(429);t.OpenaiService=class{constructor(e){this.client=e}createCompletion(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.openai.createCompletion);return this.client.post(t,e)}))}createChatCompletion(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.openai.createChatCompletion);return this.client.post(t,e)}))}generateImage(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.openai.generateImage);return this.client.post(t,e)}))}editImage(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.openai.editImage);return this.client.post(t,e)}))}}},183:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ScrappingService=void 0;const r=i(591),o=i(429);t.ScrappingService=class{constructor(e){this.client=e}scrape(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.webScraper.scrape);return this.client.post(t,e)}))}extract(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.webScraper.extract);return this.client.post(t,e)}))}screenshot(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.webScraper.screenshot);return this.client.post(t,e)}))}searchAndExtract(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.webScraper.searchAndExtract);return this.client.post(t,e)}))}}},706:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.StatisticService=void 0;const r=i(429),o=i(591);t.StatisticService=class{constructor(e){this.client=e}getStatistic(e,t){return n(this,void 0,void 0,(function*(){const i=o.UtilsService.getUrl("",r.endpoints.statistics.getStatistic,{}),n={query:e,options:t};return this.client.post(i,n)}))}}},591:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UtilsService=void 0,t.UtilsService=class{static getUrl(e,t,i){let n=e+t;for(const e in i)n=n.replace(`:${e}`,i[e]);return n}}}},t={};return function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}(492)})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.totalumSdk=t():e.totalumSdk=t()}(this,(()=>(()=>{"use strict";var e={429:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.endpoints=void 0,t.endpoints={crud:{getObjectById:"api/v1/crud/:typeId/:id",getObjects:"api/v1/crud/query/:typeId",getNestedData:"api/v1/crud/nested",query:"api/v1/crud/advanced-query",createObject:"api/v1/crud/:typeId",editObjectProperties:"api/v1/crud/:typeId/:id",deleteObject:"api/v1/crud/:typeId/:id",deleteObjectAndSubElements:"api/v1/crud/:typeId/:id/:pageId/subelements",updateLastUsersActions:"api/v1/crud/:typeId/:id/lastUsersActions",addManyToManyReference:"api/v1/crud/:typeId/:id/add-many-to-many-reference",dropManyToManyReference:"api/v1/crud/:typeId/:id/drop-many-to-many-reference",getManyToManyReferencesItems:"api/v1/crud/:typeId/:id/:propertyName"},updatesRecord:{getUpdateRecordByObjectId:"api/v1/updates-record/:objectId"},files:{uploadFile:"api/v1/files/upload",getDownloadUrl:"api/v1/files/download/:fileName",deleteFile:"api/v1/files/:fileName",ocrOfImage:"api/v1/files/ocr/image",ocrOfPdf:"api/v1/files/ocr/pdf",scanInvoice:"api/v1/files/scan-invoice",scanDocument:"api/v1/files/scan-document",transcribeAudio:"api/v1/files/transcribe-audio-pro"},filter:{lookUpFilter:"api/v1/filter/:idPage",nestedFilter:"api/v1/filter/nested-filter",runCustomAggregationQuery:"api/v1/filter/custom-mongo-aggregation-query"},pdfTemplate:{generatePdfByTemplate:"api/v1/pdf-template/generatePdfByTemplate/:id",createPdfFromHtml:"api/v1/pdf-template/createPdfFromHtml"},googleIntegration:{getEmails:"api/v1/google-integration/get-emails",sendEmail:"api/v1/google-integration/send-email",getCalendarEvents:"api/v1/google-integration/get-calendar-events",createCalendarEvent:"api/v1/google-integration/create-calendar-event"},openai:{createCompletion:"api/v1/openai/completion",createChatCompletion:"api/v1/openai/chat-completion",generateImage:"api/v1/openai/image",editImage:"api/v1/openai/image-edit"},gemini:{analyzeVideo:"api/v1/gemini/analyze-video"},notifications:{createNotification:"api/v1/notifications"},statistics:{getStatistic:"api/v1/statistics/get-statistic"},email:{sendEmail:"api/v1/startum/send-email-with-default-domain"},webScraper:{scrape:"api/v1/web-scraper/scrape",extract:"api/v1/web-scraper/extract",screenshot:"api/v1/web-scraper/screenshot",searchAndExtract:"api/v1/web-scraper/search-and-extract"}}},731:function(e,t){var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.FetchClient=t.TotalumError=void 0;class n extends Error{constructor(e){super(e.errorMessage),this.errorCode=e.errorCode,this.errorMessage=e.errorMessage,this.hasManyErrors=e.hasManyErrors||!1,this.multipleErrors=e.multipleErrors||[],this.name="TotalumError",Object.setPrototypeOf(this,n.prototype)}toJSON(){return{errorCode:this.errorCode,errorMessage:this.errorMessage,hasManyErrors:this.hasManyErrors,multipleErrors:this.multipleErrors}}}t.TotalumError=n,t.FetchClient=class{constructor(e,t){this.baseUrl=e,this.headers=t}handleResponse(e){return i(this,void 0,void 0,(function*(){let t;try{t=yield e.json()}catch(t){return{errors:{errorCode:"RESPONSE_PARSE_ERROR",errorMessage:`Failed to parse response: ${e.statusText}`},data:null}}return t}))}request(e,t){return i(this,void 0,void 0,(function*(){const i=this.baseUrl+e;try{const e=yield fetch(i,Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({},this.headers),null==t?void 0:t.headers)}));return this.handleResponse(e)}catch(e){return{errors:{errorCode:"NETWORK_ERROR",errorMessage:e instanceof Error?e.message:"Network request failed"},data:null}}}))}get(e,t){return i(this,void 0,void 0,(function*(){let i=e;if(t){const e=new URLSearchParams(Object.entries(t).reduce(((e,[t,i])=>(null!=i&&(e[t]=String(i)),e)),{})).toString();e&&(i+="?"+e)}return this.request(i,{method:"GET"})}))}post(e,t){return i(this,void 0,void 0,(function*(){const i=t instanceof FormData;return this.request(e,{method:"POST",headers:i?{}:{"Content-Type":"application/json"},body:i?t:JSON.stringify(t)})}))}patch(e,t){return i(this,void 0,void 0,(function*(){return this.request(e,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}))}delete(e){return i(this,void 0,void 0,(function*(){return this.request(e,{method:"DELETE"})}))}put(e,t){return i(this,void 0,void 0,(function*(){return this.request(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}))}}},999:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},879:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},492:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.TotalumApiSdk=t.TotalumError=void 0;const o=i(731),s=i(730),c=i(109),a=i(675),d=i(589),l=i(882),u=i(386),p=i(706),v=i(279),h=i(183);r(i(999),t),r(i(879),t);var f=i(731);Object.defineProperty(t,"TotalumError",{enumerable:!0,get:function(){return f.TotalumError}}),t.TotalumApiSdk=class{constructor(e){var t,i;if(this._baseUrl="https://api.totalum.app/",this.authOptions=e,this._headers={},null===(t=this.authOptions.token)||void 0===t?void 0:t.accessToken)this._headers.authorization=this.authOptions.token.accessToken;else{if(!(null===(i=this.authOptions.apiKey)||void 0===i?void 0:i["api-key"]))throw new Error("Error: invalid auth options");this._headers["api-key"]=this.authOptions.apiKey["api-key"]}this.authOptions.baseUrl&&(this._baseUrl=this.authOptions.baseUrl),this.authOptions.fromEvent&&(this._headers.fromEvent="true"),this.setRequestData()}changeBaseUrl(e){this._baseUrl=e,this.setRequestData()}setRequestData(){this.client=new o.FetchClient(this._baseUrl,this._headers),this.crud=new l.CrudService(this.client),this.openai=new s.OpenaiService(this.client),this.gemini=new c.GeminiService(this.client),this.files=new d.FilesService(this.client),this.filter=new a.FilterService(this.client),this.notification=new u.NotificationService(this.client),this.statistic=new p.StatisticService(this.client),this.email=new v.EmailService(this.client),this.scrapping=new h.ScrappingService(this.client)}}},882:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CrudService=void 0;const r=i(591),o=i(429);t.CrudService=class{constructor(e){this.client=e}getRecordById(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.getObjectById,{typeId:e,id:t});return this.client.get(i)}))}getHistoricRecordUpdatesById(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.updatesRecord.getUpdateRecordByObjectId,{objectId:e});return this.client.get(t)}))}getRecords(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.getObjects,{typeId:e});return this.client.post(i,t)}))}getNestedData(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.getNestedData);return this.client.post(i,{nestedQuery:e,options:t})}))}query(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.query),n=t?this.encodeSortKeys(t):{};return this.client.post(i,{tableName:e,queryOptions:n})}))}encodeSortKeys(e){if(!e||"object"!=typeof e)return e;const t={};for(const i of Object.keys(e))if("_sort"===i&&"object"==typeof e[i]){const n={};for(const t of Object.keys(e[i]))n[t.replace(/\./g,"@")]=e[i][t];t[i]=n}else"object"!=typeof e[i]||null===e[i]||Array.isArray(e[i])?t[i]=e[i]:t[i]=this.encodeSortKeys(e[i]);return t}deleteRecordById(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.deleteObject,{typeId:e,id:t});return this.client.delete(i)}))}editRecordById(e,t,i){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.crud.editObjectProperties,{typeId:e,id:t});return this.client.request(n,{method:"PATCH",headers:{"Content-Type":"application/json",returnoption:"fullrecord"},body:JSON.stringify(i)})}))}createRecord(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.crud.createObject,{typeId:e});return this.client.request(i,{method:"POST",headers:{"Content-Type":"application/json",returnoption:"fullrecord"},body:JSON.stringify(t)})}))}addManyToManyReferenceRecord(e,t,i,s){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.crud.addManyToManyReference,{typeId:e,id:t});return this.client.patch(n,{propertyId:i,referenceId:s})}))}dropManyToManyReferenceRecord(e,t,i,s){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.crud.dropManyToManyReference,{typeId:e,id:t});return this.client.patch(n,{propertyId:i,referenceId:s})}))}getManyToManyReferencesRecords(e,t,i,s){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.crud.getManyToManyReferencesItems,{typeId:e,id:t,propertyName:i});return this.client.get(n,s)}))}}},279:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailService=void 0;const r=i(429),o=i(591);t.EmailService=class{constructor(e){this.client=e}sendEmail(e){return n(this,void 0,void 0,(function*(){if(e.attachments&&e.attachments.length>10)return{errors:{errorCode:"TOO_MANY_ATTACHMENTS",errorMessage:`Maximum number of attachments is 10. Received ${e.attachments.length}.`},data:null};if(e.attachments)for(const t of e.attachments){if(!t.url||"string"!=typeof t.url)return{errors:{errorCode:"INVALID_ATTACHMENT_URL",errorMessage:`Attachment ${t.filename} must have a valid URL`},data:null};if(!t.url.startsWith("http://")&&!t.url.startsWith("https://"))return{errors:{errorCode:"INVALID_ATTACHMENT_URL",errorMessage:`Attachment ${t.filename} must have a valid HTTP/HTTPS URL`},data:null}}return this.sendEmailWithDefaultDomain(e)}))}sendEmailWithDefaultDomain(e){return n(this,void 0,void 0,(function*(){const t=o.UtilsService.getUrl("",r.endpoints.email.sendEmail,{});return this.client.post(t,e)}))}}},589:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.FilesService=void 0;const r=i(591),o=i(429);t.FilesService=class{constructor(e){this.client=e}uploadFile(e,t){return n(this,void 0,void 0,(function*(){let i=r.UtilsService.getUrl("",o.endpoints.files.uploadFile);return(null==t?void 0:t.compressFile)&&(i+="?compressFile=true"),this.client.post(i,e)}))}deleteFile(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.files.deleteFile,{fileName:e});return this.client.delete(t)}))}getDownloadUrl(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.files.getDownloadUrl,{fileName:e});return this.client.get(i,t)}))}generatePdfByTemplate(e,t,i){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.pdfTemplate.generatePdfByTemplate,{id:e});return this.client.post(n,{templateId:e,variables:t,name:i})}))}createPdfFromHtml(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.pdfTemplate.createPdfFromHtml);let i;return i="undefined"==typeof window?Buffer.from(e.html,"utf-8").toString("base64"):btoa(unescape(encodeURIComponent(e.html))),this.client.post(t,{base64HtmlString:i,name:e.name})}))}ocrOfImage(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.files.ocrOfImage);return this.client.post(t,{fileName:e})}))}ocrOfPdf(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.files.ocrOfPdf);return this.client.post(t,{fileName:e})}))}scanInvoice(e,t){return n(this,void 0,void 0,(function*(){const i=r.UtilsService.getUrl("",o.endpoints.files.scanInvoice);return this.client.post(i,{fileName:e,options:t})}))}scanDocument(e,t,i){return n(this,void 0,void 0,(function*(){const n=r.UtilsService.getUrl("",o.endpoints.files.scanDocument);return this.client.post(n,{fileName:e,properties:t,options:i})}))}transcribeAudio(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.files.transcribeAudio);return this.client.post(t,e)}))}}},675:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.FilterService=void 0;const r=i(429),o=i(591);t.FilterService=class{constructor(e){this.client=e}lookUpFilter(e,t,i,s){return n(this,void 0,void 0,(function*(){const n=o.UtilsService.getUrl("",r.endpoints.filter.lookUpFilter,{idPage:e}),c={query:encodeURIComponent(JSON.stringify(t)),idsOfMultipleNodesToSearch:i?encodeURIComponent(JSON.stringify(i)):void 0,returnCount:null==s?void 0:s.toString()};return this.client.get(n,c)}))}nestedFilter(e,t,i){return n(this,void 0,void 0,(function*(){const n=o.UtilsService.getUrl("",r.endpoints.filter.nestedFilter,{}),s={nestedFilter:e,tableNameToGetResults:t,filterOptions:i};return this.client.post(n,s)}))}runCustomMongoAggregationQuery(e,t){return n(this,void 0,void 0,(function*(){const i=o.UtilsService.getUrl("",r.endpoints.filter.runCustomAggregationQuery),n={customMongoQuery:t,type:e};return this.client.post(i,n)}))}}},109:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GeminiService=void 0;const r=i(591),o=i(429);t.GeminiService=class{constructor(e){this.client=e}analyzeVideo(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.gemini.analyzeVideo);return this.client.post(t,e)}))}}},386:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationService=void 0;const r=i(429),o=i(591);t.NotificationService=class{constructor(e){this.client=e}createNotification(e){return n(this,void 0,void 0,(function*(){const t=o.UtilsService.getUrl("",r.endpoints.notifications.createNotification,{});return this.client.post(t,{notification:e})}))}}},730:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OpenaiService=void 0;const r=i(591),o=i(429);t.OpenaiService=class{constructor(e){this.client=e}createCompletion(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.openai.createCompletion);return this.client.post(t,e)}))}createChatCompletion(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.openai.createChatCompletion);return this.client.post(t,e)}))}generateImage(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.openai.generateImage);return this.client.post(t,e)}))}editImage(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.openai.editImage);return this.client.post(t,e)}))}}},183:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ScrappingService=void 0;const r=i(591),o=i(429);t.ScrappingService=class{constructor(e){this.client=e}scrape(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.webScraper.scrape);return this.client.post(t,e)}))}extract(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.webScraper.extract);return this.client.post(t,e)}))}screenshot(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.webScraper.screenshot);return this.client.post(t,e)}))}searchAndExtract(e){return n(this,void 0,void 0,(function*(){const t=r.UtilsService.getUrl("",o.endpoints.webScraper.searchAndExtract);return this.client.post(t,e)}))}}},706:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.StatisticService=void 0;const r=i(429),o=i(591);t.StatisticService=class{constructor(e){this.client=e}getStatistic(e,t){return n(this,void 0,void 0,(function*(){const i=o.UtilsService.getUrl("",r.endpoints.statistics.getStatistic,{}),n={query:e,options:t};return this.client.post(i,n)}))}}},591:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UtilsService=void 0,t.UtilsService=class{static getUrl(e,t,i){let n=e+t;for(const e in i)n=n.replace(`:${e}`,i[e]);return n}}}},t={};return function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}(492)})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totalum-api-sdk",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "description": "Totalum sdk wrapper and utils of totalum api",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",