Skip to content

Commit f8a3dbe

Browse files
chore: 🐝 Update SDK - Generate 0.16.0 (#107)
# SDK update Based on: - OpenAPI Doc - Speakeasy CLI 1.390.7 (2.409.8) https://github.com/speakeasy-api/speakeasy ## OpenAPI Change Summary ``` β”œβ”€β”¬Info β”‚ └──[πŸ”€] version (4:14) β”œβ”€β”¬Components β”‚ └─┬partition_parameters β”‚ β”œβ”€β”€[βž•] properties (264:17) β”‚ └─┬strategy β”‚ β”œβ”€β”€[πŸ”€] description (188:34) β”‚ └──[πŸ”€] default (189:30)❌ └─┬Extensions └──[πŸ”€] x-speakeasy-retries (319:22) ``` | Document Element | Total Changes | Breaking Changes | |------------------|---------------|------------------| | info | 1 | 0 | | components | 3 | 1 | Co-authored-by: speakeasybot <[email protected]>
1 parent 6dbe6e4 commit f8a3dbe

34 files changed

+515
-100
lines changed

β€Ž.speakeasy/gen.lock

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
lockVersion: 2.0.0
22
id: f42cb8e6-e2ce-4565-b975-5a9f38b94d5a
33
management:
4-
docChecksum: f9968a9b4e176b25982c5fe01966841c
5-
docVersion: 1.0.44
6-
speakeasyVersion: 1.360.0
7-
generationVersion: 2.392.0
8-
releaseVersion: 0.15.1
9-
configChecksum: 35a1f8ef21905c725838c160f1fe7332
4+
docChecksum: 07648fa4a81409d493b04f9a0210053a
5+
docVersion: 1.0.48
6+
speakeasyVersion: 1.390.7
7+
generationVersion: 2.409.8
8+
releaseVersion: 0.16.0
9+
configChecksum: 7d3a89591f1ead1b1ef84078be25d23c
1010
repoURL: https://github.com/Unstructured-IO/unstructured-js-client.git
1111
repoSubDirectory: .
1212
installationURL: https://github.com/Unstructured-IO/unstructured-js-client
1313
published: true
1414
features:
1515
typescript:
1616
additionalDependencies: 0.1.0
17-
constsAndDefaults: 0.1.6
18-
core: 3.13.0
17+
constsAndDefaults: 0.1.11
18+
core: 3.16.1
1919
defaultEnabledRetries: 0.1.0
2020
envVarSecurityUsage: 0.1.1
2121
examples: 2.81.4
@@ -29,13 +29,15 @@ features:
2929
retries: 2.83.0
3030
sdkHooks: 0.1.0
3131
serverIDs: 2.81.2
32-
unions: 2.85.6
32+
unions: 2.85.7
33+
uploadStreams: 0.1.0
3334
generatedFiles:
3435
- src/funcs/generalPartition.ts
3536
- src/sdk/general.ts
3637
- src/sdk/sdk.ts
3738
- .eslintrc.cjs
3839
- .npmignore
40+
- FUNCTIONS.md
3941
- RUNTIMES.md
4042
- jsr.json
4143
- package.json
@@ -45,6 +47,7 @@ generatedFiles:
4547
- src/lib/config.ts
4648
- src/lib/dlv.ts
4749
- src/lib/encodings.ts
50+
- src/lib/files.ts
4851
- src/lib/http.ts
4952
- src/lib/is-plain-object.ts
5053
- src/lib/logger.ts
@@ -60,11 +63,13 @@ generatedFiles:
6063
- src/sdk/models/errors/sdkerror.ts
6164
- src/sdk/models/errors/sdkvalidationerror.ts
6265
- src/sdk/types/blobs.ts
66+
- src/sdk/types/constdatetime.ts
6367
- src/sdk/types/enums.ts
6468
- src/sdk/types/fp.ts
6569
- src/sdk/types/index.ts
6670
- src/sdk/types/operations.ts
6771
- src/sdk/types/rfcdate.ts
72+
- src/sdk/types/streams.ts
6873
- tsconfig.json
6974
- src/sdk/models/operations/partition.ts
7075
- src/sdk/models/errors/httpvalidationerror.ts

β€Ž.speakeasy/workflow.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
speakeasyVersion: 1.360.0
1+
speakeasyVersion: 1.390.7
22
sources:
33
my-source:
44
sourceNamespace: my-source
5-
sourceRevisionDigest: sha256:b83979814670834969e52df50f6ab136c2e4e7e9b52d14e3fc0969190799f822
6-
sourceBlobDigest: sha256:73c84df69bf357471186697b8e9e28eac25dfda253e7729366a9e7e391d56267
5+
sourceRevisionDigest: sha256:38f3672383baa94018f7d826c034bf0f3e25ee8ed46d70c4633fc9661441c14b
6+
sourceBlobDigest: sha256:108f49adb0607b20fc4d54949d36599c08c87c2d19e0a40e4bd5a2b91d9ac3e3
77
tags:
88
- latest
99
- main
1010
targets:
1111
unstructed-typescript:
1212
source: my-source
1313
sourceNamespace: my-source
14-
sourceRevisionDigest: sha256:b83979814670834969e52df50f6ab136c2e4e7e9b52d14e3fc0969190799f822
15-
sourceBlobDigest: sha256:73c84df69bf357471186697b8e9e28eac25dfda253e7729366a9e7e391d56267
14+
sourceRevisionDigest: sha256:38f3672383baa94018f7d826c034bf0f3e25ee8ed46d70c4633fc9661441c14b
15+
sourceBlobDigest: sha256:108f49adb0607b20fc4d54949d36599c08c87c2d19e0a40e4bd5a2b91d9ac3e3
1616
outLocation: /github/workspace/repo
1717
workflow:
1818
workflowVersion: 1.0.0

β€ŽFUNCTIONS.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Standalone Functions
2+
3+
> [!NOTE]
4+
> This section is useful if you are using a bundler and targetting browsers and
5+
> runtimes where the size of an application affects performance and load times.
6+
7+
Every method in this SDK is also available as a standalone function. This
8+
alternative API is suitable when targetting the browser or serverless runtimes
9+
and using a bundler to build your application since all unused functionality
10+
will be tree-shaken away. This includes code for unused methods, Zod schemas,
11+
encoding helpers and response handlers. The result is dramatically smaller
12+
impact on the application's final bundle size which grows very slowly as you use
13+
more and more functionality from this SDK.
14+
15+
Calling methods through the main SDK class remains a valid and generally more
16+
more ergonomic option. Standalone functions represent an optimisation for a
17+
specific category of applications.
18+
19+
## Example
20+
21+
```typescript
22+
import { openAsBlob } from "node:fs";
23+
import { UnstructuredClientCore } from "unstructured-client/core.js";
24+
import { generalPartition } from "unstructured-client/funcs/generalPartition.js";
25+
import { SDKValidationError } from "unstructured-client/sdk/models/errors/sdkvalidationerror.js";
26+
import { ChunkingStrategy, Strategy } from "unstructured-client/sdk/models/shared";
27+
28+
// Use `UnstructuredClientCore` for best tree-shaking performance.
29+
// You can create one instance of it to use across an application.
30+
const unstructuredClient = new UnstructuredClientCore();
31+
32+
async function run() {
33+
const res = await generalPartition(unstructuredClient, {
34+
partitionParameters: {
35+
files: await openAsBlob("./sample-file"),
36+
chunkingStrategy: ChunkingStrategy.Basic,
37+
splitPdfPageRange: [
38+
1,
39+
10,
40+
],
41+
strategy: Strategy.HiRes,
42+
},
43+
});
44+
45+
switch (true) {
46+
case res.ok:
47+
// The success case will be handled outside of the switch block
48+
break;
49+
case res.error instanceof SDKValidationError:
50+
// Pretty-print validation errors.
51+
return console.log(res.error.pretty());
52+
case res.error instanceof Error:
53+
return console.log(res.error);
54+
default:
55+
// TypeScript's type checking will fail on the following line if the above
56+
// cases were not exhaustive.
57+
res.error satisfies never;
58+
throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
59+
}
60+
61+
62+
const { value: result } = res;
63+
64+
// Handle the result
65+
console.log(result)
66+
}
67+
68+
run();
69+
```
70+
71+
## Result types
72+
73+
Standalone functions differ from SDK methods in that they return a
74+
`Result<Value, Error>` type to capture _known errors_ and document them using
75+
the type system. By avoiding throwing errors, application code maintains clear
76+
control flow and error-handling become part of the regular flow of application
77+
code.
78+
79+
> We use the term "known errors" because standalone functions, and JavaScript
80+
> code in general, can still throw unexpected errors such as `TypeError`s,
81+
> `RangeError`s and `DOMException`s. Exhaustively catching all errors may be
82+
> something this SDK addresses in the future. Nevertheless, there is still a lot
83+
> of benefit from capturing most errors and turning them into values.
84+
85+
The second reason for this style of programming is because these functions will
86+
typically be used in front-end applications where exception throwing is
87+
sometimes discouraged or considered unidiomatic. React and similar ecosystems
88+
and libraries tend to promote this style of programming so that components
89+
render useful content under all states (loading, success, error and so on).
90+
91+
The general pattern when calling standalone functions looks like this:
92+
93+
```typescript
94+
import { Core } from "<sdk-package-name>";
95+
import { fetchSomething } from "<sdk-package-name>/funcs/fetchSomething.js";
96+
97+
const client = new Core();
98+
99+
async function run() {
100+
const result = await fetchSomething(client, { id: "123" });
101+
if (!result.ok) {
102+
// You can throw the error or handle it. It's your choice now.
103+
throw result.error;
104+
}
105+
106+
console.log(result.value);
107+
}
108+
109+
run();
110+
```
111+
112+
Notably, `result.error` above will have an explicit type compared to a try-catch
113+
variation where the error in the catch block can only be of type `unknown` (or
114+
`any` depending on your TypeScript settings).

β€ŽREADME.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,56 @@ client.general.partition({
260260
}};
261261
```
262262
263+
<!-- Start Summary [summary] -->
264+
## Summary
265+
266+
267+
<!-- End Summary [summary] -->
268+
269+
<!-- Start Table of Contents [toc] -->
270+
## Table of Contents
271+
272+
* [SDK Installation](#sdk-installation)
273+
* [Requirements](#requirements)
274+
* [SDK Example Usage](#sdk-example-usage)
275+
* [Available Resources and Operations](#available-resources-and-operations)
276+
* [Standalone functions](#standalone-functions)
277+
* [File uploads](#file-uploads)
278+
* [Retries](#retries)
279+
* [Error Handling](#error-handling)
280+
* [Server Selection](#server-selection)
281+
* [Custom HTTP Client](#custom-http-client)
282+
* [Authentication](#authentication)
283+
* [Debugging](#debugging)
284+
<!-- End Table of Contents [toc] -->
285+
263286
<!-- Start Requirements [requirements] -->
264287
## Requirements
265288
266289
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
267290
<!-- End Requirements [requirements] -->
268291
292+
<!-- Start Standalone functions [standalone-funcs] -->
293+
## Standalone functions
294+
295+
All the methods listed above are available as standalone functions. These
296+
functions are ideal for use in applications running in the browser, serverless
297+
runtimes or other environments where application bundle size is a primary
298+
concern. When using a bundler to build your application, all unused
299+
functionality will be either excluded from the final bundle or tree-shaken away.
300+
301+
To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
302+
303+
<details>
304+
305+
<summary>Available standalone functions</summary>
306+
307+
- [generalPartition](docs/sdks/general/README.md#partition)
308+
309+
310+
</details>
311+
<!-- End Standalone functions [standalone-funcs] -->
312+
269313
<!-- Start File uploads [file-upload] -->
270314
## File uploads
271315
@@ -315,7 +359,9 @@ run();
315359
<!-- Start Debugging [debug] -->
316360
## Debugging
317361
318-
To log HTTP requests and responses, you can pass a logger that matches `console`'s interface as an SDK option.
362+
You can setup your SDK to emit debug logs for SDK requests and responses.
363+
364+
You can pass a logger that matches `console`'s interface as an SDK option.
319365
320366
> [!WARNING]
321367
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.

β€ŽRELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,4 +434,14 @@ Based on:
434434
### Generated
435435
- [typescript v0.15.1] .
436436
### Releases
437-
- [NPM v0.15.1] https://www.npmjs.com/package/unstructured-client/v/0.15.1 - .
437+
- [NPM v0.15.1] https://www.npmjs.com/package/unstructured-client/v/0.15.1 - .
438+
439+
## 2024-09-06 00:26:09
440+
### Changes
441+
Based on:
442+
- OpenAPI Doc
443+
- Speakeasy CLI 1.390.7 (2.409.8) https://github.com/speakeasy-api/speakeasy
444+
### Generated
445+
- [typescript v0.16.0] .
446+
### Releases
447+
- [NPM v0.16.0] https://www.npmjs.com/package/unstructured-client/v/0.16.0 - .

β€ŽcodeSamples.yaml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,4 @@ actions:
88
x-codeSamples:
99
- lang: typescript
1010
label: partition
11-
source: |-
12-
import { openAsBlob } from "node:fs";
13-
import { UnstructuredClient } from "unstructured-client";
14-
import { ChunkingStrategy, Strategy } from "unstructured-client/sdk/models/shared";
15-
16-
const unstructuredClient = new UnstructuredClient();
17-
18-
async function run() {
19-
const result = await unstructuredClient.general.partition({
20-
partitionParameters: {
21-
files: await openAsBlob("./sample-file"),
22-
strategy: Strategy.Auto,
23-
chunkingStrategy: ChunkingStrategy.Basic,
24-
splitPdfPageRange: [
25-
1,
26-
10,
27-
],
28-
},
29-
});
30-
31-
// Handle the result
32-
console.log(result)
33-
}
34-
35-
run();
11+
source: "import { openAsBlob } from \"node:fs\";\nimport { UnstructuredClient } from \"unstructured-client\";\nimport { ChunkingStrategy, Strategy } from \"unstructured-client/sdk/models/shared\";\n\nconst unstructuredClient = new UnstructuredClient();\n\nasync function run() {\n const result = await unstructuredClient.general.partition({\n partitionParameters: {\n files: await openAsBlob(\"./sample-file\"),\n strategy: Strategy.Auto,\n chunkingStrategy: ChunkingStrategy.Basic,\n splitPdfPageRange: [\n 1,\n 10,\n ],\n },\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"

β€Ždocs/sdk/models/errors/detail.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Detail
22

3+
## Example Usage
4+
5+
```typescript
6+
import { Detail } from "unstructured-client/sdk/models/errors";
7+
8+
let value: Detail = "<value>";
9+
```
310

411
## Supported Types
512

β€Ždocs/sdk/models/errors/httpvalidationerror.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# HTTPValidationError
22

3+
## Example Usage
4+
5+
```typescript
6+
import { HTTPValidationError } from "unstructured-client/sdk/models/errors";
7+
8+
// No examples available for this model
9+
```
310

411
## Fields
512

β€Ždocs/sdk/models/errors/servererror.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# ServerError
22

3+
## Example Usage
4+
5+
```typescript
6+
import { ServerError } from "unstructured-client/sdk/models/errors";
7+
8+
// No examples available for this model
9+
```
310

411
## Fields
512

β€Ždocs/sdk/models/operations/partitionrequest.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# PartitionRequest
22

3+
## Example Usage
4+
5+
```typescript
6+
import { PartitionRequest } from "unstructured-client/sdk/models/operations";
7+
8+
// No examples available for this model
9+
```
310

411
## Fields
512

0 commit comments

Comments
Β (0)