@anyformat/sdk 1.0.0 → 1.2.0

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/dist/index.d.cts CHANGED
@@ -2023,6 +2023,12 @@ type SplitPartition = {
2023
2023
  * Files
2024
2024
  */
2025
2025
  files: Array<FilePages>;
2026
+ /**
2027
+ * Id
2028
+ *
2029
+ * The partition's UUID. Pass it to `GET /v3/splits/{split_id}/pdf/` to download these pages as a PDF.
2030
+ */
2031
+ id: string;
2026
2032
  /**
2027
2033
  * Name
2028
2034
  *
@@ -2050,6 +2056,12 @@ type SplitResult = {
2050
2056
  * Per-file page lists, union of all partitions.
2051
2057
  */
2052
2058
  files: Array<FilePages>;
2059
+ /**
2060
+ * Id
2061
+ *
2062
+ * The split's UUID, for `GET /v3/splits/{split_id}/pdf/`. `null` when the splitter partitions this category, because the category is then several sub-documents and no single one of them: download each `partitions[].id` instead.
2063
+ */
2064
+ id?: string | null;
2053
2065
  /**
2054
2066
  * Name
2055
2067
  *
@@ -2875,6 +2887,17 @@ declare class Anyformat {
2875
2887
  iterRuns(workflowId: string, opts?: IterOptions): AsyncIterableIterator<RunSummaryV3>;
2876
2888
  /** Retrieve one run: lifecycle status plus results inline once `processed`. */
2877
2889
  getRun(runId: string): Promise<RunDetailV3>;
2890
+ /**
2891
+ * Download one split's pages as a PDF.
2892
+ *
2893
+ * Take `splitId` from a run's `results.splits[].id`, or from
2894
+ * `results.splits[].partitions[].id` when the splitter partitions that
2895
+ * category (the category's own `id` is then `null`, because it is several
2896
+ * sub-documents and no single one of them).
2897
+ *
2898
+ * The document is built when you ask for it and never stored.
2899
+ */
2900
+ downloadSplitPdf(splitId: string): Promise<Blob>;
2878
2901
  /**
2879
2902
  * Parse a document with the platform's atomic parse operation (fast lite
2880
2903
  * parse). Returns the run id; poll `getParseMarkdown(runId)` for the parsed
@@ -2965,4 +2988,4 @@ declare class ExtractionCancelledError extends RunFailedError {
2965
2988
  declare class WorkflowBuilderError extends AnyformatError {
2966
2989
  }
2967
2990
 
2968
- export { APIError, type AllOfCheck, type AnyOfCheck, Anyformat, AnyformatError, type AnyformatOptions, type ArithmeticCheck, BadRequestError, type Block, type BooleanField, type Branch, type ClassifyCategory, type ComparisonCheck, type DatasetDocument, DatasetUpload, type DatasetUploadFileV3, type DatasetUploadOptions, type DatasetUploadResponseV3, type DateCheck, type DateField, type DatetimeField, type DocumentPacketDetailV3, type DocumentPacketFileV3, type DocumentPacketStatus, type DocumentPacketSummaryV3, type Edge, type EnumField, type EnumOption, type ExpressionCheck, type ExtractedField, type ExtractedRows, type Extraction, ExtractionCancelledError, ExtractionFailedError, type ExtractionSchema, type Field, type FloatField, ForbiddenError, InsufficientScopeError, type IntegerField, type IterOptions, type JsonValue, type ListOptions, type MultiSelectField, type NestedField, NotFoundError, type ObjectField, type OneOfCheck, type Page, type ParseResult, ParseView, PaymentRequiredError, type RangeCheck, RateLimitedError, type RegexCheck, type RequiredCheck, Result, type ResultsResponseV3, Run, type RunDetailV3, RunFailedError, type RunStatus, type RunSummaryV3, type RunTriggerOptions, SDKTimeoutError, type ScalarOrList, Schema, ServerError, type SplitterRule, type StringField, TermsAcceptanceRequiredError, UnauthorizedError, Upload, type UploadFromUrlsOptions, type UploadOptions, type ValidationItem, type ValidationRule, type WaitOptions, Workflow, WorkflowBuilder, WorkflowBuilderError, type WorkflowCreateRequest, type WorkflowDefinition, type WorkflowDetailV3, WorkflowNameConflictError, type WorkflowSummaryV3 };
2991
+ export { APIError, type AllOfCheck, type AnyOfCheck, Anyformat, AnyformatError, type AnyformatOptions, type ArithmeticCheck, BadRequestError, type Block, type BooleanField, type Branch, type ClassifyCategory, type ComparisonCheck, type DatasetDocument, DatasetUpload, type DatasetUploadFileV3, type DatasetUploadOptions, type DatasetUploadResponseV3, type DateCheck, type DateField, type DatetimeField, type DocumentPacketDetailV3, type DocumentPacketFileV3, type DocumentPacketStatus, type DocumentPacketSummaryV3, type Edge, type EnumField, type EnumOption, type ExpressionCheck, type ExtractedField, type ExtractedRows, type Extraction, ExtractionCancelledError, ExtractionFailedError, type ExtractionSchema, type Field, type FloatField, ForbiddenError, InsufficientScopeError, type IntegerField, type IterOptions, type JsonValue, type ListOptions, type MultiSelectField, type NestedField, NotFoundError, type ObjectField, type OneOfCheck, type Page, type ParseResult, ParseView, PaymentRequiredError, type RangeCheck, RateLimitedError, type RegexCheck, type RequiredCheck, Result, type ResultsResponseV3, Run, type RunDetailV3, RunFailedError, type RunStatus, type RunSummaryV3, type RunTriggerOptions, SDKTimeoutError, type ScalarOrList, Schema, ServerError, type SplitPartition, type SplitResult, type SplitterRule, type StringField, TermsAcceptanceRequiredError, UnauthorizedError, Upload, type UploadFromUrlsOptions, type UploadOptions, type ValidationItem, type ValidationRule, type WaitOptions, Workflow, WorkflowBuilder, WorkflowBuilderError, type WorkflowCreateRequest, type WorkflowDefinition, type WorkflowDetailV3, WorkflowNameConflictError, type WorkflowSummaryV3 };
package/dist/index.d.ts CHANGED
@@ -2023,6 +2023,12 @@ type SplitPartition = {
2023
2023
  * Files
2024
2024
  */
2025
2025
  files: Array<FilePages>;
2026
+ /**
2027
+ * Id
2028
+ *
2029
+ * The partition's UUID. Pass it to `GET /v3/splits/{split_id}/pdf/` to download these pages as a PDF.
2030
+ */
2031
+ id: string;
2026
2032
  /**
2027
2033
  * Name
2028
2034
  *
@@ -2050,6 +2056,12 @@ type SplitResult = {
2050
2056
  * Per-file page lists, union of all partitions.
2051
2057
  */
2052
2058
  files: Array<FilePages>;
2059
+ /**
2060
+ * Id
2061
+ *
2062
+ * The split's UUID, for `GET /v3/splits/{split_id}/pdf/`. `null` when the splitter partitions this category, because the category is then several sub-documents and no single one of them: download each `partitions[].id` instead.
2063
+ */
2064
+ id?: string | null;
2053
2065
  /**
2054
2066
  * Name
2055
2067
  *
@@ -2875,6 +2887,17 @@ declare class Anyformat {
2875
2887
  iterRuns(workflowId: string, opts?: IterOptions): AsyncIterableIterator<RunSummaryV3>;
2876
2888
  /** Retrieve one run: lifecycle status plus results inline once `processed`. */
2877
2889
  getRun(runId: string): Promise<RunDetailV3>;
2890
+ /**
2891
+ * Download one split's pages as a PDF.
2892
+ *
2893
+ * Take `splitId` from a run's `results.splits[].id`, or from
2894
+ * `results.splits[].partitions[].id` when the splitter partitions that
2895
+ * category (the category's own `id` is then `null`, because it is several
2896
+ * sub-documents and no single one of them).
2897
+ *
2898
+ * The document is built when you ask for it and never stored.
2899
+ */
2900
+ downloadSplitPdf(splitId: string): Promise<Blob>;
2878
2901
  /**
2879
2902
  * Parse a document with the platform's atomic parse operation (fast lite
2880
2903
  * parse). Returns the run id; poll `getParseMarkdown(runId)` for the parsed
@@ -2965,4 +2988,4 @@ declare class ExtractionCancelledError extends RunFailedError {
2965
2988
  declare class WorkflowBuilderError extends AnyformatError {
2966
2989
  }
2967
2990
 
2968
- export { APIError, type AllOfCheck, type AnyOfCheck, Anyformat, AnyformatError, type AnyformatOptions, type ArithmeticCheck, BadRequestError, type Block, type BooleanField, type Branch, type ClassifyCategory, type ComparisonCheck, type DatasetDocument, DatasetUpload, type DatasetUploadFileV3, type DatasetUploadOptions, type DatasetUploadResponseV3, type DateCheck, type DateField, type DatetimeField, type DocumentPacketDetailV3, type DocumentPacketFileV3, type DocumentPacketStatus, type DocumentPacketSummaryV3, type Edge, type EnumField, type EnumOption, type ExpressionCheck, type ExtractedField, type ExtractedRows, type Extraction, ExtractionCancelledError, ExtractionFailedError, type ExtractionSchema, type Field, type FloatField, ForbiddenError, InsufficientScopeError, type IntegerField, type IterOptions, type JsonValue, type ListOptions, type MultiSelectField, type NestedField, NotFoundError, type ObjectField, type OneOfCheck, type Page, type ParseResult, ParseView, PaymentRequiredError, type RangeCheck, RateLimitedError, type RegexCheck, type RequiredCheck, Result, type ResultsResponseV3, Run, type RunDetailV3, RunFailedError, type RunStatus, type RunSummaryV3, type RunTriggerOptions, SDKTimeoutError, type ScalarOrList, Schema, ServerError, type SplitterRule, type StringField, TermsAcceptanceRequiredError, UnauthorizedError, Upload, type UploadFromUrlsOptions, type UploadOptions, type ValidationItem, type ValidationRule, type WaitOptions, Workflow, WorkflowBuilder, WorkflowBuilderError, type WorkflowCreateRequest, type WorkflowDefinition, type WorkflowDetailV3, WorkflowNameConflictError, type WorkflowSummaryV3 };
2991
+ export { APIError, type AllOfCheck, type AnyOfCheck, Anyformat, AnyformatError, type AnyformatOptions, type ArithmeticCheck, BadRequestError, type Block, type BooleanField, type Branch, type ClassifyCategory, type ComparisonCheck, type DatasetDocument, DatasetUpload, type DatasetUploadFileV3, type DatasetUploadOptions, type DatasetUploadResponseV3, type DateCheck, type DateField, type DatetimeField, type DocumentPacketDetailV3, type DocumentPacketFileV3, type DocumentPacketStatus, type DocumentPacketSummaryV3, type Edge, type EnumField, type EnumOption, type ExpressionCheck, type ExtractedField, type ExtractedRows, type Extraction, ExtractionCancelledError, ExtractionFailedError, type ExtractionSchema, type Field, type FloatField, ForbiddenError, InsufficientScopeError, type IntegerField, type IterOptions, type JsonValue, type ListOptions, type MultiSelectField, type NestedField, NotFoundError, type ObjectField, type OneOfCheck, type Page, type ParseResult, ParseView, PaymentRequiredError, type RangeCheck, RateLimitedError, type RegexCheck, type RequiredCheck, Result, type ResultsResponseV3, Run, type RunDetailV3, RunFailedError, type RunStatus, type RunSummaryV3, type RunTriggerOptions, SDKTimeoutError, type ScalarOrList, Schema, ServerError, type SplitPartition, type SplitResult, type SplitterRule, type StringField, TermsAcceptanceRequiredError, UnauthorizedError, Upload, type UploadFromUrlsOptions, type UploadOptions, type ValidationItem, type ValidationRule, type WaitOptions, Workflow, WorkflowBuilder, WorkflowBuilderError, type WorkflowCreateRequest, type WorkflowDefinition, type WorkflowDetailV3, WorkflowNameConflictError, type WorkflowSummaryV3 };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@anyformat/sdk",
4
- version: "1.0.0",
4
+ version: "1.2.0",
5
5
  description: "TypeScript SDK for the AnyFormat API",
6
6
  license: "MIT",
7
7
  author: "Anyformat <info@anyformat.ai>",
@@ -1089,6 +1089,11 @@ var v3GetRun = (options) => (options.client ?? client).get({
1089
1089
  url: "/v3/runs/{run_id}/",
1090
1090
  ...options
1091
1091
  });
1092
+ var v3DownloadSplitPdf = (options) => (options.client ?? client).get({
1093
+ security: [{ scheme: "bearer", type: "http" }],
1094
+ url: "/v3/splits/{split_id}/pdf/",
1095
+ ...options
1096
+ });
1092
1097
  var v3ListWorkflows = (options) => (options?.client ?? client).get({
1093
1098
  security: [{ scheme: "bearer", type: "http" }],
1094
1099
  url: "/v3/workflows/",
@@ -1742,6 +1747,21 @@ var Anyformat = class {
1742
1747
  if (res.error) throw toApiError(res.response?.status ?? 500, res.error, res.response?.headers);
1743
1748
  return res.data;
1744
1749
  }
1750
+ /**
1751
+ * Download one split's pages as a PDF.
1752
+ *
1753
+ * Take `splitId` from a run's `results.splits[].id`, or from
1754
+ * `results.splits[].partitions[].id` when the splitter partitions that
1755
+ * category (the category's own `id` is then `null`, because it is several
1756
+ * sub-documents and no single one of them).
1757
+ *
1758
+ * The document is built when you ask for it and never stored.
1759
+ */
1760
+ async downloadSplitPdf(splitId) {
1761
+ const res = await v3DownloadSplitPdf({ client: this._client, path: { split_id: splitId } });
1762
+ if (res.error) throw toApiError(res.response?.status ?? 500, res.error, res.response?.headers);
1763
+ return res.data;
1764
+ }
1745
1765
  /**
1746
1766
  * Parse a document with the platform's atomic parse operation (fast lite
1747
1767
  * parse). Returns the run id; poll `getParseMarkdown(runId)` for the parsed