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

swdc-tracker

Package Overview
Dependencies
Maintainers
1
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.0.12 to 1.1.0

4

dist/entities/file.d.ts

@@ -16,3 +16,3 @@ export interface FileInterface {

static hasData(data: FileInterface): string;
buildPayload(): Promise<{
buildPayload(): {
schema: string;

@@ -26,3 +26,3 @@ data: {

};
}>;
};
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -53,25 +17,14 @@ exports.File = void 0;

File.prototype.buildPayload = function () {
return __awaiter(this, void 0, void 0, function () {
var hashedName, hashedPath;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, hash_1.hashValue(this.file_name)];
case 1:
hashedName = _a.sent();
return [4 /*yield*/, hash_1.hashValue(this.file_path)];
case 2:
hashedPath = _a.sent();
return [2 /*return*/, {
schema: "iglu:com.software/file/jsonschema/1-0-1",
data: {
file_name: hashedName,
file_path: hashedPath,
syntax: this.syntax,
line_count: this.line_count,
character_count: this.character_count
}
}];
}
});
});
var hashedName = hash_1.hashValue(this.file_name);
var hashedPath = hash_1.hashValue(this.file_path);
return {
schema: "iglu:com.software/file/jsonschema/1-0-1",
data: {
file_name: hashedName,
file_path: hashedPath,
syntax: this.syntax,
line_count: this.line_count,
character_count: this.character_count
}
};
};

@@ -78,0 +31,0 @@ return File;

@@ -10,3 +10,3 @@ export interface ProjectInterface {

static hasData(data: ProjectInterface): string;
buildPayload(): Promise<{
buildPayload(): {
schema: string;

@@ -17,3 +17,3 @@ data: {

};
}>;
};
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -50,22 +14,11 @@ exports.Project = void 0;

Project.prototype.buildPayload = function () {
return __awaiter(this, void 0, void 0, function () {
var hashedName, hashedDirectory;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, hash_1.hashValue(this.project_name)];
case 1:
hashedName = _a.sent();
return [4 /*yield*/, hash_1.hashValue(this.project_directory)];
case 2:
hashedDirectory = _a.sent();
return [2 /*return*/, {
schema: "iglu:com.software/project/jsonschema/1-0-0",
data: {
project_name: hashedName,
project_directory: hashedDirectory
}
}];
}
});
});
var hashedName = hash_1.hashValue(this.project_name);
var hashedDirectory = hash_1.hashValue(this.project_directory);
return {
schema: "iglu:com.software/project/jsonschema/1-0-0",
data: {
project_name: hashedName,
project_directory: hashedDirectory
}
};
};

@@ -72,0 +25,0 @@ return Project;

@@ -16,3 +16,3 @@ export interface RepoInterface {

static hasData(data: RepoInterface): string;
buildPayload(): Promise<{
buildPayload(): {
schema: string;

@@ -26,3 +26,3 @@ data: {

};
}>;
};
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -53,34 +17,17 @@ exports.Repo = void 0;

Repo.prototype.buildPayload = function () {
return __awaiter(this, void 0, void 0, function () {
var hashedName, hashedIdentifier, hashedOwnerId, hashedGitBranch, hashedGitTag;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, hash_1.hashValue(this.repo_name)];
case 1:
hashedName = _a.sent();
return [4 /*yield*/, hash_1.hashValue(this.repo_identifier)];
case 2:
hashedIdentifier = _a.sent();
return [4 /*yield*/, hash_1.hashValue(this.owner_id)];
case 3:
hashedOwnerId = _a.sent();
return [4 /*yield*/, hash_1.hashValue(this.git_branch)];
case 4:
hashedGitBranch = _a.sent();
return [4 /*yield*/, hash_1.hashValue(this.git_tag)];
case 5:
hashedGitTag = _a.sent();
return [2 /*return*/, {
schema: "iglu:com.software/repo/jsonschema/1-0-0",
data: {
repo_identifier: hashedIdentifier,
reop_name: hashedName,
owner_id: hashedOwnerId,
git_branch: hashedGitBranch,
git_tag: hashedGitTag
}
}];
}
});
});
var hashedName = hash_1.hashValue(this.repo_name);
var hashedIdentifier = hash_1.hashValue(this.repo_identifier);
var hashedOwnerId = hash_1.hashValue(this.owner_id);
var hashedGitBranch = hash_1.hashValue(this.git_branch);
var hashedGitTag = hash_1.hashValue(this.git_tag);
return {
schema: "iglu:com.software/repo/jsonschema/1-0-0",
data: {
repo_identifier: hashedIdentifier,
reop_name: hashedName,
owner_id: hashedOwnerId,
git_branch: hashedGitBranch,
git_tag: hashedGitTag
}
};
};

