@graphysdk/telemetry 1.8.1-beta.1787065194945 → 1.8.1-beta.1787132472323
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 +20 -26
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
# @graphysdk/telemetry
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
from viz-engine's public compiler output (`CompiledSpec` / `CompileResult`) — it does **not** modify or
|
|
5
|
-
depend on viz-engine internals, and it never touches the network, storage, or timers.
|
|
3
|
+
Optional usage events from a compiled Graphy chart. This package never sends data anywhere — you subscribe and decide what to do with each event.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
these events — not in this package.
|
|
5
|
+
Events carry counts and flags only. They never include your data values, column names, or labels.
|
|
9
6
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
- [Quickstart](https://docs.graphy.dev/sdk-next/quickstart)
|
|
7
|
+
## Install
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
effect is the subscriber's job.
|
|
18
|
-
- **Anonymised by construction.** Every payload carries only counts, enums, and booleans derived from
|
|
19
|
-
`CompiledSpec`. Data values, column names/labels, annotation content, and formatted strings never
|
|
20
|
-
cross the boundary. An allowlist test asserts no dataset string leaks into a serialized event.
|
|
21
|
-
- **Zero-overhead when unused.** Don't wire an emitter and nothing happens. `emit` is also a no-op when
|
|
22
|
-
disabled or when nobody is subscribed.
|
|
23
|
-
- **Listener isolation.** A throwing subscriber can never break the caller — each listener call is
|
|
24
|
-
wrapped in `try/catch`.
|
|
25
|
-
- **Leak-safe subscriptions.** `subscribe` returns a `VizTelemetrySubscription` (with `unsubscribe()`,
|
|
26
|
-
a `closed` flag, and `[Symbol.dispose]` for `using`).
|
|
9
|
+
```bash
|
|
10
|
+
npm install @graphysdk/telemetry
|
|
11
|
+
```
|
|
27
12
|
|
|
28
13
|
## Usage
|
|
29
14
|
|
|
@@ -31,17 +16,26 @@ these events — not in this package.
|
|
|
31
16
|
import { createCompiler } from '@graphysdk/viz-engine';
|
|
32
17
|
import { createTelemetryEmitter, emitCompileEvents } from '@graphysdk/telemetry';
|
|
33
18
|
|
|
34
|
-
const telemetry = createTelemetryEmitter();
|
|
19
|
+
const telemetry = createTelemetryEmitter();
|
|
35
20
|
const subscription = telemetry.subscribe((event) => {
|
|
36
|
-
//
|
|
21
|
+
// send or record the event yourself
|
|
37
22
|
});
|
|
38
23
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
emitCompileEvents(telemetry, result, 'compile'); // 'compile' | 'recompile' | 'command'
|
|
24
|
+
const result = createCompiler().compile({ input, data });
|
|
25
|
+
emitCompileEvents(telemetry, result, 'compile');
|
|
42
26
|
|
|
43
27
|
subscription.unsubscribe();
|
|
44
28
|
```
|
|
45
29
|
|
|
30
|
+
`createTelemetryEmitter` accepts `{ chartInstanceId, engineVersion, enabled }`. Pass `'compile'`, `'recompile'`, or `'command'` as the third argument to `emitCompileEvents`.
|
|
31
|
+
|
|
32
|
+
## Docs
|
|
33
|
+
|
|
34
|
+
- [Quickstart](https://docs.graphy.dev/sdk-next/quickstart)
|
|
35
|
+
|
|
46
36
|
In a React host, subscribe to a `GraphHandle` (`handle.subscribe()` + `handle.getCompiled()`) and
|
|
47
37
|
call `deriveChartShape` / `emitCompileEvents` from the listener.
|
|
38
|
+
|
|
39
|
+
## Support
|
|
40
|
+
|
|
41
|
+
Questions and community help: [Discord](https://discord.gg/yGmYCjkSr).
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var m="1.8.1-beta.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var m="1.8.1-beta.1787132472323",u=0;function y(e={}){f();const{chartInstanceId:t=b(),engineVersion:s=m,enabled:i=!0}=e,r=new Set;return{chartInstanceId:t,engineVersion:s,emit:a=>{if(!i||r.size===0)return;const o=[...r];for(const n of o)try{n(a)}catch{}},subscribe:a=>{r.add(a);let o=!1;const n=()=>{o||(o=!0,r.delete(a))};return{get closed(){return o},unsubscribe:n,[Symbol.dispose]:n}}}}var b=()=>`${Math.random().toString(36).slice(2,6)}${(u+=1).toString(36)}`,f=()=>{Symbol.dispose??=Symbol.for("Symbol.dispose")};function p(e){const{layers:t,coordSystem:s,scales:i,guides:r,annotations:l,spec:d}=e,a=r.colorGroups.length>0?r.colorGroups.length:null,o=t.reduce((n,g)=>n+g.data.size(),0);return{layerCount:t.length,geoms:t.map(n=>n.geom),positions:v(t.map(n=>n.position)),coordSystem:s.type,...s.type==="cartesian"?{mainAxis:s.mainAxis}:{},scaleAesthetics:Object.keys(i),seriesCount:a,observationCount:o,hasSecondaryAxis:t.some(n=>n.yScaleType==="secondary"),features:{headline:r.headline!==null,legend:r.legends.drawn.length>0,visibleAxes:r.axes.filter(n=>n.isVisible).length,dataLabels:t.some(n=>n.dataLabels.showDataLabels),highlights:d.highlights.length,annotations:C(l)}}}function S(e,t,s){if(!e)return;const i=h(e);if(t.ok){e.emit({...i,type:"chart.compiled",trigger:s,chart:p(t.compiled),warningCodes:c(t.warnings)});return}e.emit({...i,type:"chart.compile_failed",trigger:s,errorCodes:c(t.errors),warningCodes:c(t.warnings)})}function A(e,t,s){e&&e.emit({...h(e),type:"command.applied",commandType:t.type,transient:s})}var c=e=>e.map(t=>t.code),v=e=>[...new Set(e)],C=e=>({differenceArrows:e.differenceArrows.length,shapes:e.shapes.length,freeformArrows:e.arrows.length,textAnnotations:e.textAnnotations.length,images:e.images.length,stickers:e.stickers.length,pinnedNumbers:e.pinnedNumbers.length,comments:e.comments.length}),h=e=>({timestamp:Date.now(),engineVersion:e.engineVersion,chartInstanceId:e.chartInstanceId});exports.PACKAGE_VERSION=m;exports.createTelemetryEmitter=y;exports.deriveChartShape=p;exports.emitCommandApplied=A;exports.emitCompileEvents=S;
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"chart",
|
|
12
12
|
"events"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.8.1-beta.
|
|
14
|
+
"version": "1.8.1-beta.1787132472323",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@graphysdk/viz-engine": "1.8.1-beta.
|
|
32
|
+
"@graphysdk/viz-engine": "1.8.1-beta.1787132472323"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@rollup/plugin-replace": "^6.0.3",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"vite": "^8.1.5",
|
|
39
39
|
"vite-plugin-dts": "^4.5.4",
|
|
40
40
|
"vitest": "^4.1.0",
|
|
41
|
-
"@graphysdk/viz-engine": "1.8.1-beta.
|
|
41
|
+
"@graphysdk/viz-engine": "1.8.1-beta.1787132472323",
|
|
42
42
|
"@graphytools/eslint-config": "0.0.1",
|
|
43
43
|
"@graphytools/eslint-plugin-graphy": "1.0.0",
|
|
44
44
|
"@graphytools/typescript-config": "0.0.1",
|