@cognigy/rest-api-client 2025.17.0 → 2025.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -3
- package/build/authentication/AuthenticationAPI.js +1 -1
- package/build/authentication/OAuth2/OAuth2Authentication.js +10 -9
- package/build/connector/AxiosAdapter.js +2 -1
- package/build/shared/charts/descriptors/data/code.js +1 -1
- package/build/shared/charts/descriptors/logic/goTo.js +2 -2
- package/build/shared/charts/descriptors/service/GPTPrompt.js +2 -2
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +2 -2
- package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +2 -2
- package/build/shared/errors/codes.js +2 -1
- package/build/shared/errors/invalidArgument.js +4 -0
- package/build/shared/errors/missingArgument.js +4 -0
- package/build/shared/generativeAI/utils/generativeAIPrompts.js +24 -587
- package/build/shared/generativeAI/utils/prompts/flowGeneration.js +168 -0
- package/build/shared/generativeAI/utils/prompts/generateNodeOutput.js +39 -0
- package/build/shared/generativeAI/utils/prompts/intentSentenceGeneration.js +15 -0
- package/build/shared/generativeAI/utils/prompts/lexiconGeneration.js +22 -0
- package/build/shared/generativeAI/utils/prompts/rephraseSentences.js +86 -0
- package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +4 -0
- package/build/shared/interfaces/messageAPI/endpoints.js +3 -2
- package/build/shared/interfaces/resources/IKnowledgeDescriptor.js +9 -8
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +87 -77
- package/build/shared/interfaces/resources/TResourceType.js +1 -0
- package/dist/esm/authentication/AuthenticationAPI.js +1 -1
- package/dist/esm/authentication/OAuth2/OAuth2Authentication.js +10 -9
- package/dist/esm/connector/AxiosAdapter.js +2 -1
- package/dist/esm/shared/charts/descriptors/data/code.js +1 -1
- package/dist/esm/shared/charts/descriptors/logic/goTo.js +2 -2
- package/dist/esm/shared/charts/descriptors/service/GPTPrompt.js +1 -1
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +1 -1
- package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +1 -1
- package/dist/esm/shared/errors/codes.js +1 -0
- package/dist/esm/shared/errors/invalidArgument.js +4 -0
- package/dist/esm/shared/errors/missingArgument.js +4 -0
- package/dist/esm/shared/generativeAI/utils/generativeAIPrompts.js +23 -586
- package/dist/esm/shared/generativeAI/utils/prompts/flowGeneration.js +165 -0
- package/dist/esm/shared/generativeAI/utils/prompts/generateNodeOutput.js +36 -0
- package/dist/esm/shared/generativeAI/utils/prompts/intentSentenceGeneration.js +12 -0
- package/dist/esm/shared/generativeAI/utils/prompts/lexiconGeneration.js +19 -0
- package/dist/esm/shared/generativeAI/utils/prompts/rephraseSentences.js +83 -0
- package/dist/esm/shared/interfaces/generativeAI/IGenerativeAIModels.js +4 -0
- package/dist/esm/shared/interfaces/messageAPI/endpoints.js +3 -2
- package/dist/esm/shared/interfaces/resources/IKnowledgeDescriptor.js +10 -9
- package/dist/esm/shared/interfaces/resources/INodeDescriptorSet.js +88 -78
- package/dist/esm/shared/interfaces/resources/TResourceType.js +1 -0
- package/package.json +1 -1
- package/types/index.d.ts +74 -34
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
# 2025.
|
|
2
|
-
Released:
|
|
1
|
+
# 2025.18.1
|
|
2
|
+
Released: September 04th, 2025
|
|
3
|
+
|
|
4
|
+
Released state of package up to date with Cognigy.AI v2025.18.0
|
|
5
|
+
|
|
6
|
+
- Changes for allowing cookies to be sent with authentication requests
|
|
3
7
|
|
|
4
|
-
|
|
8
|
+
# 2025.18.0
|
|
9
|
+
Released: September 02nd, 2025
|
|
10
|
+
|
|
11
|
+
Released state of package up to date with Cognigy.AI v2025.18.0
|
|
12
|
+
|
|
13
|
+
# 2025.17.0
|
|
14
|
+
Released: August 21st, 2025
|
|
5
15
|
|
|
16
|
+
Released state of package up to date with Cognigy.AI v2025.17.0
|
|
17
|
+
|
|
6
18
|
# 2025.16.0
|
|
7
19
|
Released: August 05th, 2025
|
|
8
20
|
|
|
@@ -66,7 +66,7 @@ function AuthenticationAPI(instance) {
|
|
|
66
66
|
},
|
|
67
67
|
exchangeOneTimeTokenForRefreshToken: (_a, options) => {
|
|
68
68
|
var { loginToken } = _a, args = __rest(_a, ["loginToken"]);
|
|
69
|
-
return (0, GenericAPIFn_1.GenericAPIFn)(`/auth/exchangetoken?${(0, rest_1.stringifyQuery)({ loginToken })}`, "GET", self)(args, Object.assign({ withAuthentication: false }, options));
|
|
69
|
+
return (0, GenericAPIFn_1.GenericAPIFn)(`/auth/exchangetoken?${(0, rest_1.stringifyQuery)({ loginToken })}`, "GET", self)(args, Object.assign({ withAuthentication: false, withCredentials: true }, options));
|
|
70
70
|
},
|
|
71
71
|
generateManagementUIAuthToken: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/management/auth/token", "POST", self)(args, options)
|
|
72
72
|
};
|
|
@@ -4,7 +4,6 @@ exports.OAuth2Authentication = void 0;
|
|
|
4
4
|
/* Custom Modules */
|
|
5
5
|
const OAuth2Error_1 = require("./OAuth2Error");
|
|
6
6
|
const HttpStatusCode_1 = require("../../shared/helper/HttpStatusCode");
|
|
7
|
-
const errors_1 = require("../../shared/errors");
|
|
8
7
|
const IOAuth2ErrorResponse_1 = require("./IOAuth2ErrorResponse");
|
|
9
8
|
const expiryBuffer = 8;
|
|
10
9
|
exports.OAuth2Authentication = function (credentials, self) {
|
|
@@ -29,7 +28,8 @@ exports.OAuth2Authentication = function (credentials, self) {
|
|
|
29
28
|
};
|
|
30
29
|
return await request(formFields, {
|
|
31
30
|
maxRetries: Infinity,
|
|
32
|
-
retryDelay: () => 3000
|
|
31
|
+
retryDelay: () => 3000,
|
|
32
|
+
withCredentials: true
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
const request = async (formFields, options) => {
|
|
@@ -84,6 +84,8 @@ exports.OAuth2Authentication = function (credentials, self) {
|
|
|
84
84
|
OAuth2Authentication.prototype.login = async (parameters) => {
|
|
85
85
|
const { clientId, clientSecret } = self.credentials;
|
|
86
86
|
switch (parameters.type) {
|
|
87
|
+
// Password Grant is deprecated in OAuth2, but still supported
|
|
88
|
+
// for api and e2e tests
|
|
87
89
|
case "password":
|
|
88
90
|
{
|
|
89
91
|
const { username, password, rememberMe, organisationId } = parameters;
|
|
@@ -115,17 +117,19 @@ exports.OAuth2Authentication = function (credentials, self) {
|
|
|
115
117
|
break;
|
|
116
118
|
case "authorizationCode":
|
|
117
119
|
{
|
|
118
|
-
const { code, redirectUri, codeVerifier } = parameters;
|
|
120
|
+
const { code, redirectUri, codeVerifier, rememberMe } = parameters;
|
|
119
121
|
const formFields = {
|
|
120
122
|
grant_type: "authorization_code",
|
|
121
123
|
client_id: clientId,
|
|
122
124
|
client_secret: clientSecret,
|
|
123
125
|
code,
|
|
124
126
|
redirect_uri: redirectUri,
|
|
127
|
+
rememberMe,
|
|
125
128
|
code_verifier: codeVerifier
|
|
126
129
|
};
|
|
127
130
|
self.tokenData = await request(formFields, {
|
|
128
|
-
maxRetries: 0
|
|
131
|
+
maxRetries: 0,
|
|
132
|
+
withCredentials: true
|
|
129
133
|
});
|
|
130
134
|
}
|
|
131
135
|
break;
|
|
@@ -177,9 +181,6 @@ exports.OAuth2Authentication = function (credentials, self) {
|
|
|
177
181
|
*/
|
|
178
182
|
if (isAccessTokenExpired(self.tokenData)) {
|
|
179
183
|
const credentials = self.credentials;
|
|
180
|
-
if (!self.tokenData.refresh_token) {
|
|
181
|
-
throw new errors_1.UnauthorizedError("No RefreshToken provided.");
|
|
182
|
-
}
|
|
183
184
|
if (self.refreshTokenSingleton === null) {
|
|
184
185
|
self.refreshTokenSingleton = new Promise((resolve, reject) => {
|
|
185
186
|
refreshTokenGrant({
|
|
@@ -219,8 +220,7 @@ exports.OAuth2Authentication = function (credentials, self) {
|
|
|
219
220
|
};
|
|
220
221
|
OAuth2Authentication.prototype.logout = async () => {
|
|
221
222
|
if ((self === null || self === void 0 ? void 0 : self.credentials.type) ===
|
|
222
|
-
"OAuth2"
|
|
223
|
-
self.tokenData.refresh_token) {
|
|
223
|
+
"OAuth2") {
|
|
224
224
|
const httpAdapter = self.getHttpAdapter();
|
|
225
225
|
const requestData = {
|
|
226
226
|
method: "POST",
|
|
@@ -229,6 +229,7 @@ exports.OAuth2Authentication = function (credentials, self) {
|
|
|
229
229
|
token: self.tokenData.refresh_token
|
|
230
230
|
},
|
|
231
231
|
maxRetries: 3,
|
|
232
|
+
withCredentials: true,
|
|
232
233
|
retryDelay: () => 0
|
|
233
234
|
};
|
|
234
235
|
// reset tokenData to avoid multiple revoke calls
|
|
@@ -76,13 +76,14 @@ class AxiosAdapter {
|
|
|
76
76
|
return this.request(Object.assign(Object.assign({}, request), { method: "HEAD" }), client);
|
|
77
77
|
}
|
|
78
78
|
async convertRequest(request, client) {
|
|
79
|
-
var _a;
|
|
79
|
+
var _a, _b;
|
|
80
80
|
const baseUrl = (_a = request.baseUrl) !== null && _a !== void 0 ? _a : this.config.baseUrl;
|
|
81
81
|
const axiosRequest = {
|
|
82
82
|
data: request.data,
|
|
83
83
|
headers: request.headers,
|
|
84
84
|
method: request.method || "GET",
|
|
85
85
|
url: `${baseUrl}${request.url}`,
|
|
86
|
+
withCredentials: (_b = request.withCredentials) !== null && _b !== void 0 ? _b : false,
|
|
86
87
|
validateStatus: (status) => !(0, isRetryableStatus_1.isRetryableStatus)(status)
|
|
87
88
|
};
|
|
88
89
|
if (typeof request.onProgress === "function") {
|
|
@@ -29,7 +29,7 @@ exports.CODE = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
29
29
|
function: async (codeParams) => {
|
|
30
30
|
const { cognigy } = codeParams;
|
|
31
31
|
const { api } = cognigy;
|
|
32
|
-
api.executeCodeInSecureContext(codeParams);
|
|
32
|
+
await api.executeCodeInSecureContext(codeParams);
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
//# sourceMappingURL=code.js.map
|
|
@@ -134,12 +134,12 @@ exports.GO_TO = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
134
134
|
}
|
|
135
135
|
if (!api.checkThink(thisNodeId)) {
|
|
136
136
|
api.resetNextNodes();
|
|
137
|
-
api.setThinkMarker(
|
|
137
|
+
api.setThinkMarker(flowId);
|
|
138
138
|
// Check if execution is to wait at Node for Input
|
|
139
139
|
if (executionMode === "wait") {
|
|
140
140
|
// only set the next node if the execution mode is "wait",
|
|
141
141
|
// otherwise input after the goto node would again go to this node, and not to the start node
|
|
142
|
-
await api.goToNode(config.flowNode);
|
|
142
|
+
await api.goToNode({ flowNode: config.flowNode, absorbContext });
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
if (injectedText) {
|
|
@@ -4,7 +4,7 @@ exports.GPT_PROMPT = void 0;
|
|
|
4
4
|
/* Custom modules */
|
|
5
5
|
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
6
6
|
const logic_1 = require("../logic");
|
|
7
|
-
const
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
8
|
const prompt_1 = require("../nlu/generativeSlotFiller/prompt");
|
|
9
9
|
const errors_1 = require("../../../errors");
|
|
10
10
|
const transcripts_1 = require("../../../interfaces/transcripts/transcripts");
|
|
@@ -660,7 +660,7 @@ exports.GPT_PROMPT = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
660
660
|
};
|
|
661
661
|
try {
|
|
662
662
|
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
663
|
-
const _messageId = (0,
|
|
663
|
+
const _messageId = (0, uuid_1.v4)();
|
|
664
664
|
const data = {
|
|
665
665
|
prompt,
|
|
666
666
|
temperature,
|
|
@@ -14,7 +14,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.AI_AGENT_JOB = exports.AI_AGENT_TOOLS_WHITELIST = void 0;
|
|
15
15
|
/* Custom modules */
|
|
16
16
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
17
|
-
const crypto_1 = require("crypto");
|
|
18
17
|
const setSessionConfig_mapper_1 = require("../../voice/mappers/setSessionConfig.mapper");
|
|
19
18
|
const setSessionConfig_mapper_2 = require("../../voice/mappers/setSessionConfig.mapper");
|
|
20
19
|
const logFullConfigToDebugMode_1 = require("../../../../helper/logFullConfigToDebugMode");
|
|
@@ -22,6 +21,7 @@ const createSystemMessage_1 = require("./helpers/createSystemMessage");
|
|
|
22
21
|
const generateSearchPrompt_1 = require("./helpers/generateSearchPrompt");
|
|
23
22
|
const getUserMemory_1 = require("./helpers/getUserMemory");
|
|
24
23
|
const createToolDefinitions_1 = require("./helpers/createToolDefinitions");
|
|
24
|
+
const uuid_1 = require("uuid");
|
|
25
25
|
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
26
26
|
exports.AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool"];
|
|
27
27
|
exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
@@ -1163,7 +1163,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1163
1163
|
transcript[transcript.length - 1].payload.text = enhancedInput;
|
|
1164
1164
|
}
|
|
1165
1165
|
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
1166
|
-
const _messageId = (0,
|
|
1166
|
+
const _messageId = (0, uuid_1.v4)();
|
|
1167
1167
|
const llmPromptOptions = Object.assign(Object.assign({ prompt: "", chat: systemMessage,
|
|
1168
1168
|
// Temp fix to override the transcript if needed
|
|
1169
1169
|
transcript: ((_0 = context === null || context === void 0 ? void 0 : context._cognigy) === null || _0 === void 0 ? void 0 : _0.transcript) ? [...context._cognigy.transcript] : transcript, detailedResults: true, timeoutInMs: timeoutInMs !== null && timeoutInMs !== void 0 ? timeoutInMs : 8000, maxTokens: maxTokens !== null && maxTokens !== void 0 ? maxTokens : 4000, temperature: temperature !== null && temperature !== void 0 ? temperature : 0.7, topP: 1, frequencyPenalty: 0, presencePenalty: 0, responseFormat: "text", stream: storeLocation === "stream", streamOnDataHandler: (text) => {
|
|
@@ -15,8 +15,8 @@ exports.LLM_PROMPT_V2 = void 0;
|
|
|
15
15
|
/* Custom modules */
|
|
16
16
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
17
17
|
const logic_1 = require("../../logic");
|
|
18
|
-
const crypto_1 = require("crypto");
|
|
19
18
|
const createToolDefinitions_1 = require("../aiAgent/helpers/createToolDefinitions");
|
|
19
|
+
const uuid_1 = require("uuid");
|
|
20
20
|
const prompt_1 = require("../../nlu/generativeSlotFiller/prompt");
|
|
21
21
|
const errors_1 = require("../../../../errors");
|
|
22
22
|
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
@@ -736,7 +736,7 @@ exports.LLM_PROMPT_V2 = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
736
736
|
};
|
|
737
737
|
try {
|
|
738
738
|
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
739
|
-
const _messageId = (0,
|
|
739
|
+
const _messageId = (0, uuid_1.v4)();
|
|
740
740
|
// Start measuring LLM latency and time to first output if debug flag is enabled
|
|
741
741
|
let firstOutputTime = null;
|
|
742
742
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TOO_MANY_REQUESTS_ERROR = exports.GATEWAY_TIMEOUT_ERROR = exports.BAD_GATEWAY_ERROR = exports.FORBIDDEN_ERROR = exports.PAYLOAD_TOO_LARGE_ERROR = exports.UNAUTHORIZED_ERROR = exports.TIMEOUT_ERROR = exports.INPUT_OUTPUT_ERROR = exports.DATABASE_QUERY_ERROR = exports.DATABASE_CONNECT_ERROR = exports.SMTP_CONNECT_ERROR = exports.METHOD_NOT_ALLOWED_ERROR = exports.FILE_WRITE_ERROR = exports.FILE_READ_ERROR = exports.PROCESS_ERROR = exports.NOT_IMPLEMENTED_ERROR = exports.INTERNAL_SERVER_ERROR = exports.EXPORT_ERROR = exports.IMPORT_ERROR = exports.INVALID_ARGUMENT_ERROR = exports.CONFLICT_ERROR = exports.DATABASE_READ_ERROR = exports.RESOURCE_NOT_FOUND_ERROR = exports.DATABASE_WRITE_ERROR = exports.MISSING_ARGUMENT_ERROR = void 0;
|
|
3
|
+
exports.TOO_MANY_REQUESTS_ERROR = exports.GATEWAY_TIMEOUT_ERROR = exports.BAD_GATEWAY_ERROR = exports.FORBIDDEN_ERROR = exports.PAYLOAD_TOO_LARGE_ERROR = exports.UNAUTHORIZED_ERROR = exports.TIMEOUT_ERROR = exports.INPUT_OUTPUT_ERROR = exports.DATABASE_QUERY_ERROR = exports.DATABASE_CONNECT_ERROR = exports.SMTP_CONNECT_ERROR = exports.METHOD_NOT_ALLOWED_ERROR = exports.FILE_WRITE_ERROR = exports.FILE_READ_ERROR = exports.PROCESS_ERROR = exports.NOT_IMPLEMENTED_ERROR = exports.INTERNAL_SERVER_ERROR = exports.EXPORT_ERROR = exports.IMPORT_ERROR = exports.INVALID_ARGUMENT_ERROR = exports.CONFLICT_ERROR = exports.DATABASE_READ_ERROR = exports.RESOURCE_NOT_FOUND_ERROR = exports.DATABASE_WRITE_ERROR = exports.MISSING_ARGUMENT_ERROR = exports.BAD_REQUEST_ERROR = void 0;
|
|
4
4
|
const ErrorCode_1 = require("./ErrorCode");
|
|
5
|
+
exports.BAD_REQUEST_ERROR = ErrorCode_1.ErrorCode.BAD_REQUEST;
|
|
5
6
|
exports.MISSING_ARGUMENT_ERROR = ErrorCode_1.ErrorCode.MISSING_ARGUMENT_ERROR;
|
|
6
7
|
exports.DATABASE_WRITE_ERROR = ErrorCode_1.ErrorCode.DATABASE_WRITE_ERROR;
|
|
7
8
|
exports.RESOURCE_NOT_FOUND_ERROR = ErrorCode_1.ErrorCode.RESOURCE_NOT_FOUND_ERROR;
|
|
@@ -10,6 +10,10 @@ class InvalidArgumentError extends BadRequestError_1.BadRequestError {
|
|
|
10
10
|
this.name = "Invalid Argument Error";
|
|
11
11
|
this.code = ErrorCode_1.ErrorCode.INVALID_ARGUMENT_ERROR;
|
|
12
12
|
}
|
|
13
|
+
toRFC7807Response(data) {
|
|
14
|
+
const baseResponse = super.toRFC7807Response(data);
|
|
15
|
+
return Object.assign(Object.assign({}, baseResponse), { type: "Bad Request" });
|
|
16
|
+
}
|
|
13
17
|
}
|
|
14
18
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
15
19
|
//# sourceMappingURL=invalidArgument.js.map
|
|
@@ -10,6 +10,10 @@ class MissingArgumentError extends BadRequestError_1.BadRequestError {
|
|
|
10
10
|
this.name = "Missing Argument Error";
|
|
11
11
|
this.code = ErrorCode_1.ErrorCode.MISSING_ARGUMENT_ERROR;
|
|
12
12
|
}
|
|
13
|
+
toRFC7807Response(data) {
|
|
14
|
+
const baseResponse = super.toRFC7807Response(data);
|
|
15
|
+
return Object.assign(Object.assign({}, baseResponse), { type: "Bad Request" });
|
|
16
|
+
}
|
|
13
17
|
}
|
|
14
18
|
exports.MissingArgumentError = MissingArgumentError;
|
|
15
19
|
//# sourceMappingURL=missingArgument.js.map
|