@oomol-lab/open-connector 1.6.4 → 1.6.5
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/assets/open-connector/catalog/apps/aisa.json +568 -0
- package/assets/open-connector/catalog/apps/bilibili.json +2586 -0
- package/assets/open-connector/catalog/apps/bitwarden.json +1423 -0
- package/assets/open-connector/catalog/apps/cronfree.json +303 -0
- package/assets/open-connector/catalog/apps/cufinder.json +368 -0
- package/assets/open-connector/catalog/apps/gmail.json +73 -0
- package/assets/open-connector/catalog/apps/investoday_mcp.json +22228 -197
- package/assets/open-connector/catalog/apps/ixspy.json +2274 -0
- package/assets/open-connector/catalog/apps/osv.json +663 -0
- package/assets/open-connector/catalog/apps/pdf_vector.json +329 -0
- package/assets/open-connector/catalog/apps/pulsetic.json +406 -0
- package/assets/open-connector/catalog/apps/shopee.json +1785 -0
- package/assets/open-connector/catalog/apps/slack.json +81 -0
- package/assets/open-connector/catalog/apps/slackbot.json +81 -0
- package/assets/open-connector/catalog/apps/speak_ai.json +360 -0
- package/assets/open-connector/catalog/apps/zyhub.json +1585 -0
- package/assets/open-connector/catalog/apps-index.json +1 -1
- package/package.json +1 -1
- package/src/core/json-schema.d.ts +5 -1
- package/src/core/json-schema.js +14 -2
- package/src/core/types.d.ts +9 -0
- package/src/oauth/oauth-credential-refresh-service.js +3 -1
- package/src/oauth/oauth-flow-service.js +17 -2
- package/src/oauth/oauth-token.d.ts +13 -0
- package/src/providers/action-contracts.generated.d.ts +16 -4
- package/src/providers/aisa/executors.d.ts +4 -0
- package/src/providers/aisa/executors.js +176 -0
- package/src/providers/bilibili/articles.d.ts +3 -0
- package/src/providers/bilibili/articles.js +369 -0
- package/src/providers/bilibili/executors.d.ts +8 -0
- package/src/providers/bilibili/executors.js +262 -0
- package/src/providers/bilibili/runtime.d.ts +95 -0
- package/src/providers/bilibili/runtime.js +238 -0
- package/src/providers/bilibili/upload.d.ts +14 -0
- package/src/providers/bilibili/upload.js +105 -0
- package/src/providers/bitwarden/executors.d.ts +3 -0
- package/src/providers/bitwarden/executors.js +146 -0
- package/src/providers/cronfree/executors.d.ts +4 -0
- package/src/providers/cronfree/executors.js +89 -0
- package/src/providers/cufinder/executors.d.ts +4 -0
- package/src/providers/cufinder/executors.js +105 -0
- package/src/providers/elevenreader/runtime.js +6 -5
- package/src/providers/gmail/attachment-stream.d.ts +2 -0
- package/src/providers/gmail/attachment-stream.js +162 -0
- package/src/providers/gmail/executors.d.ts +3 -1
- package/src/providers/gmail/executors.js +53 -25
- package/src/providers/investoday_mcp/official-actions.js +19 -372
- package/src/providers/investoday_mcp/official-tool-types.d.ts +10 -0
- package/src/providers/investoday_mcp/official-tool-types.js +4 -0
- package/src/providers/investoday_mcp/official-tools/charts.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/charts.js +32 -0
- package/src/providers/investoday_mcp/official-tools/fixed-income.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/fixed-income.js +326 -0
- package/src/providers/investoday_mcp/official-tools/funds.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/funds.js +1085 -0
- package/src/providers/investoday_mcp/official-tools/hong-kong.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/hong-kong.js +275 -0
- package/src/providers/investoday_mcp/official-tools/indices-industries.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/indices-industries.js +642 -0
- package/src/providers/investoday_mcp/official-tools/macro-calendar.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/macro-calendar.js +398 -0
- package/src/providers/investoday_mcp/official-tools/other.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/other.js +131 -0
- package/src/providers/investoday_mcp/official-tools/research-news.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/research-news.js +302 -0
- package/src/providers/investoday_mcp/official-tools/stocks.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/stocks.js +2829 -0
- package/src/providers/ixspy/executors.d.ts +3 -0
- package/src/providers/ixspy/executors.js +220 -0
- package/src/providers/osv/executors.d.ts +2 -0
- package/src/providers/osv/executors.js +11 -0
- package/src/providers/osv/runtime.d.ts +9 -0
- package/src/providers/osv/runtime.js +66 -0
- package/src/providers/pdf_vector/executors.d.ts +4 -0
- package/src/providers/pdf_vector/executors.js +108 -0
- package/src/providers/provider-runtime.d.ts +3 -0
- package/src/providers/provider-runtime.js +4 -1
- package/src/providers/pulsetic/executors.d.ts +4 -0
- package/src/providers/pulsetic/executors.js +126 -0
- package/src/providers/registry.generated.js +12 -0
- package/src/providers/shopee/actions.d.ts +2 -0
- package/src/providers/shopee/actions.js +474 -0
- package/src/providers/shopee/executors.d.ts +3 -0
- package/src/providers/shopee/executors.js +85 -0
- package/src/providers/shopee/runtime.d.ts +79 -0
- package/src/providers/shopee/runtime.js +693 -0
- package/src/providers/slack/actions.js +17 -0
- package/src/providers/slack/runtime.js +60 -2
- package/src/providers/speak_ai/executors.d.ts +3 -0
- package/src/providers/speak_ai/executors.js +187 -0
- package/src/providers/tushare/runtime.js +22 -9
- package/src/providers/zyhub/executors.d.ts +3 -0
- package/src/providers/zyhub/executors.js +240 -0
- package/src/server/files/transit-files.d.ts +3 -2
- package/src/server/files/transit-files.js +31 -35
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { once } from "node:events";
|
|
2
1
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
3
2
|
import { mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
4
3
|
import { join } from "node:path";
|
|
5
4
|
import { Readable } from "node:stream";
|
|
6
|
-
import {
|
|
5
|
+
import { pipeline } from "node:stream/promises";
|
|
7
6
|
import { assertFileSize, assertSafeFileId, contentTypeFromFileId, isSafeFileId, normalizeDescriptor, randomHex, safeExtension, TransitFileError, transitFileRead, transitFileResponse, uploadResult, } from "./transit-file-store.js";
|
|
8
7
|
export class TransitFileService {
|
|
9
8
|
rootDir;
|
|
@@ -18,19 +17,33 @@ export class TransitFileService {
|
|
|
18
17
|
}
|
|
19
18
|
async create(file) {
|
|
20
19
|
assertFileSize(file.size, this.maxBytes);
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
return this.createFromStream({ body: file.stream(), name: file.name, mimeType: file.type });
|
|
21
|
+
}
|
|
22
|
+
async createFromStream(file) {
|
|
23
23
|
const fileId = `${randomHex(16)}${safeExtension(file.name)}`;
|
|
24
24
|
const path = join(this.rootDir, fileId);
|
|
25
25
|
const tempPath = `${path}.tmp`;
|
|
26
|
-
const sizeBytes = await this.writeFile(file, tempPath);
|
|
27
|
-
await rename(tempPath, path);
|
|
28
26
|
const metadata = normalizeDescriptor({
|
|
29
27
|
name: file.name || fileId,
|
|
30
|
-
mimeType: file.
|
|
28
|
+
mimeType: file.mimeType || contentTypeFromFileId(fileId),
|
|
31
29
|
});
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
try {
|
|
31
|
+
file.signal?.throwIfAborted();
|
|
32
|
+
await this.cleanupExpired();
|
|
33
|
+
const sizeBytes = await this.writeStream(file, tempPath);
|
|
34
|
+
file.signal?.throwIfAborted();
|
|
35
|
+
await writeFile(metadataPath(path), JSON.stringify(metadata), { flag: "wx", signal: file.signal });
|
|
36
|
+
await rename(tempPath, path);
|
|
37
|
+
file.signal?.throwIfAborted();
|
|
38
|
+
return uploadResult(this.publicOrigin, fileId, { ...metadata, sizeBytes });
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (!file.body.locked) {
|
|
42
|
+
await file.body.cancel(error).catch(() => undefined);
|
|
43
|
+
}
|
|
44
|
+
await Promise.all([tempPath, path, metadataPath(path)].map((filePath) => unlink(filePath).catch(() => undefined)));
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
34
47
|
}
|
|
35
48
|
async createFromPath(file) {
|
|
36
49
|
assertFileSize(file.sizeBytes, this.maxBytes);
|
|
@@ -114,34 +127,17 @@ export class TransitFileService {
|
|
|
114
127
|
return fallback;
|
|
115
128
|
}
|
|
116
129
|
}
|
|
117
|
-
async
|
|
118
|
-
const writer = createWriteStream(tempPath, { flags: "wx" });
|
|
119
|
-
const reader = file.stream().getReader();
|
|
130
|
+
async writeStream(file, tempPath) {
|
|
120
131
|
let sizeBytes = 0;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
sizeBytes += value.byteLength;
|
|
128
|
-
assertFileSize(sizeBytes, this.maxBytes);
|
|
129
|
-
if (!writer.write(value)) {
|
|
130
|
-
await once(writer, "drain");
|
|
131
|
-
}
|
|
132
|
+
const maxBytes = this.maxBytes;
|
|
133
|
+
await pipeline(Readable.fromWeb(file.body), async function* (source) {
|
|
134
|
+
for await (const chunk of source) {
|
|
135
|
+
sizeBytes += chunk.byteLength;
|
|
136
|
+
assertFileSize(sizeBytes, maxBytes);
|
|
137
|
+
yield chunk;
|
|
132
138
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return sizeBytes;
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
writer.destroy();
|
|
139
|
-
await unlink(tempPath).catch(() => undefined);
|
|
140
|
-
throw error;
|
|
141
|
-
}
|
|
142
|
-
finally {
|
|
143
|
-
reader.releaseLock();
|
|
144
|
-
}
|
|
139
|
+
}, createWriteStream(tempPath, { flags: "wx" }), { signal: file.signal });
|
|
140
|
+
return sizeBytes;
|
|
145
141
|
}
|
|
146
142
|
}
|
|
147
143
|
function isManagedFileName(fileName) {
|