Netherspite icon

Untitled

Netherspite | PRO | 06/23/22 12:17:36 PM UTC | 0 ⭐ | 7703 👁️ | Never ⏰ | []
TypeScript |

2.79 KB

|

None

|

0 👍

/

0 👎

    tmtaskvcuploadinit = asAPIEndpointDef({
        service: 'ingester',
        method: 'POST',
        endpoint: '/content/vcupload/tmtaskinit',
        input: {
            origin: cLimitedString(128),
            taskid: cLimitedString(32),
            fileinfo: cWebUploadInfo
        },
        output: {
            fileId: t.string,
            fileName: t.string,
            uploadedbytes: t.number,
            uploadedchunks: t.array(cVCChunkInfo)
        },
        options: {
            crossdomain: 1,
            allowHeaders: 'Origin, Content-Type'
        }
    });
 
    contentvcuploadchunk = asAPIEndpointDef({
        service: 'ingester',
        method: 'POST',
        endpoint: '/content/vcupload/chunk',
        input: {
            fileid: cLimitedString(64),
            offset: t.number,
            chunk: cFileInformation
        },
        output: {
            fileinfo: cUploadingVCFile
        },
        options: {
            multipart: 1,
            crossdomain: 1,
            allowHeaders: 'Origin, Content-Type'
        }
    });
 
    contentvcuploadfinish = asAPIEndpointDef({
        service: 'ingester',
        method: 'POST',
        endpoint: '/content/vcupload/finish',
        input: {
            fileid: t.string
        },
        output: {
        },
        options: {
            crossdomain: 1,
            allowHeaders: 'Origin, Content-Type'
        }
    });
 
export const cIntBool = t.union([t.literal(0), t.literal(1)], 'IntBool');
export type IntBool = t.TypeOf<typeof cIntBool>;
 
export const cWebUploadInfo = t.type({
    name: t.string,
    size: t.number,
    lastModified: t.number,
    type: t.string, // MIME type
    uploadDirectory: t.string
});
export type WebUploadInfo = t.TypeOf<typeof cWebUploadInfo>;
 
export const cUploadingFileBase = t.intersection([
    t.type({
        name: t.string,
        ext: t.string,
        uploaddirectory: t.string,
        size: t.number,
        lastmodified: t.number,
        type: t.string,
        userid: t.string,
        email: t.string,
        started: t.number,
        ip: t.string
    }),
    t.partial({
        conversion: cUploadConversionInfo
    })
]);
export type UploadingFileBase = t.TypeOf<typeof cUploadingFileBase>;
 
export const cVCChunkInfo = t.type({
    offset: t.number,
    length: t.number,
    written: cIntBool
});
export type VCChunkInfo = t.TypeOf<typeof cVCChunkInfo>;
 
export const cVCChunksInfo = t.type({
    uploadedbytes: t.number,
    uploadedchunks: t.array(cVCChunkInfo)
});
 
export type VCChunksInfo = t.TypeOf<typeof cVCChunksInfo>;
 
export const cUploadingVCFile = t.intersection([
    cUploadingFileBase,
    cVCChunksInfo
]);
export type UploadingVCFile = t.TypeOf<typeof cUploadingVCFile>;
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