New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

swdc-tracker

Package Overview
Dependencies
Maintainers
5
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swdc-tracker - npm Package Compare versions

Comparing version 1.3.3 to 1.4.0

dist/entities/uncommitted_change.d.ts

2

dist/events/editor_action.js

@@ -14,3 +14,3 @@ "use strict";

return {
schema: "iglu:com.software/editor_action/jsonschema/1-0-1",
schema: "iglu:com.software/editor_action/jsonschema/1-0-2",
data: {

@@ -17,0 +17,0 @@ entity: this.entity,

@@ -52,2 +52,3 @@ "use strict";

var editor_action_1 = require("./events/editor_action");
var git_event_1 = require("./events/git_event");
var response_1 = require("./utils/response");

@@ -135,2 +136,20 @@ var env_helper_1 = require("./utils/env_helper");

/**
* @param gitEvent - the GitEvent event extends Repo, Project, UncommittedChange, Auth
*/
swdcTracker.trackGitEvent = function (params) { return __awaiter(void 0, void 0, void 0, function () {
var _codetimePayload, contexts;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, new git_event_1.GitEvent(params).buildPayload()];
case 1:
_codetimePayload = _a.sent();
return [4 /*yield*/, context_helper_1.buildContexts(params)];
case 2:
contexts = _a.sent();
return [4 /*yield*/, sendEvent(_codetimePayload, contexts)];
case 3: return [2 /*return*/, _a.sent()];
}
});
}); };
/**
* @param jwt - the authorization token

@@ -137,0 +156,0 @@ * @param params - the UI Interaction params

@@ -48,4 +48,14 @@ /**

data: {
file_name: any;
insertions: number;
modifications: number;
};
} | {
schema: string;
data: {
jwt: string;
};
}; /**
* Build the snowplow payloads based on params available
* @param params
*/
})[]>;

@@ -46,2 +46,3 @@ "use strict";

var ui_element_1 = require("../entities/ui_element");
var uncommitted_change_1 = require("../entities/uncommitted_change");
/**

@@ -53,5 +54,5 @@ * Build the snowplow payloads based on params available

return __awaiter(this, void 0, void 0, function () {
var contexts, _uiElementPayload, _projectPayload, _repoPayload, _filePayload, _pluginPayload, _authPayload;
return __generator(this, function (_a) {
switch (_a.label) {
var contexts, _uiElementPayload, _projectPayload, _repoPayload, _filePayload, _pluginPayload, _i, _a, change, _b, _c, _authPayload;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:

@@ -62,5 +63,5 @@ contexts = [];

case 1:
_uiElementPayload = _a.sent();
_uiElementPayload = _d.sent();
contexts.push(_uiElementPayload);
_a.label = 2;
_d.label = 2;
case 2:

@@ -70,5 +71,5 @@ if (!project_1.Project.hasData(params)) return [3 /*break*/, 4];

case 3:
_projectPayload = _a.sent();
_projectPayload = _d.sent();
contexts.push(_projectPayload);
_a.label = 4;
_d.label = 4;
case 4:

@@ -78,5 +79,5 @@ if (!repo_1.Repo.hasData(params)) return [3 /*break*/, 6];

case 5:
_repoPayload = _a.sent();
_repoPayload = _d.sent();
contexts.push(_repoPayload);
_a.label = 6;
_d.label = 6;
case 6:

@@ -86,5 +87,5 @@ if (!file_1.File.hasData(params)) return [3 /*break*/, 8];

case 7:
_filePayload = _a.sent();
_filePayload = _d.sent();
contexts.push(_filePayload);
_a.label = 8;
_d.label = 8;
case 8:

@@ -94,8 +95,24 @@ if (!plugin_1.Plugin.hasData(params)) return [3 /*break*/, 10];

case 9:
_pluginPayload = _a.sent();
_pluginPayload = _d.sent();
contexts.push(_pluginPayload);
_a.label = 10;
case 10: return [4 /*yield*/, new auth_1.Auth(params).buildPayload()];
_d.label = 10;
case 10:
if (!Array.isArray(params.uncommitted_changes)) return [3 /*break*/, 14];
_i = 0, _a = params.uncommitted_changes;
_d.label = 11;
case 11:
_authPayload = _a.sent();
if (!(_i < _a.length)) return [3 /*break*/, 14];
change = _a[_i];
if (!uncommitted_change_1.UncommittedChange.hasData(change)) return [3 /*break*/, 13];
_c = (_b = contexts).push;
return [4 /*yield*/, new uncommitted_change_1.UncommittedChange(change).buildPayload(params.jwt)];
case 12:
_c.apply(_b, [_d.sent()]);
_d.label = 13;
case 13:
_i++;
return [3 /*break*/, 11];
case 14: return [4 /*yield*/, new auth_1.Auth(params).buildPayload()];
case 15:
_authPayload = _d.sent();
contexts.push(_authPayload);

@@ -102,0 +119,0 @@ return [2 /*return*/, contexts];

{
"name": "swdc-tracker",
"version": "1.3.3",
"version": "1.4.0",
"description": "swdc event tracker",

@@ -5,0 +5,0 @@ "main": "dist",

@@ -28,3 +28,3 @@ import { PluginInterface } from "../entities/plugin";

return {
schema: "iglu:com.software/editor_action/jsonschema/1-0-1",
schema: "iglu:com.software/editor_action/jsonschema/1-0-2",
data: {

@@ -31,0 +31,0 @@ entity: this.entity,

import { setBaseUrl, get } from "./utils/http";
import { CodeTimeParams, CodeTime } from "./events/codetime";
import { EditorActionParams, EditorAction } from "./events/editor_action";
import { GitEventParams, GitEvent } from "./events/git_event";
import { success, error, TrackerResponse } from "./utils/response";

@@ -73,2 +74,14 @@ import { isTestMode } from "./utils/env_helper";

/**
* @param gitEvent - the GitEvent event extends Repo, Project, UncommittedChange, Auth
*/
swdcTracker.trackGitEvent = async (params: GitEventParams): Promise<any> => {
// build the contexts and event payload
const _codetimePayload: any = await new GitEvent(params).buildPayload();
const contexts: any = await buildContexts(params);
return await sendEvent(_codetimePayload, contexts);
}
/**
* @param jwt - the authorization token

@@ -75,0 +88,0 @@ * @param params - the UI Interaction params

@@ -1,3 +0,1 @@

import { CodeTime } from "../events/codetime";
import { EditorAction } from "../events/editor_action";
import { Auth } from "../entities/auth";

@@ -9,2 +7,3 @@ import { Project } from "../entities/project";

import { UIElement } from "../entities/ui_element";
import { UncommittedChange } from "../entities/uncommitted_change";

@@ -49,2 +48,10 @@ /**

// uncommitted_changes
if (Array.isArray(params.uncommitted_changes)) {
for (const change of params.uncommitted_changes) {
if (UncommittedChange.hasData(change))
contexts.push(await new UncommittedChange(change).buildPayload(params.jwt));
}
}
// Auth is required

@@ -51,0 +58,0 @@ const _authPayload = await new Auth(params).buildPayload();

@@ -22,3 +22,3 @@ import swdcTracker from "../../src/index";

});
await swdcTracker.initialize("api.software.com", "editor_action", "swdotcom-vscode");
await swdcTracker.initialize("api.software.com", "codetime", "swdotcom-vscode");
});

@@ -25,0 +25,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc