@kedem/okdb 1.9.1 → 2.0.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/README.md +3 -2
- package/bin/okdb.js +1 -1
- package/docs/deployment.md +155 -0
- package/docs/diagnostics.md +115 -0
- package/docs/embeddings.md +1 -1
- package/docs/functions.md +30 -27
- package/docs/getting-started.md +14 -3
- package/docs/http-api.md +3 -3
- package/docs/http-cluster.md +93 -60
- package/docs/index.md +13 -1
- package/docs/manifest.json +6 -3
- package/docs/pipelines.md +1 -1
- package/docs/process-registry.md +5 -5
- package/docs/processors.md +35 -18
- package/docs/queue.md +112 -42
- package/docs/sync.md +10 -7
- package/docs/ttl.md +1 -1
- package/docs/upgrade-2.0.md +290 -0
- package/okdb-functions-sandbox-worker.js +1 -1
- package/okdb-http-worker-child.js +1 -1
- package/okdb-views-bootstrap-worker.js +1 -1
- package/okdb.js +1 -1
- package/package.json +1 -1
- package/public/layouts/_default.ok.html +1 -1
- package/public/sections/db/modals/create-env-modal.ok.js +1 -1
- package/public/sections/db/modals/demo-env-modal.ok.js +1 -1
- package/public/sections/db/parts/db-overview.ok.js +1 -1
- package/public/sections/engines/engine-ui-utils.js +1 -1
- package/public/sections/engines/parts/engine-declaration-editor.ok.js +1 -1
- package/public/sections/engines/parts/generic-engine-panel.ok.js +1 -1
- package/public/sections/queue/parts/code-panel.ok.js +1 -1
- package/public/sections/queue/parts/job-log-panel.ok.js +1 -1
- package/public/sections/queue/parts/queue-jobs.ok.js +1 -1
- package/public/sections/sync/parts/sync-topology.ok.js +1 -1
- package/public/sections/system/index.ok.html +1 -1
- package/public/sections/system/parts/system-process-panel.ok.js +1 -1
- package/public/sections/system/parts/system-processing-panel.ok.js +1 -1
- package/public/sections/system/parts/system-runtime-overview.ok.js +1 -1
- package/public/setup-app.js +1 -1
- package/public/setup.html +116 -55
- package/types/index.d.ts +33 -3
- package/types/options.d.ts +19 -10
- package/docs/worker-fleet.md +0 -139
- package/okdb-functions-runner-child.js +0 -1
- package/okdb-queue-load-handler.js +0 -1
- package/okdb-queue-spawn-child.js +0 -1
- package/okdb-worker-child.js +0 -1
- package/public/sections/system/parts/system-workers-panel.ok.js +0 -1
package/public/setup.html
CHANGED
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
--accent2:#16a34a;
|
|
45
45
|
}
|
|
46
46
|
* { box-sizing:border-box; }
|
|
47
|
+
/* Author rule for .field/.check sets display, which beats the UA [hidden]
|
|
48
|
+
rule — so make hidden authoritative for everything on this page. */
|
|
49
|
+
[hidden] { display:none !important; }
|
|
47
50
|
body {
|
|
48
51
|
margin:0;
|
|
49
52
|
min-height:100vh;
|
|
@@ -59,13 +62,13 @@
|
|
|
59
62
|
background: radial-gradient(circle at top, #c8dff5 0%, var(--bg0) 45%, #e8f2ff 100%);
|
|
60
63
|
}
|
|
61
64
|
.shell {
|
|
62
|
-
width:min(
|
|
65
|
+
width:min(440px, 100%);
|
|
63
66
|
display:flex;
|
|
64
67
|
flex-direction:column;
|
|
65
68
|
gap:0;
|
|
66
69
|
}
|
|
67
70
|
.header {
|
|
68
|
-
margin-bottom:
|
|
71
|
+
margin-bottom:24px;
|
|
69
72
|
text-align:center;
|
|
70
73
|
}
|
|
71
74
|
.eyebrow {
|
|
@@ -73,13 +76,8 @@
|
|
|
73
76
|
background:rgba(79,193,255,.12); color:var(--accent); font-size:12px; letter-spacing:.08em; text-transform:uppercase;
|
|
74
77
|
border:1px solid rgba(79,193,255,.18);
|
|
75
78
|
}
|
|
76
|
-
h1 { font-size:
|
|
79
|
+
h1 { font-size:30px; line-height:1.1; margin:14px 0 6px; }
|
|
77
80
|
.subtitle { color:var(--muted); font-size:15px; margin:0; }
|
|
78
|
-
.panels {
|
|
79
|
-
display:grid;
|
|
80
|
-
grid-template-columns:1fr 1fr;
|
|
81
|
-
gap:16px;
|
|
82
|
-
}
|
|
83
81
|
.panel {
|
|
84
82
|
background:rgba(8,16,26,.86);
|
|
85
83
|
border:1px solid rgba(79,193,255,.16);
|
|
@@ -111,6 +109,24 @@
|
|
|
111
109
|
background:linear-gradient(135deg, var(--accent2), #a8f0b4);
|
|
112
110
|
box-shadow:0 10px 30px rgba(126,231,135,.18);
|
|
113
111
|
}
|
|
112
|
+
/* Secondary, low-emphasis action (e.g. the "Join a cluster" entry point) */
|
|
113
|
+
.button.ghost {
|
|
114
|
+
background:transparent; color:var(--muted); border:1px solid rgba(255,255,255,.12);
|
|
115
|
+
box-shadow:none; font-weight:600; font-size:14px; padding:12px 16px;
|
|
116
|
+
}
|
|
117
|
+
.button.ghost:hover { filter:none; color:var(--text); border-color:rgba(79,193,255,.4); }
|
|
118
|
+
[data-theme='light'] .button.ghost { border-color:var(--line); }
|
|
119
|
+
.divider {
|
|
120
|
+
display:flex; align-items:center; gap:12px; color:var(--muted); font-size:12px;
|
|
121
|
+
text-transform:uppercase; letter-spacing:.08em;
|
|
122
|
+
}
|
|
123
|
+
.divider::before, .divider::after { content:''; flex:1; height:1px; background:rgba(255,255,255,.1); }
|
|
124
|
+
[data-theme='light'] .divider::before, [data-theme='light'] .divider::after { background:var(--line); }
|
|
125
|
+
.back {
|
|
126
|
+
align-self:flex-start; background:none; border:none; cursor:pointer; font-family:inherit;
|
|
127
|
+
color:var(--muted); font-size:13px; padding:0; margin-bottom:10px;
|
|
128
|
+
}
|
|
129
|
+
.back:hover { color:var(--text); }
|
|
114
130
|
.error {
|
|
115
131
|
padding:10px 12px; border-radius:10px;
|
|
116
132
|
background:rgba(248,113,113,.12); border:1px solid rgba(248,113,113,.25); color:#fecaca;
|
|
@@ -121,11 +137,24 @@
|
|
|
121
137
|
background:rgba(126,231,135,.1); border:1px solid rgba(126,231,135,.25); color:#a8f0b4;
|
|
122
138
|
font-size:13px;
|
|
123
139
|
}
|
|
124
|
-
@media (max-width:720px) {
|
|
125
|
-
.panels { grid-template-columns:1fr; }
|
|
126
|
-
}
|
|
127
140
|
[data-theme='light'] .panel { background: rgba(255,255,255,.92); border-color: rgba(26,122,184,.2); }
|
|
128
141
|
[data-theme='light'] .field input { background: var(--bg2); border-color: var(--line); }
|
|
142
|
+
|
|
143
|
+
/* Segmented credential toggle */
|
|
144
|
+
.segmented {
|
|
145
|
+
display:flex; border:1px solid rgba(255,255,255,.1); border-radius:12px; overflow:hidden;
|
|
146
|
+
}
|
|
147
|
+
.segmented button {
|
|
148
|
+
flex:1; background:transparent; color:var(--muted); border:none; cursor:pointer;
|
|
149
|
+
font-family:inherit; font-size:13px; font-weight:600; padding:10px 8px; transition:color .15s, background .15s;
|
|
150
|
+
}
|
|
151
|
+
.segmented button + button { border-left:1px solid rgba(255,255,255,.08); }
|
|
152
|
+
.segmented button.seg-active { background:#0b1420; color:var(--text); box-shadow:inset 0 0 0 1px rgba(79,193,255,.35); }
|
|
153
|
+
[data-theme='light'] .segmented { border-color:var(--line); }
|
|
154
|
+
[data-theme='light'] .segmented button.seg-active { background:var(--bg2); }
|
|
155
|
+
.check { display:flex; align-items:flex-start; gap:9px; font-size:13px; color:var(--muted); cursor:pointer; line-height:1.45; }
|
|
156
|
+
.check input { margin-top:2px; cursor:pointer; accent-color:var(--accent2); }
|
|
157
|
+
.hint { font-size:12px; color:var(--muted); line-height:1.5; margin:0; }
|
|
129
158
|
</style>
|
|
130
159
|
</head>
|
|
131
160
|
<body>
|
|
@@ -133,57 +162,89 @@
|
|
|
133
162
|
<header class="header">
|
|
134
163
|
<div class="eyebrow">OKDB First-Time Setup</div>
|
|
135
164
|
<h1>Welcome to OKDB</h1>
|
|
136
|
-
<p class="subtitle">This node has no credentials yet. Create an admin
|
|
165
|
+
<p class="subtitle">This node has no credentials yet. Create an admin to get started.</p>
|
|
137
166
|
</header>
|
|
138
167
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
168
|
+
<!-- Create admin (default view) -->
|
|
169
|
+
<section class="panel" id="createView">
|
|
170
|
+
<div>
|
|
171
|
+
<p class="panel-title">Create your first admin</p>
|
|
172
|
+
<p class="panel-desc">Set up credentials for this node. You'll log in with these after setup.</p>
|
|
173
|
+
</div>
|
|
174
|
+
<form id="createForm" class="stack">
|
|
175
|
+
<div class="field">
|
|
176
|
+
<label for="createName">Username</label>
|
|
177
|
+
<input id="createName" name="name" value="admin" autocomplete="username" placeholder="admin">
|
|
144
178
|
</div>
|
|
145
|
-
<
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
</form>
|
|
165
|
-
</section>
|
|
179
|
+
<div class="field">
|
|
180
|
+
<label for="createPassword">Password</label>
|
|
181
|
+
<input id="createPassword" name="password" type="password" autocomplete="new-password" placeholder="••••••••">
|
|
182
|
+
</div>
|
|
183
|
+
<div class="field">
|
|
184
|
+
<label for="createConfirm">Confirm password</label>
|
|
185
|
+
<input id="createConfirm" name="confirm" type="password" autocomplete="new-password" placeholder="••••••••">
|
|
186
|
+
</div>
|
|
187
|
+
<div class="field">
|
|
188
|
+
<label for="createLabel">Label <span style="color:var(--muted)">(optional)</span></label>
|
|
189
|
+
<input id="createLabel" name="label" value="Initial admin" placeholder="Initial admin">
|
|
190
|
+
</div>
|
|
191
|
+
<div id="createError" class="error" hidden></div>
|
|
192
|
+
<button type="submit" class="button">Create admin and continue</button>
|
|
193
|
+
</form>
|
|
194
|
+
|
|
195
|
+
<div class="divider"><span>or</span></div>
|
|
196
|
+
<button type="button" id="showJoin" class="button ghost">Join an existing cluster</button>
|
|
197
|
+
</section>
|
|
166
198
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
199
|
+
<!-- Join cluster (revealed on demand) -->
|
|
200
|
+
<section class="panel" id="joinView" hidden>
|
|
201
|
+
<div>
|
|
202
|
+
<button type="button" id="backToCreate" class="back">← Back</button>
|
|
203
|
+
<p class="panel-title">Join an existing cluster</p>
|
|
204
|
+
<p class="panel-desc">Connect to a running OKDB node. The credential is used once for the handshake — after that, sync authenticates with Ed25519 keys.</p>
|
|
205
|
+
</div>
|
|
206
|
+
<form id="joinForm" class="stack">
|
|
207
|
+
<div class="field">
|
|
208
|
+
<label for="joinAddress">Remote node address</label>
|
|
209
|
+
<input id="joinAddress" name="address" placeholder="http://node-a.example.com:8484">
|
|
171
210
|
</div>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
<
|
|
179
|
-
<input id="joinToken" name="token" type="password" placeholder="cluster sync token">
|
|
211
|
+
|
|
212
|
+
<div class="field">
|
|
213
|
+
<label>Authentication</label>
|
|
214
|
+
<div class="segmented" id="joinAuthSeg">
|
|
215
|
+
<button type="button" data-method="token" class="seg-active">Token</button>
|
|
216
|
+
<button type="button" data-method="login">Login</button>
|
|
217
|
+
<button type="button" data-method="none">None</button>
|
|
180
218
|
</div>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<div class="field" data-auth="token">
|
|
222
|
+
<label for="joinToken">Cluster sync token</label>
|
|
223
|
+
<input id="joinToken" name="token" type="password" placeholder="Bearer token from the cluster admin">
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<div class="field" data-auth="login" hidden>
|
|
227
|
+
<label for="joinUsername">Username</label>
|
|
228
|
+
<input id="joinUsername" name="username" autocomplete="username" placeholder="Username on the remote node">
|
|
229
|
+
<label for="joinPassword" style="margin-top:6px;">Password</label>
|
|
230
|
+
<input id="joinPassword" name="password" type="password" autocomplete="current-password" placeholder="••••••••">
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<div class="field" data-auth="none" hidden>
|
|
234
|
+
<p class="hint">No credential is sent. This only works when the remote node is running in open mode.</p>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<label class="check">
|
|
238
|
+
<input type="checkbox" id="joinDataLink" checked>
|
|
239
|
+
<span>Sync data immediately <span style="opacity:.6">— unchecked links topology only</span></span>
|
|
240
|
+
</label>
|
|
241
|
+
|
|
242
|
+
<div id="joinError" class="error" hidden></div>
|
|
243
|
+
<button type="submit" class="button green">Join cluster</button>
|
|
244
|
+
</form>
|
|
245
|
+
</section>
|
|
186
246
|
</main>
|
|
247
|
+
|
|
187
248
|
<script type="module" src="setup-app.js"></script>
|
|
188
249
|
</body>
|
|
189
250
|
</html>
|
package/types/index.d.ts
CHANGED
|
@@ -74,7 +74,12 @@ export declare class OKDB {
|
|
|
74
74
|
readonly events: EventEmitter;
|
|
75
75
|
|
|
76
76
|
// ── Subsystems ────────────────────────────────────────────────────────────
|
|
77
|
-
readonly http:
|
|
77
|
+
readonly http: {
|
|
78
|
+
/** Start the built-in HTTP server (REST API + admin UI). Single-process only —
|
|
79
|
+
* a `{ workers }` second argument throws HTTP_CLUSTER_REMOVED (okdb 2.0). */
|
|
80
|
+
listen(port: number, host?: string): unknown;
|
|
81
|
+
[key: string]: unknown;
|
|
82
|
+
};
|
|
78
83
|
readonly auth: OKDBAuth;
|
|
79
84
|
readonly log: unknown;
|
|
80
85
|
readonly bus: unknown;
|
|
@@ -100,12 +105,37 @@ export declare class OKDB {
|
|
|
100
105
|
// ── Lifecycle ─────────────────────────────────────────────────────────────
|
|
101
106
|
open(): Promise<void>;
|
|
102
107
|
close(): Promise<void>;
|
|
108
|
+
/** Resolved role flags. `engines`/`compaction` are fixed for the instance's
|
|
109
|
+
* lifetime; `processors` reflects CURRENT participation (see processors.start/stop). */
|
|
110
|
+
readonly role: { readonly processors: boolean; readonly engines: boolean; readonly compaction: boolean };
|
|
111
|
+
/** Composite load signal for this node (cached 250 ms; safe to poll per claim).
|
|
112
|
+
* score ≥ 1 ≈ at the documented distress limits — the standard admission policy is
|
|
113
|
+
* `() => db.pressure().score < 1`. queuePending is workload context, not in the score. */
|
|
114
|
+
pressure(): {
|
|
115
|
+
writerStallMs: number;
|
|
116
|
+
writerDepth: number;
|
|
117
|
+
maxDurableLag: number;
|
|
118
|
+
queuePending: number;
|
|
119
|
+
loopLagMs: number;
|
|
120
|
+
score: number;
|
|
121
|
+
};
|
|
122
|
+
/** Processing participation control + status.
|
|
123
|
+
* start(): begin participating — un-gate lease claiming; the first call also runs
|
|
124
|
+
* the per-store view boot that open() skips on a non-participating node.
|
|
125
|
+
* stop(): cease participating — finish in-flight quanta, release leases (peers
|
|
126
|
+
* fail over), park registrations. Both idempotent; resolve true on state change. */
|
|
127
|
+
readonly processors: {
|
|
128
|
+
start(): Promise<boolean>;
|
|
129
|
+
stop(): Promise<boolean>;
|
|
130
|
+
status(): { participate: boolean; processors: unknown[] };
|
|
131
|
+
[key: string]: unknown;
|
|
132
|
+
};
|
|
103
133
|
|
|
104
134
|
// ── Environment management ────────────────────────────────────────────────
|
|
105
135
|
readonly default: OKDBEnvironment;
|
|
106
136
|
env(name?: string): OKDBEnvironment;
|
|
107
|
-
/** Open a registered env on demand (
|
|
108
|
-
*
|
|
137
|
+
/** Open a registered env on demand (envs always open lazily in okdb 2.0).
|
|
138
|
+
* Idempotent; throws ENV_NOT_FOUND for an unregistered name. */
|
|
109
139
|
openEnv(name: string): Promise<OKDBEnvironment>;
|
|
110
140
|
createEnvironment(name: string, config?: OKDBEnvironmentConfig): Promise<OKDBEnvironment>;
|
|
111
141
|
removeEnvironment(name: string, options?: { keepSubEnvs?: string[] }): Promise<OKDBRemoveEnvironmentResult>;
|
package/types/options.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export interface OKDBOptions {
|
|
|
18
18
|
auth?: OKDBAuthOptions;
|
|
19
19
|
sync?: OKDBSyncOptions;
|
|
20
20
|
queue?: OKDBQueueOptions;
|
|
21
|
-
bus?: boolean | Record<string, unknown>;
|
|
22
21
|
functions?: Record<string, unknown>;
|
|
23
22
|
timeMachine?: OKDBTimeMachineOptions;
|
|
24
23
|
runtimeDeclarations?: boolean;
|
|
@@ -28,14 +27,25 @@ export interface OKDBOptions {
|
|
|
28
27
|
* Defaults preserve full-role behavior; passive instances serve reads/writes
|
|
29
28
|
* but skip engines / async processors / compaction scheduling. */
|
|
30
29
|
engines?: boolean;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* (
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
/** okdb 2.0: INITIAL processing participation (claim every unclaimed `single` lease
|
|
31
|
+
* and drain derived work — FTS, views, time-machine, embeddings). Default true.
|
|
32
|
+
* false = not participating: claim nothing; reads/writes + inline processors still
|
|
33
|
+
* run. Participation is dynamic — db.processors.start()/stop() flip it at runtime
|
|
34
|
+
* (open with false + start() later = fast startup). Pass false for ephemeral
|
|
35
|
+
* short-lived processes. */
|
|
36
|
+
processors?: boolean;
|
|
37
|
+
/** okdb 2.0: true = eligible to claim the per-env compaction lease,
|
|
38
|
+
* false = passive (explicit env.compact() still works). */
|
|
39
|
+
compaction?: boolean;
|
|
40
|
+
/** Process-registry participation. false = invisible non-participant;
|
|
41
|
+
* { name } labels this process in the admin's process list. */
|
|
42
|
+
processes?: boolean | { name?: string; kind?: string; register?: boolean; listenAddr?: string | null };
|
|
43
|
+
/** Auto-compaction thresholds; { enabled: false } (or OKDB_AUTO_COMPACT=0) disables. */
|
|
44
|
+
autoCompact?: { enabled?: boolean; [key: string]: unknown };
|
|
45
|
+
/** HTTP API options (e.g. defaultEnv for routes that omit :env). */
|
|
46
|
+
api?: { defaultEnv?: string; [key: string]: unknown };
|
|
47
|
+
/** Admin UI feature; false disables it entirely. */
|
|
48
|
+
admin?: boolean | Record<string, unknown>;
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
export interface OKDBAuthOptions {
|
|
@@ -90,7 +100,6 @@ export interface OKDBTimeMachineOptions {
|
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
export interface OKDBEnvironmentConfig {
|
|
93
|
-
sync?: boolean;
|
|
94
103
|
durability?: 'strict' | 'balanced' | 'fast' | 'custom';
|
|
95
104
|
lmdb?: Record<string, unknown>;
|
|
96
105
|
compression?: boolean;
|
package/docs/worker-fleet.md
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# Workers — background-work placement over the root
|
|
2
|
-
|
|
3
|
-
The worker population is OKDB's **inter-process placement layer**: a set of
|
|
4
|
-
generic worker processes forked over one LMDB root that claim and execute
|
|
5
|
-
background work — processor drains, queue jobs, function runs, and (FTS)
|
|
6
|
-
snapshot bootstraps. There is no intra-process executor (the thread/process
|
|
7
|
-
pool was removed in the runtime-model rework, P4): whoever holds a claim
|
|
8
|
-
drains it **on its own loop in bounded quanta**, yielding between chunks.
|
|
9
|
-
|
|
10
|
-
> **See also:** [Processors](processors.md) for the change-subscription **modes**
|
|
11
|
-
> (`single`/`fanout`/`inline`), registration, and bootstrap — the _guarantee_ each
|
|
12
|
-
> processor declares. This doc covers _where_ that work runs (population & placement);
|
|
13
|
-
> processors.md covers _what_ a processor is.
|
|
14
|
-
|
|
15
|
-
## Quick start
|
|
16
|
-
|
|
17
|
-
```javascript
|
|
18
|
-
const db = new OKDB('./data');
|
|
19
|
-
await db.open();
|
|
20
|
-
|
|
21
|
-
// Declare workers desired state. Root-keyed and idempotent: any instance may call
|
|
22
|
-
// it any number of times; one population results.
|
|
23
|
-
db.workers.ensure({ scale: 'auto' }); // default: min 0, backlog-driven
|
|
24
|
-
|
|
25
|
-
// Tear down: scale:0 persists across restarts.
|
|
26
|
-
await db.workers.destroy();
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Zero-config embedded behavior is unchanged** — no `ensure()` call means the
|
|
30
|
-
instance self-processes exactly as before (end-of-tick async on its own loop,
|
|
31
|
-
leases held uncontended).
|
|
32
|
-
|
|
33
|
-
## `workers.ensure({scale})`
|
|
34
|
-
|
|
35
|
-
| `scale` value | Meaning |
|
|
36
|
-
| ------------------ | --------------------------------------------------------------------------------------- |
|
|
37
|
-
| `'auto'` (default) | Supervisor runs; starts at 0 workers; forks on backlog, retires to 0 when idle |
|
|
38
|
-
| `{ min, max }` | Supervisor runs; always keeps at least `min` workers; elastic ceiling `max` |
|
|
39
|
-
| `0` | Hard off — no supervisor, no workers (serverless, test runners, PID-limited containers) |
|
|
40
|
-
|
|
41
|
-
```javascript
|
|
42
|
-
// Auto-scaling (recommended default)
|
|
43
|
-
db.workers.ensure({ scale: 'auto' });
|
|
44
|
-
|
|
45
|
-
// Fixed floor with elastic ceiling
|
|
46
|
-
db.workers.ensure({ scale: { min: 2, max: 8 } });
|
|
47
|
-
|
|
48
|
-
// Hard off
|
|
49
|
-
db.workers.ensure({ scale: 0 });
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Workers are **homogeneous and anonymous**: every worker handles every job class
|
|
53
|
-
(processing drains, queue definitions, function runs, bootstrap jobs). Any
|
|
54
|
-
worker may claim any work unit — the claim IS the dispatcher.
|
|
55
|
-
|
|
56
|
-
## Deployment shapes
|
|
57
|
-
|
|
58
|
-
| shape | how |
|
|
59
|
-
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
60
|
-
| embedded, self-process | default — nothing to configure |
|
|
61
|
-
| embedded + workers | `db.workers.ensure({scale:'auto'})` — instance stops self-claiming when workers are up; resumes when they retire |
|
|
62
|
-
| embedded + HTTP workers | `db.http.listen(port, { workers: N })` after `open()` — forks okdb's own passive HTTP worker entry (child-entry mode; your app never re-executes; built-in routes only) |
|
|
63
|
-
| CLI server | HTTP cluster (primary + N HTTP workers) is the `bin/okdb` default; add workers alongside |
|
|
64
|
-
|
|
65
|
-
## How placement works
|
|
66
|
-
|
|
67
|
-
- **`processing: 'auto'`** (the default) resolves against the workers
|
|
68
|
-
desired-state:
|
|
69
|
-
- `scale:0` or no workers → self-process (today's behavior)
|
|
70
|
-
- `scale:'auto'` at 0 live workers → self-process; forks first worker → stop claiming; population retires to 0 → resume self-claiming
|
|
71
|
-
- `scale:{min,max}` → stop claiming immediately (workers are starting up)
|
|
72
|
-
A configured-but-dead population is **re-forked** by any `'auto'` instance
|
|
73
|
-
(recovery restores separation rather than absorbing the work).
|
|
74
|
-
- Explicit `processing: 'main'` self-processes regardless of workers;
|
|
75
|
-
`'none'` never processes. The legacy `'threads'`/`'processes'` values warn
|
|
76
|
-
once and map to `'auto'` (the executor they selected was removed in P4).
|
|
77
|
-
- **Supervisor**: a per-root `OKDBLock` lease elects one forker. The holder
|
|
78
|
-
forks/retires children to match desired-state, respawns crashes (backoff
|
|
79
|
-
250 ms→4 s, crash-loop guard 5-in-10 s), and recycles wedged workers (stats
|
|
80
|
-
heartbeat silent > 3× interval → SIGKILL + respawn). Supervisor death → its
|
|
81
|
-
children die with it (parent-death watch); any surviving instance acquires the
|
|
82
|
-
lease and re-forks from durable state.
|
|
83
|
-
- **Shmbuf hard gate**: `workers.ensure({ scale: non-zero })` throws
|
|
84
|
-
`WORKERS_SHMBUF_REQUIRED` when the shmbuf native binding is missing (the
|
|
85
|
-
fallback shim is process-local; a multi-process write topology would corrupt
|
|
86
|
-
HLC/clock ordering). A persisted desired > 0 read by a fallback-mode instance
|
|
87
|
-
is treated as 0 + a warning.
|
|
88
|
-
|
|
89
|
-
## Job classes
|
|
90
|
-
|
|
91
|
-
| class | mechanism |
|
|
92
|
-
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
93
|
-
| `processing` | the existing per-(env,type) lease + retry; bus `POKE {env,type}` wakes the holder |
|
|
94
|
-
| `queue` | the verb is the placement: `queue.process(type, handler)` — in-process consumer; `queue.worker(type, module)` — the SHARED POOL (durable definition, declarative: no workers yet → jobs wait until `workers.ensure()`); `queue.spawn(type, module)` — dedicated forked child |
|
|
95
|
-
| `functions` | durable request/response rows (`~fn:requests`/`~fn:responses`) + PROC bus fast path (`OKDB_FN_LEGACY_POOL=1` forces the legacy runner pool) |
|
|
96
|
-
| `bootstrap` | snapshot bootstraps route as one-shot worker jobs (v1: FTS only — durable per-index meta); ineligible/closure bootstraps run owner-local |
|
|
97
|
-
|
|
98
|
-
## Admission & elasticity
|
|
99
|
-
|
|
100
|
-
Per worker: `maxLeases` (default 32, `OKDB_WORKERS_MAX_LEASES`), loop-lag gate —
|
|
101
|
-
p99 > 200 ms (`OKDB_WORKERS_LAG_GATE_MS`) for 2 windows → stop claiming (resume
|
|
102
|
-
below half the gate for 2 windows).
|
|
103
|
-
|
|
104
|
-
The supervisor probes every `OKDB_WORKERS_SUPERVISE_MS` (default 10 s) and
|
|
105
|
-
scales on four backlog signals, **all read from durable state** (never this
|
|
106
|
-
instance's in-memory processor lag, which is self-cancelling on a self-claiming
|
|
107
|
-
supervisor and inflates on a claim-gated one):
|
|
108
|
-
|
|
109
|
-
- changelog lag — per-type heads vs the persisted `~proc:state` cursors
|
|
110
|
-
(high `OKDB_WORKERS_LAG_HIGH` default 10 000, low `OKDB_WORKERS_LAG_LOW`
|
|
111
|
-
default 1 000)
|
|
112
|
-
- queue depth (`OKDB_WORKERS_QUEUE_HIGH` default 100, `_LOW` default 10)
|
|
113
|
-
- function backlog — pending `~fn:requests` rows (`OKDB_WORKERS_FN_HIGH`
|
|
114
|
-
default 10)
|
|
115
|
-
- pending routed-bootstrap job rows (any pending row counts as backlog)
|
|
116
|
-
|
|
117
|
-
Scale-up respects `maxWorkers` (for `'auto'`: cores−1 or
|
|
118
|
-
`OKDB_WORKERS_AUTO_MAX`) and holds at +1 until the last-forked worker comes
|
|
119
|
-
online; scale-down floor is `minWorkers` (0 for `'auto'` — the population fully
|
|
120
|
-
retires when idle). Cooldown: `OKDB_WORKERS_SCALE_COOLDOWN_MS` default 5 000 ms.
|
|
121
|
-
|
|
122
|
-
## Ops
|
|
123
|
-
|
|
124
|
-
- Workers are registry citizens: `kind:'worker'` rows under their supervisor,
|
|
125
|
-
with memory/CPU stats **and their processor states** (reported over the
|
|
126
|
-
stats IPC channel) — the registry's `processorsView()` shows the
|
|
127
|
-
claim-holder's row as the truth for each 1-of-N key, so the UI says
|
|
128
|
-
"online on worker pid N", not "paused". Decommission/recommission/kill route
|
|
129
|
-
through the supervisor's reconcile loop (durable slot records).
|
|
130
|
-
- Status honesty: a `processing:'auto'` instance that released its claims
|
|
131
|
-
reports `claimGated: true` (rendered as `delegated`, never `paused`) and
|
|
132
|
-
`heldBy: {pid, hostname}` from the live lease record; a worker-routed
|
|
133
|
-
bootstrap surfaces `progress: {phase:'bootstrap', placement:'worker',
|
|
134
|
-
state, claimedBy}`.
|
|
135
|
-
- Per-drain deadlines (`drainDeadlineMs`, default 60 s) mark a slow processor
|
|
136
|
-
errored (lease retained, in-place retry); a truly wedged worker (silent stats)
|
|
137
|
-
is recycled by the supervisor.
|
|
138
|
-
- Runtime mode switching: `processor.setMode(logicalKey, mode)` /
|
|
139
|
-
`POST /api/processors/:logicalKey/mode` — see `docs/processors.md`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';const _0x53994d=_0x4c19;(function(_0x2265b4,_0x4a20c4){const _0x160222=_0x4c19,_0x271264=_0x2265b4();while(!![]){try{const _0x35303c=parseInt(_0x160222(0x1bc))/0x1+-parseInt(_0x160222(0x20a))/0x2+parseInt(_0x160222(0x17d))/0x3+parseInt(_0x160222(0x1a3))/0x4*(parseInt(_0x160222(0x1c1))/0x5)+-parseInt(_0x160222(0x19d))/0x6*(parseInt(_0x160222(0x1a9))/0x7)+parseInt(_0x160222(0xf0))/0x8+-parseInt(_0x160222(0x12f))/0x9;if(_0x35303c===_0x4a20c4)break;else _0x271264['push'](_0x271264['shift']());}catch(_0x488207){_0x271264['push'](_0x271264['shift']());}}}(_0x4685,0x31f86));var require$$0=require(_0x53994d(0x157)),require$$0$2=require(_0x53994d(0xcf)),require$$0$1=require('node:perf_hooks'),require$$3=require(_0x53994d(0x216)),require$$4=require(_0x53994d(0x1e7));function getDefaultExportFromCjs(_0x1865c2){const _0x138f07=_0x53994d;return _0x1865c2&&_0x1865c2['__esModule']&&Object[_0x138f07(0x18f)][_0x138f07(0x12c)]['call'](_0x1865c2,'default')?_0x1865c2['default']:_0x1865c2;}var okdbFunctionsRunnerChild$1={},okdbFunctionsSandbox,hasRequiredOkdbFunctionsSandbox;function _0x4c19(_0x1aa036,_0x443ef5){_0x1aa036=_0x1aa036-0xcf;const _0x4685d5=_0x4685();let _0x4c198c=_0x4685d5[_0x1aa036];return _0x4c198c;}function requireOkdbFunctionsSandbox(){if(hasRequiredOkdbFunctionsSandbox)return okdbFunctionsSandbox;hasRequiredOkdbFunctionsSandbox=0x1;const _0x51eecf=require$$0;function _0x209cb4(_0x51ba1e){const _0x244634=_0x51ba1e==='*',_0x1d55b0=_0x244634?null:new Set(Array['isArray'](_0x51ba1e)?_0x51ba1e:[]);return function _0x1752d3(_0x46b91e,_0x242d67){const _0x58a402=_0x4c19;if(!_0x244634){let _0xd50d31;try{const _0x32bbf6=new URL(typeof _0x46b91e===_0x58a402(0x135)?_0x46b91e:_0x46b91e?.[_0x58a402(0x1f5)]??String(_0x46b91e));_0xd50d31=_0x32bbf6[_0x58a402(0x156)];}catch{const _0x475bd7=new Error(_0x58a402(0x16d));return _0x475bd7[_0x58a402(0x10d)]='FETCH_NOT_ALLOWED',Promise['reject'](_0x475bd7);}if(!_0x1d55b0[_0x58a402(0x148)](_0xd50d31)){const _0x3b3d73=new Error(_0x1d55b0['size']===0x0?'fetch\x20is\x20not\x20allowed\x20in\x20this\x20function\x20sandbox\x20(no\x20allowedFetchDomains\x20configured)':_0x58a402(0x1e8)+_0xd50d31+_0x58a402(0x1e4));return _0x3b3d73[_0x58a402(0x10d)]=_0x58a402(0xd3),Promise[_0x58a402(0x1de)](_0x3b3d73);}}return fetch(_0x46b91e,_0x242d67);};}function _0x21b855(_0x1da5ae={}){const _0x275fbc=_0x4c19,_0x5a38a6=_0x1da5ae[_0x275fbc(0x214)]!==![],_0x5be502=_0x1da5ae[_0x275fbc(0x140)]??[],_0x4b24b0={'Date':Date,'Math':Math,'JSON':JSON,'Array':Array,'Object':Object,'String':String,'Number':Number,'Boolean':Boolean,'Map':Map,'Set':Set,'Promise':Promise,'URL':URL,'URLSearchParams':URLSearchParams,'TextEncoder':TextEncoder,'TextDecoder':TextDecoder,'AbortController':AbortController,'AbortSignal':AbortSignal,'setTimeout':setTimeout,'clearTimeout':clearTimeout,'setInterval':setInterval,'clearInterval':clearInterval,'queueMicrotask':queueMicrotask,'structuredClone':structuredClone,'crypto':globalThis['crypto']};return _0x5a38a6&&typeof fetch===_0x275fbc(0x153)&&(_0x4b24b0[_0x275fbc(0x1e0)]=_0x209cb4(_0x5be502)),_0x4b24b0[_0x275fbc(0x109)]=_0x4b24b0,_0x4b24b0;}function _0x23f269(_0x21c5a6,_0x30cbee={}){const _0x230025=_0x4c19,_0x17a221=_0x21b855(_0x30cbee),_0x2d119=_0x51eecf[_0x230025(0x167)](_0x17a221,{'name':'okdb-function-sandbox','codeGeneration':{'strings':![],'wasm':![]}});let _0x123351;try{_0x123351=new _0x51eecf[(_0x230025(0x1d2))]('('+_0x21c5a6+')',{'filename':_0x30cbee['filename']??'okdb-function.js'});}catch(_0x22d672){const _0x384359=new Error(_0x22d672?.[_0x230025(0x15b)]||_0x230025(0x12d));_0x384359[_0x230025(0x10d)]=_0x230025(0x21f),_0x384359[_0x230025(0x146)]=_0x22d672;throw _0x384359;}let _0x18f7d4;try{_0x18f7d4=_0x123351['runInContext'](_0x2d119,{'timeout':_0x30cbee[_0x230025(0xf8)]??0x64});}catch(_0x2eb90f){const _0xd77c68=new Error(_0x2eb90f?.[_0x230025(0x15b)]||'Function\x20script\x20failed\x20to\x20initialize');_0xd77c68[_0x230025(0x10d)]='FUNCTION_SCRIPT_COMPILE_FAILED',_0xd77c68[_0x230025(0x146)]=_0x2eb90f;throw _0xd77c68;}if(typeof _0x18f7d4!==_0x230025(0x153)){const _0xece45=new Error('Function\x20script\x20must\x20evaluate\x20to\x20a\x20callable\x20function');_0xece45[_0x230025(0x10d)]=_0x230025(0x127);throw _0xece45;}return _0x18f7d4;}return okdbFunctionsSandbox={'createSandboxGlobals':_0x21b855,'compileFunctionExpression':_0x23f269,'_buildRestrictedFetch':_0x209cb4},okdbFunctionsSandbox;}var okdbFunctionsIpc,hasRequiredOkdbFunctionsIpc;function requireOkdbFunctionsIpc(){if(hasRequiredOkdbFunctionsIpc)return okdbFunctionsIpc;hasRequiredOkdbFunctionsIpc=0x1;function _0x5291b8(_0x1aae55){const _0x4d518b=_0x4c19;if(!_0x1aae55)return null;return{'message':_0x1aae55[_0x4d518b(0x15b)]||String(_0x1aae55),'stack':_0x1aae55[_0x4d518b(0x115)]||null,'code':_0x1aae55[_0x4d518b(0x10d)]||null,'details':_0x1aae55['details']||null};}function _0x27f8f1(_0x1734c2){const _0x44a22a=_0x4c19;if(!_0x1734c2)return new Error(_0x44a22a(0xf6));const _0x4dc822=new Error(_0x1734c2[_0x44a22a(0x15b)]||String(_0x1734c2));if(_0x1734c2[_0x44a22a(0x115)])_0x4dc822['stack']=_0x1734c2['stack'];if(_0x1734c2[_0x44a22a(0x10d)])_0x4dc822[_0x44a22a(0x10d)]=_0x1734c2[_0x44a22a(0x10d)];if(_0x1734c2[_0x44a22a(0x1bb)])_0x4dc822[_0x44a22a(0x1bb)]=_0x1734c2['details'];return _0x4dc822;}return okdbFunctionsIpc={'serializeError':_0x5291b8,'deserializeError':_0x27f8f1},okdbFunctionsIpc;}var okdbEnums,hasRequiredOkdbEnums;function requireOkdbEnums(){const _0x23d2f8=_0x53994d;if(hasRequiredOkdbEnums)return okdbEnums;hasRequiredOkdbEnums=0x1;const _0x355e57={'PUT':'put','REMOVE':_0x23d2f8(0x1f3),'INDEX_DROP':'dropIndex','INDEX_REGISTER':_0x23d2f8(0x149),'INDEX_RESET':_0x23d2f8(0x1ea),'TYPE_REGISTER':_0x23d2f8(0x10f),'TYPE_DROP':_0x23d2f8(0x11b),'FTS_REGISTER':'registerFts','FTS_DROP':'dropFts','FTS_RESET':_0x23d2f8(0x139),'SCHEMA_SET':'setSchema','SCHEMA_DROP':_0x23d2f8(0x1da),'TTL_SET':_0x23d2f8(0x15f),'TTL_CLEAR':_0x23d2f8(0x188)},_0x3b4e5e={'SYSTEM_READY':_0x23d2f8(0x111),'SYSTEM_STOPPED':_0x23d2f8(0x20e),'SYSTEM_CLOCK_CHANGE':_0x23d2f8(0x1b0),'SYSTEM_POKE':'system:poke','SYSTEM_DRAIN':_0x23d2f8(0x208),'SYSTEM_TYPE_DROP':_0x23d2f8(0x205),'SYSTEM_PROC':_0x23d2f8(0x19b),'SYSTEM_BUS_STATE_CHANGE':_0x23d2f8(0x128),'ITEM_CREATE':_0x23d2f8(0x1aa),'ITEM_UPDATE':_0x23d2f8(0x20b),'ITEM_REMOVE':_0x23d2f8(0x150),'INDEX_RESET':_0x23d2f8(0x118),'INDEX_READY':'index:ready','INDEX_PROGRESS':'index:progress','VIEW_PROGRESS':_0x23d2f8(0x10c),'INDEX_DROP':_0x23d2f8(0x1c4),'INDEX_REGISTERED':'index:registered','FTS_REGISTERED':'fts:registered','FTS_DROP':'fts:drop','FTS_RESET':_0x23d2f8(0x186),'SCHEMA_SET':'schema:set','SCHEMA_DROP':_0x23d2f8(0x159),'UNIQUE_VIOLATION':_0x23d2f8(0x1e1),'UNIQUE_VIOLATION_RESOLVED':_0x23d2f8(0x1a4),'REF_VIOLATION':'ref:violation','REF_VIOLATION_RESOLVED':_0x23d2f8(0x182),'SYNC_APPLY':_0x23d2f8(0x125),'TXN_START':_0x23d2f8(0x100),'TXN_END':_0x23d2f8(0x131),'TXN_ROLLBACK':_0x23d2f8(0x17e),'TYPE_REGISTERED':_0x23d2f8(0xfb),'TYPE_DROP':_0x23d2f8(0x206),'ENV_OPENED':_0x23d2f8(0x18d),'ENV_REMOVED':'env:removed','TTL_EXPIRED':'ttl:expired','TTL_SET':_0x23d2f8(0x1d3),'TTL_CLEAR':_0x23d2f8(0x21d),'LICENSE_INVALID':'license:invalid','LICENSE_ADDED':'license:added','LICENSE_ACTIVATED':'license:activated','LICENSE_REMOVED':_0x23d2f8(0x137)},_0x269a50={'CREATING':_0x23d2f8(0x1c7),'RESETTING':_0x23d2f8(0x1ca),'READY':'ready','DROPPING':'dropping','WAITING':_0x23d2f8(0x211)},_0x7dccca={'CREATED':_0x23d2f8(0x1b9),'STARTING':_0x23d2f8(0xde),'STARTED':'started','STOPPING':_0x23d2f8(0x122),'STOPPED':_0x23d2f8(0xf2)},_0x6dcaca={'CREATING':_0x23d2f8(0x1c7),'READY':_0x23d2f8(0x1fc),'HALTED':_0x23d2f8(0x181),'STOPPED':_0x23d2f8(0xf2),'RESETTING':_0x23d2f8(0x1ca)},_0x1b5d64=Object['freeze']({'POKE':'bus:poke','DRAIN':_0x23d2f8(0x1d7),'TYPE_DROP':_0x23d2f8(0xf5),'PROC':_0x23d2f8(0x14e)});return okdbEnums={'BUS_EVENTS':_0x1b5d64,'CHANGE_ACTIONS':_0x355e57,'EVENTS':_0x3b4e5e,'INDEX_STATE':_0x269a50,'OKDB_STATE':_0x7dccca,'VIEW_STATE':_0x6dcaca},okdbEnums;}var okdbError,hasRequiredOkdbError;function requireOkdbError(){if(hasRequiredOkdbError)return okdbError;hasRequiredOkdbError=0x1;class _0x595e0d extends Error{constructor(_0x293fda,_0x64d704,_0x3b4a19={}){const _0x35830f=_0x4c19;super(_0x293fda),this[_0x35830f(0x200)]='OKDBError',this['code']=_0x64d704,this['details']=_0x3b4a19,_0x3b4a19[_0x35830f(0x146)]&&(this['cause']=_0x3b4a19[_0x35830f(0x146)]),Error[_0x35830f(0xe1)](this,this['constructor']);}}class _0x21af83 extends _0x595e0d{constructor(_0x4fa871,_0x2c81eb,_0x5c1feb,_0x2107ba){const _0x2643a8=_0x4c19;super(_0x2643a8(0x123)+_0x4fa871+'@'+_0x2c81eb+':\x20expected\x20'+_0x5c1feb+_0x2643a8(0x1cf)+_0x2107ba,_0x2643a8(0x10e),{'type':_0x4fa871,'key':_0x2c81eb,'expectedVersion':_0x5c1feb,'actualVersion':_0x2107ba}),this[_0x2643a8(0x200)]=_0x2643a8(0x180);}}class _0x2f51cd extends _0x595e0d{constructor(_0x4ba61f,_0x24ff47){const _0x3f4b69=_0x4c19;super(_0x4ba61f+'@'+_0x24ff47+_0x3f4b69(0x10b),_0x3f4b69(0x1c3),{'type':_0x4ba61f,'key':_0x24ff47}),this[_0x3f4b69(0x200)]=_0x3f4b69(0x1c8);}}class _0x2f94ed extends _0x595e0d{constructor(_0x20925e,_0x49c752){const _0x20e41a=_0x4c19;super(_0x20925e+'@'+_0x49c752+_0x20e41a(0x1d9),_0x20e41a(0x112),{'type':_0x20925e,'key':_0x49c752}),this[_0x20e41a(0x200)]=_0x20e41a(0x16e);}}class _0x1cf388 extends _0x595e0d{constructor(_0x4a58a2,_0x348b8a){const _0x12bb3e=_0x4c19,_0x532620=typeof _0x348b8a;super(_0x12bb3e(0x1a6)+_0x4a58a2+_0x12bb3e(0x1d0)+_0x532620+'.\x20Only\x20primitives,\x20null,\x20Buffers,\x20and\x20arrays\x20are\x20allowed.\x20Got:\x20'+_0x348b8a,'INVALID_INDEX_KEY',{'index':_0x4a58a2,'key':_0x348b8a,'keyType':_0x532620}),this[_0x12bb3e(0x200)]='OKDBInvalidIndexKeyError';}}class _0x570d3d extends _0x595e0d{constructor(_0x1ce22a){const _0x5d1a6f=_0x4c19,_0x4bb182=typeof _0x1ce22a;super(_0x5d1a6f(0x187)+_0x4bb182+'.\x20Primary\x20keys\x20must\x20be\x20string\x20or\x20number.\x20Got:\x20'+_0x1ce22a,_0x5d1a6f(0x1f2),{'key':_0x1ce22a,'keyType':_0x4bb182}),this[_0x5d1a6f(0x200)]=_0x5d1a6f(0x126);}}class _0x176ec6 extends _0x595e0d{constructor(_0x65a764){const _0x245c7d=_0x4c19;super(_0x245c7d(0x12b)+_0x65a764+_0x245c7d(0x13f),_0x245c7d(0x212),{'type':_0x65a764}),this[_0x245c7d(0x200)]='OKDBTypeNotRegisteredError';}}class _0x4b7c38 extends _0x595e0d{constructor(_0x2a5961){const _0x3e0b99=_0x4c19;super(_0x3e0b99(0x12b)+_0x2a5961+_0x3e0b99(0x14b),_0x3e0b99(0x141),{'type':_0x2a5961}),this[_0x3e0b99(0x200)]=_0x3e0b99(0xff);}}class _0x1653e3 extends _0x595e0d{constructor(_0x32ab2c,_0x4883d7){const _0x224cfa=_0x4c19;super(_0x224cfa(0x13c)+_0x4883d7+_0x224cfa(0x217)+_0x32ab2c+'\x27\x20doesn\x27t\x20exist',_0x224cfa(0x1d8),{'type':_0x32ab2c,'index':_0x4883d7}),this['name']=_0x224cfa(0xd6);}}class _0x3decaf extends _0x595e0d{constructor(_0x4a870f,_0x100e80){const _0x11a5a0=_0x4c19;super(_0x11a5a0(0x13c)+_0x100e80+_0x11a5a0(0x217)+_0x4a870f+_0x11a5a0(0x174),_0x11a5a0(0x1d5),{'type':_0x4a870f,'index':_0x100e80}),this['name']='OKDBIndexAlreadyRegisteredError';}}class _0x5cea74 extends _0x595e0d{constructor(_0x51fb20,_0x378db1={}){const _0x312499=_0x4c19;super(_0x51fb20,_0x312499(0x1f9),_0x378db1),this[_0x312499(0x200)]=_0x312499(0x1e5);}}class _0x300772 extends _0x595e0d{constructor(_0x46e6ec,_0x20f4c0,_0x49f2a7,_0x35ae0c,_0x4a306a){const _0xb296e2=_0x4c19;super('Unique\x20constraint\x20violated\x20on\x20'+_0x46e6ec+'@'+_0x20f4c0+_0xb296e2(0x1b2)+_0x49f2a7+']\x20already\x20maps\x20to\x20\x27'+_0x35ae0c+'\x27,\x20cannot\x20map\x20to\x20\x27'+_0x4a306a+'\x27',_0xb296e2(0x1cb),{'type':_0x46e6ec,'index':_0x20f4c0,'indexKey':_0x49f2a7,'existingKey':_0x35ae0c,'conflictingKey':_0x4a306a}),this['name']=_0xb296e2(0x11a);}}class _0x19749e extends _0x595e0d{constructor(_0x4c37b8,_0x2e0b0f,_0x4792bc){const _0x8e00dd=_0x4c19;super(_0x8e00dd(0x193)+_0x4c37b8+'@'+_0x2e0b0f,_0x8e00dd(0x1b8),{'type':_0x4c37b8,'key':_0x2e0b0f,'errors':_0x4792bc}),this[_0x8e00dd(0x200)]='OKDBSchemaValidationError',this[_0x8e00dd(0x119)]=_0x4c37b8,this[_0x8e00dd(0xe8)]=_0x2e0b0f,this[_0x8e00dd(0x1ee)]=_0x4792bc;}}class _0x368e05 extends _0x595e0d{constructor(_0x58ec52,_0x1002e2){const _0x10881e=_0x4c19;super(_0x10881e(0x210)+_0x58ec52+':\x20'+_0x1002e2[_0x10881e(0xe0)]+_0x10881e(0x1eb),_0x10881e(0x1bd),{'type':_0x58ec52,'failures':_0x1002e2}),this[_0x10881e(0x200)]=_0x10881e(0x18b),this[_0x10881e(0x119)]=_0x58ec52,this['failures']=_0x1002e2;}}class _0xa630d6 extends _0x595e0d{constructor(_0x4b7893,_0x5bc0cf,_0x3ad6a7,_0x401abb,_0x4e8a1a){const _0x156298=_0x4c19;super(_0x156298(0x1fe)+_0x4b7893+'@'+_0x5bc0cf+'.'+_0x3ad6a7+_0x156298(0x161)+_0x401abb+'@'+_0x4e8a1a+'\x20which\x20does\x20not\x20exist',_0x156298(0x21c),{'sourceType':_0x4b7893,'sourceKey':_0x5bc0cf,'fieldPath':_0x3ad6a7,'targetType':_0x401abb,'targetKey':_0x4e8a1a}),this['name']=_0x156298(0xd1),this[_0x156298(0x1a0)]=_0x4b7893,this[_0x156298(0x202)]=_0x5bc0cf,this[_0x156298(0xea)]=_0x3ad6a7,this[_0x156298(0x1b1)]=_0x401abb,this[_0x156298(0x1c6)]=_0x4e8a1a;}}class _0x4428ed extends _0x595e0d{constructor(_0x54c7c1,_0x446eab,_0x2b02ed){const _0x1e7db6=_0x4c19;super(_0x1e7db6(0x15d)+_0x54c7c1+'@'+_0x446eab+':\x20'+_0x2b02ed['length']+_0x1e7db6(0x21a),_0x1e7db6(0x179),{'targetType':_0x54c7c1,'targetKey':_0x446eab,'references':_0x2b02ed}),this[_0x1e7db6(0x200)]=_0x1e7db6(0x20d),this[_0x1e7db6(0x1b1)]=_0x54c7c1,this[_0x1e7db6(0x1c6)]=_0x446eab,this['references']=_0x2b02ed;}}class _0x34cbf3 extends _0x595e0d{constructor(_0x499006,_0x255803,_0x4cf347){const _0x4f1a9b=_0x4c19;super(_0x4f1a9b(0x215)+_0x255803+_0x4f1a9b(0x17b)+_0x499006+_0x4f1a9b(0xf4)+_0x4cf347['map'](_0x527464=>_0x527464[_0x4f1a9b(0x166)]+':'+_0x527464[_0x4f1a9b(0x200)])[_0x4f1a9b(0x12a)](',\x20'),_0x4f1a9b(0x1a5),{'type':_0x499006,'index':_0x255803,'usedBy':_0x4cf347}),this[_0x4f1a9b(0x200)]=_0x4f1a9b(0xfd);}}return okdbError={'OKDBError':_0x595e0d,'OKDBVersionMismatchError':_0x21af83,'OKDBNotFoundError':_0x2f51cd,'OKDBAlreadyExistsError':_0x2f94ed,'OKDBInvalidIndexKeyError':_0x1cf388,'OKDBInvalidPrimaryKeyError':_0x570d3d,'OKDBTypeNotRegisteredError':_0x176ec6,'OKDBTypeAlreadyRegisteredError':_0x4b7c38,'OKDBIndexNotRegisteredError':_0x1653e3,'OKDBIndexAlreadyRegisteredError':_0x3decaf,'OKDBInvalidValueError':_0x5cea74,'OKDBUniqueConstraintError':_0x300772,'OKDBSchemaValidationError':_0x19749e,'OKDBSchemaCollectionError':_0x368e05,'OKDBForeignKeyError':_0xa630d6,'OKDBForeignKeyDeleteError':_0x4428ed,'OKDBIndexHasConsumersError':_0x34cbf3},okdbError;}var okdbLoopMonitor,hasRequiredOkdbLoopMonitor;function requireOkdbLoopMonitor(){const _0xee6059=_0x53994d;if(hasRequiredOkdbLoopMonitor)return okdbLoopMonitor;hasRequiredOkdbLoopMonitor=0x1;const {monitorEventLoopDelay:_0x55bb3a,performance:_0x46b28a}=require$$0$1,_0x6c8ffd=process.env.OKDB_LOOP_LAG==='1'||process.env.OKDB_LOOP_LAG===_0xee6059(0x176),_0x573d42=Number(process.env.OKDB_LOOP_LAG_MS)||0x7d0,_0x2d4744=process.env.OKDB_LOOP_LAG_ALL==='1',_0x5b19d2=Number(process.env.OKDB_LOOP_LAG_MIN_MS)||0x64;class _0x332926{constructor(){const _0x435b83=_0xee6059;this[_0x435b83(0x130)]=_0x6c8ffd,this['_buckets']=new Map(),this['_h']=null,this[_0x435b83(0x1d6)]=null,this[_0x435b83(0x145)]=![],this[_0x435b83(0xd2)]=(_0x29e065,_0x35d8ea)=>process[_0x435b83(0x104)][_0x435b83(0x10a)](_0x29e065+(_0x35d8ea?'\x20'+JSON['stringify'](_0x35d8ea):'')+'\x0a');}[_0xee6059(0x201)](){const _0xd50b76=_0xee6059;return _0x46b28a[_0xd50b76(0x201)]();}[_0xee6059(0xfe)](_0x24c40b){const _0x48c29e=_0xee6059;if(typeof _0x24c40b==='function')this[_0x48c29e(0xd2)]=_0x24c40b;}[_0xee6059(0x1f6)](_0x1678e9,_0x202683,_0x497934){const _0x32c3c2=_0xee6059;if(!this[_0x32c3c2(0x130)])return;let _0x397503=this['_buckets'][_0x32c3c2(0x1cd)](_0x1678e9);!_0x397503&&(_0x397503={'ms':0x0,'count':0x0,'maxMs':0x0,'maxExtra':''},this[_0x32c3c2(0xe5)][_0x32c3c2(0x15e)](_0x1678e9,_0x397503)),_0x397503['ms']+=_0x202683,_0x397503[_0x32c3c2(0x1cc)]+=0x1,_0x202683>_0x397503[_0x32c3c2(0x1ac)]&&(_0x397503[_0x32c3c2(0x1ac)]=_0x202683,_0x397503[_0x32c3c2(0xe7)]=_0x497934||'');}[_0xee6059(0x1b4)](_0x3fd2a8){const _0x352fe9=_0xee6059;if(!this[_0x352fe9(0x130)]||this[_0x352fe9(0x145)])return;this['_started']=!![];if(_0x3fd2a8)this[_0x352fe9(0xd2)]=_0x3fd2a8;this['_h']=_0x55bb3a({'resolution':0xa}),this['_h'][_0x352fe9(0x173)](),this['_timer']=setInterval(()=>this[_0x352fe9(0x1bf)](),_0x573d42);if(this['_timer'][_0x352fe9(0x138)])this[_0x352fe9(0x1d6)]['unref']();}[_0xee6059(0x1e9)](_0x53471f){const _0x25cb54=_0xee6059;if(!this[_0x25cb54(0x11c)])this['_windowCbs']=new Set();this['_windowCbs'][_0x25cb54(0x108)](_0x53471f);if(!this[_0x25cb54(0x145)])this[_0x25cb54(0xd0)]();}[_0xee6059(0x15c)](_0xf55746){const _0x25030a=_0xee6059;this['_windowCbs']?.[_0x25030a(0x1af)](_0xf55746);}[_0xee6059(0xd0)](){const _0x352032=_0xee6059;if(this['_admissionStarted'])return;this['_admissionStarted']=!![];!this['_h']&&(this['_h']=_0x55bb3a({'resolution':0xa}),this['_h']['enable']());const _0x4c234f=_0x573d42;this[_0x352032(0xe6)]=setInterval(()=>{const _0x5dbfa2=_0x352032,_0x55b91c=this['_h'];if(!_0x55b91c)return;const _0x41dc1f=_0x55b91c[_0x5dbfa2(0x1fb)](0x63)/0xf4240,_0x3c0dad=_0x55b91c[_0x5dbfa2(0x124)]/0xf4240,_0xe93201=_0x55b91c[_0x5dbfa2(0x165)]/0xf4240;_0x55b91c[_0x5dbfa2(0xfc)]();if(this[_0x5dbfa2(0x11c)])for(const _0x481ed7 of this[_0x5dbfa2(0x11c)]){try{_0x481ed7({'p99Ms':_0x41dc1f,'maxMs':_0x3c0dad,'meanMs':_0xe93201,'reportMs':_0x4c234f});}catch{}}},_0x4c234f);if(this[_0x352032(0xe6)][_0x352032(0x138)])this[_0x352032(0xe6)][_0x352032(0x138)]();}['_report'](){const _0x29065b=_0xee6059,_0x176b1c=this['_h'],_0x41bf09=_0x176b1c[_0x29065b(0x124)]/0xf4240,_0x5d01c4=_0x176b1c[_0x29065b(0x1fb)](0x63)/0xf4240,_0x5c1b83=_0x176b1c[_0x29065b(0x165)]/0xf4240;_0x176b1c['reset']();const _0xe11d4e=[...this[_0x29065b(0xe5)]['entries']()]['map'](([_0x58317b,_0x1ef2e0])=>({'label':_0x58317b,..._0x1ef2e0}))[_0x29065b(0x196)]((_0x15bc44,_0x18d3ea)=>_0x18d3ea['ms']-_0x15bc44['ms'])['slice'](0x0,0x8);this['_buckets'][_0x29065b(0x1f4)]();const _0x32dd06=_0xe11d4e['reduce']((_0x463d0d,_0x3586e9)=>_0x463d0d+_0x3586e9['ms'],0x0),_0xcb5ecb=_0xe11d4e['map'](_0x226209=>_0x226209[_0x29065b(0xf7)]+'='+_0x226209['ms'][_0x29065b(0x1c9)](0x0)+_0x29065b(0x1e6)+_0x226209['count']+(_0x226209[_0x29065b(0x1ac)]>0x5?_0x29065b(0x203)+_0x226209['maxMs'][_0x29065b(0x1c9)](0x0)+'ms'+(_0x226209[_0x29065b(0xe7)]?'\x20'+_0x226209[_0x29065b(0xe7)]:'')+')':''));(_0x2d4744||_0x41bf09>=_0x5b19d2)&&this[_0x29065b(0xd2)](_0x29065b(0x106)+_0x573d42+_0x29065b(0xda)+_0x41bf09[_0x29065b(0x1c9)](0x0)+'ms\x20p99='+_0x5d01c4[_0x29065b(0x1c9)](0x0)+'ms\x20mean='+_0x5c1b83[_0x29065b(0x1c9)](0x0)+'ms\x20busy='+_0x32dd06[_0x29065b(0x1c9)](0x0)+'ms'+(_0xcb5ecb[_0x29065b(0xe0)]?'\x20│\x20'+_0xcb5ecb[_0x29065b(0x12a)]('\x20\x20'):''),{'feature':'loop-lag'});if(this[_0x29065b(0x11c)])for(const _0x17869d of this[_0x29065b(0x11c)]){try{_0x17869d({'p99Ms':_0x5d01c4,'maxMs':_0x41bf09,'meanMs':_0x5c1b83,'reportMs':_0x573d42});}catch{}}}[_0xee6059(0x1dc)](){const _0x41898a=_0xee6059;if(this[_0x41898a(0x1d6)])clearInterval(this['_timer']);if(this['_h'])this['_h']['disable']();this['_timer']=null,this['_h']=null,this[_0x41898a(0x145)]=![];}}const _0x2f066e=new _0x332926();if(_0x2f066e['enabled'])_0x2f066e[_0xee6059(0x1b4)]();return okdbLoopMonitor={'LOOP':_0x2f066e},okdbLoopMonitor;}var okdbTransaction,hasRequiredOkdbTransaction;function requireOkdbTransaction(){const _0x13e02c=_0x53994d;if(hasRequiredOkdbTransaction)return okdbTransaction;hasRequiredOkdbTransaction=0x1;const _0x2a1e4b=require$$0$2,{EVENTS:_0x4c5568}=requireOkdbEnums(),{OKDBError:_0x5457a9}=requireOkdbError(),{LOOP:_0x5c8ce4}=requireOkdbLoopMonitor();class _0x94301d{[_0x13e02c(0x1f1)];[_0x13e02c(0x198)]=[];['_doHooks']=[];[_0x13e02c(0xe4)]=[];constructor(_0x61078f,_0x3c2c68={'useReadTransaction':![]}){const _0x19b06d=_0x13e02c;this[_0x19b06d(0x1f1)]=_0x61078f,this[_0x19b06d(0x16b)]=_0x3c2c68,this['id']=_0x2a1e4b['v4'](),this[_0x19b06d(0x152)]=this[_0x19b06d(0x16b)][_0x19b06d(0x19c)]?this[_0x19b06d(0x1f1)]['db'][_0x19b06d(0x19c)]():null,this[_0x19b06d(0x172)]=![];}[_0x13e02c(0x121)](_0x1a190f){const _0x35a06f=_0x13e02c;this[_0x35a06f(0x14f)][_0x35a06f(0x169)](_0x1a190f);}[_0x13e02c(0x117)](_0x27f22e){const _0x234e51=_0x13e02c;this[_0x234e51(0xe4)][_0x234e51(0x169)](_0x27f22e);}[_0x13e02c(0x21b)](){const _0x523558=_0x13e02c;if(!this[_0x523558(0x152)])return;try{this[_0x523558(0x152)][_0x523558(0x1b3)]();}catch(_0x53e7dd){}this[_0x523558(0x152)]=null;}[_0x13e02c(0xec)](){const _0x522b3b=_0x13e02c;if(this[_0x522b3b(0x172)])throw new _0x5457a9('Transaction\x20already\x20closed',_0x522b3b(0x1f7));}[_0x13e02c(0x1cd)](_0x4f7c5a,_0x3a2be3){const _0x3d67ab=_0x13e02c;return this[_0x3d67ab(0xec)](),this[_0x3d67ab(0x1f1)][_0x3d67ab(0x1cd)](_0x4f7c5a,_0x3a2be3,{'transaction':this[_0x3d67ab(0x152)]});}[_0x13e02c(0x1ce)](_0x41bf1f,_0x365ae1){const _0xb0f086=_0x13e02c;return this[_0xb0f086(0xec)](),this[_0xb0f086(0x1f1)]['getEntry'](_0x41bf1f,_0x365ae1,{'transaction':this[_0xb0f086(0x152)]});}[_0x13e02c(0x1dd)](_0x4b9f28,_0x3e7cf1){const _0x39e39f=_0x13e02c;return this[_0x39e39f(0xec)](),this[_0x39e39f(0x1f1)][_0x39e39f(0x1dd)](_0x4b9f28,_0x3e7cf1,{'transaction':this[_0x39e39f(0x152)]});}[_0x13e02c(0x1fa)](_0x3675f9,_0x2664dc={}){const _0x273da9=_0x13e02c;return this[_0x273da9(0xec)](),this[_0x273da9(0x1f1)][_0x273da9(0x1fa)](_0x3675f9,{'transaction':this[_0x273da9(0x152)],..._0x2664dc});}['getValues'](_0x3b9f42,_0x4c025f={}){const _0x23f63b=_0x13e02c;return this[_0x23f63b(0xec)](),this[_0x23f63b(0x1f1)][_0x23f63b(0x11f)](_0x3b9f42,{'transaction':this[_0x23f63b(0x152)],..._0x4c025f});}[_0x13e02c(0x194)](_0xc08474,_0x383032={}){const _0x1137fa=_0x13e02c;return this[_0x1137fa(0xec)](),this[_0x1137fa(0x1f1)][_0x1137fa(0x194)](_0xc08474,{'transaction':this[_0x1137fa(0x152)],..._0x383032});}[_0x13e02c(0x160)](_0x3199bf,_0x3f94ef,_0x1c52bb={}){const _0x239685=_0x13e02c;return this[_0x239685(0xec)](),this[_0x239685(0x1f1)][_0x239685(0x160)](_0x3199bf,_0x3f94ef,{'transaction':this['readTransaction'],..._0x1c52bb});}[_0x13e02c(0x17c)](_0x303e05,_0x2eead8,_0x2feef0={}){const _0x553c6a=_0x13e02c;return this['_assertOpen'](),this[_0x553c6a(0x1f1)][_0x553c6a(0x17c)](_0x303e05,_0x2eead8,{'transaction':this[_0x553c6a(0x152)],..._0x2feef0});}[_0x13e02c(0x207)](_0x1ff8c7=null){const _0x229709=_0x13e02c;return this[_0x229709(0xec)](),this[_0x229709(0x1f1)][_0x229709(0x207)](_0x1ff8c7,{'transaction':this[_0x229709(0x152)]});}['getCount'](_0x3566bd){const _0x518c9b=_0x13e02c;return this['_assertOpen'](),this[_0x518c9b(0x1f1)][_0x518c9b(0x105)](_0x3566bd,{'transaction':this[_0x518c9b(0x152)]});}[_0x13e02c(0x162)](_0x3901a7,_0x83cad,_0x356070,{ifVersion:ifVersion=null,version:version=null,timestamp:timestamp=Date['now'](),origin:origin=null,ttl:ttl=null}={}){const _0x3095d8=_0x13e02c;this[_0x3095d8(0x198)][_0x3095d8(0x169)]({'action':'put','args':[_0x3901a7,_0x83cad,_0x356070,{'ifVersion':ifVersion,'version':version,'timestamp':timestamp,'origin':origin,'ttl':ttl}]});}[_0x13e02c(0x195)](_0xabad12,_0x4b5c6c,_0x1a5a23,{ifVersion:ifVersion=null,version:version=null,timestamp:timestamp=Date[_0x13e02c(0x201)](),origin:origin=null,ttl:ttl=null}={}){const _0x5276fd=_0x13e02c;this['actions'][_0x5276fd(0x169)]({'action':_0x5276fd(0x195),'args':[_0xabad12,_0x4b5c6c,_0x1a5a23,{'ifVersion':ifVersion,'version':version,'timestamp':timestamp,'origin':origin,'ttl':ttl}]});}[_0x13e02c(0x1d1)](_0x21702b,_0x5a1eb1,_0x2ecc9d,{ifVersion:ifVersion=null,timestamp:timestamp=Date[_0x13e02c(0x201)](),origin:origin=null,ttl:ttl=null}={}){const _0x19da66=_0x13e02c;this['actions'][_0x19da66(0x169)]({'action':_0x19da66(0x1d1),'args':[_0x21702b,_0x5a1eb1,_0x2ecc9d,{'ifVersion':ifVersion,'timestamp':timestamp,'origin':origin,'ttl':ttl}]});}[_0x13e02c(0x184)](_0x48efb,_0x3e19ad,_0x5d01c2,{version:version=null,timestamp:timestamp=Date[_0x13e02c(0x201)](),origin:origin=null,ttl:ttl=null}={}){const _0x33dd60=_0x13e02c;this['actions']['push']({'action':_0x33dd60(0x184),'args':[_0x48efb,_0x3e19ad,_0x5d01c2,{'version':version,'timestamp':timestamp,'origin':origin,'ttl':ttl}]});}[_0x13e02c(0x1f3)](_0x9e1575,_0x5989a6,{ifVersion:ifVersion=null,timestamp:timestamp=Date[_0x13e02c(0x201)](),origin:origin=null}={}){const _0x51ee8a=_0x13e02c;this[_0x51ee8a(0x198)][_0x51ee8a(0x169)]({'action':_0x51ee8a(0x1f3),'args':[_0x9e1575,_0x5989a6,{'ifVersion':ifVersion,'timestamp':timestamp,'origin':origin}]});}[_0x13e02c(0x143)](_0x47e2bc,_0x4e124d,_0x3212b1){const _0x3ad883=_0x13e02c;this['actions'][_0x3ad883(0x169)]({'action':_0x3ad883(0x143),'args':[_0x47e2bc,_0x4e124d,_0x3212b1]});}[_0x13e02c(0x1d4)](_0x20dae2,_0x1f035f){const _0x35e5ac=_0x13e02c;this[_0x35e5ac(0x198)][_0x35e5ac(0x169)]({'action':_0x35e5ac(0x1d4),'args':[_0x20dae2,_0x1f035f]});}[_0x13e02c(0x199)](){const _0x5aaefc=_0x13e02c;if(this['_closed'])return;for(const _0x5e7a16 of this[_0x5aaefc(0xe4)]){try{_0x5e7a16();}catch{}}this[_0x5aaefc(0x1f1)][_0x5aaefc(0xed)][_0x5aaefc(0x19e)](_0x4c5568[_0x5aaefc(0x113)],{'id':this['id']}),this[_0x5aaefc(0x198)]=[],this[_0x5aaefc(0x21b)](),this[_0x5aaefc(0x172)]=!![];}async[_0x13e02c(0xf3)](){const _0x3755dd=_0x13e02c;if(this[_0x3755dd(0x172)])throw new Error('Transaction\x20already\x20closed');const _0x2e4113={'id':this['id'],'timestamp':Date[_0x3755dd(0x201)](),'actions':this[_0x3755dd(0x198)]};this[_0x3755dd(0x1f1)][_0x3755dd(0xed)][_0x3755dd(0x19e)](_0x4c5568[_0x3755dd(0x1ef)],_0x2e4113);try{const _0x22c1b5=_0x5c8ce4['enabled']?_0x5c8ce4[_0x3755dd(0x201)]():0x0;this['okdb']['db']['transactionSync'](()=>{const _0x4587be=_0x3755dd;for(const _0x5147c6 of this['actions']){const _0x4bc793=this['okdb']['_'+_0x5147c6['action']];if(typeof _0x4bc793!==_0x4587be(0x153))throw new Error(_0x4587be(0x1a1)+_0x5147c6['action']);_0x4bc793['call'](this[_0x4587be(0x1f1)],this,..._0x5147c6[_0x4587be(0x189)]);}}),_0x5c8ce4[_0x3755dd(0x130)]&&_0x5c8ce4[_0x3755dd(0x1f6)](_0x3755dd(0xe2),_0x5c8ce4['now']()-_0x22c1b5,(this[_0x3755dd(0x1f1)][_0x3755dd(0x200)]??'?')+_0x3755dd(0x1b6)+this[_0x3755dd(0x198)][_0x3755dd(0xe0)]);}catch(_0xa1fc32){for(const _0x2805a2 of this[_0x3755dd(0xe4)]){try{_0x2805a2();}catch{}}this[_0x3755dd(0x21b)](),this['_closed']=!![];if(_0xa1fc32 instanceof _0x5457a9)throw _0xa1fc32;throw new _0x5457a9(_0xa1fc32?.[_0x3755dd(0x15b)]||_0x3755dd(0x12e),_0x3755dd(0x1ae),{'cause':_0xa1fc32});}this['okdb'][_0x3755dd(0xed)][_0x3755dd(0x19e)](_0x4c5568['TXN_END'],_0x2e4113);for(const _0x9cf316 of this['_doHooks']){try{_0x9cf316();}catch{}}this['actions']=[],this[_0x3755dd(0x21b)](),this[_0x3755dd(0x172)]=!![];}static[_0x13e02c(0x191)](_0x1fd29c){const _0x12e353=_0x13e02c;return Object[_0x12e353(0x20f)]({'id':_0x1fd29c['id'],'put':_0x1fd29c[_0x12e353(0x162)]['bind'](_0x1fd29c),'update':_0x1fd29c['update']['bind'](_0x1fd29c),'patch':_0x1fd29c[_0x12e353(0x1d1)]['bind'](_0x1fd29c),'create':_0x1fd29c[_0x12e353(0x184)][_0x12e353(0x116)](_0x1fd29c),'remove':_0x1fd29c['remove']['bind'](_0x1fd29c),'setTTL':_0x1fd29c[_0x12e353(0x143)][_0x12e353(0x116)](_0x1fd29c),'clearTTL':_0x1fd29c[_0x12e353(0x1d4)][_0x12e353(0x116)](_0x1fd29c),'commit':_0x1fd29c[_0x12e353(0xf3)][_0x12e353(0x116)](_0x1fd29c),'rollback':_0x1fd29c[_0x12e353(0x199)][_0x12e353(0x116)](_0x1fd29c),'get':_0x1fd29c[_0x12e353(0x1cd)][_0x12e353(0x116)](_0x1fd29c),'getEntry':_0x1fd29c[_0x12e353(0x1ce)][_0x12e353(0x116)](_0x1fd29c),'getMany':_0x1fd29c['getMany'][_0x12e353(0x116)](_0x1fd29c),'getRange':_0x1fd29c[_0x12e353(0x1fa)][_0x12e353(0x116)](_0x1fd29c),'getValues':_0x1fd29c[_0x12e353(0x11f)]['bind'](_0x1fd29c),'getKeys':_0x1fd29c[_0x12e353(0x194)][_0x12e353(0x116)](_0x1fd29c),'byIndex':_0x1fd29c[_0x12e353(0x160)][_0x12e353(0x116)](_0x1fd29c),'query':_0x1fd29c['query'][_0x12e353(0x116)](_0x1fd29c),'getClock':_0x1fd29c[_0x12e353(0x207)][_0x12e353(0x116)](_0x1fd29c),'getCount':_0x1fd29c[_0x12e353(0x105)][_0x12e353(0x116)](_0x1fd29c),'read':_0x1fd29c,'raw':_0x1fd29c});}static['applyOps'](_0x559173,_0x2ba883=[]){const _0x25e0ea=_0x13e02c;if(!Array[_0x25e0ea(0xee)](_0x2ba883))throw new _0x5457a9('txn\x20ops\x20must\x20be\x20an\x20array',_0x25e0ea(0x1a2));for(const _0x240a7d of _0x2ba883){if(Array[_0x25e0ea(0xee)](_0x240a7d)){const [_0xc2c430,..._0x56129e]=_0x240a7d;if(typeof _0x559173[_0xc2c430]!==_0x25e0ea(0x153))throw new _0x5457a9(_0x25e0ea(0x1a1)+_0xc2c430,_0x25e0ea(0x142),{'action':_0xc2c430});_0x559173[_0xc2c430](..._0x56129e);continue;}if(!_0x240a7d||typeof _0x240a7d!=='object')throw new _0x5457a9(_0x25e0ea(0xf1),_0x25e0ea(0x11e));const {action:_0x45ff97}=_0x240a7d;if(typeof _0x45ff97!=='string'||typeof _0x559173[_0x45ff97]!==_0x25e0ea(0x153))throw new _0x5457a9(_0x25e0ea(0x1a1)+_0x45ff97,_0x25e0ea(0x142),{'action':_0x45ff97});switch(_0x45ff97){case _0x25e0ea(0x162):case _0x25e0ea(0x195):case _0x25e0ea(0x184):_0x559173[_0x45ff97](_0x240a7d[_0x25e0ea(0x119)],_0x240a7d[_0x25e0ea(0xe8)],_0x240a7d['value'],{..._0x240a7d[_0x25e0ea(0x16b)],'ttl':_0x240a7d['ttl']??_0x240a7d['options']?.[_0x25e0ea(0xd4)]??null});break;case _0x25e0ea(0x1d1):_0x559173[_0x25e0ea(0x1d1)](_0x240a7d[_0x25e0ea(0x119)],_0x240a7d[_0x25e0ea(0xe8)],_0x240a7d[_0x25e0ea(0x1d1)],{..._0x240a7d[_0x25e0ea(0x16b)],'ttl':_0x240a7d['ttl']??_0x240a7d['options']?.['ttl']??null});break;case'remove':_0x559173[_0x25e0ea(0x1f3)](_0x240a7d[_0x25e0ea(0x119)],_0x240a7d[_0x25e0ea(0xe8)],_0x240a7d[_0x25e0ea(0x16b)]||{});break;case _0x25e0ea(0x143):_0x559173[_0x25e0ea(0x143)](_0x240a7d[_0x25e0ea(0x119)],_0x240a7d[_0x25e0ea(0xe8)],_0x240a7d[_0x25e0ea(0xd4)]);break;case'clearTTL':_0x559173[_0x25e0ea(0x1d4)](_0x240a7d[_0x25e0ea(0x119)],_0x240a7d[_0x25e0ea(0xe8)]);break;default:throw new _0x5457a9(_0x25e0ea(0x21e)+_0x45ff97,'TXN_INVALID_ACTION',{'action':_0x45ff97});}}}static async[_0x13e02c(0x163)](_0x1e14d3,_0x4009ff,_0x22c048={}){const _0x429a85=_0x13e02c,_0x516bca=new _0x94301d(_0x1e14d3,_0x22c048),_0x3d0c89=_0x94301d[_0x429a85(0x191)](_0x516bca);try{typeof _0x4009ff===_0x429a85(0x153)?await _0x4009ff(_0x3d0c89):_0x94301d[_0x429a85(0xfa)](_0x516bca,_0x4009ff||[]);const _0x568ee8=_0x516bca[_0x429a85(0x198)]['length'];return await _0x516bca[_0x429a85(0xf3)](),{'id':_0x516bca['id'],'actions':_0x568ee8};}catch(_0x17d4b){try{_0x516bca['rollback']();}catch(_0x1c436a){}throw _0x17d4b;}}}return okdbTransaction=_0x94301d,okdbTransaction;}var okdbFunctionsFacades,hasRequiredOkdbFunctionsFacades;function requireOkdbFunctionsFacades(){if(hasRequiredOkdbFunctionsFacades)return okdbFunctionsFacades;hasRequiredOkdbFunctionsFacades=0x1;const _0x12e108=requireOkdbTransaction();function _0x525653(_0x11cc36){const _0x106dc2=_0x4c19;return{'transaction':typeof _0x11cc36['transaction']===_0x106dc2(0x153)?_0x11cc36['transaction'][_0x106dc2(0x116)](_0x11cc36):_0x2c058c=>new _0x12e108(_0x11cc36,_0x2c058c),'txn':typeof _0x11cc36['txn']===_0x106dc2(0x153)?_0x11cc36['txn'][_0x106dc2(0x116)](_0x11cc36):(_0x1b5916,_0x26fe1d)=>_0x12e108['run'](_0x11cc36,_0x1b5916,_0x26fe1d)};}function _0x3532bb(_0x440ac7){const _0x23ed83=_0x4c19;return{'name':_0x440ac7['name'],..._0x525653(_0x440ac7),'put':_0x440ac7['put'][_0x23ed83(0x116)](_0x440ac7),'update':_0x440ac7['update'][_0x23ed83(0x116)](_0x440ac7),'patch':_0x440ac7[_0x23ed83(0x1d1)][_0x23ed83(0x116)](_0x440ac7),'create':_0x440ac7[_0x23ed83(0x184)][_0x23ed83(0x116)](_0x440ac7),'remove':_0x440ac7['remove'][_0x23ed83(0x116)](_0x440ac7),'get':_0x440ac7[_0x23ed83(0x1cd)][_0x23ed83(0x116)](_0x440ac7),'getMany':_0x440ac7[_0x23ed83(0x1dd)][_0x23ed83(0x116)](_0x440ac7),'getEntry':_0x440ac7[_0x23ed83(0x1ce)]['bind'](_0x440ac7),'getRange':_0x440ac7[_0x23ed83(0x1fa)][_0x23ed83(0x116)](_0x440ac7),'getValues':_0x440ac7['getValues'][_0x23ed83(0x116)](_0x440ac7),'getKeys':_0x440ac7[_0x23ed83(0x194)][_0x23ed83(0x116)](_0x440ac7),'getCount':_0x440ac7[_0x23ed83(0x105)]['bind'](_0x440ac7),'getByPrefix':_0x440ac7[_0x23ed83(0x129)][_0x23ed83(0x116)](_0x440ac7),'getIndex':_0x440ac7['getIndex']['bind'](_0x440ac7),'byIndex':_0x440ac7[_0x23ed83(0x160)][_0x23ed83(0x116)](_0x440ac7),'query':_0x440ac7[_0x23ed83(0x17c)][_0x23ed83(0x116)](_0x440ac7),'geoQuery':_0x440ac7[_0x23ed83(0x1e3)][_0x23ed83(0x116)](_0x440ac7),'ftsQuery':_0x440ac7[_0x23ed83(0x154)]['bind'](_0x440ac7),'setTTL':_0x440ac7[_0x23ed83(0x143)][_0x23ed83(0x116)](_0x440ac7),'getTTL':_0x440ac7[_0x23ed83(0x13a)][_0x23ed83(0x116)](_0x440ac7),'clearTTL':_0x440ac7['clearTTL']['bind'](_0x440ac7),'sweepExpiredTTL':_0x440ac7[_0x23ed83(0xdd)][_0x23ed83(0x116)](_0x440ac7),'listTTL':_0x440ac7[_0x23ed83(0x132)][_0x23ed83(0x116)](_0x440ac7),'ttlStats':_0x440ac7[_0x23ed83(0x151)][_0x23ed83(0x116)](_0x440ac7),'setDefaultTTL':_0x440ac7[_0x23ed83(0x144)]['bind'](_0x440ac7),'getDefaultTTL':_0x440ac7[_0x23ed83(0x158)][_0x23ed83(0x116)](_0x440ac7),'clearDefaultTTL':_0x440ac7[_0x23ed83(0x147)]['bind'](_0x440ac7),'registerType':_0x440ac7[_0x23ed83(0x10f)][_0x23ed83(0x116)](_0x440ac7),'ensureType':_0x440ac7[_0x23ed83(0x103)][_0x23ed83(0x116)](_0x440ac7),'hasType':_0x440ac7['hasType'][_0x23ed83(0x116)](_0x440ac7),'dropType':_0x440ac7['dropType'][_0x23ed83(0x116)](_0x440ac7),'registerIndex':_0x440ac7['registerIndex'][_0x23ed83(0x116)](_0x440ac7),'hasIndex':_0x440ac7[_0x23ed83(0x178)]['bind'](_0x440ac7),'dropIndex':_0x440ac7[_0x23ed83(0xe3)]['bind'](_0x440ac7),'resetIndex':_0x440ac7[_0x23ed83(0x1ea)]['bind'](_0x440ac7),'indexReady':_0x440ac7['indexReady'][_0x23ed83(0x116)](_0x440ac7),'getIndexStatus':_0x440ac7[_0x23ed83(0x1f8)][_0x23ed83(0x116)](_0x440ac7),'getClock':_0x440ac7[_0x23ed83(0x207)]['bind'](_0x440ac7),'getChanges':_0x440ac7[_0x23ed83(0x15a)][_0x23ed83(0x116)](_0x440ac7),'count':_0x440ac7[_0x23ed83(0x1cc)][_0x23ed83(0x116)](_0x440ac7),'range':_0x440ac7['range'][_0x23ed83(0x116)](_0x440ac7),'now':_0x440ac7[_0x23ed83(0x201)][_0x23ed83(0x116)](_0x440ac7)};}function _0x3b0dc8(_0x120c2b){const _0x348ff6=_0x4c19;if(!_0x120c2b)return null;const _0xebe7c7={};for(const _0x36c525 of[_0x348ff6(0x155),'getJob',_0x348ff6(0x204),_0x348ff6(0x114),_0x348ff6(0xf9),_0x348ff6(0x136),_0x348ff6(0x17f),'listBuckets']){if(typeof _0x120c2b[_0x36c525]===_0x348ff6(0x153))_0xebe7c7[_0x36c525]=_0x120c2b[_0x36c525]['bind'](_0x120c2b);}return Object[_0x348ff6(0x134)](_0xebe7c7)[_0x348ff6(0xe0)]?_0xebe7c7:null;}function _0x2d7c17(_0x14704f){const _0x23a285=_0x4c19;if(!_0x14704f)return null;const _0x3f35c0={};for(const _0x51bc28 of[_0x23a285(0xd8),_0x23a285(0x11d),_0x23a285(0x1f3),_0x23a285(0x1cd),_0x23a285(0x204),_0x23a285(0x16a)]){if(typeof _0x14704f[_0x51bc28]===_0x23a285(0x153))_0x3f35c0[_0x51bc28]=_0x14704f[_0x51bc28][_0x23a285(0x116)](_0x14704f);}return Object[_0x23a285(0x134)](_0x3f35c0)['length']?_0x3f35c0:null;}function _0x40db9e(_0x1d8e62){const _0x2b1bf6=_0x4c19;return{'env':_0x1d8e62['env'][_0x2b1bf6(0x116)](_0x1d8e62),'createEnvironment':_0x1d8e62['createEnvironment'][_0x2b1bf6(0x116)](_0x1d8e62),'removeEnvironment':_0x1d8e62[_0x2b1bf6(0x14d)][_0x2b1bf6(0x116)](_0x1d8e62),'info':_0x1d8e62[_0x2b1bf6(0x13e)],..._0x525653(_0x1d8e62),'put':_0x1d8e62[_0x2b1bf6(0x162)]['bind'](_0x1d8e62),'update':_0x1d8e62['update'][_0x2b1bf6(0x116)](_0x1d8e62),'patch':_0x1d8e62['patch'][_0x2b1bf6(0x116)](_0x1d8e62),'create':_0x1d8e62['create'][_0x2b1bf6(0x116)](_0x1d8e62),'remove':_0x1d8e62['remove'][_0x2b1bf6(0x116)](_0x1d8e62),'get':_0x1d8e62['get'][_0x2b1bf6(0x116)](_0x1d8e62),'getMany':_0x1d8e62['getMany']['bind'](_0x1d8e62),'getEntry':_0x1d8e62[_0x2b1bf6(0x1ce)][_0x2b1bf6(0x116)](_0x1d8e62),'getRange':_0x1d8e62[_0x2b1bf6(0x1fa)][_0x2b1bf6(0x116)](_0x1d8e62),'getValues':_0x1d8e62[_0x2b1bf6(0x11f)][_0x2b1bf6(0x116)](_0x1d8e62),'getKeys':_0x1d8e62[_0x2b1bf6(0x194)][_0x2b1bf6(0x116)](_0x1d8e62),'getCount':_0x1d8e62['getCount'][_0x2b1bf6(0x116)](_0x1d8e62),'getByPrefix':_0x1d8e62[_0x2b1bf6(0x129)][_0x2b1bf6(0x116)](_0x1d8e62),'getIndex':_0x1d8e62[_0x2b1bf6(0x19a)][_0x2b1bf6(0x116)](_0x1d8e62),'byIndex':_0x1d8e62[_0x2b1bf6(0x160)][_0x2b1bf6(0x116)](_0x1d8e62),'query':_0x1d8e62['query']['bind'](_0x1d8e62),'setTTL':_0x1d8e62[_0x2b1bf6(0x143)]['bind'](_0x1d8e62),'getTTL':_0x1d8e62[_0x2b1bf6(0x13a)][_0x2b1bf6(0x116)](_0x1d8e62),'clearTTL':_0x1d8e62[_0x2b1bf6(0x1d4)][_0x2b1bf6(0x116)](_0x1d8e62),'sweepExpiredTTL':_0x1d8e62[_0x2b1bf6(0xdd)][_0x2b1bf6(0x116)](_0x1d8e62),'listTTL':_0x1d8e62[_0x2b1bf6(0x132)]['bind'](_0x1d8e62),'ttlStats':_0x1d8e62['ttlStats']['bind'](_0x1d8e62),'setDefaultTTL':_0x1d8e62[_0x2b1bf6(0x144)][_0x2b1bf6(0x116)](_0x1d8e62),'getDefaultTTL':_0x1d8e62[_0x2b1bf6(0x158)][_0x2b1bf6(0x116)](_0x1d8e62),'clearDefaultTTL':_0x1d8e62['clearDefaultTTL'][_0x2b1bf6(0x116)](_0x1d8e62),'ensureType':_0x1d8e62['ensureType'][_0x2b1bf6(0x116)](_0x1d8e62),'registerType':_0x1d8e62[_0x2b1bf6(0x10f)][_0x2b1bf6(0x116)](_0x1d8e62),'hasType':_0x1d8e62[_0x2b1bf6(0x1be)][_0x2b1bf6(0x116)](_0x1d8e62),'dropType':_0x1d8e62[_0x2b1bf6(0x11b)][_0x2b1bf6(0x116)](_0x1d8e62),'registerIndex':_0x1d8e62['registerIndex'][_0x2b1bf6(0x116)](_0x1d8e62),'hasIndex':_0x1d8e62[_0x2b1bf6(0x178)]['bind'](_0x1d8e62),'dropIndex':_0x1d8e62[_0x2b1bf6(0xe3)][_0x2b1bf6(0x116)](_0x1d8e62),'resetIndex':_0x1d8e62[_0x2b1bf6(0x1ea)][_0x2b1bf6(0x116)](_0x1d8e62),'indexReady':_0x1d8e62[_0x2b1bf6(0x1ba)][_0x2b1bf6(0x116)](_0x1d8e62),'getIndexStatus':_0x1d8e62[_0x2b1bf6(0x1f8)][_0x2b1bf6(0x116)](_0x1d8e62),'getClock':_0x1d8e62[_0x2b1bf6(0x207)][_0x2b1bf6(0x116)](_0x1d8e62),'getChanges':_0x1d8e62[_0x2b1bf6(0x15a)][_0x2b1bf6(0x116)](_0x1d8e62),'queue':_0x1d8e62['queue'],'files':_0x1d8e62[_0x2b1bf6(0x170)]};}return okdbFunctionsFacades={'createEnvFacade':_0x3532bb,'createQueueFacade':_0x3b0dc8,'createFilesFacade':_0x2d7c17,'createGlobalFacade':_0x40db9e},okdbFunctionsFacades;}var okdbFunctionsDryrun,hasRequiredOkdbFunctionsDryrun;function requireOkdbFunctionsDryrun(){const _0x5debb0=_0x53994d;if(hasRequiredOkdbFunctionsDryrun)return okdbFunctionsDryrun;hasRequiredOkdbFunctionsDryrun=0x1;const _0x13ea5d=new Set(['put','patch',_0x5debb0(0x184),_0x5debb0(0x1f3),'update','setTTL',_0x5debb0(0x1d4),_0x5debb0(0xdd),_0x5debb0(0x144),_0x5debb0(0x147),_0x5debb0(0x11b),_0x5debb0(0xe3),_0x5debb0(0x1ea)]),_0x3adfda=new Set([_0x5debb0(0x155),_0x5debb0(0x114),'removeJob','addBucket']),_0x14e51b=new Set(['upload',_0x5debb0(0x1f3)]);function _0x1e3c99(_0x216716,_0xf44b02){const _0x15ac12=_0x5debb0;if(_0x216716==='env'||_0x216716===_0x15ac12(0xd7))return _0x13ea5d[_0x15ac12(0x148)](_0xf44b02);if(_0x216716===_0x15ac12(0x197))return _0x3adfda[_0x15ac12(0x148)](_0xf44b02);if(_0x216716==='files')return _0x14e51b[_0x15ac12(0x148)](_0xf44b02);return![];}function _0x3a695e(_0x2d22b8,_0x1804bd,_0x2d84c6,_0x4868a5){if(!_0x2d22b8)return _0x2d22b8;return new Proxy(_0x2d22b8,{'get'(_0x2b87c5,_0x312d69,_0x173421){const _0x3eeff6=_0x4c19,_0x5753c0=Reflect[_0x3eeff6(0x1cd)](_0x2b87c5,_0x312d69,_0x173421);if(typeof _0x5753c0!==_0x3eeff6(0x153))return _0x5753c0;if(!_0x1e3c99(_0x1804bd,_0x312d69))return _0x5753c0[_0x3eeff6(0x116)](_0x2b87c5);return function(..._0x3d6b4f){const _0x19929e=_0x3eeff6;return _0x4868a5[_0x19929e(0x169)]({'scope':_0x1804bd,'method':_0x312d69,'envName':_0x2d84c6,'args':_0x3d6b4f}),null;};}});}function _0x2b9c49(_0xe391bf,_0x108f85,_0x2fadeb,_0x15c127){const _0x28c922={};for(const _0x51f3da of _0x2fadeb){_0x28c922[_0x51f3da]=(..._0x11b1ce)=>{const _0x491972=_0x4c19;return _0x1e3c99(_0xe391bf,_0x51f3da)&&_0x15c127[_0x491972(0x169)]({'scope':_0xe391bf,'method':_0x51f3da,'envName':_0x108f85,'args':_0x11b1ce}),null;};}return _0x28c922;}return okdbFunctionsDryrun={'isWriteMethod':_0x1e3c99,'wrapForDryRun':_0x3a695e,'syntheticDryRunFacade':_0x2b9c49,'ENV_WRITE_METHODS':_0x13ea5d,'QUEUE_WRITE_METHODS':_0x3adfda,'FILES_WRITE_METHODS':_0x14e51b},okdbFunctionsDryrun;}var okdbFunctionsContext,hasRequiredOkdbFunctionsContext;function requireOkdbFunctionsContext(){const _0x522c07=_0x53994d;if(hasRequiredOkdbFunctionsContext)return okdbFunctionsContext;hasRequiredOkdbFunctionsContext=0x1;const {createEnvFacade:_0x242735,createQueueFacade:_0x948726,createFilesFacade:_0x5e3dcc,createGlobalFacade:_0x40c810}=requireOkdbFunctionsFacades(),{wrapForDryRun:_0x4a9e16,syntheticDryRunFacade:_0x55c844}=requireOkdbFunctionsDryrun(),_0x48a5e0=['enqueue',_0x522c07(0x19f),'list',_0x522c07(0x114),_0x522c07(0xf9),'addBucket',_0x522c07(0x17f),_0x522c07(0x1ed)],_0x18277d=['upload',_0x522c07(0x11d),_0x522c07(0x1f3),_0x522c07(0x1cd),_0x522c07(0x204),'getByPath'];function _0x3b1d0d(_0x2abdbd,_0x45ee31){const _0x1706d4=_0x522c07,_0x33f9a2=(_0x223564,_0x5d356d,_0x1aeacd)=>_0x45ee31({'type':'log','requestId':_0x2abdbd[_0x1706d4(0x1a8)],'runId':_0x2abdbd['runId'],'entry':{'level':_0x223564,'msg':_0x5d356d,'context':_0x1aeacd,'ts':Date[_0x1706d4(0x201)]()}}),_0x4345f4=(_0x5158ca,_0x5e6ead)=>_0x33f9a2('info',_0x5158ca,_0x5e6ead);return _0x4345f4['info']=(_0x270fc6,_0x4a2f2a)=>_0x33f9a2(_0x1706d4(0x13e),_0x270fc6,_0x4a2f2a),_0x4345f4[_0x1706d4(0x219)]=(_0x5394dc,_0x33e256)=>_0x33f9a2('warn',_0x5394dc,_0x33e256),_0x4345f4['error']=(_0x2118c3,_0x45d9d9)=>_0x33f9a2(_0x1706d4(0x13b),_0x2118c3,_0x45d9d9),_0x4345f4[_0x1706d4(0x1b7)]=(_0x2daf03,_0x9e774e)=>_0x33f9a2('debug',_0x2daf03,_0x9e774e),_0x4345f4;}function _0x54d58b(_0x4dc22e,_0x5912bf,_0x36d172){const _0x78b8c3=_0x522c07;if(!_0x4dc22e)return null;return{'id':_0x4dc22e['id']??null,'type':_0x4dc22e[_0x78b8c3(0x119)]??null,'tries':_0x4dc22e[_0x78b8c3(0xe9)]??null,'created':_0x4dc22e[_0x78b8c3(0x1b9)]??null,'tags':_0x4dc22e[_0x78b8c3(0x1f0)]??null,'priority':_0x4dc22e['priority']??null,'bucket':_0x4dc22e[_0x78b8c3(0x133)]??null,'cron':_0x4dc22e[_0x78b8c3(0x177)]??null,'heartbeat'(){const _0x5262ca=_0x78b8c3;_0x36d172({'type':_0x5262ca(0x1c5),'requestId':_0x5912bf[_0x5262ca(0x1a8)],'runId':_0x5912bf[_0x5262ca(0x14c)],'jobId':_0x4dc22e['id'],'claimId':_0x4dc22e['claimId']});},'markProgress'(_0x19a99a){const _0x3ce4ad=_0x78b8c3;_0x36d172({'type':'job_progress','requestId':_0x5912bf[_0x3ce4ad(0x1a8)],'runId':_0x5912bf[_0x3ce4ad(0x14c)],'jobId':_0x4dc22e['id'],'claimId':_0x4dc22e['claimId'],'message':_0x19a99a});}};}function _0x1c513c(_0x31da8c){const _0x1e4b7c=_0x522c07;if(!_0x31da8c)return null;return{'mode':_0x31da8c['mode']??null,'sourceType':_0x31da8c['sourceType']??null,'sourceEnv':_0x31da8c[_0x1e4b7c(0xdb)]??null,'processor':_0x31da8c['processor']??null,'engineKey':_0x31da8c['engineKey']??null,'cursorKey':_0x31da8c[_0x1e4b7c(0x1a7)]??null};}function _0x53523e(_0x4fe3d6){const _0x28a181=_0x522c07;if(!_0x4fe3d6)return null;return{'mode':_0x4fe3d6[_0x28a181(0x16f)]??null,'sourceType':_0x4fe3d6[_0x28a181(0x1a0)]??null,'targetType':_0x4fe3d6['targetType']??null,'sourceEnv':_0x4fe3d6[_0x28a181(0xdb)]??null,'targetEnv':_0x4fe3d6[_0x28a181(0x190)]??null,'engineKey':_0x4fe3d6[_0x28a181(0x18c)]??null,'cursorKey':_0x4fe3d6['cursorKey']??null};}function _0x20de12(_0xb6ddee,_0x504d01,_0x3d485e,_0x26e6e2=null,_0x52882f=null){const _0x392aa2=_0x522c07,_0x527d2f={'runId':_0x504d01[_0x392aa2(0x14c)],'scope':'env','env':_0x504d01[_0x392aa2(0x185)]??null,'functionName':_0x504d01[_0x392aa2(0x101)],'trigger':_0x504d01['info']?.[_0x392aa2(0x213)]??'sdk','requestedAt':_0x504d01[_0x392aa2(0x13e)]?.['requestedAt']??Date[_0x392aa2(0x201)]()},_0x225efc=_0x3b1d0d(_0x504d01,_0x3d485e),_0x4d760e=AbortSignal[_0x392aa2(0x1ff)](Math[_0x392aa2(0x124)](0x1,_0x504d01[_0x392aa2(0x17a)]?.[_0x392aa2(0x20c)]??0x3e8)),_0x49a2e3=_0x52882f?AbortSignal[_0x392aa2(0x1e2)]([_0x4d760e,_0x52882f]):_0x4d760e,_0x31c630=_0xb6ddee['env'](_0x504d01[_0x392aa2(0x185)]),_0x1b05b8=_0x26e6e2?_0x4a9e16(_0x31c630,_0x392aa2(0xef),_0x504d01[_0x392aa2(0x185)],_0x26e6e2):_0x31c630,_0x5581a1=_0x26e6e2?_0x31c630[_0x392aa2(0x197)]?_0x4a9e16(_0x31c630[_0x392aa2(0x197)],_0x392aa2(0x197),_0x504d01[_0x392aa2(0x185)],_0x26e6e2):_0x55c844(_0x392aa2(0x197),_0x504d01[_0x392aa2(0x185)],_0x48a5e0,_0x26e6e2):_0x31c630[_0x392aa2(0x197)],_0x1a2d64=_0x26e6e2?_0x31c630[_0x392aa2(0x170)]?_0x4a9e16(_0x31c630[_0x392aa2(0x170)],_0x392aa2(0x170),_0x504d01[_0x392aa2(0x185)],_0x26e6e2):_0x55c844(_0x392aa2(0x170),_0x504d01[_0x392aa2(0x185)],_0x18277d,_0x26e6e2):_0x31c630['files'],_0xb8d283=_0x242735(_0x1b05b8),_0x43ed9c=_0x948726(_0x5581a1),_0x353f79=_0x5e3dcc(_0x1a2d64);if(_0x43ed9c)_0xb8d283[_0x392aa2(0x197)]=_0x43ed9c;if(_0x353f79)_0xb8d283[_0x392aa2(0x170)]=_0x353f79;const _0x24ff33={'payload':_0x504d01['payload']??null,'info':_0x527d2f,'signal':_0x49a2e3,'log':_0x225efc,'env':_0xb8d283},_0x5a2ac4=_0x54d58b(_0x504d01[_0x392aa2(0x18a)],_0x504d01,_0x3d485e);if(_0x5a2ac4)_0x24ff33[_0x392aa2(0xdc)]=_0x5a2ac4;const _0x366db0=_0x1c513c(_0x504d01[_0x392aa2(0x1fd)]);if(_0x366db0)_0x24ff33[_0x392aa2(0x209)]=_0x366db0;const _0x3ad2ac=_0x53523e(_0x504d01[_0x392aa2(0x1df)]);if(_0x3ad2ac)_0x24ff33['materializer']=_0x3ad2ac;if(_0x504d01[_0x392aa2(0x164)]){const _0x33f908=_0x26e6e2?_0x4a9e16(_0xb6ddee,'global',null,_0x26e6e2):_0xb6ddee;_0x24ff33[_0x392aa2(0x1f1)]=_0x40c810(_0x33f908);}return _0x24ff33;}return okdbFunctionsContext={'createExecutionContext':_0x20de12,'createScriptLogger':_0x3b1d0d},okdbFunctionsContext;}function _0x4685(){const _0x16465e=[',\x20got\x20','\x27:\x20','patch','Script','ttl:set','clearTTL','INDEX_ALREADY_REGISTERED','_timer','bus:drain','INDEX_NOT_REGISTERED','\x20already\x20exists','dropSchema','open','stop','getMany','reject','materializerContext','fetch','unique:violation','any','geoQuery','\x22\x20is\x20not\x20in\x20the\x20allowedFetchDomains\x20list','OKDBInvalidValueError','ms/','node:os','fetch\x20blocked:\x20hostname\x20\x22','onWindow','resetIndex','\x20documents\x20fail\x20validation','size','listBuckets','errors','TXN_START','tags','okdb','INVALID_PRIMARY_KEY','remove','clear','url','note','TXN_CLOSED','getIndexStatus','INVALID_VALUE','getRange','percentile','ready','processorContext','Foreign\x20key\x20violation:\x20','timeout','name','now','sourceKey','(worst\x20','list','system:type_drop','type:drop','getClock','system:drain','processor','634420VBZAZw','item:update','timeoutMs','OKDBForeignKeyDeleteError','system:stopped','freeze','Cannot\x20set\x20enforce\x20schema\x20on\x20','waiting','TYPE_NOT_REGISTERED','trigger','allowFetch','Index\x20\x22','./okdb','\x27\x20on\x20type\x20\x27','send','warn','\x20document(s)\x20reference\x20it\x20with\x20onDelete:restrict','_closeReadTransaction','FOREIGN_KEY_VIOLATION','ttl:clear','Unsupported\x20transaction\x20action:\x20','FUNCTION_SCRIPT_COMPILE_FAILED','uuid','_startAdmission','OKDBForeignKeyError','_log','FETCH_NOT_ALLOWED','ttl','dryRunActions','OKDBIndexNotRegisteredError','global','upload','Runner\x20is\x20already\x20executing\x20a\x20function','ms\x20max=','sourceEnv','job','sweepExpiredTTL','starting','dryRun','length','captureStackTrace','txn-commit','dropIndex','_undoHooks','_buckets','_admissionTimer','maxExtra','key','tries','fieldPath','cpuUsage','_assertOpen','events','isArray','env','2012264sevbfL','txn\x20op\x20must\x20be\x20an\x20object\x20or\x20tuple','stopped','commit','\x22\x20is\x20used\x20by:\x20','bus:type_drop','Unknown\x20custom\x20function\x20error','label','compileTimeoutMs','removeJob','applyOps','type:registered','reset','OKDBIndexHasConsumersError','setLogger','OKDBTypeAlreadyRegisteredError','txn:start','functionName','result','ensureType','stderr','getCount','loop-lag\x20','user','add','globalThis','write','\x20does\x20not\x20exist','view:progress','code','VERSION_MISMATCH','registerType','catch','system:ready','ALREADY_EXISTS','TXN_ROLLBACK','updateJob','stack','bind','onUndo','index:reset','type','OKDBUniqueConstraintError','dropType','_windowCbs','stream','TXN_INVALID_OP','getValues','rss','onDo','stopping','Version\x20mismatch\x20for\x20','max','sync:apply','OKDBInvalidPrimaryKeyError','FUNCTION_SCRIPT_INVALID_SHAPE','system:bus_state_change','getByPrefix','join','Type\x20\x27','hasOwnProperty','Function\x20script\x20failed\x20to\x20compile','Unknown\x20OKDB\x20transaction\x20error','3080745ZisCzf','enabled','txn:end','listTTL','bucket','keys','string','addBucket','license:removed','unref','resetFts','getTTL','error','Index\x20\x27','memoryUsage','info','\x27\x20doesn\x27t\x20exist','allowedFetchDomains','TYPE_ALREADY_REGISTERED','TXN_INVALID_ACTION','setTTL','setDefaultTTL','_started','cause','clearDefaultTTL','has','registerIndex','system','\x27\x20already\x20registered','runId','removeEnvironment','bus:proc','_doHooks','item:remove','ttlStats','readTransaction','function','ftsQuery','enqueue','hostname','node:vm','getDefaultTTL','schema:drop','getChanges','message','offWindow','Cannot\x20delete\x20','set','setTtl','byIndex','\x20references\x20','put','run','unsafe','mean','kind','createContext','close','push','getByPath','options','heapUsed','fetch\x20blocked:\x20invalid\x20URL','OKDBAlreadyExistsError','mode','files','exit','_closed','enable','\x27\x20is\x20already\x20registered','script','true','cron','hasIndex','FOREIGN_KEY_DELETE_RESTRICTED','runtime','\x22\x20on\x20\x22','query','613275zJpaOs','txn:rollback','getBucket','OKDBVersionMismatchError','halted','ref:violation_resolved','heapTotal','create','envName','fts:reset','Invalid\x20primary\x20key\x20type:\x20','clearTtl','args','jobContext','OKDBSchemaCollectionError','engineKey','env:opened','ping','prototype','targetEnv','createWriteFacade','~system','Schema\x20validation\x20failed\x20for\x20','getKeys','update','sort','queue','actions','rollback','getIndex','system:proc','useReadTransaction','180nNvgqL','emit','getJob','sourceType','Unknown\x20transaction\x20action:\x20','TXN_INVALID_OPS','12JBTGHe','unique:violation_resolved','INDEX_HAS_CONSUMERS','Invalid\x20index\x20key\x20type\x20for\x20\x27','cursorKey','requestId','16387iDjEKK','item:create','openEnv','maxMs','min','TXN_ERROR','delete','system:clock_change','targetType',':\x20key\x20[','done','start','version','\x20actions=','debug','SCHEMA_VALIDATION_FAILED','created','indexReady','details','87880LYRpRd','SCHEMA_COLLECTION_INVALID','hasType','_report','stats','650975yxamGi','external','NOT_FOUND','index:drop','job_heartbeat','targetKey','creating','OKDBNotFoundError','toFixed','resetting','UNIQUE_CONSTRAINT','count','get','getEntry'];_0x4685=function(){return _0x16465e;};return _0x4685();}var hasRequiredOkdbFunctionsRunnerChild;function requireOkdbFunctionsRunnerChild(){const _0x53553f=_0x53994d;if(hasRequiredOkdbFunctionsRunnerChild)return okdbFunctionsRunnerChild$1;hasRequiredOkdbFunctionsRunnerChild=0x1;const {compileFunctionExpression:_0x3e7fa0}=requireOkdbFunctionsSandbox(),{serializeError:_0x1e7d14}=requireOkdbFunctionsIpc(),{createExecutionContext:_0x4ce8f0}=requireOkdbFunctionsContext(),_0x4cb6a4=require$$3;let _0x77bac7=null,_0x48a420=![],_0x63096f=![];const _0x16ad7e=new Map();function _0x436d79(_0x1bce42){const _0x511e53=_0x4c19;try{if(typeof process['send']==='function')process[_0x511e53(0x218)](_0x1bce42);}catch{}}function _0x4b77e3(_0x4ab119){const _0x2e9d26=_0x4c19,_0x2e41d7=require$$4;let _0x38dcee=process[_0x2e9d26(0xeb)](),_0x33a57d=Date[_0x2e9d26(0x201)]();const _0x14fb84=()=>{const _0x434dc2=_0x2e9d26,_0xdab611=Date['now'](),_0x330253=process[_0x434dc2(0xeb)](),_0x34c25f=(_0xdab611-_0x33a57d)*0x3e8,_0x3fa7c6=_0x330253[_0x434dc2(0x107)]-_0x38dcee[_0x434dc2(0x107)]+(_0x330253[_0x434dc2(0x14a)]-_0x38dcee[_0x434dc2(0x14a)]),_0x54d55f=_0x34c25f>0x0?Math[_0x434dc2(0x1ad)](0x64,Math['round'](_0x3fa7c6/(_0x34c25f*(_0x2e41d7['cpus']()[_0x434dc2(0xe0)]||0x1))*0x64)):0x0;_0x38dcee=_0x330253,_0x33a57d=_0xdab611;const _0x54ad96=process[_0x434dc2(0x13d)]();_0x4ab119({'type':_0x434dc2(0x1c0),'stats':{'rss':_0x54ad96[_0x434dc2(0x120)],'heapUsed':_0x54ad96[_0x434dc2(0x16c)],'heapTotal':_0x54ad96[_0x434dc2(0x183)],'external':_0x54ad96[_0x434dc2(0x1c2)],'cpuPct':_0x54d55f,'cpuWindowMs':Math['round'](_0x34c25f/0x3e8)||null}});},_0x4b9c5d=Math[_0x2e9d26(0x124)](0x3e8,Number(process.env.OKDB_STATS_INTERVAL_MS)||0x1388),_0x5349fd=setInterval(_0x14fb84,_0x4b9c5d);if(_0x5349fd[_0x2e9d26(0x138)])_0x5349fd['unref']();_0x14fb84();}function _0x40d213(_0x1dd9db){const _0x4df48f=_0x4c19,_0xe24273=(_0x1dd9db[_0x4df48f(0x185)]||_0x4df48f(0x192))+':'+_0x1dd9db[_0x4df48f(0x101)]+':'+_0x1dd9db[_0x4df48f(0x1b5)]+':'+_0x1dd9db['hash'];let _0x21146c=_0x16ad7e['get'](_0xe24273);return!_0x21146c&&(_0x21146c=_0x3e7fa0(_0x1dd9db[_0x4df48f(0x175)],{'allowFetch':_0x1dd9db[_0x4df48f(0x17a)]?.['allowFetch']!==![],'filename':_0x1dd9db['functionName']+'.okdb-function.js'}),_0x16ad7e['set'](_0xe24273,_0x21146c)),_0x21146c;}async function _0x3f00b4(_0x1433d7){const _0x731ecf=_0x4c19;if(_0x63096f)throw new Error(_0x731ecf(0xd9));_0x63096f=!![];const _0x434a28=Date[_0x731ecf(0x201)]();try{const _0x4b852b=_0x40d213(_0x1433d7);if(_0x1433d7[_0x731ecf(0x185)])await _0x77bac7[_0x731ecf(0x1ab)](_0x1433d7[_0x731ecf(0x185)]);const _0x13260f=_0x1433d7[_0x731ecf(0xdf)]?[]:null,_0x5994d8=_0x4ce8f0(_0x77bac7,_0x1433d7,_0x436d79,_0x13260f),_0x2b370b=await _0x4b852b(_0x5994d8),_0x1983f3={'type':_0x731ecf(0x102),'requestId':_0x1433d7[_0x731ecf(0x1a8)],'runId':_0x1433d7['runId'],'result':_0x2b370b,'meta':{'runnerId':process.env.OKDB_FUNCTION_RUNNER_ID||null,'startedAt':_0x434a28,'finishedAt':Date[_0x731ecf(0x201)](),'durationMs':Date[_0x731ecf(0x201)]()-_0x434a28,'cacheSize':_0x16ad7e[_0x731ecf(0x1ec)]}};if(_0x13260f)_0x1983f3[_0x731ecf(0xd5)]=_0x13260f;_0x436d79(_0x1983f3);}catch(_0x4950eb){_0x436d79({'type':_0x731ecf(0x13b),'requestId':_0x1433d7[_0x731ecf(0x1a8)],'runId':_0x1433d7[_0x731ecf(0x14c)],'error':_0x1e7d14(_0x4950eb),'meta':{'runnerId':process.env.OKDB_FUNCTION_RUNNER_ID||null,'startedAt':_0x434a28,'finishedAt':Date[_0x731ecf(0x201)](),'durationMs':Date[_0x731ecf(0x201)]()-_0x434a28}});}finally{_0x63096f=![];}}async function _0x42e818(){const _0x270f6d=_0x4c19;if(_0x48a420)return;_0x48a420=!![];try{await _0x77bac7?.[_0x270f6d(0x168)]?.();}catch{}process['exit'](0x0);}async function _0xa4a719(){const _0x15c4e=_0x4c19,_0x616868=process.env.OKDB_FUNCTION_DB_PATH;if(!_0x616868)throw new Error('OKDB_FUNCTION_DB_PATH\x20not\x20set\x20on\x20runner\x20child');_0x77bac7=new _0x4cb6a4(_0x616868,{'engines':![],'asyncProcessors':![],'compaction':'passive','http':![],'auth':{'open':!![]}}),await _0x77bac7[_0x15c4e(0x1db)](),process['on'](_0x15c4e(0x15b),async _0x28a61d=>{const _0x8eab2=_0x15c4e;if(!_0x28a61d||typeof _0x28a61d!=='object')return;if(_0x28a61d[_0x8eab2(0x119)]===_0x8eab2(0x1dc))return _0x42e818();if(_0x28a61d[_0x8eab2(0x119)]===_0x8eab2(0x18e)){_0x436d79({'type':'pong','requestId':_0x28a61d[_0x8eab2(0x1a8)],'runnerId':process.env.OKDB_FUNCTION_RUNNER_ID||null});return;}_0x28a61d['type']==='run'&&await _0x3f00b4(_0x28a61d);}),process['on']('SIGINT',_0x42e818),process['on']('SIGTERM',_0x42e818),_0x436d79({'type':_0x15c4e(0x1fc),'runnerId':process.env.OKDB_FUNCTION_RUNNER_ID||null,'pid':process['pid']}),_0x4b77e3(_0x436d79);}return _0xa4a719()[_0x53553f(0x110)](async _0x4a71e0=>{const _0x13941c=_0x53553f;_0x436d79({'type':_0x13941c(0x13b),'error':_0x1e7d14(_0x4a71e0)}),process[_0x13941c(0x171)](0x1);}),okdbFunctionsRunnerChild$1;}var okdbFunctionsRunnerChildExports=requireOkdbFunctionsRunnerChild(),okdbFunctionsRunnerChild=getDefaultExportFromCjs(okdbFunctionsRunnerChildExports);module['exports']=okdbFunctionsRunnerChild;
|