Advertisement
Netherspite

Untitled

Jun 23rd, 2022
732
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     tmtaskvcuploadinit = asAPIEndpointDef({
  2.         service: 'ingester',
  3.         method: 'POST',
  4.         endpoint: '/content/vcupload/tmtaskinit',
  5.         input: {
  6.             origin: cLimitedString(128),
  7.             taskid: cLimitedString(32),
  8.             fileinfo: cWebUploadInfo
  9.         },
  10.         output: {
  11.             fileId: t.string,
  12.             fileName: t.string,
  13.             uploadedbytes: t.number,
  14.             uploadedchunks: t.array(cVCChunkInfo)
  15.         },
  16.         options: {
  17.             crossdomain: 1,
  18.             allowHeaders: 'Origin, Content-Type'
  19.         }
  20.     });
  21.  
  22.     contentvcuploadchunk = asAPIEndpointDef({
  23.         service: 'ingester',
  24.         method: 'POST',
  25.         endpoint: '/content/vcupload/chunk',
  26.         input: {
  27.             fileid: cLimitedString(64),
  28.             offset: t.number,
  29.             chunk: cFileInformation
  30.         },
  31.         output: {
  32.             fileinfo: cUploadingVCFile
  33.         },
  34.         options: {
  35.             multipart: 1,
  36.             crossdomain: 1,
  37.             allowHeaders: 'Origin, Content-Type'
  38.         }
  39.     });
  40.  
  41.     contentvcuploadfinish = asAPIEndpointDef({
  42.         service: 'ingester',
  43.         method: 'POST',
  44.         endpoint: '/content/vcupload/finish',
  45.         input: {
  46.             fileid: t.string
  47.         },
  48.         output: {
  49.         },
  50.         options: {
  51.             crossdomain: 1,
  52.             allowHeaders: 'Origin, Content-Type'
  53.         }
  54.     });
  55.  
  56. export const cIntBool = t.union([t.literal(0), t.literal(1)], 'IntBool');
  57. export type IntBool = t.TypeOf<typeof cIntBool>;
  58.  
  59. export const cWebUploadInfo = t.type({
  60.     name: t.string,
  61.     size: t.number,
  62.     lastModified: t.number,
  63.     type: t.string, // MIME type
  64.     uploadDirectory: t.string
  65. });
  66. export type WebUploadInfo = t.TypeOf<typeof cWebUploadInfo>;
  67.  
  68. export const cUploadingFileBase = t.intersection([
  69.     t.type({
  70.         name: t.string,
  71.         ext: t.string,
  72.         uploaddirectory: t.string,
  73.         size: t.number,
  74.         lastmodified: t.number,
  75.         type: t.string,
  76.         userid: t.string,
  77.         email: t.string,
  78.         started: t.number,
  79.         ip: t.string
  80.     }),
  81.     t.partial({
  82.         conversion: cUploadConversionInfo
  83.     })
  84. ]);
  85. export type UploadingFileBase = t.TypeOf<typeof cUploadingFileBase>;
  86.  
  87. export const cVCChunkInfo = t.type({
  88.     offset: t.number,
  89.     length: t.number,
  90.     written: cIntBool
  91. });
  92. export type VCChunkInfo = t.TypeOf<typeof cVCChunkInfo>;
  93.  
  94. export const cVCChunksInfo = t.type({
  95.     uploadedbytes: t.number,
  96.     uploadedchunks: t.array(cVCChunkInfo)
  97. });
  98.  
  99. export type VCChunksInfo = t.TypeOf<typeof cVCChunksInfo>;
  100.  
  101. export const cUploadingVCFile = t.intersection([
  102.     cUploadingFileBase,
  103.     cVCChunksInfo
  104. ]);
  105. export type UploadingVCFile = t.TypeOf<typeof cUploadingVCFile>;
  106.  
Advertisement
RAW Paste Data Copied
Advertisement