@anyformat/sdk 1.12.0 → 1.14.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.cjs +46 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +46 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -52,7 +52,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
52
52
|
// package.json
|
|
53
53
|
var package_default = {
|
|
54
54
|
name: "@anyformat/sdk",
|
|
55
|
-
version: "1.
|
|
55
|
+
version: "1.14.0",
|
|
56
56
|
description: "TypeScript SDK for the AnyFormat API",
|
|
57
57
|
license: "MIT",
|
|
58
58
|
author: "Anyformat <info@anyformat.ai>",
|
|
@@ -1120,6 +1120,20 @@ var v3GetDocumentPacket = (options) => (options.client ?? client).get({
|
|
|
1120
1120
|
url: "/v3/document-packets/{document_packet_id}/",
|
|
1121
1121
|
...options
|
|
1122
1122
|
});
|
|
1123
|
+
var v3GetGroundTruth = (options) => (options.client ?? client).get({
|
|
1124
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1125
|
+
url: "/v3/document-packets/{document_packet_id}/ground-truth/",
|
|
1126
|
+
...options
|
|
1127
|
+
});
|
|
1128
|
+
var v3SetGroundTruth = (options) => (options.client ?? client).put({
|
|
1129
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1130
|
+
url: "/v3/document-packets/{document_packet_id}/ground-truth/",
|
|
1131
|
+
...options,
|
|
1132
|
+
headers: {
|
|
1133
|
+
"Content-Type": "application/json",
|
|
1134
|
+
...options.headers
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1123
1137
|
var v3RunDocumentPacket = (options) => (options.client ?? client).post({
|
|
1124
1138
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1125
1139
|
url: "/v3/document-packets/{document_packet_id}/run/",
|
|
@@ -1967,6 +1981,37 @@ var Anyformat = class {
|
|
|
1967
1981
|
if (res.error) throw toApiError(res.response?.status ?? 500, res.error, res.response?.headers);
|
|
1968
1982
|
return res.data;
|
|
1969
1983
|
}
|
|
1984
|
+
/**
|
|
1985
|
+
* A dataset document packet's ground truth, keyed by field `persistent_id`,
|
|
1986
|
+
* or `null` until it is first set. Omit `version` for the workflow's current
|
|
1987
|
+
* version; `nodeId` is needed only when the version has more than one extract node.
|
|
1988
|
+
*/
|
|
1989
|
+
async getGroundTruth(documentPacketId, opts = {}) {
|
|
1990
|
+
const res = await v3GetGroundTruth({
|
|
1991
|
+
client: this._client,
|
|
1992
|
+
path: { document_packet_id: documentPacketId },
|
|
1993
|
+
query: { version: opts.version, node_id: opts.nodeId }
|
|
1994
|
+
});
|
|
1995
|
+
if (res.error) throw toApiError(res.response?.status ?? 500, res.error, res.response?.headers);
|
|
1996
|
+
return res.data;
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Create or replace a dataset document packet's complete ground truth and
|
|
2000
|
+
* return it as stored. A production packet throws with `NOT_IN_DATASET`.
|
|
2001
|
+
*/
|
|
2002
|
+
async setGroundTruth(documentPacketId, groundTruth, opts = {}) {
|
|
2003
|
+
const res = await v3SetGroundTruth({
|
|
2004
|
+
client: this._client,
|
|
2005
|
+
path: { document_packet_id: documentPacketId },
|
|
2006
|
+
body: {
|
|
2007
|
+
ground_truth: groundTruth,
|
|
2008
|
+
...opts.versionId ? { version_id: opts.versionId } : {},
|
|
2009
|
+
...opts.nodeId ? { node_id: opts.nodeId } : {}
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
if (res.error) throw toApiError(res.response?.status ?? 500, res.error, res.response?.headers);
|
|
2013
|
+
return res.data;
|
|
2014
|
+
}
|
|
1970
2015
|
};
|
|
1971
2016
|
|
|
1972
2017
|
// src/schema.ts
|