@bavard/agent-config
Advanced tools
Comparing version 0.0.75 to 0.0.76
@@ -14,2 +14,3 @@ "use strict"; | ||
const form_action_1 = require("./actions/agent/form-action"); | ||
const graph_policy_v2_1 = require("./graph-policy-v2"); | ||
const packageJson = require('../package.json'); | ||
@@ -238,2 +239,5 @@ var EPolicyType; | ||
} | ||
for (const policy of jsonObj.graphPoliciesV2 || []) { | ||
config.addGraphPolicyV2(graph_policy_v2_1.GraphPolicyV2.fromJsonObj(policy)); | ||
} | ||
if (jsonObj.activePolicyName) { | ||
@@ -240,0 +244,0 @@ if (config.graphPolicies.has(jsonObj.activePolicyName)) { |
@@ -16,9 +16,10 @@ "use strict"; | ||
this.allNodes = allNodes; | ||
if (!allNodes.has(startNode)) { | ||
throw new Error('Start node not in all nodes.'); | ||
} | ||
this._currentNode = startNode; | ||
this.startNode = startNode; | ||
} | ||
addNode(node) { | ||
this.allNodes.add(node); | ||
if (!this.startNode && node instanceof agent_node_1.AgentNode) { | ||
this.startNode = node; | ||
} | ||
} | ||
@@ -25,0 +26,0 @@ get currentNode() { |
@@ -5,6 +5,6 @@ import * as yup from './yup'; | ||
version: string; | ||
startNode: object; | ||
startNodeId: string; | ||
currentNode: object | undefined; | ||
intents: (string | undefined)[]; | ||
intents: (string | undefined)[] | undefined; | ||
nodes: (object | undefined)[] | undefined; | ||
}>, object>; |
@@ -97,3 +97,3 @@ "use strict"; | ||
UserTextOptionNodeSchema, | ||
UserSubmitNodeSchema | ||
UserSubmitNodeSchema, | ||
]); | ||
@@ -103,7 +103,7 @@ exports.GraphPolicySchemaV2 = yup_1.object().shape({ | ||
version: yup_1.string().required(), | ||
startNode: yup_1.object().oneOfSchemas([AgentUtteranceNodeSchema, AgentEmailNodeSchema, AgentFormNodeSchema]).required(), | ||
startNodeId: yup_1.string().required(), | ||
currentNode: NodeSchema, | ||
intents: yup_1.array().of(yup_1.string()).min(0).required(), | ||
intents: yup_1.array().of(yup_1.string()), | ||
nodes: yup_1.array().of(NodeSchema), | ||
}); | ||
//# sourceMappingURL=validator.js.map |
{ | ||
"name": "@bavard/agent-config", | ||
"version": "0.0.75", | ||
"version": "0.0.76", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -286,2 +286,3 @@ import { BaseAgentAction } from './actions/agent/base-action'; | ||
}; | ||
return jsonObj; | ||
@@ -326,2 +327,6 @@ } | ||
for (const policy of jsonObj.graphPoliciesV2 || []) { | ||
config.addGraphPolicyV2(GraphPolicyV2.fromJsonObj(policy)); | ||
} | ||
if (jsonObj.activePolicyName) { | ||
@@ -328,0 +333,0 @@ if (config.graphPolicies.has(jsonObj.activePolicyName)) { |
@@ -26,6 +26,4 @@ import { isEmpty } from 'lodash'; | ||
) { | ||
if (!allNodes.has(startNode)) { | ||
throw new Error('Start node not in all nodes.'); | ||
} | ||
this._currentNode = startNode; | ||
this.startNode = startNode; | ||
} | ||
@@ -35,2 +33,5 @@ | ||
this.allNodes.add(node); | ||
if (!this.startNode && node instanceof AgentNode) { | ||
this.startNode = node; | ||
} | ||
} | ||
@@ -37,0 +38,0 @@ |
@@ -11,3 +11,3 @@ import * as yup from './yup'; | ||
schemas: yup.MixedSchema[], | ||
message?: yup.TestOptionsMessage | ||
message?: yup.TestOptionsMessage, | ||
) { | ||
@@ -23,8 +23,8 @@ return this.test( | ||
return schemas.some((schema) => | ||
schema.isValidSync(item, { strict: true }) | ||
schema.isValidSync(item, { strict: true }), | ||
); | ||
}); | ||
} | ||
}, | ||
); | ||
} | ||
}, | ||
); | ||
@@ -34,3 +34,3 @@ | ||
schemas: yup.MixedSchema[], | ||
message?: yup.TestOptionsMessage | ||
message?: yup.TestOptionsMessage, | ||
) { | ||
@@ -42,5 +42,5 @@ return this.test( | ||
return schemas.some((schema) => | ||
schema.isValidSync(value, { strict: true }) | ||
schema.isValidSync(value, { strict: true }), | ||
); | ||
} | ||
}, | ||
); | ||
@@ -51,3 +51,3 @@ }); | ||
nodeId: number().required(), | ||
nodeType: mixed().oneOf([EUserNodeTypes.USER_SUBMIT]), | ||
nodeType: mixed().oneOf([EUserNodeTypes.USER_SUBMIT]), | ||
targetLinnk: string().optional(), | ||
@@ -59,3 +59,3 @@ childAgentNodeId: number().optional(), | ||
nodeId: number().required(), | ||
nodeType: mixed().oneOf([EUserNodeTypes.USER_IMAGE_OPTION]), | ||
nodeType: mixed().oneOf([EUserNodeTypes.USER_IMAGE_OPTION]), | ||
text: string().required(), | ||
@@ -97,7 +97,9 @@ imageName: string().required(), | ||
url: string().required(), | ||
fields: array(object().shape({ | ||
name: string(), | ||
type: string(), | ||
required: bool(), | ||
})).required(), | ||
fields: array( | ||
object().shape({ | ||
name: string(), | ||
type: string(), | ||
required: bool(), | ||
}), | ||
).required(), | ||
childUserNodes: array().of(number()), | ||
@@ -113,3 +115,3 @@ childAgentNodeId: number().optional(), | ||
UserTextOptionNodeSchema, | ||
UserSubmitNodeSchema | ||
UserSubmitNodeSchema, | ||
]); | ||
@@ -120,6 +122,6 @@ | ||
version: string().required(), | ||
startNode: object().oneOfSchemas([AgentUtteranceNodeSchema, AgentEmailNodeSchema, AgentFormNodeSchema]).required(), | ||
startNodeId: string().required(), | ||
currentNode: NodeSchema, | ||
intents: array().of(string()).min(0).required(), | ||
intents: array().of(string()), | ||
nodes: array().of(NodeSchema), | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
397073
8997