@xberg-io/sdk 0.6.0 → 0.7.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/README.md +4 -5
- package/dist/index.d.ts +15 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,9 +48,8 @@ pnpm add @xberg-io/sdk
|
|
|
48
48
|
|
|
49
49
|
## Targets
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
`
|
|
53
|
-
`target: "pro"` with an explicit `baseUrl`:
|
|
51
|
+
Both products are self-hosted, so `XbergClient` requires the deployment's
|
|
52
|
+
`baseUrl`. Pass `target: "pro"` when the target is already known:
|
|
54
53
|
|
|
55
54
|
```ts
|
|
56
55
|
import { XbergClient } from "@xberg-io/sdk";
|
|
@@ -68,7 +67,7 @@ or `login()` on Enterprise) throws a clear "not available on this tier" error.
|
|
|
68
67
|
import { XbergClient } from "@xberg-io/sdk";
|
|
69
68
|
import { readFile } from "node:fs/promises";
|
|
70
69
|
|
|
71
|
-
const client = new XbergClient({ apiKey: process.env.XBERG_API_KEY! });
|
|
70
|
+
const client = new XbergClient({ baseUrl: "https://xberg.example.com", apiKey: process.env.XBERG_API_KEY! });
|
|
72
71
|
|
|
73
72
|
const data = await readFile("invoice.pdf");
|
|
74
73
|
const result = await client.extractAndWait({
|
|
@@ -83,7 +82,7 @@ console.log(result.result?.content);
|
|
|
83
82
|
import { XbergClient } from "@xberg-io/sdk";
|
|
84
83
|
import { readFile } from "node:fs/promises";
|
|
85
84
|
|
|
86
|
-
const client = new XbergClient({ apiKey: process.env.XBERG_API_KEY! });
|
|
85
|
+
const client = new XbergClient({ baseUrl: "https://xberg.example.com", apiKey: process.env.XBERG_API_KEY! });
|
|
87
86
|
|
|
88
87
|
const files = await Promise.all(
|
|
89
88
|
["a.pdf", "b.pdf", "c.pdf"].map(async (name) => ({
|
package/dist/index.d.ts
CHANGED
|
@@ -5896,7 +5896,11 @@ interface components$1 {
|
|
|
5896
5896
|
OcrConfig: {
|
|
5897
5897
|
/** @description Automatic page rotation detection */
|
|
5898
5898
|
auto_rotate?: boolean | null;
|
|
5899
|
-
/**
|
|
5899
|
+
/**
|
|
5900
|
+
* @description OCR backend name. Must be one this deployment has compiled in and
|
|
5901
|
+
* registered; the accepted set is deployment-dependent and is rejected
|
|
5902
|
+
* with a 400 when not recognized.
|
|
5903
|
+
*/
|
|
5900
5904
|
backend?: string | null;
|
|
5901
5905
|
/** @description Structured OCR element extraction */
|
|
5902
5906
|
element_config?: components$1["schemas"]["OcrElementConfig"];
|
|
@@ -6028,7 +6032,11 @@ interface components$1 {
|
|
|
6028
6032
|
};
|
|
6029
6033
|
/** @description Single backend stage in the OCR pipeline. */
|
|
6030
6034
|
OcrPipelineStage: {
|
|
6031
|
-
/**
|
|
6035
|
+
/**
|
|
6036
|
+
* @description Backend name for this pipeline stage. Must be one this deployment has
|
|
6037
|
+
* compiled in and registered; the accepted set is deployment-dependent
|
|
6038
|
+
* and is rejected with a 400 when not recognized.
|
|
6039
|
+
*/
|
|
6032
6040
|
backend: string;
|
|
6033
6041
|
/** @description Language override for this stage */
|
|
6034
6042
|
language?: string | null;
|
|
@@ -38168,7 +38176,7 @@ type BackendWebhookTestResponse = components["schemas"]["WebhookTestResponse"];
|
|
|
38168
38176
|
//#region src/client.d.ts
|
|
38169
38177
|
interface XbergClientOptions {
|
|
38170
38178
|
apiKey?: string;
|
|
38171
|
-
baseUrl
|
|
38179
|
+
baseUrl: string;
|
|
38172
38180
|
/**
|
|
38173
38181
|
* Origin of the Enterprise control plane, which runs as a second binary
|
|
38174
38182
|
* alongside the data plane. Defaults to `baseUrl` — Pro serves both planes
|
|
@@ -38299,7 +38307,7 @@ interface PublicSandboxExtractParams {
|
|
|
38299
38307
|
/** Underlying `openapi-fetch` client, typed over the Enterprise API schema. */
|
|
38300
38308
|
type XbergRawClient = Client<paths$1>;
|
|
38301
38309
|
/**
|
|
38302
|
-
* High-level dual-target client. Construct with `new XbergClient({ apiKey })`.
|
|
38310
|
+
* High-level dual-target client. Construct with `new XbergClient({ baseUrl, apiKey })`.
|
|
38303
38311
|
*/
|
|
38304
38312
|
declare class XbergClient {
|
|
38305
38313
|
private readonly baseUrl;
|
|
@@ -38321,7 +38329,7 @@ declare class XbergClient {
|
|
|
38321
38329
|
private tierProbe;
|
|
38322
38330
|
/** Underlying `openapi-fetch` client — exposed for advanced use. */
|
|
38323
38331
|
readonly raw: XbergRawClient;
|
|
38324
|
-
constructor(options
|
|
38332
|
+
constructor(options: XbergClientOptions);
|
|
38325
38333
|
/** Enterprise backend `DELETE /auth/account`. */
|
|
38326
38334
|
deleteAccount(): Promise<void>;
|
|
38327
38335
|
/** Enterprise backend `GET /auth/config`. */
|
|
@@ -38766,12 +38774,12 @@ declare class XbergClient {
|
|
|
38766
38774
|
}
|
|
38767
38775
|
/** Backwards-compatible factory returning the low-level `openapi-fetch` client. */
|
|
38768
38776
|
interface CreateClientOptions {
|
|
38769
|
-
baseUrl
|
|
38777
|
+
baseUrl: string;
|
|
38770
38778
|
apiKey?: string;
|
|
38771
38779
|
headers?: Record<string, string>;
|
|
38772
38780
|
fetch?: typeof fetch;
|
|
38773
38781
|
}
|
|
38774
|
-
declare function createClient(options
|
|
38782
|
+
declare function createClient(options: CreateClientOptions): XbergRawClient;
|
|
38775
38783
|
//#endregion
|
|
38776
38784
|
//#region src/errors.d.ts
|
|
38777
38785
|
/**
|