diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ed840a4c..e3668cf5 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: f42cb8e6-e2ce-4565-b975-5a9f38b94d5a management: - docChecksum: 2e7f129641ad96d49fcda2ceb173d43c - docVersion: 1.0.81 - speakeasyVersion: 1.519.0 - generationVersion: 2.552.1 - releaseVersion: 0.23.0 - configChecksum: 86d5f752c6378b160f1e0a2fb1b0cea7 + docChecksum: 836a71c214bbd252ed63f3ce3ba6b20f + docVersion: 1.1.4 + speakeasyVersion: 1.526.0 + generationVersion: 2.563.0 + releaseVersion: 0.24.0 + configChecksum: bf57ed240e6647b8f46d61e7a668981f repoURL: https://github.com/Unstructured-IO/unstructured-js-client.git repoSubDirectory: . installationURL: https://github.com/Unstructured-IO/unstructured-js-client @@ -24,7 +24,7 @@ features: globalSecurity: 2.82.13 globalSecurityCallbacks: 0.1.0 globalServerURLs: 2.82.4 - mcpServer: 0.8.0 + mcpServer: 0.9.0 nameOverrides: 2.81.2 nullables: 0.1.1 openEnums: 0.1.1 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index b157ab42..76a36d76 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,20 +1,21 @@ -speakeasyVersion: 1.519.0 +speakeasyVersion: 1.526.0 sources: my-source: sourceNamespace: my-source - sourceRevisionDigest: sha256:acb76c58ac398f0d1ea1f9eef8df422c40d5a237c7cf020522258b327792a68d - sourceBlobDigest: sha256:822e38da0c61b9aeaa5446413a6cec058a464920a02d20d9ee7955c827446050 + sourceRevisionDigest: sha256:48993802cc67795e3789ee890eef5fe1c982a2b35e88e24945abe11831725e11 + sourceBlobDigest: sha256:a010b23fbfe96d4c7f91bffa6d9247d90e8e0f499e7b99f81f0d30af125517cf tags: - latest - - 1.0.81 + - speakeasy-sdk-regen-1743121795 + - 1.1.4 targets: unstructed-typescript: source: my-source sourceNamespace: my-source - sourceRevisionDigest: sha256:acb76c58ac398f0d1ea1f9eef8df422c40d5a237c7cf020522258b327792a68d - sourceBlobDigest: sha256:822e38da0c61b9aeaa5446413a6cec058a464920a02d20d9ee7955c827446050 + sourceRevisionDigest: sha256:48993802cc67795e3789ee890eef5fe1c982a2b35e88e24945abe11831725e11 + sourceBlobDigest: sha256:a010b23fbfe96d4c7f91bffa6d9247d90e8e0f499e7b99f81f0d30af125517cf codeSamplesNamespace: my-source-typescript-code-samples - codeSamplesRevisionDigest: sha256:bc9b9485931a5f01bce3a872cdba2295e5aa3e155f52890568c3e8b18c9fd66d + codeSamplesRevisionDigest: sha256:088b6af4d3d80368306b838d59c11f499eea3ec8fa83c000175d551671195cb5 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md index 93061f67..2ac24c90 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -554,4 +554,14 @@ Based on: ### Generated - [typescript v0.22.0] . ### Releases -- [NPM v0.22.0] https://www.npmjs.com/package/unstructured-client/v/0.22.0 - . \ No newline at end of file +- [NPM v0.22.0] https://www.npmjs.com/package/unstructured-client/v/0.22.0 - . + +## 2025-03-31 00:31:49 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.526.0 (2.563.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.24.0] . +### Releases +- [NPM v0.24.0] https://www.npmjs.com/package/unstructured-client/v/0.24.0 - . \ No newline at end of file diff --git a/docs/sdk/models/shared/partitionparameters.md b/docs/sdk/models/shared/partitionparameters.md index c1d58125..ff6152d5 100644 --- a/docs/sdk/models/shared/partitionparameters.md +++ b/docs/sdk/models/shared/partitionparameters.md @@ -33,6 +33,10 @@ import { PartitionParameters } from "unstructured-client/sdk/models/shared"; | `overlap` | *number* | :heavy_minus_sign: | Specifies the length of a string ('tail') to be drawn from each chunk and prefixed to the next chunk as a context-preserving mechanism. By default, this only applies to split-chunks where an oversized element is divided into multiple chunks by text-splitting. Default: 0 | | | `overlapAll` | *boolean* | :heavy_minus_sign: | When `True`, apply overlap between 'normal' chunks formed from whole elements and not subject to text-splitting. Use this with caution as it entails a certain level of 'pollution' of otherwise clean semantic chunk boundaries. Default: False | | | `pdfInferTableStructure` | *boolean* | :heavy_minus_sign: | Deprecated! Use skip_infer_table_types to opt out of table extraction for any file type. If False and strategy=hi_res, no Table Elements will be extracted from pdf files regardless of skip_infer_table_types contents. | | +| `pdfminerCharMargin` | *number* | :heavy_minus_sign: | If two characters are closer together than this margin they are considered part of the same line. The margin is specified relative to the width of the character. | | +| `pdfminerLineMargin` | *number* | :heavy_minus_sign: | If two lines are close together they are considered to be part of the same paragraph. The margin is specified relative to the height of a line. | | +| `pdfminerLineOverlap` | *number* | :heavy_minus_sign: | If two characters have more overlap than this they are considered to be on the same line. The overlap is specified relative to the minimum height of both characters. | | +| `pdfminerWordMargin` | *number* | :heavy_minus_sign: | If two characters on the same line are further apart than this margin then they are considered to be two separate words, and an intermediate space will be added for readability. The margin is specified relative to the width of the character. | | | `similarityThreshold` | *number* | :heavy_minus_sign: | A value between 0.0 and 1.0 describing the minimum similarity two elements must have to be included in the same chunk. Note that similar elements may be separated to meet chunk-size criteria; this value can only guarantees that two elements with similarity below the threshold will appear in separate chunks. | | | `skipInferTableTypes` | *string*[] | :heavy_minus_sign: | The document types that you want to skip table extraction with. Default: [] | | | `splitPdfAllowFailed` | *boolean* | :heavy_minus_sign: | When `split_pdf_page` is set to `True`, this parameter defines the behavior when some of the parallel requests fail. By default `split_pdf_allow_failed` is set to `False` and any failed request send to the API will make the whole process break and raise an Exception. If `split_pdf_allow_failed` is set to `True`, the errors encountered while sending parallel requests will not break the processing - the resuling list of Elements will miss the data from errored pages. | | diff --git a/gen.yaml b/gen.yaml index 2e058e5a..17271ba8 100644 --- a/gen.yaml +++ b/gen.yaml @@ -12,7 +12,7 @@ generation: oAuth2ClientCredentialsEnabled: false oAuth2PasswordEnabled: false typescript: - version: 0.23.0 + version: 0.24.0 additionalDependencies: dependencies: async: ^3.2.5 diff --git a/jsr.json b/jsr.json index 58f0eb21..5791dc6b 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "unstructured-client", - "version": "0.23.0", + "version": "0.24.0", "exports": { ".": "./src/index.ts", "./sdk/models/errors": "./src/sdk/models/errors/index.ts", diff --git a/package-lock.json b/package-lock.json index 478bc99b..b7e04085 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "unstructured-client", - "version": "0.23.0", + "version": "0.24.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "unstructured-client", - "version": "0.23.0", + "version": "0.24.0", "dependencies": { "async": "^3.2.5", "pdf-lib": "^1.17.1" diff --git a/package.json b/package.json index a9ab0b50..f8c91619 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unstructured-client", - "version": "0.23.0", + "version": "0.24.0", "author": "Unstructured", "type": "module", "bin": { diff --git a/src/funcs/generalPartition.ts b/src/funcs/generalPartition.ts index 60ce04cb..75961644 100644 --- a/src/funcs/generalPartition.ts +++ b/src/funcs/generalPartition.ts @@ -229,6 +229,34 @@ async function $do( payload.partition_parameters.pdf_infer_table_structure, ); } + if (payload.partition_parameters.pdfminer_char_margin !== undefined) { + appendForm( + body, + "pdfminer_char_margin", + payload.partition_parameters.pdfminer_char_margin, + ); + } + if (payload.partition_parameters.pdfminer_line_margin !== undefined) { + appendForm( + body, + "pdfminer_line_margin", + payload.partition_parameters.pdfminer_line_margin, + ); + } + if (payload.partition_parameters.pdfminer_line_overlap !== undefined) { + appendForm( + body, + "pdfminer_line_overlap", + payload.partition_parameters.pdfminer_line_overlap, + ); + } + if (payload.partition_parameters.pdfminer_word_margin !== undefined) { + appendForm( + body, + "pdfminer_word_margin", + payload.partition_parameters.pdfminer_word_margin, + ); + } if (payload.partition_parameters.similarity_threshold !== undefined) { appendForm( body, diff --git a/src/hooks/types.ts b/src/hooks/types.ts index f34898c0..1d56c6f2 100644 --- a/src/hooks/types.ts +++ b/src/hooks/types.ts @@ -9,7 +9,7 @@ import { SecurityState } from "../lib/security.js"; export type HookContext = { baseURL: string | URL; operationID: string; - oAuth2Scopes?: string[]; + oAuth2Scopes: string[] | null; securitySource?: any | (() => Promise); retryConfig: RetryConfig; resolvedSecurity: SecurityState | null; diff --git a/src/lib/config.ts b/src/lib/config.ts index 1c13f7dd..c6e7af04 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -68,9 +68,9 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", - openapiDocVersion: "1.0.81", - sdkVersion: "0.23.0", - genVersion: "2.552.1", + openapiDocVersion: "1.1.4", + sdkVersion: "0.24.0", + genVersion: "2.563.0", userAgent: - "speakeasy-sdk/typescript 0.23.0 2.552.1 1.0.81 unstructured-client", + "speakeasy-sdk/typescript 0.24.0 2.563.0 1.1.4 unstructured-client", } as const; diff --git a/src/lib/security.ts b/src/lib/security.ts index e069ce42..68fc1337 100644 --- a/src/lib/security.ts +++ b/src/lib/security.ts @@ -3,6 +3,7 @@ */ import * as shared from "../sdk/models/shared/index.js"; + type OAuth2PasswordFlow = { username: string; password?: string | undefined; @@ -84,7 +85,9 @@ type SecurityInputOAuth2ClientCredentials = { value: | { clientID?: string | undefined; clientSecret?: string | undefined } | null + | string | undefined; + fieldName?: string; }; type SecurityInputOAuth2PasswordCredentials = { @@ -93,13 +96,13 @@ type SecurityInputOAuth2PasswordCredentials = { | string | null | undefined; - fieldName: string; + fieldName?: string; }; type SecurityInputCustom = { type: "http:custom"; value: any | null | undefined; - fieldName: string; + fieldName?: string; }; export type SecurityInput = @@ -136,6 +139,9 @@ export function resolveSecurity( typeof o.value === "string" && !!o.value ); } else if (o.type === "oauth2:client_credentials") { + if (typeof o.value == "string") { + return !!o.value; + } return o.value.clientID != null || o.value.clientSecret != null; } else if (typeof o.value === "string") { return !!o.value; @@ -224,7 +230,9 @@ function applyBearer( value = `Bearer ${value}`; } - state.headers[spec.fieldName] = value; + if (spec.fieldName !== undefined) { + state.headers[spec.fieldName] = value; + } } export function resolveGlobalSecurity( diff --git a/src/mcp-server/mcp-server.ts b/src/mcp-server/mcp-server.ts index d2236a4f..d0c171aa 100644 --- a/src/mcp-server/mcp-server.ts +++ b/src/mcp-server/mcp-server.ts @@ -19,7 +19,7 @@ const routes = buildRouteMap({ export const app = buildApplication(routes, { name: "mcp", versionInfo: { - currentVersion: "0.23.0", + currentVersion: "0.24.0", }, }); diff --git a/src/mcp-server/server.ts b/src/mcp-server/server.ts index 00e43119..30cbb4c7 100644 --- a/src/mcp-server/server.ts +++ b/src/mcp-server/server.ts @@ -27,7 +27,7 @@ export function createMCPServer(deps: { }) { const server = new McpServer({ name: "UnstructuredClient", - version: "0.23.0", + version: "0.24.0", }); const client = new UnstructuredClientCore({ diff --git a/src/sdk/models/shared/partitionparameters.ts b/src/sdk/models/shared/partitionparameters.ts index 16b40fce..dedb8dd6 100644 --- a/src/sdk/models/shared/partitionparameters.ts +++ b/src/sdk/models/shared/partitionparameters.ts @@ -175,6 +175,22 @@ export type PartitionParameters = { * Deprecated! Use skip_infer_table_types to opt out of table extraction for any file type. If False and strategy=hi_res, no Table Elements will be extracted from pdf files regardless of skip_infer_table_types contents. */ pdfInferTableStructure?: boolean | undefined; + /** + * If two characters are closer together than this margin they are considered part of the same line. The margin is specified relative to the width of the character. + */ + pdfminerCharMargin?: number | null | undefined; + /** + * If two lines are close together they are considered to be part of the same paragraph. The margin is specified relative to the height of a line. + */ + pdfminerLineMargin?: number | null | undefined; + /** + * If two characters have more overlap than this they are considered to be on the same line. The overlap is specified relative to the minimum height of both characters. + */ + pdfminerLineOverlap?: number | null | undefined; + /** + * If two characters on the same line are further apart than this margin then they are considered to be two separate words, and an intermediate space will be added for readability. The margin is specified relative to the width of the character. + */ + pdfminerWordMargin?: number | null | undefined; /** * A value between 0.0 and 1.0 describing the minimum similarity two elements must have to be included in the same chunk. Note that similar elements may be separated to meet chunk-size criteria; this value can only guarantees that two elements with similarity below the threshold will appear in separate chunks. */ @@ -446,6 +462,10 @@ export const PartitionParameters$inboundSchema: z.ZodType< overlap: z.number().int().default(0), overlap_all: z.boolean().default(false), pdf_infer_table_structure: z.boolean().default(true), + pdfminer_char_margin: z.nullable(z.number()).optional(), + pdfminer_line_margin: z.nullable(z.number()).optional(), + pdfminer_line_overlap: z.nullable(z.number()).optional(), + pdfminer_word_margin: z.nullable(z.number()).optional(), similarity_threshold: z.nullable(z.number()).optional(), skip_infer_table_types: z.array(z.string()).optional(), split_pdf_allow_failed: z.boolean().default(false), @@ -477,6 +497,10 @@ export const PartitionParameters$inboundSchema: z.ZodType< "output_format": "outputFormat", "overlap_all": "overlapAll", "pdf_infer_table_structure": "pdfInferTableStructure", + "pdfminer_char_margin": "pdfminerCharMargin", + "pdfminer_line_margin": "pdfminerLineMargin", + "pdfminer_line_overlap": "pdfminerLineOverlap", + "pdfminer_word_margin": "pdfminerWordMargin", "similarity_threshold": "similarityThreshold", "skip_infer_table_types": "skipInferTableTypes", "split_pdf_allow_failed": "splitPdfAllowFailed", @@ -515,6 +539,10 @@ export type PartitionParameters$Outbound = { overlap: number; overlap_all: boolean; pdf_infer_table_structure: boolean; + pdfminer_char_margin?: number | null | undefined; + pdfminer_line_margin?: number | null | undefined; + pdfminer_line_overlap?: number | null | undefined; + pdfminer_word_margin?: number | null | undefined; similarity_threshold?: number | null | undefined; skip_infer_table_types?: Array | undefined; split_pdf_allow_failed: boolean; @@ -559,6 +587,10 @@ export const PartitionParameters$outboundSchema: z.ZodType< overlap: z.number().int().default(0), overlapAll: z.boolean().default(false), pdfInferTableStructure: z.boolean().default(true), + pdfminerCharMargin: z.nullable(z.number()).optional(), + pdfminerLineMargin: z.nullable(z.number()).optional(), + pdfminerLineOverlap: z.nullable(z.number()).optional(), + pdfminerWordMargin: z.nullable(z.number()).optional(), similarityThreshold: z.nullable(z.number()).optional(), skipInferTableTypes: z.array(z.string()).optional(), splitPdfAllowFailed: z.boolean().default(false), @@ -590,6 +622,10 @@ export const PartitionParameters$outboundSchema: z.ZodType< outputFormat: "output_format", overlapAll: "overlap_all", pdfInferTableStructure: "pdf_infer_table_structure", + pdfminerCharMargin: "pdfminer_char_margin", + pdfminerLineMargin: "pdfminer_line_margin", + pdfminerLineOverlap: "pdfminer_line_overlap", + pdfminerWordMargin: "pdfminer_word_margin", similarityThreshold: "similarity_threshold", skipInferTableTypes: "skip_infer_table_types", splitPdfAllowFailed: "split_pdf_allow_failed",