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

Apify Client v1 #146

Merged
merged 136 commits into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
1ffc2fd
Reimplement first actor endpoints
mnmkng Sep 4, 2019
98dd092
Progress commit
mnmkng Dec 31, 2019
6fc594c
Completed tests for actors endpoint.
petrpatek Dec 31, 2019
3f0fa6c
Task endpoint partial rewrote.
petrpatek Dec 31, 2019
819012b
rewrote users.
petrpatek Dec 31, 2019
a86bd4d
rewrote logs.js
petrpatek Dec 31, 2019
2208ea5
started dataset rewrote.
petrpatek Jan 2, 2020
f66a4ba
keyValuesStores basic methods rewrote.
petrpatek Jan 6, 2020
a5ffb60
rewrote request_queues.js
petrpatek Jan 6, 2020
634af0e
rewrote webhooks.js
petrpatek Jan 6, 2020
cc7057d
rewrote webhook_dispatches.js.
petrpatek Jan 6, 2020
503def2
rewrote dataset tests. Removed Crawler.
petrpatek Jan 11, 2020
165520b
rewrote key_value_stores.js tests
petrpatek Jan 13, 2020
ec90fdf
xited tests that are not working, because of the client implementatio…
petrpatek Jan 13, 2020
5a1c71a
stuck in rewriting to async-retry.
petrpatek Jan 14, 2020
80d1ff6
fixed exponential backoff... I guess
petrpatek Jan 28, 2020
e8a55fa
make working browser POC.
petrpatek Jan 29, 2020
00c7638
make browser test work.
petrpatek Feb 14, 2020
ce86a42
used brotli compressor to reduce the bundle size.
petrpatek Feb 17, 2020
bebeb3b
Merge remote-tracking branch 'origin/master' into feature/isomorphic
petrpatek Feb 17, 2020
e96514c
introduced latest features from master.
petrpatek Feb 17, 2020
4887c61
refactored code. split lodash to functions because of the bundle size.
petrpatek Feb 17, 2020
3773cc4
removed deprecated method from task
petrpatek Feb 17, 2020
f953264
fixed lint err
petrpatek Feb 17, 2020
c72697b
added workflows.
petrpatek Feb 17, 2020
1622133
improved build script to build files for the test.
petrpatek Feb 17, 2020
9b96984
removed prepare script.
petrpatek Feb 17, 2020
f523460
split build to two parts.
petrpatek Feb 17, 2020
d24a225
improved webpack browser build.
petrpatek Feb 17, 2020
b9938df
removed unnecessary dependencies and engines.
petrpatek Feb 17, 2020
7eea3e4
migrated to jest due to performance
petrpatek Feb 17, 2020
24974f7
fixed lint
petrpatek Feb 17, 2020
a88d4a3
made tests green again,
petrpatek Feb 18, 2020
29a66fc
started abstract class.
petrpatek Feb 18, 2020
9d2cfe5
Comments from PR.
petrpatek Feb 20, 2020
81b3d74
renamed edpoint to resource. Deleted extra expbackoff logic from data…
petrpatek Feb 20, 2020
12208e0
changed webpack mode.
petrpatek Feb 20, 2020
af99d39
added defaults.
petrpatek Feb 20, 2020
9ab5568
improved text decoding.
petrpatek Feb 20, 2020
2bed4fa
documented listActors endpoint.
petrpatek Feb 20, 2020
d827a7d
updated docs for actor endpoint.
petrpatek Feb 21, 2020
d7fded2
improved dataset endpoint docs.
petrpatek Feb 21, 2020
2df3d35
documented dataset endpoint.
petrpatek Feb 21, 2020
f164895
improved KV stores docs.
petrpatek Feb 21, 2020
0f1082d
logs docs slightly improved.
petrpatek Feb 21, 2020
c39b07a
Request queue docs improved.
petrpatek Feb 21, 2020
4963927
improved tasks docs.
petrpatek Feb 22, 2020
a29bd00
documented user endpoint.
petrpatek Feb 22, 2020
d763168
documented webhook dispatches
petrpatek Feb 22, 2020
3ca1579
documented webhooks endpoint.
petrpatek Feb 22, 2020
89c8589
added build docs action.
petrpatek Feb 24, 2020
d2d3744
improved docs strategy.
petrpatek Feb 24, 2020
616b6c8
fixed yml
petrpatek Feb 24, 2020
8456f68
fix
petrpatek Feb 24, 2020
ea957b4
refactored actions.
petrpatek Feb 24, 2020
c7a0f07
refactored actions.
petrpatek Feb 24, 2020
b958310
renamed.
petrpatek Feb 24, 2020
02d4a68
on added
petrpatek Feb 24, 2020
0321852
increased version added my parameter to list actors endpoint.
petrpatek Feb 24, 2020
4ccc2b1
added dist
petrpatek Feb 24, 2020
20173bc
fix because of null from integration tests.
petrpatek Feb 24, 2020
972d5d6
renamed tilde separated to slash separated.
petrpatek Feb 25, 2020
dcded5e
added missing return.
petrpatek Feb 25, 2020
464d04b
Fixed docs. Improved README.md. Added CHANGELOG.md. Bump version.
petrpatek Mar 3, 2020
6f50096
Added possibility to remove content-type header with null and fixed J…
petrpatek Mar 22, 2020
1e1ea72
fixed getValue
petrpatek Mar 22, 2020
edb560d
Implementing schedules API
mtrunkat Mar 24, 2020
232d1cc
Adding tests and linting
mtrunkat Mar 24, 2020
2b60154
fixed header removal and log endpoint.
petrpatek Mar 24, 2020
d9c2e47
Merge pull request #139 from apifytech/feature/schedules
petrpatek Mar 24, 2020
f1b3881
improved log tests increased beta version.
petrpatek Mar 24, 2020
3642fe1
Fix typo in version
mnmkng Mar 25, 2020
c041286
Fix lint
mnmkng Mar 25, 2020
4f66e4f
Fixed tasks endpoint
petrpatek Mar 30, 2020
678c1d7
fixed signing url. task input handling.
petrpatek Mar 31, 2020
c33bc35
Merge branch 'feature/isomorphic' of github.com:apifytech/apify-clien…
petrpatek Mar 31, 2020
91eee0d
removed babel for nodeJs.
petrpatek Apr 1, 2020
32c97eb
improved browser header to don't trigger error.
petrpatek Apr 1, 2020
28cac26
fixed docs.
petrpatek Apr 1, 2020
5782a2a
bump version
petrpatek Apr 1, 2020
a6185ce
Some changes
mnmkng Apr 19, 2020
61f6223
Not great, not terrible
mnmkng Jun 9, 2020
16bd1a5
Add missing clients
mnmkng Jun 9, 2020
b4b6464
Add clients to index
mnmkng Jun 9, 2020
1eb64b6
Dataset tests work
mnmkng Jun 10, 2020
cabb896
Dataset tests pass
mnmkng Jun 12, 2020
926616a
Key value stores
mnmkng Jun 17, 2020
5099c2d
Key value stores finished
mnmkng Jun 22, 2020
cca7c8d
Logs finished
mnmkng Jun 22, 2020
0c067f6
Request queue finished
mnmkng Jun 22, 2020
61f14bc
Schedules finished
mnmkng Jun 22, 2020
ac7dd9e
Tasks finished
mnmkng Jun 23, 2020
8a17bad
Users finished
mnmkng Jun 23, 2020
c019b50
Webhooks finished
mnmkng Jun 23, 2020
8fa92f4
Webhook Dispatches finished
mnmkng Jun 23, 2020
2b15949
Remove old stuff, refactor, fix tests
mnmkng Jun 23, 2020
6baeee2
Test Statistics
mnmkng Jun 23, 2020
ad8027c
Bump version
mnmkng Jun 24, 2020
cc5452b
Minor improvements
mnmkng Jul 22, 2020
f25f65b
Add response parsing logic
mnmkng Jul 22, 2020
77f3094
Add status params to actor runs endpoint
mnmkng Aug 25, 2020
785e9ce
Fix axios defaults
mnmkng Sep 2, 2020
9700d2d
Bump version
mnmkng Sep 2, 2020
ba63a57
Update KVS, bump version
mnmkng Sep 5, 2020
27fb35b
Lint files
mnmkng Sep 5, 2020
dd46dcd
Some changes
mnmkng Sep 8, 2020
04cc125
Merge branch 'chore/refactoring' of github.com:apify/apify-client-js …
jbartadev Sep 9, 2020
6b4340c
Minor improvements
mnmkng Sep 18, 2020
adb0a71
Merge branch 'chore/refactoring' of github.com:apify/apify-client-js …
jbartadev Sep 21, 2020
52a90e3
Add waitForFinish function to Run and Build
mnmkng Oct 2, 2020
c3caee2
Add waitForFinish tests
mnmkng Oct 2, 2020
27ae925
Fix lint
mnmkng Oct 2, 2020
fbf0b01
Merge branch 'chore/refactoring' of github.com:apify/apify-client-js …
jbartadev Oct 2, 2020
3cc3b4a
Added call method to actor
jbartadev Oct 2, 2020
4f9f53b
Fix invalid return value in getRecord
mnmkng Oct 5, 2020
5724d28
Merge branch 'chore/refactoring' of github.com:apify/apify-client-js …
jbartadev Oct 5, 2020
b8ce886
Fix setRecord with stringified JSON, remove lodash
mnmkng Oct 6, 2020
2b07cc5
Added private method _call to resource client
jbartadev Oct 6, 2020
ad5d99c
Added call method to task client, update actor call method
jbartadev Oct 6, 2020
ca40649
Bump version
mnmkng Oct 6, 2020
e63d263
Added call method tests
jbartadev Oct 6, 2020
13a6ed8
Merge branch 'chore/refactoring' into refactor/v1
jbartadev Oct 6, 2020
3850a50
fixed condition
jbartadev Oct 6, 2020
2df33ef
further refactoring
jbartadev Oct 7, 2020
0c1064e
small changes & made tests green again
jbartadev Oct 9, 2020
cdb1e95
Merge pull request #144 from apify/refactor/v1
mnmkng Oct 9, 2020
a715a36
Bump version
mnmkng Oct 9, 2020
304500d
Change signature of start and call methods
mnmkng Oct 13, 2020
0c185cd
Update comment
mnmkng Oct 13, 2020
ff0dea9
Change metamorph signature
mnmkng Oct 13, 2020
631b1ee
Improve ApifyApiError
mnmkng Oct 14, 2020
a8be029
Fix trailing slash and add some improvements
mnmkng Oct 14, 2020
93db7fb
Bump version
mnmkng Oct 14, 2020
aea26b8
Fix v2 in baseUrl and tests
mnmkng Oct 14, 2020
ff19d9c
Improve error logging, fix 404 on redirects
mnmkng Oct 14, 2020
8be38ec
Add browser test for api error, test node 14 not 10
mnmkng Oct 22, 2020
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
Prev Previous commit
Next Next commit
Added call method tests
  • Loading branch information
