@bavard/agent-config
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -14,2 +14,3 @@ import { BotSettings } from './agent-settings'; | ||
private graphPolicies; | ||
private activePolicyName?; | ||
constructor(projectId: string, uname: string, language: string); | ||
@@ -28,4 +29,6 @@ addIntent(name: string, defaultActionName?: string): void; | ||
getGraphPolicies(): GraphPolicy[]; | ||
getActiveGraphPolicy(): GraphPolicy | undefined; | ||
setActiveGraphPolicy(name: string): void; | ||
toJsonObj(): IAgentConfig; | ||
static fromJsonObj(jsonObj: IAgentConfig): AgentConfig; | ||
} |
@@ -62,2 +62,15 @@ "use strict"; | ||
} | ||
getActiveGraphPolicy() { | ||
if (this.activePolicyName && this.graphPolicies.has(this.activePolicyName)) { | ||
return this.graphPolicies.get(name); | ||
} | ||
} | ||
setActiveGraphPolicy(name) { | ||
if (this.graphPolicies.has(name)) { | ||
this.activePolicyName = name; | ||
} | ||
else { | ||
throw new Error(`No graph policy with name "${name}" was found.`); | ||
} | ||
} | ||
// serialization | ||
@@ -64,0 +77,0 @@ toJsonObj() { |
{ | ||
"name": "@bavard/agent-config", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,2 +17,3 @@ import { BotSettings } from './agent-settings'; | ||
private graphPolicies: Map<string, GraphPolicy> = new Map(); | ||
private activePolicyName?: string; | ||
@@ -82,2 +83,16 @@ constructor(projectId: string, uname: string, language: string) { | ||
getActiveGraphPolicy(): GraphPolicy | undefined { | ||
if (this.activePolicyName && this.graphPolicies.has(this.activePolicyName)) { | ||
return this.graphPolicies.get(name); | ||
} | ||
} | ||
setActiveGraphPolicy(name: string) { | ||
if (this.graphPolicies.has(name)) { | ||
this.activePolicyName = name; | ||
} else { | ||
throw new Error(`No graph policy with name "${name}" was found.`); | ||
} | ||
} | ||
// serialization | ||
@@ -84,0 +99,0 @@ toJsonObj(): IAgentConfig { |
31908
903