@crawlora-org/sdk 1.2.0-sdk.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/LICENSE +21 -0
- package/README.md +103 -0
- package/examples/bing-search.mjs +18 -0
- package/examples/youtube-transcript.mjs +26 -0
- package/openapi/public.json +52962 -0
- package/package.json +53 -0
- package/src/client.js +268 -0
- package/src/index.d.ts +75 -0
- package/src/index.js +2 -0
- package/src/operations.js +12472 -0
- package/src/types.d.ts +12425 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v1.2.0-sdk.11
|
|
4
|
+
|
|
5
|
+
- Added operation-id parameter and response maps so dynamic `request` and
|
|
6
|
+
`operation` calls infer types from literal operation ids.
|
|
7
|
+
- Added type-usage coverage for typed dynamic calls and kept runtime call
|
|
8
|
+
shapes unchanged.
|
|
9
|
+
- Published the SDK to npmjs while keeping the GitHub Packages mirror active.
|
|
10
|
+
|
|
11
|
+
## v1.2.0-sdk.10
|
|
12
|
+
|
|
13
|
+
- Generated OpenAPI schema model interfaces and aliases for endpoint responses
|
|
14
|
+
and body parameters.
|
|
15
|
+
- Updated typed endpoint declarations to return concrete response aliases while
|
|
16
|
+
keeping runtime call shapes unchanged.
|
|
17
|
+
|
|
18
|
+
## v1.2.0-sdk.9
|
|
19
|
+
|
|
20
|
+
- Added fail-fast enum validation for generated query and form parameters.
|
|
21
|
+
- Wrapped malformed JSON responses in `CrawloraError` with response status,
|
|
22
|
+
raw response text, and parser cause details.
|
|
23
|
+
|
|
24
|
+
## v1.2.0-sdk.8
|
|
25
|
+
|
|
26
|
+
- Regenerated from the SDK spec that excludes deprecated endpoints.
|
|
27
|
+
- Removed the deprecated Google Lens example and generated SDK surface.
|
|
28
|
+
|
|
29
|
+
## v1.2.0-sdk.7
|
|
30
|
+
|
|
31
|
+
- Added fail-fast validation for required query, form, and body parameters.
|
|
32
|
+
- Normalized negative retry settings while preserving the public client API.
|
|
33
|
+
|
|
34
|
+
## v1.2.0-sdk.6
|
|
35
|
+
|
|
36
|
+
- Added runnable Bing search, YouTube transcript, and Google Lens upload
|
|
37
|
+
examples.
|
|
38
|
+
- Added npm example scripts and an optional `smoke:live` command that skips
|
|
39
|
+
cleanly when live credentials or inputs are absent.
|
|
40
|
+
- Published the beta SDK to GitHub Packages as `@crawlora-org/sdk`.
|
|
41
|
+
|
|
42
|
+
## v1.2.0-sdk.5
|
|
43
|
+
|
|
44
|
+
- Prepared the SDK for future npm publishing as `@crawlora-org/sdk`.
|
|
45
|
+
- Updated package identity, public import examples, and registry-readiness
|
|
46
|
+
documentation.
|
|
47
|
+
|
|
48
|
+
## v1.2.0-sdk.4
|
|
49
|
+
|
|
50
|
+
- Added release-readiness files, CI, license, fuller README guidance, and npm
|
|
51
|
+
package metadata.
|
|
52
|
+
- Kept endpoint behavior and generated operation contract unchanged.
|
|
53
|
+
|
|
54
|
+
## v1.2.0-sdk.3
|
|
55
|
+
|
|
56
|
+
- Added generated TypeScript endpoint declarations for operation ids, groups,
|
|
57
|
+
params, enum values, and response aliases.
|
|
58
|
+
|
|
59
|
+
## v1.2.0-sdk.2
|
|
60
|
+
|
|
61
|
+
- Improved retries, request options, user agent handling, multipart support,
|
|
62
|
+
response parsing, and SDK error details.
|
|
63
|
+
|
|
64
|
+
## v1.2.0-sdk.1
|
|
65
|
+
|
|
66
|
+
- Cleaned public SDK docs to avoid maintainer-only generation details.
|
|
67
|
+
|
|
68
|
+
## Initial SDK
|
|
69
|
+
|
|
70
|
+
- Added the first Git-installable Crawlora JavaScript SDK generated from the
|
|
71
|
+
public API contract.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Crawlora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Crawlora JavaScript SDK
|
|
2
|
+
|
|
3
|
+
JavaScript and TypeScript SDK for the public Crawlora API. It works in Node.js
|
|
4
|
+
18+ and modern runtimes with `fetch`.
|
|
5
|
+
|
|
6
|
+
Website: [crawlora.net](https://crawlora.net)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @crawlora-org/sdk@latest
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
For reproducible builds, pin the current package version:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @crawlora-org/sdk@1.2.0-sdk.11
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { CrawloraClient } from "@crawlora-org/sdk";
|
|
24
|
+
|
|
25
|
+
const crawlora = new CrawloraClient({ apiKey: process.env.CRAWLORA_API_KEY });
|
|
26
|
+
const result = await crawlora.bing.search({ q: "coffee shops", count: 10 });
|
|
27
|
+
console.log(result);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Generated TypeScript declarations cover operation ids, endpoint groups,
|
|
31
|
+
parameter objects, enum values, request options, and response aliases.
|
|
32
|
+
Dynamic calls infer parameter and response types from literal operation ids:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const result = await crawlora.request("bing-search", { q: "coffee shops" });
|
|
36
|
+
result.data?.results?.[0]?.title;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
const crawlora = new CrawloraClient({
|
|
43
|
+
apiKey: process.env.CRAWLORA_API_KEY,
|
|
44
|
+
baseUrl: "https://api.crawlora.net/api/v1",
|
|
45
|
+
retries: 2,
|
|
46
|
+
retryDelay: 250,
|
|
47
|
+
headers: { "x-client": "example" }
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Per-request options support headers, timeout, abort signals, and response mode:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const text = await crawlora.youtube.transcript(
|
|
55
|
+
{ id: "VIDEO_ID", format: "text" },
|
|
56
|
+
{ responseType: "text", timeout: 10000 }
|
|
57
|
+
);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Failed API calls throw `CrawloraError` with `status`, optional API `code`,
|
|
61
|
+
parsed `body`, and the original `response` when available.
|
|
62
|
+
|
|
63
|
+
## Examples
|
|
64
|
+
|
|
65
|
+
Runnable examples live under `examples/`:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
CRAWLORA_API_KEY=... npm run example:bing-search
|
|
69
|
+
CRAWLORA_API_KEY=... CRAWLORA_YOUTUBE_VIDEO_ID=... npm run example:youtube-transcript
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Each example also accepts `CRAWLORA_BASE_URL` for staging or local API testing.
|
|
73
|
+
The examples exit without making a request when the required live environment
|
|
74
|
+
variables are not set. `npm run smoke:live` runs all live examples in sequence.
|
|
75
|
+
|
|
76
|
+
## Versioning
|
|
77
|
+
|
|
78
|
+
This SDK is published to npmjs and mirrored to GitHub Packages. The package
|
|
79
|
+
`latest` dist-tag and the moving Git tag named `latest` track the current
|
|
80
|
+
promoted beta. Explicit package versions and Git beta tags such as
|
|
81
|
+
`1.2.0-sdk.11` / `v1.2.0-sdk.11` remain available for reproducible builds. Pin
|
|
82
|
+
an explicit version in production applications and upgrade intentionally.
|
|
83
|
+
|
|
84
|
+
GitHub Packages installs require a project `.npmrc` that maps the
|
|
85
|
+
`@crawlora-org` scope to `https://npm.pkg.github.com` and a GitHub token that
|
|
86
|
+
can read packages.
|
|
87
|
+
|
|
88
|
+
## Package Name
|
|
89
|
+
|
|
90
|
+
The npm package name is `@crawlora-org/sdk`:
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
import { CrawloraClient } from "@crawlora-org/sdk";
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The package names `crawlora` and `@crawlora/sdk` are not used by this repository
|
|
97
|
+
because they already exist on npm and point to a different package source.
|
|
98
|
+
|
|
99
|
+
## Optional Live Smoke Test
|
|
100
|
+
|
|
101
|
+
Default tests use mock `fetch` implementations. The programs under `examples/`
|
|
102
|
+
can be used as optional live smoke tests when `CRAWLORA_API_KEY` is available.
|
|
103
|
+
Live calls are not part of default CI.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CrawloraClient } from "../src/index.js";
|
|
2
|
+
|
|
3
|
+
const client = newClient();
|
|
4
|
+
if (client) {
|
|
5
|
+
const result = await client.bing.search({ q: "coffee shops", count: 5 });
|
|
6
|
+
console.log(JSON.stringify(result, null, 2));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function newClient() {
|
|
10
|
+
if (!process.env.CRAWLORA_API_KEY) {
|
|
11
|
+
console.error("set CRAWLORA_API_KEY to run this live example");
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return new CrawloraClient({
|
|
15
|
+
apiKey: process.env.CRAWLORA_API_KEY,
|
|
16
|
+
baseUrl: process.env.CRAWLORA_BASE_URL
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CrawloraClient } from "../src/index.js";
|
|
2
|
+
|
|
3
|
+
const client = newClient();
|
|
4
|
+
if (client) {
|
|
5
|
+
const videoId = process.argv[2] || process.env.CRAWLORA_YOUTUBE_VIDEO_ID;
|
|
6
|
+
if (!videoId) {
|
|
7
|
+
console.error("set CRAWLORA_YOUTUBE_VIDEO_ID or pass a video id to run this live example");
|
|
8
|
+
} else {
|
|
9
|
+
const text = await client.youtube.transcript(
|
|
10
|
+
{ id: videoId, format: "text" },
|
|
11
|
+
{ responseType: "text" }
|
|
12
|
+
);
|
|
13
|
+
console.log(text);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function newClient() {
|
|
18
|
+
if (!process.env.CRAWLORA_API_KEY) {
|
|
19
|
+
console.error("set CRAWLORA_API_KEY to run this live example");
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return new CrawloraClient({
|
|
23
|
+
apiKey: process.env.CRAWLORA_API_KEY,
|
|
24
|
+
baseUrl: process.env.CRAWLORA_BASE_URL
|
|
25
|
+
});
|
|
26
|
+
}
|