@learnpack/learnpack 5.0.10 → 5.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/lib/commands/start.js +5 -0
- package/lib/managers/server/routes.js +5 -0
- package/lib/managers/session.js +6 -1
- package/lib/managers/telemetry.d.ts +21 -3
- package/lib/managers/telemetry.js +41 -9
- package/lib/models/session.d.ts +2 -0
- package/lib/utils/api.d.ts +1 -1
- package/lib/utils/api.js +7 -2
- package/lib/utils/checkNotInstalled.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/start.ts +6 -0
- package/src/managers/server/routes.ts +6 -0
- package/src/managers/session.ts +9 -1
- package/src/managers/telemetry.ts +423 -353
- package/src/models/session.ts +2 -0
- package/src/utils/api.ts +10 -3
- package/src/utils/checkNotInstalled.ts +2 -3
package/src/models/session.ts
CHANGED
package/src/utils/api.ts
CHANGED
@@ -229,7 +229,7 @@ const APIError = (error: TypeError | string, code?: number) => {
|
|
229
229
|
return _err
|
230
230
|
}
|
231
231
|
|
232
|
-
const sendBatchTelemetry = async function (url: string, body:
|
232
|
+
const sendBatchTelemetry = async function (url: string, body: any) {
|
233
233
|
if (!url) {
|
234
234
|
return
|
235
235
|
}
|
@@ -240,10 +240,17 @@ const sendBatchTelemetry = async function (url: string, body: object) {
|
|
240
240
|
!Object.prototype.hasOwnProperty.call(session, "token") ||
|
241
241
|
session.token === ""
|
242
242
|
) {
|
243
|
-
Console.debug("No token found, skipping
|
243
|
+
Console.debug("No token found, skipping batch telemetry delivery")
|
244
|
+
return
|
245
|
+
}
|
246
|
+
|
247
|
+
if (!session || !session.user_id || session.user_id === "") {
|
248
|
+
Console.debug("No user_id found, skipping batch telemetry delivery")
|
244
249
|
return
|
245
250
|
}
|
246
251
|
|
252
|
+
body.user_id = session.user_id
|
253
|
+
|
247
254
|
fetch(
|
248
255
|
url,
|
249
256
|
{
|
@@ -254,7 +261,7 @@ const sendBatchTelemetry = async function (url: string, body: object) {
|
|
254
261
|
)
|
255
262
|
.then(response => {
|
256
263
|
Console.debug("Telemetry sent successfully")
|
257
|
-
return response
|
264
|
+
return response
|
258
265
|
})
|
259
266
|
.catch(error => {
|
260
267
|
Console.debug("Error while sending batch Telemetry", error)
|
@@ -166,7 +166,8 @@ export const checkNotInstalledDependencies = async (
|
|
166
166
|
Console.info("Checking needed dependencies...")
|
167
167
|
|
168
168
|
const jsPluginsDependencies = ["jest@29.7.0", "jest-environment-jsdom@29.7.0"]
|
169
|
-
|
169
|
+
// pytest up to 6.2.5
|
170
|
+
const pyPluginsDependencies = ["pytest", "pytest-testdox", "mock"]
|
170
171
|
|
171
172
|
const npmLsCommand = "npm ls jest jest-environment-jsdom -g"
|
172
173
|
|
@@ -221,8 +222,6 @@ return true
|
|
221
222
|
}
|
222
223
|
|
223
224
|
if (pytestNeeded) {
|
224
|
-
console.log("Trying to install pytest dependencies")
|
225
|
-
|
226
225
|
const { stdout, stderr } = await exec("pip list")
|
227
226
|
if (stderr) {
|
228
227
|
Console.error(`Error executing pip list. Use debug for more info`)
|