@@ -87,0 +34,0 @@ return Repo;

@@ -16,3 +16,3 @@ export interface UIElementInterface {

static hasData(data: UIElementInterface): string;
buildPayload(): Promise<{
buildPayload(): {
schema: string;

@@ -26,3 +26,3 @@ data: {

};
}>;
};
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -52,16 +16,12 @@ exports.UIElement = void 0;

UIElement.prototype.buildPayload = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, {
schema: "iglu:com.software/ui_element/jsonschema/1-0-1",
data: {
element_name: this.element_name,
element_location: this.element_location,
color: this.color,
icon_name: this.icon_name,
cta_text: this.cta_text
}
}];
});
});
return {
schema: "iglu:com.software/ui_element/jsonschema/1-0-1",
data: {
element_name: this.element_name,
element_location: this.element_location,
color: this.color,
icon_name: this.icon_name,
cta_text: this.cta_text
}
};
};

@@ -68,0 +28,0 @@ return UIElement;

@@ -96,10 +96,7 @@ "use strict";

switch (_a.label) {
case 0: return [4 /*yield*/, new codetime_1.CodeTime(params).buildPayload()];
case 1:
_codetimePayload = _a.sent();
return [4 /*yield*/, context_helper_1.buildContexts(params)];
case 2:
contexts = _a.sent();
case 0:
_codetimePayload = new codetime_1.CodeTime(params).buildPayload();
contexts = context_helper_1.buildContexts(params);
return [4 /*yield*/, sendEvent(_codetimePayload, contexts)];
case 3: return [2 /*return*/, _a.sent()];
case 1: return [2 /*return*/, _a.sent()];
}

@@ -116,10 +113,7 @@ });

switch (_a.label) {
case 0: return [4 /*yield*/, new editor_action_1.EditorAction(params).buildPayload()];
case 1:
_editorActionPayload = _a.sent();
return [4 /*yield*/, context_helper_1.buildContexts(params)];
case 2:
contexts = _a.sent();
case 0:
_editorActionPayload = new editor_action_1.EditorAction(params).buildPayload();
contexts = context_helper_1.buildContexts(params);
return [4 /*yield*/, sendEvent(_editorActionPayload, contexts)];
case 3: return [2 /*return*/, _a.sent()];
case 1: return [2 /*return*/, _a.sent()];
}

@@ -136,10 +130,7 @@ });

switch (_a.label) {
case 0: return [4 /*yield*/, new ui_interaction_1.UIInteraction(params).buildPayload()];
case 1:
_uiInteractionPayload = _a.sent();
return [4 /*yield*/, context_helper_1.buildContexts(params)];
case 2:
contexts = _a.sent();
case 0:
_uiInteractionPayload = new ui_interaction_1.UIInteraction(params).buildPayload();
contexts = context_helper_1.buildContexts(params);
return [4 /*yield*/, sendEvent(_uiInteractionPayload, contexts)];
case 3: return [2 /*return*/, _a.sent()];
case 1: return [2 /*return*/, _a.sent()];
}

@@ -146,0 +137,0 @@ });

@@ -5,3 +5,3 @@ /**

*/
export declare function buildContexts(params: any): Promise<({
export declare function buildContexts(params: any): ({
schema: string;

@@ -77,2 +77,2 @@ data: {

};
})[]>;
})[];
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -54,72 +18,48 @@ exports.buildContexts = void 0;

