@learnpack/learnpack 4.0.14 → 4.0.16

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @learnpack/learnpack
21
21
  $ learnpack COMMAND
22
22
  running command...
23
23
  $ learnpack (-v|--version|version)
24
- @learnpack/learnpack/4.0.14 win32-x64 node-v20.16.0
24
+ @learnpack/learnpack/4.0.16 win32-x64 node-v20.16.0
25
25
  $ learnpack --help [COMMAND]
26
26
  USAGE
27
27
  $ learnpack COMMAND
@@ -74,7 +74,7 @@ DESCRIPTION
74
74
  12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
75
75
  ```
76
76
 
77
- _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\audit.ts)_
77
+ _See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\audit.ts)_
78
78
 
79
79
  ## `learnpack clean`
80
80
 
@@ -89,7 +89,7 @@ DESCRIPTION
89
89
  Extra documentation goes here
90
90
  ```
91
91
 
92
- _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\clean.ts)_
92
+ _See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\clean.ts)_
93
93
 
94
94
  ## `learnpack download [PACKAGE]`
95
95
 
@@ -107,7 +107,7 @@ DESCRIPTION
107
107
  Extra documentation goes here
108
108
  ```
109
109
 
110
- _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\download.ts)_
110
+ _See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\download.ts)_
111
111
 
112
112
  ## `learnpack help [COMMAND]`
113
113
 
@@ -138,7 +138,7 @@ OPTIONS
138
138
  -h, --grading show CLI help
139
139
  ```
140
140
 
141
- _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\init.ts)_
141
+ _See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\init.ts)_
142
142
 
143
143
  ## `learnpack login [PACKAGE]`
144
144
 
@@ -156,7 +156,7 @@ DESCRIPTION
156
156
  Extra documentation goes here
157
157
  ```
158
158
 
159
- _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\login.ts)_
159
+ _See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\login.ts)_
160
160
 
161
161
  ## `learnpack logout [PACKAGE]`
162
162
 
@@ -174,7 +174,7 @@ DESCRIPTION
174
174
  Extra documentation goes here
175
175
  ```
176
176
 
177
- _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\logout.ts)_
177
+ _See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\logout.ts)_
178
178
 
179
179
  ## `learnpack plugins`
180
180
 
@@ -305,7 +305,7 @@ OPTIONS
305
305
  -h, --help show CLI help
306
306
  ```
307
307
 
308
- _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\publish.ts)_
308
+ _See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\publish.ts)_
309
309
 
310
310
  ## `learnpack start`
311
311
 
@@ -326,7 +326,7 @@ OPTIONS
326
326
  -w, --watch Watch for file changes
327
327
  ```
328
328
 
329
- _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\start.ts)_
329
+ _See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\start.ts)_
330
330
 
331
331
  ## `learnpack test [EXERCISESLUG]`
332
332
 
@@ -340,7 +340,7 @@ ARGUMENTS
340
340
  EXERCISESLUG The name of the exercise to test
