@docx-editor.dev/telemetry 2.29.0 → 2.31.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 +5 -1
- package/dist/chunk-3O6TTDB5.cjs +2 -0
- package/dist/chunk-7SYLCJFQ.cjs +1 -0
- package/dist/chunk-AL2YERWY.cjs +1 -0
- package/dist/{chunk-RRYW7EAV.js → chunk-CLA4ASL4.js} +1 -1
- package/dist/{chunk-7ZXJ6HP2.cjs → chunk-CNSLQJPA.cjs} +1 -1
- package/dist/{chunk-U6ERFNUM.cjs → chunk-G4BK3PPE.cjs} +1 -1
- package/dist/{chunk-LFX65QJG.js → chunk-JM4KJB6O.js} +1 -1
- package/dist/chunk-L4OYI7YL.js +1 -0
- package/dist/chunk-NJ5XLQLN.js +2 -0
- package/dist/{chunk-MJX3ECH3.cjs → chunk-QDOUVRQA.cjs} +1 -1
- package/dist/chunk-RSWAOCAT.js +1 -0
- package/dist/chunk-W5HFB5EV.js +1 -0
- package/dist/hocuspocus/index.cjs +1 -1
- package/dist/hocuspocus/index.d.cts +1 -1
- package/dist/hocuspocus/index.d.ts +1 -1
- package/dist/hocuspocus/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +30 -7
- package/dist/index.d.ts +30 -7
- package/dist/index.js +1 -1
- package/dist/ingest/index.cjs +1 -1
- package/dist/ingest/index.d.cts +21 -12
- package/dist/ingest/index.d.ts +21 -12
- package/dist/ingest/index.js +1 -1
- package/dist/otel/index.cjs +1 -1
- package/dist/otel/index.d.cts +1 -1
- package/dist/otel/index.d.ts +1 -1
- package/dist/otel/index.js +1 -1
- package/dist/{pipeline-DbVW7S-K.d.cts → pipeline-CCq2Ng0B.d.cts} +6 -0
- package/dist/{pipeline-DbVW7S-K.d.ts → pipeline-CCq2Ng0B.d.ts} +6 -0
- package/dist/prometheus/index.cjs +1 -1
- package/dist/prometheus/index.d.cts +1 -1
- package/dist/prometheus/index.d.ts +1 -1
- package/dist/prometheus/index.js +1 -1
- package/dist/sentry/index.cjs +1 -1
- package/dist/sentry/index.d.cts +1 -1
- package/dist/sentry/index.d.ts +1 -1
- package/dist/sentry/index.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-73YEPWY5.js +0 -1
- package/dist/chunk-DTEVX2XS.js +0 -1
- package/dist/chunk-LFQSY2TD.cjs +0 -1
- package/dist/chunk-LGNT4I5W.cjs +0 -1
- package/dist/chunk-NUN46EXH.js +0 -2
- package/dist/chunk-S7KBMROA.js +0 -1
- package/dist/chunk-UK2MNJCG.cjs +0 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import {c,b as b$1}from'./chunk-L4OYI7YL.js';export{b as ENGINE_VERSION,a as MAX_METRIC_LABEL_VALUES}from'./chunk-L4OYI7YL.js';import {a as a$1}from'./chunk-RSWAOCAT.js';export{a as METRICS,b as prometheusName}from'./chunk-RSWAOCAT.js';export{a as callbackExporter,e as consoleExporter,d as failureCount,c as isFailure,f as memoryExporter}from'./chunk-NJ5XLQLN.js';import {c as c$1,a,b}from'./chunk-W5HFB5EV.js';import'./chunk-DT2KMPUJ.js';import {explainDiagnostic}from'@docx-editor.dev/core';export{explainDiagnostic}from'@docx-editor.dev/core';var X={documentOpen:true,documentSave:true,sessions:true,editing:true,trackedChanges:true,fonts:true,history:true,customNodes:true,collaborationClient:true,performance:true},Y=new Set(["edit.tracking-required","edit.suggesting-needs-author","edit.tracking-mode-unsupported","edit.tracking-author-required","edit.tracking-unsupported-host"]);function Z(e){switch(e.kind){case "document.open":return "documentOpen";case "document.save":return "documentSave";case "session":return "sessions";case "edit.rejected":return e.tracked||Y.has(e.code)?"trackedChanges":"editing";case "review.skipped":return "trackedChanges";case "font.failed":return "fonts";case "history":return "history";case "custom-node":return "customNodes";case "collab.status":case "collab.participants":return "collaborationClient";case "performance":return "performance";default:return null}}function J(e){return e.kind==="collab.participants"?`${e.editorSessionId}|participants`:e.kind==="edit.rejected"?[e.editorSessionId,e.code,e.cause,e.errorName,e.stage,e.origin,e.tracked,e.command].join("|"):e.kind==="font.failed"?`${e.editorSessionId}|font|${e.code}`:e.kind==="history"||e.kind==="custom-node"?`${e.editorSessionId}|${e.kind}|${e.code}`:e.kind==="collab.status"?`${e.editorSessionId}|status|${e.status}|${e.code??""}|${e.recovering}`:null}function Q(e){let t=c(e),m=e.metricLabels??[];function n(o){let r={};try{let a=typeof e.attributes=="function"?e.attributes():e.attributes;r=c$1(a??{},"attributes");}catch{}return Object.freeze({...r,...o})}function c$2(o){let r={};for(let a of m)o[a]!==void 0&&(r[a]=o[a]);return r}let f=e.include??X,l=e.dedupeWindowMs??1e4,g=o=>{try{if(e.filter&&!e.filter(o))return}catch{return}t.event(o);},E=e.documentShape==="detailed",y=new Map,S=false,k=()=>{},T=false;function D(o){let r=f[o];return r?r===true?1:Math.min(1,Math.max(0,r.sampleRate??1)):null}let h=new Map;function w(o,r,a){if(a>=1)return true;if(r!=="performance"&&r!=="sessions")return Math.random()<a;let p=`${r}|${o.editorSessionId}`,b=h.get(p);return b===void 0&&(h.size>=1e3&&h.clear(),b=Math.random()<a,h.set(p,b)),b}function M(){if(S)return;S=true;let o=globalThis;if(typeof o.addEventListener!="function")return;let r=()=>{t.setPageClosing(true),u();},a=()=>{let p=globalThis.document?.visibilityState==="hidden";t.setPageClosing(p),p&&u();};o.addEventListener("pagehide",r),o.addEventListener("visibilitychange",a),k=()=>{o.removeEventListener?.("pagehide",r),o.removeEventListener?.("visibilitychange",a);};}function v(o){let r=y.get(o);if(r){if(y.delete(o),clearTimeout(r.timer),r.latest){let a=r.event;r.latest.count!==a.count&&g(I(F(r.latest,E),t,r.event.attributes));}else if(r.repeated>0){let{connectMs:a$1,...p}=r.event;g({...p,repeated:Math.min(r.repeated,a)});}}}function i(o,r={}){if(T||!t.consented())return;let a=n(r),p=b(I(o,t,a));if("dropped"in p){t.metric(a$1.droppedEvents,1,{...c$2(a),reason:p.dropped,"docx_editor.version":b$1});return}let b$2=Z(o),A=b$2?D(b$2):null;if(A===null||b$2==="performance"&&A===0)return;M(),ee(t,p.event,c$2(a));let x=l>0?J(o):null,O=x?y.get(x):void 0;if(O){o.kind==="collab.participants"?O.latest=o:O.repeated+=1;return}let _=o.kind==="session"&&o.phase==="end";if(!w(o,b$2,A)){_&&u();return}let L=I(F(o,E),t,a);if(g(L),_&&u(),x){let R=setTimeout(()=>v(x),l);R.unref?.(),y.set(x,{event:L,repeated:0,timer:R});}}function d(o){return Object.freeze({id:"telemetry",onDiagnostic:r=>i(r,o),wantsDiagnostic:r=>!T&&(r==="session"?D("sessions")!==null:r!=="performance"||(D("performance")??0)>0&&t.consented())})}async function u(){for(let o of [...y.keys()])v(o);await t.flush();}return {module:d({}),moduleFor(o){return d(c$1(o,"moduleFor"))},record:i,flush:u,async shutdown(){for(let o of [...y.keys()])v(o);T=true,k(),await t.shutdown();}}}function F(e,t){if(t||e.kind!=="document.open"||e.outcome!=="opened"||!("shape"in e))return e;let{shape:m,...n}=e;return n}function I(e,t,m){let n="code"in e?e.code:void 0;return {...e,...n?explainDiagnostic(n):{},engineVersion:b$1,resource:t.resource,attributes:m}}function ee(e,t,m){let n={metric:(c,f,l={})=>e.metric(c,f,{...l,...m,"docx_editor.version":b$1})};switch(t.kind){case "document.open":t.outcome==="opened"?(n.metric(a$1.documentOpens,1,{outcome:"opened",code:"none",cause:"none",part:"none"}),n.metric(a$1.documentOpenDuration,t.durationMs/1e3)):n.metric(a$1.documentOpens,1,{outcome:"rejected",code:t.code,cause:t.cause??"none",part:t.part??"none"});return;case "edit.rejected":n.metric(a$1.editRejections,1,{code:t.code,cause:t.cause??"none",origin:t.origin,tracked:t.tracked});return;case "review.skipped":n.metric(a$1.reviewSkipped,t.count,{code:t.code,cause:t.cause??"none",operation:t.operation??"none",change_kind:t.changeKind??"none"});return;case "font.failed":n.metric(a$1.fontFailures,1,{code:t.code});return;case "history":n.metric(a$1.historyDiagnostics,1,{code:t.code});return;case "custom-node":n.metric(a$1.customNodeDiagnostics,1,{code:t.code});return;case "collab.status":n.metric(a$1.collabClientStatusTransitions,1,{status:t.status,code:t.code??"none"}),t.connectMs!==void 0&&n.metric(a$1.collabClientConnectDuration,t.connectMs/1e3);return;case "collab.participants":n.metric(a$1.collabClientParticipants,t.count);return;case "performance":{let c=t.pagesBucket??"unknown";N(n,a$1.editorInteractionDuration,c,t.interaction),N(n,a$1.editorLayoutDuration,c,t.layout),N(n,a$1.editorPaintDuration,c,t.paint);return}case "document.save":n.metric(a$1.documentSaves,1,{outcome:t.outcome,code:t.outcome==="rejected"?t.code:"none"}),t.outcome==="saved"&&n.metric(a$1.documentSaveDuration,t.durationMs/1e3);return;case "session":te(n,t);}}function te(e,t){if(t.phase==="start"){e.metric(a$1.editorSessions,1,{phase:"start"});return}if(t.phase==="end"){e.metric(a$1.editorSessions,1,{phase:"end"}),e.metric(a$1.editorSessionDuration,t.durationMs/1e3);return}t.activeMs>0&&e.metric(a$1.editorActiveTime,t.activeMs/1e3);for(let[m,n]of [["input",t.inputEdits],["command",t.commandEdits],["automation",t.automationEdits]])n>0&&e.metric(a$1.edits,n,{origin:m});}function N(e,t,m,n){if(!n)return;let c=t.buckets??[];n.bands.forEach((f,l)=>{let g=c[l],E=l===0?0:c[l-1],y=g===void 0?Math.max(n.maxMs/1e3,E+1e-6):(E+g)/2;for(let S=0;S<f;S+=1)e.metric(t,y,{pages:m});});}var oe=new TextEncoder,ne=e=>oe.encode(e).byteLength;function re(e){let t=Math.min(50,Math.max(1,Math.floor(e.batchSize??20))),m=e.flushIntervalMs??1e4,n=[],c,f,l=new Set,g=i=>{try{e.onError?.(i);}catch{}},E=(i,d)=>{if(typeof fetch!="function")return;let u=fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:i,keepalive:d}).then(o=>{if(!o.ok)throw new Error(`telemetry endpoint answered ${o.status}`)}).catch(g).finally(()=>l.delete(u));l.add(u);},y=i=>{let d=globalThis.navigator;if(!e.headers&&typeof d?.sendBeacon=="function")try{if(d.sendBeacon(e.url,new Blob([i],{type:"application/json"})))return}catch{}E(i,true);},S=i=>{let d=Math.min(t,n.length);for(;d>0;){let u=JSON.stringify(n.slice(0,d)),o=ne(u);if(o<=i)return {body:u,bytes:o,count:d};if(d===1)return null;d=Math.ceil(d/2);}return null},k=0,T=false,D=i=>{if(c!==void 0&&clearTimeout(c),c=void 0,f&&!f.consented()){n=[];return}(!i||!T)&&(k=0),T=i;let d=0;for(;n.length;){let u=S(61440-(i?k:0));if(!u){d+=i?n.length:1,n=i?[]:n.slice(1);continue}n=n.slice(u.count),i?(k+=u.bytes,y(u.body)):E(u.body,false);}d&&g(new Error(`telemetry dropped ${d} events that did not fit`));},h=()=>{let i=f?.pageClosing()??false;return i||(T=false),i},w=globalThis.document,M=()=>{w?.visibilityState==="visible"&&(T=false);},v=()=>w?.removeEventListener?.("visibilitychange",M);return {name:"http",attach(i){f=i,w?.addEventListener?.("visibilitychange",M);},event(i){n.push(i),n.length>=t?D(h()):c===void 0&&(c=setTimeout(()=>D(h()),m),c.unref?.());},async flush(){D(h()),await Promise.all(l);},async shutdown(){v(),D(h()),await Promise.all(l);}}}function ie(e={}){return ()=>{let t=globalThis;if(!t.window||!t.document||!t.navigator||t.navigator.globalPrivacyControl===true||t.navigator.doNotTrack==="1")return false;if(!e.optOutKey)return true;try{return globalThis.localStorage?.getItem(e.optOutKey)!=="off"}catch{return true}}}export{ie as browserPrivacySignals,Q as createTelemetry,re as httpExporter};
|
package/dist/ingest/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk3O6TTDB5_cjs=require('../chunk-3O6TTDB5.cjs'),chunk7SYLCJFQ_cjs=require('../chunk-7SYLCJFQ.cjs');require('../chunk-WGWKNKUT.cjs');var b=50,o=e=>typeof e=="string",u=e=>typeof e=="number"&&Number.isFinite(e),p=e=>typeof e=="boolean",h={"edit.rejected":[["code",o],["origin",o],["tracked",p]],"review.skipped":[["code",o],["count",u]],"font.failed":[["code",o]],history:[["code",o]],"custom-node":[["code",o]],"collab.status":[["status",o],["previous",o],["recovering",p]],"collab.participants":[["count",u]],performance:[["windowMs",u]]},E=["durationMs","activeMs","inputEdits","commandEdits","automationEdits"];function T(e){if(!u(e.schemaVersion)||!u(e.time)||!o(e.editorSessionId)||!o(e.engineVersion))return false;if(e.kind==="document.open")return e.outcome==="opened"?o(e.sizeBucket)&&u(e.durationMs):e.outcome==="rejected"&&o(e.code);if(e.kind==="document.save")return u(e.durationMs)&&(e.outcome==="saved"?o(e.sizeBucket):e.outcome==="rejected"&&o(e.code));if(e.kind==="session")return e.phase==="start"||(e.phase==="active"||e.phase==="end")&&E.every(t=>u(e[t]));let n=h[e.kind];return !!n&&n.every(([t,s])=>s(e[t]))}function w(e,n){if(n.size===0)return {};let t=chunk7SYLCJFQ_cjs.d(e)??{};return Object.fromEntries(Object.entries(t).filter(([s])=>n.has(s)))}function R(e,n={}){let t=n.maxEvents??b,s=new Set(n.attributeKeys??[]);return !Array.isArray(e)||e.length>t?[]:e.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return [];let a=r,{resource:d,attributes:l,...i}=a,c=chunk7SYLCJFQ_cjs.b(i);if("dropped"in c||!T(c.event))return [];let g=w(a.attributes,s),{attributes:O,...k}=c.event;return [Object.freeze({...k,resource:w(a.resource,s),attributes:g})]})}function _(e){let{hint:n,docs:t,...s}=e,r="code"in e&&e.code?` ${e.code}`:"";return {...s,dt:e.time,message:`${e.kind}${r}`,occurrences:e.repeated??1,failures:chunk3O6TTDB5_cjs.d(e)}}var x=64*1024;async function A(e,n){if(Number(e.headers.get("content-length")??0)>n)return null;let t=e.body;if(!t)return "";let s=t.getReader(),r=[],a=0;for(;;){let{done:i,value:c}=await s.read();if(i)break;if(a+=c.byteLength,a>n)return await s.cancel().catch(()=>{}),null;r.push(c);}let d=new Uint8Array(a),l=0;for(let i of r)d.set(i,l),l+=i.byteLength;return new TextDecoder().decode(d)}function F(e){let n=e.maxBodyBytes??x,t=()=>new Response(null,{status:204}),s=r=>{try{e.onError?.(r);}catch{}};return async r=>{if(r.method!=="POST")return t();if(e.allowedOrigins){let i=r.headers.get("origin");if(!i||!e.allowedOrigins.includes(i))return t()}let a;try{a=await A(r,n);}catch{return t()}if(a===null)return t();let d;try{d=JSON.parse(a);}catch{return t()}let l=R(d,e);if(!l.length)return t();try{let c=await e.forward(l);if(c&&c.ok===!1)throw new Error(`the log service answered ${String(c.status)}`)}catch(i){s(i);}return t()}}exports.telemetryRoute=F;exports.toLogRecord=_;exports.validateTelemetryEvents=R;
|
package/dist/ingest/index.d.cts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
|
-
import { a as TelemetryEvent } from '../pipeline-
|
|
13
|
+
import { a as TelemetryEvent } from '../pipeline-CCq2Ng0B.cjs';
|
|
14
14
|
import '@docx-editor.dev/core';
|
|
15
15
|
|
|
16
16
|
/** Options for {@link validateTelemetryEvents}. @public */
|
|
@@ -26,14 +26,15 @@ interface ValidateTelemetryEventsOptions {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* The telemetry events in an untrusted request body, checked again with the package's own
|
|
29
|
-
* closed lists. An event with an unknown kind or code,
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* closed lists. An event with an unknown kind or code, a code of another kind, a value outside
|
|
30
|
+
* its list or range, or without the fields its kind needs, is dropped. An unknown field, a
|
|
31
|
+
* number or timing summary its kind does not carry, or a wall-clock span above its bound is
|
|
32
|
+
* removed. The client's `resource` and `attributes` keep only the keys in `attributeKeys`.
|
|
33
|
+
* Returns an empty list for a body that is not an array or is longer than `maxEvents`.
|
|
33
34
|
*
|
|
34
|
-
* The check proves that every value comes from the package's lists or is a number
|
|
35
|
-
* prove that a client told the truth: a script can send a
|
|
36
|
-
* happened. It can never send text.
|
|
35
|
+
* The check proves that every value comes from the package's lists or is a number in the range
|
|
36
|
+
* the engine produces. It cannot prove that a client told the truth: a script can send a
|
|
37
|
+
* well-formed event that never happened. It can never send text.
|
|
37
38
|
*
|
|
38
39
|
* @example
|
|
39
40
|
* ```ts
|
|
@@ -43,17 +44,25 @@ interface ValidateTelemetryEventsOptions {
|
|
|
43
44
|
* @public
|
|
44
45
|
*/
|
|
45
46
|
declare function validateTelemetryEvents(body: unknown, options?: ValidateTelemetryEventsOptions): TelemetryEvent[];
|
|
46
|
-
/** A log record with the fields log services read for time and
|
|
47
|
+
/** A log record with the fields log services read for time, summary, and counts. @public */
|
|
47
48
|
type TelemetryLogRecord = Record<string, unknown> & {
|
|
48
49
|
/** The event time in milliseconds since the epoch, which Better Stack and others read. */
|
|
49
50
|
readonly dt: number;
|
|
50
51
|
/** A one-line summary, such as `edit.rejected edit.picture-selected`. */
|
|
51
52
|
readonly message: string;
|
|
53
|
+
/**
|
|
54
|
+
* How many times the event happened: `1`, or `repeated` for a deduplication summary, whose
|
|
55
|
+
* first event was already sent. Sum it to count events; do not count records.
|
|
56
|
+
*/
|
|
57
|
+
readonly occurrences: number;
|
|
58
|
+
/** How many failures the record adds to a failure total. See `failureCount`. */
|
|
59
|
+
readonly failures: number;
|
|
52
60
|
};
|
|
53
61
|
/**
|
|
54
|
-
* An event as a log record: `dt` for the time, `message` for the live tail, and
|
|
55
|
-
* the event except the fixed `hint` and `docs` text,
|
|
56
|
-
* your own fixed fields, such as a service name, to the
|
|
62
|
+
* An event as a log record: `dt` for the time, `message` for the live tail, `occurrences` and
|
|
63
|
+
* `failures` to sum, and every field of the event except the fixed `hint` and `docs` text,
|
|
64
|
+
* which the code already identifies. Add your own fixed fields, such as a service name, to the
|
|
65
|
+
* result.
|
|
57
66
|
*
|
|
58
67
|
* @example
|
|
59
68
|
* ```ts
|
package/dist/ingest/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
|
-
import { a as TelemetryEvent } from '../pipeline-
|
|
13
|
+
import { a as TelemetryEvent } from '../pipeline-CCq2Ng0B.js';
|
|
14
14
|
import '@docx-editor.dev/core';
|
|
15
15
|
|
|
16
16
|
/** Options for {@link validateTelemetryEvents}. @public */
|
|
@@ -26,14 +26,15 @@ interface ValidateTelemetryEventsOptions {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* The telemetry events in an untrusted request body, checked again with the package's own
|
|
29
|
-
* closed lists. An event with an unknown kind or code,
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* closed lists. An event with an unknown kind or code, a code of another kind, a value outside
|
|
30
|
+
* its list or range, or without the fields its kind needs, is dropped. An unknown field, a
|
|
31
|
+
* number or timing summary its kind does not carry, or a wall-clock span above its bound is
|
|
32
|
+
* removed. The client's `resource` and `attributes` keep only the keys in `attributeKeys`.
|
|
33
|
+
* Returns an empty list for a body that is not an array or is longer than `maxEvents`.
|
|
33
34
|
*
|
|
34
|
-
* The check proves that every value comes from the package's lists or is a number
|
|
35
|
-
* prove that a client told the truth: a script can send a
|
|
36
|
-
* happened. It can never send text.
|
|
35
|
+
* The check proves that every value comes from the package's lists or is a number in the range
|
|
36
|
+
* the engine produces. It cannot prove that a client told the truth: a script can send a
|
|
37
|
+
* well-formed event that never happened. It can never send text.
|
|
37
38
|
*
|
|
38
39
|
* @example
|
|
39
40
|
* ```ts
|
|
@@ -43,17 +44,25 @@ interface ValidateTelemetryEventsOptions {
|
|
|
43
44
|
* @public
|
|
44
45
|
*/
|
|
45
46
|
declare function validateTelemetryEvents(body: unknown, options?: ValidateTelemetryEventsOptions): TelemetryEvent[];
|
|
46
|
-
/** A log record with the fields log services read for time and
|
|
47
|
+
/** A log record with the fields log services read for time, summary, and counts. @public */
|
|
47
48
|
type TelemetryLogRecord = Record<string, unknown> & {
|
|
48
49
|
/** The event time in milliseconds since the epoch, which Better Stack and others read. */
|
|
49
50
|
readonly dt: number;
|
|
50
51
|
/** A one-line summary, such as `edit.rejected edit.picture-selected`. */
|
|
51
52
|
readonly message: string;
|
|
53
|
+
/**
|
|
54
|
+
* How many times the event happened: `1`, or `repeated` for a deduplication summary, whose
|
|
55
|
+
* first event was already sent. Sum it to count events; do not count records.
|
|
56
|
+
*/
|
|
57
|
+
readonly occurrences: number;
|
|
58
|
+
/** How many failures the record adds to a failure total. See `failureCount`. */
|
|
59
|
+
readonly failures: number;
|
|
52
60
|
};
|
|
53
61
|
/**
|
|
54
|
-
* An event as a log record: `dt` for the time, `message` for the live tail, and
|
|
55
|
-
* the event except the fixed `hint` and `docs` text,
|
|
56
|
-
* your own fixed fields, such as a service name, to the
|
|
62
|
+
* An event as a log record: `dt` for the time, `message` for the live tail, `occurrences` and
|
|
63
|
+
* `failures` to sum, and every field of the event except the fixed `hint` and `docs` text,
|
|
64
|
+
* which the code already identifies. Add your own fixed fields, such as a service name, to the
|
|
65
|
+
* result.
|
|
57
66
|
*
|
|
58
67
|
* @example
|
|
59
68
|
* ```ts
|
package/dist/ingest/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {d}from'../chunk-NJ5XLQLN.js';import {b as b$1,d as d$1}from'../chunk-W5HFB5EV.js';import'../chunk-DT2KMPUJ.js';var b=50,o=e=>typeof e=="string",u=e=>typeof e=="number"&&Number.isFinite(e),p=e=>typeof e=="boolean",h={"edit.rejected":[["code",o],["origin",o],["tracked",p]],"review.skipped":[["code",o],["count",u]],"font.failed":[["code",o]],history:[["code",o]],"custom-node":[["code",o]],"collab.status":[["status",o],["previous",o],["recovering",p]],"collab.participants":[["count",u]],performance:[["windowMs",u]]},E=["durationMs","activeMs","inputEdits","commandEdits","automationEdits"];function T(e){if(!u(e.schemaVersion)||!u(e.time)||!o(e.editorSessionId)||!o(e.engineVersion))return false;if(e.kind==="document.open")return e.outcome==="opened"?o(e.sizeBucket)&&u(e.durationMs):e.outcome==="rejected"&&o(e.code);if(e.kind==="document.save")return u(e.durationMs)&&(e.outcome==="saved"?o(e.sizeBucket):e.outcome==="rejected"&&o(e.code));if(e.kind==="session")return e.phase==="start"||(e.phase==="active"||e.phase==="end")&&E.every(t=>u(e[t]));let n=h[e.kind];return !!n&&n.every(([t,s])=>s(e[t]))}function w(e,n){if(n.size===0)return {};let t=d$1(e)??{};return Object.fromEntries(Object.entries(t).filter(([s])=>n.has(s)))}function R(e,n={}){let t=n.maxEvents??b,s=new Set(n.attributeKeys??[]);return !Array.isArray(e)||e.length>t?[]:e.flatMap(r=>{if(!r||typeof r!="object"||Array.isArray(r))return [];let a=r,{resource:d,attributes:l,...i}=a,c=b$1(i);if("dropped"in c||!T(c.event))return [];let g=w(a.attributes,s),{attributes:O,...k}=c.event;return [Object.freeze({...k,resource:w(a.resource,s),attributes:g})]})}function _(e){let{hint:n,docs:t,...s}=e,r="code"in e&&e.code?` ${e.code}`:"";return {...s,dt:e.time,message:`${e.kind}${r}`,occurrences:e.repeated??1,failures:d(e)}}var x=64*1024;async function A(e,n){if(Number(e.headers.get("content-length")??0)>n)return null;let t=e.body;if(!t)return "";let s=t.getReader(),r=[],a=0;for(;;){let{done:i,value:c}=await s.read();if(i)break;if(a+=c.byteLength,a>n)return await s.cancel().catch(()=>{}),null;r.push(c);}let d=new Uint8Array(a),l=0;for(let i of r)d.set(i,l),l+=i.byteLength;return new TextDecoder().decode(d)}function F(e){let n=e.maxBodyBytes??x,t=()=>new Response(null,{status:204}),s=r=>{try{e.onError?.(r);}catch{}};return async r=>{if(r.method!=="POST")return t();if(e.allowedOrigins){let i=r.headers.get("origin");if(!i||!e.allowedOrigins.includes(i))return t()}let a;try{a=await A(r,n);}catch{return t()}if(a===null)return t();let d;try{d=JSON.parse(a);}catch{return t()}let l=R(d,e);if(!l.length)return t();try{let c=await e.forward(l);if(c&&c.ok===!1)throw new Error(`the log service answered ${String(c.status)}`)}catch(i){s(i);}return t()}}export{F as telemetryRoute,_ as toLogRecord,R as validateTelemetryEvents};
|
package/dist/otel/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk3O6TTDB5_cjs=require('../chunk-3O6TTDB5.cjs'),chunkWGWKNKUT_cjs=require('../chunk-WGWKNKUT.cjs'),api=require('@opentelemetry/api');var E="@docx-editor.dev/telemetry";function M(o){let n=o.getDelegate?.()??o;return /^Noop/.test(n?.constructor?.name??"")}var k=false;function h(o,n){let s=chunkWGWKNKUT_cjs.a();k||s==="production"||!M(o)||!M(n)||(k=true,console.warn("[docx-editor telemetry] otelExporter found no OpenTelemetry SDK. Register a MeterProvider and a TracerProvider before creating the exporter, or pass them as options. Until then every measurement is dropped."));}function C(o,n,s){return o.createObservableGauge(n.name,{unit:n.unit,description:n.description}).addCallback(t=>{for(let{value:i,attributes:a}of s.values())t.observe(i,a);}),{record(t,i={}){s.set(g(i),{value:t,attributes:i});},forget(t){s.delete(g(t));}}}function g(o){return JSON.stringify(Object.keys(o).sort().map(n=>[n,o[n]]))}function f(o){let n={...o.resource,...o.attributes};for(let[s,t]of Object.entries(o))if(!(s==="resource"||s==="attributes"||s==="hint"||s==="docs")){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")n[`docx_editor.${s}`]=t;else if(s==="shape"&&t&&typeof t=="object")for(let[i,a]of Object.entries(t))typeof a=="string"&&(n[`docx_editor.shape.${i}`]=a);else if(t&&typeof t=="object"&&!Array.isArray(t))for(let[i,a]of Object.entries(t))typeof a=="number"&&(n[`docx_editor.${s}.${i}`]=a);}return n}function j(o={}){let n=o.scope??E,s=()=>o.meterProvider??api.metrics.getMeterProvider(),t=()=>o.tracerProvider??api.trace.getTracerProvider(),i,a,l=new Map,m=new Map,b=false;function P(e){let r=m.get(e);return r||(r=new Map,m.set(e,r)),r}function T(){let e=s();return (e!==i||!a)&&(i=e,a=e.getMeter(n),l.clear()),a}function A(e){let r=T();b||(b=true,setTimeout(()=>h(s(),t()),5e3).unref?.());let c=l.get(e.name);if(c)return c;let u={unit:e.unit,description:e.description},d=e.kind==="counter"?r.createCounter(e.name,u):e.kind==="histogram"?r.createHistogram(e.name,{...u,...e.buckets?{advice:{explicitBucketBoundaries:[...e.buckets]}}:{}}):C(r,e,P(e.name));return l.set(e.name,d),d}return {name:"otel",metric(e){let r=A(e.definition),c=e.attributes;"add"in r?r.add(e.value,c):r.record(e.value,c);},event(e){if(e.kind==="document.open"||e.kind==="document.save"){let u=e.kind==="document.save"||e.outcome==="opened"?e.durationMs:0,d=e.time-u,p=t().getTracer(n).startSpan(`docx_editor.${e.kind}`,{startTime:d,attributes:f(e)},o.parentContext?.());e.outcome==="rejected"&&p.setStatus({code:api.SpanStatusCode.ERROR,message:e.code}),p.end(e.time);return}let r=api.trace.getActiveSpan();if(r){r.addEvent(`docx_editor.${e.kind}`,f(e));return}if(!chunk3O6TTDB5_cjs.c(e))return;let c=t().getTracer(n).startSpan(`docx_editor.${e.kind}`,{startTime:e.time,attributes:f(e)},o.parentContext?.());c.setStatus({code:api.SpanStatusCode.ERROR,message:"code"in e?e.code:e.kind}),c.end(e.time);},forget(e,r){m.get(e.name)?.delete(g(r));},async flush(){let e=r=>(r.getDelegate?.()??r).forceFlush?.();await Promise.all([e(s()),e(t())]);}}}exports.otelExporter=j;
|
package/dist/otel/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
import { MeterProvider, TracerProvider, Context } from '@opentelemetry/api';
|
|
9
|
-
import { b as TelemetryExporter } from '../pipeline-
|
|
9
|
+
import { b as TelemetryExporter } from '../pipeline-CCq2Ng0B.cjs';
|
|
10
10
|
import '@docx-editor.dev/core';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/otel/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
import { MeterProvider, TracerProvider, Context } from '@opentelemetry/api';
|
|
9
|
-
import { b as TelemetryExporter } from '../pipeline-
|
|
9
|
+
import { b as TelemetryExporter } from '../pipeline-CCq2Ng0B.js';
|
|
10
10
|
import '@docx-editor.dev/core';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/otel/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'../chunk-
|
|
1
|
+
import {c}from'../chunk-NJ5XLQLN.js';import {a}from'../chunk-DT2KMPUJ.js';import {SpanStatusCode,trace,metrics}from'@opentelemetry/api';var E="@docx-editor.dev/telemetry";function M(o){let n=o.getDelegate?.()??o;return /^Noop/.test(n?.constructor?.name??"")}var k=false;function h(o,n){let s=a();k||s==="production"||!M(o)||!M(n)||(k=true,console.warn("[docx-editor telemetry] otelExporter found no OpenTelemetry SDK. Register a MeterProvider and a TracerProvider before creating the exporter, or pass them as options. Until then every measurement is dropped."));}function C(o,n,s){return o.createObservableGauge(n.name,{unit:n.unit,description:n.description}).addCallback(t=>{for(let{value:i,attributes:a}of s.values())t.observe(i,a);}),{record(t,i={}){s.set(g(i),{value:t,attributes:i});},forget(t){s.delete(g(t));}}}function g(o){return JSON.stringify(Object.keys(o).sort().map(n=>[n,o[n]]))}function f(o){let n={...o.resource,...o.attributes};for(let[s,t]of Object.entries(o))if(!(s==="resource"||s==="attributes"||s==="hint"||s==="docs")){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")n[`docx_editor.${s}`]=t;else if(s==="shape"&&t&&typeof t=="object")for(let[i,a]of Object.entries(t))typeof a=="string"&&(n[`docx_editor.shape.${i}`]=a);else if(t&&typeof t=="object"&&!Array.isArray(t))for(let[i,a]of Object.entries(t))typeof a=="number"&&(n[`docx_editor.${s}.${i}`]=a);}return n}function j(o={}){let n=o.scope??E,s=()=>o.meterProvider??metrics.getMeterProvider(),t=()=>o.tracerProvider??trace.getTracerProvider(),i,a,l=new Map,m=new Map,b=false;function P(e){let r=m.get(e);return r||(r=new Map,m.set(e,r)),r}function T(){let e=s();return (e!==i||!a)&&(i=e,a=e.getMeter(n),l.clear()),a}function A(e){let r=T();b||(b=true,setTimeout(()=>h(s(),t()),5e3).unref?.());let c=l.get(e.name);if(c)return c;let u={unit:e.unit,description:e.description},d=e.kind==="counter"?r.createCounter(e.name,u):e.kind==="histogram"?r.createHistogram(e.name,{...u,...e.buckets?{advice:{explicitBucketBoundaries:[...e.buckets]}}:{}}):C(r,e,P(e.name));return l.set(e.name,d),d}return {name:"otel",metric(e){let r=A(e.definition),c=e.attributes;"add"in r?r.add(e.value,c):r.record(e.value,c);},event(e){if(e.kind==="document.open"||e.kind==="document.save"){let u=e.kind==="document.save"||e.outcome==="opened"?e.durationMs:0,d=e.time-u,p=t().getTracer(n).startSpan(`docx_editor.${e.kind}`,{startTime:d,attributes:f(e)},o.parentContext?.());e.outcome==="rejected"&&p.setStatus({code:SpanStatusCode.ERROR,message:e.code}),p.end(e.time);return}let r=trace.getActiveSpan();if(r){r.addEvent(`docx_editor.${e.kind}`,f(e));return}if(!c(e))return;let c$1=t().getTracer(n).startSpan(`docx_editor.${e.kind}`,{startTime:e.time,attributes:f(e)},o.parentContext?.());c$1.setStatus({code:SpanStatusCode.ERROR,message:"code"in e?e.code:e.kind}),c$1.end(e.time);},forget(e,r){m.get(e.name)?.delete(g(r));},async flush(){let e=r=>(r.getDelegate?.()??r).forceFlush?.();await Promise.all([e(s()),e(t())]);}}}export{j as otelExporter};
|
|
@@ -35,6 +35,9 @@ interface MetricDefinition {
|
|
|
35
35
|
declare const METRICS: Readonly<{
|
|
36
36
|
documentOpens: MetricDefinition;
|
|
37
37
|
documentOpenDuration: MetricDefinition;
|
|
38
|
+
documentSaves: MetricDefinition;
|
|
39
|
+
documentSaveDuration: MetricDefinition;
|
|
40
|
+
edits: MetricDefinition;
|
|
38
41
|
editRejections: MetricDefinition;
|
|
39
42
|
reviewSkipped: MetricDefinition;
|
|
40
43
|
fontFailures: MetricDefinition;
|
|
@@ -43,6 +46,9 @@ declare const METRICS: Readonly<{
|
|
|
43
46
|
collabClientStatusTransitions: MetricDefinition;
|
|
44
47
|
collabClientConnectDuration: MetricDefinition;
|
|
45
48
|
collabClientParticipants: MetricDefinition;
|
|
49
|
+
editorSessions: MetricDefinition;
|
|
50
|
+
editorSessionDuration: MetricDefinition;
|
|
51
|
+
editorActiveTime: MetricDefinition;
|
|
46
52
|
editorInteractionDuration: MetricDefinition;
|
|
47
53
|
editorLayoutDuration: MetricDefinition;
|
|
48
54
|
editorPaintDuration: MetricDefinition;
|
|
@@ -35,6 +35,9 @@ interface MetricDefinition {
|
|
|
35
35
|
declare const METRICS: Readonly<{
|
|
36
36
|
documentOpens: MetricDefinition;
|
|
37
37
|
documentOpenDuration: MetricDefinition;
|
|
38
|
+
documentSaves: MetricDefinition;
|
|
39
|
+
documentSaveDuration: MetricDefinition;
|
|
40
|
+
edits: MetricDefinition;
|
|
38
41
|
editRejections: MetricDefinition;
|
|
39
42
|
reviewSkipped: MetricDefinition;
|
|
40
43
|
fontFailures: MetricDefinition;
|
|
@@ -43,6 +46,9 @@ declare const METRICS: Readonly<{
|
|
|
43
46
|
collabClientStatusTransitions: MetricDefinition;
|
|
44
47
|
collabClientConnectDuration: MetricDefinition;
|
|
45
48
|
collabClientParticipants: MetricDefinition;
|
|
49
|
+
editorSessions: MetricDefinition;
|
|
50
|
+
editorSessionDuration: MetricDefinition;
|
|
51
|
+
editorActiveTime: MetricDefinition;
|
|
46
52
|
editorInteractionDuration: MetricDefinition;
|
|
47
53
|
editorLayoutDuration: MetricDefinition;
|
|
48
54
|
editorPaintDuration: MetricDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkQDOUVRQA_cjs=require('../chunk-QDOUVRQA.cjs');require('../chunk-AL2YERWY.cjs');Object.defineProperty(exports,"PROMETHEUS_CONTENT_TYPE",{enumerable:true,get:function(){return chunkQDOUVRQA_cjs.a}});Object.defineProperty(exports,"fetchMetricsHandler",{enumerable:true,get:function(){return chunkQDOUVRQA_cjs.d}});Object.defineProperty(exports,"metricsHandler",{enumerable:true,get:function(){return chunkQDOUVRQA_cjs.c}});Object.defineProperty(exports,"prometheusRegistry",{enumerable:true,get:function(){return chunkQDOUVRQA_cjs.b}});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
|
-
import { b as TelemetryExporter } from '../pipeline-
|
|
9
|
+
import { b as TelemetryExporter } from '../pipeline-CCq2Ng0B.cjs';
|
|
10
10
|
import '@docx-editor.dev/core';
|
|
11
11
|
|
|
12
12
|
/** The Prometheus text exposition content type. @public */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
|
-
import { b as TelemetryExporter } from '../pipeline-
|
|
9
|
+
import { b as TelemetryExporter } from '../pipeline-CCq2Ng0B.js';
|
|
10
10
|
import '@docx-editor.dev/core';
|
|
11
11
|
|
|
12
12
|
/** The Prometheus text exposition content type. @public */
|
package/dist/prometheus/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as PROMETHEUS_CONTENT_TYPE,d as fetchMetricsHandler,c as metricsHandler,b as prometheusRegistry}from'../chunk-
|
|
1
|
+
export{a as PROMETHEUS_CONTENT_TYPE,d as fetchMetricsHandler,c as metricsHandler,b as prometheusRegistry}from'../chunk-JM4KJB6O.js';import'../chunk-RSWAOCAT.js';
|
package/dist/sentry/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk3O6TTDB5_cjs=require('../chunk-3O6TTDB5.cjs');var i=class extends Error{name="DocxEditorDiagnosticError";code;constructor(r,t){super(t?`${r}: ${t}`:r),this.code=r;}},u=new Set(["collab.authentication-failed","collab.room-generation-changed"]),l=new Set(["open.failed","open.unsupported-source","open.invalid-limits"]),f=Object.freeze([".docx-editor",".docx-pages"]);function x(e,r){return e.category?.startsWith("ui.")&&g(r?.event?.target)?null:e}function g(e){try{let r=e;return r&&typeof r.closest!="function"&&(r=r.parentElement),!r||typeof r.closest!="function"?!0:r.closest(f.join(", "))!=null}catch{return true}}function p(e){switch(e.kind){case "document.open":return e.outcome==="rejected"&&l.has(e.code);case "document.save":return e.outcome==="rejected"&&e.code==="save.failed";case "edit.rejected":return e.code==="edit.internal-invariant";case "review.skipped":return e.code==="review.revision-unsupported"||e.code==="review.retained-structure";case "font.failed":return e.code==="font.shaper-unavailable";case "collab.status":return e.status==="error"&&!e.recovering&&!u.has(e.code??"");default:return false}}function m(e){return e.kind==="document.open"?e.outcome==="opened":e.kind==="document.save"?e.outcome==="saved":e.kind==="session"?true:e.kind==="performance"&&e.code===void 0}function c(e){return "code"in e&&e.code?e.code:e.kind}function y(e){let r=e,t={"docx_editor.kind":e.kind,"docx_editor.code":c(e),"docx_editor.version":e.engineVersion,"docx_editor.editor_session":e.editorSessionId};for(let[o,n]of [["origin","origin"],["tracked","tracked"],["status","status"],["outcome","outcome"],["command","command"],["cause","cause"],["part","part"],["errorName","error_name"],["stage","stage"],["operation","operation"],["changeKind","change_kind"],["formattingKind","formatting_kind"]])r[o]!==void 0&&(t[`docx_editor.${n}`]=String(r[o]));for(let[o,n]of Object.entries(e.attributes??{}))t[o]=String(n);return t}function k(e,r){let t=e,o=["cause","errorName","stage","changeKind","formattingKind"].map(n=>t[n]).filter(n=>typeof n=="string");return ["docx-editor",e.kind,r,...o]}function d(e){let{resource:r,...t}=e;return {...t,...Object.keys(r).length?{resource:r}:{}}}function b(e,r={}){let t=r.issue??p,o=r.breadcrumbs??true;return {name:"sentry",event(n){let s=c(n);if(n.repeated===void 0&&t(n)){e.captureException(new i(s,n.hint),{fingerprint:k(n,s),level:n.kind==="font.failed"||n.kind==="review.skipped"?"warning":"error",tags:y(n),contexts:{docx_editor:d(n)}});return}o&&e.addBreadcrumb({category:"docx-editor",message:chunk3O6TTDB5_cjs.b(n),level:m(n)?"info":"warning",data:d(n)});},async flush(){await e.flush?.(2e3);}}}exports.DocxEditorDiagnosticError=i;exports.EDITOR_SELECTORS=f;exports.dropEditorBreadcrumbs=x;exports.isSentryIssue=p;exports.sentryExporter=b;
|
package/dist/sentry/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import { a as TelemetryEvent, b as TelemetryExporter } from '../pipeline-
|
|
7
|
+
import { a as TelemetryEvent, b as TelemetryExporter } from '../pipeline-CCq2Ng0B.cjs';
|
|
8
8
|
import '@docx-editor.dev/core';
|
|
9
9
|
|
|
10
10
|
/** Sentry severity, as the Sentry SDKs spell it. @public */
|
package/dist/sentry/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
|
-
import { a as TelemetryEvent, b as TelemetryExporter } from '../pipeline-
|
|
7
|
+
import { a as TelemetryEvent, b as TelemetryExporter } from '../pipeline-CCq2Ng0B.js';
|
|
8
8
|
import '@docx-editor.dev/core';
|
|
9
9
|
|
|
10
10
|
/** Sentry severity, as the Sentry SDKs spell it. @public */
|
package/dist/sentry/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1}from'../chunk-
|
|
1
|
+
import {b as b$1}from'../chunk-NJ5XLQLN.js';var i=class extends Error{name="DocxEditorDiagnosticError";code;constructor(r,t){super(t?`${r}: ${t}`:r),this.code=r;}},u=new Set(["collab.authentication-failed","collab.room-generation-changed"]),l=new Set(["open.failed","open.unsupported-source","open.invalid-limits"]),f=Object.freeze([".docx-editor",".docx-pages"]);function x(e,r){return e.category?.startsWith("ui.")&&g(r?.event?.target)?null:e}function g(e){try{let r=e;return r&&typeof r.closest!="function"&&(r=r.parentElement),!r||typeof r.closest!="function"?!0:r.closest(f.join(", "))!=null}catch{return true}}function p(e){switch(e.kind){case "document.open":return e.outcome==="rejected"&&l.has(e.code);case "document.save":return e.outcome==="rejected"&&e.code==="save.failed";case "edit.rejected":return e.code==="edit.internal-invariant";case "review.skipped":return e.code==="review.revision-unsupported"||e.code==="review.retained-structure";case "font.failed":return e.code==="font.shaper-unavailable";case "collab.status":return e.status==="error"&&!e.recovering&&!u.has(e.code??"");default:return false}}function m(e){return e.kind==="document.open"?e.outcome==="opened":e.kind==="document.save"?e.outcome==="saved":e.kind==="session"?true:e.kind==="performance"&&e.code===void 0}function c(e){return "code"in e&&e.code?e.code:e.kind}function y(e){let r=e,t={"docx_editor.kind":e.kind,"docx_editor.code":c(e),"docx_editor.version":e.engineVersion,"docx_editor.editor_session":e.editorSessionId};for(let[o,n]of [["origin","origin"],["tracked","tracked"],["status","status"],["outcome","outcome"],["command","command"],["cause","cause"],["part","part"],["errorName","error_name"],["stage","stage"],["operation","operation"],["changeKind","change_kind"],["formattingKind","formatting_kind"]])r[o]!==void 0&&(t[`docx_editor.${n}`]=String(r[o]));for(let[o,n]of Object.entries(e.attributes??{}))t[o]=String(n);return t}function k(e,r){let t=e,o=["cause","errorName","stage","changeKind","formattingKind"].map(n=>t[n]).filter(n=>typeof n=="string");return ["docx-editor",e.kind,r,...o]}function d(e){let{resource:r,...t}=e;return {...t,...Object.keys(r).length?{resource:r}:{}}}function b(e,r={}){let t=r.issue??p,o=r.breadcrumbs??true;return {name:"sentry",event(n){let s=c(n);if(n.repeated===void 0&&t(n)){e.captureException(new i(s,n.hint),{fingerprint:k(n,s),level:n.kind==="font.failed"||n.kind==="review.skipped"?"warning":"error",tags:y(n),contexts:{docx_editor:d(n)}});return}o&&e.addBreadcrumb({category:"docx-editor",message:b$1(n),level:m(n)?"info":"warning",data:d(n)});},async flush(){await e.flush?.(2e3);}}}export{i as DocxEditorDiagnosticError,f as EDITOR_SELECTORS,x as dropEditorBreadcrumbs,p as isSentryIssue,b as sentryExporter};
|
package/dist/server/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCNSLQJPA_cjs=require('../chunk-CNSLQJPA.cjs');require('../chunk-G4BK3PPE.cjs'),require('../chunk-AL2YERWY.cjs'),require('../chunk-7SYLCJFQ.cjs'),require('../chunk-WGWKNKUT.cjs');Object.defineProperty(exports,"hmacRoomLabel",{enumerable:true,get:function(){return chunkCNSLQJPA_cjs.a}});Object.defineProperty(exports,"roomTelemetry",{enumerable:true,get:function(){return chunkCNSLQJPA_cjs.b}});
|
package/dist/server/index.d.cts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import * as Y from 'yjs';
|
|
11
|
-
import { T as TelemetryPipelineOptions } from '../pipeline-
|
|
12
|
-
export { b as TelemetryExporter } from '../pipeline-
|
|
11
|
+
import { T as TelemetryPipelineOptions } from '../pipeline-CCq2Ng0B.cjs';
|
|
12
|
+
export { b as TelemetryExporter } from '../pipeline-CCq2Ng0B.cjs';
|
|
13
13
|
import '@docx-editor.dev/core';
|
|
14
14
|
|
|
15
15
|
/** The part of a `y-protocols` `Awareness` the telemetry reads. @public */
|
package/dist/server/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import * as Y from 'yjs';
|
|
11
|
-
import { T as TelemetryPipelineOptions } from '../pipeline-
|
|
12
|
-
export { b as TelemetryExporter } from '../pipeline-
|
|
11
|
+
import { T as TelemetryPipelineOptions } from '../pipeline-CCq2Ng0B.js';
|
|
12
|
+
export { b as TelemetryExporter } from '../pipeline-CCq2Ng0B.js';
|
|
13
13
|
import '@docx-editor.dev/core';
|
|
14
14
|
|
|
15
15
|
/** The part of a `y-protocols` `Awareness` the telemetry reads. @public */
|
package/dist/server/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as hmacRoomLabel,b as roomTelemetry}from'../chunk-
|
|
1
|
+
export{a as hmacRoomLabel,b as roomTelemetry}from'../chunk-CLA4ASL4.js';import'../chunk-L4OYI7YL.js';import'../chunk-RSWAOCAT.js';import'../chunk-W5HFB5EV.js';import'../chunk-DT2KMPUJ.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/telemetry",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.0",
|
|
4
4
|
"description": "Anonymous diagnostics, metrics, and error reporting for @docx-editor.dev editors and collaboration servers, with OpenTelemetry, Prometheus, and Sentry exporters.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"license:add": "license-check-and-add add -f license-check.json"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@docx-editor.dev/core": "~2.
|
|
60
|
-
"@docx-editor.dev/pro": "~2.
|
|
59
|
+
"@docx-editor.dev/core": "~2.31.0",
|
|
60
|
+
"@docx-editor.dev/pro": "~2.31.0",
|
|
61
61
|
"@opentelemetry/api": "^1.9.0",
|
|
62
62
|
"yjs": "^13.6.32",
|
|
63
63
|
"@hocuspocus/server": "^4.6.0"
|
package/dist/chunk-73YEPWY5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e="docx_editor.version",n=[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10,30,60],l=[1024,16*1024,64*1024,256*1024,1024*1024,4*1024*1024,16*1024*1024,64*1024*1024,256*1024*1024,1024*1024*1024],i=[.016,.033,.05,.1,.2,.5,1],c=[1,2,3,5,10,20,50,100,250],p=[1e3,1e4,5e4,1e5,25e4,5e5,1e6],g=[.1,.25,.5,.75,.9,.95,1],d=[60,300,900,3600,4*3600,24*3600,168*3600];function o(t,r,a,m,u=[],s){return Object.freeze({name:t,kind:r,unit:a,description:m,labels:u,...s?{buckets:s}:{}})}var b=Object.freeze({documentOpens:o("docx_editor.document.opens","counter","{open}","Documents opened or refused, by outcome, refusal code, engine reason, and part role.",["outcome","code","cause","part",e]),documentOpenDuration:o("docx_editor.document.open.duration","histogram","s","Time from the start of an open to the laid-out document.",[e],n),editRejections:o("docx_editor.edit.rejections","counter","{edit}","Edits, commands, and tracked changes refused, by public code and engine reason.",["code","cause","origin","tracked",e]),reviewSkipped:o("docx_editor.review.skipped","counter","{change}","Tracked changes skipped by accept, reject, or reassign requests, by engine reason, operation, and change kind.",["code","cause","operation","change_kind",e]),fontFailures:o("docx_editor.font.failures","counter","{failure}","Font faces that failed to load and were substituted.",["code",e]),historyDiagnostics:o("docx_editor.history.diagnostics","counter","{event}","Undo steps that did not group as the gesture intended, by code.",["code",e]),customNodeDiagnostics:o("docx_editor.custom_node.diagnostics","counter","{node}","Custom node payloads that could not be read, by code.",["code",e]),collabClientStatusTransitions:o("docx_editor.collab.client.status_transitions","counter","{transition}","Collaboration status changes on clients, by new status and failure code.",["status","code",e]),collabClientConnectDuration:o("docx_editor.collab.client.connect.duration","histogram","s","Time from an editor attaching a room to its first ready status, when the editor attached before the room was ready.",[e],n),collabClientParticipants:o("docx_editor.collab.client.participants","histogram","{participant}","People in the room, as each client sees it when the count changes.",[e],c),editorInteractionDuration:o("docx_editor.editor.interaction.duration","histogram","s","Key presses and pointer presses on the pages, to the next frame on screen, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",e],i),editorLayoutDuration:o("docx_editor.editor.layout.duration","histogram","s","Engine layout passes after edits and view changes, background work included, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",e],i),editorPaintDuration:o("docx_editor.editor.paint.duration","histogram","s","Engine paints of the pages, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",e],i),droppedEvents:o("docx_editor.telemetry.dropped_events","counter","{event}","Events the anonymity guard dropped, by reason. Usually a version mismatch.",["reason",e]),roomsActive:o("docx_editor.collab.rooms.active","gauge","{room}","Rooms loaded."),connectionsActive:o("docx_editor.collab.connections.active","gauge","{connection}","Open client connections. One person with two tabs is two connections."),participantsActive:o("docx_editor.collab.participants.active","gauge","{participant}","People present in all rooms, from awareness states."),roomParticipants:o("docx_editor.collab.room.participants","histogram","{participant}","People present in each room, sampled once per room per interval.",[],c),roomParticipantsMax:o("docx_editor.collab.room.participants.max","gauge","{participant}","People in the fullest room now."),roomMemory:o("docx_editor.collab.room.memory","histogram","By","Bytes each room holds, sampled per room: encoded state, blobs, and updates not yet stored.",["kind"],l),roomsMemory:o("docx_editor.collab.rooms.memory","gauge","By","Bytes all rooms hold together at the last sample.",["kind"]),roomNodes:o("docx_editor.collab.room.nodes","histogram","{node}","Shared document nodes per room, live and tombstoned.",["state"],p),roomResourceUsage:o("docx_editor.collab.room.resource_usage","histogram","1","Share of each room resource limit in use, from 0 to 1.",["resource"],g),roomAge:o("docx_editor.collab.room.age","histogram","s","How long each room has been loaded.",[],d),roomIdle:o("docx_editor.collab.room.idle","histogram","s","Time since each room last changed.",[],d),roomLoadDuration:o("docx_editor.collab.room.load.duration","histogram","s","Time to load a room, by outcome.",["outcome"],n),roomStoreDuration:o("docx_editor.collab.room.store.duration","histogram","s","Time to store a room, by outcome.",["outcome"],n),admissionRejections:o("docx_editor.collab.admission.rejections","counter","{connection}","Connections refused at admission, by reason.",["reason"]),messageRefusals:o("docx_editor.collab.message.refusals","counter","{message}","Messages refused before they applied, by reason, such as room-generation-changed.",["reason"]),updates:o("docx_editor.collab.updates","counter","{update}","Document updates applied to rooms."),updateBytes:o("docx_editor.collab.update.bytes","counter","By","Bytes of document updates applied to rooms."),roomParticipantsByRoom:o("docx_editor.collab.room.participants.current","gauge","{participant}","People in each room, labeled by room. Recorded only with perRoomSeries.",["room"]),roomMemoryByRoom:o("docx_editor.collab.room.memory.current","gauge","By","Bytes each room holds, labeled by room and kind. Recorded only with perRoomSeries.",["room","kind"]),migrations:o("docx_editor.collab.migrations","counter","{room}","Room migrations, by outcome.",["outcome"])}),h={s:"seconds",By:"bytes"};function y(t){let r=t.name.replace(/[^a-zA-Z0-9_]/g,"_"),a=t.unit==="1"?t.kind==="gauge"?"ratio":void 0:h[t.unit];return a&&!r.endsWith(`_${a}`)&&(r+=`_${a}`),t.kind==="counter"&&(r+="_total"),r}export{b as a,y as b};
|
package/dist/chunk-DTEVX2XS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-DT2KMPUJ.js';import {diagnosticCodes,diagnosticCauses,diagnosticCommands,explainDiagnostic}from'@docx-editor.dev/core';var w=new Set(diagnosticCodes());function u(t){return new Set(Object.keys(t))}var N=u({package:true,"content-types":true,relationships:true,"main-document":true,glossary:true,styles:true,numbering:true,settings:true,"web-settings":true,"font-table":true,theme:true,header:true,footer:true,footnotes:true,endnotes:true,comments:true,people:true,"custom-xml":true,"document-properties":true,media:true,embedding:true,other:true}),C=u({Error:true,TypeError:true,RangeError:true,ReferenceError:true,SyntaxError:true,other:true}),j=u({accept:true,reject:true,reassign:true}),M=u({"open-mount":true,"open-layout":true,command:true,"review-item":true,automation:true}),T=u({insert:true,delete:true,replace:true,moveFrom:true,moveTo:true,format:true,paragraphMark:true,structural:true}),D=u({rPrChange:true,pPrChange:true,sectPrChange:true,tblPrChange:true,tblPrExChange:true,tblGridChange:true,trPrChange:true,tcPrChange:true,numberingChange:true,other:true}),c={kind:new Set(["document.open","edit.rejected","review.skipped","font.failed","history","custom-node","collab.status","collab.participants","performance"]),code:w,outcome:new Set(["opened","rejected"]),origin:new Set(["command","input","automation"]),command:new Set(diagnosticCommands()),sizeBucket:/^(?:\d+(?:KiB|MiB)?-\d+(?:KiB|MiB)|512MiB\+)$/,pagesBucket:new Set(["0","1","2-9","10-99","100-999","1000+"]),editorSessionId:/^e_(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,64}|[0-9a-z]{6,12}_[0-9a-z]{1,8})$/,engineVersion:/^(?:development|\d{1,4}\.\d{1,4}\.\d{1,4}(?:-[0-9A-Za-z.]{1,20})?)$/,status:new Set(["initializing","ready","disconnected","error","destroyed"]),previous:new Set(["none","initializing","ready","disconnected","error","destroyed"]),cause:new Set(diagnosticCauses()),part:N,errorName:C,stage:M,operation:j,changeKind:T,formattingKind:D},l=new Set(["schemaVersion","time","durationMs","count","repeated","connectMs","participants","windowMs"]),g=new Set(["tracked","recovering"]),m=new Set;function a(t,n=t){m.has(n)||a$1()==="production"||(m.add(n),console.warn(`[docx-editor telemetry] ${t}`));}function f(t,n){let i=Object.hasOwn(c,t)?c[t]:void 0;return i?i instanceof RegExp?i.test(n):i.has(n):false}function B(t){let n=t;if(typeof n.kind!="string"||!f("kind",n.kind))return a("dropped an event of an unknown kind; core and telemetry versions may differ","kind"),{dropped:"unknown-kind"};let i=typeof n.code=="string"?n.code:void 0;if(i!==void 0&&!w.has(i))return a("dropped an event with an unknown code; core and telemetry versions may differ","code"),{dropped:"unknown-code"};let o=i?explainDiagnostic(i):void 0,r={};for(let[e,s]of Object.entries(n)){if(e==="resource"||e==="attributes")continue;if(e==="shape"){let d=K(s);if(!d)return a('dropped an event whose "shape" is not a valid document shape',"shape"),{dropped:"invalid-field"};r.shape=d;continue}if(I.has(e)){let d=x(s);if(!d)return a(`dropped an event whose "${e}" is not a valid timing summary`,`timing:${e}`),{dropped:"invalid-field"};r[e]=d;continue}if(e==="hint"||e==="docs"){o&&s===o[e]&&(r[e]=s);continue}let R=Object.hasOwn(c,e)||l.has(e)||g.has(e);if(typeof s=="number"&&l.has(e)&&Number.isFinite(s))r[e]=s;else if(typeof s=="boolean"&&g.has(e))r[e]=s;else if(typeof s=="string"&&f(e,s))r[e]=s;else {if(R)return a(`dropped an event whose "${e}" is not a valid value`,`field:${e}`),{dropped:"invalid-field"};a(`dropped the field "${e}", which is not an anonymous diagnostic field`,`extra:${e}`);}}return r.resource=t.resource,r.attributes=t.attributes??{},{event:Object.freeze(r)}}var I=new Set(["interaction","layout","paint"]),y=["count","p50Ms","p95Ms","maxMs"],$=8,h=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0;function x(t){if(!t||typeof t!="object")return null;let n=t,i=[...y,"bands"];if(Object.keys(n).some(e=>!i.includes(e)))return null;let o={};for(let e of y){if(!h(n[e]))return null;o[e]=n[e];}let r=n.bands;return !Array.isArray(r)||r.length!==$||!r.every(h)?null:(o.bands=Object.freeze([...r]),Object.freeze(o))}var b=["parts","paragraphs","reviewItems","embeddedFonts"];function K(t){if(!t||typeof t!="object")return null;let n=t;if(Object.keys(n).some(o=>!b.includes(o)))return null;let i={};for(let o of b){let r=n[o];if(typeof r!="string"||!f("pagesBucket",r))return null;i[o]=r;}return Object.freeze(i)}var k=/^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/,S=/^[A-Za-z0-9_.:+-]{0,64}$/;function F(t,n,i){let o={};for(let[r,e]of Object.entries(t)){if(!k.test(r)||i&&!i.includes(r)){a(`dropped the attribute "${r.slice(0,40)}" on ${n}`,`attribute:${n}:${r}`);continue}typeof e=="number"||typeof e=="boolean"?o[r]=e:typeof e=="string"&&(o[r]=i&&!S.test(e)?"other":e.slice(0,256));}return o}function P(t){if(!t||typeof t!="object"||Array.isArray(t))return;let n={};for(let[i,o]of Object.entries(t))k.test(i)&&(typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o)||typeof o=="string"&&o&&S.test(o))&&(n[i]=o);return Object.keys(n).length?n:void 0}export{B as a,F as b,P as c};
|
package/dist/chunk-LFQSY2TD.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkWGWKNKUT_cjs=require('./chunk-WGWKNKUT.cjs'),core=require('@docx-editor.dev/core');var w=new Set(core.diagnosticCodes());function u(t){return new Set(Object.keys(t))}var N=u({package:true,"content-types":true,relationships:true,"main-document":true,glossary:true,styles:true,numbering:true,settings:true,"web-settings":true,"font-table":true,theme:true,header:true,footer:true,footnotes:true,endnotes:true,comments:true,people:true,"custom-xml":true,"document-properties":true,media:true,embedding:true,other:true}),C=u({Error:true,TypeError:true,RangeError:true,ReferenceError:true,SyntaxError:true,other:true}),j=u({accept:true,reject:true,reassign:true}),M=u({"open-mount":true,"open-layout":true,command:true,"review-item":true,automation:true}),T=u({insert:true,delete:true,replace:true,moveFrom:true,moveTo:true,format:true,paragraphMark:true,structural:true}),D=u({rPrChange:true,pPrChange:true,sectPrChange:true,tblPrChange:true,tblPrExChange:true,tblGridChange:true,trPrChange:true,tcPrChange:true,numberingChange:true,other:true}),c={kind:new Set(["document.open","edit.rejected","review.skipped","font.failed","history","custom-node","collab.status","collab.participants","performance"]),code:w,outcome:new Set(["opened","rejected"]),origin:new Set(["command","input","automation"]),command:new Set(core.diagnosticCommands()),sizeBucket:/^(?:\d+(?:KiB|MiB)?-\d+(?:KiB|MiB)|512MiB\+)$/,pagesBucket:new Set(["0","1","2-9","10-99","100-999","1000+"]),editorSessionId:/^e_(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,64}|[0-9a-z]{6,12}_[0-9a-z]{1,8})$/,engineVersion:/^(?:development|\d{1,4}\.\d{1,4}\.\d{1,4}(?:-[0-9A-Za-z.]{1,20})?)$/,status:new Set(["initializing","ready","disconnected","error","destroyed"]),previous:new Set(["none","initializing","ready","disconnected","error","destroyed"]),cause:new Set(core.diagnosticCauses()),part:N,errorName:C,stage:M,operation:j,changeKind:T,formattingKind:D},l=new Set(["schemaVersion","time","durationMs","count","repeated","connectMs","participants","windowMs"]),g=new Set(["tracked","recovering"]),m=new Set;function a(t,n=t){m.has(n)||chunkWGWKNKUT_cjs.a()==="production"||(m.add(n),console.warn(`[docx-editor telemetry] ${t}`));}function f(t,n){let i=Object.hasOwn(c,t)?c[t]:void 0;return i?i instanceof RegExp?i.test(n):i.has(n):false}function B(t){let n=t;if(typeof n.kind!="string"||!f("kind",n.kind))return a("dropped an event of an unknown kind; core and telemetry versions may differ","kind"),{dropped:"unknown-kind"};let i=typeof n.code=="string"?n.code:void 0;if(i!==void 0&&!w.has(i))return a("dropped an event with an unknown code; core and telemetry versions may differ","code"),{dropped:"unknown-code"};let o=i?core.explainDiagnostic(i):void 0,r={};for(let[e,s]of Object.entries(n)){if(e==="resource"||e==="attributes")continue;if(e==="shape"){let d=K(s);if(!d)return a('dropped an event whose "shape" is not a valid document shape',"shape"),{dropped:"invalid-field"};r.shape=d;continue}if(I.has(e)){let d=x(s);if(!d)return a(`dropped an event whose "${e}" is not a valid timing summary`,`timing:${e}`),{dropped:"invalid-field"};r[e]=d;continue}if(e==="hint"||e==="docs"){o&&s===o[e]&&(r[e]=s);continue}let R=Object.hasOwn(c,e)||l.has(e)||g.has(e);if(typeof s=="number"&&l.has(e)&&Number.isFinite(s))r[e]=s;else if(typeof s=="boolean"&&g.has(e))r[e]=s;else if(typeof s=="string"&&f(e,s))r[e]=s;else {if(R)return a(`dropped an event whose "${e}" is not a valid value`,`field:${e}`),{dropped:"invalid-field"};a(`dropped the field "${e}", which is not an anonymous diagnostic field`,`extra:${e}`);}}return r.resource=t.resource,r.attributes=t.attributes??{},{event:Object.freeze(r)}}var I=new Set(["interaction","layout","paint"]),y=["count","p50Ms","p95Ms","maxMs"],$=8,h=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0;function x(t){if(!t||typeof t!="object")return null;let n=t,i=[...y,"bands"];if(Object.keys(n).some(e=>!i.includes(e)))return null;let o={};for(let e of y){if(!h(n[e]))return null;o[e]=n[e];}let r=n.bands;return !Array.isArray(r)||r.length!==$||!r.every(h)?null:(o.bands=Object.freeze([...r]),Object.freeze(o))}var b=["parts","paragraphs","reviewItems","embeddedFonts"];function K(t){if(!t||typeof t!="object")return null;let n=t;if(Object.keys(n).some(o=>!b.includes(o)))return null;let i={};for(let o of b){let r=n[o];if(typeof r!="string"||!f("pagesBucket",r))return null;i[o]=r;}return Object.freeze(i)}var k=/^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/,S=/^[A-Za-z0-9_.:+-]{0,64}$/;function F(t,n,i){let o={};for(let[r,e]of Object.entries(t)){if(!k.test(r)||i&&!i.includes(r)){a(`dropped the attribute "${r.slice(0,40)}" on ${n}`,`attribute:${n}:${r}`);continue}typeof e=="number"||typeof e=="boolean"?o[r]=e:typeof e=="string"&&(o[r]=i&&!S.test(e)?"other":e.slice(0,256));}return o}function P(t){if(!t||typeof t!="object"||Array.isArray(t))return;let n={};for(let[i,o]of Object.entries(t))k.test(i)&&(typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o)||typeof o=="string"&&o&&S.test(o))&&(n[i]=o);return Object.keys(n).length?n:void 0}exports.a=B;exports.b=F;exports.c=P;
|
package/dist/chunk-LGNT4I5W.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var e="docx_editor.version",n=[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10,30,60],l=[1024,16*1024,64*1024,256*1024,1024*1024,4*1024*1024,16*1024*1024,64*1024*1024,256*1024*1024,1024*1024*1024],i=[.016,.033,.05,.1,.2,.5,1],c=[1,2,3,5,10,20,50,100,250],p=[1e3,1e4,5e4,1e5,25e4,5e5,1e6],g=[.1,.25,.5,.75,.9,.95,1],d=[60,300,900,3600,4*3600,24*3600,168*3600];function o(t,r,a,m,u=[],s){return Object.freeze({name:t,kind:r,unit:a,description:m,labels:u,...s?{buckets:s}:{}})}var b=Object.freeze({documentOpens:o("docx_editor.document.opens","counter","{open}","Documents opened or refused, by outcome, refusal code, engine reason, and part role.",["outcome","code","cause","part",e]),documentOpenDuration:o("docx_editor.document.open.duration","histogram","s","Time from the start of an open to the laid-out document.",[e],n),editRejections:o("docx_editor.edit.rejections","counter","{edit}","Edits, commands, and tracked changes refused, by public code and engine reason.",["code","cause","origin","tracked",e]),reviewSkipped:o("docx_editor.review.skipped","counter","{change}","Tracked changes skipped by accept, reject, or reassign requests, by engine reason, operation, and change kind.",["code","cause","operation","change_kind",e]),fontFailures:o("docx_editor.font.failures","counter","{failure}","Font faces that failed to load and were substituted.",["code",e]),historyDiagnostics:o("docx_editor.history.diagnostics","counter","{event}","Undo steps that did not group as the gesture intended, by code.",["code",e]),customNodeDiagnostics:o("docx_editor.custom_node.diagnostics","counter","{node}","Custom node payloads that could not be read, by code.",["code",e]),collabClientStatusTransitions:o("docx_editor.collab.client.status_transitions","counter","{transition}","Collaboration status changes on clients, by new status and failure code.",["status","code",e]),collabClientConnectDuration:o("docx_editor.collab.client.connect.duration","histogram","s","Time from an editor attaching a room to its first ready status, when the editor attached before the room was ready.",[e],n),collabClientParticipants:o("docx_editor.collab.client.participants","histogram","{participant}","People in the room, as each client sees it when the count changes.",[e],c),editorInteractionDuration:o("docx_editor.editor.interaction.duration","histogram","s","Key presses and pointer presses on the pages, to the next frame on screen, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",e],i),editorLayoutDuration:o("docx_editor.editor.layout.duration","histogram","s","Engine layout passes after edits and view changes, background work included, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",e],i),editorPaintDuration:o("docx_editor.editor.paint.duration","histogram","s","Engine paints of the pages, by page count bucket. Bucket counts are exact; the sum is estimated from the bands.",["pages",e],i),droppedEvents:o("docx_editor.telemetry.dropped_events","counter","{event}","Events the anonymity guard dropped, by reason. Usually a version mismatch.",["reason",e]),roomsActive:o("docx_editor.collab.rooms.active","gauge","{room}","Rooms loaded."),connectionsActive:o("docx_editor.collab.connections.active","gauge","{connection}","Open client connections. One person with two tabs is two connections."),participantsActive:o("docx_editor.collab.participants.active","gauge","{participant}","People present in all rooms, from awareness states."),roomParticipants:o("docx_editor.collab.room.participants","histogram","{participant}","People present in each room, sampled once per room per interval.",[],c),roomParticipantsMax:o("docx_editor.collab.room.participants.max","gauge","{participant}","People in the fullest room now."),roomMemory:o("docx_editor.collab.room.memory","histogram","By","Bytes each room holds, sampled per room: encoded state, blobs, and updates not yet stored.",["kind"],l),roomsMemory:o("docx_editor.collab.rooms.memory","gauge","By","Bytes all rooms hold together at the last sample.",["kind"]),roomNodes:o("docx_editor.collab.room.nodes","histogram","{node}","Shared document nodes per room, live and tombstoned.",["state"],p),roomResourceUsage:o("docx_editor.collab.room.resource_usage","histogram","1","Share of each room resource limit in use, from 0 to 1.",["resource"],g),roomAge:o("docx_editor.collab.room.age","histogram","s","How long each room has been loaded.",[],d),roomIdle:o("docx_editor.collab.room.idle","histogram","s","Time since each room last changed.",[],d),roomLoadDuration:o("docx_editor.collab.room.load.duration","histogram","s","Time to load a room, by outcome.",["outcome"],n),roomStoreDuration:o("docx_editor.collab.room.store.duration","histogram","s","Time to store a room, by outcome.",["outcome"],n),admissionRejections:o("docx_editor.collab.admission.rejections","counter","{connection}","Connections refused at admission, by reason.",["reason"]),messageRefusals:o("docx_editor.collab.message.refusals","counter","{message}","Messages refused before they applied, by reason, such as room-generation-changed.",["reason"]),updates:o("docx_editor.collab.updates","counter","{update}","Document updates applied to rooms."),updateBytes:o("docx_editor.collab.update.bytes","counter","By","Bytes of document updates applied to rooms."),roomParticipantsByRoom:o("docx_editor.collab.room.participants.current","gauge","{participant}","People in each room, labeled by room. Recorded only with perRoomSeries.",["room"]),roomMemoryByRoom:o("docx_editor.collab.room.memory.current","gauge","By","Bytes each room holds, labeled by room and kind. Recorded only with perRoomSeries.",["room","kind"]),migrations:o("docx_editor.collab.migrations","counter","{room}","Room migrations, by outcome.",["outcome"])}),h={s:"seconds",By:"bytes"};function y(t){let r=t.name.replace(/[^a-zA-Z0-9_]/g,"_"),a=t.unit==="1"?t.kind==="gauge"?"ratio":void 0:h[t.unit];return a&&!r.endsWith(`_${a}`)&&(r+=`_${a}`),t.kind==="counter"&&(r+="_total"),r}exports.a=b;exports.b=y;
|
package/dist/chunk-NUN46EXH.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function u(e,o){return {name:"callback",event:e,...o?{metric:o}:{}}}function n(e){let o=e,r=["operation","changeKind","formattingKind","cause","errorName","stage","part"].map(t=>o[t]).filter(t=>typeof t=="string");return r.length?` [${r.join(", ")}]`:""}function i(e){let o=e.repeated?` (and ${e.repeated} more)`:"";switch(e.kind){case "document.open":return e.outcome==="rejected"?`document refused: ${e.code}${n(e)}`:e.pagesBucket===void 0?`document opened: ${e.sizeBucket}, ${e.durationMs} ms`:`document opened: ${e.pagesBucket} pages, ${e.sizeBucket}, ${e.durationMs} ms`;case "edit.rejected":{let r=e.command?`${e.origin} ${e.command}`:e.origin;return `edit refused: ${e.code}${n(e)} (${r}, ${e.tracked?"tracked":"untracked"})${o}`}case "review.skipped":return `tracked changes skipped: ${e.code}${n(e)} x${e.count}`;case "font.failed":return `font substituted: ${e.code}${o}`;case "history":return `undo history: ${e.code}${o}`;case "custom-node":return `custom node payload unreadable: ${e.code}${o}`;case "collab.participants":return `collaboration: ${e.count} ${e.count===1?"person":"people"} in the room`;case "collab.status":{let r=e.code?`: ${e.code}`:"",t=e.connectMs!==void 0?` after ${e.connectMs} ms`:"";return `collaboration ${e.status}${r}${e.recovering?" (recovering)":""}${t}`}case "performance":{let r=[c("key presses and clicks",e.interaction),c("layout",e.layout),c("paint",e.paint)].filter(Boolean),t=e.pagesBucket===void 0?"":`, ${e.pagesBucket} pages`;return `performance over ${Math.round(e.windowMs/1e3)} s${t}: ${r.join("; ")}`}}}function c(e,o){return o?`${e} p50 ${o.p50Ms} ms, p95 ${o.p95Ms} ms, max ${o.maxMs} ms (x${o.count})`:""}function a(e){if(e.repeated!==void 0)return false;switch(e.kind){case "document.open":return e.outcome==="rejected";case "collab.participants":case "history":case "performance":return false;case "collab.status":return e.status==="error"&&e.code!=="collab.authentication-failed"&&e.code!=="collab.room-generation-changed";case "edit.rejected":return !s.has(e.code);case "font.failed":return e.code!=="font.missing";case "review.skipped":return e.code!=="review.stale-revision";default:return true}}var s=new Set(["edit.stale-target","edit.read-only","edit.protected-content","edit.refresh-in-progress","edit.collaboration-not-ready"]);function l(e={}){let o=e.console??console;return {name:"console",event(r){let t=[`[docx-editor] ${i(r)}`];r.hint&&t.push(` ${r.hint}`),r.docs&&t.push(` ${r.docs}`),(a(r)||r.kind==="performance"&&r.code!==void 0?o.warn:o.info).call(o,t.join(`
|
|
2
|
-
`));},...e.metrics?{metric(r){o.info(`[docx-editor] ${r.definition.name} ${r.value}`,r.attributes);}}:{}}}function p(){let e=[],o=[];return {name:"memory",events:e,metrics:o,event:r=>{e.push(r);},metric:r=>{o.push(r);},clear(){e.length=0,o.length=0;}}}export{u as a,i as b,a as c,l as d,p as e};
|
package/dist/chunk-S7KBMROA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-73YEPWY5.js';import {b,a}from'./chunk-DTEVX2XS.js';var A=50,R="2.29.0";function M(o){let i=[...o.exporters],T=Object.freeze({...b(o.resource??{},"resource")}),d=[...o.metricLabels??[]],m=new Map,b$1=new Set;function y(e){if(d.length===0)return e;let r={...e};for(let t of d){let n=r[t];if(n===void 0)continue;let s=String(n),a=m.get(t);if(a||m.set(t,a=new Set),!a.has(s)){if(a.size>=A){r[t]="other";continue}a.add(s);}}return r}let f=false;function p(e,r){if(!b$1.has(r)){b$1.add(r);try{if(o.onExporterError){let t=o.onExporterError(e,r);t&&typeof t.then=="function"&&Promise.resolve(t).catch(()=>{});}else console.warn(`[docx-editor telemetry] exporter "${r}" failed`,e);}catch{}}}function c(e,r){try{let t=r();if(!t||typeof t.then!="function")return;Promise.resolve(t).then(void 0,n=>p(n,e.name));}catch(t){p(t,e.name);}}function v(){let e=o.consent??true;if(typeof e=="boolean")return e;try{return e()===!0}catch{return false}}function u(){return !f&&v()}let E=false,_=()=>E||globalThis.document?.visibilityState==="hidden";for(let e of i)c(e,()=>e.attach?.({consented:v,pageClosing:_}));async function g(e){await Promise.all(i.map(async r=>{try{await e(r);}catch(t){p(t,r.name);}}));}return {resource:T,consented:u,event(e){if(!u())return;let r=a(e);if("dropped"in r){this.metric(a$1.droppedEvents,1,{reason:r.dropped});return}for(let t of i)t.event&&c(t,()=>t.event(r.event));},metric(e,r,t={}){if(!u()||!Number.isFinite(r))return;let n={definition:e,value:r,attributes:y(b(t,e.name,[...e.labels,...d]))};for(let s of i)s.metric&&c(s,()=>s.metric(n));},forget(e,r){let t=b(r,e.name,e.labels);for(let n of i)n.forget&&c(n,()=>n.forget(e,t));},declare(e,r={}){if(!u())return;let t=y(b(r,e.name,[...e.labels,...d]));for(let n of i)n.declare&&c(n,()=>n.declare(e,t));},flush:()=>g(e=>e.flush?.()),setPageClosing(e){E=e;},async shutdown(){f||(f=true,await g(e=>e.shutdown?e.shutdown():e.flush?.()));}}}export{A as a,R as b,M as c};
|
package/dist/chunk-UK2MNJCG.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';function u(e,o){return {name:"callback",event:e,...o?{metric:o}:{}}}function n(e){let o=e,r=["operation","changeKind","formattingKind","cause","errorName","stage","part"].map(t=>o[t]).filter(t=>typeof t=="string");return r.length?` [${r.join(", ")}]`:""}function i(e){let o=e.repeated?` (and ${e.repeated} more)`:"";switch(e.kind){case "document.open":return e.outcome==="rejected"?`document refused: ${e.code}${n(e)}`:e.pagesBucket===void 0?`document opened: ${e.sizeBucket}, ${e.durationMs} ms`:`document opened: ${e.pagesBucket} pages, ${e.sizeBucket}, ${e.durationMs} ms`;case "edit.rejected":{let r=e.command?`${e.origin} ${e.command}`:e.origin;return `edit refused: ${e.code}${n(e)} (${r}, ${e.tracked?"tracked":"untracked"})${o}`}case "review.skipped":return `tracked changes skipped: ${e.code}${n(e)} x${e.count}`;case "font.failed":return `font substituted: ${e.code}${o}`;case "history":return `undo history: ${e.code}${o}`;case "custom-node":return `custom node payload unreadable: ${e.code}${o}`;case "collab.participants":return `collaboration: ${e.count} ${e.count===1?"person":"people"} in the room`;case "collab.status":{let r=e.code?`: ${e.code}`:"",t=e.connectMs!==void 0?` after ${e.connectMs} ms`:"";return `collaboration ${e.status}${r}${e.recovering?" (recovering)":""}${t}`}case "performance":{let r=[c("key presses and clicks",e.interaction),c("layout",e.layout),c("paint",e.paint)].filter(Boolean),t=e.pagesBucket===void 0?"":`, ${e.pagesBucket} pages`;return `performance over ${Math.round(e.windowMs/1e3)} s${t}: ${r.join("; ")}`}}}function c(e,o){return o?`${e} p50 ${o.p50Ms} ms, p95 ${o.p95Ms} ms, max ${o.maxMs} ms (x${o.count})`:""}function a(e){if(e.repeated!==void 0)return false;switch(e.kind){case "document.open":return e.outcome==="rejected";case "collab.participants":case "history":case "performance":return false;case "collab.status":return e.status==="error"&&e.code!=="collab.authentication-failed"&&e.code!=="collab.room-generation-changed";case "edit.rejected":return !s.has(e.code);case "font.failed":return e.code!=="font.missing";case "review.skipped":return e.code!=="review.stale-revision";default:return true}}var s=new Set(["edit.stale-target","edit.read-only","edit.protected-content","edit.refresh-in-progress","edit.collaboration-not-ready"]);function l(e={}){let o=e.console??console;return {name:"console",event(r){let t=[`[docx-editor] ${i(r)}`];r.hint&&t.push(` ${r.hint}`),r.docs&&t.push(` ${r.docs}`),(a(r)||r.kind==="performance"&&r.code!==void 0?o.warn:o.info).call(o,t.join(`
|
|
2
|
-
`));},...e.metrics?{metric(r){o.info(`[docx-editor] ${r.definition.name} ${r.value}`,r.attributes);}}:{}}}function p(){let e=[],o=[];return {name:"memory",events:e,metrics:o,event:r=>{e.push(r);},metric:r=>{o.push(r);},clear(){e.length=0,o.length=0;}}}exports.a=u;exports.b=i;exports.c=a;exports.d=l;exports.e=p;
|