@caido-utils/backend 0.5.0 → 0.5.2
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/index.d.ts +1 -3
- package/dist/index.js +8 -6
- package/dist/pool/index.d.ts +2 -0
- package/dist/pool/index.js +1 -0
- package/dist/process/index.d.ts +1 -0
- package/dist/process/index.js +1 -0
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +1 -0
- package/dist/requests/index.d.ts +2 -0
- package/dist/requests/index.js +2 -0
- package/dist/{requests.d.ts → requests/query.d.ts} +1 -0
- package/dist/requests/query.js +73 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +1 -0
- package/package.json +1 -1
- package/dist/requests.js +0 -25
- /package/dist/{pool.d.ts → pool/pool.d.ts} +0 -0
- /package/dist/{pool.js → pool/pool.js} +0 -0
- /package/dist/{process.d.ts → process/spawn.d.ts} +0 -0
- /package/dist/{process.js → process/spawn.js} +0 -0
- /package/dist/{project.d.ts → project/project.d.ts} +0 -0
- /package/dist/{project.js → project/project.js} +0 -0
- /package/dist/{fetcher.d.ts → requests/fetcher.d.ts} +0 -0
- /package/dist/{fetcher.js → requests/fetcher.js} +0 -0
- /package/dist/{storage.d.ts → storage/files.d.ts} +0 -0
- /package/dist/{storage.js → storage/files.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export { Fetch, type FetchOptions } from "./fetcher";
|
|
2
1
|
export { createSignal, pausePool, resumePool, runPool, stopPool } from "./pool";
|
|
3
2
|
export type { PoolCallbacks, PoolConfig, PoolSignal } from "./pool";
|
|
4
3
|
export { spawnCommand } from "./process";
|
|
5
4
|
export { getProjectId } from "./project";
|
|
6
|
-
export { queryRequests } from "./requests";
|
|
7
|
-
export type { QueryRequestsOptions } from "./requests";
|
|
5
|
+
export { Fetch, queryRequests, type FetchOptions, type QueryRequestsOptions, } from "./requests";
|
|
8
6
|
export { fileExists, readFile, storeFile } from "./storage";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export { createSignal, pausePool, resumePool, runPool, stopPool } from "./pool/index.js";
|
|
2
|
+
export { spawnCommand } from "./process/index.js";
|
|
3
|
+
export { getProjectId } from "./project/index.js";
|
|
4
|
+
export {
|
|
5
|
+
Fetch,
|
|
6
|
+
queryRequests
|
|
7
|
+
} from "./requests/index.js";
|
|
8
|
+
export { fileExists, readFile, storeFile } from "./storage/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSignal, pausePool, resumePool, runPool, stopPool } from "./pool.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { spawnCommand } from "./spawn";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { spawnCommand } from "./spawn.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getProjectId } from "./project";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getProjectId } from "./project.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const STATIC_EXTENSIONS = [
|
|
2
|
+
"apng",
|
|
3
|
+
"avif",
|
|
4
|
+
"gif",
|
|
5
|
+
"jpg",
|
|
6
|
+
"jpeg",
|
|
7
|
+
"pjpeg",
|
|
8
|
+
"pjp",
|
|
9
|
+
"png",
|
|
10
|
+
"svg",
|
|
11
|
+
"webp",
|
|
12
|
+
"bmp",
|
|
13
|
+
"ico",
|
|
14
|
+
"cur",
|
|
15
|
+
"tif",
|
|
16
|
+
"tiff",
|
|
17
|
+
"css",
|
|
18
|
+
"woff",
|
|
19
|
+
"woff2",
|
|
20
|
+
"ttf",
|
|
21
|
+
"eot",
|
|
22
|
+
"js",
|
|
23
|
+
"mjs",
|
|
24
|
+
"jsx",
|
|
25
|
+
"ts",
|
|
26
|
+
"tsx",
|
|
27
|
+
"map",
|
|
28
|
+
"mp4",
|
|
29
|
+
"webm",
|
|
30
|
+
"ogg",
|
|
31
|
+
"mp3",
|
|
32
|
+
"wav",
|
|
33
|
+
"flac",
|
|
34
|
+
"aac",
|
|
35
|
+
"m4a",
|
|
36
|
+
"avi",
|
|
37
|
+
"mov",
|
|
38
|
+
"wmv",
|
|
39
|
+
"flv",
|
|
40
|
+
"mkv"
|
|
41
|
+
];
|
|
42
|
+
const STATIC_ASSET_FILTER = STATIC_EXTENSIONS.map(
|
|
43
|
+
(ext) => `req.ext.nlike:"%.${ext}"`
|
|
44
|
+
).join(" AND ");
|
|
45
|
+
export async function queryRequests(sdk, options) {
|
|
46
|
+
const pageSize = options?.pageSize ?? 1e3;
|
|
47
|
+
const results = [];
|
|
48
|
+
let cursor = void 0;
|
|
49
|
+
let fullFilter = options?.filter ?? "";
|
|
50
|
+
if (options?.excludeStaticAssets) {
|
|
51
|
+
fullFilter = fullFilter ? `(${fullFilter}) AND ${STATIC_ASSET_FILTER}` : STATIC_ASSET_FILTER;
|
|
52
|
+
}
|
|
53
|
+
while (true) {
|
|
54
|
+
let query = sdk.requests.query().first(pageSize).ascending("req", "created_at");
|
|
55
|
+
if (fullFilter) {
|
|
56
|
+
query = query.filter(fullFilter);
|
|
57
|
+
}
|
|
58
|
+
if (cursor !== void 0) {
|
|
59
|
+
query = query.after(cursor);
|
|
60
|
+
}
|
|
61
|
+
const page = await query.execute();
|
|
62
|
+
if (page.items.length > 0) {
|
|
63
|
+
results.push(...page.items);
|
|
64
|
+
options?.onPage?.(page.items);
|
|
65
|
+
}
|
|
66
|
+
if (page.pageInfo.hasNextPage) {
|
|
67
|
+
cursor = page.pageInfo.endCursor;
|
|
68
|
+
} else {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return results;
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { fileExists, readFile, storeFile } from "./files";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { fileExists, readFile, storeFile } from "./files.js";
|
package/package.json
CHANGED
package/dist/requests.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export async function queryRequests(sdk, options) {
|
|
2
|
-
const pageSize = options?.pageSize ?? 1e3;
|
|
3
|
-
const results = [];
|
|
4
|
-
let cursor = void 0;
|
|
5
|
-
while (true) {
|
|
6
|
-
let query = sdk.requests.query().first(pageSize).ascending("req", "created_at");
|
|
7
|
-
if (options?.filter) {
|
|
8
|
-
query = query.filter(options.filter);
|
|
9
|
-
}
|
|
10
|
-
if (cursor !== void 0) {
|
|
11
|
-
query = query.after(cursor);
|
|
12
|
-
}
|
|
13
|
-
const page = await query.execute();
|
|
14
|
-
if (page.items.length > 0) {
|
|
15
|
-
results.push(...page.items);
|
|
16
|
-
options?.onPage?.(page.items);
|
|
17
|
-
}
|
|
18
|
-
if (page.pageInfo.hasNextPage) {
|
|
19
|
-
cursor = page.pageInfo.endCursor;
|
|
20
|
-
} else {
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return results;
|
|
25
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|