Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit82eed3d

Browse files
committed
add tutorial id to webhooks
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent124a092 commit82eed3d

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

‎src/actions/onRunReset.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ const onRunReset = async (action: ResetAction, context: Context): Promise<void>
3232
// if tutorial.config.reset.command, run it
3333
constresetActions=tutorial?.config?.reset
3434
if(resetActions){
35-
hooks.onReset({commands:resetActions?.commands,vscodeCommands:resetActions?.vscodeCommands})
35+
hooks.onReset(
36+
{commands:resetActions?.commands,vscodeCommands:resetActions?.vscodeCommands},
37+
tutorial?.idasstring,
38+
)
3639
}
3740
}
3841

‎src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const createCommands = ({ extensionPath, workspaceState }: CreateCommandP
6565
if(!alreadyConfigured){
6666
constsetupActions=data.config.setup
6767
if(setupActions){
68-
hooks.onInit(setupActions)
68+
hooks.onInit(setupActions,data.id)
6969
}
7070
}
7171
testRunner=createTestRunner(data,{

‎src/services/hooks/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import { VERSION } from '../../environment'
1111
import*aswebhooksfrom'./webhooks'
1212

1313
// run at the end of when a tutorial is configured
14-
exportconstonInit=async(actions:TT.StepActions):Promise<void>=>{
14+
exportconstonInit=async(actions:TT.StepActions,tutorialId:string):Promise<void>=>{
1515
awaitloadCommits(actions?.commits)
1616
awaitrunCommands(actions?.commands)
1717
awaitrunVSCodeCommands(actions?.vscodeCommands)
1818
webhooks.onInit({
19-
//tutorialId,
19+
tutorialId,
2020
coderoadVersion:VERSION,
2121
})
2222
}
@@ -47,12 +47,12 @@ export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> =>
4747
}
4848

4949
// run when "reset" is triggered
50-
exportconstonReset=async(actions:TT.StepActions):Promise<void>=>{
50+
exportconstonReset=async(actions:TT.StepActions,tutorialId:string):Promise<void>=>{
5151
awaitresetWatchers()
5252
awaitrunCommands(actions?.commands)
5353
awaitrunVSCodeCommands(actions?.vscodeCommands)
5454
webhooks.onReset({
55-
//tutorialId,
55+
tutorialId,
5656
})
5757
}
5858

‎src/services/hooks/webhooks.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,47 +26,47 @@ const callWebhookEndpoint = async <B>(bodyObject: B): Promise<void> => {
2626
}
2727
}
2828

29-
typeInitEvent={
30-
//tutorialId: string;
29+
typeWebhookEventInit={
30+
tutorialId:string
3131
coderoadVersion:string
3232
}
3333

34-
exportconstonInit=(event:InitEvent):void=>{
34+
exportconstonInit=(event:WebhookEventInit):void=>{
3535
if(WEBHOOKS.init){
36-
callWebhookEndpoint<InitEvent>(event)
36+
callWebhookEndpoint<WebhookEventInit>(event)
3737
}
3838
}
3939

40-
typeResetEvent={
41-
//tutorialId: string;
40+
typeWebhookEventReset={
41+
tutorialId:string
4242
}
4343

44-
exportconstonReset=(event:ResetEvent):void=>{
44+
exportconstonReset=(event:WebhookEventReset):void=>{
4545
if(WEBHOOKS.reset){
46-
callWebhookEndpoint<ResetEvent>(event)
46+
callWebhookEndpoint<WebhookEventReset>(event)
4747
}
4848
}
4949

50-
typeStepCompleteEvent={tutorialId:string;version:string;levelId:string;stepId:string}
50+
typeWebhookEventStepComplete={tutorialId:string;version:string;levelId:string;stepId:string}
5151

52-
exportconstonStepComplete=(event:StepCompleteEvent):void=>{
52+
exportconstonStepComplete=(event:WebhookEventStepComplete):void=>{
5353
if(WEBHOOKS.step_complete){
54-
callWebhookEndpoint<StepCompleteEvent>(event)
54+
callWebhookEndpoint<WebhookEventStepComplete>(event)
5555
}
5656
}
5757

58-
typeLevelCompleteEvent={tutorialId:string;version:string;levelId:string}
58+
typeWebhookEventLevelComplete={tutorialId:string;version:string;levelId:string}
5959

60-
exportconstonLevelComplete=(event:LevelCompleteEvent):void=>{
60+
exportconstonLevelComplete=(event:WebhookEventLevelComplete):void=>{
6161
if(WEBHOOKS.level_complete){
62-
callWebhookEndpoint<LevelCompleteEvent>(event)
62+
callWebhookEndpoint<WebhookEventLevelComplete>(event)
6363
}
6464
}
6565

66-
typeTutorialCompleteEvent={tutorialId:string;version:string}
66+
typeWebhookEevntTutorialComplete={tutorialId:string;version:string}
6767

68-
exportconstonTutorialComplete=(event:TutorialCompleteEvent):void=>{
68+
exportconstonTutorialComplete=(event:WebhookEevntTutorialComplete):void=>{
6969
if(WEBHOOKS.tutorial_complete){
70-
callWebhookEndpoint<TutorialCompleteEvent>(event)
70+
callWebhookEndpoint<WebhookEevntTutorialComplete>(event)
7171
}
7272
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp