Skip to content

Commit 5400f84

Browse files
committed
chore: update lockfile
1 parent bb6afcd commit 5400f84

File tree

10 files changed

+36316
-13146
lines changed

10 files changed

+36316
-13146
lines changed

eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import eslintConfigPrettier from 'eslint-config-prettier/flat';
55
export default [
66
{
77
ignores: [
8-
'node_modules',
9-
'dist',
8+
'**/node_modules',
9+
'**/dist',
1010
'coverage',
1111
'**/*.js',
1212
'**/*.d.ts',

package-lock.json

Lines changed: 15680 additions & 3550 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"test:e2e:scrapers": "node test/e2e/runScraperTests.mjs",
4545
"test:e2e:sdk": "npm run test:e2e:sdk:tarball && node test/e2e/runSdkTests.mjs",
4646
"test:e2e:sdk:tarball": "npm run build && cd packages/apify && mv $(npm pack | tail -n 1) ../../test/e2e/apify.tgz",
47+
"tsc-check-tests": "tsc --noEmit --project test/tsconfig.json",
4748
"coverage": "vitest --coverage",
4849
"release": "npm run build && lerna publish from-package --contents dist",
4950
"publish:next": "lerna publish --canary --preid beta --dist-tag next",
@@ -95,5 +96,8 @@
9596
"vite-tsconfig-paths": "^4.3.2",
9697
"vitest": "^2.0.5"
9798
},
99+
"overrides": {
100+
"vite": "5.4.11"
101+
},
98102
"packageManager": "npm@10.9.2"
99103
}

packages/apify/src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { type } from 'node:os';
22
import { normalize } from 'node:path';
33

4-
// @ts-expect-error if we enable resolveJsonModule, we end up with `src` folder in `dist`
4+
// @ts-ignore if we enable resolveJsonModule, we end up with `src` folder in `dist`
55
import { version as crawleeVersion } from '@crawlee/core/package.json';
6-
// @ts-expect-error if we enable resolveJsonModule, we end up with `src` folder in `dist`
6+
// @ts-ignore if we enable resolveJsonModule, we end up with `src` folder in `dist`
77
import { version as apifyClientVersion } from 'apify-client/package.json';
88
import { pathExistsSync, readJSONSync } from 'fs-extra';
99
import semver from 'semver';
1010

1111
import { APIFY_ENV_VARS } from '@apify/consts';
1212
import log from '@apify/log';
1313

14-
// @ts-expect-error if we enable resolveJsonModule, we end up with `src` folder in `dist`
14+
// @ts-ignore if we enable resolveJsonModule, we end up with `src` folder in `dist`
1515
import { version as apifyVersion } from '../package.json';
1616

1717
/**

test/apify/actor.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ describe('Actor', () => {
838838
this.readyRun = { ...this.run, status: ACT_JOB_STATUSES.READY };
839839
// @ts-expect-error
840840
this.expected = {
841+
// @ts-expect-error
841842
...this.finishedRun,
842843
output: {
843844
contentType: globalOptions.contentType,

test/apify/events.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { WebSocketServer } from 'ws';
77
import { ACTOR_ENV_VARS, APIFY_ENV_VARS } from '@apify/consts';
88

99
describe('events', () => {
10-
let wss: WebSocketServer = null;
10+
let wss: WebSocketServer = null!;
1111
const config = Configuration.getGlobalConfig();
12-
let events: PlatformEventManager | null = null;
12+
let events: PlatformEventManager = null!;
1313

1414
beforeEach(() => {
1515
wss = new WebSocketServer({ port: 9099 });
@@ -130,7 +130,7 @@ describe('events', () => {
130130

131131
test('should send persist state events in regular interval', async () => {
132132
const eventsReceived = [];
133-
const interval = config.get('persistStateIntervalMillis');
133+
const interval = config.get('persistStateIntervalMillis')!;
134134

135135
events.on(EventType.PERSIST_STATE, (data) => eventsReceived.push(data));
136136
await events.init();

test/apify/proxy_configuration.test.ts

Lines changed: 55 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Actor, ProxyConfiguration } from 'apify';
22
import { UserClient } from 'apify-client';
3-
import { Request, sleep } from 'crawlee';
3+
import { type Dictionary, Request, sleep } from 'crawlee';
44

55
import { APIFY_ENV_VARS, LOCAL_APIFY_ENV_VARS } from '@apify/consts';
66

@@ -140,12 +140,12 @@ describe('ProxyConfiguration', () => {
140140
});
141141

142142
test('should throw on invalid groups and countryCode args', async () => {
143-
// @ts-expect-error invalid input
144143
expect(
144+
// @ts-expect-error invalid input
145145
() => new ProxyConfiguration({ groups: [new Date()] }),
146146
).toThrowError();
147-
// @ts-expect-error invalid input
148147
expect(
148+
// @ts-expect-error invalid input
149149
() => new ProxyConfiguration({ groups: [{}, 'fff', 'ccc'] }),
150150
).toThrowError();
151151
expect(
@@ -154,13 +154,13 @@ describe('ProxyConfiguration', () => {
154154
expect(
155155
() => new ProxyConfiguration({ groups: ['ffff', 'fff', 'cc$c'] }),
156156
).toThrowError();
157-
// @ts-expect-error invalid input
158157
expect(
158+
// @ts-expect-error invalid input
159159
() => new ProxyConfiguration({ apifyProxyGroups: [new Date()] }),
160160
).toThrowError();
161161

162-
// @ts-expect-error invalid input
163162
expect(
163+
// @ts-expect-error invalid input
164164
() => new ProxyConfiguration({ countryCode: new Date() }),
165165
).toThrow();
166166
expect(() => new ProxyConfiguration({ countryCode: 'aa' })).toThrow();
@@ -231,7 +231,7 @@ describe('ProxyConfiguration', () => {
231231
'http://proxy.com:6666',
232232
];
233233
const newUrlFunction = () => {
234-
return customUrls.pop();
234+
return customUrls.pop() ?? null;
235235
};
236236
const proxyConfiguration = new ProxyConfiguration({
237237
newUrlFunction,
@@ -248,14 +248,15 @@ describe('ProxyConfiguration', () => {
248248
'http://proxy.com:4444',
249249
);
250250

251+
// TODO enable strictNullChecks in tests
251252
// through newProxyInfo()
252-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
253+
expect((await proxyConfiguration.newProxyInfo())?.url).toEqual(
253254
'http://proxy.com:3333',
254255
);
255-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
256+
expect((await proxyConfiguration.newProxyInfo())?.url).toEqual(
256257
'http://proxy.com:2222',
257258
);
258-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
259+
expect((await proxyConfiguration.newProxyInfo())?.url).toEqual(
259260
'http://proxy.com:1111',
260261
);
261262
});
@@ -271,7 +272,7 @@ describe('ProxyConfiguration', () => {
271272
];
272273
const newUrlFunction = async () => {
273274
await sleep(5);
274-
return customUrls.pop();
275+
return customUrls.pop() ?? null;
275276
};
276277
const proxyConfiguration = new ProxyConfiguration({
277278
newUrlFunction,
@@ -289,13 +290,13 @@ describe('ProxyConfiguration', () => {
289290
);
290291

291292
// through newProxyInfo()
292-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
293+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
293294
'http://proxy.com:3333',
294295
);
295-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
296+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
296297
'http://proxy.com:2222',
297298
);
298-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
299+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
299300
'http://proxy.com:1111',
300301
);
301302
});
@@ -312,12 +313,12 @@ describe('ProxyConfiguration', () => {
312313

313314
// @ts-expect-error private property
314315
const { proxyUrls } = proxyConfiguration;
315-
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls[0]);
316-
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls[1]);
317-
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls[2]);
318-
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls[0]);
319-
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls[1]);
320-
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls[2]);
316+
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls![0]);
317+
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls![1]);
318+
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls![2]);
319+
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls![0]);
320+
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls![1]);
321+
expect(await proxyConfiguration.newUrl()).toEqual(proxyUrls![2]);
321322
});
322323

323324
test('newProxyInfo() should return correctly rotated URL', async () => {
@@ -331,23 +332,23 @@ describe('ProxyConfiguration', () => {
331332

332333
// @ts-expect-error TODO private property?
333334
const { proxyUrls } = proxyConfiguration;
334-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
335-
proxyUrls[0],
335+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
336+
proxyUrls![0],
336337
);
337-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
338-
proxyUrls[1],
338+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
339+
proxyUrls![1],
339340
);
340-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
341-
proxyUrls[2],
341+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
342+
proxyUrls![2],
342343
);
343-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
344-
proxyUrls[0],
344+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
345+
proxyUrls![0],
345346
);
346-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
347-
proxyUrls[1],
347+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
348+
proxyUrls![1],
348349
);
349-
expect((await proxyConfiguration.newProxyInfo()).url).toEqual(
350-
proxyUrls[2],
350+
expect((await proxyConfiguration.newProxyInfo())!.url).toEqual(
351+
proxyUrls![2],
351352
);
352353
});
353354

@@ -372,38 +373,38 @@ describe('ProxyConfiguration', () => {
372373
const { proxyUrls } = proxyConfiguration;
373374
// should use same proxy URL
374375
expect(await proxyConfiguration.newUrl(sessions[0])).toEqual(
375-
proxyUrls[0],
376+
proxyUrls![0],
376377
);
377378
expect(await proxyConfiguration.newUrl(sessions[0])).toEqual(
378-
proxyUrls[0],
379+
proxyUrls![0],
379380
);
380381
expect(await proxyConfiguration.newUrl(sessions[0])).toEqual(
381-
proxyUrls[0],
382+
proxyUrls![0],
382383
);
383384

384385
// should rotate different proxies
385386
expect(await proxyConfiguration.newUrl(sessions[1])).toEqual(
386-
proxyUrls[1],
387+
proxyUrls![1],
387388
);
388389
expect(await proxyConfiguration.newUrl(sessions[2])).toEqual(
389-
proxyUrls[2],
390+
proxyUrls![2],
390391
);
391392
expect(await proxyConfiguration.newUrl(sessions[3])).toEqual(
392-
proxyUrls[0],
393+
proxyUrls![0],
393394
);
394395
expect(await proxyConfiguration.newUrl(sessions[4])).toEqual(
395-
proxyUrls[1],
396+
proxyUrls![1],
396397
);
397398
expect(await proxyConfiguration.newUrl(sessions[5])).toEqual(
398-
proxyUrls[2],
399+
proxyUrls![2],
399400
);
400401

401402
// should remember already used session
402403
expect(await proxyConfiguration.newUrl(sessions[1])).toEqual(
403-
proxyUrls[1],
404+
proxyUrls![1],
404405
);
405406
expect(await proxyConfiguration.newUrl(sessions[3])).toEqual(
406-
proxyUrls[0],
407+
proxyUrls![0],
407408
);
408409
});
409410

@@ -510,13 +511,11 @@ describe('ProxyConfiguration', () => {
510511

511512
// through newProxyInfo()
512513
expect(
513-
(
514-
await proxyConfiguration.newProxyInfo('abc', {
515-
request: new Request({
516-
url: 'http://example.com',
517-
}) as any,
518-
})
519-
).url,
514+
(await proxyConfiguration.newProxyInfo('abc', {
515+
request: new Request({
516+
url: 'http://example.com',
517+
}) as any,
518+
}))!.url,
520519
).toEqual('http://proxy.com:1111');
521520
});
522521

@@ -594,7 +593,7 @@ describe('Actor.createProxyConfiguration()', () => {
594593

595594
test('should work without password (with token)', async () => {
596595
process.env.APIFY_TOKEN = '123456789';
597-
const opts = { ...basicOpts };
596+
const opts: Dictionary = { ...basicOpts };
598597
delete opts.password;
599598

600599
const getUserSpy = vitest.spyOn(UserClient.prototype, 'get');
@@ -743,20 +742,18 @@ describe('Actor.createProxyConfiguration()', () => {
743742

744743
// through newUrl()
745744
expect(
746-
await proxyConfiguration.newUrl('abc', {
745+
await proxyConfiguration!.newUrl('abc', {
747746
request: new Request({ url: 'http://example.com' }) as any,
748747
}),
749748
).toEqual('http://proxy.com:1111');
750749

751750
// through newProxyInfo()
752751
expect(
753-
(
754-
await proxyConfiguration.newProxyInfo('abc', {
755-
request: new Request({
756-
url: 'http://example.com',
757-
}) as any,
758-
})
759-
).url,
752+
(await proxyConfiguration!.newProxyInfo('abc', {
753+
request: new Request({
754+
url: 'http://example.com',
755+
}) as any,
756+
}))!.url,
760757
).toEqual('http://proxy.com:1111');
761758
});
762759

@@ -784,7 +781,7 @@ describe('Actor.createProxyConfiguration()', () => {
784781
});
785782

786783
// eslint-disable-next-line dot-notation
787-
expect(proxyConfiguration['tieredProxyUrls']).toEqual([
784+
expect(proxyConfiguration!['tieredProxyUrls']).toEqual([
788785
[
789786
'http://groups-GROUP1,country-CZ:password@proxy.apify.com:8000',
790787
],

test/apify/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('printOutdatedSdkWarning()', () => {
7373
process.env[APIFY_ENV_VARS.SDK_LATEST_VERSION] = semver.inc(
7474
currentVersion,
7575
'minor',
76-
);
76+
)!;
7777
printOutdatedSdkWarning();
7878

7979
expect(spy).toHaveBeenCalledTimes(1);

test/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
"sourceMap": true,
66
"noUnusedLocals": false,
77
"noUnusedParameters": false,
8-
"strictNullChecks": false,
98
"types": ["vitest/globals"],
10-
"module": "Node16",
9+
"module": "ESNext",
1110
"moduleResolution": "Bundler",
1211
"resolveJsonModule": true
1312
}

0 commit comments

Comments
 (0)