@kadoa/node-sdk 0.2.0 → 0.3.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 +6 -5
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -150,9 +150,8 @@ var DEFAULT_OPTIONS = {
|
|
|
150
150
|
navigationMode: "single-page",
|
|
151
151
|
location: { type: "auto" },
|
|
152
152
|
name: "Untitled Workflow",
|
|
153
|
-
|
|
153
|
+
maxRecords: 99999
|
|
154
154
|
};
|
|
155
|
-
var MAX_DATA_LIMIT = 99999;
|
|
156
155
|
var TERMINAL_RUN_STATES = /* @__PURE__ */ new Set([
|
|
157
156
|
"FINISHED",
|
|
158
157
|
"SUCCESS",
|
|
@@ -1866,11 +1865,11 @@ var Configuration = class {
|
|
|
1866
1865
|
|
|
1867
1866
|
// src/api-client.ts
|
|
1868
1867
|
var workflowsApiCache = /* @__PURE__ */ new WeakMap();
|
|
1869
|
-
function getWorkflowsApi(
|
|
1870
|
-
let api = workflowsApiCache.get(
|
|
1868
|
+
function getWorkflowsApi(sdk) {
|
|
1869
|
+
let api = workflowsApiCache.get(sdk);
|
|
1871
1870
|
if (!api) {
|
|
1872
|
-
api = new WorkflowsApi(
|
|
1873
|
-
workflowsApiCache.set(
|
|
1871
|
+
api = new WorkflowsApi(sdk.configuration, sdk.baseUrl, sdk.axiosInstance);
|
|
1872
|
+
workflowsApiCache.set(sdk, api);
|
|
1874
1873
|
}
|
|
1875
1874
|
return api;
|
|
1876
1875
|
}
|
|
@@ -1976,10 +1975,10 @@ async function handleErrorResponse(response, url, link) {
|
|
|
1976
1975
|
}
|
|
1977
1976
|
);
|
|
1978
1977
|
}
|
|
1979
|
-
async function fetchEntityFields(
|
|
1978
|
+
async function fetchEntityFields(sdk, options) {
|
|
1980
1979
|
validateEntityOptions(options);
|
|
1981
|
-
const url = new URL(ENTITY_API_ENDPOINT,
|
|
1982
|
-
const headers = await buildRequestHeaders(
|
|
1980
|
+
const url = new URL(ENTITY_API_ENDPOINT, sdk.baseUrl || DEFAULT_API_BASE_URL);
|
|
1981
|
+
const headers = await buildRequestHeaders(sdk.configuration);
|
|
1983
1982
|
const requestBody = options;
|
|
1984
1983
|
let response;
|
|
1985
1984
|
try {
|
|
@@ -2042,7 +2041,7 @@ async function createWorkflow(sdkInstance, config) {
|
|
|
2042
2041
|
name: config.name,
|
|
2043
2042
|
fields: config.fields,
|
|
2044
2043
|
bypassPreview: true,
|
|
2045
|
-
limit:
|
|
2044
|
+
limit: config.maxRecords,
|
|
2046
2045
|
tags: ["sdk"]
|
|
2047
2046
|
};
|
|
2048
2047
|
try {
|
|
@@ -2149,11 +2148,9 @@ async function runExtraction(sdkInstance, options) {
|
|
|
2149
2148
|
}
|
|
2150
2149
|
);
|
|
2151
2150
|
const workflowId = await createWorkflow(sdkInstance, {
|
|
2152
|
-
urls: config.urls,
|
|
2153
|
-
navigationMode: config.navigationMode,
|
|
2154
2151
|
entity: entityPrediction.entity,
|
|
2155
2152
|
fields: entityPrediction.fields,
|
|
2156
|
-
|
|
2153
|
+
...config
|
|
2157
2154
|
});
|
|
2158
2155
|
sdkInstance.emit(
|
|
2159
2156
|
"extraction:started",
|
|
@@ -2165,6 +2162,7 @@ async function runExtraction(sdkInstance, options) {
|
|
|
2165
2162
|
"extraction"
|
|
2166
2163
|
);
|
|
2167
2164
|
const workflow = await waitForWorkflowCompletion(sdkInstance, workflowId, {
|
|
2165
|
+
...config,
|
|
2168
2166
|
pollingInterval: config.pollingInterval,
|
|
2169
2167
|
maxWaitTime: config.maxWaitTime
|
|
2170
2168
|
});
|