Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: events and directive #55

Merged
merged 9 commits into from
Jun 1, 2020
Merged

feat: events and directive #55

merged 9 commits into from
Jun 1, 2020

Conversation

DecathectZero
Copy link
Member

@DecathectZero DecathectZero commented May 11, 2020

contingent on:

voiceflow/database: https://github.com/voiceflow/database/pull/41
voiceflow/app: https://github.com/voiceflow/creator-app/pull/1612
voiceflow/api: https://github.com/voiceflow/creator-api/pull/359

renamed previous eventHandler to permissionHandler

the new eventHandler is for the event block, and attempts to intercept and modify the stack (like the intent block) but at the Alexa Handler level, not the Voiceflow Client Handler level.

@DecathectZero DecathectZero added the in review Being reviewed by another developer or reacting to review comments label May 11, 2020
Copy link
Member

@z4o4z z4o4z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like prototype tool doesn't work with Event, I guess it can be fixed on the front-end by sending another request type

import { Command, Context, extractFrameCommand } from '@voiceflow/client';

import { EventRequest, RequestType } from '@/lib/services/voiceflow/types';
// import { mapSlots } from '@/lib/services/voiceflow/utils';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed

Comment on lines 7 to 9
// export enum Request {
// INTENT = 'IntentRequest',
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed

const utilsObj = {
buildContext,
getEvent,
// handleEvent,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed

Comment on lines 18 to 31
// export const EventHandlerGenerator = (utils: typeof utilsObj): RequestHandler => ({
// async canHandle(input: HandlerInput): Promise<boolean> {
// const context = await utils.buildContext(input);
// return !!getEvent(context);
// },
// async handle(input: HandlerInput) {
// const context = await utils.buildContext(input);
// // based on the event, modify the context
// await handleEvent(context);
// input.attributesManager.setPersistentAttributes(context.getRawState());

// return IntentHandler.handle(input);
// },
// });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed

@z4o4z z4o4z added changes requested and removed in review Being reviewed by another developer or reacting to review comments labels Jun 1, 2020
@effervescentia
Copy link
Contributor

effervescentia commented Jun 1, 2020

Codecov Report

Merging #55 into master will decrease coverage by 1.99%.
The diff coverage is 63.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #55      +/-   ##
==========================================
- Coverage   97.65%   95.65%   -2.00%     
==========================================
  Files          88       92       +4     
  Lines        1578     1658      +80     
  Branches      260      273      +13     
==========================================
+ Hits         1541     1586      +45     
- Misses         27       62      +35     
  Partials       10       10              
Impacted Files Coverage Δ
lib/services/alexa/index.ts 100.00% <ø> (ø)
lib/services/alexa/request/event/context.ts 21.62% <21.62%> (ø)
lib/services/alexa/request/event/index.ts 50.00% <50.00%> (ø)
lib/constants/flags.ts 100.00% <100.00%> (ø)
lib/services/alexa/request/error.ts 100.00% <100.00%> (ø)
lib/services/alexa/request/index.ts 100.00% <100.00%> (ø)
lib/services/alexa/request/intent/index.ts 100.00% <100.00%> (ø)
lib/services/alexa/request/lifecycle/context.ts 100.00% <100.00%> (ø)
lib/services/alexa/request/permission.ts 100.00% <100.00%> (ø)
lib/services/alexa/request/sessionEnded.ts 100.00% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60d1074...e776e44. Read the comment docs.

Copy link
Contributor

@leartgjoni-voiceflow leartgjoni-voiceflow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job! There's a lot of comments to cleanup and there's no tests for the new event handler (in case time is tight, let's create a ticket in Jira for adding tests)

@@ -0,0 +1,50 @@
import { HandlerFactory } from '@voiceflow/client';
import { Directive } from 'ask-sdk-model';
import _isString from 'lodash/isString';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@DecathectZero DecathectZero merged commit b3e0a4c into master Jun 1, 2020
@DecathectZero DecathectZero deleted the tyler/events/CORE-3116 branch June 1, 2020 22:03
@voiceflow-dev
Copy link

🎉 This PR is included in version 1.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

DecathectZero added a commit that referenced this pull request Sep 8, 2020
* wip: add directive handlers

* chore: handlers

* chore: event setup

* wip: event implementation

* chore: fixed tests

* test: add directive handler tests

* chore: update client to make tests pass

* chore: remove comments and clean up

* chore: variable mapping

Co-authored-by: leartgjoni-voiceflow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants