@n8n_io/ai-assistant-sdk
Advanced tools
Comparing version 1.10.2 to 1.10.3
# Changelog | ||
## [1.10.3](https://github.com/n8n-io/ai-assistant-service/compare/ai-assistant-sdk-v1.10.2...ai-assistant-sdk-v1.10.3) (2024-10-03) | ||
### Bug Fixes | ||
* Add type assertion to `askAi` method ([#176](https://github.com/n8n-io/ai-assistant-service/issues/176)) ([96e5673](https://github.com/n8n-io/ai-assistant-service/commit/96e5673276c06f9a912991276a5f58d161c125e0)) | ||
## [1.10.2](https://github.com/n8n-io/ai-assistant-service/compare/ai-assistant-sdk-v1.10.1...ai-assistant-sdk-v1.10.2) (2024-10-02) | ||
@@ -4,0 +11,0 @@ |
@@ -30,3 +30,3 @@ "use strict"; | ||
name: "@n8n_io/ai-assistant-sdk", | ||
version: "1.10.2", | ||
version: "1.10.3", | ||
description: "n8n AI assistant SDK", | ||
@@ -64,5 +64,2 @@ author: "", | ||
typescript: "^5.5.3" | ||
}, | ||
dependencies: { | ||
undici: "^6.19.8" | ||
} | ||
@@ -112,3 +109,3 @@ }; | ||
const data = await response.json(); | ||
if (isValidResponse(data)) { | ||
if (isValidApplySuggestionResponse(data)) { | ||
return data; | ||
@@ -122,3 +119,6 @@ } | ||
const data = await response.json(); | ||
return data; | ||
if (isValidAskAiResponse(data)) { | ||
return data; | ||
} | ||
throw new Error("Invalid response from assistant service"); | ||
} | ||
@@ -186,5 +186,8 @@ } | ||
} | ||
function isValidResponse(response) { | ||
function isValidApplySuggestionResponse(response) { | ||
return typeof response === "object" && !!response && "parameters" in response && "sessionId" in response; | ||
} | ||
function isValidAskAiResponse(response) { | ||
return typeof response === "object" && !!response && "code" in response; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -191,0 +194,0 @@ 0 && (module.exports = { |
{ | ||
"name": "@n8n_io/ai-assistant-sdk", | ||
"version": "1.10.2", | ||
"version": "1.10.3", | ||
"description": "n8n AI assistant SDK", | ||
@@ -27,5 +27,2 @@ "author": "", | ||
}, | ||
"dependencies": { | ||
"undici": "^6.19.8" | ||
}, | ||
"scripts": { | ||
@@ -32,0 +29,0 @@ "typecheck": "tsc --noEmit", |
@@ -113,3 +113,3 @@ import packageJson from '../package.json'; | ||
const data = await response.json(); | ||
if (isValidResponse(data)) { | ||
if (isValidApplySuggestionResponse(data)) { | ||
return data; | ||
@@ -130,3 +130,7 @@ } | ||
return data; | ||
if (isValidAskAiResponse(data)) { | ||
return data; | ||
} | ||
throw new Error('Invalid response from assistant service'); | ||
} | ||
@@ -220,3 +224,5 @@ } | ||
function isValidResponse(response: unknown): response is AiAssistantSDK.ApplySuggestionResponse { | ||
function isValidApplySuggestionResponse( | ||
response: unknown, | ||
): response is AiAssistantSDK.ApplySuggestionResponse { | ||
return ( | ||
@@ -229,1 +235,5 @@ typeof response === 'object' && | ||
} | ||
function isValidAskAiResponse(response: unknown): response is AiAssistantSDK.AskAiResponsePayload { | ||
return typeof response === 'object' && !!response && 'code' in response; | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38629
0
945
- Removedundici@^6.19.8
- Removedundici@6.21.0(transitive)