Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swdc-tracker

Package Overview
Dependencies
Maintainers
7
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.5.3 to 1.5.5

dist/entities/vscode_extension.d.ts

2

dist/entities/repo.js

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

data: {
repo_identifier: hashedValues.repo_identifer,
repo_identifier: hashedValues.repo_identifier,
repo_name: hashedValues.repo_name,

@@ -72,0 +72,0 @@ owner_id: hashedValues.owner_id,

@@ -6,2 +6,3 @@ declare const swdcTracker: any;

export * from "./events/ui_interaction";
export * from "./events/vscode_extension_event";
export * from "./entities/auth";

@@ -13,1 +14,2 @@ export * from "./entities/file";

export * from "./entities/ui_element";
export * from "./entities/vscode_extension";

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

var node_tracker_1 = require("@snowplow/node-tracker");
var vscode_extension_event_1 = require("./events/vscode_extension_event");
var hash = require("object-hash");

@@ -182,2 +183,20 @@ var swdcTracker = {};

};
/**
* @param jwt - the authorization token
* @param params - the VSCodeExtensionEvent params
*/
swdcTracker.trackVSCodeExtension = function (params) { return __awaiter(void 0, void 0, void 0, function () {
var vscodeExtensionPayload, contexts;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
vscodeExtensionPayload = new vscode_extension_event_1.VSCodeExtensionEvent(params).buildPayload();
return [4 /*yield*/, (0, context_helper_1.buildContexts)(params)];
case 1:
contexts = _a.sent();
return [4 /*yield*/, sendEvent(vscodeExtensionPayload, contexts)];
case 2: return [2 /*return*/, _a.sent()];
}
});
}); };
function sendEvent(event_payload, contexts) {

@@ -229,2 +248,3 @@ return __awaiter(this, void 0, void 0, function () {

__exportStar(require("./events/ui_interaction"), exports);
__exportStar(require("./events/vscode_extension_event"), exports);
__exportStar(require("./entities/auth"), exports);

@@ -236,1 +256,2 @@ __exportStar(require("./entities/file"), exports);

__exportStar(require("./entities/ui_element"), exports);
__exportStar(require("./entities/vscode_extension"), exports);

@@ -57,4 +57,17 @@ /**

data: {
id: string;
publisher: string;
name: string;
display_name: string;
author: string;
version: string;
description: string;
categories: string[];
extension_kind: string[];
};
} | {
schema: string;
data: {
jwt: string;
};
})[]>;

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

var file_change_1 = require("../entities/file_change");
var vscode_extension_1 = require("../entities/vscode_extension");
/**

@@ -54,3 +55,3 @@ * Build the snowplow payloads based on params available

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

@@ -110,4 +111,11 @@ switch (_d.label) {

return [3 /*break*/, 11];
case 14: return [4 /*yield*/, new auth_1.Auth(params).buildPayload()];
case 14:
if (!vscode_extension_1.VSCodeExtension.hasData(params)) return [3 /*break*/, 16];
return [4 /*yield*/, new vscode_extension_1.VSCodeExtension(params).buildPayload()];
case 15:
_vscodeExtension = _d.sent();
contexts.push(_vscodeExtension);
_d.label = 16;
case 16: return [4 /*yield*/, new auth_1.Auth(params).buildPayload()];
case 17:
_authPayload = _d.sent();

@@ -114,0 +122,0 @@ contexts.push(_authPayload);

{
"name": "swdc-tracker",
"version": "1.5.3",
"version": "1.5.5",
"description": "swdc event tracker",

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

"dependencies": {
"@snowplow/node-tracker": "^3.3.1",
"@snowplow/node-tracker": "^3.8.0",
"@types/node": "^17.0.21",
"axios": "^0.26.0",
"axios": "^1.3.2",
"libsodium": "^0.7.9",

@@ -33,0 +33,0 @@ "libsodium-wrappers": "^0.7.9",

@@ -46,3 +46,3 @@ import {hashAndEncryptValues} from '../utils/hash';

data: {
repo_identifier: hashedValues.repo_identifer,
repo_identifier: hashedValues.repo_identifier,
repo_name: hashedValues.repo_name,

@@ -49,0 +49,0 @@ owner_id: hashedValues.owner_id,

@@ -10,2 +10,3 @@ import { setBaseUrl, get } from "./utils/http";

import { tracker, gotEmitter, HttpMethod, buildSelfDescribingEvent } from '@snowplow/node-tracker';
import { VSCodeExtensionEvent, VSCodeExtensionEventParams } from './events/vscode_extension_event';

@@ -99,2 +100,13 @@ const hash = require("object-hash");

/**
* @param jwt - the authorization token
* @param params - the VSCodeExtensionEvent params
*/
swdcTracker.trackVSCodeExtension = async (params: VSCodeExtensionEventParams): Promise<any> => {
const vscodeExtensionPayload: any = new VSCodeExtensionEvent(params).buildPayload();
const contexts: any = await buildContexts(params);
return await sendEvent(vscodeExtensionPayload, contexts);
}
async function sendEvent(event_payload: any, contexts: any): Promise<TrackerResponse> {

@@ -152,2 +164,3 @@ if (isTestMode()) {

export * from "./events/ui_interaction";
export * from "./events/vscode_extension_event";
export * from "./entities/auth";

@@ -159,1 +172,2 @@ export * from "./entities/file";

export * from "./entities/ui_element";
export * from "./entities/vscode_extension";

@@ -8,2 +8,3 @@ import { Auth } from "../entities/auth";

import { FileChange } from "../entities/file_change";
import { VSCodeExtension } from '../entities/vscode_extension';

@@ -56,2 +57,8 @@ /**

// vscode extension event
if (VSCodeExtension.hasData(params)) {
const _vscodeExtension = await new VSCodeExtension(params).buildPayload();
contexts.push(_vscodeExtension);
}
// Auth is required

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

@@ -1,2 +0,2 @@

import swdcTracker, {CodeTimeInterface, CodeTimeParams} from '../../src/index';
import swdcTracker, {CodeTimeParams} from '../../src/index';
import {TrackerResponse} from '../../src/utils/response';

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

@@ -1,2 +0,2 @@

import swdcTracker from "../../src/index";
import swdcTracker, { Repo } from "../../src/index";
import { TrackerResponse } from "../../src/utils/response";

@@ -35,3 +35,3 @@

context("with a valid payload", async function() {
const eventData = {
const eventData: any = {
git_event_type: "uncommitted_change",

@@ -76,2 +76,20 @@ jwt: "JWT 123",

it("has all of the repo properties", async function() {
await swdcTracker.trackGitEvent(eventData);
const repoPayload = await new Repo(eventData).buildPayload(eventData.jwt);
const lastProcessedTestEvent = swdcTracker.getLastProcessedTestEvent();
const repoContext = lastProcessedTestEvent.contexts.find((n: any) => n.schema == 'iglu:com.software/repo/jsonschema/1-0-0')
// use Deep Equality "eql"
expect(repoContext.data).to.eql(repoPayload.data);
})
it("repo_identifier is not undefined", async function() {
await swdcTracker.trackGitEvent(eventData);
const lastProcessedTestEvent = swdcTracker.getLastProcessedTestEvent();
const repoContext = lastProcessedTestEvent.contexts.find((n: any) => n.schema == 'iglu:com.software/repo/jsonschema/1-0-0')
expect(repoContext.data.repo_identifier).to.not.equal(undefined);
})
it("sets multiple file_change entities", async function () {

@@ -78,0 +96,0 @@ await swdcTracker.trackGitEvent(eventData);

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