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

oss-mariner

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oss-mariner - npm Package Compare versions

Comparing version 0.3.0-alpha to 0.3.1-alpha

3

dist/src/gitHubIssueFetcher.d.ts

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

import { Logger } from './tab-level-logger';
export interface Edge {

@@ -15,4 +14,2 @@ node: GitHubIssue;

export declare class GitHubIssueFetcher {
private readonly logger;
constructor(logger: Logger);
fetchMatchingIssues(token: string, label: string, repositoryIdentifiers: string[]): Promise<GitHubIssue[]>;

@@ -19,0 +16,0 @@ private splitArray;

14

dist/src/gitHubIssueFetcher.js

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

const graphql_1 = require("@octokit/graphql");
const tab_level_logger_1 = require("./tab-level-logger");
const queryTemplate = `

@@ -50,5 +51,2 @@ query findByLabel($queryString:String!, $pageSize:Int, $after:String) {

class GitHubIssueFetcher {
constructor(logger) {
this.logger = logger;
}
fetchMatchingIssues(token, label, repositoryIdentifiers) {

@@ -70,3 +68,3 @@ return __awaiter(this, void 0, void 0, function* () {

}
this.logger.info(`-----Fetched ${label}: ${edgeArray.length} matching issues`);
tab_level_logger_1.getLogger().info(`-----Fetched ${label}: ${edgeArray.length} matching issues`);
const issues = edgeArray.map((edge) => {

@@ -107,9 +105,9 @@ return edge.node;

while (result.pageInfo.hasNextPage) {
this.logger.info(`Calling: ${queryId}`);
tab_level_logger_1.getLogger().info(`Calling: ${queryId}`);
const response = (yield graphqlWithAuth(query, variables));
const issueCountsAndIssues = response.search;
this.logger.info(`Fetched: ${queryId} => ` +
tab_level_logger_1.getLogger().info(`Fetched: ${queryId} => ` +
`${issueCountsAndIssues.edges.length}/${issueCountsAndIssues.issueCount} (${issueCountsAndIssues.pageInfo.hasNextPage})`);
const rateLimit = response.rateLimit;
this.logger.info(`Rate limits: ${JSON.stringify(rateLimit)}`);
tab_level_logger_1.getLogger().info(`Rate limits: ${JSON.stringify(rateLimit)}`);
variables.after = issueCountsAndIssues.pageInfo.endCursor;

@@ -126,3 +124,3 @@ result.pageInfo.hasNextPage = issueCountsAndIssues.pageInfo.hasNextPage;

result.issueCount = result.edges.length;
this.logger.info(`Returning: ${queryId} => ${result.issueCount}`);
tab_level_logger_1.getLogger().info(`Returning: ${queryId} => ${result.issueCount}`);
return result.edges;

@@ -129,0 +127,0 @@ });

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

import { Logger } from './tab-level-logger';
export interface Issue {

@@ -9,5 +8,4 @@ title: string;

export declare class IssueFinder {
private readonly logger;
private readonly fetcher;
constructor(logger: Logger);
constructor();
findIssues(token: string, labels: string[], repositoryIdentifiers: string[]): Promise<Map<string, Issue[]>>;

@@ -14,0 +12,0 @@ private convertFromGitHubIssue;

@@ -14,5 +14,4 @@ "use strict";

class IssueFinder {
constructor(logger) {
this.logger = logger;
this.fetcher = new gitHubIssueFetcher_1.GitHubIssueFetcher(logger);
constructor() {
this.fetcher = new gitHubIssueFetcher_1.GitHubIssueFetcher();
}

@@ -19,0 +18,0 @@ findIssues(token, labels, repositoryIdentifiers) {

export { DependencyDetailsRetriever } from '../dependency-details-retriever';
export { Issue, IssueFinder } from '../issueFinder';
export { Logger, setLogger } from '../tab-level-logger';
export { Logger, getLogger, setLogger } from '../tab-level-logger';

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

var tab_level_logger_1 = require("../tab-level-logger");
exports.getLogger = tab_level_logger_1.getLogger;
exports.setLogger = tab_level_logger_1.setLogger;

@@ -5,2 +5,3 @@ export interface Logger {

}
export declare function getLogger(): Logger;
export declare function setLogger(newLogger: Logger): void;

@@ -7,0 +8,0 @@ export declare class TabDepthLogger {

@@ -13,2 +13,6 @@ "use strict";

let currentLogger = new ConsoleLogger();
function getLogger() {
return currentLogger;
}
exports.getLogger = getLogger;
function setLogger(newLogger) {

@@ -15,0 +19,0 @@ currentLogger = newLogger;

{
"name": "oss-mariner",
"version": "0.3.0-alpha",
"version": "0.3.1-alpha",
"description": "A node.js library for analyzing open source library dependencies",
"main": "dist/mariner/index.js",
"types": "dist/mariner/index.d.ts",
"main": "dist/src/mariner/index.js",
"types": "dist/src/mariner/index.d.ts",
"author": "",

@@ -56,4 +56,4 @@ "license": "Apache-2.0",

"files": [
"/dist/**/*"
"/dist/src/*"
]
}

@@ -5,2 +5,4 @@ # Mariner

## Introduction
A node.js library for analyzing open source library dependencies.

@@ -28,4 +30,23 @@

### Step-by-step
1. Create a new project folder and use `npm init` to make it a node project.
1. Copy the contents of `runFasterCode.ts` into `index.js` in the new project.
1.1. <https://github.com/indeedeng/Mariner/blob/master/examples/runFasterCode.ts>
1. Comment out the existing line that imports mariner.
1. Uncomment the line saying how mariner would normally be imported.
1. Convert the TypeScript code to JavaScript by
1.1. Remove the `public` keywords from class members.
1.1. Remove the `implements Xxxx` from the FancyLogger class declaration.
1.1. Remove all the type declarations (like `: string`).
1. Replace the path.join lines with simple hard-coded filenames: `exampleData.json` and `output.json`.
1. Create an exampleData.json file or copy it in from Mariner.
1. Run `npm install oss-mariner`
1. Add `"type": "module"` to `package.json`.
1. Run `node index.js`.
### More details (possibly outdated)
Mariner can be called from Javascript or from Typescript. You can see an example here:
https://github.com/indeedeng/Mariner/blob/master/examples/runOldCode.ts
<https://github.com/indeedeng/Mariner/blob/master/examples/runOldCode.ts>

@@ -35,3 +56,3 @@ Mariner is in transition from the old way of accessing GitHub data (REST) to the new way (GraphQL)

To invoke mariner using the new GraphQL code you can see an example here:
https://github.com/indeedeng/Mariner/blob/master/examples/runFasterCode.ts
<https://github.com/indeedeng/Mariner/blob/master/examples/runFasterCode.ts>

@@ -41,3 +62,3 @@ If you are using mariner with the new GraphQL code, Invoke the finder(), passing the

````
```
const token = getFromEnvOrThrow('MARINER_GITHUB_TOKEN'); // from an environment variable

@@ -64,3 +85,3 @@ const inputFilePath = process.env.MARINER_INPUT_FILE_PATH || path.join(__dirname, '..', '..', 'examples', 'exampleData.json');

````
```

@@ -70,4 +91,3 @@ If you are using the examples/runOldCode.ts file, (using the old REST code that is very slow)

````
```
const ddr = new DependencyDetailsRetriever();

@@ -80,3 +100,3 @@ const githubToken = Process.env.GITHUB_TOKEN; // from an environment variable

````
```

@@ -145,2 +165,4 @@ For both the runOldCode.ts and runFasterCode.ts files you must create a token.

1. Create a branch named "publish-x.y.z (x.y.z will be the version number)
1. Update the version number in package.json
1. Be sure the version number in package.json is correct

@@ -153,3 +175,3 @@ 1. Run `npm install` to update package-lock.json

1. Publish: `npm publish`
1. Verify: https://www.npmjs.com/package/oss-mariner
1. Verify: <https://www.npmjs.com/package/oss-mariner>

@@ -156,0 +178,0 @@ ## Code of Conduct

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