@rpcbase/server 0.366.0 → 0.367.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/package.json
CHANGED
|
@@ -3,17 +3,29 @@ import Promise from "bluebird"
|
|
|
3
3
|
import queue from "../../queue"
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
export type ProcessFilePayload = {
|
|
7
|
+
hash: string;
|
|
8
|
+
ocr?: boolean;
|
|
9
|
+
vectors?: boolean;
|
|
10
|
+
img_preview?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const DEFAULTS = {
|
|
14
|
+
ocr: false,
|
|
15
|
+
vectors: false,
|
|
16
|
+
img_preview: false,
|
|
17
|
+
}
|
|
18
|
+
|
|
6
19
|
// after we've uploaded a file, we process it with ocr, llm vectorization, png rendering, etc
|
|
7
|
-
export const finalize_file_upload = async(files: Array<
|
|
20
|
+
export const finalize_file_upload = async(files: Array<ProcessFilePayload>) => {
|
|
8
21
|
|
|
9
22
|
await Promise.map(files,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
async(file: ProcessFilePayload) => {
|
|
24
|
+
await queue.add("finalize_file_upload", {...DEFAULTS, ...file}, {
|
|
25
|
+
jobId: `finalize_file_upload-${file.hash}`,
|
|
26
|
+
removeOnComplete: true,
|
|
27
|
+
removeOnFail: true,
|
|
28
|
+
})
|
|
15
29
|
})
|
|
16
|
-
}
|
|
17
|
-
)
|
|
18
30
|
|
|
19
31
|
}
|