@libo11y/rum 0.0.0-stage → 0.6.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/LICENSE +202 -0
- package/README.md +478 -2
- package/dist/actions/collector.d.ts +29 -0
- package/dist/actions/collector.js +260 -0
- package/dist/actions/naming.d.ts +15 -0
- package/dist/actions/naming.js +65 -0
- package/dist/actions/record.d.ts +13 -0
- package/dist/actions/record.js +28 -0
- package/dist/actions/settle.d.ts +28 -0
- package/dist/actions/settle.js +53 -0
- package/dist/attrs.d.ts +10 -0
- package/dist/attrs.js +12 -0
- package/dist/bind.d.ts +23 -0
- package/dist/bind.js +55 -0
- package/dist/bootstrap/buffer.d.ts +72 -0
- package/dist/bootstrap/buffer.js +95 -0
- package/dist/bootstrap/replay.d.ts +10 -0
- package/dist/bootstrap/replay.js +11 -0
- package/dist/bootstrap.d.ts +17 -0
- package/dist/bootstrap.js +33 -0
- package/dist/bus.d.ts +3 -0
- package/dist/bus.js +21 -0
- package/dist/config/clamp.d.ts +34 -0
- package/dist/config/clamp.js +79 -0
- package/dist/config/remote.d.ts +103 -0
- package/dist/config/remote.js +241 -0
- package/dist/context-manager.d.ts +8 -0
- package/dist/context-manager.js +29 -0
- package/dist/contracts/binding.d.ts +82 -0
- package/dist/contracts/binding.js +1 -0
- package/dist/contracts/retention.d.ts +32 -0
- package/dist/contracts/retention.js +1 -0
- package/dist/contracts/runtime.d.ts +164 -0
- package/dist/contracts/runtime.js +1 -0
- package/dist/contracts/session.d.ts +68 -0
- package/dist/contracts/session.js +1 -0
- package/dist/contracts/summary.d.ts +28 -0
- package/dist/contracts/summary.js +1 -0
- package/dist/contracts/views.d.ts +71 -0
- package/dist/contracts/views.js +1 -0
- package/dist/core-setup.d.ts +121 -0
- package/dist/core-setup.js +1117 -0
- package/dist/core.d.ts +46 -0
- package/dist/core.js +36 -0
- package/dist/errors/breadcrumbs.d.ts +16 -0
- package/dist/errors/breadcrumbs.js +27 -0
- package/dist/errors/collector.d.ts +17 -0
- package/dist/errors/collector.js +186 -0
- package/dist/errors/normalize.d.ts +7 -0
- package/dist/errors/normalize.js +31 -0
- package/dist/errors/record.d.ts +20 -0
- package/dist/errors/record.js +46 -0
- package/dist/frustration/detect.d.ts +38 -0
- package/dist/frustration/detect.js +62 -0
- package/dist/ids.d.ts +2 -0
- package/dist/ids.js +2 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +12 -0
- package/dist/internal.d.ts +34 -0
- package/dist/internal.js +25 -0
- package/dist/loaf.d.ts +15 -0
- package/dist/loaf.js +27 -0
- package/dist/options.d.ts +84 -0
- package/dist/options.js +1 -0
- package/dist/pending-spans.d.ts +29 -0
- package/dist/pending-spans.js +92 -0
- package/dist/query.d.ts +2 -0
- package/dist/query.js +19 -0
- package/dist/resources/collector.d.ts +76 -0
- package/dist/resources/collector.js +270 -0
- package/dist/resources/server-timing.d.ts +18 -0
- package/dist/resources/server-timing.js +21 -0
- package/dist/retention/buffer.d.ts +29 -0
- package/dist/retention/buffer.js +130 -0
- package/dist/retention/exporters.d.ts +71 -0
- package/dist/retention/exporters.js +281 -0
- package/dist/retention/sessions.d.ts +4 -0
- package/dist/retention/sessions.js +30 -0
- package/dist/session/local-store.d.ts +25 -0
- package/dist/session/local-store.js +91 -0
- package/dist/session/manager.d.ts +36 -0
- package/dist/session/manager.js +169 -0
- package/dist/session/sampling.d.ts +4 -0
- package/dist/session/sampling.js +20 -0
- package/dist/session/state.d.ts +4 -0
- package/dist/session/state.js +28 -0
- package/dist/settings.d.ts +8 -0
- package/dist/settings.js +36 -0
- package/dist/setup.d.ts +42 -0
- package/dist/setup.js +57 -0
- package/dist/span-processor.d.ts +38 -0
- package/dist/span-processor.js +125 -0
- package/dist/summary/accumulator.d.ts +30 -0
- package/dist/summary/accumulator.js +128 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/dist/views/collector.d.ts +40 -0
- package/dist/views/collector.js +286 -0
- package/dist/views/history.d.ts +18 -0
- package/dist/views/history.js +42 -0
- package/dist/views/naming.d.ts +6 -0
- package/dist/views/naming.js +12 -0
- package/dist/views/paint.d.ts +12 -0
- package/dist/views/paint.js +15 -0
- package/dist/views/tracker.d.ts +37 -0
- package/dist/views/tracker.js +114 -0
- package/dist/vitals/attribution.d.ts +14 -0
- package/dist/vitals/attribution.js +60 -0
- package/dist/vitals/collector.d.ts +24 -0
- package/dist/vitals/collector.js +232 -0
- package/dist/vitals/lcp.d.ts +32 -0
- package/dist/vitals/lcp.js +49 -0
- package/dist/webext/chrome.d.ts +45 -0
- package/dist/webext/chrome.js +13 -0
- package/dist/webext/config-storage.d.ts +18 -0
- package/dist/webext/config-storage.js +98 -0
- package/dist/webext/scope.d.ts +22 -0
- package/dist/webext/scope.js +50 -0
- package/dist/webext/session-access.d.ts +13 -0
- package/dist/webext/session-access.js +9 -0
- package/dist/webext/session-store.d.ts +5 -0
- package/dist/webext/session-store.js +104 -0
- package/dist/webext/setup.d.ts +74 -0
- package/dist/webext/setup.js +206 -0
- package/dist/webext.d.ts +10 -0
- package/dist/webext.js +8 -0
- package/dist/wire.d.ts +13 -0
- package/dist/wire.js +30 -0
- package/package.json +60 -4
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The remote configuration cache in an extension: chrome.storage.local, shared by every context of
|
|
3
|
+
* the extension and never the host page's localStorage. Remote configuration reads its cache
|
|
4
|
+
* synchronously, so this reads the stored values once, keeps them in memory and follows other
|
|
5
|
+
* contexts' writes through storage.onChanged. Writes go to memory at once and to storage after,
|
|
6
|
+
* and flush resolves once they reached storage. An update (a pin) reads the stored value afresh
|
|
7
|
+
* under navigator.locks where the context runs on the extension's origin, serialized across
|
|
8
|
+
* extension-origin contexts, so contexts pinning at once keep every pin in order. A content script's
|
|
9
|
+
* navigator.locks is the host page's, so it updates without a lock. A removal runs under the same
|
|
10
|
+
* lock, and an update begun before it writes nothing.
|
|
11
|
+
*/
|
|
12
|
+
import { diag } from "@opentelemetry/api";
|
|
13
|
+
import { CONFIG_PINNED_STORAGE_KEY, CONFIG_STORAGE_KEY } from "../config/remote.js";
|
|
14
|
+
const KEYS = [CONFIG_STORAGE_KEY, CONFIG_PINNED_STORAGE_KEY];
|
|
15
|
+
function isExtensionOrigin(chrome) {
|
|
16
|
+
const base = chrome.runtime.getURL?.("");
|
|
17
|
+
const href = globalThis.location?.href;
|
|
18
|
+
if (base === undefined || base === "" || href === undefined)
|
|
19
|
+
return false;
|
|
20
|
+
try {
|
|
21
|
+
const page = new URL(href);
|
|
22
|
+
const ext = new URL(base);
|
|
23
|
+
return page.protocol === ext.protocol && ext.host !== "" && page.host === ext.host;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A cache over chrome.storage.local once the stored values are read, or undefined without the area.
|
|
31
|
+
* locks null updates without a lock. Never rejects.
|
|
32
|
+
*/
|
|
33
|
+
export async function chromeConfigStorage(chrome, locks = isExtensionOrigin(chrome)
|
|
34
|
+
? globalThis.navigator?.locks
|
|
35
|
+
: undefined) {
|
|
36
|
+
const area = chrome.storage?.local;
|
|
37
|
+
if (area === undefined)
|
|
38
|
+
return undefined;
|
|
39
|
+
const values = new Map();
|
|
40
|
+
const keep = (key, v) => {
|
|
41
|
+
if (typeof v === "string")
|
|
42
|
+
values.set(key, v);
|
|
43
|
+
else
|
|
44
|
+
values.delete(key);
|
|
45
|
+
};
|
|
46
|
+
const failed = (err) => diag.debug("o11y: rum: the remote configuration cache failed", err);
|
|
47
|
+
for (const key of KEYS)
|
|
48
|
+
keep(key, (await area.get(key).catch(failed))?.[key]);
|
|
49
|
+
const onChanged = (changes, areaName) => {
|
|
50
|
+
if (areaName === "local")
|
|
51
|
+
for (const key of KEYS)
|
|
52
|
+
if (key in changes)
|
|
53
|
+
keep(key, changes[key]?.newValue);
|
|
54
|
+
};
|
|
55
|
+
chrome.storage?.onChanged.addListener(onChanged);
|
|
56
|
+
/** Writes not yet in storage. */
|
|
57
|
+
const writes = new Set();
|
|
58
|
+
const track = (write) => {
|
|
59
|
+
const done = write.catch(failed).then(() => {
|
|
60
|
+
writes.delete(done);
|
|
61
|
+
});
|
|
62
|
+
writes.add(done);
|
|
63
|
+
};
|
|
64
|
+
const set = (key, value) => {
|
|
65
|
+
values.set(key, value);
|
|
66
|
+
return area.set({ [key]: value });
|
|
67
|
+
};
|
|
68
|
+
const locked = (key, run) => track(locks?.request(key, run) ?? run());
|
|
69
|
+
/** Bumped by each removal, so an update begun before it writes nothing. */
|
|
70
|
+
let removals = 0;
|
|
71
|
+
return {
|
|
72
|
+
getItem: (key) => values.get(key) ?? null,
|
|
73
|
+
setItem: (key, value) => track(set(key, value)),
|
|
74
|
+
removeItem(key) {
|
|
75
|
+
removals++;
|
|
76
|
+
keep(key, undefined);
|
|
77
|
+
locked(key, () => area.remove(key));
|
|
78
|
+
},
|
|
79
|
+
updateItem(key, fn) {
|
|
80
|
+
const gen = removals;
|
|
81
|
+
locked(key, async () => {
|
|
82
|
+
if (gen !== removals)
|
|
83
|
+
return;
|
|
84
|
+
const stored = (await area.get(key))[key];
|
|
85
|
+
// Removed since the update began, before or while it waited on the lock or the read.
|
|
86
|
+
if (gen !== removals)
|
|
87
|
+
return;
|
|
88
|
+
keep(key, stored);
|
|
89
|
+
await set(key, fn(values.get(key) ?? null));
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
async flush() {
|
|
93
|
+
await Promise.all([...writes]);
|
|
94
|
+
},
|
|
95
|
+
/** Stops following other contexts' writes. */
|
|
96
|
+
close: () => chrome.storage?.onChanged.removeListener(onChanged),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The content script rules. A content script shares the host page's document, so
|
|
3
|
+
* RUM there records only what is the extension's own: actions inside the extension's UI root,
|
|
4
|
+
* errors from the extension's own scripts, and one fixed view whose span names the host only by
|
|
5
|
+
* url.domain.
|
|
6
|
+
*/
|
|
7
|
+
import type { RumScope } from "../contracts/runtime.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Where an error event came from: a failed element's resource URL, a CSP violation's source file,
|
|
10
|
+
* an uncaught error's filename (else its stack's first frame), or a rejection reason's first frame.
|
|
11
|
+
*/
|
|
12
|
+
export declare function errorSourceUrl(e: Event): string | undefined;
|
|
13
|
+
export interface ContentScopeOptions {
|
|
14
|
+
/** The extension's base URL, chrome.runtime.getURL(""). */
|
|
15
|
+
readonly base: string;
|
|
16
|
+
/** The extension's own UI in the page. Without it, no actions. */
|
|
17
|
+
readonly uiRoot?: Node;
|
|
18
|
+
/** The host page's host name, for url.domain. */
|
|
19
|
+
readonly host: string;
|
|
20
|
+
}
|
|
21
|
+
/** The RumScope of a content script. */
|
|
22
|
+
export declare function contentScope(o: ContentScopeOptions): RumScope;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** An extension or web URL. */
|
|
2
|
+
const URL_IN = /\b(?:(?:chrome|moz|safari-web)-extension|https?|file):\/\/[^\s)'"]+/;
|
|
3
|
+
/** A stack frame line: V8's " at ..." or Firefox and Safari's "name@url". */
|
|
4
|
+
const FRAME_LINE = /^\s+at\s|^[^\s@]*@/;
|
|
5
|
+
/** The URL of the first frame of a stack trace, skipping the message lines above the frames. */
|
|
6
|
+
function firstFrame(stack) {
|
|
7
|
+
if (typeof stack !== "string")
|
|
8
|
+
return undefined;
|
|
9
|
+
for (const line of stack.split("\n")) {
|
|
10
|
+
if (FRAME_LINE.test(line))
|
|
11
|
+
return URL_IN.exec(line)?.[0];
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
function stackOf(v) {
|
|
16
|
+
return typeof v === "object" && v !== null ? v.stack : undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Where an error event came from: a failed element's resource URL, a CSP violation's source file,
|
|
20
|
+
* an uncaught error's filename (else its stack's first frame), or a rejection reason's first frame.
|
|
21
|
+
*/
|
|
22
|
+
export function errorSourceUrl(e) {
|
|
23
|
+
const target = e.target;
|
|
24
|
+
if (e.type === "error" && typeof target?.tagName === "string") {
|
|
25
|
+
for (const v of [target.currentSrc, target.src, target.href])
|
|
26
|
+
if (typeof v === "string" && v !== "")
|
|
27
|
+
return v;
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (e.type === "securitypolicyviolation") {
|
|
31
|
+
const file = e.sourceFile;
|
|
32
|
+
return typeof file === "string" && file !== "" ? file : undefined;
|
|
33
|
+
}
|
|
34
|
+
if (e.type === "unhandledrejection")
|
|
35
|
+
return firstFrame(stackOf(e.reason));
|
|
36
|
+
const ev = e;
|
|
37
|
+
if (typeof ev.filename === "string" && ev.filename !== "")
|
|
38
|
+
return ev.filename;
|
|
39
|
+
return firstFrame(stackOf(ev.error));
|
|
40
|
+
}
|
|
41
|
+
/** The RumScope of a content script. */
|
|
42
|
+
export function contentScope(o) {
|
|
43
|
+
const root = o.uiRoot;
|
|
44
|
+
return {
|
|
45
|
+
action: (e) => root !== undefined && typeof e.composedPath === "function" && e.composedPath().includes(root),
|
|
46
|
+
error: (e) => errorSourceUrl(e)?.startsWith(o.base) === true,
|
|
47
|
+
fixedView: true,
|
|
48
|
+
...(o.host === "" ? {} : { viewAttributes: { "url.domain": o.host } }),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opening the extension's session area to content scripts. A module of its own, which imports
|
|
3
|
+
* nothing, so the @libo11y/rum/webext entry reaches it before the extension setup and the bundle
|
|
4
|
+
* keeps its module order.
|
|
5
|
+
*/
|
|
6
|
+
import type { ChromeSessionStorageLike } from "./chrome.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Lets content scripts read and write chrome.storage.session, so they share the extension's RUM
|
|
9
|
+
* session. Call it in the service worker on every wake. It opens the whole session area to content
|
|
10
|
+
* scripts, so keep nothing there that the pages a content script runs on must not reach. Resolves
|
|
11
|
+
* where the browser has no setAccessLevel.
|
|
12
|
+
*/
|
|
13
|
+
export declare function allowRumSessionInContentScripts(chrome: ChromeSessionStorageLike): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lets content scripts read and write chrome.storage.session, so they share the extension's RUM
|
|
3
|
+
* session. Call it in the service worker on every wake. It opens the whole session area to content
|
|
4
|
+
* scripts, so keep nothing there that the pages a content script runs on must not reach. Resolves
|
|
5
|
+
* where the browser has no setAccessLevel.
|
|
6
|
+
*/
|
|
7
|
+
export async function allowRumSessionInContentScripts(chrome) {
|
|
8
|
+
await chrome.storage?.session?.setAccessLevel?.({ accessLevel: "TRUSTED_AND_UNTRUSTED_CONTEXTS" });
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SessionStore } from "../contracts/session.ts";
|
|
2
|
+
import type { ChromeSessionStorageLike } from "./chrome.ts";
|
|
3
|
+
export { allowRumSessionInContentScripts } from "./session-access.ts";
|
|
4
|
+
/** The extension SessionStore. Storage is reached on first use, which the session manager makes only after consent. */
|
|
5
|
+
export declare function chromeSessionStore(chrome: ChromeSessionStorageLike): SessionStore;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The extension session store: the session record in chrome.storage.session, which
|
|
3
|
+
* every context of the extension shares and the browser clears when it closes, and
|
|
4
|
+
* storage.onChanged, which tells the other contexts of a save. Records are the web store's version
|
|
5
|
+
* 1 JSON plus w, a token naming the store that wrote it, so a store ignores its own saves when the
|
|
6
|
+
* change event comes back to it.
|
|
7
|
+
*
|
|
8
|
+
* Content scripts reach chrome.storage.session only once the service worker opened it to them
|
|
9
|
+
* (allowRumSessionInContentScripts). Until then each content script's store only keeps its session
|
|
10
|
+
* in memory, so it starts sessions of its own.
|
|
11
|
+
*/
|
|
12
|
+
import { diag } from "@opentelemetry/api";
|
|
13
|
+
import { randomUuid } from "../ids.js";
|
|
14
|
+
import { parseSessionState, SESSION_STORAGE_KEY } from "../session/local-store.js";
|
|
15
|
+
export { allowRumSessionInContentScripts } from "./session-access.js";
|
|
16
|
+
/** The extension SessionStore. Storage is reached on first use, which the session manager makes only after consent. */
|
|
17
|
+
export function chromeSessionStore(chrome) {
|
|
18
|
+
const token = randomUuid();
|
|
19
|
+
const area = chrome.storage?.session;
|
|
20
|
+
const listeners = new Set();
|
|
21
|
+
let warned = false;
|
|
22
|
+
const failed = (what, err) => {
|
|
23
|
+
if (warned) {
|
|
24
|
+
diag.debug(`o11y: rum: chrome.storage.session ${what} failed`, err);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
warned = true;
|
|
28
|
+
diag.warn(`o11y: rum: chrome.storage.session ${what} failed; in a content script, call allowRumSessionInContentScripts in the worker`, err);
|
|
29
|
+
};
|
|
30
|
+
const onChanged = (changes, areaName) => {
|
|
31
|
+
if (areaName !== "session" || !(SESSION_STORAGE_KEY in changes))
|
|
32
|
+
return;
|
|
33
|
+
const next = changes[SESSION_STORAGE_KEY]?.newValue;
|
|
34
|
+
if (next === undefined) {
|
|
35
|
+
for (const l of listeners)
|
|
36
|
+
l(undefined);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (next?.w === token)
|
|
40
|
+
return; // this store's own save
|
|
41
|
+
const s = parseSessionState(next);
|
|
42
|
+
if (s === undefined)
|
|
43
|
+
return;
|
|
44
|
+
for (const l of listeners)
|
|
45
|
+
l(s);
|
|
46
|
+
};
|
|
47
|
+
/** Saves not yet in storage. */
|
|
48
|
+
const writes = new Set();
|
|
49
|
+
let listening = false;
|
|
50
|
+
const listen = () => {
|
|
51
|
+
if (listening)
|
|
52
|
+
return;
|
|
53
|
+
listening = true;
|
|
54
|
+
chrome.storage?.onChanged.addListener(onChanged);
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
async load() {
|
|
58
|
+
listen();
|
|
59
|
+
if (area === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
try {
|
|
62
|
+
const items = await area.get(SESSION_STORAGE_KEY);
|
|
63
|
+
return parseSessionState(items[SESSION_STORAGE_KEY]);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
failed("read", err);
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
save(state) {
|
|
71
|
+
listen();
|
|
72
|
+
if (area === undefined)
|
|
73
|
+
return;
|
|
74
|
+
try {
|
|
75
|
+
const write = state === undefined
|
|
76
|
+
? area.remove(SESSION_STORAGE_KEY)
|
|
77
|
+
: area.set({ [SESSION_STORAGE_KEY]: { v: 1, ...state, w: token } });
|
|
78
|
+
const done = write
|
|
79
|
+
.catch((err) => failed("write", err))
|
|
80
|
+
.then(() => {
|
|
81
|
+
writes.delete(done);
|
|
82
|
+
});
|
|
83
|
+
writes.add(done);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
failed("write", err);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
async flush() {
|
|
90
|
+
await Promise.all([...writes]);
|
|
91
|
+
},
|
|
92
|
+
onChange(listener) {
|
|
93
|
+
listen();
|
|
94
|
+
listeners.add(listener);
|
|
95
|
+
return () => listeners.delete(listener);
|
|
96
|
+
},
|
|
97
|
+
close() {
|
|
98
|
+
if (listening)
|
|
99
|
+
chrome.storage?.onChanged.removeListener(onChanged);
|
|
100
|
+
listening = false;
|
|
101
|
+
listeners.clear();
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ContentScriptSetupOptions, ContentScriptTelemetry, WorkerSetupOptions, WorkerTelemetry } from "@libo11y/webext";
|
|
2
|
+
import { type ContentDeps, type WorkerDeps } from "@libo11y/webext/internal";
|
|
3
|
+
import { type WebRumBind } from "../bind.ts";
|
|
4
|
+
import type { Rum, RumOptions } from "../options.ts";
|
|
5
|
+
import { type RumDeps } from "../setup.ts";
|
|
6
|
+
import { type RumChromeLike } from "./chrome.ts";
|
|
7
|
+
/** The name of a content script's view when content.viewName does not give one. */
|
|
8
|
+
export declare const CONTENT_VIEW_NAME = "content-script";
|
|
9
|
+
/** Options for setupRumExtension: the content script setup options of `@libo11y/webext` and RUM's own. */
|
|
10
|
+
export interface RumExtensionOptions extends ContentScriptSetupOptions {
|
|
11
|
+
/** "page" for popups, options pages and side panels; "content" for content scripts. */
|
|
12
|
+
readonly context: "page" | "content";
|
|
13
|
+
/**
|
|
14
|
+
* RUM's options. Remote configuration needs an absolute URL here. In a content script viewName is
|
|
15
|
+
* replaced by the fixed view name, and vitals(), resources() and long animation frames are refused.
|
|
16
|
+
*/
|
|
17
|
+
readonly rum?: RumOptions;
|
|
18
|
+
/** Content scripts only. */
|
|
19
|
+
readonly content?: {
|
|
20
|
+
/** The extension's own UI in the page, such as its shadow host. Actions are recorded only inside it; without it, none. */
|
|
21
|
+
readonly uiRoot?: Node;
|
|
22
|
+
/** The name of the content script's one view. Default "content-script". */
|
|
23
|
+
readonly viewName?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** An extension page's or content script's telemetry with RUM. Its records go to the worker. */
|
|
27
|
+
export interface RumExtensionTelemetry extends ContentScriptTelemetry {
|
|
28
|
+
readonly rum: Rum;
|
|
29
|
+
}
|
|
30
|
+
/** What setupRumExtensionWith builds on. Internal: tests replace any of it. */
|
|
31
|
+
export interface RumExtensionDeps {
|
|
32
|
+
readonly chrome: RumChromeLike | undefined;
|
|
33
|
+
readonly content: ContentDeps;
|
|
34
|
+
/** RUM's dependencies. The platform, binding, session store and cache storage are replaced, and in a content script the retention queue. */
|
|
35
|
+
readonly rum: Omit<RumDeps, "web" | "sessionStore"> & {
|
|
36
|
+
readonly web?: RumDeps["web"];
|
|
37
|
+
readonly sessionStore?: RumDeps["sessionStore"];
|
|
38
|
+
};
|
|
39
|
+
/** Install the telemetry globally. Default true. */
|
|
40
|
+
readonly install?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** The real dependencies of this context. */
|
|
43
|
+
export declare function defaultRumExtensionDeps(): RumExtensionDeps;
|
|
44
|
+
/** The binding of extension contexts: @libo11y/webext's setupContentScriptWith with RUM's wrappers. */
|
|
45
|
+
export declare function contentBinding(content: ContentDeps, install: boolean): WebRumBind;
|
|
46
|
+
/** Builds telemetry with RUM for an extension page or content script and installs it globally. */
|
|
47
|
+
export declare function setupRumExtension(options: RumExtensionOptions): Promise<RumExtensionTelemetry>;
|
|
48
|
+
/** setupRumExtension over deps. Internal: the seam the unit tests use. */
|
|
49
|
+
export declare function setupRumExtensionWith(options: RumExtensionOptions, deps: RumExtensionDeps): Promise<RumExtensionTelemetry>;
|
|
50
|
+
/** Options for setupRumWorker: the worker setup options of `@libo11y/webext` and the gateway's client token. */
|
|
51
|
+
export interface RumWorkerSetupOptions extends WorkerSetupOptions {
|
|
52
|
+
readonly rum?: {
|
|
53
|
+
/** The app's public client token for the RUM gateway, sent with sent_at on every request. */
|
|
54
|
+
readonly clientToken?: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** What setupRumWorkerWith builds on. Internal: tests replace any of it. */
|
|
58
|
+
export interface RumWorkerDeps {
|
|
59
|
+
readonly worker: WorkerDeps;
|
|
60
|
+
/** The fetch the transport posts with. Default the transport's own. */
|
|
61
|
+
readonly fetch?: typeof fetch;
|
|
62
|
+
/** Epoch milliseconds, for sent_at. Default Date.now. */
|
|
63
|
+
readonly now?: () => number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Builds the service worker's telemetry for an extension that runs RUM: setupWorker from
|
|
67
|
+
* `@libo11y/webext`, posting to the RUM gateway with the wire parameters sent_at and client_token
|
|
68
|
+
* and app metrics in delta temporality, and allowRumSessionInContentScripts, so content scripts
|
|
69
|
+
* share the extension's session. Call it at the top level of the worker on every wake, as
|
|
70
|
+
* setupWorker.
|
|
71
|
+
*/
|
|
72
|
+
export declare function setupRumWorker(options?: RumWorkerSetupOptions): Promise<WorkerTelemetry>;
|
|
73
|
+
/** setupRumWorker over deps. Internal: the seam the unit tests use. */
|
|
74
|
+
export declare function setupRumWorkerWith(options: RumWorkerSetupOptions, deps: RumWorkerDeps): Promise<WorkerTelemetry>;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RUM in Manifest V3 extensions. setupRumExtension runs in extension pages (popups,
|
|
3
|
+
* options pages, side panels) and content scripts; setupRumWorker runs in the service worker.
|
|
4
|
+
*
|
|
5
|
+
* Both contexts of setupRumExtension bind through @libo11y/webext's content script setup, so their
|
|
6
|
+
* records go to the worker by runtime messaging and the worker sends them. Their platform is
|
|
7
|
+
* webext, and they share one session through chrome.storage.session (chromeSessionStore), which a
|
|
8
|
+
* content script reaches once the worker called allowRumSessionInContentScripts (setupRumWorker
|
|
9
|
+
* does). Remote configuration is cached in chrome.storage.local, never in a page's localStorage,
|
|
10
|
+
* and needs an absolute URL, because an extension context has no gateway origin of its own.
|
|
11
|
+
*
|
|
12
|
+
* An extension page behaves as setupRum does, with its retention buffer in IndexedDB at the
|
|
13
|
+
* extension's origin. A content script shares the host page's document, so it records only what is
|
|
14
|
+
* the extension's own:
|
|
15
|
+
* - one view, named content.viewName or "content-script", never named from the URL, starting when
|
|
16
|
+
* RUM starts and on screen at once. Its span carries the host page's url.domain and no other URL;
|
|
17
|
+
* - actions only on events whose composed path holds content.uiRoot, and none without it;
|
|
18
|
+
* - errors only from the extension's own scripts (errorSourceUrl starts with getURL(""));
|
|
19
|
+
* - no vitals(), resources() or long animation frames, which would measure the host page, and no
|
|
20
|
+
* documentLoad span: each is refused with O11yError INVALID_OPTION;
|
|
21
|
+
* - a retention buffer in memory, because its IndexedDB is the host page's.
|
|
22
|
+
*/
|
|
23
|
+
import { O11yError } from "@libo11y/core";
|
|
24
|
+
import { browserEnv, createExporterSet, createMemoryQueue } from "@libo11y/web/internal";
|
|
25
|
+
import { defaultContentDeps, defaultWorkerDeps, setupContentScriptWith, setupWorkerWith, } from "@libo11y/webext/internal";
|
|
26
|
+
import { diag } from "@opentelemetry/api";
|
|
27
|
+
import { webLifecycle } from "../bind.js";
|
|
28
|
+
import { takeBootstrap } from "../bootstrap/buffer.js";
|
|
29
|
+
import { replayBootstrap } from "../bootstrap/replay.js";
|
|
30
|
+
import { setupRumCore } from "../core-setup.js";
|
|
31
|
+
import { defaultBrowserRumDeps } from "../setup.js";
|
|
32
|
+
import { gatewayTransportOptions } from "../wire.js";
|
|
33
|
+
import { getRumChrome } from "./chrome.js";
|
|
34
|
+
import { chromeConfigStorage } from "./config-storage.js";
|
|
35
|
+
import { contentScope } from "./scope.js";
|
|
36
|
+
import { allowRumSessionInContentScripts, chromeSessionStore } from "./session-store.js";
|
|
37
|
+
/** The name of a content script's view when content.viewName does not give one. */
|
|
38
|
+
export const CONTENT_VIEW_NAME = "content-script";
|
|
39
|
+
/** Collectors that would measure the host page, refused in a content script. */
|
|
40
|
+
const HOST_PAGE_COLLECTORS = new Set([
|
|
41
|
+
"vitals",
|
|
42
|
+
"resources",
|
|
43
|
+
"long_animation_frames",
|
|
44
|
+
]);
|
|
45
|
+
/** The real dependencies of this context. */
|
|
46
|
+
export function defaultRumExtensionDeps() {
|
|
47
|
+
return { chrome: getRumChrome(), content: defaultContentDeps(), rum: defaultBrowserRumDeps() };
|
|
48
|
+
}
|
|
49
|
+
/** The binding of extension contexts: @libo11y/webext's setupContentScriptWith with RUM's wrappers. */
|
|
50
|
+
export function contentBinding(content, install) {
|
|
51
|
+
return (options, w) => setupContentScriptWith(options, {
|
|
52
|
+
...content,
|
|
53
|
+
createConsentController: (o) => w.consentController(content.createConsentController(o)),
|
|
54
|
+
webPlatform: (po) => {
|
|
55
|
+
w.platform(po, browserEnv(options, po.endpoints));
|
|
56
|
+
const platform = content.webPlatform(po);
|
|
57
|
+
return {
|
|
58
|
+
...platform,
|
|
59
|
+
// Logs are routed by session; app metrics export with delta temporality for the gateway,
|
|
60
|
+
// behind the consent boundary.
|
|
61
|
+
buildExporters: (req) => w.exporterSet(createExporterSet(req, po.delivery, po.endpoints, {
|
|
62
|
+
...(po.mode === undefined ? {} : { mode: po.mode }),
|
|
63
|
+
metricTemporality: "delta",
|
|
64
|
+
gate: po.gate,
|
|
65
|
+
})),
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
installFetchInstrumentation: (o) => content.installFetchInstrumentation({ ...o, onStart: w.onRequestStart }),
|
|
69
|
+
installXhrInstrumentation: (o) => content.installXhrInstrumentation({ ...o, onStart: w.onRequestStart }),
|
|
70
|
+
}, install);
|
|
71
|
+
}
|
|
72
|
+
function hostOf(url) {
|
|
73
|
+
try {
|
|
74
|
+
return new URL(url).hostname;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function absolute(url) {
|
|
81
|
+
try {
|
|
82
|
+
return /^https?:$/.test(new URL(url).protocol);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Builds telemetry with RUM for an extension page or content script and installs it globally. */
|
|
89
|
+
export function setupRumExtension(options) {
|
|
90
|
+
return setupRumExtensionWith(options, defaultRumExtensionDeps());
|
|
91
|
+
}
|
|
92
|
+
/** setupRumExtension over deps. Internal: the seam the unit tests use. */
|
|
93
|
+
export async function setupRumExtensionWith(options, deps) {
|
|
94
|
+
const { context, rum, content, ...base } = options;
|
|
95
|
+
const chrome = deps.chrome;
|
|
96
|
+
if (chrome === undefined) {
|
|
97
|
+
throw new Error("o11y: setupRumExtension needs the extension API (chrome.runtime)");
|
|
98
|
+
}
|
|
99
|
+
const inContent = context === "content";
|
|
100
|
+
if (inContent) {
|
|
101
|
+
for (const c of rum?.collectors ?? []) {
|
|
102
|
+
if (HOST_PAGE_COLLECTORS.has(c.name)) {
|
|
103
|
+
throw new O11yError("INVALID_OPTION", `rum: a content script cannot run ${c.name}, which would measure the host page`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (base.instrumentations?.documentLoad === true) {
|
|
107
|
+
throw new O11yError("INVALID_OPTION", "rum: a content script records no documentLoad, the host page's load");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const configAt = rum?.remoteConfig?.url;
|
|
111
|
+
if (rum?.remoteConfig !== undefined && (configAt === undefined || !absolute(configAt))) {
|
|
112
|
+
throw new O11yError("INVALID_OPTION", "rum.remoteConfig needs an absolute http(s) url in an extension");
|
|
113
|
+
}
|
|
114
|
+
let cache;
|
|
115
|
+
let shutDown = false;
|
|
116
|
+
const extensionBase = chrome.runtime.getURL?.("") ?? `chrome-extension://${chrome.runtime.id}/`;
|
|
117
|
+
const viewName = content?.viewName ?? CONTENT_VIEW_NAME;
|
|
118
|
+
const rumOptions = inContent ? { ...rum, viewName: () => viewName } : rum;
|
|
119
|
+
const t = await setupRumCore({
|
|
120
|
+
...base,
|
|
121
|
+
...(inContent ? { instrumentations: { ...base.instrumentations, documentLoad: false } } : {}),
|
|
122
|
+
}, rumOptions, {
|
|
123
|
+
...deps.rum,
|
|
124
|
+
platform: "webext",
|
|
125
|
+
bind: contentBinding(deps.content, deps.install !== false),
|
|
126
|
+
lifecycle: deps.rum.lifecycle ?? webLifecycle(deps.rum.document, deps.rum.window),
|
|
127
|
+
sessionStore: () => chromeSessionStore(chrome),
|
|
128
|
+
storage: async () => {
|
|
129
|
+
// A content script's navigator.locks is the host page's, so it updates without a lock.
|
|
130
|
+
const opened = cache ?? (await chromeConfigStorage(chrome, inContent ? null : undefined));
|
|
131
|
+
// A cache that finished loading after shutdown stops listening at once.
|
|
132
|
+
if (shutDown)
|
|
133
|
+
opened?.close();
|
|
134
|
+
else
|
|
135
|
+
cache = opened;
|
|
136
|
+
return opened;
|
|
137
|
+
},
|
|
138
|
+
bootstrap: () => {
|
|
139
|
+
const early = takeBootstrap();
|
|
140
|
+
return (runtime) => replayBootstrap(runtime, early);
|
|
141
|
+
},
|
|
142
|
+
...(inContent
|
|
143
|
+
? {
|
|
144
|
+
openRetentionQueue: async (o) => createMemoryQueue(o),
|
|
145
|
+
prerendered: () => false,
|
|
146
|
+
scope: contentScope({
|
|
147
|
+
base: extensionBase,
|
|
148
|
+
host: hostOf(deps.rum.location()),
|
|
149
|
+
...(content?.uiRoot === undefined ? {} : { uiRoot: content.uiRoot }),
|
|
150
|
+
}),
|
|
151
|
+
}
|
|
152
|
+
: {}),
|
|
153
|
+
});
|
|
154
|
+
const handle = t;
|
|
155
|
+
const rumShutdown = handle.shutdown.bind(handle);
|
|
156
|
+
let shutdownPromise;
|
|
157
|
+
handle.shutdown = (opts) => (shutdownPromise ??= (async () => {
|
|
158
|
+
shutDown = true;
|
|
159
|
+
const report = await rumShutdown(opts);
|
|
160
|
+
cache?.close();
|
|
161
|
+
return report;
|
|
162
|
+
})());
|
|
163
|
+
return handle;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Builds the service worker's telemetry for an extension that runs RUM: setupWorker from
|
|
167
|
+
* `@libo11y/webext`, posting to the RUM gateway with the wire parameters sent_at and client_token
|
|
168
|
+
* and app metrics in delta temporality, and allowRumSessionInContentScripts, so content scripts
|
|
169
|
+
* share the extension's session. Call it at the top level of the worker on every wake, as
|
|
170
|
+
* setupWorker.
|
|
171
|
+
*/
|
|
172
|
+
export function setupRumWorker(options = {}) {
|
|
173
|
+
return setupRumWorkerWith(options, { worker: defaultWorkerDeps() });
|
|
174
|
+
}
|
|
175
|
+
/** setupRumWorker over deps. Internal: the seam the unit tests use. */
|
|
176
|
+
export async function setupRumWorkerWith(options, deps) {
|
|
177
|
+
const { rum, ...workerOptions } = options;
|
|
178
|
+
const token = rum?.clientToken;
|
|
179
|
+
if (token !== undefined && (typeof token !== "string" || token === "")) {
|
|
180
|
+
throw new O11yError("INVALID_OPTION", "rum.clientToken must be a non-empty string");
|
|
181
|
+
}
|
|
182
|
+
const w = deps.worker;
|
|
183
|
+
// Started before setupWorker awaits anything, so a content script that wakes the worker finds
|
|
184
|
+
// the session open as soon as it can.
|
|
185
|
+
const access = w.chrome === undefined
|
|
186
|
+
? Promise.resolve()
|
|
187
|
+
: allowRumSessionInContentScripts(w.chrome).catch((err) => diag.warn("o11y: rum: could not open chrome.storage.session to content scripts", err));
|
|
188
|
+
const t = await setupWorkerWith(workerOptions, {
|
|
189
|
+
...w,
|
|
190
|
+
createHttpTransport: (o) => w.createHttpTransport(gatewayTransportOptions(deps.fetch === undefined ? o : { ...o, fetch: deps.fetch }, token, deps.now ?? Date.now)),
|
|
191
|
+
webPlatform: (po) => {
|
|
192
|
+
const platform = w.webPlatform(po);
|
|
193
|
+
return {
|
|
194
|
+
...platform,
|
|
195
|
+
buildExporters: (req) => createExporterSet(req, po.delivery, po.endpoints, {
|
|
196
|
+
...(po.mode === undefined ? {} : { mode: po.mode }),
|
|
197
|
+
metricTemporality: "delta",
|
|
198
|
+
// The consent boundary: nothing measured before a revoke is exported after it.
|
|
199
|
+
gate: po.gate,
|
|
200
|
+
}),
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
await access;
|
|
205
|
+
return t;
|
|
206
|
+
}
|
package/dist/webext.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @libo11y/rum/webext: RUM in Manifest V3 extensions. setupRumExtension for extension pages and
|
|
3
|
+
* content scripts, setupRumWorker for the service worker that sends their records, and
|
|
4
|
+
* allowRumSessionInContentScripts for a worker set up with @libo11y/webext's setupWorker directly.
|
|
5
|
+
* The collectors come from @libo11y/rum; the types its options and handle name are re-exported here.
|
|
6
|
+
*/
|
|
7
|
+
export type { AddErrorOptions, BootstrapEntry, CollectorName, EventBody, RemoteConfig, RemoteConfigClient, RemoteConfigConnection, RemoteConfigDocument, RemoteConfigOpenOptions, RemoteConfigStorage, RemoteConfigTimers, RequestStartHook, Rum, RumBus, RumCollector, RumOptions, RumRuntime, RumScope, RumSettings, RumSignal, SessionDecision, SessionEvent, SessionManager, SessionState, SummaryAccumulator, SummaryCountKey, SummaryView, ViewEvent, ViewStartOptions, ViewState, ViewTracker, VitalName, } from "./index.ts";
|
|
8
|
+
export type { ChromeSessionStorageLike, RumChromeLike, StorageAreaLike, StorageChangeListener, StorageChanges, } from "./webext/chrome.ts";
|
|
9
|
+
export { allowRumSessionInContentScripts } from "./webext/session-access.ts";
|
|
10
|
+
export { CONTENT_VIEW_NAME, type RumExtensionOptions, type RumExtensionTelemetry, type RumWorkerSetupOptions, setupRumExtension, setupRumWorker, } from "./webext/setup.ts";
|
package/dist/webext.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @libo11y/rum/webext: RUM in Manifest V3 extensions. setupRumExtension for extension pages and
|
|
3
|
+
* content scripts, setupRumWorker for the service worker that sends their records, and
|
|
4
|
+
* allowRumSessionInContentScripts for a worker set up with @libo11y/webext's setupWorker directly.
|
|
5
|
+
* The collectors come from @libo11y/rum; the types its options and handle name are re-exported here.
|
|
6
|
+
*/
|
|
7
|
+
export { allowRumSessionInContentScripts } from "./webext/session-access.js";
|
|
8
|
+
export { CONTENT_VIEW_NAME, setupRumExtension, setupRumWorker, } from "./webext/setup.js";
|
package/dist/wire.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire contract with the RUM gateway: every OTLP request carries the query parameters sent_at
|
|
3
|
+
* (the client's Unix time in milliseconds at send time) and client_token (the app's public token),
|
|
4
|
+
* because sendBeacon cannot set headers. The gateway uses sent_at to correct client clock skew.
|
|
5
|
+
*/
|
|
6
|
+
import { type HttpTransportOptions } from "@libo11y/web/portable";
|
|
7
|
+
/** url with sent_at, and client_token when there is one, appended to its query. */
|
|
8
|
+
export declare function withWireParams(url: string, clientToken: string | undefined, sentAt: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* The transport options with fetch and sendBeacon wrapped, so each attempt, retries included, posts
|
|
11
|
+
* to the signal URL with the wire parameters of the moment it is sent.
|
|
12
|
+
*/
|
|
13
|
+
export declare function gatewayTransportOptions(opts: HttpTransportOptions, clientToken: string | undefined, now: () => number): HttpTransportOptions;
|
package/dist/wire.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire contract with the RUM gateway: every OTLP request carries the query parameters sent_at
|
|
3
|
+
* (the client's Unix time in milliseconds at send time) and client_token (the app's public token),
|
|
4
|
+
* because sendBeacon cannot set headers. The gateway uses sent_at to correct client clock skew.
|
|
5
|
+
*/
|
|
6
|
+
import { pristineFetch, pristineSendBeacon } from "@libo11y/web/portable";
|
|
7
|
+
/** url with sent_at, and client_token when there is one, appended to its query. */
|
|
8
|
+
export function withWireParams(url, clientToken, sentAt) {
|
|
9
|
+
const params = new URLSearchParams({ sent_at: String(sentAt) });
|
|
10
|
+
if (clientToken !== undefined)
|
|
11
|
+
params.set("client_token", clientToken);
|
|
12
|
+
return `${url}${url.includes("?") ? "&" : "?"}${params.toString()}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The transport options with fetch and sendBeacon wrapped, so each attempt, retries included, posts
|
|
16
|
+
* to the signal URL with the wire parameters of the moment it is sent.
|
|
17
|
+
*/
|
|
18
|
+
export function gatewayTransportOptions(opts, clientToken, now) {
|
|
19
|
+
const baseFetch = opts.fetch ?? pristineFetch;
|
|
20
|
+
const baseBeacon = "sendBeacon" in opts ? opts.sendBeacon : pristineSendBeacon;
|
|
21
|
+
const wrap = (url) => withWireParams(url, clientToken, now());
|
|
22
|
+
const fetchWithParams = baseFetch === undefined
|
|
23
|
+
? undefined
|
|
24
|
+
: ((input, init) => baseFetch(input instanceof Request ? input : wrap(String(input)), init));
|
|
25
|
+
return {
|
|
26
|
+
...opts,
|
|
27
|
+
...(fetchWithParams === undefined ? {} : { fetch: fetchWithParams }),
|
|
28
|
+
sendBeacon: baseBeacon === undefined ? undefined : (url, data) => baseBeacon(wrap(url), data),
|
|
29
|
+
};
|
|
30
|
+
}
|