Skip to content

Commit 162f70a

Browse files
authored
Bump dependencies (#109)
* bump all devDependencies * bump Axios * bump other dependencies * bump workflow dependencies & NodeJS
1 parent 289a632 commit 162f70a

File tree

10 files changed

+4067
-6088
lines changed

10 files changed

+4067
-6088
lines changed

.estlintrc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ env:
44
extends:
55
- "eslint:recommended"
66
- "plugin:@typescript-eslint/eslint-recommended"
7-
- "plugin:@typescript-eslint/recommended-requiring-type-checking"
8-
- "plugin:@typescript-eslint/recommended"
7+
- "plugin:@typescript-eslint/recommended-type-checked"
8+
- "plugin:@typescript-eslint/stylistic-type-checked"
99
- "plugin:import/recommended"
1010
- "plugin:import/typescript"
1111
- "plugin:jsdoc/recommended"

.github/workflows/release-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- id: is_release_branch_without_pr
1818
name: Find matching PR
19-
uses: actions/github-script@v3
19+
uses: actions/github-script@v7
2020
with:
2121
github-token: ${{ secrets.GITHUB_TOKEN }}
2222
script: |
@@ -42,7 +42,7 @@ jobs:
4242
name: Create Release Pull Request
4343
runs-on: ubuntu-latest
4444
steps:
45-
- uses: actions/checkout@v2
45+
- uses: actions/checkout@v4
4646

4747
- name: Parse release version
4848
id: get_version

.github/workflows/release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@ name: Release SDK if needed
22

33
on:
44
pull_request:
5-
branches: main
6-
types: closed
5+
branches:
6+
- main
7+
types:
8+
- closed
79

810
jobs:
911
release:
1012
runs-on: ubuntu-latest
1113
if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'release/')
1214
steps:
1315
- name: Checkout
14-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1517
with:
1618
fetch-depth: 0
1719
- name: Setup Node
18-
uses: actions/setup-node@v2
20+
uses: actions/setup-node@v4
1921
with:
20-
node-version: '12.x'
22+
node-version: '20.x'
2123
registry-url: 'https://registry.npmjs.org'
2224
- run: npm install
2325
- name: Publish to npm

.github/workflows/test-main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ jobs:
99
coverage:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
- name: Test with Node.js Latest LTS
14-
uses: actions/setup-node@v1
14+
uses: actions/setup-node@v4
1515
with:
1616
# Latest LTS version
17-
node-version: '12.x'
17+
node-version: '20.x'
1818
- name: Cache NPM modules
19-
uses: actions/cache@v2
19+
uses: actions/cache@v3
2020
with:
2121
path: ~/.npm
2222
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -25,6 +25,6 @@ jobs:
2525
- name: Run tests
2626
run: npm install && npm run test:coverage
2727
- name: Upload coverage to Codecov
28-
uses: codecov/codecov-action@v1
28+
uses: codecov/codecov-action@v3
2929
with:
3030
directory: ./coverage/

.github/workflows/test-prs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ jobs:
88
lintAndTestWithCoverage:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212
- name: Test with Node.js Latest LTS
13-
uses: actions/setup-node@v1
13+
uses: actions/setup-node@v4
1414
with:
1515
# Latest LTS version
16-
node-version: '12.x'
16+
node-version: '20.x'
1717
- name: Cache NPM modules
18-
uses: actions/cache@v2
18+
uses: actions/cache@v3
1919
with:
2020
path: ~/.npm
2121
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -25,6 +25,6 @@ jobs:
2525
- run: npm run lint
2626
- run: npm run test:coverage
2727
- name: Upload coverage to Codecov
28-
uses: codecov/codecov-action@v1
28+
uses: codecov/codecov-action@v3
2929
with:
3030
directory: ./coverage/

__test__/adapter.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ jest.mock("../src/lib/client", () => ({
99
}));
1010

1111
test("Assert Token and Server URL are required", () => {
12+
// @ts-ignore
1213
expect(() => new RequestAdapter(new HTTPClient(), {serverURL: undefined, token: undefined}))
13-
.toThrowError("Options serverURL and token are required.");
14+
.toThrow("Options serverURL and token are required.");
1415
});
1516

