@n1k1t/mock-server 0.1.78 → 0.1.79
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/lib/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import type { Socket as ClientSocket } from 'socket.io-client';
|
|
2
2
|
import type { Socket as ServerSocket } from 'socket.io';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Duplex, Stream } from 'stream';
|
|
4
4
|
import type { TFunction } from '../../types';
|
|
5
5
|
export type TSocketIoStreamFunction = (socket: ServerSocket | ClientSocket) => {
|
|
6
|
-
emit: <
|
|
7
|
-
on: <
|
|
8
|
-
once: <
|
|
6
|
+
emit: <T extends object = object>(event: string, stream: Stream, parameters: T) => void;
|
|
7
|
+
on: <T extends object = object>(event: string, handler: TFunction<unknown, [Stream, T]>) => void;
|
|
8
|
+
once: <T extends object = object>(event: string, handler: TFunction<unknown, [Stream, T]>) => void;
|
|
9
9
|
};
|
|
10
10
|
export type TSocketIoStreamPackage = TSocketIoStreamFunction & {
|
|
11
|
-
createStream: (
|
|
12
|
-
|
|
11
|
+
createStream: (options?: {
|
|
12
|
+
highWaterMark?: number;
|
|
13
|
+
}) => Duplex;
|
|
14
|
+
createBlobReadStream: (file: File, options?: {
|
|
15
|
+
highWaterMark?: number;
|
|
16
|
+
}) => Stream;
|
|
13
17
|
};
|
|
14
18
|
export declare const socketIoStream: TSocketIoStreamPackage;
|
|
15
19
|
//# sourceMappingURL=io-stream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io-stream.d.ts","sourceRoot":"","sources":["../../../src/utils/io-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
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EAAI,sBAAkD,CAAC"}
|
package/package.json
CHANGED
|
@@ -500,7 +500,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
500
500
|
<p class="version"><span>Version</span><b>{{version}}</b></p>
|
|
501
501
|
<p class="version"><span>Uptime</span><b>{{uptime}}</b></p>
|
|
502
502
|
</div>
|
|
503
|
-
`,$s={cacheRestoration:Fe.compile(M3),cacheDeletion:Fe.compile(C3),cacheBackup:Fe.compile(P3),section:Fe.compile(O3),stats:Fe.compile(L3)},Qn={stats:Ar.build({title:{text:"Stats",icon:"fas fa-server"},class:"stats",height:"XS",width:"M"}),cacheDeletion:Ar.build({title:{text:"Cache deletion",icon:"fas fa-database"},class:"cache",height:"XS",width:"M"}).replace($s.cacheDeletion({})),cacheBackup:Ar.build({title:{text:"Cache backup",icon:"fas fa-database"},class:"cache",height:"XS",width:"M"}).replace($s.cacheBackup({})),cacheRestoration:Ar.build({title:{text:"Cache restoration",icon:"fas fa-database"},class:"cache",height:"XS",width:"M"}).replace($s.cacheRestoration({}))},x_=ts.build($s.section({})).assignMeta({icon:"fas fa-cog"}).once("initialize",async n=>{n.content.append(Qn.stats),n.content.append(Qn.cacheDeletion),n.content.append(Qn.cacheBackup),n.content.append(Qn.cacheRestoration),$r.build(Qn.cacheDeletion.element.querySelector("button#delete")).handle(async()=>{var r;const t=await Gs.build(Qn.cacheDeletion).extract(),{data:e}=await Nt.services.io.exec("cache:delete",{prefix:t.prefix});Nt.shared.popups.push(`Deleted <b>${((r=e.redis)==null?void 0:r.count)??0}</b> cache keys`)}),$r.build(Qn.cacheBackup.element.querySelector("button#backup")).handle(async()=>{const{data:t}=await Nt.services.io.exec("cache:backup"),e=document.createElement("a"),r=new Date;e.download=`mock-server-cache-backup-${r.toLocaleDateString()}-${r.getTime()}.txt`,e.href=URL.createObjectURL(new Blob([t],{type:"text"})),e.click()}),$r.build(Qn.cacheRestoration.element.querySelector("button#restore")).handle(async()=>{var
|
|
503
|
+
`,$s={cacheRestoration:Fe.compile(M3),cacheDeletion:Fe.compile(C3),cacheBackup:Fe.compile(P3),section:Fe.compile(O3),stats:Fe.compile(L3)},Qn={stats:Ar.build({title:{text:"Stats",icon:"fas fa-server"},class:"stats",height:"XS",width:"M"}),cacheDeletion:Ar.build({title:{text:"Cache deletion",icon:"fas fa-database"},class:"cache",height:"XS",width:"M"}).replace($s.cacheDeletion({})),cacheBackup:Ar.build({title:{text:"Cache backup",icon:"fas fa-database"},class:"cache",height:"XS",width:"M"}).replace($s.cacheBackup({})),cacheRestoration:Ar.build({title:{text:"Cache restoration",icon:"fas fa-database"},class:"cache",height:"XS",width:"M"}).replace($s.cacheRestoration({}))},x_=ts.build($s.section({})).assignMeta({icon:"fas fa-cog"}).once("initialize",async n=>{n.content.append(Qn.stats),n.content.append(Qn.cacheDeletion),n.content.append(Qn.cacheBackup),n.content.append(Qn.cacheRestoration),$r.build(Qn.cacheDeletion.element.querySelector("button#delete")).handle(async()=>{var r;const t=await Gs.build(Qn.cacheDeletion).extract(),{data:e}=await Nt.services.io.exec("cache:delete",{prefix:t.prefix});Nt.shared.popups.push(`Deleted <b>${((r=e.redis)==null?void 0:r.count)??0}</b> cache keys`)}),$r.build(Qn.cacheBackup.element.querySelector("button#backup")).handle(async()=>{const{data:t}=await Nt.services.io.exec("cache:backup"),e=document.createElement("a"),r=new Date;e.download=`mock-server-cache-backup-${r.toLocaleDateString()}-${r.getTime()}.txt`,e.href=URL.createObjectURL(new Blob([t],{type:"text"})),e.click()}),$r.build(Qn.cacheRestoration.element.querySelector("button#restore")).handle(async()=>{var s;const t=await Gs.build(Qn.cacheRestoration).extract();if(!((s=t.files)!=null&&s.length))return Nt.shared.popups.push("File is not provided",{level:"warning"});const e=1024*1024*300,r=t.files[0],i=Mf.createStream({highWaterMark:e});Mf(Nt.instances.io).emit("cache:restore:stream",i,{ttl:t.ttl}),Mf.createBlobReadStream(r.source,{highWaterMark:e}).pipe(i),await new Promise(a=>i.once("finish",a)),Nt.shared.popups.push("Restored")})}).on("select",async()=>{const{data:n}=await Nt.services.io.exec("stats");Qn.stats.replace($s.stats(n))}),T3=`
|
|
504
504
|
<section id="history">
|
|
505
505
|
<div class="storage"></div>
|
|
506
506
|
|
package/public/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link type="image/png" sizes="120x120" rel="icon" href="./assets/favicon-rsW1wnD3.png">
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-BXPxP7__.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-D49L1fdH.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|