@npaw/forge-web 10.0.4 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forge_kernel_wasm.d.ts +733 -41
- package/dist/forge_kernel_wasm.js +162 -562
- package/dist/forge_kernel_wasm_bg.wasm +0 -0
- package/dist/index.cjs +71 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -14
- package/dist/index.d.ts +0 -14
- package/dist/index.global.js +122 -24
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +71 -24
- package/dist/index.js.map +1 -1
- package/dist/npaw-forge-web.iife.js +265 -513
- package/dist/npaw-forge-web.iife.js.map +1 -1
- package/dist/npaw-forge-web.iife.min.js +3 -0
- package/dist/npaw-forge-web.iife.min.js.map +1 -0
- package/package.json +2 -1
- package/dist/forge_kernel_wasm_bg.wasm.d.ts +0 -15
|
@@ -1,52 +1,744 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A device runtime health sample, the kernel's `DeviceSample` contract in its
|
|
3
|
+
* JSON spelling. Every metric field is optional and independently absent: an
|
|
4
|
+
* omitted field is an absent metric and the kernel then omits the metric on
|
|
5
|
+
* the wire — never send `0`, `-1`, `null` or a placeholder for "unknown".
|
|
6
|
+
*/
|
|
7
|
+
interface ForgeDeviceSample {
|
|
8
|
+
/**
|
|
9
|
+
* Wall clock at read time, milliseconds since the Unix epoch. Filled with
|
|
10
|
+
* the runtime clock (`Date.now()` by default) when omitted.
|
|
11
|
+
*/
|
|
12
|
+
sampledAtMs?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Cumulative process CPU time, user + system, in milliseconds, monotonic
|
|
15
|
+
* non-decreasing over the process lifetime. Must be supplied together with
|
|
16
|
+
* `cpuCores` on every sample for the CPU rate to be derived.
|
|
17
|
+
*/
|
|
18
|
+
cpuTimeMs?: number;
|
|
19
|
+
/** Logical cores available to the process, at least 1. */
|
|
20
|
+
cpuCores?: number;
|
|
21
|
+
/** Process resident / footprint memory, bytes. */
|
|
22
|
+
memUsedBytes?: number;
|
|
23
|
+
/** Memory available to the app, bytes. */
|
|
24
|
+
memAvailBytes?: number;
|
|
25
|
+
/** Battery level, integer percent 0..100. */
|
|
26
|
+
batteryLevelPct?: number;
|
|
27
|
+
/** Whether the device is charging. */
|
|
28
|
+
batteryCharging?: boolean;
|
|
29
|
+
/** Thermal state on the kernel's normalised ordinal: 0 nominal … 4 emergency. */
|
|
30
|
+
thermal?: 0 | 1 | 2 | 3 | 4;
|
|
31
|
+
/** Free storage on the app's volume, bytes. */
|
|
32
|
+
diskFreeBytes?: number;
|
|
33
|
+
/** WiFi signal strength, dBm (negative). No browser API — hosts only. */
|
|
34
|
+
netSignalDbm?: number;
|
|
35
|
+
/** Negotiated WiFi PHY link rate, Mbps. No browser API — hosts only. */
|
|
36
|
+
netLinkMbps?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Platform downstream-bandwidth estimate, integer kbps (the kernel emits
|
|
39
|
+
* the `netDownlink` param in Mbps). The browser source is
|
|
40
|
+
* `navigator.connection.downlink` — Chromium only, a privacy-shaped
|
|
41
|
+
* estimate rounded to 25 kbps steps and capped at 10 Mbps ("10" means
|
|
42
|
+
* "10 or more").
|
|
43
|
+
*/
|
|
44
|
+
netDownlinkKbps?: number;
|
|
45
|
+
/** WiFi channel frequency, MHz. No browser API — hosts only. */
|
|
46
|
+
netFreqMhz?: number;
|
|
30
47
|
}
|
|
31
48
|
|
|
32
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
33
|
-
|
|
34
49
|
/**
|
|
35
|
-
*
|
|
36
|
-
* a precompiled `WebAssembly.Module`.
|
|
50
|
+
* Copyright (C) NPAW - All Rights Reserved
|
|
37
51
|
*
|
|
38
|
-
*
|
|
52
|
+
* This source code is protected under international copyright law. All rights
|
|
53
|
+
* reserved and protected by the copyright holders.
|
|
54
|
+
* This file is confidential and only available to authorized individuals with the
|
|
55
|
+
* permission of the copyright holders. If you encounter this file and do not have
|
|
56
|
+
* permission, please contact the copyright holders and delete this file.
|
|
39
57
|
*
|
|
40
|
-
*
|
|
58
|
+
*
|
|
59
|
+
* @author: Victor Soto <victor.soto@nicepeopleatwork.com>
|
|
60
|
+
* @description: Public and internal TypeScript contracts for the Forge Web facade.
|
|
41
61
|
*/
|
|
42
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
43
62
|
|
|
63
|
+
type NormalizedParams = Record<string, string>;
|
|
64
|
+
/** Typed identity transitions handled by the kernel identity command. */
|
|
65
|
+
type ForgeIdentityEventKind = "loginSuccess" | "loginFailed" | "logout" | "profileCreated" | "profileSelected" | "profileDeleted";
|
|
66
|
+
type ForgeOutcomeKind = "accepted" | "deferred" | "dropped" | "ignored_duplicate" | "ignored_before_session_start" | "ignored_invalid_state" | "transport_failed" | "error";
|
|
67
|
+
interface ForgeOutcome {
|
|
68
|
+
kind: ForgeOutcomeKind;
|
|
69
|
+
message?: string;
|
|
70
|
+
}
|
|
71
|
+
interface ForgeDiagnostic {
|
|
72
|
+
code: string;
|
|
73
|
+
message: string;
|
|
74
|
+
recoverable: boolean;
|
|
75
|
+
attributes: Record<string, string>;
|
|
76
|
+
}
|
|
77
|
+
interface ForgeRenderedLog {
|
|
78
|
+
level: string;
|
|
79
|
+
tag: string;
|
|
80
|
+
message: string;
|
|
81
|
+
}
|
|
82
|
+
interface ForgeEventSnapshot {
|
|
83
|
+
eventName: string;
|
|
84
|
+
timemarkMs: number;
|
|
85
|
+
viewId?: number;
|
|
86
|
+
payload: NormalizedParams;
|
|
87
|
+
outcome: ForgeOutcome;
|
|
88
|
+
destination?: string;
|
|
89
|
+
dispatchSource: string;
|
|
90
|
+
replay: boolean;
|
|
91
|
+
renderedLog?: ForgeRenderedLog;
|
|
92
|
+
}
|
|
93
|
+
interface ForgeRuntimeConfig {
|
|
94
|
+
accountCode: string;
|
|
95
|
+
appName?: string;
|
|
96
|
+
buildVariant?: string;
|
|
97
|
+
appReleaseVersion?: string;
|
|
98
|
+
lmaEndpoint?: string;
|
|
99
|
+
analyticsHost?: string;
|
|
100
|
+
userAgent?: string;
|
|
101
|
+
allowLocalHttp?: boolean;
|
|
102
|
+
processEventsBeforeSessionStart?: boolean;
|
|
103
|
+
preSessionEventQueueLimitEvents?: number;
|
|
104
|
+
preSessionEventQueueMaxAgeMs?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Logout guard window in milliseconds (session-update mode only): after
|
|
107
|
+
* `logout()` closes the session, Forge holds the replacement session back
|
|
108
|
+
* for this long so a follow-up `loginSuccess` attaches its own session
|
|
109
|
+
* directly; events raised inside the window are buffered with their
|
|
110
|
+
* original timestamps and flushed into whichever session finally starts.
|
|
111
|
+
* `0` disables the guard. Default 30 000.
|
|
112
|
+
*/
|
|
113
|
+
logoutSessionGuardMs?: number;
|
|
114
|
+
logLevel?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Stable device identifier. Collected automatically unless
|
|
117
|
+
* `autoDeviceIdentity` is false; set this to supply your own.
|
|
118
|
+
*/
|
|
119
|
+
deviceUuid?: string;
|
|
120
|
+
/**
|
|
121
|
+
* `deviceInfo` facts. Forge does not auto-detect these on Web: the browser
|
|
122
|
+
* already sends a User-Agent header on every request and NPAW resolves the
|
|
123
|
+
* device from it server-side, which is strictly better than anything a
|
|
124
|
+
* client-side parser can do. The v7 Web plugin makes the same choice. Set
|
|
125
|
+
* them only when you know something the User-Agent does not convey.
|
|
126
|
+
*/
|
|
127
|
+
deviceInfo?: DeviceOverrides;
|
|
128
|
+
}
|
|
129
|
+
interface ForgeTransportRequest {
|
|
130
|
+
method: string;
|
|
131
|
+
url: string;
|
|
132
|
+
headers: Record<string, string>;
|
|
133
|
+
query: NormalizedParams;
|
|
134
|
+
body?: unknown;
|
|
135
|
+
/** The kernel's own serialization of `body`, byte-exact; send this when present. */
|
|
136
|
+
bodyText?: string;
|
|
137
|
+
bodyBytes?: number[];
|
|
138
|
+
}
|
|
139
|
+
interface ForgeHttpResponse {
|
|
140
|
+
status: number;
|
|
141
|
+
headers: Record<string, string>;
|
|
142
|
+
body: string;
|
|
143
|
+
}
|
|
144
|
+
interface WasmResponse<T> {
|
|
145
|
+
ok: boolean;
|
|
146
|
+
value?: T;
|
|
147
|
+
error?: WasmBoundaryError;
|
|
148
|
+
}
|
|
149
|
+
interface WasmBoundaryError {
|
|
150
|
+
code: string;
|
|
151
|
+
message: string;
|
|
152
|
+
recoverable: boolean;
|
|
153
|
+
}
|
|
154
|
+
interface WasmBatch {
|
|
155
|
+
outcome: ForgeOutcome;
|
|
156
|
+
createdViewId?: number;
|
|
157
|
+
effects: WasmEffect[];
|
|
158
|
+
}
|
|
159
|
+
type WasmDriverCommand = {
|
|
160
|
+
type: "start";
|
|
161
|
+
nowMs?: number;
|
|
162
|
+
} | {
|
|
163
|
+
type: "destroy";
|
|
164
|
+
} | {
|
|
165
|
+
type: "createVideoView";
|
|
166
|
+
viewId?: number;
|
|
167
|
+
nowMs?: number;
|
|
168
|
+
options?: VideoOptions;
|
|
169
|
+
} | {
|
|
170
|
+
type: "destroyVideoView";
|
|
171
|
+
viewId: number;
|
|
172
|
+
} | {
|
|
173
|
+
type: "videoEvent";
|
|
174
|
+
event: VideoEventName;
|
|
175
|
+
viewId: number;
|
|
176
|
+
timestamp?: SemanticTimestamp;
|
|
177
|
+
overrides?: OverrideBundle;
|
|
178
|
+
metadata: ContentMetadata;
|
|
179
|
+
qos?: QosSnapshot;
|
|
180
|
+
} | {
|
|
181
|
+
type: "adEvent";
|
|
182
|
+
event: AdEventName;
|
|
183
|
+
viewId: number;
|
|
184
|
+
timestamp?: SemanticTimestamp;
|
|
185
|
+
overrides?: OverrideBundle;
|
|
186
|
+
metadata: AdMetadata;
|
|
187
|
+
adapterVersion?: string;
|
|
188
|
+
} | {
|
|
189
|
+
type: "adMetadataUpdate";
|
|
190
|
+
viewId: number;
|
|
191
|
+
timestamp?: SemanticTimestamp;
|
|
192
|
+
metadata: AdMetadata;
|
|
193
|
+
} | {
|
|
194
|
+
type: "sessionEvent";
|
|
195
|
+
eventName: string;
|
|
196
|
+
timemarkMs?: number;
|
|
197
|
+
params: NormalizedParams;
|
|
198
|
+
} | {
|
|
199
|
+
type: "sessionUpdate";
|
|
200
|
+
timemarkMs?: number;
|
|
201
|
+
params?: NormalizedParams;
|
|
202
|
+
metrics?: Record<string, number>;
|
|
203
|
+
} | {
|
|
204
|
+
type: "identityEvent";
|
|
205
|
+
kind: ForgeIdentityEventKind;
|
|
206
|
+
timemarkMs?: number;
|
|
207
|
+
userId?: string;
|
|
208
|
+
profileId?: string;
|
|
209
|
+
profileType?: string;
|
|
210
|
+
method?: string;
|
|
211
|
+
errorCode?: string;
|
|
212
|
+
reason?: string;
|
|
213
|
+
userType?: string;
|
|
214
|
+
params: NormalizedParams;
|
|
215
|
+
} | {
|
|
216
|
+
type: "applicationForeground";
|
|
217
|
+
foreground: boolean;
|
|
218
|
+
timemarkMs?: number;
|
|
219
|
+
} | {
|
|
220
|
+
type: "networkEvent";
|
|
221
|
+
observation: InternalNetworkObservation;
|
|
222
|
+
} | {
|
|
223
|
+
type: "timerFired";
|
|
224
|
+
id: string;
|
|
225
|
+
kind: WasmTimerKind;
|
|
226
|
+
generation: number;
|
|
227
|
+
timestamp: SemanticTimestamp;
|
|
228
|
+
} | {
|
|
229
|
+
type: "httpCompleted";
|
|
230
|
+
requestId: number;
|
|
231
|
+
response: WasmHttpResponse;
|
|
232
|
+
} | {
|
|
233
|
+
type: "httpFailed";
|
|
234
|
+
requestId: number;
|
|
235
|
+
error: string;
|
|
236
|
+
} | {
|
|
237
|
+
type: "storageReadCompleted";
|
|
238
|
+
operationId: number;
|
|
239
|
+
value: string | null;
|
|
240
|
+
error?: string;
|
|
241
|
+
} | {
|
|
242
|
+
type: "storageWriteCompleted";
|
|
243
|
+
operationId: number;
|
|
244
|
+
error?: string;
|
|
245
|
+
} | {
|
|
246
|
+
type: "storageDeleteCompleted";
|
|
247
|
+
operationId: number;
|
|
248
|
+
error?: string;
|
|
249
|
+
} | {
|
|
250
|
+
type: "setLogLevel";
|
|
251
|
+
level: string;
|
|
252
|
+
} | {
|
|
253
|
+
type: "setAutoConnectionType";
|
|
254
|
+
connectionType: string | undefined;
|
|
255
|
+
} | {
|
|
256
|
+
type: "recordLocationFix";
|
|
257
|
+
latitude: number;
|
|
258
|
+
longitude: number;
|
|
259
|
+
accuracyM: number;
|
|
260
|
+
timestampMs: number;
|
|
261
|
+
} | {
|
|
262
|
+
/**
|
|
263
|
+
* A device sample answering a `deviceSampleRequest` effect (or pushed
|
|
264
|
+
* by the integrator). Mirrors the kernel's `DeviceSample` in camelCase;
|
|
265
|
+
* an omitted field is an absent metric. `sampledAtMs` is stamped by the
|
|
266
|
+
* runtime bridge from its clock when the sample carries none.
|
|
267
|
+
*/
|
|
268
|
+
type: "recordDeviceSample";
|
|
269
|
+
sample: ForgeDeviceSample;
|
|
270
|
+
};
|
|
271
|
+
type WasmEffect = {
|
|
272
|
+
type: "httpRequest";
|
|
273
|
+
id: number;
|
|
274
|
+
request: WasmTransportRequest;
|
|
275
|
+
} | {
|
|
276
|
+
type: "scheduleTimer";
|
|
277
|
+
timer: WasmTimer;
|
|
278
|
+
} | {
|
|
279
|
+
type: "cancelTimer";
|
|
280
|
+
timer: WasmTimerCancellation;
|
|
281
|
+
} | {
|
|
282
|
+
type: "storageRead";
|
|
283
|
+
id: number;
|
|
284
|
+
key: string;
|
|
285
|
+
} | {
|
|
286
|
+
type: "storageWrite";
|
|
287
|
+
id: number;
|
|
288
|
+
key: string;
|
|
289
|
+
value: string;
|
|
290
|
+
} | {
|
|
291
|
+
type: "storageDelete";
|
|
292
|
+
id: number;
|
|
293
|
+
key: string;
|
|
294
|
+
} | {
|
|
295
|
+
type: "eventSnapshot";
|
|
296
|
+
snapshot: ForgeEventSnapshot;
|
|
297
|
+
} | {
|
|
298
|
+
type: "renderedLog";
|
|
299
|
+
log: ForgeRenderedLog;
|
|
300
|
+
} | {
|
|
301
|
+
type: "capturePlan";
|
|
302
|
+
plan: WasmCapturePlan;
|
|
303
|
+
} | {
|
|
304
|
+
/**
|
|
305
|
+
* The kernel's device-insights cadence fired: read the listed metric
|
|
306
|
+
* families now and answer with a `recordDeviceSample` command. Only
|
|
307
|
+
* emitted while an operator enabled `di.en`.
|
|
308
|
+
*/
|
|
309
|
+
type: "deviceSampleRequest";
|
|
310
|
+
families: string[];
|
|
311
|
+
} | ForgeDiagnosticEffect;
|
|
312
|
+
interface ForgeDiagnosticEffect extends ForgeDiagnostic {
|
|
313
|
+
type: "diagnostic";
|
|
314
|
+
}
|
|
44
315
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
316
|
+
* Kernel-derived capture plan emitted by the WASM bridge whenever the plan
|
|
317
|
+
* hash changes (first Start onward, and after remote-config refreshes).
|
|
318
|
+
* Mirrors `WasmCapturePlan` in crates/forge-kernel-wasm/src/lib.rs. `hash` is
|
|
319
|
+
* a string because it carries a full 64-bit value. TypeScript may decode the
|
|
320
|
+
* plan bits to gate observers; deriving the plan (propagation policy, rules,
|
|
321
|
+
* sampling) stays in Rust.
|
|
322
|
+
*/
|
|
323
|
+
interface WasmCapturePlan {
|
|
324
|
+
planSeq: number;
|
|
325
|
+
bits: number;
|
|
326
|
+
configVersion?: string;
|
|
327
|
+
focus: WasmCapturePlanFocus;
|
|
328
|
+
sections: WasmCapturePlanSections;
|
|
329
|
+
attribution: WasmCapturePlanAttribution;
|
|
330
|
+
limits: WasmCapturePlanLimits;
|
|
331
|
+
behavior: WasmCapturePlanBehavior;
|
|
332
|
+
/**
|
|
333
|
+
* Extra `data-*` attribute names (kebab-case, without the `data-` prefix)
|
|
334
|
+
* to capture off interaction targets — all clicks and sections items. The
|
|
335
|
+
* kernel admits their camelized forms through the target-attribute
|
|
336
|
+
* allowlist and rewrites `elementData.<kebab>` to `target.attr.<camel>`;
|
|
337
|
+
* the binding only captures them. Remote entries union with the local
|
|
338
|
+
* privacy `allowedDataAttributes` option (remote adds, never removes).
|
|
339
|
+
* Omitted when empty.
|
|
340
|
+
*/
|
|
341
|
+
targetDataAttributes?: string[];
|
|
342
|
+
/**
|
|
343
|
+
* Device-insights metric families the kernel will request (`di.m`, canonical
|
|
344
|
+
* order); present only while the `DEVICE_INSIGHTS` bit is set. Lets a host
|
|
345
|
+
* pre-arm an observer a family needs; the Web reader needs none, so it is
|
|
346
|
+
* informational here. The `deviceSampleRequest` effect, not the plan, is
|
|
347
|
+
* what triggers a read.
|
|
348
|
+
*/
|
|
349
|
+
deviceInsightFamilies?: string[];
|
|
350
|
+
hash: string;
|
|
351
|
+
}
|
|
352
|
+
interface WasmCapturePlanFocus {
|
|
353
|
+
dwellThresholdMs: number;
|
|
354
|
+
dedupeMs: number;
|
|
355
|
+
repeatUnchangedDwell: boolean;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Sections auto-capture knobs mirrored from `WasmCapturePlanSections` in
|
|
359
|
+
* crates/forge-kernel-wasm/src/lib.rs. `sectionNativeIds`/`itemNativeIds`
|
|
360
|
+
* target native view-id lookups on Android/Apple and are ignored on Web.
|
|
361
|
+
*/
|
|
362
|
+
interface WasmCapturePlanSections {
|
|
363
|
+
visibilityThresholdPct: number;
|
|
364
|
+
impressionMinVisibleMs: number;
|
|
365
|
+
dwellMs: number;
|
|
366
|
+
maxTrackedItems: number;
|
|
367
|
+
maxSections: number;
|
|
368
|
+
/** Remote CSS selector for section containers; absent when not remotely set. */
|
|
369
|
+
sectionSelector?: string;
|
|
370
|
+
/** Remote CSS selector for content items; absent when not remotely set. */
|
|
371
|
+
itemSelector?: string;
|
|
372
|
+
sectionNativeIds?: string[];
|
|
373
|
+
itemNativeIds?: string[];
|
|
374
|
+
/** Section naming source token: "auto" | "id" | "da" | "hd" | "ar". */
|
|
375
|
+
nameFrom: string;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Attribution auto-capture knobs mirrored from `WasmCapturePlanAttribution`
|
|
379
|
+
* in crates/forge-kernel-wasm/src/lib.rs. `deriveFromDeepLinks` and
|
|
380
|
+
* `installReferrerEnabled` are mobile-only knobs; the Web observer ignores
|
|
381
|
+
* them.
|
|
382
|
+
*/
|
|
383
|
+
interface WasmCapturePlanAttribution {
|
|
384
|
+
/**
|
|
385
|
+
* Extra landing-page query keys captured in addition to the built-in
|
|
386
|
+
* click-id list (gclid/fbclid/ttclid/msclkid/dclid/twclid); the union
|
|
387
|
+
* extends, never replaces, `utm_*` handling. Omitted when empty.
|
|
388
|
+
*/
|
|
389
|
+
extraQueryKeys?: string[];
|
|
390
|
+
includeLandingUrl: boolean;
|
|
391
|
+
deriveFromDeepLinks: boolean;
|
|
392
|
+
installReferrerEnabled: boolean;
|
|
393
|
+
}
|
|
394
|
+
interface WasmCapturePlanLimits {
|
|
395
|
+
maxTargetTextLength: number;
|
|
396
|
+
maxPayloadFields: number;
|
|
397
|
+
}
|
|
398
|
+
interface WasmCapturePlanBehavior {
|
|
399
|
+
joinMethod?: string;
|
|
400
|
+
seekHeuristicEnabled?: boolean;
|
|
401
|
+
seekJumpThresholdMs?: number;
|
|
402
|
+
metadataSamplingMs?: number;
|
|
403
|
+
}
|
|
404
|
+
interface WasmTransportRequest extends ForgeTransportRequest {
|
|
405
|
+
}
|
|
406
|
+
interface WasmHttpResponse extends ForgeHttpResponse {
|
|
407
|
+
}
|
|
408
|
+
interface WasmTimer {
|
|
409
|
+
id: string;
|
|
410
|
+
kind: WasmTimerKind;
|
|
411
|
+
generation: number;
|
|
412
|
+
delayMs: number;
|
|
413
|
+
baseTimestamp: SemanticTimestamp;
|
|
414
|
+
dueTimestamp: SemanticTimestamp;
|
|
415
|
+
}
|
|
416
|
+
interface WasmTimerCancellation {
|
|
417
|
+
id: string;
|
|
418
|
+
kind: WasmTimerKind;
|
|
419
|
+
generation: number;
|
|
420
|
+
}
|
|
421
|
+
type WasmTimerKind = {
|
|
422
|
+
type: "bootstrapRetry";
|
|
423
|
+
} | {
|
|
424
|
+
type: "sessionBeat";
|
|
425
|
+
} | {
|
|
426
|
+
type: "videoPing";
|
|
427
|
+
viewId: number;
|
|
428
|
+
} | {
|
|
429
|
+
type: "delayedVideoStart";
|
|
430
|
+
viewId: number;
|
|
431
|
+
} | {
|
|
432
|
+
type: "fastDataRefresh";
|
|
433
|
+
version: string;
|
|
434
|
+
} | {
|
|
435
|
+
type: "liveBatchFlush";
|
|
436
|
+
} | {
|
|
437
|
+
type: "windowExpiry";
|
|
438
|
+
id: string;
|
|
439
|
+
} | {
|
|
440
|
+
type: "retry";
|
|
441
|
+
} | {
|
|
442
|
+
type: "deviceSample";
|
|
443
|
+
} | {
|
|
444
|
+
type: "sessionUpdateDebounce";
|
|
445
|
+
} | {
|
|
446
|
+
type: "logoutGuard";
|
|
447
|
+
} | {
|
|
448
|
+
type: "networkStatsFlush";
|
|
449
|
+
};
|
|
450
|
+
interface SemanticTimestamp {
|
|
451
|
+
timemarkMs: number;
|
|
452
|
+
elapsedRealtimeMs: number;
|
|
453
|
+
}
|
|
454
|
+
interface VideoOptions {
|
|
455
|
+
joinTimeCalculationMode?: "default" | "legacy";
|
|
456
|
+
adJoinFromAdBreakStart?: boolean;
|
|
457
|
+
adConnectedRequiresAdJoin?: boolean;
|
|
458
|
+
contentIsLiveNoSeek?: boolean;
|
|
459
|
+
ignorePauseSmallEvents?: boolean;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Mirrors the kernel serde contract in crates/forge-kernel/src/wire/bundle.rs
|
|
463
|
+
* (`OverrideBundle`, camelCase keys). Values in `scalars` must reach the kernel
|
|
464
|
+
* as strings; the facade coerces other primitives before crossing the boundary.
|
|
465
|
+
*/
|
|
466
|
+
interface OverrideBundle {
|
|
467
|
+
scalars?: Record<string, string | number | boolean>;
|
|
468
|
+
numbers?: Record<string, number>;
|
|
469
|
+
bools?: Record<string, boolean>;
|
|
470
|
+
dimensions?: Record<string, unknown>;
|
|
471
|
+
properties?: Record<string, unknown>;
|
|
472
|
+
adProperties?: Record<string, unknown>;
|
|
473
|
+
codecSettings?: Record<string, unknown>;
|
|
474
|
+
metrics?: Record<string, unknown>;
|
|
475
|
+
sessionMetrics?: Record<string, unknown>;
|
|
476
|
+
expectedPattern?: Record<string, number[]>;
|
|
477
|
+
breaksTime?: number[];
|
|
478
|
+
adBreaksTime?: number[];
|
|
479
|
+
device?: DeviceOverrides;
|
|
480
|
+
control?: OverrideControlOptions;
|
|
481
|
+
}
|
|
482
|
+
/** Mirrors `DeviceOverrides` in crates/forge-kernel/src/wire/bundle.rs (string-only fields). */
|
|
483
|
+
/**
|
|
484
|
+
* Device identity overrides.
|
|
485
|
+
*
|
|
486
|
+
* These are the *input* names. They are not the wire keys: the kernel emits
|
|
487
|
+
* `deviceInfo` using the v7 plugin contract, where `code` becomes `deviceCode`
|
|
488
|
+
* and `type` becomes `deviceType`. The short names here are kept because they
|
|
489
|
+
* are public API; the kernel accepts them as aliases. See
|
|
490
|
+
* `device_info_json` in crates/forge-kernel/src/wire/serialize.rs and the
|
|
491
|
+
* `deviceInfo` key table in docs/events.md.
|
|
492
|
+
*/
|
|
493
|
+
interface DeviceOverrides {
|
|
494
|
+
brand?: string;
|
|
495
|
+
code?: string;
|
|
496
|
+
model?: string;
|
|
497
|
+
type?: string;
|
|
498
|
+
osName?: string;
|
|
499
|
+
osVersion?: string;
|
|
500
|
+
}
|
|
501
|
+
/** Mirrors `ControlOptions` in crates/forge-kernel/src/wire/bundle.rs. */
|
|
502
|
+
interface OverrideControlOptions {
|
|
503
|
+
errorsToIgnore?: string[];
|
|
504
|
+
fatalErrors?: string[];
|
|
505
|
+
nonFatalErrors?: string[];
|
|
506
|
+
legacyErrorNames?: boolean;
|
|
507
|
+
forceInit?: boolean;
|
|
508
|
+
pendingMetadata?: string[];
|
|
509
|
+
waitForMetadata?: boolean;
|
|
510
|
+
waitForMetadataTimeoutMs?: number;
|
|
511
|
+
contentIsLiveNoSeek?: boolean;
|
|
512
|
+
ignorePauseSmallEvents?: boolean;
|
|
513
|
+
parseManifest?: boolean;
|
|
514
|
+
parseCdnNode?: boolean;
|
|
515
|
+
parseCdnNodeDisableFallback?: boolean;
|
|
516
|
+
parseCdnNodeAllowedGetMethodOnRetry?: boolean;
|
|
517
|
+
parseCdnNodeRequestDelayed?: boolean;
|
|
518
|
+
parseCdnNodeList?: string[];
|
|
519
|
+
parseCdnNameHeaderList?: string[];
|
|
520
|
+
parseCdnNodeHeaderList?: string[];
|
|
521
|
+
parseManifestAuth?: Record<string, string>;
|
|
522
|
+
autoRestartOnMaxTimeExpiration?: boolean;
|
|
523
|
+
autoDetectBackground?: boolean;
|
|
524
|
+
}
|
|
525
|
+
type ContentType = "live" | "vod" | "audio" | "unknown";
|
|
526
|
+
interface ContentMetadata {
|
|
527
|
+
player?: string;
|
|
528
|
+
playerVersion?: string;
|
|
529
|
+
resource?: string;
|
|
530
|
+
parsedResource?: string;
|
|
531
|
+
title?: string;
|
|
532
|
+
program?: string;
|
|
533
|
+
transactionCode?: string;
|
|
534
|
+
properties?: Record<string, unknown>;
|
|
535
|
+
contentId?: string;
|
|
536
|
+
contentLanguage?: string;
|
|
537
|
+
subtitles?: string;
|
|
538
|
+
cdn?: string;
|
|
539
|
+
streamingProtocol?: string;
|
|
540
|
+
transportFormat?: string;
|
|
541
|
+
privacyProtocol?: string;
|
|
542
|
+
householdId?: string;
|
|
543
|
+
username?: string;
|
|
544
|
+
profileId?: string;
|
|
545
|
+
userType?: string;
|
|
546
|
+
anonymousUser?: string;
|
|
547
|
+
email?: string;
|
|
548
|
+
ip?: string;
|
|
549
|
+
isp?: string;
|
|
550
|
+
connectionType?: string;
|
|
551
|
+
nodeHost?: string;
|
|
552
|
+
nodeType?: string;
|
|
553
|
+
nodeTypeString?: string;
|
|
554
|
+
linkedViewId?: string;
|
|
555
|
+
/** Page/context URL (OLD-parity `referer`); defaults to the current page URL per event when unset. */
|
|
556
|
+
referer?: string;
|
|
557
|
+
/** Traffic origin (OLD-parity `referral`); defaults to `document.referrer` when unset. */
|
|
558
|
+
referral?: string;
|
|
559
|
+
/** Milliseconds from navigation start to player setup (OLD-parity `playerStartupTime`); stamped at adapter attach when unset. */
|
|
560
|
+
playerStartupTimeMs?: number;
|
|
561
|
+
package?: string;
|
|
562
|
+
saga?: string;
|
|
563
|
+
tvShow?: string;
|
|
564
|
+
season?: string;
|
|
565
|
+
episodeTitle?: string;
|
|
566
|
+
channel?: string;
|
|
567
|
+
drm?: string;
|
|
568
|
+
codecSettings?: Record<string, unknown>;
|
|
569
|
+
contentTypeName?: string;
|
|
570
|
+
genre?: string;
|
|
571
|
+
imdbId?: string;
|
|
572
|
+
gracenoteId?: string;
|
|
573
|
+
contractedResolution?: string;
|
|
574
|
+
cost?: string;
|
|
575
|
+
price?: string;
|
|
576
|
+
playbackType?: string;
|
|
577
|
+
contentType?: ContentType;
|
|
578
|
+
playheadMs?: number;
|
|
579
|
+
durationMs?: number;
|
|
580
|
+
seekDurationMs?: number;
|
|
581
|
+
bufferDurationMs?: number;
|
|
582
|
+
segmentDurationMs?: number;
|
|
583
|
+
bitrate?: number;
|
|
584
|
+
throughput?: number;
|
|
585
|
+
totalBytes?: number;
|
|
586
|
+
droppedFrames?: number;
|
|
587
|
+
rendition?: string;
|
|
588
|
+
videoCodec?: string;
|
|
589
|
+
audioCodec?: string;
|
|
590
|
+
codecProfile?: string;
|
|
591
|
+
containerFormat?: string;
|
|
592
|
+
legacyCustomDimensions?: Record<string, string>;
|
|
593
|
+
customDimensions?: Record<string, unknown>;
|
|
594
|
+
customMetrics?: Record<string, unknown>;
|
|
595
|
+
errorCode?: string;
|
|
596
|
+
errorMessage?: string;
|
|
597
|
+
errorMetadata?: string;
|
|
598
|
+
errorLevel?: string;
|
|
599
|
+
forceInit?: boolean;
|
|
600
|
+
convertFromBuffer?: boolean;
|
|
601
|
+
convertFromSeek?: boolean;
|
|
602
|
+
customEventJson?: string;
|
|
603
|
+
}
|
|
604
|
+
interface QosSnapshot {
|
|
605
|
+
throughput?: number;
|
|
606
|
+
fps?: number;
|
|
607
|
+
latency?: number;
|
|
608
|
+
playrate?: number;
|
|
609
|
+
droppedFrames?: number;
|
|
610
|
+
totalBytes?: number;
|
|
611
|
+
packetLoss?: number;
|
|
612
|
+
packetSent?: number;
|
|
613
|
+
droppedPackets?: number;
|
|
614
|
+
lostPackets?: number;
|
|
615
|
+
multicastAffectionTimeMs?: number;
|
|
616
|
+
}
|
|
617
|
+
type VideoEventName = "init" | "start" | "join" | "pause" | "resume" | "seekBegin" | "seekEnd" | "bufferBegin" | "bufferEnd" | "stop" | "error" | "custom" | "customEnd" | "fatalError" | "metadataUpdate";
|
|
618
|
+
type AdEventName = "adManifest" | "adBreakStart" | "adInit" | "adStart" | "adJoin" | "adPause" | "adResume" | "adBufferBegin" | "adBufferEnd" | "adQuartile" | "adClick" | "adSkip" | "adStop" | "adError" | "adFatalError" | "adBreakStop";
|
|
619
|
+
interface AdMetadata {
|
|
620
|
+
player?: string;
|
|
621
|
+
creativeId?: string;
|
|
622
|
+
adCampaign?: string;
|
|
623
|
+
adPlayerVersion?: string;
|
|
624
|
+
adProvider?: string;
|
|
625
|
+
adResource?: string;
|
|
626
|
+
adUrl?: string;
|
|
627
|
+
adTitle?: string;
|
|
628
|
+
adDurationMs?: number;
|
|
629
|
+
adPlayheadMs?: number;
|
|
630
|
+
adBitrate?: number;
|
|
631
|
+
adProperties?: Record<string, unknown>;
|
|
632
|
+
legacyCustomDimensions?: Record<string, string>;
|
|
633
|
+
position?: "pre" | "mid" | "post" | "unknown";
|
|
634
|
+
skippable?: boolean;
|
|
635
|
+
fullscreen?: boolean;
|
|
636
|
+
audio?: boolean;
|
|
637
|
+
givenAds?: number;
|
|
638
|
+
expectedAds?: number;
|
|
639
|
+
givenBreaks?: number;
|
|
640
|
+
expectedBreaks?: number;
|
|
641
|
+
expectedPattern?: string | Record<string, number[]>;
|
|
642
|
+
breaksTime?: string;
|
|
643
|
+
breakNumber?: number;
|
|
644
|
+
adNumber?: number;
|
|
645
|
+
adNumberInBreak?: number;
|
|
646
|
+
quartile?: number;
|
|
647
|
+
insertionType?: "csai" | "ssai" | "unknown";
|
|
648
|
+
viewability?: AdViewabilitySample;
|
|
649
|
+
errorCode?: string;
|
|
650
|
+
errorMessage?: string;
|
|
651
|
+
errorMetadata?: string;
|
|
652
|
+
errorLevel?: string;
|
|
653
|
+
}
|
|
654
|
+
interface AdViewabilitySample {
|
|
655
|
+
maxIntervalMs?: number;
|
|
656
|
+
viewedDurationMs?: number;
|
|
657
|
+
}
|
|
658
|
+
interface NetworkObservation {
|
|
659
|
+
eventId: string;
|
|
660
|
+
source?: string;
|
|
661
|
+
targetUrl: string;
|
|
662
|
+
method: string;
|
|
663
|
+
startElapsedRealtimeMs?: number;
|
|
664
|
+
endElapsedRealtimeMs?: number;
|
|
665
|
+
durationMs: number;
|
|
666
|
+
responseStatusCode: number;
|
|
667
|
+
outcome?: string;
|
|
668
|
+
responseStatusText?: string;
|
|
669
|
+
errorMessage?: string;
|
|
670
|
+
traceparent?: string;
|
|
671
|
+
dnsDurationMs?: number;
|
|
672
|
+
connectDurationMs?: number;
|
|
673
|
+
sslDurationMs?: number;
|
|
674
|
+
requestDurationMs?: number;
|
|
675
|
+
timeToFirstByteMs?: number;
|
|
676
|
+
responseDownloadDurationMs?: number;
|
|
677
|
+
redirectDurationMs?: number;
|
|
678
|
+
redirectCount?: number;
|
|
679
|
+
protocol?: string;
|
|
680
|
+
/**
|
|
681
|
+
* Resource class of the request as reported by the observing host, e.g. a
|
|
682
|
+
* player adapter classifying its SDK's own downloads. Canonical lowercase
|
|
683
|
+
* tokens: `manifest`, `media`, `media_video`, `media_audio`,
|
|
684
|
+
* `media_subtitles`, `media_thumbnails`, `drm_license`, `drm_key`,
|
|
685
|
+
* `asset_list`. The kernel caps it at 32 chars on the wire (wire key
|
|
686
|
+
* `requestType`, fact `net.request_type`).
|
|
687
|
+
*/
|
|
688
|
+
requestType?: string;
|
|
689
|
+
/**
|
|
690
|
+
* Request/response body sizes in bytes. Body content is never captured:
|
|
691
|
+
* the binding measures the outgoing body bytes when it can and falls back
|
|
692
|
+
* to the `Content-Length` header; only these sizes travel to the kernel
|
|
693
|
+
* (wire keys `requestBytes`/`responseBytes`, facts `net.bytes_out`/
|
|
694
|
+
* `net.bytes_in`).
|
|
695
|
+
*/
|
|
696
|
+
requestBytes?: number;
|
|
697
|
+
responseBytes?: number;
|
|
698
|
+
requestQuery?: NormalizedParams;
|
|
699
|
+
requestHeaders?: NormalizedParams;
|
|
700
|
+
responseHeaders?: NormalizedParams;
|
|
701
|
+
/**
|
|
702
|
+
* Optional explicit observation wall-clock time in milliseconds. When
|
|
703
|
+
* omitted the runtime stamps the observation with the current clock; set it
|
|
704
|
+
* only when forwarding a network fact observed earlier (e.g. replayed or
|
|
705
|
+
* recorded requests).
|
|
706
|
+
*/
|
|
707
|
+
timemarkMs?: number;
|
|
708
|
+
}
|
|
709
|
+
interface InternalNetworkObservation extends NetworkObservation {
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Copyright (C) NPAW - All Rights Reserved
|
|
714
|
+
*
|
|
715
|
+
* This source code is protected under international copyright law. All rights
|
|
716
|
+
* reserved and protected by the copyright holders.
|
|
717
|
+
* This file is confidential and only available to authorized individuals with the
|
|
718
|
+
* permission of the copyright holders. If you encounter this file and do not have
|
|
719
|
+
* permission, please contact the copyright holders and delete this file.
|
|
47
720
|
*
|
|
48
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
49
721
|
*
|
|
50
|
-
* @
|
|
722
|
+
* @author: Victor Soto <victor.soto@nicepeopleatwork.com>
|
|
723
|
+
* @description: Browser loader for the plain-ABI Forge Web wasm kernel. Drives
|
|
724
|
+
* the forge-kernel-web extern "C" exports (length-prefixed JSON buffers over
|
|
725
|
+
* forge-kernel-wasm's json_api) and adapts them to the WasmModule interface the
|
|
726
|
+
* runtime bridge consumes. Replaces the wasm-bindgen glue so the shipped module
|
|
727
|
+
* stays within the WebAssembly MVP feature set (Chrome 68-class TV engines).
|
|
51
728
|
*/
|
|
52
|
-
|
|
729
|
+
|
|
730
|
+
interface ForgeWasmInitInput {
|
|
731
|
+
module_or_path?: BufferSource | Response | Promise<Response> | string | URL;
|
|
732
|
+
}
|
|
733
|
+
declare function forgeRuntimeCreate(config: ForgeRuntimeConfig): WasmResponse<{
|
|
734
|
+
handle: number;
|
|
735
|
+
}>;
|
|
736
|
+
declare function forgeRuntimeProcess(handle: number, command: WasmDriverCommand): WasmResponse<WasmBatch>;
|
|
737
|
+
declare function forgeRuntimeDestroy(handle: number): WasmResponse<WasmBatch>;
|
|
738
|
+
declare function forgeRuntimeRelease(handle: number): WasmResponse<{
|
|
739
|
+
released: boolean;
|
|
740
|
+
}>;
|
|
741
|
+
declare function forgeRuntimeVersion(): string;
|
|
742
|
+
declare function init(input?: ForgeWasmInitInput | BufferSource | Response | string | URL): Promise<void>;
|
|
743
|
+
|
|
744
|
+
export { type ForgeWasmInitInput, init as default, forgeRuntimeCreate, forgeRuntimeDestroy, forgeRuntimeProcess, forgeRuntimeRelease, forgeRuntimeVersion };
|