function buildContexts(params) {
return __awaiter(this, void 0, void 0, function () {
var contexts, _codetimePayload, _editorActionPayload, _uiInteractionPayload, _uiElementPayload, _projecPayload, _repoPayload, _filePayload, _pluginPayload, _authPayload;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
contexts = [];
if (!codetime_1.CodeTime.hasData(params)) return [3 /*break*/, 2];
return [4 /*yield*/, new codetime_1.CodeTime(params).buildPayload()];
case 1:
_codetimePayload = _a.sent();
contexts.push(_codetimePayload);
_a.label = 2;
case 2:
if (!editor_action_1.EditorAction.hasData(params)) return [3 /*break*/, 4];
return [4 /*yield*/, new editor_action_1.EditorAction(params).buildPayload()];
case 3:
_editorActionPayload = _a.sent();
contexts.push(_editorActionPayload);
_a.label = 4;
case 4:
if (!ui_interaction_1.UIInteraction.hasData(params)) return [3 /*break*/, 6];
return [4 /*yield*/, new ui_interaction_1.UIInteraction(params).buildPayload()];
case 5:
_uiInteractionPayload = _a.sent();
contexts.push(_uiInteractionPayload);
_a.label = 6;
case 6:
if (!ui_element_1.UIElement.hasData(params)) return [3 /*break*/, 8];
return [4 /*yield*/, new ui_element_1.UIElement(params).buildPayload()];
case 7:
_uiElementPayload = _a.sent();
contexts.push(_uiElementPayload);
_a.label = 8;
case 8:
if (!project_1.Project.hasData(params)) return [3 /*break*/, 10];
return [4 /*yield*/, new project_1.Project(params).buildPayload()];
case 9:
_projecPayload = _a.sent();
contexts.push(_projecPayload);
_a.label = 10;
case 10:
if (!repo_1.Repo.hasData(params)) return [3 /*break*/, 12];
return [4 /*yield*/, new repo_1.Repo(params).buildPayload()];
case 11:
_repoPayload = _a.sent();
contexts.push(_repoPayload);
_a.label = 12;
case 12:
if (!file_1.File.hasData(params)) return [3 /*break*/, 14];
return [4 /*yield*/, new file_1.File(params).buildPayload()];
case 13:
_filePayload = _a.sent();
contexts.push(_filePayload);
_a.label = 14;
case 14:
if (!plugin_1.Plugin.hasData(params)) return [3 /*break*/, 16];
return [4 /*yield*/, new plugin_1.Plugin(params).buildPayload()];
case 15:
_pluginPayload = _a.sent();
contexts.push(_pluginPayload);
_a.label = 16;
case 16: return [4 /*yield*/, new auth_1.Auth(params).buildPayload()];
case 17:
_authPayload = _a.sent();
contexts.push(_authPayload);
return [2 /*return*/, contexts];
}
});
});
var contexts = [];
// code time
if (codetime_1.CodeTime.hasData(params)) {
var _codetimePayload = new codetime_1.CodeTime(params).buildPayload();
contexts.push(_codetimePayload);
}
// editor action
if (editor_action_1.EditorAction.hasData(params)) {
var _editorActionPayload = new editor_action_1.EditorAction(params).buildPayload();
contexts.push(_editorActionPayload);
}
// ui interaction
if (ui_interaction_1.UIInteraction.hasData(params)) {
var _uiInteractionPayload = new ui_interaction_1.UIInteraction(params).buildPayload();
contexts.push(_uiInteractionPayload);
}
// ui element
if (ui_element_1.UIElement.hasData(params)) {
var _uiElementPayload = new ui_element_1.UIElement(params).buildPayload();
contexts.push(_uiElementPayload);
}
// project
if (project_1.Project.hasData(params)) {
var _projecPayload = new project_1.Project(params).buildPayload();
contexts.push(_projecPayload);
}
// repo
if (repo_1.Repo.hasData(params)) {
var _repoPayload = new repo_1.Repo(params).buildPayload();
contexts.push(_repoPayload);
}
// file
if (file_1.File.hasData(params)) {
var _filePayload = new file_1.File(params).buildPayload();
contexts.push(_filePayload);
}
// plugin
if (plugin_1.Plugin.hasData(params)) {
var _pluginPayload = new plugin_1.Plugin(params).buildPayload();
contexts.push(_pluginPayload);
}
// Auth is required
var _authPayload = new auth_1.Auth(params).buildPayload();
contexts.push(_authPayload);
return contexts;
}
exports.buildContexts = buildContexts;

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

