secure-upload-fastify-sdk 1.0.0 → 1.0.2
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 +139 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -4
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.js +7 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +7 -4
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/routes/smart.d.ts.map +1 -1
- package/package.json +2 -4
package/dist/server/index.js
CHANGED
|
@@ -1616,9 +1616,11 @@ var FileInitItemSchema = import_zod2.z.object({
|
|
|
1616
1616
|
expectedHash: import_zod2.z.string().regex(/^[a-f0-9]{64}$/i).optional(),
|
|
1617
1617
|
meta: import_zod2.z.record(import_zod2.z.unknown()).optional()
|
|
1618
1618
|
}).strict();
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1619
|
+
function makeSmartInitBodySchema(maxFiles) {
|
|
1620
|
+
return import_zod2.z.object({
|
|
1621
|
+
files: import_zod2.z.array(FileInitItemSchema).min(1).max(maxFiles)
|
|
1622
|
+
}).strict();
|
|
1623
|
+
}
|
|
1622
1624
|
async function processOneFile(req, rt, file, index) {
|
|
1623
1625
|
try {
|
|
1624
1626
|
const { userId } = await resolveSession(req, file.isPublic, rt.validateSession);
|
|
@@ -1732,7 +1734,8 @@ async function registerSmartRoutes(app, rt) {
|
|
|
1732
1734
|
"\u{1F527} smart-routes: \u6CE8\u518C smart \u4E0A\u4F20\u8DEF\u7531(part/complete/abort/status \u590D\u7528 multipart/*)..."
|
|
1733
1735
|
);
|
|
1734
1736
|
app.post(`${base}/init`, async (req) => {
|
|
1735
|
-
const
|
|
1737
|
+
const schema = makeSmartInitBodySchema(rt.config.smartMaxFiles);
|
|
1738
|
+
const body = schema.parse(req.body ?? {});
|
|
1736
1739
|
if (body.files.length > rt.config.smartMaxFiles) {
|
|
1737
1740
|
throw new SecureError(
|
|
1738
1741
|
1511 /* BATCH_TOO_MANY_FILES */,
|