@scout9/app 1.0.0-alpha.0.2.2 → 1.0.0-alpha.0.2.4
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/dist/{dev-df823c44.cjs → dev-73ac7343.cjs} +109 -10
- package/dist/{index-332067ab.cjs → index-6fd2c8cd.cjs} +5 -5
- package/dist/index.cjs +52 -2
- package/dist/{multipart-parser-50a82502.cjs → multipart-parser-a55dfbdc.cjs} +2 -2
- package/dist/testing-tools.cjs +1 -1
- package/package.json +1 -1
- package/src/core/templates/app.js +36 -5
- package/src/exports.js +1 -0
|
@@ -39939,7 +39939,7 @@ function _loadUserPackageJson() {
|
|
|
39939
39939
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
39940
39940
|
_context2.t0 = JSON;
|
|
39941
39941
|
_context2.next = 10;
|
|
39942
|
-
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('dev-
|
|
39942
|
+
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('dev-73ac7343.js', document.baseURI).href))), 'utf-8');
|
|
39943
39943
|
case 10:
|
|
39944
39944
|
_context2.t1 = _context2.sent;
|
|
39945
39945
|
pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
|
|
@@ -40749,9 +40749,9 @@ var PersonaConfigurationSchema = AgentConfigurationSchema.extend({
|
|
|
40749
40749
|
})
|
|
40750
40750
|
});
|
|
40751
40751
|
var AgentsConfigurationSchema = z.array(AgentConfigurationSchema);
|
|
40752
|
-
z.array(PersonaConfigurationSchema);
|
|
40752
|
+
var PersonasConfigurationSchema = z.array(PersonaConfigurationSchema);
|
|
40753
40753
|
var AgentsSchema = z.array(AgentSchema);
|
|
40754
|
-
z.array(PersonaSchema);
|
|
40754
|
+
var PersonasSchema = z.array(PersonaSchema);
|
|
40755
40755
|
var Bus = z.object({
|
|
40756
40756
|
foo: z.string(),
|
|
40757
40757
|
bar: z["boolean"]().optional()
|
|
@@ -40762,7 +40762,7 @@ var Baz = z.object({
|
|
|
40762
40762
|
two: z.number().optional()
|
|
40763
40763
|
})
|
|
40764
40764
|
});
|
|
40765
|
-
z.object({
|
|
40765
|
+
var TestSchema = z.object({
|
|
40766
40766
|
baz: Baz,
|
|
40767
40767
|
bus: Bus
|
|
40768
40768
|
});
|
|
@@ -40852,7 +40852,7 @@ var WorkflowResponseMessageApiRequest = z.object({
|
|
|
40852
40852
|
* If its a string, it will be sent as a static string.
|
|
40853
40853
|
* If it's a object or WorkflowResponseMessageAPI - it will use
|
|
40854
40854
|
*/
|
|
40855
|
-
z.union([z.string(),
|
|
40855
|
+
var WorkflowResponseMessage = z.union([z.string(),
|
|
40856
40856
|
/**
|
|
40857
40857
|
* An api call that should be called later, must return a string or {message: string}
|
|
40858
40858
|
*/
|
|
@@ -40861,7 +40861,7 @@ WorkflowResponseMessageApiRequest]);
|
|
|
40861
40861
|
/**
|
|
40862
40862
|
* The intended response provided by the WorkflowResponseMessageApiRequest
|
|
40863
40863
|
*/
|
|
40864
|
-
z.union([z.string(), z.object({
|
|
40864
|
+
var WorkflowResponseMessageApiResponse = z.union([z.string(), z.object({
|
|
40865
40865
|
message: z.string()
|
|
40866
40866
|
}), z.object({
|
|
40867
40867
|
text: z.string()
|
|
@@ -40971,7 +40971,7 @@ var WorkflowResponseSlotSchema = WorkflowResponseSlotBaseSchema.extend({
|
|
|
40971
40971
|
* The workflow response to send in any given workflow
|
|
40972
40972
|
*/
|
|
40973
40973
|
var WorkflowResponseSchema = z.union([WorkflowResponseSlotSchema, z.array(WorkflowResponseSlotSchema)]);
|
|
40974
|
-
z["function"]().args(WorkflowEventSchema).returns(z.union([z.promise(WorkflowResponseSchema), WorkflowResponseSchema]));
|
|
40974
|
+
var WorkflowFunctionSchema = z["function"]().args(WorkflowEventSchema).returns(z.union([z.promise(WorkflowResponseSchema), WorkflowResponseSchema]));
|
|
40975
40975
|
|
|
40976
40976
|
var _excluded$2 = ["success"];
|
|
40977
40977
|
function MacroUtilsFactory() {
|
|
@@ -41443,7 +41443,7 @@ var EntityConfigurationSchema = _EntityConfigurationSchema.refine(function (data
|
|
|
41443
41443
|
// Custom error message
|
|
41444
41444
|
message: "If 'definitions' is provided, then 'training' must also be provided"
|
|
41445
41445
|
});
|
|
41446
|
-
z.array(EntityConfigurationSchema);
|
|
41446
|
+
var EntitiesRootConfigurationSchema = z.array(EntityConfigurationSchema);
|
|
41447
41447
|
var EntityExtendedProjectConfigurationSchema = z.object({
|
|
41448
41448
|
entities: z.array(zId('Entity Folder', z.string()), {
|
|
41449
41449
|
description: 'Entity id association, used to handle route params'
|
|
@@ -41563,13 +41563,70 @@ apiFunctionParamsSchema.extend({
|
|
|
41563
41563
|
* @template Response
|
|
41564
41564
|
* @typedef {function(IApiFunctionParams): Promise<EventResponse>} IApiFunction
|
|
41565
41565
|
*/
|
|
41566
|
-
z["function"]().args(apiFunctionParamsSchema).returns(z.promise(eventResponseSchema));
|
|
41566
|
+
var apiFunctionSchema = z["function"]().args(apiFunctionParamsSchema).returns(z.promise(eventResponseSchema));
|
|
41567
|
+
|
|
41568
|
+
/**
|
|
41569
|
+
* @template Params
|
|
41570
|
+
* @template Response
|
|
41571
|
+
* @typedef {IApiFunction<Params, Response>} IQueryApiFunction
|
|
41572
|
+
*/
|
|
41573
|
+
var queryApiFunctionSchema = apiFunctionSchema;
|
|
41574
|
+
|
|
41575
|
+
/**
|
|
41576
|
+
* @template Params
|
|
41577
|
+
* @template Response
|
|
41578
|
+
* @typedef {IApiFunction<Params, Response>} GetApiFunction
|
|
41579
|
+
*/
|
|
41580
|
+
var getApiFunctionSchema = apiFunctionSchema;
|
|
41581
|
+
|
|
41582
|
+
/**
|
|
41583
|
+
* @template Params
|
|
41584
|
+
* @template RequestBody
|
|
41585
|
+
* @template Response
|
|
41586
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPostApiFunction
|
|
41587
|
+
*/
|
|
41588
|
+
var postApiFunctionSchema = function postApiFunctionSchema(requestBodySchema) {
|
|
41589
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
41590
|
+
body: requestBodySchema.partial()
|
|
41591
|
+
})).returns(z.promise(eventResponseSchema));
|
|
41592
|
+
};
|
|
41593
|
+
|
|
41594
|
+
/**
|
|
41595
|
+
* @template Params
|
|
41596
|
+
* @template RequestBody
|
|
41597
|
+
* @template Response
|
|
41598
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPutApiFunction
|
|
41599
|
+
*/
|
|
41600
|
+
var putApiFunctionSchema = function putApiFunctionSchema(requestBodySchema) {
|
|
41601
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
41602
|
+
body: requestBodySchema.partial()
|
|
41603
|
+
})).returns(z.promise(eventResponseSchema));
|
|
41604
|
+
};
|
|
41605
|
+
|
|
41606
|
+
/**
|
|
41607
|
+
* @template Params
|
|
41608
|
+
* @template RequestBody
|
|
41609
|
+
* @template Response
|
|
41610
|
+
* @typedef {function(IApiFunctionParams & {body: Partial<RequestBody>}): Promise<EventResponse<Response>>} IPatchApiFunction
|
|
41611
|
+
*/
|
|
41612
|
+
var patchApiFunctionSchema = function patchApiFunctionSchema(requestBodySchema) {
|
|
41613
|
+
return z["function"]().args(apiFunctionParamsSchema.extend({
|
|
41614
|
+
body: requestBodySchema.partial()
|
|
41615
|
+
})).returns(z.promise(eventResponseSchema));
|
|
41616
|
+
};
|
|
41617
|
+
|
|
41618
|
+
/**
|
|
41619
|
+
* @template Params
|
|
41620
|
+
* @template Response
|
|
41621
|
+
* @typedef {IApiFunction<Params, Response>} IDeleteApiFunction
|
|
41622
|
+
*/
|
|
41623
|
+
var deleteApiFunctionSchema = apiFunctionSchema;
|
|
41567
41624
|
|
|
41568
41625
|
var ContextExampleWithTrainingDataSchema = z.object({
|
|
41569
41626
|
input: z.string(),
|
|
41570
41627
|
output: z.array(z.record(z.string(), z.any()))
|
|
41571
41628
|
});
|
|
41572
|
-
z.union([z.array(ContextExampleWithTrainingDataSchema), z.array(z.record(z.string(), z.any()))]);
|
|
41629
|
+
var ContextExampleSchema = z.union([z.array(ContextExampleWithTrainingDataSchema), z.array(z.record(z.string(), z.any()))]);
|
|
41573
41630
|
|
|
41574
41631
|
let FORCE_COLOR,
|
|
41575
41632
|
NODE_DISABLE_COLORS,
|
|
@@ -48204,16 +48261,51 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
48204
48261
|
}();
|
|
48205
48262
|
|
|
48206
48263
|
exports.$ = $$1;
|
|
48264
|
+
exports.AgentConfigurationSchema = AgentConfigurationSchema;
|
|
48265
|
+
exports.AgentSchema = AgentSchema;
|
|
48266
|
+
exports.AgentsConfigurationSchema = AgentsConfigurationSchema;
|
|
48267
|
+
exports.AgentsSchema = AgentsSchema;
|
|
48268
|
+
exports.Baz = Baz;
|
|
48269
|
+
exports.Bus = Bus;
|
|
48270
|
+
exports.ContextExampleSchema = ContextExampleSchema;
|
|
48271
|
+
exports.ContextExampleWithTrainingDataSchema = ContextExampleWithTrainingDataSchema;
|
|
48272
|
+
exports.ConversationAnticipateSchema = ConversationAnticipateSchema;
|
|
48273
|
+
exports.ConversationContext = ConversationContext;
|
|
48274
|
+
exports.ConversationSchema = ConversationSchema;
|
|
48275
|
+
exports.CustomerSchema = CustomerSchema;
|
|
48276
|
+
exports.CustomerValueSchema = CustomerValueSchema;
|
|
48277
|
+
exports.EntitiesRootConfigurationSchema = EntitiesRootConfigurationSchema;
|
|
48207
48278
|
exports.EntitiesRootProjectConfigurationSchema = EntitiesRootProjectConfigurationSchema;
|
|
48208
48279
|
exports.EntityApiConfigurationSchema = EntityApiConfigurationSchema;
|
|
48209
48280
|
exports.EntityConfigurationSchema = EntityConfigurationSchema;
|
|
48210
48281
|
exports.EntityRootProjectConfigurationSchema = EntityRootProjectConfigurationSchema;
|
|
48282
|
+
exports.FollowupBaseSchema = FollowupBaseSchema;
|
|
48283
|
+
exports.FollowupSchema = FollowupSchema;
|
|
48284
|
+
exports.ForwardSchema = ForwardSchema;
|
|
48285
|
+
exports.InstructionObjectSchema = InstructionObjectSchema;
|
|
48286
|
+
exports.InstructionSchema = InstructionSchema;
|
|
48287
|
+
exports.IntentWorkflowEventSchema = IntentWorkflowEventSchema;
|
|
48288
|
+
exports.MessageSchema = MessageSchema;
|
|
48289
|
+
exports.PersonaConfigurationSchema = PersonaConfigurationSchema;
|
|
48290
|
+
exports.PersonaSchema = PersonaSchema;
|
|
48291
|
+
exports.PersonasConfigurationSchema = PersonasConfigurationSchema;
|
|
48292
|
+
exports.PersonasSchema = PersonasSchema;
|
|
48211
48293
|
exports.ProgressLogger = ProgressLogger;
|
|
48212
48294
|
exports.Scout9ProjectBuildConfigSchema = Scout9ProjectBuildConfigSchema;
|
|
48295
|
+
exports.Scout9ProjectConfigSchema = Scout9ProjectConfigSchema;
|
|
48213
48296
|
exports.Scout9Test = Scout9Test;
|
|
48297
|
+
exports.TestSchema = TestSchema;
|
|
48214
48298
|
exports.WorkflowConfigurationSchema = WorkflowConfigurationSchema;
|
|
48215
48299
|
exports.WorkflowEventSchema = WorkflowEventSchema;
|
|
48300
|
+
exports.WorkflowFunctionSchema = WorkflowFunctionSchema;
|
|
48301
|
+
exports.WorkflowResponseMessage = WorkflowResponseMessage;
|
|
48302
|
+
exports.WorkflowResponseMessageApiRequest = WorkflowResponseMessageApiRequest;
|
|
48303
|
+
exports.WorkflowResponseMessageApiResponse = WorkflowResponseMessageApiResponse;
|
|
48304
|
+
exports.WorkflowResponseSchema = WorkflowResponseSchema;
|
|
48305
|
+
exports.WorkflowResponseSlotBaseSchema = WorkflowResponseSlotBaseSchema;
|
|
48306
|
+
exports.WorkflowResponseSlotSchema = WorkflowResponseSlotSchema;
|
|
48216
48307
|
exports.WorkflowsConfigurationSchema = WorkflowsConfigurationSchema;
|
|
48308
|
+
exports.apiFunctionSchema = apiFunctionSchema;
|
|
48217
48309
|
exports.balancedMatch = balancedMatch;
|
|
48218
48310
|
exports.build = build;
|
|
48219
48311
|
exports.checkVariableType = checkVariableType;
|
|
@@ -48224,7 +48316,10 @@ exports.createMockConversation = createMockConversation;
|
|
|
48224
48316
|
exports.createMockCustomer = createMockCustomer;
|
|
48225
48317
|
exports.createMockMessage = createMockMessage;
|
|
48226
48318
|
exports.createMockWorkflowEvent = createMockWorkflowEvent;
|
|
48319
|
+
exports.deleteApiFunctionSchema = deleteApiFunctionSchema;
|
|
48320
|
+
exports.eventResponseSchema = eventResponseSchema;
|
|
48227
48321
|
exports.forward = forward;
|
|
48322
|
+
exports.getApiFunctionSchema = getApiFunctionSchema;
|
|
48228
48323
|
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
48229
48324
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
48230
48325
|
exports.globSync = globSync;
|
|
@@ -48233,7 +48328,11 @@ exports.loadConfig = loadConfig;
|
|
|
48233
48328
|
exports.loadEnvConfig = loadEnvConfig;
|
|
48234
48329
|
exports.loadUserPackageJson = loadUserPackageJson;
|
|
48235
48330
|
exports.logUserValidationError = logUserValidationError;
|
|
48331
|
+
exports.patchApiFunctionSchema = patchApiFunctionSchema;
|
|
48332
|
+
exports.postApiFunctionSchema = postApiFunctionSchema;
|
|
48236
48333
|
exports.projectTemplates = projectTemplates;
|
|
48334
|
+
exports.putApiFunctionSchema = putApiFunctionSchema;
|
|
48335
|
+
exports.queryApiFunctionSchema = queryApiFunctionSchema;
|
|
48237
48336
|
exports.reply = reply;
|
|
48238
48337
|
exports.report = report;
|
|
48239
48338
|
exports.requireOptionalProjectFile = requireOptionalProjectFile;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var spirits = require("./spirits-76855e30.cjs");
|
|
4
|
-
var dev = require("./dev-
|
|
4
|
+
var dev = require("./dev-73ac7343.cjs");
|
|
5
5
|
var require$$0 = require('fs');
|
|
6
6
|
var require$$2$1 = require('events');
|
|
7
7
|
var require$$1 = require('path');
|
|
@@ -29482,7 +29482,7 @@ class Body {
|
|
|
29482
29482
|
}
|
|
29483
29483
|
const {
|
|
29484
29484
|
toFormData
|
|
29485
|
-
} = await Promise.resolve().then(function () { return require("./multipart-parser-
|
|
29485
|
+
} = await Promise.resolve().then(function () { return require("./multipart-parser-a55dfbdc.cjs"); });
|
|
29486
29486
|
return toFormData(this.body, ct);
|
|
29487
29487
|
}
|
|
29488
29488
|
|
|
@@ -41891,7 +41891,7 @@ function _loadUserPackageJson() {
|
|
|
41891
41891
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
41892
41892
|
_context.t0 = JSON;
|
|
41893
41893
|
_context.next = 10;
|
|
41894
|
-
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-
|
|
41894
|
+
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-6fd2c8cd.js', document.baseURI).href))), 'utf-8');
|
|
41895
41895
|
case 10:
|
|
41896
41896
|
_context.t1 = _context.sent;
|
|
41897
41897
|
pkg = _context.t0.parse.call(_context.t0, _context.t1);
|
|
@@ -43097,7 +43097,7 @@ var ProjectFiles = /*#__PURE__*/function () {
|
|
|
43097
43097
|
return ProjectFiles;
|
|
43098
43098
|
}();
|
|
43099
43099
|
|
|
43100
|
-
var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-
|
|
43100
|
+
var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-6fd2c8cd.js', document.baseURI).href)));
|
|
43101
43101
|
var __dirname$1 = path__default["default"].dirname(__filename$1);
|
|
43102
43102
|
function zipDirectory(source, out) {
|
|
43103
43103
|
var archive = archiver$1('tar', {
|
|
@@ -43312,7 +43312,7 @@ function _buildApp() {
|
|
|
43312
43312
|
case 11:
|
|
43313
43313
|
_context4.t0 = JSON;
|
|
43314
43314
|
_context4.next = 14;
|
|
43315
|
-
return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-
|
|
43315
|
+
return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-6fd2c8cd.js', document.baseURI).href))), 'utf-8');
|
|
43316
43316
|
case 14:
|
|
43317
43317
|
_context4.t1 = _context4.sent;
|
|
43318
43318
|
packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
package/dist/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require("./index-
|
|
6
|
-
var dev = require("./dev-
|
|
5
|
+
var index = require("./index-6fd2c8cd.cjs");
|
|
6
|
+
var dev = require("./dev-73ac7343.cjs");
|
|
7
7
|
require("./spirits-76855e30.cjs");
|
|
8
8
|
require('fs');
|
|
9
9
|
require('events');
|
|
@@ -47,12 +47,62 @@ exports.did = index.did;
|
|
|
47
47
|
exports.json = index.json;
|
|
48
48
|
exports.run = index.run;
|
|
49
49
|
exports.sendEvent = index.sendEvent;
|
|
50
|
+
exports.AgentConfigurationSchema = dev.AgentConfigurationSchema;
|
|
51
|
+
exports.AgentSchema = dev.AgentSchema;
|
|
52
|
+
exports.AgentsConfigurationSchema = dev.AgentsConfigurationSchema;
|
|
53
|
+
exports.AgentsSchema = dev.AgentsSchema;
|
|
54
|
+
exports.Baz = dev.Baz;
|
|
55
|
+
exports.Bus = dev.Bus;
|
|
56
|
+
exports.ContextExampleSchema = dev.ContextExampleSchema;
|
|
57
|
+
exports.ContextExampleWithTrainingDataSchema = dev.ContextExampleWithTrainingDataSchema;
|
|
58
|
+
exports.ConversationAnticipateSchema = dev.ConversationAnticipateSchema;
|
|
59
|
+
exports.ConversationContext = dev.ConversationContext;
|
|
60
|
+
exports.ConversationSchema = dev.ConversationSchema;
|
|
61
|
+
exports.CustomerSchema = dev.CustomerSchema;
|
|
62
|
+
exports.CustomerValueSchema = dev.CustomerValueSchema;
|
|
63
|
+
exports.EntitiesRootConfigurationSchema = dev.EntitiesRootConfigurationSchema;
|
|
64
|
+
exports.EntitiesRootProjectConfigurationSchema = dev.EntitiesRootProjectConfigurationSchema;
|
|
65
|
+
exports.EntityApiConfigurationSchema = dev.EntityApiConfigurationSchema;
|
|
66
|
+
exports.EntityConfigurationSchema = dev.EntityConfigurationSchema;
|
|
67
|
+
exports.EntityRootProjectConfigurationSchema = dev.EntityRootProjectConfigurationSchema;
|
|
68
|
+
exports.FollowupBaseSchema = dev.FollowupBaseSchema;
|
|
69
|
+
exports.FollowupSchema = dev.FollowupSchema;
|
|
70
|
+
exports.ForwardSchema = dev.ForwardSchema;
|
|
71
|
+
exports.InstructionObjectSchema = dev.InstructionObjectSchema;
|
|
72
|
+
exports.InstructionSchema = dev.InstructionSchema;
|
|
73
|
+
exports.IntentWorkflowEventSchema = dev.IntentWorkflowEventSchema;
|
|
74
|
+
exports.MessageSchema = dev.MessageSchema;
|
|
75
|
+
exports.PersonaConfigurationSchema = dev.PersonaConfigurationSchema;
|
|
76
|
+
exports.PersonaSchema = dev.PersonaSchema;
|
|
77
|
+
exports.PersonasConfigurationSchema = dev.PersonasConfigurationSchema;
|
|
78
|
+
exports.PersonasSchema = dev.PersonasSchema;
|
|
79
|
+
exports.Scout9ProjectBuildConfigSchema = dev.Scout9ProjectBuildConfigSchema;
|
|
80
|
+
exports.Scout9ProjectConfigSchema = dev.Scout9ProjectConfigSchema;
|
|
50
81
|
exports.Scout9Test = dev.Scout9Test;
|
|
82
|
+
exports.TestSchema = dev.TestSchema;
|
|
83
|
+
exports.WorkflowConfigurationSchema = dev.WorkflowConfigurationSchema;
|
|
84
|
+
exports.WorkflowEventSchema = dev.WorkflowEventSchema;
|
|
85
|
+
exports.WorkflowFunctionSchema = dev.WorkflowFunctionSchema;
|
|
86
|
+
exports.WorkflowResponseMessage = dev.WorkflowResponseMessage;
|
|
87
|
+
exports.WorkflowResponseMessageApiRequest = dev.WorkflowResponseMessageApiRequest;
|
|
88
|
+
exports.WorkflowResponseMessageApiResponse = dev.WorkflowResponseMessageApiResponse;
|
|
89
|
+
exports.WorkflowResponseSchema = dev.WorkflowResponseSchema;
|
|
90
|
+
exports.WorkflowResponseSlotBaseSchema = dev.WorkflowResponseSlotBaseSchema;
|
|
91
|
+
exports.WorkflowResponseSlotSchema = dev.WorkflowResponseSlotSchema;
|
|
92
|
+
exports.WorkflowsConfigurationSchema = dev.WorkflowsConfigurationSchema;
|
|
93
|
+
exports.apiFunctionSchema = dev.apiFunctionSchema;
|
|
51
94
|
exports.createMockAgent = dev.createMockAgent;
|
|
52
95
|
exports.createMockConversation = dev.createMockConversation;
|
|
53
96
|
exports.createMockCustomer = dev.createMockCustomer;
|
|
54
97
|
exports.createMockMessage = dev.createMockMessage;
|
|
55
98
|
exports.createMockWorkflowEvent = dev.createMockWorkflowEvent;
|
|
99
|
+
exports.deleteApiFunctionSchema = dev.deleteApiFunctionSchema;
|
|
100
|
+
exports.eventResponseSchema = dev.eventResponseSchema;
|
|
56
101
|
exports.forward = dev.forward;
|
|
102
|
+
exports.getApiFunctionSchema = dev.getApiFunctionSchema;
|
|
57
103
|
exports.instruct = dev.instruct;
|
|
104
|
+
exports.patchApiFunctionSchema = dev.patchApiFunctionSchema;
|
|
105
|
+
exports.postApiFunctionSchema = dev.postApiFunctionSchema;
|
|
106
|
+
exports.putApiFunctionSchema = dev.putApiFunctionSchema;
|
|
107
|
+
exports.queryApiFunctionSchema = dev.queryApiFunctionSchema;
|
|
58
108
|
exports.reply = dev.reply;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
require('node:fs');
|
|
4
4
|
require('node:path');
|
|
5
|
-
var index = require("./index-
|
|
5
|
+
var index = require("./index-6fd2c8cd.cjs");
|
|
6
6
|
require("./spirits-76855e30.cjs");
|
|
7
|
-
require("./dev-
|
|
7
|
+
require("./dev-73ac7343.cjs");
|
|
8
8
|
require('util');
|
|
9
9
|
require('stream');
|
|
10
10
|
require('path');
|
package/dist/testing-tools.cjs
CHANGED
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
13
13
|
import projectApp from './src/app.js';
|
|
14
14
|
import config from './config.js';
|
|
15
15
|
import { readdir } from 'fs/promises';
|
|
16
|
+
import { ZodError } from 'zod';
|
|
16
17
|
|
|
17
18
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
19
|
const __dirname = path.dirname(__filename);
|
|
@@ -93,6 +94,10 @@ const handleError = (e, res = undefined) => {
|
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
console.log(colors.red(`${colors.bold(`${code} Error`)}: ${message}`));
|
|
97
|
+
if ('stack' in e) {
|
|
98
|
+
console.log(colors.grey(e.stack));
|
|
99
|
+
}
|
|
100
|
+
console.log(colors)
|
|
96
101
|
if (res) {
|
|
97
102
|
res.writeHead(code, {'Content-Type': 'application/json'});
|
|
98
103
|
res.end(JSON.stringify({
|
|
@@ -162,17 +167,43 @@ if (dev) {
|
|
|
162
167
|
|
|
163
168
|
// Root application POST endpoint will run the scout9 app
|
|
164
169
|
app.post(dev ? '/dev/workflow' : '/', async (req, res) => {
|
|
170
|
+
let workflowEvent;
|
|
165
171
|
try {
|
|
166
|
-
|
|
172
|
+
workflowEvent = WorkflowEventSchema.parse(req.body.event);
|
|
167
173
|
globalThis.SCOUT9 = {
|
|
168
|
-
...
|
|
174
|
+
...workflowEvent,
|
|
169
175
|
$convo: req.body.$convo,
|
|
170
176
|
}
|
|
171
|
-
|
|
177
|
+
} catch (error) {
|
|
178
|
+
if (error instanceof ZodError) {
|
|
179
|
+
const formattedErrors = error.format();
|
|
180
|
+
res.writeHead(400, {'Content-Type': 'application/json'});
|
|
181
|
+
res.end(JSON.stringify({
|
|
182
|
+
status: 'WorkflowInvalidResponseType',
|
|
183
|
+
errors: formattedErrors
|
|
184
|
+
}));
|
|
185
|
+
console.log(colors.red(`${colors.bold(`Bad Input Event:`)}: Received: ${JSON.stringify(req.body.event, null, 2)}\n\nErrors:\n\n${JSON.stringify(formattedErrors, null, 2)}`));
|
|
186
|
+
} else {
|
|
187
|
+
error.message = `Workflow Template Event Parse Error: ` + error.message;
|
|
188
|
+
handleError(error, res);
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (!workflowEvent) {
|
|
193
|
+
handleError(new Error('No workflowEvent defined'), res);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
const response = await projectApp(workflowEvent);
|
|
198
|
+
if (dev) {
|
|
199
|
+
console.log(colors.green(`Workflow Sending Response:`));
|
|
200
|
+
console.log(colors.grey(JSON.stringify(response, null, 2)));
|
|
201
|
+
}
|
|
172
202
|
res.writeHead(200, {'Content-Type': 'application/json'});
|
|
173
203
|
res.end(JSON.stringify(response));
|
|
174
|
-
} catch (
|
|
175
|
-
|
|
204
|
+
} catch (error) {
|
|
205
|
+
error.message = `Workflow Template Runtime Error: ` + error.message
|
|
206
|
+
handleError(error, res);
|
|
176
207
|
}
|
|
177
208
|
});
|
|
178
209
|
|
package/src/exports.js
CHANGED