File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { Actor , log } from 'apify' ;
2
2
3
- // Also needs to be changed in test.mjs
4
- const PUBLIC_RECORD_KEY = 'public-record-key' ;
5
- const PUBLIC_DATA = { exposedData : 'test' } ;
6
-
7
3
await Actor . init ( ) ;
8
4
9
- await Actor . setValue ( PUBLIC_RECORD_KEY , JSON . stringify ( PUBLIC_DATA ) , { contentType : `application/json` } ) ;
5
+ const { data, recordKey } = await Actor . getInput ( ) ;
6
+
7
+ await Actor . setValue ( recordKey , JSON . stringify ( data ) , { contentType : `application/json` } ) ;
10
8
11
9
const defaultKeyValueStore = await Actor . openKeyValueStore ( ) ;
12
- const publicUrl = defaultKeyValueStore . getPublicUrl ( PUBLIC_RECORD_KEY ) ;
10
+ const publicUrl = defaultKeyValueStore . getPublicUrl ( recordKey ) ;
13
11
14
12
// Here we store the url itself
15
13
await Actor . setValue ( 'urlToPublicData' , publicUrl ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import assert from 'node:assert/strict';
2
2
3
3
import { ApifyClient } from 'apify' ;
4
4
5
- // Also needs to be changed in main.mjs
6
5
const PUBLIC_DATA = { exposedData : 'test' } ;
7
6
8
7
const client = new ApifyClient ( {
@@ -11,7 +10,7 @@ const client = new ApifyClient({
11
10
12
11
const actor = client . actor ( process . argv [ 2 ] ) ;
13
12
14
- const run = await actor . call ( { } , { waitSecs : 15 } ) ;
13
+ const run = await actor . call ( { data : PUBLIC_DATA , recordKey : 'public-record-key' } , { waitSecs : 15 } ) ;
15
14
assert . equal ( run . exitCode , 0 ) ;
16
15
17
16
const publicUrl = await client . keyValueStore ( run . defaultKeyValueStoreId ) . getRecord ( 'urlToPublicData' ) ;
You can’t perform that action at this time.
0 commit comments