@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
|
@@ -12,8 +12,8 @@ const nodeAppearanceSchema = {
|
|
|
12
12
|
textColor: { type: "string", format: "color" },
|
|
13
13
|
contrastTextColor: { type: "string", format: "color" },
|
|
14
14
|
showIcon: { type: "boolean" },
|
|
15
|
-
variant: { type: "string", enum: ["regular", "mini", "hexagon"] }
|
|
16
|
-
}
|
|
15
|
+
variant: { type: "string", enum: ["regular", "mini", "hexagon"] }
|
|
16
|
+
}
|
|
17
17
|
};
|
|
18
18
|
const nodeBehaviorSchema = {
|
|
19
19
|
title: "nodeBehaviorSchema",
|
|
@@ -21,8 +21,8 @@ const nodeBehaviorSchema = {
|
|
|
21
21
|
additionalProperties: false,
|
|
22
22
|
properties: {
|
|
23
23
|
stopping: { type: "boolean" },
|
|
24
|
-
entrypoint: { type: "boolean" }
|
|
25
|
-
}
|
|
24
|
+
entrypoint: { type: "boolean" }
|
|
25
|
+
}
|
|
26
26
|
};
|
|
27
27
|
exports.nodePreviewTypes = [
|
|
28
28
|
"text",
|
|
@@ -38,8 +38,8 @@ const nodePreviewSchema = {
|
|
|
38
38
|
additionalProperties: false,
|
|
39
39
|
properties: {
|
|
40
40
|
key: { type: "string", minLength: 1, maxLength: 200 },
|
|
41
|
-
type: { type: "string", enum: [...exports.nodePreviewTypes] }
|
|
42
|
-
}
|
|
41
|
+
type: { type: "string", enum: [...exports.nodePreviewTypes] }
|
|
42
|
+
}
|
|
43
43
|
};
|
|
44
44
|
const nodeConstraintSchema = {
|
|
45
45
|
title: "nodeConstraintSchema",
|
|
@@ -48,13 +48,13 @@ const nodeConstraintSchema = {
|
|
|
48
48
|
properties: {
|
|
49
49
|
blacklist: {
|
|
50
50
|
type: "array",
|
|
51
|
-
items: { type: "string", minLength: 1, maxLength: 200 }
|
|
51
|
+
items: { type: "string", minLength: 1, maxLength: 200 }
|
|
52
52
|
},
|
|
53
53
|
whitelist: {
|
|
54
54
|
type: "array",
|
|
55
|
-
items: { type: "string", minLength: 1, maxLength: 200 }
|
|
56
|
-
}
|
|
57
|
-
}
|
|
55
|
+
items: { type: "string", minLength: 1, maxLength: 200 }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
58
|
};
|
|
59
59
|
const nodeConstraintsSchema = {
|
|
60
60
|
title: "nodeConstraintsSchema",
|
|
@@ -73,10 +73,10 @@ const nodeConstraintsSchema = {
|
|
|
73
73
|
properties: {
|
|
74
74
|
children: nodeConstraintSchema,
|
|
75
75
|
predecessor: nodeConstraintSchema,
|
|
76
|
-
successor: nodeConstraintSchema
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
76
|
+
successor: nodeConstraintSchema
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
80
|
};
|
|
81
81
|
const nodeDependenciesSchema = {
|
|
82
82
|
title: "nodeDependenciesSchema",
|
|
@@ -85,9 +85,9 @@ const nodeDependenciesSchema = {
|
|
|
85
85
|
properties: {
|
|
86
86
|
children: {
|
|
87
87
|
type: "array",
|
|
88
|
-
items: { type: "string", minLength: 1, maxLength: 200 }
|
|
89
|
-
}
|
|
90
|
-
}
|
|
88
|
+
items: { type: "string", minLength: 1, maxLength: 200 }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
91
|
};
|
|
92
92
|
exports.nodeFieldTypes = [
|
|
93
93
|
"adaptivecard",
|
|
@@ -157,7 +157,7 @@ exports.searchableNodeFieldTypes = [
|
|
|
157
157
|
"say",
|
|
158
158
|
"code",
|
|
159
159
|
"caseNode",
|
|
160
|
-
"select"
|
|
160
|
+
"select"
|
|
161
161
|
];
|
|
162
162
|
exports.nodeFieldSingleConditionSchema = {
|
|
163
163
|
title: "nodeFieldSingleConditionSchema",
|
|
@@ -174,11 +174,11 @@ exports.nodeFieldSingleConditionSchema = {
|
|
|
174
174
|
{ type: "number" },
|
|
175
175
|
{ type: "array", items: { type: "number" } },
|
|
176
176
|
{ type: "boolean" },
|
|
177
|
-
{ type: "array", items: { type: "boolean" } }
|
|
178
|
-
]
|
|
177
|
+
{ type: "array", items: { type: "boolean" } }
|
|
178
|
+
]
|
|
179
179
|
},
|
|
180
|
-
negate: { type: "boolean" }
|
|
181
|
-
}
|
|
180
|
+
negate: { type: "boolean" }
|
|
181
|
+
}
|
|
182
182
|
};
|
|
183
183
|
exports.nodeFieldANDConditionSchema = {
|
|
184
184
|
title: "nodeFieldANDConditionSchema",
|
|
@@ -186,8 +186,8 @@ exports.nodeFieldANDConditionSchema = {
|
|
|
186
186
|
additionalProperties: false,
|
|
187
187
|
required: ["and"],
|
|
188
188
|
properties: {
|
|
189
|
-
and: { type: "array", items: { $ref: "nodeFieldConditionSchema" } }
|
|
190
|
-
}
|
|
189
|
+
and: { type: "array", items: { $ref: "nodeFieldConditionSchema" } }
|
|
190
|
+
}
|
|
191
191
|
};
|
|
192
192
|
exports.nodeFieldORConditionSchema = {
|
|
193
193
|
title: "nodeFieldORConditionSchema",
|
|
@@ -195,8 +195,8 @@ exports.nodeFieldORConditionSchema = {
|
|
|
195
195
|
additionalProperties: false,
|
|
196
196
|
required: ["or"],
|
|
197
197
|
properties: {
|
|
198
|
-
or: { type: "array", items: { $ref: "nodeFieldConditionSchema" } }
|
|
199
|
-
}
|
|
198
|
+
or: { type: "array", items: { $ref: "nodeFieldConditionSchema" } }
|
|
199
|
+
}
|
|
200
200
|
};
|
|
201
201
|
// @ts-ignore
|
|
202
202
|
exports.nodeFieldConditionSchema = {
|
|
@@ -209,8 +209,8 @@ exports.nodeFieldConditionSchema = {
|
|
|
209
209
|
// @ts-ignore
|
|
210
210
|
exports.nodeFieldANDConditionSchema,
|
|
211
211
|
// @ts-ignore
|
|
212
|
-
exports.nodeFieldORConditionSchema
|
|
213
|
-
]
|
|
212
|
+
exports.nodeFieldORConditionSchema
|
|
213
|
+
]
|
|
214
214
|
};
|
|
215
215
|
exports.nodeOptionsResolverSchema = {
|
|
216
216
|
title: "nodeOptionsResolverSchema",
|
|
@@ -219,10 +219,10 @@ exports.nodeOptionsResolverSchema = {
|
|
|
219
219
|
properties: {
|
|
220
220
|
dependencies: {
|
|
221
221
|
type: "array",
|
|
222
|
-
items: { type: "string", minLength: 1, maxLength: 200 }
|
|
222
|
+
items: { type: "string", minLength: 1, maxLength: 200 }
|
|
223
223
|
},
|
|
224
|
-
resolverFunction: {}
|
|
225
|
-
}
|
|
224
|
+
resolverFunction: {}
|
|
225
|
+
}
|
|
226
226
|
};
|
|
227
227
|
exports.nodeFieldSchema = {
|
|
228
228
|
title: "nodeFieldSchema",
|
|
@@ -243,10 +243,10 @@ exports.nodeFieldSchema = {
|
|
|
243
243
|
deDE: { type: "string", maxLength: 200 },
|
|
244
244
|
jaJP: { type: "string", maxLength: 200 },
|
|
245
245
|
esES: { type: "string", maxLength: 200 },
|
|
246
|
-
koKR: { type: "string", maxLength: 200 }
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
]
|
|
246
|
+
koKR: { type: "string", maxLength: 200 }
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
250
|
},
|
|
251
251
|
condition: exports.nodeFieldConditionSchema,
|
|
252
252
|
defaultValue: {
|
|
@@ -256,8 +256,18 @@ exports.nodeFieldSchema = {
|
|
|
256
256
|
{ type: "number" },
|
|
257
257
|
{ type: "null" },
|
|
258
258
|
{ type: "object" },
|
|
259
|
-
{ type: "string" }
|
|
260
|
-
]
|
|
259
|
+
{ type: "string" }
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
fallbackValue: {
|
|
263
|
+
oneOf: [
|
|
264
|
+
{ type: "array" },
|
|
265
|
+
{ type: "boolean" },
|
|
266
|
+
{ type: "number" },
|
|
267
|
+
{ type: "null" },
|
|
268
|
+
{ type: "object" },
|
|
269
|
+
{ type: "string" }
|
|
270
|
+
]
|
|
261
271
|
},
|
|
262
272
|
description: {
|
|
263
273
|
oneOf: [
|
|
@@ -271,10 +281,10 @@ exports.nodeFieldSchema = {
|
|
|
271
281
|
deDE: { type: "string", maxLength: 200 },
|
|
272
282
|
jaJP: { type: "string", maxLength: 200 },
|
|
273
283
|
esES: { type: "string", maxLength: 200 },
|
|
274
|
-
koKR: { type: "string", maxLength: 200 }
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
]
|
|
284
|
+
koKR: { type: "string", maxLength: 200 }
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
]
|
|
278
288
|
},
|
|
279
289
|
params: { type: "object" },
|
|
280
290
|
optionsResolver: exports.nodeOptionsResolverSchema,
|
|
@@ -285,11 +295,11 @@ exports.nodeFieldSchema = {
|
|
|
285
295
|
lookupValue: { type: "string" },
|
|
286
296
|
fieldsToReset: {
|
|
287
297
|
type: "array",
|
|
288
|
-
items: { type: "string" }
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
298
|
+
items: { type: "string" }
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
293
303
|
};
|
|
294
304
|
exports.nodeSectionSchema = {
|
|
295
305
|
title: "nodeSectionSchema",
|
|
@@ -309,10 +319,10 @@ exports.nodeSectionSchema = {
|
|
|
309
319
|
deDE: { type: "string", maxLength: 200 },
|
|
310
320
|
jaJP: { type: "string", maxLength: 200 },
|
|
311
321
|
esES: { type: "string", maxLength: 200 },
|
|
312
|
-
koKR: { type: "string", maxLength: 200 }
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
]
|
|
322
|
+
koKR: { type: "string", maxLength: 200 }
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
]
|
|
316
326
|
},
|
|
317
327
|
description: {
|
|
318
328
|
oneOf: [
|
|
@@ -326,10 +336,10 @@ exports.nodeSectionSchema = {
|
|
|
326
336
|
deDE: { type: "string", maxLength: 200 },
|
|
327
337
|
jaJP: { type: "string", maxLength: 200 },
|
|
328
338
|
esES: { type: "string", maxLength: 200 },
|
|
329
|
-
koKR: { type: "string", maxLength: 200 }
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
]
|
|
339
|
+
koKR: { type: "string", maxLength: 200 }
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
]
|
|
333
343
|
},
|
|
334
344
|
condition: exports.nodeFieldConditionSchema,
|
|
335
345
|
defaultCollapsed: { type: "boolean" },
|
|
@@ -341,10 +351,10 @@ exports.nodeSectionSchema = {
|
|
|
341
351
|
items: {
|
|
342
352
|
type: "string",
|
|
343
353
|
minLength: 1,
|
|
344
|
-
maxLength: 200
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
354
|
+
maxLength: 200
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
348
358
|
};
|
|
349
359
|
exports.nodeFieldAndSectionFormElementSchema = {
|
|
350
360
|
title: "nodeFieldAndSectionFormElementSchema",
|
|
@@ -352,8 +362,8 @@ exports.nodeFieldAndSectionFormElementSchema = {
|
|
|
352
362
|
required: ["key", "type"],
|
|
353
363
|
properties: {
|
|
354
364
|
key: { type: "string", minLength: 1, maxLength: 200 },
|
|
355
|
-
type: { type: "string", enum: ["field", "section"] }
|
|
356
|
-
}
|
|
365
|
+
type: { type: "string", enum: ["field", "section"] }
|
|
366
|
+
}
|
|
357
367
|
};
|
|
358
368
|
exports.nodeDescriptorSchema = {
|
|
359
369
|
title: "nodeDescriptorSchema",
|
|
@@ -375,10 +385,10 @@ exports.nodeDescriptorSchema = {
|
|
|
375
385
|
deDE: { type: "string", maxLength: 200 },
|
|
376
386
|
jaJP: { type: "string", maxLength: 200 },
|
|
377
387
|
esES: { type: "string", maxLength: 200 },
|
|
378
|
-
koKR: { type: "string", maxLength: 200 }
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
]
|
|
388
|
+
koKR: { type: "string", maxLength: 200 }
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
]
|
|
382
392
|
},
|
|
383
393
|
summary: {
|
|
384
394
|
oneOf: [
|
|
@@ -392,10 +402,10 @@ exports.nodeDescriptorSchema = {
|
|
|
392
402
|
deDE: { type: "string", maxLength: 200 },
|
|
393
403
|
jaJP: { type: "string", maxLength: 200 },
|
|
394
404
|
esES: { type: "string", maxLength: 200 },
|
|
395
|
-
koKR: { type: "string", maxLength: 200 }
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
]
|
|
405
|
+
koKR: { type: "string", maxLength: 200 }
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
]
|
|
399
409
|
},
|
|
400
410
|
appearance: nodeAppearanceSchema,
|
|
401
411
|
behavior: nodeBehaviorSchema,
|
|
@@ -408,25 +418,25 @@ exports.nodeDescriptorSchema = {
|
|
|
408
418
|
type: "array",
|
|
409
419
|
items: { type: "string" },
|
|
410
420
|
uniqueItems: true,
|
|
411
|
-
minItems: 0
|
|
421
|
+
minItems: 0
|
|
412
422
|
},
|
|
413
423
|
tokens: {
|
|
414
424
|
type: "array",
|
|
415
425
|
items: ISnippet_1.snippetDataSchema,
|
|
416
|
-
uniqueItems: true
|
|
426
|
+
uniqueItems: true
|
|
417
427
|
},
|
|
418
428
|
sections: {
|
|
419
429
|
type: "array",
|
|
420
430
|
additionalItems: false,
|
|
421
|
-
items: exports.nodeSectionSchema
|
|
431
|
+
items: exports.nodeSectionSchema
|
|
422
432
|
},
|
|
423
433
|
form: {
|
|
424
434
|
type: "array",
|
|
425
435
|
additionalItems: false,
|
|
426
436
|
maxLength: 25,
|
|
427
|
-
items: exports.nodeFieldAndSectionFormElementSchema
|
|
428
|
-
}
|
|
429
|
-
}
|
|
437
|
+
items: exports.nodeFieldAndSectionFormElementSchema
|
|
438
|
+
}
|
|
439
|
+
}
|
|
430
440
|
};
|
|
431
441
|
exports.nodeDescriptorSetSchema = {
|
|
432
442
|
title: "nodeDescriptorSetSchema",
|
|
@@ -442,10 +452,10 @@ exports.nodeDescriptorSetSchema = {
|
|
|
442
452
|
descriptors: {
|
|
443
453
|
type: "array",
|
|
444
454
|
additionalItems: false,
|
|
445
|
-
items: exports.nodeDescriptorSchema
|
|
455
|
+
items: exports.nodeDescriptorSchema
|
|
446
456
|
},
|
|
447
457
|
resourceType: { type: "string", enum: TResourceType_1.chartableResourceTypes },
|
|
448
|
-
trustedCode: { type: "boolean" }
|
|
449
|
-
}
|
|
458
|
+
trustedCode: { type: "boolean" }
|
|
459
|
+
}
|
|
450
460
|
};
|
|
451
461
|
//# sourceMappingURL=INodeDescriptorSet.js.map
|
|
@@ -53,7 +53,7 @@ export function AuthenticationAPI(instance) {
|
|
|
53
53
|
}),
|
|
54
54
|
exchangeOneTimeTokenForRefreshToken: (_a, options) => {
|
|
55
55
|
var { loginToken } = _a, args = __rest(_a, ["loginToken"]);
|
|
56
|
-
return GenericAPIFn(`/auth/exchangetoken?${stringifyQuery({ loginToken })}`, "GET", self)(args, Object.assign({ withAuthentication: false }, options));
|
|
56
|
+
return GenericAPIFn(`/auth/exchangetoken?${stringifyQuery({ loginToken })}`, "GET", self)(args, Object.assign({ withAuthentication: false, withCredentials: true }, options));
|
|
57
57
|
},
|
|
58
58
|
generateManagementUIAuthToken: (args, options) => GenericAPIFn("/new/management/auth/token", "POST", self)(args, options)
|
|
59
59
|
};
|
|
@@ -2,7 +2,6 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
/* Custom Modules */
|
|
3
3
|
import { OAuth2Error } from "./OAuth2Error";
|
|
4
4
|
import { HttpStatusCode } from "../../shared/helper/HttpStatusCode";
|
|
5
|
-
import { UnauthorizedError } from "../../shared/errors";
|
|
6
5
|
import { OAuth2Errors } from "./IOAuth2ErrorResponse";
|
|
7
6
|
const expiryBuffer = 8;
|
|
8
7
|
export const OAuth2Authentication = function (credentials, self) {
|
|
@@ -27,7 +26,8 @@ export const OAuth2Authentication = function (credentials, self) {
|
|
|
27
26
|
};
|
|
28
27
|
return yield request(formFields, {
|
|
29
28
|
maxRetries: Infinity,
|
|
30
|
-
retryDelay: () => 3000
|
|
29
|
+
retryDelay: () => 3000,
|
|
30
|
+
withCredentials: true
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
const request = (formFields, options) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -82,6 +82,8 @@ export const OAuth2Authentication = function (credentials, self) {
|
|
|
82
82
|
OAuth2Authentication.prototype.login = (parameters) => __awaiter(this, void 0, void 0, function* () {
|
|
83
83
|
const { clientId, clientSecret } = self.credentials;
|
|
84
84
|
switch (parameters.type) {
|
|
85
|
+
// Password Grant is deprecated in OAuth2, but still supported
|
|
86
|
+
// for api and e2e tests
|
|
85
87
|
case "password":
|
|
86
88
|
{
|
|
87
89
|
const { username, password, rememberMe, organisationId } = parameters;
|
|
@@ -113,17 +115,19 @@ export const OAuth2Authentication = function (credentials, self) {
|
|
|
113
115
|
break;
|
|
114
116
|
case "authorizationCode":
|
|
115
117
|
{
|
|
116
|
-
const { code, redirectUri, codeVerifier } = parameters;
|
|
118
|
+
const { code, redirectUri, codeVerifier, rememberMe } = parameters;
|
|
117
119
|
const formFields = {
|
|
118
120
|
grant_type: "authorization_code",
|
|
119
121
|
client_id: clientId,
|
|
120
122
|
client_secret: clientSecret,
|
|
121
123
|
code,
|
|
122
124
|
redirect_uri: redirectUri,
|
|
125
|
+
rememberMe,
|
|
123
126
|
code_verifier: codeVerifier
|
|
124
127
|
};
|
|
125
128
|
self.tokenData = yield request(formFields, {
|
|
126
|
-
maxRetries: 0
|
|
129
|
+
maxRetries: 0,
|
|
130
|
+
withCredentials: true
|
|
127
131
|
});
|
|
128
132
|
}
|
|
129
133
|
break;
|
|
@@ -175,9 +179,6 @@ export const OAuth2Authentication = function (credentials, self) {
|
|
|
175
179
|
*/
|
|
176
180
|
if (isAccessTokenExpired(self.tokenData)) {
|
|
177
181
|
const credentials = self.credentials;
|
|
178
|
-
if (!self.tokenData.refresh_token) {
|
|
179
|
-
throw new UnauthorizedError("No RefreshToken provided.");
|
|
180
|
-
}
|
|
181
182
|
if (self.refreshTokenSingleton === null) {
|
|
182
183
|
self.refreshTokenSingleton = new Promise((resolve, reject) => {
|
|
183
184
|
refreshTokenGrant({
|
|
@@ -217,8 +218,7 @@ export const OAuth2Authentication = function (credentials, self) {
|
|
|
217
218
|
});
|
|
218
219
|
OAuth2Authentication.prototype.logout = () => __awaiter(this, void 0, void 0, function* () {
|
|
219
220
|
if ((self === null || self === void 0 ? void 0 : self.credentials.type) ===
|
|
220
|
-
"OAuth2"
|
|
221
|
-
self.tokenData.refresh_token) {
|
|
221
|
+
"OAuth2") {
|
|
222
222
|
const httpAdapter = self.getHttpAdapter();
|
|
223
223
|
const requestData = {
|
|
224
224
|
method: "POST",
|
|
@@ -227,6 +227,7 @@ export const OAuth2Authentication = function (credentials, self) {
|
|
|
227
227
|
token: self.tokenData.refresh_token
|
|
228
228
|
},
|
|
229
229
|
maxRetries: 3,
|
|
230
|
+
withCredentials: true,
|
|
230
231
|
retryDelay: () => 0
|
|
231
232
|
};
|
|
232
233
|
// reset tokenData to avoid multiple revoke calls
|
|
@@ -86,7 +86,7 @@ export class AxiosAdapter {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
convertRequest(request, client) {
|
|
89
|
-
var _a;
|
|
89
|
+
var _a, _b;
|
|
90
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
91
|
const baseUrl = (_a = request.baseUrl) !== null && _a !== void 0 ? _a : this.config.baseUrl;
|
|
92
92
|
const axiosRequest = {
|
|
@@ -94,6 +94,7 @@ export class AxiosAdapter {
|
|
|
94
94
|
headers: request.headers,
|
|
95
95
|
method: request.method || "GET",
|
|
96
96
|
url: `${baseUrl}${request.url}`,
|
|
97
|
+
withCredentials: (_b = request.withCredentials) !== null && _b !== void 0 ? _b : false,
|
|
97
98
|
validateStatus: (status) => !isRetryableStatus(status)
|
|
98
99
|
};
|
|
99
100
|
if (typeof request.onProgress === "function") {
|
|
@@ -27,7 +27,7 @@ export const CODE = createNodeDescriptor({
|
|
|
27
27
|
function: (codeParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
28
|
const { cognigy } = codeParams;
|
|
29
29
|
const { api } = cognigy;
|
|
30
|
-
api.executeCodeInSecureContext(codeParams);
|
|
30
|
+
yield api.executeCodeInSecureContext(codeParams);
|
|
31
31
|
})
|
|
32
32
|
});
|
|
33
33
|
//# sourceMappingURL=code.js.map
|
|
@@ -132,12 +132,12 @@ export const GO_TO = createNodeDescriptor({
|
|
|
132
132
|
}
|
|
133
133
|
if (!api.checkThink(thisNodeId)) {
|
|
134
134
|
api.resetNextNodes();
|
|
135
|
-
api.setThinkMarker(
|
|
135
|
+
api.setThinkMarker(flowId);
|
|
136
136
|
// Check if execution is to wait at Node for Input
|
|
137
137
|
if (executionMode === "wait") {
|
|
138
138
|
// only set the next node if the execution mode is "wait",
|
|
139
139
|
// otherwise input after the goto node would again go to this node, and not to the start node
|
|
140
|
-
yield api.goToNode(config.flowNode);
|
|
140
|
+
yield api.goToNode({ flowNode: config.flowNode, absorbContext });
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
if (injectedText) {
|
|
@@ -2,7 +2,7 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
/* Custom modules */
|
|
3
3
|
import { createNodeDescriptor } from "../../createNodeDescriptor";
|
|
4
4
|
import { GO_TO } from "../logic";
|
|
5
|
-
import { randomUUID } from
|
|
5
|
+
import { v4 as randomUUID } from "uuid";
|
|
6
6
|
import { createLastConverationString, createLastConversationChatObject, createLastUserInputString, writeLLMDebugLogs } from "../nlu/generativeSlotFiller/prompt";
|
|
7
7
|
import { InternalServerError } from "../../../errors";
|
|
8
8
|
import { TranscriptEntryType, TranscriptRole } from "../../../interfaces/transcripts/transcripts";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __rest } from "tslib";
|
|
2
2
|
/* Custom modules */
|
|
3
3
|
import { createNodeDescriptor } from "../../../createNodeDescriptor";
|
|
4
|
-
import { randomUUID } from 'crypto';
|
|
5
4
|
import { setSessionConfig } from "../../voice/mappers/setSessionConfig.mapper";
|
|
6
5
|
import { voiceConfigParamsToVoiceSettings } from "../../voice/mappers/setSessionConfig.mapper";
|
|
7
6
|
import { logFullConfigToDebugMode } from "../../../../helper/logFullConfigToDebugMode";
|
|
@@ -9,6 +8,7 @@ import { createSystemMessage, getCognigyBrandMessage } from "./helpers/createSys
|
|
|
9
8
|
import { generateSearchPrompt } from "./helpers/generateSearchPrompt";
|
|
10
9
|
import { getUserMemory } from "./helpers/getUserMemory";
|
|
11
10
|
import { createToolDefinitions } from "./helpers/createToolDefinitions";
|
|
11
|
+
import { v4 as randomUUID } from "uuid";
|
|
12
12
|
import { TranscriptEntryType, TranscriptRole } from "../../../../interfaces/transcripts/transcripts";
|
|
13
13
|
export const AI_AGENT_TOOLS_WHITELIST = ["aiAgentJobDefault", "aiAgentJobTool", "aiAgentJobMCPTool"];
|
|
14
14
|
export const AI_AGENT_JOB = createNodeDescriptor({
|
|
@@ -2,8 +2,8 @@ import { __awaiter, __rest } from "tslib";
|
|
|
2
2
|
/* Custom modules */
|
|
3
3
|
import { createNodeDescriptor } from "../../../createNodeDescriptor";
|
|
4
4
|
import { GO_TO } from "../../logic";
|
|
5
|
-
import { randomUUID } from 'crypto';
|
|
6
5
|
import { createToolDefinitions } from "../aiAgent/helpers/createToolDefinitions";
|
|
6
|
+
import { v4 as randomUUID } from "uuid";
|
|
7
7
|
import { createLastConverationString, createLastUserInputString, writeLLMDebugLogs } from "../../nlu/generativeSlotFiller/prompt";
|
|
8
8
|
import { InternalServerError } from "../../../../errors";
|
|
9
9
|
import { TranscriptEntryType, TranscriptRole } from "../../../../interfaces/transcripts/transcripts";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ErrorCode } from "./ErrorCode";
|
|
2
|
+
export const BAD_REQUEST_ERROR = ErrorCode.BAD_REQUEST;
|
|
2
3
|
export const MISSING_ARGUMENT_ERROR = ErrorCode.MISSING_ARGUMENT_ERROR;
|
|
3
4
|
export const DATABASE_WRITE_ERROR = ErrorCode.DATABASE_WRITE_ERROR;
|
|
4
5
|
export const RESOURCE_NOT_FOUND_ERROR = ErrorCode.RESOURCE_NOT_FOUND_ERROR;
|
|
@@ -7,5 +7,9 @@ export class InvalidArgumentError extends BadRequestError {
|
|
|
7
7
|
this.name = "Invalid Argument Error";
|
|
8
8
|
this.code = ErrorCode.INVALID_ARGUMENT_ERROR;
|
|
9
9
|
}
|
|
10
|
+
toRFC7807Response(data) {
|
|
11
|
+
const baseResponse = super.toRFC7807Response(data);
|
|
12
|
+
return Object.assign(Object.assign({}, baseResponse), { type: "Bad Request" });
|
|
13
|
+
}
|
|
10
14
|
}
|
|
11
15
|
//# sourceMappingURL=invalidArgument.js.map
|
|
@@ -7,5 +7,9 @@ export class MissingArgumentError extends BadRequestError {
|
|
|
7
7
|
this.name = "Missing Argument Error";
|
|
8
8
|
this.code = ErrorCode.MISSING_ARGUMENT_ERROR;
|
|
9
9
|
}
|
|
10
|
+
toRFC7807Response(data) {
|
|
11
|
+
const baseResponse = super.toRFC7807Response(data);
|
|
12
|
+
return Object.assign(Object.assign({}, baseResponse), { type: "Bad Request" });
|
|
13
|
+
}
|
|
10
14
|
}
|
|
11
15
|
//# sourceMappingURL=missingArgument.js.map
|