export declare function hashValue(value: string): Promise<any>;
export declare function hashValue(value: string): any;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.hashValue = void 0;
var _sodium = require('libsodium-wrappers');
var sodium;
var blake3 = require('blake3');
function hashValue(value) {
return __awaiter(this, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!value) {
return [2 /*return*/, value];
}
if (!(sodium === undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, _sodium.ready];
case 1:
_a.sent();
sodium = _sodium;
_a.label = 2;
case 2:
result = sodium.crypto_generichash(64, value);
return [2 /*return*/, sodium.to_hex(result)];
}
});
});
if (!value) {
return value;
}
return blake3.hash(value, { length: 64 }).toString('hex');
}
exports.hashValue = hashValue;
{
"name": "swdc-tracker",
"version": "1.0.12",
"version": "1.1.0",
"description": "swdc event tracker",

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

"axios": "^0.19.2",
"libsodium": "^0.7.6",
"libsodium-wrappers": "^0.7.6",
"blake3": "^2.1.4",
"snowplow-tracker": "^0.3.0"
}
}

@@ -31,6 +31,6 @@ import { hashValue } from "../utils/hash";

async buildPayload() {
buildPayload() {
const hashedName = await hashValue(this.file_name);
const hashedPath = await hashValue(this.file_path);
const hashedName = hashValue(this.file_name);
const hashedPath = hashValue(this.file_path);

@@ -49,2 +49,2 @@ return {

}
}

@@ -22,6 +22,6 @@ import { hashValue } from "../utils/hash";

async buildPayload() {
buildPayload() {
const hashedName = await hashValue(this.project_name);
const hashedDirectory = await hashValue(this.project_directory);
const hashedName = hashValue(this.project_name);
const hashedDirectory = hashValue(this.project_directory);

@@ -36,2 +36,2 @@ return {

}
}
}

@@ -31,9 +31,9 @@ import { hashValue } from "../utils/hash";

async buildPayload() {
buildPayload() {
const hashedName = await hashValue(this.repo_name);
const hashedIdentifier = await hashValue(this.repo_identifier);
const hashedOwnerId = await hashValue(this.owner_id);
const hashedGitBranch = await hashValue(this.git_branch);
const hashedGitTag = await hashValue(this.git_tag);
const hashedName = hashValue(this.repo_name);
const hashedIdentifier = hashValue(this.repo_identifier);
const hashedOwnerId = hashValue(this.owner_id);
const hashedGitBranch = hashValue(this.git_branch);
const hashedGitTag = hashValue(this.git_tag);

@@ -51,2 +51,2 @@ return {

}
}
}

@@ -29,3 +29,3 @@ // The ui_element interface

async buildPayload() {
buildPayload() {
return {

@@ -32,0 +32,0 @@ schema: "iglu:com.software/ui_element/jsonschema/1-0-1",

@@ -48,4 +48,4 @@ import { get } from "./utils/http";

// build the contexts and event payload
const _codetimePayload: any = await new CodeTime(params).buildPayload();
const contexts: any = await buildContexts(params);
const _codetimePayload: any = new CodeTime(params).buildPayload();
const contexts: any = buildContexts(params);

@@ -62,4 +62,4 @@ return await sendEvent(_codetimePayload, contexts);

// build the contexts and event payload
const _editorActionPayload: any = await new EditorAction(params).buildPayload();
const contexts: any = await buildContexts(params);
const _editorActionPayload: any = new EditorAction(params).buildPayload();
const contexts: any = buildContexts(params);

@@ -76,4 +76,4 @@ return await sendEvent(_editorActionPayload, contexts);

// build the contexts and event payload
const _uiInteractionPayload: any = await new UIInteraction(params).buildPayload();
const contexts: any = await buildContexts(params);
const _uiInteractionPayload: any = new UIInteraction(params).buildPayload();
const contexts: any = buildContexts(params);

@@ -80,0 +80,0 @@ return await sendEvent(_uiInteractionPayload, contexts);

@@ -13,5 +13,5 @@ import { CodeTime } from "../events/codetime";

* Build the snowplow payloads based on params available
* @param params
* @param params
*/
export async function buildContexts(params: any) {
export function buildContexts(params: any) {

@@ -22,3 +22,3 @@ const contexts = [];

if (CodeTime.hasData(params)) {
const _codetimePayload = await new CodeTime(params).buildPayload();
const _codetimePayload = new CodeTime(params).buildPayload();
contexts.push(_codetimePayload);

@@ -29,3 +29,3 @@ }

if (EditorAction.hasData(params)) {
const _editorActionPayload = await new EditorAction(params).buildPayload();
const _editorActionPayload = new EditorAction(params).buildPayload();
contexts.push(_editorActionPayload);

@@ -36,3 +36,3 @@ }

if (UIInteraction.hasData(params)) {
const _uiInteractionPayload = await new UIInteraction(params).buildPayload();
const _uiInteractionPayload = new UIInteraction(params).buildPayload();
contexts.push(_uiInteractionPayload);

@@ -43,3 +43,3 @@ }

if (UIElement.hasData(params)) {
const _uiElementPayload = await new UIElement(params).buildPayload();
const _uiElementPayload = new UIElement(params).buildPayload();
contexts.push(_uiElementPayload);

@@ -50,3 +50,3 @@ }

if (Project.hasData(params)) {
const _projecPayload = await new Project(params).buildPayload();
const _projecPayload = new Project(params).buildPayload();
contexts.push(_projecPayload);

@@ -57,3 +57,3 @@ }

if (Repo.hasData(params)) {
const _repoPayload = await new Repo(params).buildPayload();
const _repoPayload = new Repo(params).buildPayload();
contexts.push(_repoPayload);

@@ -64,3 +64,3 @@ }

if (File.hasData(params)) {
const _filePayload = await new File(params).buildPayload();
const _filePayload = new File(params).buildPayload();
contexts.push(_filePayload);

@@ -71,3 +71,3 @@ }

if (Plugin.hasData(params)) {
const _pluginPayload = await new Plugin(params).buildPayload();
const _pluginPayload = new Plugin(params).buildPayload();
contexts.push(_pluginPayload);

@@ -77,6 +77,6 @@ }

// Auth is required
const _authPayload = await new Auth(params).buildPayload();
const _authPayload = new Auth(params).buildPayload();
contexts.push(_authPayload);
return contexts;
}
}

@@ -1,6 +0,4 @@

const _sodium = require('libsodium-wrappers');
const blake3 = require('blake3');
let sodium: any;
export async function hashValue(value: string) {
export function hashValue(value: string) {
if (!value) {

@@ -10,9 +8,3 @@ return value;

if (sodium === undefined) {
await _sodium.ready;
sodium = _sodium
}
const result = sodium.crypto_generichash(64, value);
return sodium.to_hex(result);
return blake3.hash(value, { length: 64 }).toString('hex');
}

@@ -7,20 +7,20 @@ import { hashValue } from "../../src/utils/hash";

describe("Hash Utility", function () {
context("when the parameter is empty string", async function () {
context("when the parameter is empty string", function () {
let string_param = "";
it("returns empty string", async function () {
expect(await hashValue(string_param)).to.equal("");
it("returns empty string", function () {
expect(hashValue(string_param)).to.equal("");
});
});
context("when the parameter is a string", async function () {
context("when the parameter is a string", function () {
let string_param = "secret_message";
it("returns a hashed string with 128 character length", async function () {
let result = await hashValue(string_param);
it("returns a hashed string with 128 character length", function () {
let result = hashValue(string_param);
expect(result).to.be.a('string')
.that.matches(/^[a-f0-9]{128}$/)
.and.equal('998504e62163ab1030d14ec90ba2d4e4dd87707f2591fcdcb6473e6f6c260778cdaed8b9e913b3965b9ab331553eedcbfb877b3268c3fa414a4cb09a5b30ee05');
.and.equal('51d9ca721aa09fde72ec722137a3ac8fef053a49df4b2354e36fd95dc3372e881f3a41b9e625d2acb5775f390e98069ee8510296949966b0b8a72a558a42a073');
});
});
});
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