@peerbit/server 5.2.3 → 5.3.0
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/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +18 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/client.d.ts +2 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +24 -9
- package/dist/src/client.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/assets/index-C2EeKc-J.js +66 -0
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/src/cli.ts +18 -0
- package/src/client.ts +44 -21
- package/dist/ui/assets/index-DfjdQIsv.js +0 -66
package/dist/ui/index.html
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
Learn how to configure a non-root public URL by running `npm run build`.
|
|
24
24
|
-->
|
|
25
25
|
<title>Peerbit</title>
|
|
26
|
-
<script type="module" crossorigin src="/assets/index-
|
|
26
|
+
<script type="module" crossorigin src="/assets/index-C2EeKc-J.js"></script>
|
|
27
27
|
<link rel="stylesheet" crossorigin href="/assets/index-CIfVvUo9.css">
|
|
28
28
|
</head>
|
|
29
29
|
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -956,6 +956,15 @@ export const cli = async (args?: string[]) => {
|
|
|
956
956
|
}
|
|
957
957
|
},
|
|
958
958
|
})
|
|
959
|
+
.command({
|
|
960
|
+
command: "drop-all",
|
|
961
|
+
describe: "Drop all programs",
|
|
962
|
+
handler: async () => {
|
|
963
|
+
for (const api of apis) {
|
|
964
|
+
await api.api.program.dropAll();
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
})
|
|
959
968
|
.command({
|
|
960
969
|
command: "close <address>",
|
|
961
970
|
describe: "Close a program",
|
|
@@ -974,6 +983,15 @@ export const cli = async (args?: string[]) => {
|
|
|
974
983
|
}
|
|
975
984
|
},
|
|
976
985
|
})
|
|
986
|
+
.command({
|
|
987
|
+
command: "close-all",
|
|
988
|
+
describe: "Close all programs",
|
|
989
|
+
handler: async () => {
|
|
990
|
+
for (const api of apis) {
|
|
991
|
+
await api.api.program.closeAll();
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
})
|
|
977
995
|
.command({
|
|
978
996
|
command: "list",
|
|
979
997
|
describe: "List all running programs",
|
package/src/client.ts
CHANGED
|
@@ -87,6 +87,32 @@ export const createClient = async (
|
|
|
87
87
|
}),
|
|
88
88
|
).data;
|
|
89
89
|
|
|
90
|
+
const close = async (address: string) => {
|
|
91
|
+
return throwIfNot200(
|
|
92
|
+
await axiosInstance.delete(
|
|
93
|
+
endpoint + PROGRAM_PATH + "/" + encodeURIComponent(address.toString()),
|
|
94
|
+
{
|
|
95
|
+
validateStatus,
|
|
96
|
+
},
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const drop = async (address: string) => {
|
|
102
|
+
return throwIfNot200(
|
|
103
|
+
await axiosInstance.delete(
|
|
104
|
+
endpoint +
|
|
105
|
+
PROGRAM_PATH +
|
|
106
|
+
"/" +
|
|
107
|
+
encodeURIComponent(address.toString()) +
|
|
108
|
+
"?delete=true",
|
|
109
|
+
{
|
|
110
|
+
validateStatus,
|
|
111
|
+
},
|
|
112
|
+
),
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
90
116
|
return {
|
|
91
117
|
peer: {
|
|
92
118
|
id: {
|
|
@@ -173,32 +199,29 @@ export const createClient = async (
|
|
|
173
199
|
},
|
|
174
200
|
|
|
175
201
|
close: async (address: string): Promise<void> => {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
),
|
|
202
|
+
await close(address);
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
closeAll: async (): Promise<void> => {
|
|
206
|
+
const resp = throwIfNot200(
|
|
207
|
+
await axiosInstance.get(endpoint + PROGRAMS_PATH, {
|
|
208
|
+
validateStatus,
|
|
209
|
+
}),
|
|
186
210
|
);
|
|
211
|
+
await Promise.all(resp.data.map((address: string) => close(address)));
|
|
187
212
|
},
|
|
188
213
|
|
|
189
214
|
drop: async (address: string): Promise<void> => {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
validateStatus,
|
|
199
|
-
},
|
|
200
|
-
),
|
|
215
|
+
await drop(address);
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
dropAll: async (): Promise<void> => {
|
|
219
|
+
const resp = throwIfNot200(
|
|
220
|
+
await axiosInstance.get(endpoint + PROGRAMS_PATH, {
|
|
221
|
+
validateStatus,
|
|
222
|
+
}),
|
|
201
223
|
);
|
|
224
|
+
await Promise.all(resp.data.map((address: string) => drop(address)));
|
|
202
225
|
},
|
|
203
226
|
|
|
204
227
|
list: async (): Promise<string[]> => {
|