jbartadev committed Oct 6, 2020
commit e63d263d5375445e54c0f242cb674663584a800a
67 changes: 65 additions & 2 deletions test/actors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,71 @@ describe('Actor methods', () => {
validateRequest({ webhooks: stringifyWebhooksToBase64(webhooks) }, { actorId });
});

test.skip('call() works', async () => {
// TODO
test('call() works', async () => {
const actorId = 'some-id';
const contentType = 'application/x-www-form-urlencoded';
const input = 'some=body';
const timeout = 120;
const memory = 256;
const build = '1.2.0';

const query = {
timeout,
memory,
build,
};

const res = await client.actor(actorId).call({
contentType,
memoryMbytes: memory,
timeoutSecs: timeout,
build,
input,
});

await page.evaluate((id, opts) => client.actor(id).start(opts), actorId, { contentType, input, ...query });
validateRequest(query, { actorId }, { some: 'body' }, { 'content-type': contentType });

expect(res.id).toEqual('run-actor');
validateRequest(query, { actorId }, { some: 'body' }, { 'content-type': contentType });

const browserRes = await page.evaluate((id, opts) => client.actor(id).start(opts), actorId, { contentType, input, ...query });
expect(browserRes).toEqual(res);
validateRequest(query, { actorId }, { some: 'body' }, { 'content-type': contentType });
});

test('call() with wait for finish works', async () => {
const actorId = 'some-id';
const contentType = 'application/x-www-form-urlencoded';
const input = 'some=body';
const timeout = 120;
const memory = 256;
const build = '1.2.0';

const query = {
timeout,
memory,
build,
};

const res = await client.actor(actorId).call({
contentType,
memoryMbytes: memory,
timeoutSecs: timeout,
build,
waitSecs: 2,
input,
});

await page.evaluate((id, opts) => client.actor(id).start(opts), actorId, { contentType, input, ...query });
validateRequest(query, { actorId }, { some: 'body' }, { 'content-type': contentType });

expect(res.id).toEqual('get-actor');
validateRequest({ waitForFinish: 0 }, { actorId });

const browserRes = await page.evaluate((id) => client.actor(id).get(), actorId);
expect(browserRes).toEqual(res);
validateRequest({}, { actorId });
});

test('build() works', async () => {
Expand Down
63 changes: 63 additions & 0 deletions test/tasks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,69 @@ describe('Task methods', () => {
validateRequest(query, { taskId });
});

test('call() works', async () => {
const taskId = 'some-id';
const input = { some: 'body' };
const timeout = 120;
const memory = 256;
const build = '1.2.0';

const query = {
timeout,
memory,
build,
};

const res = await client.task(taskId).call({
memoryMbytes: memory,
timeoutSecs: timeout,
build,
input,
});

await page.evaluate((id, opts) => client.task(id).start(opts), taskId, { input, ...query });
validateRequest(query, { taskId }, { some: 'body' });

expect(res.id).toEqual('run-task');
validateRequest(query, { taskId }, { some: 'body' });

const browserRes = await page.evaluate((id, opts) => client.task(id).start(opts), taskId, { input, ...query });
expect(browserRes).toEqual(res);
validateRequest(query, { taskId }, { some: 'body' });
});

test('call() with wait for finish works', async () => {
const taskId = 'some-id';
const input = { some: 'body' };
const timeout = 120;
const memory = 256;
const build = '1.2.0';

const query = {
timeout,
memory,
build,
};

const res = await client.task(taskId).call({
memoryMbytes: memory,
timeoutSecs: timeout,
build,
waitSecs: 2,
input,
});

await page.evaluate((id, opts) => client.task(id).start(opts), taskId, { input, ...query });
validateRequest(query, { taskId }, { some: 'body' });

expect(res.id).toEqual('get-task');
validateRequest({ waitForFinish: 0 }, { taskId });

const browserRes = await page.evaluate((id) => client.task(id).get(), taskId);
expect(browserRes).toEqual(res);
validateRequest({}, { taskId });
});

test('webhooks().list() works', async () => {
const taskId = 'some-task-id';
const query = {
Expand Down