1617
describe("Assert Adapter delegates calls to Client", () => {

__test__/itembuilder.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ describe("Test ItemBuilder", () => {
4343
.build();
4444

4545
const { urls } = newItem;
46-
expect(urls.length).toEqual(2);
46+
expect(urls?.length).toEqual(2);
4747

4848
// Assert:
4949
// - the **LAST** url to be set as "primary" is given that attribute
5050
// - there is only 1 url with the `primary: true` attr
5151
let primaryUrls = 0;
5252
let primaryUrl;
53-
urls.forEach((url) => {
53+
urls?.forEach((url) => {
5454
if (url.primary) {
5555
primaryUrl = url.href;
5656
primaryUrls++;
@@ -92,7 +92,7 @@ describe("Test ItemBuilder", () => {
9292
// Invalid category -> ERROR
9393
expect(() => {
9494
builder.setCategory("invalid");
95-
}).toThrowError(TypeError);
95+
}).toThrow(TypeError);
9696

9797
builder.setCategory(CategoryEnum.Login);
9898
const itemWithCategory = builder.build();
@@ -106,7 +106,7 @@ describe("Test ItemBuilder", () => {
106106
.addSection("section 1")
107107
.build();
108108

109-
expect(itemOneSection.sections.length).toEqual(1);
109+
expect(itemOneSection.sections?.length).toEqual(1);
110110
expect(isValidSectionId(itemOneSection.sections[0].id)).toBeTruthy();
111111
});
112112

@@ -213,7 +213,7 @@ describe("Test ItemBuilder", () => {
213213
});
214214

215215
describe("Field GeneratorRecipe Configuration", () => {
216-
// @ts-expect-error
216+
// @ts-ignore
217217
const invalidRecipe: GeneratorRecipe = {
218218
length: 6,
219219
characterSets: new Array("adfioadhfg"),
@@ -268,7 +268,7 @@ describe("Test ItemBuilder", () => {
268268
generate: true,
269269
recipe: invalidRecipe,
270270
});
271-
}).toThrowError();
271+
}).toThrow();
272272
});
273273

274274
it("does not throw invalid recipe error if generate = false", () => {
@@ -279,7 +279,7 @@ describe("Test ItemBuilder", () => {
279279
generate: false,
280280
recipe: invalidRecipe,
281281
});
282-
}).not.toThrowError();
282+
}).not.toThrow();
283283

284284
const item = builder.build();
285285
expect(item.fields.length).toEqual(1);
@@ -342,6 +342,6 @@ describe("Use ENV Vars as default values", () => {
342342
const builder = new ItemBuilder();
343343
expect(() => {
344344
builder.build();
345-
}).toThrowError();
345+
}).toThrow();
346346
});
347347
});

__test__/op-connect.test.ts

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe("Test OnePasswordConnect CRUD", () => {
109109

110110
expect(updatedItem instanceof FullItem).toEqual(true);
111111
expect(updatedItem.title).toBe("Updated Title");
112-
expect(updatedItem.tags.sort()).toEqual(itemToBeUpdated.tags.sort());
112+
expect(updatedItem.tags?.sort()).toEqual(itemToBeUpdated.tags.sort());
113113
});
114114

