-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Merged by Bors] - feat: added importable types for survey context (PL-37) #359
Conversation
type: string; | ||
data: PrototypeData<Locale>; | ||
model: PrototypeModel; | ||
context: PrototypeContext<Command>; | ||
platform: string; | ||
settings: PrototypeSettings; | ||
surveyorContext: SurveyContext<SurveyContextExtension>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property is needed inside general-service
, which generates the surveyorContext
while it generates the prototype.
I think it makes the most sense to pull the surveyorContext
out of a finished prototype, rather than returning the surveyor context from general-service
before it gets passed into the prototype rendering code.
It leads to less brittle code, because if the prototype rendering modifies surveyorContext
for whatever reason, we capture that.
export interface AlexaSurveyContextExtension { | ||
products: Record<string, Product>; | ||
permissions: PermissionType[]; | ||
interfaces: InterfaceType[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some channels populate the surveyor context with additional data. The AlexaSurveyContextExtension
encodes these additional properties for Alexa. There is an extension that covers additional properties from Google and DFES.
@@ -24,7 +26,8 @@ export interface PlatformData extends VoiceVersion.PlatformData<Voice> { | |||
publishing: Publishing; | |||
} | |||
|
|||
export interface Version extends VoiceVersion.Version<Voice, BaseModels.Version.Prototype<AnyCommand, VoiceflowConstants.Locale>> { | |||
export interface Version | |||
extends VoiceVersion.Version<Voice, BaseModels.Version.Prototype<AnyCommand, VoiceflowConstants.Locale, AlexaSurveyContextExtension>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, I'm just passing in the AlexaSurveyContextExtension
to extend the SurveyContext
with Alexa-specific properties for this default "AlexaVersion" exported by alexa-types
.
In the code below, you'll see me do this a lot of places to avoid type issues in the *-service
s.
@@ -57,7 +62,7 @@ export interface Model<_PlatformData extends PlatformData, Command extends BaseC | |||
domains?: Domain[]; | |||
folders?: Record<string, Folder>; | |||
variables: Variable[]; | |||
prototype?: Prototype<Command, Locale>; | |||
prototype?: Prototype<Command, Locale, SurveyContextExt>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some boilerplate here to allow us to specify the SurveyContextExt
in SurveyContext
from an enclosing Version.Model
type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, lets merge it :)
5e10ce7
to
28a86c3
Compare
bors r+ |
<!-- You can erase any parts of this template not applicable to your Pull Request. --> **Fixes or implements PL-37** ### Brief description. What is this change? <!-- Build up some context for your teammates on the changes made here and potential tradeoffs made and/or highlight any topics for discussion --> Adds typing for `surveyorContext` on the `Version` data.
28a86c3
to
27f0a3e
Compare
Canceled. |
bors r+ |
<!-- You can erase any parts of this template not applicable to your Pull Request. --> **Fixes or implements PL-37** ### Brief description. What is this change? <!-- Build up some context for your teammates on the changes made here and potential tradeoffs made and/or highlight any topics for discussion --> Adds typing for `surveyorContext` on the `Version` data.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Pull request successfully merged into master. Build succeeded: |
Fixes or implements PL-37
Brief description. What is this change?
Adds typing for
surveyorContext
on theVersion
data.Implementation details. How do you make this change?
Added a
SurveyContext
type for theversion.prototype.surveyorContext
property.The
SurveyContext
can be extended by theSurveyContextExtension
type.Each channel extends the survey context with its own properties:
AlexaSurveyContextExtension
orGaDfesSurveyContextExtension
.The original source of truth of
SurveyContext
is actually in this file:general-service/lib/clients/platform/types.ts
. I've just broken it up so that the domain-specific properties belong to the domain-specific type package, and allowed the survey context to be shared.Setup information
N/A
Deployment Notes
libs
- Can be merged nowgeneral-service
- Can be merged afterlibs
alexa-service
+google-service
- Merged after theprototype-programs
migration is doneRelated PRs
Blocked by: https://github.com/voiceflow/creator-app/pull/5881
[Merged by Bors] - feat: added importable types for survey context (PL-37) #359
https://github.com/voiceflow/alexa-service/pull/294
https://github.com/voiceflow/general-service/pull/396
https://github.com/voiceflow/google-service/pull/311
Checklist