@eveai/eve-sdk-for-node 0.0.2 → 0.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.bak +510 -0
- package/README.md.orig +510 -0
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +1 -1
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/dist/services/eveai-chat.d.mts +118 -0
- package/dist/services/eveai-chat.d.ts +118 -0
- package/dist/services/eveai-chat.js +115 -0
- package/dist/services/eveai-chat.js.map +1 -0
- package/dist/services/eveai-chat.mjs +114 -0
- package/dist/services/eveai-chat.mjs.map +1 -0
- package/dist/services/eveai-payment.d.mts +145 -0
- package/dist/services/eveai-payment.d.ts +145 -0
- package/dist/services/eveai-payment.js +132 -0
- package/dist/services/eveai-payment.js.map +1 -0
- package/dist/services/eveai-payment.mjs +131 -0
- package/dist/services/eveai-payment.mjs.map +1 -0
- package/dist/services/eveai-provider-discovery.d.mts +126 -0
- package/dist/services/eveai-provider-discovery.d.ts +126 -0
- package/dist/services/eveai-provider-discovery.js +96 -0
- package/dist/services/eveai-provider-discovery.js.map +1 -0
- package/dist/services/eveai-provider-discovery.mjs +95 -0
- package/dist/services/eveai-provider-discovery.mjs.map +1 -0
- package/dist/services/eveai-task.d.mts +137 -0
- package/dist/services/eveai-task.d.ts +137 -0
- package/dist/services/eveai-task.js +143 -0
- package/dist/services/eveai-task.js.map +1 -0
- package/dist/services/eveai-task.mjs +142 -0
- package/dist/services/eveai-task.mjs.map +1 -0
- package/package.json +16 -2
package/dist/client.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts"],"names":[],"mappings":";AAAA,SAAS,OAAO,UAAU,YAAY;AACtC,SAA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;AACjB,mBAAa,SAAS;AACtB,UAAI,MAAM,SAAS,cAAc;AAC7B,cAAM,IAAI,kBAAkB,yBAAyB,KAAK,OAAO,OAAO,MAAM,KAAK,eAAe;AAAA,MACtG;AACA,YAAM;AAAA,IACV;AAAA,EACJ;AAAA,EAEA,OAAO,QAAQ,MAAe,SAAS,IAAa;AAChD,QAAI,SAAkB,CAAC;AAEvB,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC7C,UAAI,WAAW,SAAS,SAAS,MAAM,MAAK,MAAM;AAClD,UAAI,MAAM,QAAQ,KAAK,GAAG;AACtB,iBAAS,EAAE,GAAG,QAAQ,GAAG,QAAO,QAAQ,OAAO,QAAQ,EAAE;AAAA,MAC7D,OAAO;AACH,eAAO,QAAQ,IAAI;AAAA,MACvB;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AACJ;AAvSM,QACK,aAAa,OAAO,OAAO;AADtC,IAAM,SAAN","sourcesContent":["import { fetch, FormData, File } from 'node-fetch-native-with-agent';\nimport { createAgent } from 'node-fetch-native-with-agent/agent';\nimport { Models } from './models';\n\ntype Payload = {\n [key: string]: any;\n}\n\ntype UploadProgress = {\n $id: string;\n progress: number;\n sizeUploaded: number;\n chunksTotal: number;\n chunksUploaded: number;\n}\n\ntype Headers = {\n [key: string]: string;\n}\n\nclass AppwriteException extends Error {\n code: number;\n response: string;\n type: string;\n constructor(message: string, code: number = 0, type: string = '', response: string = '') {\n super(message);\n this.name = 'AppwriteException';\n this.message = message;\n this.code = code;\n this.type = type;\n this.response = response;\n }\n}\n\nfunction getUserAgent() {\n let ua = 'EveNodeJSSDK/0.0.1';\n\n // `process` is a global in Node.js, but not fully available in all runtimes.\n const platform: string[] = [];\n if (typeof process !== 'undefined') {\n if (typeof process.platform === 'string') platform.push(process.platform);\n if (typeof process.arch === 'string') platform.push(process.arch);\n }\n if (platform.length > 0) {\n ua += ` (${platform.join('; ')})`;\n }\n\n // `navigator.userAgent` is available in Node.js 21 and later.\n // It's also part of the WinterCG spec, so many edge runtimes provide it.\n // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent\n // @ts-ignore\n if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') {\n // @ts-ignore\n ua += ` ${navigator.userAgent}`;\n\n // @ts-ignore\n } else if (typeof globalThis.EdgeRuntime === 'string') {\n ua += ` EdgeRuntime`;\n\n // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`.\n } else if (typeof process !== 'undefined' && typeof process.version === 'string') {\n ua += ` Node.js/${process.version}`;\n }\n\n return ua;\n}\n\nclass Client {\n static CHUNK_SIZE = 1024 * 1024 * 5;\n\n config = {\n endpoint: 'http://localhost:37000',\n selfSigned: false,\n token: '',\n timeout: 600000, // 10 minutes default timeout for large video uploads\n };\n headers: Headers = {\n // 'x-sdk-name': 'Node.js',\n // 'x-sdk-platform': 'server',\n // 'x-sdk-language': 'nodejs',\n // 'x-sdk-version': '0.0.1',\n 'user-agent' : getUserAgent(),\n // 'Content-Type': 'application/json',\n };\n\n /**\n * Set Endpoint\n *\n * Your Eve AI API endpoint\n *\n * @param {string} endpoint\n *\n * @returns {this}\n */\n setEndpoint(endpoint: string): this {\n if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {\n throw new AppwriteException('Invalid endpoint URL: ' + endpoint);\n }\n\n this.config.endpoint = endpoint;\n return this;\n }\n\n /**\n * Set Timeout\n *\n * Set the timeout for API requests in milliseconds\n *\n * @param {number} timeout - Timeout in milliseconds\n *\n * @returns {this}\n */\n setTimeout(timeout: number): this {\n this.config.timeout = timeout;\n return this;\n }\n\n /**\n * Set self-signed\n *\n * @param {boolean} selfSigned\n *\n * @returns {this}\n */\n setSelfSigned(selfSigned: boolean): this {\n // @ts-ignore\n if (typeof globalThis.EdgeRuntime !== 'undefined') {\n console.warn('setSelfSigned is not supported in edge runtimes.');\n }\n\n this.config.selfSigned = selfSigned;\n\n return this;\n }\n\n /**\n * Add header\n *\n * @param {string} header\n * @param {string} value\n *\n * @returns {this}\n */\n addHeader(header: string, value: string): this {\n this.headers[header.toLowerCase()] = value;\n\n return this;\n }\n\n /**\n * Set Token\n *\n * Your authentication token\n *\n * @param value string\n *\n * @return {this}\n */\n setToken(value: string): this {\n // this.headers['Authorization'] = `Bearer ${value}`;\n this.config.token = value;\n return this;\n }\n /**\n * Set ForwardedUserAgent\n *\n * The user agent string of the client that made the request\n *\n * @param value string\n *\n * @return {this}\n */\n setForwardedUserAgent(value: string): this {\n this.headers['X-Forwarded-User-Agent'] = value;\n return this;\n }\n\n prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } {\n method = method.toUpperCase();\n\n headers = Object.assign({}, this.headers, headers);\n\n let options: RequestInit = {\n method,\n headers,\n ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }),\n };\n\n if (method === 'GET') {\n for (const [key, value] of Object.entries(Client.flatten(params))) {\n url.searchParams.append(key, value);\n }\n } else {\n switch (headers['content-type']) {\n case 'application/json':\n options.body = JSON.stringify(params);\n break;\n\n case 'multipart/form-data':\n const formData = new FormData();\n\n for (const [key, value] of Object.entries(params)) {\n if (value instanceof File) {\n formData.append(key, value, value.name);\n } else if (Array.isArray(value)) {\n for (const nestedValue of value) {\n formData.append(`${key}[]`, nestedValue);\n }\n } else {\n formData.append(key, value);\n }\n }\n\n options.body = formData;\n // Do NOT set Content-Type header manually when using FormData\n // The 'form-data' package (or native FormData) will automatically set it\n // along with the boundary. \n // headers['content-type'] = 'multipart/form-data';\n delete headers['content-type'];\n break;\n }\n }\n\n return { uri: url.toString(), options };\n }\n\n async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {\n const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];\n\n if (!file || !fileParam) {\n throw new Error('File not found in payload');\n }\n\n if (file.size <= Client.CHUNK_SIZE) {\n return await this.call(method, url, headers, originalPayload);\n }\n\n let start = 0;\n let response = null;\n\n while (start < file.size) {\n let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk\n if (end >= file.size) {\n end = file.size; // Adjust for the last chunk to include the last byte\n }\n\n headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;\n const chunk = file.slice(start, end);\n\n let payload = { ...originalPayload };\n payload[fileParam] = new File([chunk], file.name);\n\n response = await this.call(method, url, headers, payload);\n\n if (onProgress && typeof onProgress === 'function') {\n onProgress({\n $id: response.upload_id || response.$id,\n progress: Math.round((end / file.size) * 100),\n sizeUploaded: end,\n chunksTotal: response.chunks_total || Math.ceil(file.size / Client.CHUNK_SIZE),\n chunksUploaded: response.chunks_uploaded || Math.ceil(end / Client.CHUNK_SIZE)\n });\n }\n\n // Support both Eve AI (upload_id) and Appwrite ($id) formats\n if (response && response.upload_id) {\n headers['X-Upload-Id'] = response.upload_id;\n } else if (response && response.$id) {\n headers['x-appwrite-id'] = response.$id;\n }\n\n start = end;\n }\n\n return response;\n }\n\n async ping(): Promise<string> {\n return this.call('GET', new URL(this.config.endpoint + '/ping'));\n }\n\n async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n \n const response = await fetch(uri, {\n ...options,\n redirect: 'manual'\n });\n\n if (response.status !== 301 && response.status !== 302) {\n throw new AppwriteException('Invalid redirect', response.status);\n }\n\n return response.headers.get('location') || '';\n }\n\n async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n\n let data: any = null;\n\n // Create an AbortController for timeout\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n try {\n const response = await fetch(uri, {\n ...options,\n signal: controller.signal\n });\n\n clearTimeout(timeoutId);\n\n const warnings = response.headers.get('x-appwrite-warning');\n if (warnings) {\n warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning));\n }\n\n if (response.headers.get('content-type')?.includes('application/json')) {\n data = await response.json();\n } else if (responseType === 'arrayBuffer') {\n data = await response.arrayBuffer();\n } else {\n data = {\n message: await response.text()\n };\n }\n\n if (400 <= response.status) {\n let responseText = '';\n if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') {\n responseText = JSON.stringify(data);\n } else {\n responseText = data?.message;\n }\n throw new AppwriteException(data?.message, response.status, data?.type, responseText);\n }\n\n return data;\n } catch (error: any) {\n clearTimeout(timeoutId);\n if (error.name === 'AbortError') {\n throw new AppwriteException(`Request timeout after ${this.config.timeout}ms`, 408, 'timeout_error');\n }\n throw error;\n }\n }\n\n static flatten(data: Payload, prefix = ''): Payload {\n let output: Payload = {};\n\n for (const [key, value] of Object.entries(data)) {\n let finalKey = prefix ? prefix + '[' + key +']' : key;\n if (Array.isArray(value)) {\n output = { ...output, ...Client.flatten(value, finalKey) };\n } else {\n output[finalKey] = value;\n }\n }\n\n return output;\n }\n}\n\nexport { Client, AppwriteException };\nexport { Query } from './query';\nexport type { Models, Payload, UploadProgress };\nexport type { QueryTypes, QueryTypesList } from './query';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"names":[],"mappings":";AAAA,SAAS,OAAO,UAAU,YAAY;AACtC,SAAS,mBAAmB;AA4W5B,SAAS,aAAa;AAzVtB,IAAM,oBAAN,cAAgC,MAAM;AAAA,EAIlC,YAAY,SAAiB,OAAe,GAAG,OAAe,IAAI,WAAmB,IAAI;AACrF,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EACpB;AACJ;AAEA,SAAS,eAAe;AACpB,MAAI,KAAK;AAGT,QAAM,WAAqB,CAAC;AAC5B,MAAI,OAAO,YAAY,aAAa;AAChC,QAAI,OAAO,QAAQ,aAAa;AAAU,eAAS,KAAK,QAAQ,QAAQ;AACxE,QAAI,OAAO,QAAQ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Q,OAAO,QAAQ,EAAE;AAAA,MAC7D,OAAO;AACH,eAAO,QAAQ,IAAI;AAAA,MACvB;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AACJ;AAvSM,QACK,aAAa,OAAO,OAAO;AADtC,IAAM,SAAN","sourcesContent":["import { fetch, FormData, File } from 'node-fetch-native-with-agent';\nimport { createAgent } from 'node-fetch-native-with-agent/agent';\nimport { Models } from './models';\n\ntype Payload = {\n [key: string]: any;\n}\n\ntype UploadProgress = {\n $id: string;\n progress: number;\n sizeUploaded: number;\n chunksTotal: number;\n chunksUploaded: number;\n}\n\ntype Headers = {\n [key: string]: string;\n}\n\nclass AppwriteException extends Error {\n code: number;\n response: string;\n type: string;\n constructor(message: string, code: number = 0, type: string = '', response: string = '') {\n super(message);\n this.name = 'AppwriteException';\n this.message = message;\n this.code = code;\n this.type = type;\n this.response = response;\n }\n}\n\nfunction getUserAgent() {\n let ua = 'EveNodeJSSDK/0.0.1';\n\n // `process` is a global in Node.js, but not fully available in all runtimes.\n const platform: string[] = [];\n if (typeof process !== 'undefined') {\n if (typeof process.platform === 'string') platform.push(process.platform);\n if (typeof process.arch === 'string') platform.push(process.arch);\n }\n if (platform.length > 0) {\n ua += ` (${platform.join('; ')})`;\n }\n\n // `navigator.userAgent` is available in Node.js 21 and later.\n // It's also part of the WinterCG spec, so many edge runtimes provide it.\n // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent\n // @ts-ignore\n if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') {\n // @ts-ignore\n ua += ` ${navigator.userAgent}`;\n\n // @ts-ignore\n } else if (typeof globalThis.EdgeRuntime === 'string') {\n ua += ` EdgeRuntime`;\n\n // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`.\n } else if (typeof process !== 'undefined' && typeof process.version === 'string') {\n ua += ` Node.js/${process.version}`;\n }\n\n return ua;\n}\n\nclass Client {\n static CHUNK_SIZE = 1024 * 1024 * 5;\n\n config = {\n endpoint: 'https://api.eve.ai/v1',\n selfSigned: false,\n token: '',\n timeout: 600000, // 10 minutes default timeout for large video uploads\n };\n headers: Headers = {\n // 'x-sdk-name': 'Node.js',\n // 'x-sdk-platform': 'server',\n // 'x-sdk-language': 'nodejs',\n // 'x-sdk-version': '0.0.1',\n 'user-agent' : getUserAgent(),\n // 'Content-Type': 'application/json',\n };\n\n /**\n * Set Endpoint\n *\n * Your Eve AI API endpoint\n *\n * @param {string} endpoint\n *\n * @returns {this}\n */\n setEndpoint(endpoint: string): this {\n if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {\n throw new AppwriteException('Invalid endpoint URL: ' + endpoint);\n }\n\n this.config.endpoint = endpoint;\n return this;\n }\n\n /**\n * Set Timeout\n *\n * Set the timeout for API requests in milliseconds\n *\n * @param {number} timeout - Timeout in milliseconds\n *\n * @returns {this}\n */\n setTimeout(timeout: number): this {\n this.config.timeout = timeout;\n return this;\n }\n\n /**\n * Set self-signed\n *\n * @param {boolean} selfSigned\n *\n * @returns {this}\n */\n setSelfSigned(selfSigned: boolean): this {\n // @ts-ignore\n if (typeof globalThis.EdgeRuntime !== 'undefined') {\n console.warn('setSelfSigned is not supported in edge runtimes.');\n }\n\n this.config.selfSigned = selfSigned;\n\n return this;\n }\n\n /**\n * Add header\n *\n * @param {string} header\n * @param {string} value\n *\n * @returns {this}\n */\n addHeader(header: string, value: string): this {\n this.headers[header.toLowerCase()] = value;\n\n return this;\n }\n\n /**\n * Set Token\n *\n * Your authentication token\n *\n * @param value string\n *\n * @return {this}\n */\n setToken(value: string): this {\n // this.headers['Authorization'] = `Bearer ${value}`;\n this.config.token = value;\n return this;\n }\n /**\n * Set ForwardedUserAgent\n *\n * The user agent string of the client that made the request\n *\n * @param value string\n *\n * @return {this}\n */\n setForwardedUserAgent(value: string): this {\n this.headers['X-Forwarded-User-Agent'] = value;\n return this;\n }\n\n prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } {\n method = method.toUpperCase();\n\n headers = Object.assign({}, this.headers, headers);\n\n let options: RequestInit = {\n method,\n headers,\n ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }),\n };\n\n if (method === 'GET') {\n for (const [key, value] of Object.entries(Client.flatten(params))) {\n url.searchParams.append(key, value);\n }\n } else {\n switch (headers['content-type']) {\n case 'application/json':\n options.body = JSON.stringify(params);\n break;\n\n case 'multipart/form-data':\n const formData = new FormData();\n\n for (const [key, value] of Object.entries(params)) {\n if (value instanceof File) {\n formData.append(key, value, value.name);\n } else if (Array.isArray(value)) {\n for (const nestedValue of value) {\n formData.append(`${key}[]`, nestedValue);\n }\n } else {\n formData.append(key, value);\n }\n }\n\n options.body = formData;\n // Do NOT set Content-Type header manually when using FormData\n // The 'form-data' package (or native FormData) will automatically set it\n // along with the boundary. \n // headers['content-type'] = 'multipart/form-data';\n delete headers['content-type'];\n break;\n }\n }\n\n return { uri: url.toString(), options };\n }\n\n async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {\n const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];\n\n if (!file || !fileParam) {\n throw new Error('File not found in payload');\n }\n\n if (file.size <= Client.CHUNK_SIZE) {\n return await this.call(method, url, headers, originalPayload);\n }\n\n let start = 0;\n let response = null;\n\n while (start < file.size) {\n let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk\n if (end >= file.size) {\n end = file.size; // Adjust for the last chunk to include the last byte\n }\n\n headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;\n const chunk = file.slice(start, end);\n\n let payload = { ...originalPayload };\n payload[fileParam] = new File([chunk], file.name);\n\n response = await this.call(method, url, headers, payload);\n\n if (onProgress && typeof onProgress === 'function') {\n onProgress({\n $id: response.upload_id || response.$id,\n progress: Math.round((end / file.size) * 100),\n sizeUploaded: end,\n chunksTotal: response.chunks_total || Math.ceil(file.size / Client.CHUNK_SIZE),\n chunksUploaded: response.chunks_uploaded || Math.ceil(end / Client.CHUNK_SIZE)\n });\n }\n\n // Support both Eve AI (upload_id) and Appwrite ($id) formats\n if (response && response.upload_id) {\n headers['X-Upload-Id'] = response.upload_id;\n } else if (response && response.$id) {\n headers['x-appwrite-id'] = response.$id;\n }\n\n start = end;\n }\n\n return response;\n }\n\n async ping(): Promise<string> {\n return this.call('GET', new URL(this.config.endpoint + '/ping'));\n }\n\n async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n \n const response = await fetch(uri, {\n ...options,\n redirect: 'manual'\n });\n\n if (response.status !== 301 && response.status !== 302) {\n throw new AppwriteException('Invalid redirect', response.status);\n }\n\n return response.headers.get('location') || '';\n }\n\n async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n\n let data: any = null;\n\n // Create an AbortController for timeout\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n try {\n const response = await fetch(uri, {\n ...options,\n signal: controller.signal\n });\n\n clearTimeout(timeoutId);\n\n const warnings = response.headers.get('x-appwrite-warning');\n if (warnings) {\n warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning));\n }\n\n if (response.headers.get('content-type')?.includes('application/json')) {\n data = await response.json();\n } else if (responseType === 'arrayBuffer') {\n data = await response.arrayBuffer();\n } else {\n data = {\n message: await response.text()\n };\n }\n\n if (400 <= response.status) {\n let responseText = '';\n if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') {\n responseText = JSON.stringify(data);\n } else {\n responseText = data?.message;\n }\n throw new AppwriteException(data?.message, response.status, data?.type, responseText);\n }\n\n return data;\n } catch (error: any) {\n clearTimeout(timeoutId);\n if (error.name === 'AbortError') {\n throw new AppwriteException(`Request timeout after ${this.config.timeout}ms`, 408, 'timeout_error');\n }\n throw error;\n }\n }\n\n static flatten(data: Payload, prefix = ''): Payload {\n let output: Payload = {};\n\n for (const [key, value] of Object.entries(data)) {\n let finalKey = prefix ? prefix + '[' + key +']' : key;\n if (Array.isArray(value)) {\n output = { ...output, ...Client.flatten(value, finalKey) };\n } else {\n output[finalKey] = value;\n }\n }\n\n return output;\n }\n}\n\nexport { Client, AppwriteException };\nexport { Query } from './query';\nexport type { Models, Payload, UploadProgress };\nexport type { QueryTypes, QueryTypesList } from './query';\n"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,10 @@ export { Favorite } from './services/favorite.mjs';
|
|
|
8
8
|
export { Relation } from './services/relation.mjs';
|
|
9
9
|
export { Message, MessageService } from './services/message.mjs';
|
|
10
10
|
export { GuGoTikStorage } from './services/gugotik-storage.mjs';
|
|
11
|
+
export { AIAnalysis, AIAnalysisResponse, EveAITask, Task, TaskListResponse, TaskLocation, TaskResponse, TaskSuggestion } from './services/eveai-task.mjs';
|
|
12
|
+
export { EarningsResponse, EveAIPayment, Payment, PaymentIntentResponse, PaymentResponse, PayoutResponse, PriceCalculationResponse, Subscription, SubscriptionResponse } from './services/eveai-payment.mjs';
|
|
13
|
+
export { Message as ChatMessage, Conversation, ConversationListResponse, ConversationResponse, EveAIChat, MessageListResponse, MessageResponse, UnreadCountResponse } from './services/eveai-chat.mjs';
|
|
14
|
+
export { ContactProvidersResponse, ConversionStatsResponse, DiscoveredProvider, EveAIProviderDiscovery, OutreachAttempt, SearchProvidersResponse, SearchResult, TaskOutreachInfo } from './services/eveai-provider-discovery.mjs';
|
|
11
15
|
export { Account } from './services/account.mjs';
|
|
12
16
|
export { Avatars } from './services/avatars.mjs';
|
|
13
17
|
export { Databases } from './services/databases.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export { Favorite } from './services/favorite.js';
|
|
|
8
8
|
export { Relation } from './services/relation.js';
|
|
9
9
|
export { Message, MessageService } from './services/message.js';
|
|
10
10
|
export { GuGoTikStorage } from './services/gugotik-storage.js';
|
|
11
|
+
export { AIAnalysis, AIAnalysisResponse, EveAITask, Task, TaskListResponse, TaskLocation, TaskResponse, TaskSuggestion } from './services/eveai-task.js';
|
|
12
|
+
export { EarningsResponse, EveAIPayment, Payment, PaymentIntentResponse, PaymentResponse, PayoutResponse, PriceCalculationResponse, Subscription, SubscriptionResponse } from './services/eveai-payment.js';
|
|
13
|
+
export { Message as ChatMessage, Conversation, ConversationListResponse, ConversationResponse, EveAIChat, MessageListResponse, MessageResponse, UnreadCountResponse } from './services/eveai-chat.js';
|
|
14
|
+
export { ContactProvidersResponse, ConversionStatsResponse, DiscoveredProvider, EveAIProviderDiscovery, OutreachAttempt, SearchProvidersResponse, SearchResult, TaskOutreachInfo } from './services/eveai-provider-discovery.js';
|
|
11
15
|
export { Account } from './services/account.js';
|
|
12
16
|
export { Avatars } from './services/avatars.js';
|
|
13
17
|
export { Databases } from './services/databases.js';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,10 @@ var favorite = require('./services/favorite');
|
|
|
10
10
|
var relation = require('./services/relation');
|
|
11
11
|
var message = require('./services/message');
|
|
12
12
|
var gugotikStorage = require('./services/gugotik-storage');
|
|
13
|
+
var eveaiTask = require('./services/eveai-task');
|
|
14
|
+
var eveaiPayment = require('./services/eveai-payment');
|
|
15
|
+
var eveaiChat = require('./services/eveai-chat');
|
|
16
|
+
var eveaiProviderDiscovery = require('./services/eveai-provider-discovery');
|
|
13
17
|
var account = require('./services/account');
|
|
14
18
|
var avatars = require('./services/avatars');
|
|
15
19
|
var databases = require('./services/databases');
|
|
@@ -117,6 +121,22 @@ Object.defineProperty(exports, 'GuGoTikStorage', {
|
|
|
117
121
|
enumerable: true,
|
|
118
122
|
get: function () { return gugotikStorage.GuGoTikStorage; }
|
|
119
123
|
});
|
|
124
|
+
Object.defineProperty(exports, 'EveAITask', {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function () { return eveaiTask.EveAITask; }
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(exports, 'EveAIPayment', {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function () { return eveaiPayment.EveAIPayment; }
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, 'EveAIChat', {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () { return eveaiChat.EveAIChat; }
|
|
135
|
+
});
|
|
136
|
+
Object.defineProperty(exports, 'EveAIProviderDiscovery', {
|
|
137
|
+
enumerable: true,
|
|
138
|
+
get: function () { return eveaiProviderDiscovery.EveAIProviderDiscovery; }
|
|
139
|
+
});
|
|
120
140
|
Object.defineProperty(exports, 'Account', {
|
|
121
141
|
enumerable: true,
|
|
122
142
|
get: function () { return account.Account; }
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,SAAS,QAAQ,yBAAyB;AAI1C,SAAS,YAAY;AACrB,SAAS,mBAA8B;AACvC,SAAS,YAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,sBAAoC;AAC7C,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,sBAAoC;AAC7C,SAAS,sBAAsB;AAG/B,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,aAAa;AAItB,SAAS,aAAa;AAEtB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,UAAU,iBAAiB;AAGpC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,yBAAyB;AAClC,SAAS,qBAAqB","sourcesContent":["// GuGoTik SDK Exports\nexport { Client, AppwriteException } from './client';\nexport type { Payload, UploadProgress } from './client';\n\n// GuGoTik Services\nexport { Auth } from './services/auth';\nexport { UserService, type User } from './services/user';\nexport { Feed, type Video } from './services/feed';\nexport { Publish } from './services/publish';\nexport { CommentService, type Comment } from './services/comment';\nexport { Favorite } from './services/favorite';\nexport { Relation } from './services/relation';\nexport { MessageService, type Message } from './services/message';\nexport { GuGoTikStorage } from './services/gugotik-storage';\n\n// Legacy Appwrite Services (kept for backward compatibility)\nexport { Account } from './services/account';\nexport { Avatars } from './services/avatars';\nexport { Databases } from './services/databases';\nexport { Functions } from './services/functions';\nexport { Graphql } from './services/graphql';\nexport { Health } from './services/health';\nexport { Locale } from './services/locale';\nexport { Messaging } from './services/messaging';\nexport { Sites } from './services/sites';\nexport { Storage } from './services/storage';\nexport { TablesDB } from './services/tables-db';\nexport { Teams } from './services/teams';\nexport { Tokens } from './services/tokens';\nexport { Users } from './services/users';\n\n// Utilities\nexport type { Models } from './client';\nexport { Query } from './client';\nexport type { QueryTypes, QueryTypesList } from './query';\nexport { Permission } from './permission';\nexport { Role } from './role';\nexport { ID } from './id';\nexport { Operator, Condition } from './operator';\n\n// Enums\nexport { AuthenticatorType } from './enums/authenticator-type';\nexport { AuthenticationFactor } from './enums/authentication-factor';\nexport { OAuthProvider } from './enums/o-auth-provider';\nexport { Browser } from './enums/browser';\nexport { CreditCard } from './enums/credit-card';\nexport { Flag } from './enums/flag';\nexport { Theme } from './enums/theme';\nexport { Timezone } from './enums/timezone';\nexport { Output } from './enums/output';\nexport { RelationshipType } from './enums/relationship-type';\nexport { RelationMutate } from './enums/relation-mutate';\nexport { IndexType } from './enums/index-type';\nexport { Runtime } from './enums/runtime';\nexport { TemplateReferenceType } from './enums/template-reference-type';\nexport { VCSReferenceType } from './enums/vcs-reference-type';\nexport { DeploymentDownloadType } from './enums/deployment-download-type';\nexport { ExecutionMethod } from './enums/execution-method';\nexport { Name } from './enums/name';\nexport { MessagePriority } from './enums/message-priority';\nexport { SmtpEncryption } from './enums/smtp-encryption';\nexport { Framework } from './enums/framework';\nexport { BuildRuntime } from './enums/build-runtime';\nexport { Adapter } from './enums/adapter';\nexport { Compression } from './enums/compression';\nexport { ImageGravity } from './enums/image-gravity';\nexport { ImageFormat } from './enums/image-format';\nexport { PasswordHash } from './enums/password-hash';\nexport { MessagingProviderType } from './enums/messaging-provider-type';\nexport { DatabaseType } from './enums/database-type';\nexport { AttributeStatus } from './enums/attribute-status';\nexport { ColumnStatus } from './enums/column-status';\nexport { IndexStatus } from './enums/index-status';\nexport { DeploymentStatus } from './enums/deployment-status';\nexport { ExecutionTrigger } from './enums/execution-trigger';\nexport { ExecutionStatus } from './enums/execution-status';\nexport { HealthAntivirusStatus } from './enums/health-antivirus-status';\nexport { HealthCheckStatus } from './enums/health-check-status';\nexport { MessageStatus } from './enums/message-status';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":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AAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,yBAAyB;AAClC,SAAS,qBAAqB","sourcesContent":["// GuGoTik SDK Exports\nexport { Client, AppwriteException } from './client';\nexport type { Payload, UploadProgress } from './client';\n\n// GuGoTik Services\nexport { Auth } from './services/auth';\nexport { UserService, type User } from './services/user';\nexport { Feed, type Video } from './services/feed';\nexport { Publish } from './services/publish';\nexport { CommentService, type Comment } from './services/comment';\nexport { Favorite } from './services/favorite';\nexport { Relation } from './services/relation';\nexport { MessageService, type Message } from './services/message';\nexport { GuGoTikStorage } from './services/gugotik-storage';\n\n// Eve.AI Services\nexport { EveAITask } from './services/eveai-task';\nexport type {\n Task,\n TaskResponse,\n TaskListResponse,\n AIAnalysisResponse,\n TaskLocation,\n AIAnalysis,\n TaskSuggestion\n} from './services/eveai-task';\n\nexport { EveAIPayment } from './services/eveai-payment';\nexport type {\n PriceCalculationResponse,\n PaymentIntentResponse,\n PaymentResponse,\n SubscriptionResponse,\n Payment,\n Subscription,\n EarningsResponse,\n PayoutResponse\n} from './services/eveai-payment';\n\nexport { EveAIChat } from './services/eveai-chat';\nexport type {\n Conversation,\n ConversationResponse,\n ConversationListResponse,\n MessageResponse,\n Message as ChatMessage,\n MessageListResponse,\n UnreadCountResponse\n} from './services/eveai-chat';\n\nexport { EveAIProviderDiscovery } from './services/eveai-provider-discovery';\nexport type {\n TaskOutreachInfo,\n SearchProvidersResponse,\n DiscoveredProvider,\n ContactProvidersResponse,\n OutreachAttempt,\n SearchResult,\n ConversionStatsResponse\n} from './services/eveai-provider-discovery';\n\n// Legacy Appwrite Services (kept for backward compatibility)\nexport { Account } from './services/account';\nexport { Avatars } from './services/avatars';\nexport { Databases } from './services/databases';\nexport { Functions } from './services/functions';\nexport { Graphql } from './services/graphql';\nexport { Health } from './services/health';\nexport { Locale } from './services/locale';\nexport { Messaging } from './services/messaging';\nexport { Sites } from './services/sites';\nexport { Storage } from './services/storage';\nexport { TablesDB } from './services/tables-db';\nexport { Teams } from './services/teams';\nexport { Tokens } from './services/tokens';\nexport { Users } from './services/users';\n\n// Utilities\nexport type { Models } from './client';\nexport { Query } from './client';\nexport type { QueryTypes, QueryTypesList } from './query';\nexport { Permission } from './permission';\nexport { Role } from './role';\nexport { ID } from './id';\nexport { Operator, Condition } from './operator';\n\n// Enums\nexport { AuthenticatorType } from './enums/authenticator-type';\nexport { AuthenticationFactor } from './enums/authentication-factor';\nexport { OAuthProvider } from './enums/o-auth-provider';\nexport { Browser } from './enums/browser';\nexport { CreditCard } from './enums/credit-card';\nexport { Flag } from './enums/flag';\nexport { Theme } from './enums/theme';\nexport { Timezone } from './enums/timezone';\nexport { Output } from './enums/output';\nexport { RelationshipType } from './enums/relationship-type';\nexport { RelationMutate } from './enums/relation-mutate';\nexport { IndexType } from './enums/index-type';\nexport { Runtime } from './enums/runtime';\nexport { TemplateReferenceType } from './enums/template-reference-type';\nexport { VCSReferenceType } from './enums/vcs-reference-type';\nexport { DeploymentDownloadType } from './enums/deployment-download-type';\nexport { ExecutionMethod } from './enums/execution-method';\nexport { Name } from './enums/name';\nexport { MessagePriority } from './enums/message-priority';\nexport { SmtpEncryption } from './enums/smtp-encryption';\nexport { Framework } from './enums/framework';\nexport { BuildRuntime } from './enums/build-runtime';\nexport { Adapter } from './enums/adapter';\nexport { Compression } from './enums/compression';\nexport { ImageGravity } from './enums/image-gravity';\nexport { ImageFormat } from './enums/image-format';\nexport { PasswordHash } from './enums/password-hash';\nexport { MessagingProviderType } from './enums/messaging-provider-type';\nexport { DatabaseType } from './enums/database-type';\nexport { AttributeStatus } from './enums/attribute-status';\nexport { ColumnStatus } from './enums/column-status';\nexport { IndexStatus } from './enums/index-status';\nexport { DeploymentStatus } from './enums/deployment-status';\nexport { ExecutionTrigger } from './enums/execution-trigger';\nexport { ExecutionStatus } from './enums/execution-status';\nexport { HealthAntivirusStatus } from './enums/health-antivirus-status';\nexport { HealthCheckStatus } from './enums/health-check-status';\nexport { MessageStatus } from './enums/message-status';\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,10 @@ export { Favorite } from './services/favorite.mjs';
|
|
|
8
8
|
export { Relation } from './services/relation.mjs';
|
|
9
9
|
export { MessageService } from './services/message.mjs';
|
|
10
10
|
export { GuGoTikStorage } from './services/gugotik-storage.mjs';
|
|
11
|
+
export { EveAITask } from './services/eveai-task.mjs';
|
|
12
|
+
export { EveAIPayment } from './services/eveai-payment.mjs';
|
|
13
|
+
export { EveAIChat } from './services/eveai-chat.mjs';
|
|
14
|
+
export { EveAIProviderDiscovery } from './services/eveai-provider-discovery.mjs';
|
|
11
15
|
export { Account } from './services/account.mjs';
|
|
12
16
|
export { Avatars } from './services/avatars.mjs';
|
|
13
17
|
export { Databases } from './services/databases.mjs';
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AACA,SAAS,QAAQ,yBAAyB;AAI1C,SAAS,YAAY;AACrB,SAAS,mBAA8B;AACvC,SAAS,YAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,sBAAoC;AAC7C,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,sBAAoC;AAC7C,SAAS,sBAAsB;AAG/B,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,aAAa;AAItB,SAAS,aAAa;AAEtB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,UAAU,iBAAiB;AAGpC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,yBAAyB;AAClC,SAAS,qBAAqB","sourcesContent":["// GuGoTik SDK Exports\nexport { Client, AppwriteException } from './client';\nexport type { Payload, UploadProgress } from './client';\n\n// GuGoTik Services\nexport { Auth } from './services/auth';\nexport { UserService, type User } from './services/user';\nexport { Feed, type Video } from './services/feed';\nexport { Publish } from './services/publish';\nexport { CommentService, type Comment } from './services/comment';\nexport { Favorite } from './services/favorite';\nexport { Relation } from './services/relation';\nexport { MessageService, type Message } from './services/message';\nexport { GuGoTikStorage } from './services/gugotik-storage';\n\n// Legacy Appwrite Services (kept for backward compatibility)\nexport { Account } from './services/account';\nexport { Avatars } from './services/avatars';\nexport { Databases } from './services/databases';\nexport { Functions } from './services/functions';\nexport { Graphql } from './services/graphql';\nexport { Health } from './services/health';\nexport { Locale } from './services/locale';\nexport { Messaging } from './services/messaging';\nexport { Sites } from './services/sites';\nexport { Storage } from './services/storage';\nexport { TablesDB } from './services/tables-db';\nexport { Teams } from './services/teams';\nexport { Tokens } from './services/tokens';\nexport { Users } from './services/users';\n\n// Utilities\nexport type { Models } from './client';\nexport { Query } from './client';\nexport type { QueryTypes, QueryTypesList } from './query';\nexport { Permission } from './permission';\nexport { Role } from './role';\nexport { ID } from './id';\nexport { Operator, Condition } from './operator';\n\n// Enums\nexport { AuthenticatorType } from './enums/authenticator-type';\nexport { AuthenticationFactor } from './enums/authentication-factor';\nexport { OAuthProvider } from './enums/o-auth-provider';\nexport { Browser } from './enums/browser';\nexport { CreditCard } from './enums/credit-card';\nexport { Flag } from './enums/flag';\nexport { Theme } from './enums/theme';\nexport { Timezone } from './enums/timezone';\nexport { Output } from './enums/output';\nexport { RelationshipType } from './enums/relationship-type';\nexport { RelationMutate } from './enums/relation-mutate';\nexport { IndexType } from './enums/index-type';\nexport { Runtime } from './enums/runtime';\nexport { TemplateReferenceType } from './enums/template-reference-type';\nexport { VCSReferenceType } from './enums/vcs-reference-type';\nexport { DeploymentDownloadType } from './enums/deployment-download-type';\nexport { ExecutionMethod } from './enums/execution-method';\nexport { Name } from './enums/name';\nexport { MessagePriority } from './enums/message-priority';\nexport { SmtpEncryption } from './enums/smtp-encryption';\nexport { Framework } from './enums/framework';\nexport { BuildRuntime } from './enums/build-runtime';\nexport { Adapter } from './enums/adapter';\nexport { Compression } from './enums/compression';\nexport { ImageGravity } from './enums/image-gravity';\nexport { ImageFormat } from './enums/image-format';\nexport { PasswordHash } from './enums/password-hash';\nexport { MessagingProviderType } from './enums/messaging-provider-type';\nexport { DatabaseType } from './enums/database-type';\nexport { AttributeStatus } from './enums/attribute-status';\nexport { ColumnStatus } from './enums/column-status';\nexport { IndexStatus } from './enums/index-status';\nexport { DeploymentStatus } from './enums/deployment-status';\nexport { ExecutionTrigger } from './enums/execution-trigger';\nexport { ExecutionStatus } from './enums/execution-status';\nexport { HealthAntivirusStatus } from './enums/health-antivirus-status';\nexport { HealthCheckStatus } from './enums/health-check-status';\nexport { MessageStatus } from './enums/message-status';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AACA,SAAS,QAAQ,yBAAyB;AAI1C,SAAS,YAAY;AACrB,SAAS,mBAA8B;AACvC,SAAS,YAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,sBAAoC;AAC7C,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,sBAAoC;AAC7C,SAAS,sBAAsB;AAG/B,SAAS,iBAAiB;AAW1B,SAAS,oBAAoB;AAY7B,SAAS,iBAAiB;AAW1B,SAAS,8BAA8B;AAYvC,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,aAAa;AAItB,SAAS,aAAa;AAEtB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,UAAU,iBAAiB;AAGpC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,yBAAyB;AAClC,SAAS,qBAAqB","sourcesContent":["// GuGoTik SDK Exports\nexport { Client, AppwriteException } from './client';\nexport type { Payload, UploadProgress } from './client';\n\n// GuGoTik Services\nexport { Auth } from './services/auth';\nexport { UserService, type User } from './services/user';\nexport { Feed, type Video } from './services/feed';\nexport { Publish } from './services/publish';\nexport { CommentService, type Comment } from './services/comment';\nexport { Favorite } from './services/favorite';\nexport { Relation } from './services/relation';\nexport { MessageService, type Message } from './services/message';\nexport { GuGoTikStorage } from './services/gugotik-storage';\n\n// Eve.AI Services\nexport { EveAITask } from './services/eveai-task';\nexport type {\n Task,\n TaskResponse,\n TaskListResponse,\n AIAnalysisResponse,\n TaskLocation,\n AIAnalysis,\n TaskSuggestion\n} from './services/eveai-task';\n\nexport { EveAIPayment } from './services/eveai-payment';\nexport type {\n PriceCalculationResponse,\n PaymentIntentResponse,\n PaymentResponse,\n SubscriptionResponse,\n Payment,\n Subscription,\n EarningsResponse,\n PayoutResponse\n} from './services/eveai-payment';\n\nexport { EveAIChat } from './services/eveai-chat';\nexport type {\n Conversation,\n ConversationResponse,\n ConversationListResponse,\n MessageResponse,\n Message as ChatMessage,\n MessageListResponse,\n UnreadCountResponse\n} from './services/eveai-chat';\n\nexport { EveAIProviderDiscovery } from './services/eveai-provider-discovery';\nexport type {\n TaskOutreachInfo,\n SearchProvidersResponse,\n DiscoveredProvider,\n ContactProvidersResponse,\n OutreachAttempt,\n SearchResult,\n ConversionStatsResponse\n} from './services/eveai-provider-discovery';\n\n// Legacy Appwrite Services (kept for backward compatibility)\nexport { Account } from './services/account';\nexport { Avatars } from './services/avatars';\nexport { Databases } from './services/databases';\nexport { Functions } from './services/functions';\nexport { Graphql } from './services/graphql';\nexport { Health } from './services/health';\nexport { Locale } from './services/locale';\nexport { Messaging } from './services/messaging';\nexport { Sites } from './services/sites';\nexport { Storage } from './services/storage';\nexport { TablesDB } from './services/tables-db';\nexport { Teams } from './services/teams';\nexport { Tokens } from './services/tokens';\nexport { Users } from './services/users';\n\n// Utilities\nexport type { Models } from './client';\nexport { Query } from './client';\nexport type { QueryTypes, QueryTypesList } from './query';\nexport { Permission } from './permission';\nexport { Role } from './role';\nexport { ID } from './id';\nexport { Operator, Condition } from './operator';\n\n// Enums\nexport { AuthenticatorType } from './enums/authenticator-type';\nexport { AuthenticationFactor } from './enums/authentication-factor';\nexport { OAuthProvider } from './enums/o-auth-provider';\nexport { Browser } from './enums/browser';\nexport { CreditCard } from './enums/credit-card';\nexport { Flag } from './enums/flag';\nexport { Theme } from './enums/theme';\nexport { Timezone } from './enums/timezone';\nexport { Output } from './enums/output';\nexport { RelationshipType } from './enums/relationship-type';\nexport { RelationMutate } from './enums/relation-mutate';\nexport { IndexType } from './enums/index-type';\nexport { Runtime } from './enums/runtime';\nexport { TemplateReferenceType } from './enums/template-reference-type';\nexport { VCSReferenceType } from './enums/vcs-reference-type';\nexport { DeploymentDownloadType } from './enums/deployment-download-type';\nexport { ExecutionMethod } from './enums/execution-method';\nexport { Name } from './enums/name';\nexport { MessagePriority } from './enums/message-priority';\nexport { SmtpEncryption } from './enums/smtp-encryption';\nexport { Framework } from './enums/framework';\nexport { BuildRuntime } from './enums/build-runtime';\nexport { Adapter } from './enums/adapter';\nexport { Compression } from './enums/compression';\nexport { ImageGravity } from './enums/image-gravity';\nexport { ImageFormat } from './enums/image-format';\nexport { PasswordHash } from './enums/password-hash';\nexport { MessagingProviderType } from './enums/messaging-provider-type';\nexport { DatabaseType } from './enums/database-type';\nexport { AttributeStatus } from './enums/attribute-status';\nexport { ColumnStatus } from './enums/column-status';\nexport { IndexStatus } from './enums/index-status';\nexport { DeploymentStatus } from './enums/deployment-status';\nexport { ExecutionTrigger } from './enums/execution-trigger';\nexport { ExecutionStatus } from './enums/execution-status';\nexport { HealthAntivirusStatus } from './enums/health-antivirus-status';\nexport { HealthCheckStatus } from './enums/health-check-status';\nexport { MessageStatus } from './enums/message-status';\n"]}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Client } from '../client.mjs';
|
|
2
|
+
import '../models.mjs';
|
|
3
|
+
import '../enums/database-type.mjs';
|
|
4
|
+
import '../enums/attribute-status.mjs';
|
|
5
|
+
import '../enums/column-status.mjs';
|
|
6
|
+
import '../enums/index-status.mjs';
|
|
7
|
+
import '../enums/deployment-status.mjs';
|
|
8
|
+
import '../enums/execution-trigger.mjs';
|
|
9
|
+
import '../enums/execution-status.mjs';
|
|
10
|
+
import '../enums/health-antivirus-status.mjs';
|
|
11
|
+
import '../enums/health-check-status.mjs';
|
|
12
|
+
import '../enums/message-status.mjs';
|
|
13
|
+
import '../query.mjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Eve.AI Chat Service
|
|
17
|
+
*
|
|
18
|
+
* Real-time messaging and conversation management
|
|
19
|
+
*/
|
|
20
|
+
declare class EveAIChat {
|
|
21
|
+
client: Client;
|
|
22
|
+
constructor(client: Client);
|
|
23
|
+
/**
|
|
24
|
+
* Create Conversation
|
|
25
|
+
*
|
|
26
|
+
* Start a new conversation for a task
|
|
27
|
+
*/
|
|
28
|
+
createConversation(taskId: string, participantIds: number[]): Promise<ConversationResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Get Conversation
|
|
31
|
+
*
|
|
32
|
+
* Get conversation details
|
|
33
|
+
*/
|
|
34
|
+
getConversation(conversationId: string): Promise<ConversationResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* List Conversations
|
|
37
|
+
*
|
|
38
|
+
* List all user conversations
|
|
39
|
+
*/
|
|
40
|
+
listConversations(page?: number, pageSize?: number): Promise<ConversationListResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Send Message
|
|
43
|
+
*
|
|
44
|
+
* Send a chat message
|
|
45
|
+
*/
|
|
46
|
+
sendMessage(conversationId: string, content: string, type?: string, metadata?: any): Promise<MessageResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Get Messages
|
|
49
|
+
*
|
|
50
|
+
* Get messages for a conversation
|
|
51
|
+
*/
|
|
52
|
+
getMessages(conversationId: string, page?: number, pageSize?: number): Promise<MessageListResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Mark as Read
|
|
55
|
+
*
|
|
56
|
+
* Mark messages as read
|
|
57
|
+
*/
|
|
58
|
+
markAsRead(conversationId: string, messageIds: string[]): Promise<StatusResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Get Unread Count
|
|
61
|
+
*
|
|
62
|
+
* Get total unread message count
|
|
63
|
+
*/
|
|
64
|
+
getUnreadCount(): Promise<UnreadCountResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Search Messages
|
|
67
|
+
*
|
|
68
|
+
* Search messages across conversations
|
|
69
|
+
*/
|
|
70
|
+
searchMessages(query: string, conversationId?: string): Promise<MessageListResponse>;
|
|
71
|
+
}
|
|
72
|
+
interface ConversationResponse {
|
|
73
|
+
status_code: number;
|
|
74
|
+
conversation: Conversation;
|
|
75
|
+
}
|
|
76
|
+
interface Conversation {
|
|
77
|
+
id: string;
|
|
78
|
+
task_id: string;
|
|
79
|
+
participants: number[];
|
|
80
|
+
last_message?: Message;
|
|
81
|
+
unread_count: number;
|
|
82
|
+
created_at: string;
|
|
83
|
+
updated_at: string;
|
|
84
|
+
}
|
|
85
|
+
interface ConversationListResponse {
|
|
86
|
+
status_code: number;
|
|
87
|
+
conversations: Conversation[];
|
|
88
|
+
total: number;
|
|
89
|
+
}
|
|
90
|
+
interface MessageResponse {
|
|
91
|
+
status_code: number;
|
|
92
|
+
message: Message;
|
|
93
|
+
}
|
|
94
|
+
interface Message {
|
|
95
|
+
id: string;
|
|
96
|
+
conversation_id: string;
|
|
97
|
+
sender_id: number;
|
|
98
|
+
content: string;
|
|
99
|
+
type: string;
|
|
100
|
+
metadata?: any;
|
|
101
|
+
is_read: boolean;
|
|
102
|
+
created_at: string;
|
|
103
|
+
}
|
|
104
|
+
interface MessageListResponse {
|
|
105
|
+
status_code: number;
|
|
106
|
+
messages: Message[];
|
|
107
|
+
total: number;
|
|
108
|
+
}
|
|
109
|
+
interface UnreadCountResponse {
|
|
110
|
+
status_code: number;
|
|
111
|
+
unread_count: number;
|
|
112
|
+
}
|
|
113
|
+
interface StatusResponse {
|
|
114
|
+
status_code: number;
|
|
115
|
+
status_msg: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { Conversation, ConversationListResponse, ConversationResponse, EveAIChat, Message, MessageListResponse, MessageResponse, StatusResponse, UnreadCountResponse };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Client } from '../client.js';
|
|
2
|
+
import '../models.js';
|
|
3
|
+
import '../enums/database-type.js';
|
|
4
|
+
import '../enums/attribute-status.js';
|
|
5
|
+
import '../enums/column-status.js';
|
|
6
|
+
import '../enums/index-status.js';
|
|
7
|
+
import '../enums/deployment-status.js';
|
|
8
|
+
import '../enums/execution-trigger.js';
|
|
9
|
+
import '../enums/execution-status.js';
|
|
10
|
+
import '../enums/health-antivirus-status.js';
|
|
11
|
+
import '../enums/health-check-status.js';
|
|
12
|
+
import '../enums/message-status.js';
|
|
13
|
+
import '../query.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Eve.AI Chat Service
|
|
17
|
+
*
|
|
18
|
+
* Real-time messaging and conversation management
|
|
19
|
+
*/
|
|
20
|
+
declare class EveAIChat {
|
|
21
|
+
client: Client;
|
|
22
|
+
constructor(client: Client);
|
|
23
|
+
/**
|
|
24
|
+
* Create Conversation
|
|
25
|
+
*
|
|
26
|
+
* Start a new conversation for a task
|
|
27
|
+
*/
|
|
28
|
+
createConversation(taskId: string, participantIds: number[]): Promise<ConversationResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Get Conversation
|
|
31
|
+
*
|
|
32
|
+
* Get conversation details
|
|
33
|
+
*/
|
|
34
|
+
getConversation(conversationId: string): Promise<ConversationResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* List Conversations
|
|
37
|
+
*
|
|
38
|
+
* List all user conversations
|
|
39
|
+
*/
|
|
40
|
+
listConversations(page?: number, pageSize?: number): Promise<ConversationListResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Send Message
|
|
43
|
+
*
|
|
44
|
+
* Send a chat message
|
|
45
|
+
*/
|
|
46
|
+
sendMessage(conversationId: string, content: string, type?: string, metadata?: any): Promise<MessageResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Get Messages
|
|
49
|
+
*
|
|
50
|
+
* Get messages for a conversation
|
|
51
|
+
*/
|
|
52
|
+
getMessages(conversationId: string, page?: number, pageSize?: number): Promise<MessageListResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Mark as Read
|
|
55
|
+
*
|
|
56
|
+
* Mark messages as read
|
|
57
|
+
*/
|
|
58
|
+
markAsRead(conversationId: string, messageIds: string[]): Promise<StatusResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Get Unread Count
|
|
61
|
+
*
|
|
62
|
+
* Get total unread message count
|
|
63
|
+
*/
|
|
64
|
+
getUnreadCount(): Promise<UnreadCountResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Search Messages
|
|
67
|
+
*
|
|
68
|
+
* Search messages across conversations
|
|
69
|
+
*/
|
|
70
|
+
searchMessages(query: string, conversationId?: string): Promise<MessageListResponse>;
|
|
71
|
+
}
|
|
72
|
+
interface ConversationResponse {
|
|
73
|
+
status_code: number;
|
|
74
|
+
conversation: Conversation;
|
|
75
|
+
}
|
|
76
|
+
interface Conversation {
|
|
77
|
+
id: string;
|
|
78
|
+
task_id: string;
|
|
79
|
+
participants: number[];
|
|
80
|
+
last_message?: Message;
|
|
81
|
+
unread_count: number;
|
|
82
|
+
created_at: string;
|
|
83
|
+
updated_at: string;
|
|
84
|
+
}
|
|
85
|
+
interface ConversationListResponse {
|
|
86
|
+
status_code: number;
|
|
87
|
+
conversations: Conversation[];
|
|
88
|
+
total: number;
|
|
89
|
+
}
|
|
90
|
+
interface MessageResponse {
|
|
91
|
+
status_code: number;
|
|
92
|
+
message: Message;
|
|
93
|
+
}
|
|
94
|
+
interface Message {
|
|
95
|
+
id: string;
|
|
96
|
+
conversation_id: string;
|
|
97
|
+
sender_id: number;
|
|
98
|
+
content: string;
|
|
99
|
+
type: string;
|
|
100
|
+
metadata?: any;
|
|
101
|
+
is_read: boolean;
|
|
102
|
+
created_at: string;
|
|
103
|
+
}
|
|
104
|
+
interface MessageListResponse {
|
|
105
|
+
status_code: number;
|
|
106
|
+
messages: Message[];
|
|
107
|
+
total: number;
|
|
108
|
+
}
|
|
109
|
+
interface UnreadCountResponse {
|
|
110
|
+
status_code: number;
|
|
111
|
+
unread_count: number;
|
|
112
|
+
}
|
|
113
|
+
interface StatusResponse {
|
|
114
|
+
status_code: number;
|
|
115
|
+
status_msg: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { Conversation, ConversationListResponse, ConversationResponse, EveAIChat, Message, MessageListResponse, MessageResponse, StatusResponse, UnreadCountResponse };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class EveAIChat {
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create Conversation
|
|
9
|
+
*
|
|
10
|
+
* Start a new conversation for a task
|
|
11
|
+
*/
|
|
12
|
+
async createConversation(taskId, participantIds) {
|
|
13
|
+
const path = "/chat/conversations";
|
|
14
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
15
|
+
return await this.client.call("post", uri, {
|
|
16
|
+
"content-type": "application/json"
|
|
17
|
+
}, {
|
|
18
|
+
task_id: taskId,
|
|
19
|
+
participant_ids: participantIds
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get Conversation
|
|
24
|
+
*
|
|
25
|
+
* Get conversation details
|
|
26
|
+
*/
|
|
27
|
+
async getConversation(conversationId) {
|
|
28
|
+
const path = `/chat/conversations/${conversationId}`;
|
|
29
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
30
|
+
return await this.client.call("get", uri);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* List Conversations
|
|
34
|
+
*
|
|
35
|
+
* List all user conversations
|
|
36
|
+
*/
|
|
37
|
+
async listConversations(page = 1, pageSize = 20) {
|
|
38
|
+
const path = "/chat/conversations";
|
|
39
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
40
|
+
return await this.client.call("get", uri, {}, {
|
|
41
|
+
page,
|
|
42
|
+
page_size: pageSize
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Send Message
|
|
47
|
+
*
|
|
48
|
+
* Send a chat message
|
|
49
|
+
*/
|
|
50
|
+
async sendMessage(conversationId, content, type = "text", metadata) {
|
|
51
|
+
const path = `/chat/conversations/${conversationId}/messages`;
|
|
52
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
53
|
+
return await this.client.call("post", uri, {
|
|
54
|
+
"content-type": "application/json"
|
|
55
|
+
}, {
|
|
56
|
+
content,
|
|
57
|
+
type,
|
|
58
|
+
metadata
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get Messages
|
|
63
|
+
*
|
|
64
|
+
* Get messages for a conversation
|
|
65
|
+
*/
|
|
66
|
+
async getMessages(conversationId, page = 1, pageSize = 50) {
|
|
67
|
+
const path = `/chat/conversations/${conversationId}/messages`;
|
|
68
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
69
|
+
return await this.client.call("get", uri, {}, {
|
|
70
|
+
page,
|
|
71
|
+
page_size: pageSize
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Mark as Read
|
|
76
|
+
*
|
|
77
|
+
* Mark messages as read
|
|
78
|
+
*/
|
|
79
|
+
async markAsRead(conversationId, messageIds) {
|
|
80
|
+
const path = `/chat/conversations/${conversationId}/read`;
|
|
81
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
82
|
+
return await this.client.call("post", uri, {
|
|
83
|
+
"content-type": "application/json"
|
|
84
|
+
}, {
|
|
85
|
+
message_ids: messageIds
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get Unread Count
|
|
90
|
+
*
|
|
91
|
+
* Get total unread message count
|
|
92
|
+
*/
|
|
93
|
+
async getUnreadCount() {
|
|
94
|
+
const path = "/chat/unread";
|
|
95
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
96
|
+
return await this.client.call("get", uri);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Search Messages
|
|
100
|
+
*
|
|
101
|
+
* Search messages across conversations
|
|
102
|
+
*/
|
|
103
|
+
async searchMessages(query, conversationId) {
|
|
104
|
+
const path = "/chat/search";
|
|
105
|
+
const payload = { query };
|
|
106
|
+
if (conversationId)
|
|
107
|
+
payload.conversation_id = conversationId;
|
|
108
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
109
|
+
return await this.client.call("get", uri, {}, payload);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
exports.EveAIChat = EveAIChat;
|
|
114
|
+
//# sourceMappingURL=out.js.map
|
|
115
|
+
//# sourceMappingURL=eveai-chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/eveai-chat.ts"],"names":[],"mappings":"A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,YACF,gBACA,OAAe,GACf,WAAmB,IACS;AAC5B,UAAM,OAAO,uBAAuB,cAAc;AAClD,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,OAAO,KAAK,CAAC,GAAG;AAAA,MAC1C;AAAA,MACA,WAAW;AAAA,IACf,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,WACF,gBACA,YACuB;AACvB,UAAM,OAAO,uBAAuB,cAAc;AAClD,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,QAAQ,KAAK;AAAA,MACvC,gBAAgB;AAAA,IACpB,GAAG;AAAA,MACC,aAAa;AAAA,IACjB,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,iBAA+C;AACjD,UAAM,OAAO;AACb,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,OAAO,GAAG;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eACF,OACA,gBAC4B;AAC5B,UAAM,OAAO;AACb,UAAM,UAAe,EAAE,MAAM;AAC7B,QAAI;AAAgB,cAAQ,kBAAkB;AAE9C,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,OAAO,KAAK,CAAC,GAAG,OAAO;AAAA,EACzD;AACJ","sourcesContent":["import { Client } from '../client';\n\n/**\n * Eve.AI Chat Service\n * \n * Real-time messaging and conversation management\n */\nexport class EveAIChat {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Create Conversation\n * \n * Start a new conversation for a task\n */\n async createConversation(\n taskId: string,\n participantIds: number[]\n ): Promise<ConversationResponse> {\n const path = '/chat/conversations';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n task_id: taskId,\n participant_ids: participantIds\n });\n }\n\n /**\n * Get Conversation\n * \n * Get conversation details\n */\n async getConversation(conversationId: string): Promise<ConversationResponse> {\n const path = `/chat/conversations/${conversationId}`;\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri);\n }\n\n /**\n * List Conversations\n * \n * List all user conversations\n */\n async listConversations(\n page: number = 1,\n pageSize: number = 20\n ): Promise<ConversationListResponse> {\n const path = '/chat/conversations';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri, {}, {\n page,\n page_size: pageSize\n });\n }\n\n /**\n * Send Message\n * \n * Send a chat message\n */\n async sendMessage(\n conversationId: string,\n content: string,\n type: string = 'text',\n metadata?: any\n ): Promise<MessageResponse> {\n const path = `/chat/conversations/${conversationId}/messages`;\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n content,\n type,\n metadata\n });\n }\n\n /**\n * Get Messages\n * \n * Get messages for a conversation\n */\n async getMessages(\n conversationId: string,\n page: number = 1,\n pageSize: number = 50\n ): Promise<MessageListResponse> {\n const path = `/chat/conversations/${conversationId}/messages`;\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri, {}, {\n page,\n page_size: pageSize\n });\n }\n\n /**\n * Mark as Read\n * \n * Mark messages as read\n */\n async markAsRead(\n conversationId: string,\n messageIds: string[]\n ): Promise<StatusResponse> {\n const path = `/chat/conversations/${conversationId}/read`;\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n message_ids: messageIds\n });\n }\n\n /**\n * Get Unread Count\n * \n * Get total unread message count\n */\n async getUnreadCount(): Promise<UnreadCountResponse> {\n const path = '/chat/unread';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri);\n }\n\n /**\n * Search Messages\n * \n * Search messages across conversations\n */\n async searchMessages(\n query: string,\n conversationId?: string\n ): Promise<MessageListResponse> {\n const path = '/chat/search';\n const payload: any = { query };\n if (conversationId) payload.conversation_id = conversationId;\n\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri, {}, payload);\n }\n}\n\n// Types\nexport interface ConversationResponse {\n status_code: number;\n conversation: Conversation;\n}\n\nexport interface Conversation {\n id: string;\n task_id: string;\n participants: number[];\n last_message?: Message;\n unread_count: number;\n created_at: string;\n updated_at: string;\n}\n\nexport interface ConversationListResponse {\n status_code: number;\n conversations: Conversation[];\n total: number;\n}\n\nexport interface MessageResponse {\n status_code: number;\n message: Message;\n}\n\nexport interface Message {\n id: string;\n conversation_id: string;\n sender_id: number;\n content: string;\n type: string;\n metadata?: any;\n is_read: boolean;\n created_at: string;\n}\n\nexport interface MessageListResponse {\n status_code: number;\n messages: Message[];\n total: number;\n}\n\nexport interface UnreadCountResponse {\n status_code: number;\n unread_count: number;\n}\n\nexport interface StatusResponse {\n status_code: number;\n status_msg: string;\n}\n"]}
|