341
341
  ```
342
342
 
343
- _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.14/src\commands\test.ts)_
343
+ _See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v4.0.16/src\commands\test.ts)_
344
344
  <!-- commandsstop -->
345
345
 
346
346
  > > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
@@ -77,15 +77,11 @@ async function default_1(app, configObject, configManager) {
77
77
  }));
78
78
  app.post("/set-tab-hash", jsonBodyParser, withHandler(async (req, res) => {
79
79
  const hash = req.body.hash;
80
- // Ensure token is provided in the request body
81
- console_1.default.error("TRYINH YO SET TAB HASH IN CLI");
82
- console_1.default.success(hash);
83
80
  if (!hash) {
84
81
  return res.status(400).json({ error: "Token is required" });
85
82
  }
86
83
  try {
87
84
  const hashSaved = await session_1.default.setTabHash(hash);
88
- // Check if the token was saved successfully
89
85
  if (hashSaved) {
90
86
  res.json({ status: "ok" });
91
87
  }
@@ -94,7 +90,43 @@ async function default_1(app, configObject, configManager) {
94
90
  }
95
91
  }
96
92
  catch (_a) {
97
- // Handle any unexpected errors during the process
93
+ res.status(500).json({ error: "Internal server error" });
94
+ }
95
+ }));
96
+ app.post("/set-session-key", jsonBodyParser, withHandler(async (req, res) => {
97
+ const sessionKey = req.body.sessionKey;
98
+ if (!sessionKey) {
99
+ return res.status(400).json({ error: "Token is required" });
100
+ }
101
+ try {
102
+ const sessionSaved = await session_1.default.setSessionKey(sessionKey);
103
+ if (sessionSaved) {
104
+ res.json({ status: "ok" });
105
+ }
106
+ else {
107
+ res.status(500).json({ error: "Failed to save the token" });
108
+ }
109
+ }
110
+ catch (_a) {
111
+ res.status(500).json({ error: "Internal server error" });
112
+ }
113
+ }));
114
+ app.post("/set-session", jsonBodyParser, withHandler(async (req, res) => {
115
+ const payload = req.body.payload;
116
+ if (!payload) {
117
+ return res.status(400).json({ error: "Token is required" });
118
+ }
119
+ try {
120
+ const payloadSaved = await session_1.default.setPayload(payload);
121
+ if (payloadSaved) {
122
+ res.json({ status: "ok" });
123
+ socket_1.default.sessionRefreshed(payload);
124
+ }
125
+ else {
126
+ res.status(500).json({ error: "Failed to save the token" });
127
+ }
128
+ }
129
+ catch (_a) {
98
130
  res.status(500).json({ error: "Internal server error" });
99
131
  }
100
132
  }));
@@ -227,15 +259,6 @@ async function default_1(app, configObject, configManager) {
227
259
  res.end();
228
260
  }
229
261
  }));
230
- /*
231
- app.post(
232
- "/exercise/:slug/file/:fileName",
233
- withHandler((req: express.Request, res: express.Response) => {
234
- get tokens but also, add allowed action for 'generate'
235
- use the sessionManager to keep compatibility with the cli login command.
236
- })
237
- );
238
- */
239
262
  const textBodyParser = bodyParser.text();
240
263
  app.put("/exercise/:slug/file/:fileName", textBodyParser, withHandler((req, res) => {
241
264
  const exercise = configManager.getExercise(req.params.slug);
@@ -37,7 +37,14 @@ const Session = {
37
37
  await this.initialize();
38
38
  const payload = await storage.getItem("bc-payload");
39
39
  await storage.setItem("bc-payload", Object.assign(Object.assign({}, payload), { tabHash: hash }));
40
- console_1.default.debug("Rigobot token successfuly set");
40
+ console_1.default.debug("tabHash successfuly set");
41
+ return true;
42
+ },
43
+ setSessionKey: async function (value) {
44
+ await this.initialize();
45
+ const payload = await storage.getItem("bc-payload");
46
+ await storage.setItem("bc-payload", Object.assign(Object.assign({}, payload), { sessionKey: value }));
47
+ console_1.default.debug("sessionKey successfuly set");
41
48
  return true;
42
49
  },
43
50
  setPayload: async function (value) {
@@ -103,6 +103,9 @@ const SocketManager = {
103
103
  });
104
104
  });
105
105
  },
106
+ sessionRefreshed: function (data) {
107
+ this.emit("session-refreshed", "", [data]);
108
+ },
106
109
  reload: function (files = null, exercises = null) {
107
110
  this.emit("reload", (files === null || files === void 0 ? void 0 : files.join("")) || "", exercises);
108
111
  },
@@ -1,2 +1,2 @@
1
- export type TAction = "test" | "log" | "reload" | "ready" | "clean" | "ask" | "file_change" | "dialog";
1
+ export type TAction = "test" | "log" | "reload" | "ready" | "clean" | "ask" | "file_change" | "dialog" | "session-refreshed";
2
2
  export type ICallback = (...agrs: any[]) => any;
@@ -19,6 +19,7 @@ export interface ISession {
19
19
  initialize: () => Promise<boolean>;
20
20
  setRigoToken: (token: string) => Promise<boolean>;
21
21
  setTabHash: (hash: string) => Promise<boolean>;
22
+ setSessionKey: (value: string) => Promise<boolean>;
22
23
  setPayload: (value: IPayload) => Promise<boolean>;
23
24
  getPayload: () => Promise<any>;
24
25
  isActive: () => boolean;
@@ -20,6 +20,7 @@ export interface ISocket {
20
20
  clean: (_: string, logs: Array<any>) => void;
21
21
  complete: () => void;
22
22
  ask: (questions: Array<string>) => void;
23
+ sessionRefreshed: (data: any) => void;
23
24
  reload: (files: Array<string> | null, exercises: Array<string>) => void;
24
25
  openWindow: (id: string) => void;
25
26
  log: (status: TStatus, messages?: string | Array<string>, report?: Array<string>, data?: any) => void;
@@ -1 +1 @@
1
- {"version":"4.0.14","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]}}}
1
+ {"version":"4.0.16","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@learnpack/learnpack",
3
3
  "description": "Create, sell or download and take learning amazing learning packages",
4
- "version": "4.0.14",
4
+ "version": "4.0.16",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -110,28 +110,66 @@ export default async function (
110
110
  jsonBodyParser,
111
111
  withHandler(async (req: express.Request, res: express.Response) => {
112
112
  const hash = req.body.hash
113
- // Ensure token is provided in the request body
114
-
115
- Console.error("TRYINH YO SET TAB HASH IN CLI")
116
- Console.success(hash)
117
113
  if (!hash) {
118
114
  return res.status(400).json({ error: "Token is required" })
119
115
  }
120
116
 
121
117
  try {
122
118
  const hashSaved = await SessionManager.setTabHash(hash)
123
- // Check if the token was saved successfully
124
119
  if (hashSaved) {
125
120
  res.json({ status: "ok" })
126
121
  } else {
127
122
  res.status(500).json({ error: "Failed to save the token" })
128
123
  }
129
124
  } catch {
130
- // Handle any unexpected errors during the process
131
125
  res.status(500).json({ error: "Internal server error" })
132
126
  }
133
127
  })
134
128
  )
129
+ app.post(
130
+ "/set-session-key",
131
+ jsonBodyParser,
132
+ withHandler(async (req: express.Request, res: express.Response) => {
133
+ const sessionKey = req.body.sessionKey
134
+ if (!sessionKey) {
135
+ return res.status(400).json({ error: "Token is required" })
136
+ }
137
+
138
+ try {
139
+ const sessionSaved = await SessionManager.setSessionKey(sessionKey)
140
+ if (sessionSaved) {
141
+ res.json({ status: "ok" })
142
+ } else {
143
+ res.status(500).json({ error: "Failed to save the token" })
144
+ }
145
+ } catch {
146
+ res.status(500).json({ error: "Internal server error" })
147
+ }
148
+ })
149
+ )
150
+ app.post(
151
+ "/set-session",
152
+ jsonBodyParser,
153
+ withHandler(async (req: express.Request, res: express.Response) => {
154
+ const payload = req.body.payload
155
+ if (!payload) {
156
+ return res.status(400).json({ error: "Token is required" })
157
+ }
158
+
159
+ try {
160
+ const payloadSaved = await SessionManager.setPayload(payload)
161
+ if (payloadSaved) {
162
+ res.json({ status: "ok" })
163
+ socket.sessionRefreshed(payload)
164
+ } else {
165
+ res.status(500).json({ error: "Failed to save the token" })
166
+ }
167
+ } catch {
168
+ res.status(500).json({ error: "Internal server error" })
169
+ }
170
+ })
171
+ )
172
+
135
173
  app.get(
136
174
  "/check/rigo/status",
137
175
  withHandler(async (_: express.Request, res: express.Response) => {
@@ -333,16 +371,6 @@ throw new Error("File not found: " + filePath)
333
371
  })
334
372
  )
335
373
 
336
- /*
337
- app.post(
338
- "/exercise/:slug/file/:fileName",
339
- withHandler((req: express.Request, res: express.Response) => {
340
- get tokens but also, add allowed action for 'generate'
341
- use the sessionManager to keep compatibility with the cli login command.
342
- })
343
- );
344
- */
345
-
346
374
  const textBodyParser = bodyParser.text()
347
375
  app.put(
348
376
  "/exercise/:slug/file/:fileName",
@@ -51,7 +51,17 @@ const Session: ISession = {
51
51
  ...payload,
52
52
  tabHash: hash,
53
53
  })
54
- Console.debug("Rigobot token successfuly set")
54
+ Console.debug("tabHash successfuly set")
55
+ return true
56
+ },
57
+ setSessionKey: async function (value: string) {
58
+ await this.initialize()
59
+ const payload = await storage.getItem("bc-payload")
60
+ await storage.setItem("bc-payload", {
61
+ ...payload,
62
+ sessionKey: value,
63
+ })
64
+ Console.debug("sessionKey successfuly set")
55
65
  return true
56
66
  },
57
67
  setPayload: async function (value: IPayload) {
@@ -140,6 +140,10 @@ actions = [actions]
140
140
  })
141
141
  })
142
142
  },
143
+ sessionRefreshed: function (data) {
144
+ this.emit("session-refreshed", "", [data])
145
+ },
146
+
143
147
  reload: function (
144
148
  files: Array<string> | null = null,
145
149
  exercises: Array<string> | null = null
@@ -6,6 +6,7 @@ export type TAction =
6
6
  | "clean"
7
7
  | "ask"
8
8
  | "file_change"
9
- | "dialog";
9
+ | "dialog"
10
+ | "session-refreshed"
10
11
 
11
- export type ICallback = (...agrs: any[]) => any;
12
+ export type ICallback = (...agrs: any[]) => any
@@ -23,6 +23,7 @@ export interface ISession {
23
23
  initialize: () => Promise<boolean>
24
24
  setRigoToken: (token: string) => Promise<boolean>
25
25
  setTabHash: (hash: string) => Promise<boolean>
26
+ setSessionKey: (value: string) => Promise<boolean>
26
27
  setPayload: (value: IPayload) => Promise<boolean>
27
28
  getPayload: () => Promise<any>
28
29
  isActive: () => boolean
@@ -9,7 +9,7 @@ export type TPossibleActions =
9
9
  | "test"
10
10
  | "reset"
11
11
  | "tutorial"
12
- | "generate";
12
+ | "generate"
13
13
 
14
14
  export interface ISocket {
15
15
  socket: Server<
@@ -17,27 +17,28 @@ export interface ISocket {
17
17
  DefaultEventsMap,
18
18
  DefaultEventsMap,
19
19
  any
20
- > | null;
21
- config: IConfig | null;
22
- allowedActions: Array<TPossibleActions>;
23
- actionCallBacks: { [key: string]: ICallback };
24
- possibleActions: Array<TPossibleActions>;
25
- isTestingEnvironment: boolean;
26
- addAllowed: (actions: any) => void;
27
- removeAllowed: (actions: any) => void;
28
- start: (config: IConfig, server: any, isTestingEnvironment: boolean) => void;
29
- on: (action: any, callBack: any) => void;
30
- clean: (_: string, logs: Array<any>) => void;
31
- complete: () => void;
32
- ask: (questions: Array<string>) => void;
33
- reload: (files: Array<string> | null, exercises: Array<string>) => void;
34
- openWindow: (id: string) => void;
20
+ > | null
21
+ config: IConfig | null
22
+ allowedActions: Array<TPossibleActions>
23
+ actionCallBacks: { [key: string]: ICallback }
24
+ possibleActions: Array<TPossibleActions>
25
+ isTestingEnvironment: boolean
26
+ addAllowed: (actions: any) => void
27
+ removeAllowed: (actions: any) => void
28
+ start: (config: IConfig, server: any, isTestingEnvironment: boolean) => void
29
+ on: (action: any, callBack: any) => void
30
+ clean: (_: string, logs: Array<any>) => void
31
+ complete: () => void
32
+ ask: (questions: Array<string>) => void
33
+ sessionRefreshed: (data: any) => void
34
+ reload: (files: Array<string> | null, exercises: Array<string>) => void
35
+ openWindow: (id: string) => void
35
36
  log: (
36
37
  status: TStatus,
37
38
  messages?: string | Array<string>,
38
39
  report?: Array<string>,
39
40
  data?: any
40
- ) => void;
41
+ ) => void
41
42
  emit: (
42
43
  action: TAction,
43
44
  status: TStatus | string,
@@ -45,16 +46,16 @@ export interface ISocket {
45
46
  inputs?: Array<string>,
46
47
  report?: Array<string>,
47
48
  data?: any
48
- ) => void;
49
- ready: (message: string) => void;
50
- error: (type: any, stdout: string) => void;
51
- fatal: (msg: string) => void;
52
- dialog: (message: string) => void;
53
- success: (type: any, stdout: string) => void;
54
- onTestingFinished: (obj: any) => void;
49
+ ) => void
50
+ ready: (message: string) => void
51
+ error: (type: any, stdout: string) => void
52
+ fatal: (msg: string) => void
53
+ dialog: (message: string) => void
54
+ success: (type: any, stdout: string) => void
55
+ onTestingFinished: (obj: any) => void
55
56
  }
56
57
 
57
58
  export type TOpenWindowData = {
58
- url: string;
59
- exerciseSlug: string;
60
- };
59
+ url: string
60
+ exerciseSlug: string
61
+ }