Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused ingestCommitRange and ingestEntities endpoints from client #158

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
if: env.publish == 'true'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
publish: ${{ env.publish }}
Copy link
Contributor Author

@Nick-NCSU Nick-NCSU May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonus: Declares this env variable so that the GHA linter stops warning that publish might be invalid. Shouldn't have any effect on how this step runs.

run: |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
yarn
Expand Down
6 changes: 0 additions & 6 deletions src/index.new.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ describe('Core Index Tests', () => {
test('queryGraphQL', () => {
expect(j1).toHaveProperty('queryGraphQL');
});
test('ingestEntities', () => {
expect(j1).toHaveProperty('ingestEntities');
});
test('ingestCommitRange', () => {
expect(j1).toHaveProperty('ingestCommitRange');
});
test('mutateAlertRule', () => {
expect(j1).toHaveProperty('mutateAlertRule');
});
Expand Down
43 changes: 0 additions & 43 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
{
maxAttempts: 5,
delay: 1000,
handleError(err, context, options) {

Check warning on line 117 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

'options' is defined but never used

Check warning on line 117 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

'options' is defined but never used
const possibleFetchError = err as Partial<FetchError>;
const { httpStatusCode } = possibleFetchError;
if (httpStatusCode !== undefined) {
Expand Down Expand Up @@ -166,20 +166,9 @@

export interface JupiterOneEntity {
entity: JupiterOneEntityMetadata;
properties: any;

Check warning on line 169 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 169 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type
}

export interface CommitRange {
account_uuid: string;
repo_uuid: string;
source: string;
destination: string;
}

export interface IngestionResults {
entities: object[];
}

export interface QueryResult {
id: string;
entity: object;
Expand Down Expand Up @@ -297,7 +286,7 @@
};

export class JupiterOneClient {
graphClient: ApolloClient<any>;

Check warning on line 289 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 289 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type
headers?: Record<string, string>;
account: string;
accessToken: string;
Expand Down Expand Up @@ -372,7 +361,7 @@
) {
let complete = false;
let page = startPage;
let results: any[] = [];

Check warning on line 364 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 364 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

while (!complete && results.length < stopAfter) {
const j1qlForPage = `${j1ql} SKIP ${
Expand Down Expand Up @@ -443,7 +432,7 @@
return results;
}

async queryGraphQL(query: any) {

Check warning on line 435 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 435 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type
const res = await this.graphClient.query({ query });
if (res.errors) {
this.logger.info(res.errors);
Expand All @@ -452,39 +441,7 @@
return res;
}

async ingestEntities(
integrationInstanceId: string,
entities: any[],
): Promise<IngestionResults> {
return fetch(this.apiUrl + '/integrations/ingest', {
method: 'POST',
body: JSON.stringify({ integrationInstanceId, entities }),
headers: {
'Content-Type': 'application/json',
...this.headers,
},
}).then((res: any) => res.json());
}

async ingestCommitRange(
integrationInstanceId: string,
commitRange: CommitRange,
): Promise<IngestionResults> {
return fetch(this.apiUrl + '/integrations/action', {
method: 'POST',
body: JSON.stringify({
integrationInstanceId,
action: { name: 'INGEST', commitRange },
}),
headers: {
'Content-Type': 'application/json',
...this.headers,
},
timeout: 10000,
}).then((res: any) => res.json());
}

async mutateAlertRule(rule: any, update: any) {

Check warning on line 444 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 444 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 444 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 444 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type
const inlineQuestion = !!rule.instance?.question;
let mutation;
if (inlineQuestion) {
Expand Down Expand Up @@ -514,7 +471,7 @@
key: string,
type: string,
classLabels: string[],
properties: any,

Check warning on line 474 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 474 in src/index.ts

View workflow job for this annotation

GitHub Actions / test (18.x, ubuntu-latest)

Unexpected any. Specify a different type
): Promise<object> {
const res = await this.graphClient.mutate({
mutation: CREATE_ENTITY,
Expand Down
Loading