115115
test("get item by title", async () => {
@@ -175,8 +175,9 @@ describe("Test OnePasswordConnect CRUD", () => {
175175
[null],
176176
[""],
177177
])("should throw error if %s provided", async (vaultQuery) => {
178+
// @ts-ignore
178179
await expect(() => op.getVault(vaultQuery))
179-
.rejects.toThrowError(ERROR_MESSAGE.PROVIDE_VAULT_NAME_OR_ID);
180+
.rejects.toThrow(ERROR_MESSAGE.PROVIDE_VAULT_NAME_OR_ID);
180181
});
181182

182183
test("should return vault by id", async () => {
@@ -218,7 +219,7 @@ describe("Test OnePasswordConnect CRUD", () => {
218219
});
219220

220221
test("should re-throw api error", async () => {
221-
const badRequestError = { status: 400, message: "Some bad request" };
222+
const badRequestError = new Error('Some bad request');
222223

223224
getItemsByTitleMock(title).replyWithError(badRequestError);
224225

@@ -230,8 +231,8 @@ describe("Test OnePasswordConnect CRUD", () => {
230231
const item2 = { id: "2" } as Item;
231232

232233
getItemsByTitleMock(title).reply(200, [item1, item2]);
233-
getFullItemMock(item1.id).reply(200, item1);
234-
getFullItemMock(item2.id).reply(200, item2);
234+
getFullItemMock(item1.id!).reply(200, item1);
235+
getFullItemMock(item2.id!).reply(200, item2);
235236

236237
const result: FullItem[] = await op.listItemsByTitle(VAULT_ID, title);
237238

@@ -247,8 +248,9 @@ describe("Test OnePasswordConnect CRUD", () => {
247248
[null],
248249
[""],
249250
])("should throw error if %s provided", async (itemQuery) => {
251+
// @ts-ignore
250252
await expect(() => op.getItem(VAULT_ID, itemQuery))
251-
.rejects.toThrowError(ERROR_MESSAGE.PROVIDE_ITEM_NAME_OR_ID);
253+
.rejects.toThrow(ERROR_MESSAGE.PROVIDE_ITEM_NAME_OR_ID);
252254
});
253255

254256
test("should return item by id", async () => {
@@ -286,7 +288,7 @@ describe("Test OnePasswordConnect CRUD", () => {
286288
});
287289

288290
test("should re-throw api error", async () => {
289-
const notFoundError = { status: 404, message: "Item not found" };
291+
const notFoundError = new Error('Item not found');
290292

291293
apiMock.getItemById()
292294
.replyWithError(notFoundError);
@@ -336,7 +338,7 @@ describe("Test OnePasswordConnect CRUD", () => {
336338
.reply(404);
337339

338340
await expect(() => op.deleteItemById(VAULT_ID, ITEM_ID))
339-
.rejects.toThrowError();
341+
.rejects.toThrow();
340342
});
341343

342344
test("should finish successfully ", async () => {
@@ -351,8 +353,9 @@ describe("Test OnePasswordConnect CRUD", () => {
351353
[null],
352354
[""],
353355
])("should throw error if %s provided", async (itemQuery) => {
356+
// @ts-ignore
354357
await expect(() => op.deleteItem(VAULT_ID, itemQuery))
355-
.rejects.toThrowError(ERROR_MESSAGE.PROVIDE_ITEM_NAME_OR_ID);
358+
.rejects.toThrow(ERROR_MESSAGE.PROVIDE_ITEM_NAME_OR_ID);
356359
});
357360

358361
test("should throw an error if 2 items found by title", async () => {
@@ -425,14 +428,14 @@ describe("Test OnePasswordConnect CRUD", () => {
425428
apiMock.getItemById().reply(404);
426429

427430
await expect(() => op.getItemOTP(VAULT_ID, ITEM_ID))
428-
.rejects.toThrowError();
431+
.rejects.toThrow();
429432
});
430433

431434
test("should throw error if item has no OTP", async () => {
432435
apiMock.getItemById().reply(200, { id: ITEM_ID });
433436

434437
await expect(() => op.getItemOTP(VAULT_ID, ITEM_ID))
435-
.rejects.toThrowError(ErrorMessageFactory.noOTPFoundForItem(ITEM_ID));
438+
.rejects.toThrow(ErrorMessageFactory.noOTPFoundForItem(ITEM_ID));
436439
});
437440

438441
test("should return OTP", async () => {
@@ -455,7 +458,7 @@ describe("Test OnePasswordConnect CRUD", () => {
455458
});
456459

457460
test("should re-throw api error", async () => {
458-
const badRequestError = { status: 400, message: "Some bad request" };
461+
const badRequestError = new Error('Some bad request');
459462

460463
apiMock.listItemsByTitleContains(title).replyWithError(badRequestError);
461464

@@ -482,7 +485,8 @@ describe("Test OnePasswordConnect CRUD", () => {
482485
describe("get file by id", () => {
483486
test.each(["", null, undefined])
484487
("should throw error if %s provides as file id", async (fileId) => {
485-
await expect(() => op.getFileById(vaultTitle, itemTitle, fileId)).rejects.toThrowError(new Error(ErrorMessageFactory.noFileIdProvided()));
488+
// @ts-ignore
489+
await expect(() => op.getFileById(vaultTitle, itemTitle, fileId)).rejects.toThrow(new Error(ErrorMessageFactory.noFileIdProvided()));
486490
});
487491

488492
test("should throw error if invalid vault id provided", async () => {
@@ -534,7 +538,8 @@ describe("Test OnePasswordConnect CRUD", () => {
534538
describe('as a string', () => {
535539
test.each(["", null, undefined])
536540
("should throw error if %s provides as file id", async (fileId) => {
537-
await expect(() => op.getFileContent(vaultTitle, itemTitle, fileId)).rejects.toThrowError(new Error(ErrorMessageFactory.noFileIdProvided()));
541+
// @ts-ignore
542+
await expect(() => op.getFileContent(vaultTitle, itemTitle, fileId)).rejects.toThrow(new Error(ErrorMessageFactory.noFileIdProvided()));
538543
});
539544

540545
test("should throw error if invalid vault id provided", async () => {
@@ -583,7 +588,8 @@ describe("Test OnePasswordConnect CRUD", () => {
583588
describe('as a stream', () => {
584589
test.each(["", null, undefined])
585590
("should throw error if %s provides as file id", async (fileId) => {
586-
await expect(() => op.getFileContentStream(vaultTitle, itemTitle, fileId)).rejects.toThrowError(new Error(ErrorMessageFactory.noFileIdProvided()));
591+
// @ts-ignore
592+
await expect(() => op.getFileContentStream(vaultTitle, itemTitle, fileId)).rejects.toThrow(new Error(ErrorMessageFactory.noFileIdProvided()));
587593
});
588594

589595
test("should throw error if invalid vault id provided", async () => {
@@ -643,10 +649,12 @@ describe("Connector HTTP errors", () => {
643649
});
644650

645651
test("factory requires serverURL and token", () => {
646-
647-
expect(() => OnePasswordConnect({serverURL: undefined, token: undefined})).toThrowError();
648-
expect(() => OnePasswordConnect({serverURL: mockServerUrl, token: undefined})).toThrowError();
649-
expect(() => OnePasswordConnect({serverURL: undefined, token: mockToken})).toThrowError();
652+
// @ts-ignore
653+
expect(() => OnePasswordConnect({serverURL: undefined, token: undefined})).toThrow();
654+
// @ts-ignore
655+
expect(() => OnePasswordConnect({serverURL: mockServerUrl, token: undefined})).toThrow();
656+
// @ts-ignore
657+
expect(() => OnePasswordConnect({serverURL: undefined, token: mockToken})).toThrow();
650658

651659
});
652660

0 commit comments

Comments
 (0)