-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import 'reflect-metadata'; | ||
export declare const DialogFlowParam: (property?: string) => (target: any, key: any, index: any) => any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("reflect-metadata"); | ||
const constant_1 = require("../constant"); | ||
exports.DialogFlowParam = (property) => { | ||
return (target, key, index) => { | ||
const metadataValue = Reflect.getMetadata(constant_1.DIALOG_FLOW_PARAMS, target) || []; | ||
metadataValue.push({ key, property, index }); | ||
Reflect.defineMetadata(constant_1.DIALOG_FLOW_PARAMS, metadataValue, target); | ||
return target; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export declare const dialogFlowResponseData: { | ||
"responseId": string; | ||
"queryResult": { | ||
"queryText": string; | ||
"parameters": { | ||
"date": string; | ||
"geo-city": string; | ||
}; | ||
"allRequiredParamsPresent": boolean; | ||
"fulfillmentMessages": { | ||
"text": { | ||
"text": string[]; | ||
}; | ||
}[]; | ||
"outputContexts": { | ||
"name": string; | ||
"lifespanCount": number; | ||
"parameters": { | ||
"date.original": string; | ||
"date": string; | ||
"geo-city.original": string; | ||
"geo-city": string; | ||
}; | ||
}[]; | ||
"intent": { | ||
"name": string; | ||
"displayName": string; | ||
}; | ||
"intentDetectionConfidence": number; | ||
"diagnosticInfo": { | ||
"webhook_latency_ms": number; | ||
}; | ||
"languageCode": string; | ||
}; | ||
"webhookStatus": { | ||
"code": number; | ||
"message": string; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dialogFlowResponseData = { | ||
"responseId": "1d05835a-1092-442e-b363-910c34c6e735", | ||
"queryResult": { | ||
"queryText": "Météo de demain à marseille", | ||
"parameters": { | ||
"date": "2018-05-16T12:00:00+02:00", | ||
"geo-city": "Marseille" | ||
}, | ||
"allRequiredParamsPresent": true, | ||
"fulfillmentMessages": [ | ||
{ | ||
"text": { | ||
"text": [ | ||
"" | ||
] | ||
} | ||
} | ||
], | ||
"outputContexts": [ | ||
{ | ||
"name": "projects/hermes-d8e54/agent/sessions/f060c5a3-f95e-4551-aedd-3d970d0d4dc4/contexts/weather_question", | ||
"lifespanCount": 5, | ||
"parameters": { | ||
"date.original": "de demain", | ||
"date": "2018-05-16T12:00:00+02:00", | ||
"geo-city.original": "marseille", | ||
"geo-city": "Marseille" | ||
} | ||
} | ||
], | ||
"intent": { | ||
"name": "projects/hermes-d8e54/agent/intents/62e2d690-bf1b-4eaa-af39-c9c0d48b8c41", | ||
"displayName": "Question:weather" | ||
}, | ||
"intentDetectionConfidence": 1, | ||
"diagnosticInfo": { | ||
"webhook_latency_ms": 75 | ||
}, | ||
"languageCode": "fr" | ||
}, | ||
"webhookStatus": { | ||
"code": 5, | ||
"message": "Webhook call failed. Error: 404 Not Found" | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare function applyParamsMetadataDecorator(paramsMetadata: any[], args: any[]): any[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function applyParamsMetadataDecorator(paramsMetadata, args) { | ||
if (paramsMetadata.length && args.length) { | ||
for (const param of paramsMetadata) { | ||
if (typeof args[param.index] === 'object') { | ||
if (!param.property) { | ||
args[param.index] = args[param.index]; | ||
continue; | ||
} | ||
args[param.index] = param.property | ||
.split('.') | ||
.reduce((accumulator, property) => accumulator[property], args[param.index]); | ||
} | ||
} | ||
} | ||
return args; | ||
} | ||
exports.applyParamsMetadataDecorator = applyParamsMetadataDecorator; |