From 22c9efff538c3f054359c75628e11db4655fe52f Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:57:02 -0600 Subject: [PATCH 1/4] use testdriver repo --- dist/index.js | 7 +++++-- src/index.js | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 50347b8..5cbc6d3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32398,8 +32398,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); (async function () { const owner = "replayableio"; - const repo = "testdriver-dev"; - const branch = "main"; + const repo = "testdriver"; + const branch = "michael/flag-based-action-or-bot"; const dispatchWorkflow = "interpret-comment.yml"; const octokit = github.getOctokit(process.env.GH_TOKEN); @@ -32414,8 +32414,11 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); workflow_id: dispatchWorkflow, ref: branch, inputs: { + repo: config.input.owner + "/" + config.input.repo, + branch: config.input.branch, dispatchId, comment: config.input.prompt, + isFromAction: true, }, } ); diff --git a/src/index.js b/src/index.js index a1110c8..b3508bc 100644 --- a/src/index.js +++ b/src/index.js @@ -14,8 +14,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); (async function () { const owner = "replayableio"; - const repo = "testdriver-dev"; - const branch = "main"; + const repo = "testdriver"; + const branch = "michael/flag-based-action-or-bot"; const dispatchWorkflow = "interpret-comment.yml"; const octokit = github.getOctokit(process.env.GH_TOKEN); @@ -30,8 +30,11 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); workflow_id: dispatchWorkflow, ref: branch, inputs: { + repo: config.input.owner + "/" + config.input.repo, + branch: config.input.branch, dispatchId, comment: config.input.prompt, + isFromAction: true, }, } ); From acdb3c000816fdffb6dcaa4a0ec448f278b740ed Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:09:43 -0600 Subject: [PATCH 2/4] fix --- dist/index.js | 4 ++-- src/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5cbc6d3..bd42b0e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32414,8 +32414,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); workflow_id: dispatchWorkflow, ref: branch, inputs: { - repo: config.input.owner + "/" + config.input.repo, - branch: config.input.branch, + repo: config.githubContext.owner + "/" + config.githubContext.repo, + branch: config.githubContext.branch, dispatchId, comment: config.input.prompt, isFromAction: true, diff --git a/src/index.js b/src/index.js index b3508bc..a33102c 100644 --- a/src/index.js +++ b/src/index.js @@ -30,8 +30,8 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); workflow_id: dispatchWorkflow, ref: branch, inputs: { - repo: config.input.owner + "/" + config.input.repo, - branch: config.input.branch, + repo: config.githubContext.owner + "/" + config.githubContext.repo, + branch: config.githubContext.branch, dispatchId, comment: config.input.prompt, isFromAction: true, From bb84c05e0726c2b7432e77da93e22426a77cf7ab Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:16:15 -0600 Subject: [PATCH 3/4] boolean string --- dist/index.js | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index bd42b0e..2bb870b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32418,7 +32418,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); branch: config.githubContext.branch, dispatchId, comment: config.input.prompt, - isFromAction: true, + isFromAction: "true", }, } ); diff --git a/src/index.js b/src/index.js index a33102c..5d8b095 100644 --- a/src/index.js +++ b/src/index.js @@ -34,7 +34,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); branch: config.githubContext.branch, dispatchId, comment: config.input.prompt, - isFromAction: true, + isFromAction: "true", }, } ); From a0d6db364d4f8365266a4e13df52703d10ea2e72 Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Sat, 24 Feb 2024 20:18:35 -0600 Subject: [PATCH 4/4] use branch main --- dist/index.js | 1662 ++++++++++++++++++++++++------------------------- src/index.js | 2 +- 2 files changed, 832 insertions(+), 832 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2bb870b..d00e8a0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -29560,836 +29560,836 @@ exports["default"] = _default; /***/ 8222: /***/ ((module) => { - - -var UZIP = {}; -if(true) module.exports = UZIP; - - -UZIP["parse"] = function(buf, onlyNames) // ArrayBuffer -{ - var rUs = UZIP.bin.readUshort, rUi = UZIP.bin.readUint, o = 0, out = {}; - var data = new Uint8Array(buf); - var eocd = data.length-4; - - while(rUi(data, eocd)!=0x06054b50) eocd--; - - var o = eocd; - o+=4; // sign = 0x06054b50 - o+=4; // disks = 0; - var cnu = rUs(data, o); o+=2; - var cnt = rUs(data, o); o+=2; - - var csize = rUi(data, o); o+=4; - var coffs = rUi(data, o); o+=4; - - o = coffs; - for(var i=0; i8514000) { - //console.log(PUtils.readASCII(buf , 8514500, 500)); - //console.log(PUtils.readASCII(nbuf, 8514500, 500)); - } - for(var i=0; i>>4); - //console.log(CM, CINFO,CMF,FLG); - return UZIP.inflateRaw(new Uint8Array(file.buffer, file.byteOffset+2, file.length-6), buf); -} -UZIP.deflate = function(data, opts/*, buf, off*/) { - if(opts==null) opts={level:6}; - var off=0, buf=new Uint8Array(50+Math.floor(data.length*1.1)); - buf[off]=120; buf[off+1]=156; off+=2; - off = UZIP.F.deflateRaw(data, buf, off, opts.level); - var crc = UZIP.adler(data, 0, data.length); - buf[off+0]=((crc>>>24)&255); - buf[off+1]=((crc>>>16)&255); - buf[off+2]=((crc>>> 8)&255); - buf[off+3]=((crc>>> 0)&255); - return new Uint8Array(buf.buffer, 0, off+4); -} -UZIP.deflateRaw = function(data, opts) { - if(opts==null) opts={level:6}; - var buf=new Uint8Array(50+Math.floor(data.length*1.1)); - var off = UZIP.F.deflateRaw(data, buf, off, opts.level); - return new Uint8Array(buf.buffer, 0, off); -} - - -UZIP.encode = function(obj, noCmpr) { - if(noCmpr==null) noCmpr=false; - var tot = 0, wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort; - var zpd = {}; - for(var p in obj) { var cpr = !UZIP._noNeed(p) && !noCmpr, buf = obj[p], crc = UZIP.crc.crc(buf,0,buf.length); - zpd[p] = { cpr:cpr, usize:buf.length, crc:crc, file: (cpr ? UZIP.deflateRaw(buf) : buf) }; } - - for(var p in zpd) tot += zpd[p].file.length + 30 + 46 + 2*UZIP.bin.sizeUTF8(p); - tot += 22; - - var data = new Uint8Array(tot), o = 0; - var fof = [] - - for(var p in zpd) { - var file = zpd[p]; fof.push(o); - o = UZIP._writeHeader(data, o, p, file, 0); - } - var i=0, ioff = o; - for(var p in zpd) { - var file = zpd[p]; fof.push(o); - o = UZIP._writeHeader(data, o, p, file, 1, fof[i++]); - } - var csize = o-ioff; - - wUi(data, o, 0x06054b50); o+=4; - o += 4; // disks - wUs(data, o, i); o += 2; - wUs(data, o, i); o += 2; // number of c d records - wUi(data, o, csize); o += 4; - wUi(data, o, ioff ); o += 4; - o += 2; - return data.buffer; -} -// no need to compress .PNG, .ZIP, .JPEG .... -UZIP._noNeed = function(fn) { var ext = fn.split(".").pop().toLowerCase(); return "png,jpg,jpeg,zip".indexOf(ext)!=-1; } - -UZIP._writeHeader = function(data, o, p, obj, t, roff) -{ - var wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort; - var file = obj.file; - - wUi(data, o, t==0 ? 0x04034b50 : 0x02014b50); o+=4; // sign - if(t==1) o+=2; // ver made by - wUs(data, o, 20); o+=2; // ver - wUs(data, o, 0); o+=2; // gflip - wUs(data, o, obj.cpr?8:0); o+=2; // cmpr - - wUi(data, o, 0); o+=4; // time - wUi(data, o, obj.crc); o+=4; // crc32 - wUi(data, o, file.length); o+=4; // csize - wUi(data, o, obj.usize); o+=4; // usize - - wUs(data, o, UZIP.bin.sizeUTF8(p)); o+=2; // nlen - wUs(data, o, 0); o+=2; // elen - - if(t==1) { - o += 2; // comment length - o += 2; // disk number - o += 6; // attributes - wUi(data, o, roff); o+=4; // usize - } - var nlen = UZIP.bin.writeUTF8(data, o, p); o+= nlen; - if(t==0) { data.set(file, o); o += file.length; } - return o; -} - - - - - -UZIP.crc = { - table : ( function() { - var tab = new Uint32Array(256); - for (var n=0; n<256; n++) { - var c = n; - for (var k=0; k<8; k++) { - if (c & 1) c = 0xedb88320 ^ (c >>> 1); - else c = c >>> 1; - } - tab[n] = c; } - return tab; })(), - update : function(c, buf, off, len) { - for (var i=0; i>> 8); - return c; - }, - crc : function(b,o,l) { return UZIP.crc.update(0xffffffff,b,o,l) ^ 0xffffffff; } -} -UZIP.adler = function(data,o,len) { - var a = 1, b = 0; - var off = o, end=o+len; - while(off>8)&255; }, - readUint : function(buff,p) { return (buff[p+3]*(256*256*256)) + ((buff[p+2]<<16) | (buff[p+1]<< 8) | buff[p]); }, - writeUint : function(buff,p,n){ buff[p]=n&255; buff[p+1]=(n>>8)&255; buff[p+2]=(n>>16)&255; buff[p+3]=(n>>24)&255; }, - readASCII : function(buff,p,l){ var s = ""; for(var i=0; i> 6)); buff[p+i+1] = (128|((code>> 0)&63)); i+=2; } - else if((code&(0xffffffff-(1<<16)+1))==0) { buff[p+i] = (224|(code>>12)); buff[p+i+1] = (128|((code>> 6)&63)); buff[p+i+2] = (128|((code>>0)&63)); i+=3; } - else if((code&(0xffffffff-(1<<21)+1))==0) { buff[p+i] = (240|(code>>18)); buff[p+i+1] = (128|((code>>12)&63)); buff[p+i+2] = (128|((code>>6)&63)); buff[p+i+3] = (128|((code>>0)&63)); i+=4; } - else throw "e"; - } - return i; - }, - sizeUTF8 : function(str) { - var strl = str.length, i=0; - for(var ci=0; ci>>3; - } - - var lits = U.lits, strt=U.strt, prev=U.prev, li=0, lc=0, bs=0, ebits=0, c=0, nc=0; // last_item, literal_count, block_start - if(dlen>2) { nc=UZIP.F._hash(data,0); strt[nc]=0; } - var nmch=0,nmci=0; - - for(i=0; i14000 || lc>26697) && (dlen-i)>100) { - if(cvrd>>16)>>16)>(mch>>>16)) mch=0; - }//*/ - var len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw "e"; - if(mch!=0) { - var len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw "e"; - var lgi = goodIndex(len, U.of0); U.lhst[257+lgi]++; - var dgi = goodIndex(dst, U.df0); U.dhst[ dgi]++; ebits += U.exb[lgi] + U.dxb[dgi]; - lits[li] = (len<<23)|(i-cvrd); lits[li+1] = (dst<<16)|(lgi<<8)|dgi; li+=2; - cvrd = i + len; - } - else { U.lhst[data[i]]++; } - lc++; - } - } - if(bs!=i || data.length==0) { - if(cvrd>>3; -} -UZIP.F._bestMatch = function(data, i, prev, c, nice, chain) { - var ci = (i&0x7fff), pi=prev[ci]; - //console.log("----", i); - var dif = ((ci-pi + (1<<15)) & 0x7fff); if(pi==ci || c!=UZIP.F._hash(data,i-dif)) return 0; - var tl=0, td=0; // top length, top distance - var dlim = Math.min(0x7fff, i); - while(dif<=dlim && --chain!=0 && pi!=ci /*&& c==UZIP.F._hash(data,i-dif)*/) { - if(tl==0 || (data[i+tl]==data[i+tl-dif])) { - var cl = UZIP.F._howLong(data, i, dif); - if(cl>tl) { - tl=cl; td=dif; if(tl>=nice) break; //* - if(dif+2maxd) { maxd=curd; pi = ei; } - } //*/ - } - } - - ci=pi; pi = prev[ci]; - dif += ((ci-pi + (1<<15)) & 0x7fff); - } - return (tl<<16)|td; -} -UZIP.F._howLong = function(data, i, dif) { - if(data[i]!=data[i-dif] || data[i+1]!=data[i+1-dif] || data[i+2]!=data[i+2-dif]) return 0; - var oi=i, l = Math.min(data.length, i+258); i+=3; - //while(i+4>>23), end = off+(qb&((1<<23)-1)); - while(off>16), lgi=(qc>>8)&255, dgi=(qc&255); - pos = UZIP.F._writeLit(257+lgi, ltree, out, pos); - putsE(out, pos, len-U.of0[lgi]); pos+=U.exb[lgi]; - - pos = UZIP.F._writeLit(dgi, dtree, out, pos); - putsF(out, pos, dst-U.df0[dgi]); pos+=U.dxb[dgi]; off+=len; - } - } - pos = UZIP.F._writeLit(256, ltree, out, pos); - } - //console.log(pos-opos, fxdSize, dynSize, cstSize); - return pos; -} -UZIP.F._copyExact = function(data,off,len,out,pos) { - var p8 = (pos>>>3); - out[p8]=(len); out[p8+1]=(len>>>8); out[p8+2]=255-out[p8]; out[p8+3]=255-out[p8+1]; p8+=4; - out.set(new Uint8Array(data.buffer, off, len), p8); - //for(var i=0; i4 && U.itree[(U.ordr[numh-1]<<1)+1]==0) numh--; - return [ML, MD, MH, numl, numd, numh, lset, dset]; -} -UZIP.F.getSecond= function(a) { var b=[]; for(var i=0; i>1)+","; return b; } -UZIP.F.contSize = function(tree, hst) { var s=0; for(var i=0; i15) { UZIP.F._putsE(out, pos, rst, rsl); pos+=rsl; } - } - return pos; -} -UZIP.F._lenCodes = function(tree, set) { - var len=tree.length; while(len!=2 && tree[len-1]==0) len-=2; // when no distances, keep one code with length 0 - for(var i=0; i>>1, 138); - if(zc<11) set.push(17, zc-3); - else set.push(18, zc-11); - i += zc*2-2; - } - else if(l==prv && nxt==l && nnxt==l) { - var lz = i+5; - while(lz+2>>1, 6); - set.push(16, zc-3); - i += zc*2-2; - } - else set.push(l, 0); - } - return len>>>1; -} -UZIP.F._hufTree = function(hst, tree, MAXL) { - var list=[], hl = hst.length, tl=tree.length, i=0; - for(i=0; iMAXL) { UZIP.F.restrictDepth(l2, MAXL, maxl); maxl = MAXL; } - for(i=0; iMD) { var od=dps[i].d; dps[i].d=MD; dbt+=bCost-(1<<(maxl-od)); } else break; - dbt = dbt>>>(maxl-MD); - while(dbt>0) { var od=dps[i].d; if(od=0; i--) if(dps[i].d==MD && dbt<0) { dps[i].d--; dbt++; } if(dbt!=0) console.log("debt left"); -} - -UZIP.F._goodIndex = function(v, arr) { - var i=0; if(arr[i|16]<=v) i|=16; if(arr[i|8]<=v) i|=8; if(arr[i|4]<=v) i|=4; if(arr[i|2]<=v) i|=2; if(arr[i|1]<=v) i|=1; return i; -} -UZIP.F._writeLit = function(ch, ltree, out, pos) { - UZIP.F._putsF(out, pos, ltree[ch<<1]); - return pos+ltree[(ch<<1)+1]; -} - - - - - - - - -UZIP.F.inflate = function(data, buf) { - var u8=Uint8Array; - if(data[0]==3 && data[1]==0) return (buf ? buf : new u8(0)); - var F=UZIP.F, bitsF = F._bitsF, bitsE = F._bitsE, decodeTiny = F._decodeTiny, makeCodes = F.makeCodes, codes2map=F.codes2map, get17 = F._get17; - var U = F.U; - - var noBuf = (buf==null); - if(noBuf) buf = new u8((data.length>>>2)<<3); - - var BFINAL=0, BTYPE=0, HLIT=0, HDIST=0, HCLEN=0, ML=0, MD=0; - var off = 0, pos = 0; - var lmap, dmap; - - while(BFINAL==0) { - BFINAL = bitsF(data, pos , 1); - BTYPE = bitsF(data, pos+1, 2); pos+=3; - //console.log(BFINAL, BTYPE); - - if(BTYPE==0) { - if((pos&7)!=0) pos+=8-(pos&7); - var p8 = (pos>>>3)+4, len = data[p8-4]|(data[p8-3]<<8); //console.log(len);//bitsF(data, pos, 16), - if(noBuf) buf=UZIP.F._check(buf, off+len); - buf.set(new u8(data.buffer, data.byteOffset+p8, len), off); - //for(var i=0; itl)tl=l; } pos+=3*HCLEN; //console.log(itree); - makeCodes(U.itree, tl); - codes2map(U.itree, tl, U.imap); - - lmap = U.lmap; dmap = U.dmap; - - pos = decodeTiny(U.imap, (1<>>24))-1; pos+=(ml&0xffffff); - makeCodes(U.ltree, mx0); - codes2map(U.ltree, mx0, lmap); - - //var md = decodeTiny(U.imap, (1<>>24))-1; pos+=(md&0xffffff); - makeCodes(U.dtree, mx1); - codes2map(U.dtree, mx1, dmap); - } - //var ooff=off, opos=pos; - while(true) { - var code = lmap[get17(data, pos) & ML]; pos += code&15; - var lit = code>>>4; //U.lhst[lit]++; - if((lit>>>8)==0) { buf[off++] = lit; } - else if(lit==256) { break; } - else { - var end = off+lit-254; - if(lit>264) { var ebs = U.ldef[lit-257]; end = off + (ebs>>>3) + bitsE(data, pos, ebs&7); pos += ebs&7; } - //UZIP.F.dst[end-off]++; - - var dcode = dmap[get17(data, pos) & MD]; pos += dcode&15; - var dlit = dcode>>>4; - var dbs = U.ddef[dlit], dst = (dbs>>>4) + bitsF(data, pos, dbs&15); pos += dbs&15; - - //var o0 = off-dst, stp = Math.min(end-off, dst); - //if(stp>20) while(off>>3); - } - //console.log(UZIP.F.dst); - //console.log(tlen, dlen, off-tlen+tcnt); - return buf.length==off ? buf : buf.slice(0,off); -} -UZIP.F._check=function(buf, len) { - var bl=buf.length; if(len<=bl) return buf; - var nbuf = new Uint8Array(Math.max(bl<<1,len)); nbuf.set(buf,0); - //for(var i=0; i>>4; - if(lit<=15) { tree[i]=lit; i++; } - else { - var ll = 0, n = 0; - if(lit==16) { - n = (3 + bitsE(data, pos, 2)); pos += 2; ll = tree[i-1]; - } - else if(lit==17) { - n = (3 + bitsE(data, pos, 3)); pos += 3; - } - else if(lit==18) { - n = (11 + bitsE(data, pos, 7)); pos += 7; - } - var ni = i+n; - while(i>>1; - while(imx)mx=v; i++; } - while(i>1; - var cl = tree[i+1], val = (lit<<4)|cl; // : (0x8000 | (U.of0[lit-257]<<7) | (U.exb[lit-257]<<4) | cl); - var rest = (MAX_BITS-cl), i0 = tree[i]<>>(15-MAX_BITS); - while(i0!=i1) { - var p0 = r15[i0]>>>(15-MAX_BITS); - map[p0]=val; i0++; - } - } -} -UZIP.F.revCodes = function(tree, MAX_BITS) { - var r15 = UZIP.F.U.rev15, imb = 15-MAX_BITS; - for(var i=0; i>>imb; } -} - -// used only in deflate -UZIP.F._putsE= function(dt, pos, val ) { val = val<<(pos&7); var o=(pos>>>3); dt[o]|=val; dt[o+1]|=(val>>>8); } -UZIP.F._putsF= function(dt, pos, val ) { val = val<<(pos&7); var o=(pos>>>3); dt[o]|=val; dt[o+1]|=(val>>>8); dt[o+2]|=(val>>>16); } - -UZIP.F._bitsE= function(dt, pos, length) { return ((dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) )>>>(pos&7))&((1<>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16))>>>(pos&7))&((1<>>3] | (dt[(pos>>>3)+1]<<8))>>>(pos&7))&511; -} */ -UZIP.F._get17= function(dt, pos) { // return at least 17 meaningful bytes - return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) )>>>(pos&7); -} -UZIP.F._get25= function(dt, pos) { // return at least 17 meaningful bytes - return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) | (dt[(pos>>>3)+3]<<24) )>>>(pos&7); -} -UZIP.F.U = function(){ - var u16=Uint16Array, u32=Uint32Array; - return { - next_code : new u16(16), - bl_count : new u16(16), - ordr : [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], - of0 : [3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999], - exb : [0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0], - ldef : new u16(32), - df0 : [1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 65535, 65535], - dxb : [0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0], - ddef : new u32(32), - flmap: new u16( 512), fltree: [], - fdmap: new u16( 32), fdtree: [], - lmap : new u16(32768), ltree : [], ttree:[], - dmap : new u16(32768), dtree : [], - imap : new u16( 512), itree : [], - //rev9 : new u16( 512) - rev15: new u16(1<<15), - lhst : new u32(286), dhst : new u32( 30), ihst : new u32(19), - lits : new u32(15000), - strt : new u16(1<<16), - prev : new u16(1<<15) - }; -} (); - -(function(){ - var U = UZIP.F.U; - var len = 1<<15; - for(var i=0; i>> 1) | ((x & 0x55555555) << 1)); - x = (((x & 0xcccccccc) >>> 2) | ((x & 0x33333333) << 2)); - x = (((x & 0xf0f0f0f0) >>> 4) | ((x & 0x0f0f0f0f) << 4)); - x = (((x & 0xff00ff00) >>> 8) | ((x & 0x00ff00ff) << 8)); - U.rev15[i] = (((x >>> 16) | (x << 16)))>>>17; - } - - function pushV(tgt, n, sv) { while(n--!=0) tgt.push(0,sv); } - - for(var i=0; i<32; i++) { U.ldef[i]=(U.of0[i]<<3)|U.exb[i]; U.ddef[i]=(U.df0[i]<<4)|U.dxb[i]; } - - pushV(U.fltree, 144, 8); pushV(U.fltree, 255-143, 9); pushV(U.fltree, 279-255, 7); pushV(U.fltree,287-279,8); - /* - var i = 0; - for(; i<=143; i++) U.fltree.push(0,8); - for(; i<=255; i++) U.fltree.push(0,9); - for(; i<=279; i++) U.fltree.push(0,7); - for(; i<=287; i++) U.fltree.push(0,8); - */ - UZIP.F.makeCodes(U.fltree, 9); - UZIP.F.codes2map(U.fltree, 9, U.flmap); - UZIP.F.revCodes (U.fltree, 9) - - pushV(U.fdtree,32,5); - //for(i=0;i<32; i++) U.fdtree.push(0,5); - UZIP.F.makeCodes(U.fdtree, 5); - UZIP.F.codes2map(U.fdtree, 5, U.fdmap); - UZIP.F.revCodes (U.fdtree, 5) - - pushV(U.itree,19,0); pushV(U.ltree,286,0); pushV(U.dtree,30,0); pushV(U.ttree,320,0); - /* - for(var i=0; i< 19; i++) U.itree.push(0,0); - for(var i=0; i<286; i++) U.ltree.push(0,0); - for(var i=0; i< 30; i++) U.dtree.push(0,0); - for(var i=0; i<320; i++) U.ttree.push(0,0); - */ -})() - - - - - - - - - - - - - - - - - - + + +var UZIP = {}; +if(true) module.exports = UZIP; + + +UZIP["parse"] = function(buf, onlyNames) // ArrayBuffer +{ + var rUs = UZIP.bin.readUshort, rUi = UZIP.bin.readUint, o = 0, out = {}; + var data = new Uint8Array(buf); + var eocd = data.length-4; + + while(rUi(data, eocd)!=0x06054b50) eocd--; + + var o = eocd; + o+=4; // sign = 0x06054b50 + o+=4; // disks = 0; + var cnu = rUs(data, o); o+=2; + var cnt = rUs(data, o); o+=2; + + var csize = rUi(data, o); o+=4; + var coffs = rUi(data, o); o+=4; + + o = coffs; + for(var i=0; i8514000) { + //console.log(PUtils.readASCII(buf , 8514500, 500)); + //console.log(PUtils.readASCII(nbuf, 8514500, 500)); + } + for(var i=0; i>>4); + //console.log(CM, CINFO,CMF,FLG); + return UZIP.inflateRaw(new Uint8Array(file.buffer, file.byteOffset+2, file.length-6), buf); +} +UZIP.deflate = function(data, opts/*, buf, off*/) { + if(opts==null) opts={level:6}; + var off=0, buf=new Uint8Array(50+Math.floor(data.length*1.1)); + buf[off]=120; buf[off+1]=156; off+=2; + off = UZIP.F.deflateRaw(data, buf, off, opts.level); + var crc = UZIP.adler(data, 0, data.length); + buf[off+0]=((crc>>>24)&255); + buf[off+1]=((crc>>>16)&255); + buf[off+2]=((crc>>> 8)&255); + buf[off+3]=((crc>>> 0)&255); + return new Uint8Array(buf.buffer, 0, off+4); +} +UZIP.deflateRaw = function(data, opts) { + if(opts==null) opts={level:6}; + var buf=new Uint8Array(50+Math.floor(data.length*1.1)); + var off = UZIP.F.deflateRaw(data, buf, off, opts.level); + return new Uint8Array(buf.buffer, 0, off); +} + + +UZIP.encode = function(obj, noCmpr) { + if(noCmpr==null) noCmpr=false; + var tot = 0, wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort; + var zpd = {}; + for(var p in obj) { var cpr = !UZIP._noNeed(p) && !noCmpr, buf = obj[p], crc = UZIP.crc.crc(buf,0,buf.length); + zpd[p] = { cpr:cpr, usize:buf.length, crc:crc, file: (cpr ? UZIP.deflateRaw(buf) : buf) }; } + + for(var p in zpd) tot += zpd[p].file.length + 30 + 46 + 2*UZIP.bin.sizeUTF8(p); + tot += 22; + + var data = new Uint8Array(tot), o = 0; + var fof = [] + + for(var p in zpd) { + var file = zpd[p]; fof.push(o); + o = UZIP._writeHeader(data, o, p, file, 0); + } + var i=0, ioff = o; + for(var p in zpd) { + var file = zpd[p]; fof.push(o); + o = UZIP._writeHeader(data, o, p, file, 1, fof[i++]); + } + var csize = o-ioff; + + wUi(data, o, 0x06054b50); o+=4; + o += 4; // disks + wUs(data, o, i); o += 2; + wUs(data, o, i); o += 2; // number of c d records + wUi(data, o, csize); o += 4; + wUi(data, o, ioff ); o += 4; + o += 2; + return data.buffer; +} +// no need to compress .PNG, .ZIP, .JPEG .... +UZIP._noNeed = function(fn) { var ext = fn.split(".").pop().toLowerCase(); return "png,jpg,jpeg,zip".indexOf(ext)!=-1; } + +UZIP._writeHeader = function(data, o, p, obj, t, roff) +{ + var wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort; + var file = obj.file; + + wUi(data, o, t==0 ? 0x04034b50 : 0x02014b50); o+=4; // sign + if(t==1) o+=2; // ver made by + wUs(data, o, 20); o+=2; // ver + wUs(data, o, 0); o+=2; // gflip + wUs(data, o, obj.cpr?8:0); o+=2; // cmpr + + wUi(data, o, 0); o+=4; // time + wUi(data, o, obj.crc); o+=4; // crc32 + wUi(data, o, file.length); o+=4; // csize + wUi(data, o, obj.usize); o+=4; // usize + + wUs(data, o, UZIP.bin.sizeUTF8(p)); o+=2; // nlen + wUs(data, o, 0); o+=2; // elen + + if(t==1) { + o += 2; // comment length + o += 2; // disk number + o += 6; // attributes + wUi(data, o, roff); o+=4; // usize + } + var nlen = UZIP.bin.writeUTF8(data, o, p); o+= nlen; + if(t==0) { data.set(file, o); o += file.length; } + return o; +} + + + + + +UZIP.crc = { + table : ( function() { + var tab = new Uint32Array(256); + for (var n=0; n<256; n++) { + var c = n; + for (var k=0; k<8; k++) { + if (c & 1) c = 0xedb88320 ^ (c >>> 1); + else c = c >>> 1; + } + tab[n] = c; } + return tab; })(), + update : function(c, buf, off, len) { + for (var i=0; i>> 8); + return c; + }, + crc : function(b,o,l) { return UZIP.crc.update(0xffffffff,b,o,l) ^ 0xffffffff; } +} +UZIP.adler = function(data,o,len) { + var a = 1, b = 0; + var off = o, end=o+len; + while(off>8)&255; }, + readUint : function(buff,p) { return (buff[p+3]*(256*256*256)) + ((buff[p+2]<<16) | (buff[p+1]<< 8) | buff[p]); }, + writeUint : function(buff,p,n){ buff[p]=n&255; buff[p+1]=(n>>8)&255; buff[p+2]=(n>>16)&255; buff[p+3]=(n>>24)&255; }, + readASCII : function(buff,p,l){ var s = ""; for(var i=0; i> 6)); buff[p+i+1] = (128|((code>> 0)&63)); i+=2; } + else if((code&(0xffffffff-(1<<16)+1))==0) { buff[p+i] = (224|(code>>12)); buff[p+i+1] = (128|((code>> 6)&63)); buff[p+i+2] = (128|((code>>0)&63)); i+=3; } + else if((code&(0xffffffff-(1<<21)+1))==0) { buff[p+i] = (240|(code>>18)); buff[p+i+1] = (128|((code>>12)&63)); buff[p+i+2] = (128|((code>>6)&63)); buff[p+i+3] = (128|((code>>0)&63)); i+=4; } + else throw "e"; + } + return i; + }, + sizeUTF8 : function(str) { + var strl = str.length, i=0; + for(var ci=0; ci>>3; + } + + var lits = U.lits, strt=U.strt, prev=U.prev, li=0, lc=0, bs=0, ebits=0, c=0, nc=0; // last_item, literal_count, block_start + if(dlen>2) { nc=UZIP.F._hash(data,0); strt[nc]=0; } + var nmch=0,nmci=0; + + for(i=0; i14000 || lc>26697) && (dlen-i)>100) { + if(cvrd>>16)>>16)>(mch>>>16)) mch=0; + }//*/ + var len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw "e"; + if(mch!=0) { + var len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw "e"; + var lgi = goodIndex(len, U.of0); U.lhst[257+lgi]++; + var dgi = goodIndex(dst, U.df0); U.dhst[ dgi]++; ebits += U.exb[lgi] + U.dxb[dgi]; + lits[li] = (len<<23)|(i-cvrd); lits[li+1] = (dst<<16)|(lgi<<8)|dgi; li+=2; + cvrd = i + len; + } + else { U.lhst[data[i]]++; } + lc++; + } + } + if(bs!=i || data.length==0) { + if(cvrd>>3; +} +UZIP.F._bestMatch = function(data, i, prev, c, nice, chain) { + var ci = (i&0x7fff), pi=prev[ci]; + //console.log("----", i); + var dif = ((ci-pi + (1<<15)) & 0x7fff); if(pi==ci || c!=UZIP.F._hash(data,i-dif)) return 0; + var tl=0, td=0; // top length, top distance + var dlim = Math.min(0x7fff, i); + while(dif<=dlim && --chain!=0 && pi!=ci /*&& c==UZIP.F._hash(data,i-dif)*/) { + if(tl==0 || (data[i+tl]==data[i+tl-dif])) { + var cl = UZIP.F._howLong(data, i, dif); + if(cl>tl) { + tl=cl; td=dif; if(tl>=nice) break; //* + if(dif+2maxd) { maxd=curd; pi = ei; } + } //*/ + } + } + + ci=pi; pi = prev[ci]; + dif += ((ci-pi + (1<<15)) & 0x7fff); + } + return (tl<<16)|td; +} +UZIP.F._howLong = function(data, i, dif) { + if(data[i]!=data[i-dif] || data[i+1]!=data[i+1-dif] || data[i+2]!=data[i+2-dif]) return 0; + var oi=i, l = Math.min(data.length, i+258); i+=3; + //while(i+4>>23), end = off+(qb&((1<<23)-1)); + while(off>16), lgi=(qc>>8)&255, dgi=(qc&255); + pos = UZIP.F._writeLit(257+lgi, ltree, out, pos); + putsE(out, pos, len-U.of0[lgi]); pos+=U.exb[lgi]; + + pos = UZIP.F._writeLit(dgi, dtree, out, pos); + putsF(out, pos, dst-U.df0[dgi]); pos+=U.dxb[dgi]; off+=len; + } + } + pos = UZIP.F._writeLit(256, ltree, out, pos); + } + //console.log(pos-opos, fxdSize, dynSize, cstSize); + return pos; +} +UZIP.F._copyExact = function(data,off,len,out,pos) { + var p8 = (pos>>>3); + out[p8]=(len); out[p8+1]=(len>>>8); out[p8+2]=255-out[p8]; out[p8+3]=255-out[p8+1]; p8+=4; + out.set(new Uint8Array(data.buffer, off, len), p8); + //for(var i=0; i4 && U.itree[(U.ordr[numh-1]<<1)+1]==0) numh--; + return [ML, MD, MH, numl, numd, numh, lset, dset]; +} +UZIP.F.getSecond= function(a) { var b=[]; for(var i=0; i>1)+","; return b; } +UZIP.F.contSize = function(tree, hst) { var s=0; for(var i=0; i15) { UZIP.F._putsE(out, pos, rst, rsl); pos+=rsl; } + } + return pos; +} +UZIP.F._lenCodes = function(tree, set) { + var len=tree.length; while(len!=2 && tree[len-1]==0) len-=2; // when no distances, keep one code with length 0 + for(var i=0; i>>1, 138); + if(zc<11) set.push(17, zc-3); + else set.push(18, zc-11); + i += zc*2-2; + } + else if(l==prv && nxt==l && nnxt==l) { + var lz = i+5; + while(lz+2>>1, 6); + set.push(16, zc-3); + i += zc*2-2; + } + else set.push(l, 0); + } + return len>>>1; +} +UZIP.F._hufTree = function(hst, tree, MAXL) { + var list=[], hl = hst.length, tl=tree.length, i=0; + for(i=0; iMAXL) { UZIP.F.restrictDepth(l2, MAXL, maxl); maxl = MAXL; } + for(i=0; iMD) { var od=dps[i].d; dps[i].d=MD; dbt+=bCost-(1<<(maxl-od)); } else break; + dbt = dbt>>>(maxl-MD); + while(dbt>0) { var od=dps[i].d; if(od=0; i--) if(dps[i].d==MD && dbt<0) { dps[i].d--; dbt++; } if(dbt!=0) console.log("debt left"); +} + +UZIP.F._goodIndex = function(v, arr) { + var i=0; if(arr[i|16]<=v) i|=16; if(arr[i|8]<=v) i|=8; if(arr[i|4]<=v) i|=4; if(arr[i|2]<=v) i|=2; if(arr[i|1]<=v) i|=1; return i; +} +UZIP.F._writeLit = function(ch, ltree, out, pos) { + UZIP.F._putsF(out, pos, ltree[ch<<1]); + return pos+ltree[(ch<<1)+1]; +} + + + + + + + + +UZIP.F.inflate = function(data, buf) { + var u8=Uint8Array; + if(data[0]==3 && data[1]==0) return (buf ? buf : new u8(0)); + var F=UZIP.F, bitsF = F._bitsF, bitsE = F._bitsE, decodeTiny = F._decodeTiny, makeCodes = F.makeCodes, codes2map=F.codes2map, get17 = F._get17; + var U = F.U; + + var noBuf = (buf==null); + if(noBuf) buf = new u8((data.length>>>2)<<3); + + var BFINAL=0, BTYPE=0, HLIT=0, HDIST=0, HCLEN=0, ML=0, MD=0; + var off = 0, pos = 0; + var lmap, dmap; + + while(BFINAL==0) { + BFINAL = bitsF(data, pos , 1); + BTYPE = bitsF(data, pos+1, 2); pos+=3; + //console.log(BFINAL, BTYPE); + + if(BTYPE==0) { + if((pos&7)!=0) pos+=8-(pos&7); + var p8 = (pos>>>3)+4, len = data[p8-4]|(data[p8-3]<<8); //console.log(len);//bitsF(data, pos, 16), + if(noBuf) buf=UZIP.F._check(buf, off+len); + buf.set(new u8(data.buffer, data.byteOffset+p8, len), off); + //for(var i=0; itl)tl=l; } pos+=3*HCLEN; //console.log(itree); + makeCodes(U.itree, tl); + codes2map(U.itree, tl, U.imap); + + lmap = U.lmap; dmap = U.dmap; + + pos = decodeTiny(U.imap, (1<>>24))-1; pos+=(ml&0xffffff); + makeCodes(U.ltree, mx0); + codes2map(U.ltree, mx0, lmap); + + //var md = decodeTiny(U.imap, (1<>>24))-1; pos+=(md&0xffffff); + makeCodes(U.dtree, mx1); + codes2map(U.dtree, mx1, dmap); + } + //var ooff=off, opos=pos; + while(true) { + var code = lmap[get17(data, pos) & ML]; pos += code&15; + var lit = code>>>4; //U.lhst[lit]++; + if((lit>>>8)==0) { buf[off++] = lit; } + else if(lit==256) { break; } + else { + var end = off+lit-254; + if(lit>264) { var ebs = U.ldef[lit-257]; end = off + (ebs>>>3) + bitsE(data, pos, ebs&7); pos += ebs&7; } + //UZIP.F.dst[end-off]++; + + var dcode = dmap[get17(data, pos) & MD]; pos += dcode&15; + var dlit = dcode>>>4; + var dbs = U.ddef[dlit], dst = (dbs>>>4) + bitsF(data, pos, dbs&15); pos += dbs&15; + + //var o0 = off-dst, stp = Math.min(end-off, dst); + //if(stp>20) while(off>>3); + } + //console.log(UZIP.F.dst); + //console.log(tlen, dlen, off-tlen+tcnt); + return buf.length==off ? buf : buf.slice(0,off); +} +UZIP.F._check=function(buf, len) { + var bl=buf.length; if(len<=bl) return buf; + var nbuf = new Uint8Array(Math.max(bl<<1,len)); nbuf.set(buf,0); + //for(var i=0; i>>4; + if(lit<=15) { tree[i]=lit; i++; } + else { + var ll = 0, n = 0; + if(lit==16) { + n = (3 + bitsE(data, pos, 2)); pos += 2; ll = tree[i-1]; + } + else if(lit==17) { + n = (3 + bitsE(data, pos, 3)); pos += 3; + } + else if(lit==18) { + n = (11 + bitsE(data, pos, 7)); pos += 7; + } + var ni = i+n; + while(i>>1; + while(imx)mx=v; i++; } + while(i>1; + var cl = tree[i+1], val = (lit<<4)|cl; // : (0x8000 | (U.of0[lit-257]<<7) | (U.exb[lit-257]<<4) | cl); + var rest = (MAX_BITS-cl), i0 = tree[i]<>>(15-MAX_BITS); + while(i0!=i1) { + var p0 = r15[i0]>>>(15-MAX_BITS); + map[p0]=val; i0++; + } + } +} +UZIP.F.revCodes = function(tree, MAX_BITS) { + var r15 = UZIP.F.U.rev15, imb = 15-MAX_BITS; + for(var i=0; i>>imb; } +} + +// used only in deflate +UZIP.F._putsE= function(dt, pos, val ) { val = val<<(pos&7); var o=(pos>>>3); dt[o]|=val; dt[o+1]|=(val>>>8); } +UZIP.F._putsF= function(dt, pos, val ) { val = val<<(pos&7); var o=(pos>>>3); dt[o]|=val; dt[o+1]|=(val>>>8); dt[o+2]|=(val>>>16); } + +UZIP.F._bitsE= function(dt, pos, length) { return ((dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) )>>>(pos&7))&((1<>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16))>>>(pos&7))&((1<>>3] | (dt[(pos>>>3)+1]<<8))>>>(pos&7))&511; +} */ +UZIP.F._get17= function(dt, pos) { // return at least 17 meaningful bytes + return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) )>>>(pos&7); +} +UZIP.F._get25= function(dt, pos) { // return at least 17 meaningful bytes + return (dt[pos>>>3] | (dt[(pos>>>3)+1]<<8) | (dt[(pos>>>3)+2]<<16) | (dt[(pos>>>3)+3]<<24) )>>>(pos&7); +} +UZIP.F.U = function(){ + var u16=Uint16Array, u32=Uint32Array; + return { + next_code : new u16(16), + bl_count : new u16(16), + ordr : [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], + of0 : [3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999], + exb : [0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0], + ldef : new u16(32), + df0 : [1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 65535, 65535], + dxb : [0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0], + ddef : new u32(32), + flmap: new u16( 512), fltree: [], + fdmap: new u16( 32), fdtree: [], + lmap : new u16(32768), ltree : [], ttree:[], + dmap : new u16(32768), dtree : [], + imap : new u16( 512), itree : [], + //rev9 : new u16( 512) + rev15: new u16(1<<15), + lhst : new u32(286), dhst : new u32( 30), ihst : new u32(19), + lits : new u32(15000), + strt : new u16(1<<16), + prev : new u16(1<<15) + }; +} (); + +(function(){ + var U = UZIP.F.U; + var len = 1<<15; + for(var i=0; i>> 1) | ((x & 0x55555555) << 1)); + x = (((x & 0xcccccccc) >>> 2) | ((x & 0x33333333) << 2)); + x = (((x & 0xf0f0f0f0) >>> 4) | ((x & 0x0f0f0f0f) << 4)); + x = (((x & 0xff00ff00) >>> 8) | ((x & 0x00ff00ff) << 8)); + U.rev15[i] = (((x >>> 16) | (x << 16)))>>>17; + } + + function pushV(tgt, n, sv) { while(n--!=0) tgt.push(0,sv); } + + for(var i=0; i<32; i++) { U.ldef[i]=(U.of0[i]<<3)|U.exb[i]; U.ddef[i]=(U.df0[i]<<4)|U.dxb[i]; } + + pushV(U.fltree, 144, 8); pushV(U.fltree, 255-143, 9); pushV(U.fltree, 279-255, 7); pushV(U.fltree,287-279,8); + /* + var i = 0; + for(; i<=143; i++) U.fltree.push(0,8); + for(; i<=255; i++) U.fltree.push(0,9); + for(; i<=279; i++) U.fltree.push(0,7); + for(; i<=287; i++) U.fltree.push(0,8); + */ + UZIP.F.makeCodes(U.fltree, 9); + UZIP.F.codes2map(U.fltree, 9, U.flmap); + UZIP.F.revCodes (U.fltree, 9) + + pushV(U.fdtree,32,5); + //for(i=0;i<32; i++) U.fdtree.push(0,5); + UZIP.F.makeCodes(U.fdtree, 5); + UZIP.F.codes2map(U.fdtree, 5, U.fdmap); + UZIP.F.revCodes (U.fdtree, 5) + + pushV(U.itree,19,0); pushV(U.ltree,286,0); pushV(U.dtree,30,0); pushV(U.ttree,320,0); + /* + for(var i=0; i< 19; i++) U.itree.push(0,0); + for(var i=0; i<286; i++) U.ltree.push(0,0); + for(var i=0; i< 30; i++) U.dtree.push(0,0); + for(var i=0; i<320; i++) U.ttree.push(0,0); + */ +})() + + + + + + + + + + + + + + + + + + /***/ }), @@ -32399,7 +32399,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); (async function () { const owner = "replayableio"; const repo = "testdriver"; - const branch = "michael/flag-based-action-or-bot"; + const branch = "main"; const dispatchWorkflow = "interpret-comment.yml"; const octokit = github.getOctokit(process.env.GH_TOKEN); diff --git a/src/index.js b/src/index.js index 5d8b095..0233ef0 100644 --- a/src/index.js +++ b/src/index.js @@ -15,7 +15,7 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms)); (async function () { const owner = "replayableio"; const repo = "testdriver"; - const branch = "michael/flag-based-action-or-bot"; + const branch = "main"; const dispatchWorkflow = "interpret-comment.yml"; const octokit = github.getOctokit(process.env.GH_TOKEN);