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

@soos-io/api-client

Package Overview
Dependencies
Maintainers
1
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soos-io/api-client - npm Package Compare versions

Comparing version 0.2.44 to 0.2.46

2

dist/constants.d.ts

@@ -12,3 +12,3 @@ /// <reference types="node" />

Files: {
ContributorAuditOutput: string;
ContributorAuditResults: string;
SoosDirectoryExclusionGlobPattern: string;

@@ -15,0 +15,0 @@ SarifOutput: string;

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

Files: {
ContributorAuditOutput: "soos_contributor_audit.json",
ContributorAuditResults: "soos_contributor_audit",
SoosDirectoryExclusionGlobPattern: "**/soos/**",

@@ -17,0 +17,0 @@ SarifOutput: "results.sarif",

@@ -89,2 +89,6 @@ export declare enum ContributingDeveloperSource {

}
export declare enum ScmResultsFormat {
JSON = "JSON",
TXT = "TXT"
}
export declare enum ScmType {

@@ -91,0 +95,0 @@ GitHub = "GitHub",

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OnFailure = exports.OutputFormat = exports.LogLevel = exports.SeverityEnum = exports.ScmType = exports.ScanType = exports.ScanStatus = exports.ManifestStatus = exports.PackageManagerType = exports.IntegrationType = exports.IntegrationName = exports.ContributingDeveloperSource = void 0;
exports.OnFailure = exports.OutputFormat = exports.LogLevel = exports.SeverityEnum = exports.ScmType = exports.ScmResultsFormat = exports.ScanType = exports.ScanStatus = exports.ManifestStatus = exports.PackageManagerType = exports.IntegrationType = exports.IntegrationName = exports.ContributingDeveloperSource = void 0;
var ContributingDeveloperSource;

@@ -99,2 +99,7 @@ (function (ContributingDeveloperSource) {

})(ScanType || (exports.ScanType = ScanType = {}));
var ScmResultsFormat;
(function (ScmResultsFormat) {
ScmResultsFormat["JSON"] = "JSON";
ScmResultsFormat["TXT"] = "TXT";
})(ScmResultsFormat || (exports.ScmResultsFormat = ScmResultsFormat = {}));
var ScmType;

@@ -101,0 +106,0 @@ (function (ScmType) {

import { ArgumentParser } from "argparse";
import { ScmType } from "../enums";
import { ScmResultsFormat, ScmType } from "../enums";
import { ArgumentParserBase, ICommonArguments } from "./ArgumentParserBase";

@@ -7,3 +7,3 @@ interface IContributorAuditArguments extends ICommonArguments {

secret: string;
saveResults: boolean;
saveResults: ScmResultsFormat;
scmType: ScmType;

@@ -10,0 +10,0 @@ }

@@ -25,7 +25,6 @@ "use strict";

});
this.argumentParser.add_argument("--saveResults", {
help: "Save results to file.",
action: "store_true",
default: false,
this.addEnumArgument(this.argumentParser, "--saveResults", enums_1.ScmResultsFormat, {
help: "Save results to file, options available: JSON, TXT.",
required: false,
default: enums_1.ScmResultsFormat.TXT,
});

@@ -32,0 +31,0 @@ this.addEnumArgument(this.argumentParser, "--scmType", enums_1.ScmType, {

import SOOSHooksApiClient, { IContributorAuditModel } from "../../api/SOOSHooksApiClient";
import { ScmType } from "../../enums";
import { ScmResultsFormat, ScmType } from "../../enums";
export interface IContributorAuditProvider {

@@ -13,5 +13,7 @@ audit(implementationParams: Record<string, string | number>): Promise<IContributorAuditModel>;

uploadContributorAudits(clientHash: string, contributorAudit: IContributorAuditModel): Promise<void>;
saveResults(results: IContributorAuditModel): Promise<void>;
saveResults(results: IContributorAuditModel, format: ScmResultsFormat): Promise<void>;
private saveResultsAsJSON;
private saveResultsAsTXT;
private validateCommonParams;
}
export default ContributorAuditService;

@@ -47,7 +47,32 @@ "use strict";

}
async saveResults(results) {
async saveResults(results, format) {
logging_1.soosLogger.info(`Saving results.`);
fs_1.default.writeFileSync(Path.join(process.cwd(), constants_1.SOOS_CONSTANTS.Files.ContributorAuditOutput), JSON.stringify(results, null, 2));
logging_1.soosLogger.info(`Results saved successfully ${Path.join(process.cwd(), constants_1.SOOS_CONSTANTS.Files.ContributorAuditOutput)}`);
switch (format) {
case enums_1.ScmResultsFormat.JSON: {
await this.saveResultsAsJSON(results);
break;
}
case enums_1.ScmResultsFormat.TXT: {
await this.saveResultsAsTXT(results);
break;
}
default: {
throw new Error(`Unsupported format: ${format}`);
}
}
}
async saveResultsAsJSON(results) {
fs_1.default.writeFileSync(Path.join(process.cwd(), `${constants_1.SOOS_CONSTANTS.Files.ContributorAuditResults}.json`), JSON.stringify(results, null, 2));
logging_1.soosLogger.info(`Results saved successfully ${Path.join(process.cwd(), `${constants_1.SOOS_CONSTANTS.Files.ContributorAuditResults}.json`)}`);
}
async saveResultsAsTXT(results) {
const uniqueContributors = new Set();
results.contributors
.sort((a, b) => a.username.localeCompare(b.username))
.forEach((contributor) => {
uniqueContributors.add(contributor.username);
});
fs_1.default.writeFileSync(Path.join(process.cwd(), `${constants_1.SOOS_CONSTANTS.Files.ContributorAuditResults}.txt`), Array.from(uniqueContributors).join("\n"));
logging_1.soosLogger.info(`Results saved successfully ${Path.join(process.cwd(), `${constants_1.SOOS_CONSTANTS.Files.ContributorAuditResults}.txt`)}`);
}
validateCommonParams(implementationParams) {

@@ -54,0 +79,0 @@ if (!implementationParams["days"]) {

@@ -5,6 +5,6 @@ import { IntegrationName, OnFailure, ScanStatus } from "./enums";

declare const ensureNonEmptyValue: (value: string | null | undefined, propertyName: string) => string;
declare const ensureEnumValue: <T, TEnumObject extends Record<string, T> = Record<string, T>>(enumObject: TEnumObject, inputValue: string | null | undefined, parameterName?: string, excludeDefault?: keyof TEnumObject | undefined, ignoreCase?: boolean) => T | undefined;
declare const ensureEnumValue: <T, TEnumObject extends Record<string, T> = Record<string, T>>(enumObject: TEnumObject, inputValue: string | null | undefined, parameterName?: string, excludeDefault?: keyof TEnumObject, ignoreCase?: boolean) => T | undefined;
declare const sleep: (ms: number) => Promise<unknown>;
declare const isUrlAvailable: (url: string) => Promise<boolean>;
declare const obfuscateProperties: <T extends Record<string, unknown> = Record<string, unknown>>(dictionary: T, properties: (keyof T)[], replacement?: string) => T;
declare const obfuscateProperties: <T extends Record<string, unknown> = Record<string, unknown>>(dictionary: T, properties: Array<keyof T>, replacement?: string) => T;
declare const convertStringToBase64: (content: string) => string;

@@ -11,0 +11,0 @@ declare const getEnvVariable: (name: string) => string | null;

{
"name": "@soos-io/api-client",
"version": "0.2.44",
"version": "0.2.46",
"description": "This is the SOOS API Client for registered clients leveraging the various integrations to the SOOS platform.",

@@ -17,3 +17,3 @@ "main": "dist/index.js",

"test": "jest",
"check": "npm run format && npm run typecheck && npm run test && npm outdated",
"check": "npm run format && npm run typecheck && npm outdated",
"build:link": "npm run build && npm link"

@@ -52,3 +52,3 @@ },

"argparse": "^2.0.1",
"axios": "^1.6.7",
"axios": "^1.6.8",
"form-data": "^4.0.0",

@@ -59,5 +59,5 @@ "glob": "^10.3.10",

"devDependencies": {
"@types/argparse": "^2.0.14",
"@types/argparse": "^2.0.15",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.16",
"@types/node": "^20.11.28",
"jest": "^29.1.2",

@@ -67,4 +67,4 @@ "prettier": "^3.2.5",

"ts-node": "^10.9.2",
"typescript": "^5.3.3"
"typescript": "^5.4.2"
}
}
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