dp-worker 0.1.19 → 0.1.21
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/builtin-skills/x.md +27 -0
- package/dist/bird/bird-frontend.d.ts +58 -0
- package/dist/bird/bird-frontend.js +110 -0
- package/dist/bird/bird-frontend.js.map +1 -0
- package/dist/bird/credentials.d.ts +36 -0
- package/dist/bird/credentials.js +82 -0
- package/dist/bird/credentials.js.map +1 -0
- package/dist/bird/ops.d.ts +103 -0
- package/dist/bird/ops.js +523 -0
- package/dist/bird/ops.js.map +1 -0
- package/dist/bird/sidecar-entry.d.ts +25 -0
- package/dist/bird/sidecar-entry.js +192 -0
- package/dist/bird/sidecar-entry.js.map +1 -0
- package/dist/bird/sidecar-host.d.ts +54 -0
- package/dist/bird/sidecar-host.js +318 -0
- package/dist/bird/sidecar-host.js.map +1 -0
- package/dist/bird/socks-connector.d.ts +26 -0
- package/dist/bird/socks-connector.js +49 -0
- package/dist/bird/socks-connector.js.map +1 -0
- package/dist/browser/cloakbrowser-backend.js +10 -27
- package/dist/browser/cloakbrowser-backend.js.map +1 -1
- package/dist/chrome-extension/omni-flow/manifest.json +1 -1
- package/dist/config/center-config.d.ts +8 -0
- package/dist/config/center-config.js +1 -0
- package/dist/config/center-config.js.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/node_modules/dp-shared/dist/admin-broadcast.d.ts +1 -1
- package/node_modules/dp-shared/dist/admin-broadcast.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/bird-contracts.d.ts +487 -0
- package/node_modules/dp-shared/dist/bird-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/bird-contracts.js +381 -0
- package/node_modules/dp-shared/dist/bird-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/configs-contracts.d.ts +11 -1
- package/node_modules/dp-shared/dist/configs-contracts.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/configs-contracts.js +43 -0
- package/node_modules/dp-shared/dist/configs-contracts.js.map +1 -1
- package/node_modules/dp-shared/dist/index.d.ts +2 -0
- package/node_modules/dp-shared/dist/index.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/index.js +2 -0
- package/node_modules/dp-shared/dist/index.js.map +1 -1
- package/node_modules/dp-shared/dist/post-drafts-contracts.d.ts +9 -3
- package/node_modules/dp-shared/dist/post-drafts-contracts.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/post-drafts-contracts.js +34 -0
- package/node_modules/dp-shared/dist/post-drafts-contracts.js.map +1 -1
- package/node_modules/dp-shared/dist/promo-contracts.d.ts +651 -0
- package/node_modules/dp-shared/dist/promo-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/promo-contracts.js +566 -0
- package/node_modules/dp-shared/dist/promo-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/rest-contracts.d.ts +73 -0
- package/node_modules/dp-shared/dist/rest-contracts.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/rest-contracts.js +70 -0
- package/node_modules/dp-shared/dist/rest-contracts.js.map +1 -1
- package/node_modules/dp-shared/dist/smart-money-contracts.d.ts +86 -0
- package/node_modules/dp-shared/dist/smart-money-contracts.d.ts.map +1 -0
- package/node_modules/dp-shared/dist/smart-money-contracts.js +71 -0
- package/node_modules/dp-shared/dist/smart-money-contracts.js.map +1 -0
- package/node_modules/dp-shared/dist/task-history-contracts.d.ts +2 -0
- package/node_modules/dp-shared/dist/task-history-contracts.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/task-history-contracts.js +2 -0
- package/node_modules/dp-shared/dist/task-history-contracts.js.map +1 -1
- package/node_modules/dp-shared/dist/worker-detail-contracts.d.ts +7 -0
- package/node_modules/dp-shared/dist/worker-detail-contracts.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/worker-detail-contracts.js +9 -0
- package/node_modules/dp-shared/dist/worker-detail-contracts.js.map +1 -1
- package/node_modules/dp-shared/dist/ws-protocol.d.ts +52 -0
- package/node_modules/dp-shared/dist/ws-protocol.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/ws-protocol.js +37 -0
- package/node_modules/dp-shared/dist/ws-protocol.js.map +1 -1
- package/package.json +9 -4
- package/scripts/prepack-bundle-shared.mjs +67 -0
- package/dist/browser/proxy-relay.d.ts +0 -50
- package/dist/browser/proxy-relay.js +0 -50
- package/dist/browser/proxy-relay.js.map +0 -1
- package/node_modules/dp-shared/src/admin-broadcast.ts +0 -41
- package/node_modules/dp-shared/src/audit-contracts.ts +0 -33
- package/node_modules/dp-shared/src/auto-post-contracts.ts +0 -206
- package/node_modules/dp-shared/src/cloak-contracts.ts +0 -110
- package/node_modules/dp-shared/src/configs-contracts.ts +0 -249
- package/node_modules/dp-shared/src/db-rows.ts +0 -303
- package/node_modules/dp-shared/src/deploy-contracts.ts +0 -38
- package/node_modules/dp-shared/src/domain.ts +0 -124
- package/node_modules/dp-shared/src/fingerprint.ts +0 -21
- package/node_modules/dp-shared/src/identities.ts +0 -38
- package/node_modules/dp-shared/src/index.ts +0 -30
- package/node_modules/dp-shared/src/omni-flow-cookie.ts +0 -272
- package/node_modules/dp-shared/src/omni-flow-session.ts +0 -79
- package/node_modules/dp-shared/src/post-drafts-contracts.ts +0 -807
- package/node_modules/dp-shared/src/rest-contracts.ts +0 -592
- package/node_modules/dp-shared/src/task-history-contracts.ts +0 -124
- package/node_modules/dp-shared/src/worker-detail-contracts.ts +0 -236
- package/node_modules/dp-shared/src/ws-protocol.ts +0 -495
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OmniFlow ⇄ Playwright cookie/routing mapping — single source of truth.
|
|
3
|
-
*
|
|
4
|
-
* The养号 session blob ({@link OmniFlowSessionExport}) is the interchange format
|
|
5
|
-
* shared by the OmniFlow extension, dp-worker's CloakBrowser backend, and the
|
|
6
|
-
* dp-cloak desktop app. Converting between that blob and Playwright's native
|
|
7
|
-
* cookie/proxy shapes is pure data mapping, so it lives here rather than being
|
|
8
|
-
* copied per-consumer — a change to the mapping (new sameSite value, partition
|
|
9
|
-
* key, …) then updates every tier at once.
|
|
10
|
-
*
|
|
11
|
-
* dp-worker's `cloakbrowser-backend.ts` originally owned the FORWARD direction
|
|
12
|
-
* (blob → Playwright, for injection). dp-cloak needs the REVERSE too (live
|
|
13
|
-
* `context.cookies()` → blob, for export back to a worker). Both directions are
|
|
14
|
-
* here and are tested to round-trip losslessly.
|
|
15
|
-
*
|
|
16
|
-
* No runtime dependency on playwright-core: the Playwright cookie shapes are
|
|
17
|
-
* described structurally below. `context.cookies()` output and `addCookies()`
|
|
18
|
-
* input both satisfy these, so consumers pass Playwright values directly.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
import type {
|
|
22
|
-
OmniFlowCookie,
|
|
23
|
-
OmniFlowProxyConfig,
|
|
24
|
-
OmniFlowSessionExport,
|
|
25
|
-
} from "./omni-flow-session.js";
|
|
26
|
-
|
|
27
|
-
/** Playwright `SameSite` enum (the only three values Chromium emits/accepts). */
|
|
28
|
-
export type PlaywrightSameSite = "Strict" | "Lax" | "None";
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Shape accepted by Playwright's `BrowserContext.addCookies()` (a subset of its
|
|
32
|
-
* params — the fields we actually set). Structurally compatible with the real
|
|
33
|
-
* type, so callers can pass the array straight to `addCookies`.
|
|
34
|
-
*/
|
|
35
|
-
export interface PlaywrightCookieParam {
|
|
36
|
-
name: string;
|
|
37
|
-
value: string;
|
|
38
|
-
domain: string;
|
|
39
|
-
path: string;
|
|
40
|
-
expires?: number;
|
|
41
|
-
secure?: boolean;
|
|
42
|
-
httpOnly?: boolean;
|
|
43
|
-
sameSite?: PlaywrightSameSite;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Shape returned by Playwright's `BrowserContext.cookies()`. Same fields, but
|
|
48
|
-
* `expires` is always present (`-1` denotes a session cookie) — that `-1`
|
|
49
|
-
* sentinel is the single trickiest part of the reverse mapping.
|
|
50
|
-
*/
|
|
51
|
-
export interface PlaywrightCookie {
|
|
52
|
-
name: string;
|
|
53
|
-
value: string;
|
|
54
|
-
domain: string;
|
|
55
|
-
path: string;
|
|
56
|
-
expires: number;
|
|
57
|
-
httpOnly: boolean;
|
|
58
|
-
secure: boolean;
|
|
59
|
-
sameSite: PlaywrightSameSite;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ---------------------------------------------------------------------------
|
|
63
|
-
// sameSite — bidirectional
|
|
64
|
-
// ---------------------------------------------------------------------------
|
|
65
|
-
|
|
66
|
-
/** Map a Chrome-exported cookie's sameSite string to Playwright's enum. */
|
|
67
|
-
export function mapSameSiteToPlaywright(
|
|
68
|
-
v?: string
|
|
69
|
-
): PlaywrightSameSite | undefined {
|
|
70
|
-
switch ((v ?? "").toLowerCase()) {
|
|
71
|
-
case "no_restriction":
|
|
72
|
-
case "none":
|
|
73
|
-
return "None";
|
|
74
|
-
case "lax":
|
|
75
|
-
return "Lax";
|
|
76
|
-
case "strict":
|
|
77
|
-
return "Strict";
|
|
78
|
-
default:
|
|
79
|
-
return undefined; // 'unspecified' / unknown -> let Playwright default
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** Map Playwright's sameSite enum back to the OmniFlow/Chrome string form. */
|
|
84
|
-
export function mapSameSiteToOmniFlow(
|
|
85
|
-
v?: PlaywrightSameSite
|
|
86
|
-
): string | undefined {
|
|
87
|
-
switch (v) {
|
|
88
|
-
case "None":
|
|
89
|
-
return "no_restriction";
|
|
90
|
-
case "Lax":
|
|
91
|
-
return "lax";
|
|
92
|
-
case "Strict":
|
|
93
|
-
return "strict";
|
|
94
|
-
default:
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// ---------------------------------------------------------------------------
|
|
100
|
-
// cookie — forward (blob → Playwright)
|
|
101
|
-
// ---------------------------------------------------------------------------
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Convert an OmniFlow-exported cookie to Playwright's addCookies shape, or null
|
|
105
|
-
* if it lacks the required name/domain. Persistent cookies carry an absolute
|
|
106
|
-
* expiry (Unix seconds); session cookies omit it so Playwright treats them as
|
|
107
|
-
* session-scoped.
|
|
108
|
-
*/
|
|
109
|
-
export function omniFlowCookieToPlaywright(
|
|
110
|
-
c: OmniFlowCookie
|
|
111
|
-
): PlaywrightCookieParam | null {
|
|
112
|
-
if (!c.name || !c.domain) return null;
|
|
113
|
-
const out: PlaywrightCookieParam = {
|
|
114
|
-
name: c.name,
|
|
115
|
-
value: c.value ?? "",
|
|
116
|
-
domain: c.domain,
|
|
117
|
-
path: c.path || "/",
|
|
118
|
-
};
|
|
119
|
-
if (typeof c.secure === "boolean") out.secure = c.secure;
|
|
120
|
-
if (typeof c.httpOnly === "boolean") out.httpOnly = c.httpOnly;
|
|
121
|
-
if (!c.session && typeof c.expirationDate === "number") {
|
|
122
|
-
out.expires = Math.floor(c.expirationDate);
|
|
123
|
-
}
|
|
124
|
-
const sameSite = mapSameSiteToPlaywright(c.sameSite);
|
|
125
|
-
if (sameSite) {
|
|
126
|
-
out.sameSite = sameSite;
|
|
127
|
-
// Chrome/Playwright require SameSite=None cookies to be Secure.
|
|
128
|
-
if (sameSite === "None") out.secure = true;
|
|
129
|
-
}
|
|
130
|
-
return out;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// ---------------------------------------------------------------------------
|
|
134
|
-
// cookie — reverse (Playwright → blob)
|
|
135
|
-
// ---------------------------------------------------------------------------
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Convert a live Playwright cookie (from `context.cookies()`) into an OmniFlow
|
|
139
|
-
* cookie for export. Inverse of {@link omniFlowCookieToPlaywright}.
|
|
140
|
-
*
|
|
141
|
-
* The `expires` sentinel is the crux: Playwright uses `-1` (and we also treat a
|
|
142
|
-
* missing/non-positive value) to mean "session cookie", which OmniFlow encodes
|
|
143
|
-
* as `session: true` with NO `expirationDate`. A real future expiry becomes
|
|
144
|
-
* `session: false` + `expirationDate`.
|
|
145
|
-
*/
|
|
146
|
-
export function playwrightCookieToOmniFlow(
|
|
147
|
-
c: PlaywrightCookie
|
|
148
|
-
): OmniFlowCookie {
|
|
149
|
-
const isSession = !(typeof c.expires === "number" && c.expires > 0);
|
|
150
|
-
const out: OmniFlowCookie = {
|
|
151
|
-
name: c.name,
|
|
152
|
-
value: c.value ?? "",
|
|
153
|
-
domain: c.domain,
|
|
154
|
-
path: c.path || "/",
|
|
155
|
-
session: isSession,
|
|
156
|
-
};
|
|
157
|
-
if (typeof c.secure === "boolean") out.secure = c.secure;
|
|
158
|
-
if (typeof c.httpOnly === "boolean") out.httpOnly = c.httpOnly;
|
|
159
|
-
if (!isSession) out.expirationDate = Math.floor(c.expires);
|
|
160
|
-
const sameSite = mapSameSiteToOmniFlow(c.sameSite);
|
|
161
|
-
if (sameSite) out.sameSite = sameSite;
|
|
162
|
-
return out;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// ---------------------------------------------------------------------------
|
|
166
|
-
// routing (proxy + timezone) resolved from a session blob
|
|
167
|
-
// ---------------------------------------------------------------------------
|
|
168
|
-
|
|
169
|
-
/** A CloakBrowser proxy option (URL string form fed to `--proxy-server`). */
|
|
170
|
-
export interface CloakProxy {
|
|
171
|
-
server: string;
|
|
172
|
-
username?: string;
|
|
173
|
-
password?: string;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export interface ResolvedRouting {
|
|
177
|
-
proxy?: CloakProxy;
|
|
178
|
-
timezone?: string;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** Convert an OmniFlow proxy config into cloakbrowser's proxy option. */
|
|
182
|
-
export function omniFlowProxyToCloak(
|
|
183
|
-
pc: OmniFlowProxyConfig | null | undefined
|
|
184
|
-
): CloakProxy | undefined {
|
|
185
|
-
if (!pc || !pc.host || !pc.port) return undefined;
|
|
186
|
-
return {
|
|
187
|
-
// OmniFlow stores `type` as 'socks5' | 'http' etc., port as string|number.
|
|
188
|
-
server: `${String(pc.type).toLowerCase()}://${pc.host}:${pc.port}`,
|
|
189
|
-
...(pc.username ? { username: pc.username } : {}),
|
|
190
|
-
...(pc.password ? { password: pc.password } : {}),
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Pull proxy + timezone out of a session blob (the blob branch of dp-worker's
|
|
196
|
-
* `resolveRouting`, minus the DipclawConfig fallback — that is worker-only).
|
|
197
|
-
* A disabled timezone (`timezoneEnabled === false`) resolves to no timezone.
|
|
198
|
-
*/
|
|
199
|
-
export function resolveRoutingFromBlob(
|
|
200
|
-
blob: OmniFlowSessionExport
|
|
201
|
-
): ResolvedRouting {
|
|
202
|
-
const storage = blob.extensionStorage;
|
|
203
|
-
const proxy = omniFlowProxyToCloak(storage.proxyConfig);
|
|
204
|
-
const timezone =
|
|
205
|
-
storage.timezoneEnabled === false
|
|
206
|
-
? undefined
|
|
207
|
-
: storage.spoofTimezone || undefined;
|
|
208
|
-
return { ...(proxy ? { proxy } : {}), ...(timezone ? { timezone } : {}) };
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// ---------------------------------------------------------------------------
|
|
212
|
-
// timezone → locale
|
|
213
|
-
// ---------------------------------------------------------------------------
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Best-effort IANA timezone -> BCP-47 locale. We feed our own per-proxy
|
|
217
|
-
* timezone (no geoip), and a locale that roughly matches keeps the two
|
|
218
|
-
* consistent for fingerprinting. Unknown zones fall back to en-US, which is
|
|
219
|
-
* also CloakBrowser's default.
|
|
220
|
-
*/
|
|
221
|
-
export function localeFromTimezone(timezone: string | undefined): string {
|
|
222
|
-
if (!timezone) return "en-US";
|
|
223
|
-
const map: Record<string, string> = {
|
|
224
|
-
"Asia/Shanghai": "zh-CN",
|
|
225
|
-
"Asia/Hong_Kong": "zh-HK",
|
|
226
|
-
"Asia/Taipei": "zh-TW",
|
|
227
|
-
"Asia/Tokyo": "ja-JP",
|
|
228
|
-
"Asia/Seoul": "ko-KR",
|
|
229
|
-
"Asia/Singapore": "en-SG",
|
|
230
|
-
"Europe/London": "en-GB",
|
|
231
|
-
"Europe/Paris": "fr-FR",
|
|
232
|
-
"Europe/Berlin": "de-DE",
|
|
233
|
-
"Europe/Madrid": "es-ES",
|
|
234
|
-
"Europe/Moscow": "ru-RU",
|
|
235
|
-
"America/Sao_Paulo": "pt-BR",
|
|
236
|
-
};
|
|
237
|
-
if (map[timezone]) return map[timezone];
|
|
238
|
-
if (timezone.startsWith("America/")) return "en-US";
|
|
239
|
-
if (timezone.startsWith("Australia/")) return "en-AU";
|
|
240
|
-
return "en-US";
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// ---------------------------------------------------------------------------
|
|
244
|
-
// blob assembly (for export)
|
|
245
|
-
// ---------------------------------------------------------------------------
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Assemble a dp-worker-compatible OmniFlow session blob from a proxy/timezone
|
|
249
|
-
* config plus exported cookies. Mirrors what the extension writes and what
|
|
250
|
-
* `readSessionBlob` in the worker expects, so the output drops straight into a
|
|
251
|
-
* worker's `<workspace>/.dipclaw/omni-flow-session.json`.
|
|
252
|
-
*/
|
|
253
|
-
export function buildOmniFlowSession(params: {
|
|
254
|
-
proxy: OmniFlowProxyConfig | null;
|
|
255
|
-
timezone: string | null;
|
|
256
|
-
timezoneEnabled?: boolean;
|
|
257
|
-
cookies: OmniFlowCookie[];
|
|
258
|
-
timestamp?: number;
|
|
259
|
-
}): OmniFlowSessionExport {
|
|
260
|
-
const { proxy, timezone, cookies } = params;
|
|
261
|
-
const timezoneEnabled = params.timezoneEnabled ?? Boolean(timezone);
|
|
262
|
-
return {
|
|
263
|
-
app: "OmniFlow",
|
|
264
|
-
...(params.timestamp != null ? { timestamp: params.timestamp } : {}),
|
|
265
|
-
extensionStorage: {
|
|
266
|
-
proxyConfig: proxy ?? null,
|
|
267
|
-
timezoneEnabled,
|
|
268
|
-
spoofTimezone: timezoneEnabled ? timezone ?? "" : "",
|
|
269
|
-
},
|
|
270
|
-
cookies,
|
|
271
|
-
};
|
|
272
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
|
-
|
|
3
|
-
const StringOrNumber = z.union([z.string(), z.number()]);
|
|
4
|
-
|
|
5
|
-
export const OmniFlowProxyConfigSchema = z.object({
|
|
6
|
-
type: z.string().min(1),
|
|
7
|
-
host: z.string().min(1),
|
|
8
|
-
port: StringOrNumber,
|
|
9
|
-
username: z.string().optional().default(""),
|
|
10
|
-
password: z.string().optional().default(""),
|
|
11
|
-
});
|
|
12
|
-
export type OmniFlowProxyConfig = z.infer<typeof OmniFlowProxyConfigSchema>;
|
|
13
|
-
|
|
14
|
-
export const OmniFlowExtensionStorageSchema = z
|
|
15
|
-
.object({
|
|
16
|
-
proxyConfig: OmniFlowProxyConfigSchema.optional().nullable(),
|
|
17
|
-
timezoneEnabled: z.boolean().optional(),
|
|
18
|
-
spoofTimezone: z.string().optional().default(""),
|
|
19
|
-
webrtcDisabled: z.boolean().optional(),
|
|
20
|
-
languagesEnabled: z.boolean().optional(),
|
|
21
|
-
hardwareMaskingEnabled: z.boolean().optional(),
|
|
22
|
-
antiBotEnabled: z.boolean().optional(),
|
|
23
|
-
})
|
|
24
|
-
.passthrough();
|
|
25
|
-
export type OmniFlowExtensionStorage = z.infer<
|
|
26
|
-
typeof OmniFlowExtensionStorageSchema
|
|
27
|
-
>;
|
|
28
|
-
|
|
29
|
-
export const OmniFlowCookieSchema = z
|
|
30
|
-
.object({
|
|
31
|
-
name: z.string().min(1),
|
|
32
|
-
value: z.string(),
|
|
33
|
-
domain: z.string().min(1),
|
|
34
|
-
path: z.string().default("/"),
|
|
35
|
-
secure: z.boolean().optional(),
|
|
36
|
-
httpOnly: z.boolean().optional(),
|
|
37
|
-
sameSite: z.string().optional(),
|
|
38
|
-
expirationDate: z.number().optional(),
|
|
39
|
-
session: z.boolean().optional(),
|
|
40
|
-
storeId: z.string().optional(),
|
|
41
|
-
})
|
|
42
|
-
.passthrough();
|
|
43
|
-
export type OmniFlowCookie = z.infer<typeof OmniFlowCookieSchema>;
|
|
44
|
-
|
|
45
|
-
export const OmniFlowSessionExportSchema = z
|
|
46
|
-
.object({
|
|
47
|
-
app: z.literal("OmniFlow"),
|
|
48
|
-
version: z.string().optional(),
|
|
49
|
-
timestamp: z.number().optional(),
|
|
50
|
-
extensionStorage: OmniFlowExtensionStorageSchema,
|
|
51
|
-
cookies: z.array(OmniFlowCookieSchema).default([]),
|
|
52
|
-
})
|
|
53
|
-
.passthrough();
|
|
54
|
-
export type OmniFlowSessionExport = z.infer<
|
|
55
|
-
typeof OmniFlowSessionExportSchema
|
|
56
|
-
>;
|
|
57
|
-
|
|
58
|
-
export const OmniFlowSessionSummarySchema = z.object({
|
|
59
|
-
proxy: OmniFlowProxyConfigSchema.nullable(),
|
|
60
|
-
timezone: z.string().optional().default(""),
|
|
61
|
-
cookie_count: z.number().int().nonnegative().default(0),
|
|
62
|
-
});
|
|
63
|
-
export type OmniFlowSessionSummary = z.infer<
|
|
64
|
-
typeof OmniFlowSessionSummarySchema
|
|
65
|
-
>;
|
|
66
|
-
|
|
67
|
-
export function summarizeOmniFlowSession(
|
|
68
|
-
payload: OmniFlowSessionExport
|
|
69
|
-
): OmniFlowSessionSummary {
|
|
70
|
-
const storage = payload.extensionStorage;
|
|
71
|
-
const proxy = storage.proxyConfig ?? null;
|
|
72
|
-
const timezone =
|
|
73
|
-
storage.timezoneEnabled === false ? "" : storage.spoofTimezone ?? "";
|
|
74
|
-
return {
|
|
75
|
-
proxy,
|
|
76
|
-
timezone,
|
|
77
|
-
cookie_count: payload.cookies.length,
|
|
78
|
-
};
|
|
79
|
-
}
|