1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "sourceFormat": "json-schema",
12 "targetFormats": [
13 "typescript",
14 "zod"
15 ],
16 "schemaSource": "direct",
17 "conversionOptions": {
18 "typescript": {
19 "bannerComment": "/* Auto-generated types */",
20 "style": {
21 "semi": true,
22 "singleQuote": true
23 },
24 "strictIndexSignatures": false
25 },
26 "zod": {
27 "strict": true,
28 "errorMessages": true
29 },
30 "openapi": {
31 "version": "3.0.0",
32 "includeExamples": true
33 },
34 "graphql": {
35 "includeDescriptions": true,
36 "nullableArrayItems": false
37 }
38 },
39 "validateSchema": true,
40 "generateExamples": false
41};
42
43
44const run = await client.actor("fiery_dream/schema-universal-converter").call(input);
45
46
47console.log('Results from dataset');
48console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
49const { items } = await client.dataset(run.defaultDatasetId).listItems();
50items.forEach((item) => {
51 console.dir(item);
52});
53
54