snapshot of https://github.com/dream-num/univer.git (dev, 2026-09-16; blobs > 131072B omitted)
Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-16 05:09:45 +05:00
commit bcf6ef63ad
7118 changed files with 1236854 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
# @univerjs/telemetry
[![npm version](https://img.shields.io/npm/v/@univerjs/telemetry?style=flat-square)](https://npmjs.com/package/@univerjs/telemetry)
[![license](https://img.shields.io/npm/l/@univerjs/telemetry?style=flat-square)](https://npmjs.com/package/@univerjs/telemetry)
[![downloads](https://img.shields.io/npm/dm/@univerjs/telemetry?style=flat-square)](https://npmjs.com/package/@univerjs/telemetry)
`@univerjs/telemetry` defines the telemetry service interface used by Univer packages. Applications can implement and register this service to collect usage or diagnostic events.
## Package Overview
| Package | UMD global | CSS | Locales | Facade entry |
| --- | --- | :---: | :---: | :---: |
| `@univerjs/telemetry` | `UniverTelemetry` | No | No | No |
## Installation
```sh
pnpm add @univerjs/telemetry
# or
npm install @univerjs/telemetry
```
Keep all `@univerjs/*` packages on the same version.
## Usage
```ts
import { ITelemetryService } from '@univerjs/telemetry';
```
## Resources
- [Documentation](https://docs.univer.ai)
- [NPM package](https://npmjs.com/package/@univerjs/telemetry)
- [GitHub repository](https://github.com/dream-num/univer)

View File

@@ -0,0 +1,74 @@
{
"name": "@univerjs/telemetry",
"version": "1.0.0-rc.0",
"private": false,
"description": "Telemetry service interface for Univer packages.",
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
"license": "Apache-2.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/univer"
},
"homepage": "https://univer.ai",
"repository": {
"type": "git",
"url": "https://github.com/dream-num/univer"
},
"bugs": {
"url": "https://github.com/dream-num/univer/issues"
},
"keywords": [
"univer",
"telemetry",
"analytics",
"events",
"service"
],
"exports": {
".": "./src/index.ts",
"./*": "./src/*"
},
"main": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"publishConfig": {
"access": "public",
"main": "./lib/es/index.js",
"module": "./lib/es/index.js",
"exports": {
".": {
"import": "./lib/es/index.js",
"require": "./lib/cjs/index.js",
"types": "./lib/types/index.d.ts"
},
"./*": {
"import": "./lib/es/*",
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
"./lib/*": "./lib/*"
}
},
"directories": {
"lib": "lib"
},
"files": [
"lib"
],
"scripts": {
"test": "vitest run",
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"typecheck": "tsc --noEmit",
"build:bundle": "univer-cli build",
"build:types": "tsc -p tsconfig.node.json",
"build": "pnpm run build:bundle && pnpm run build:types"
},
"dependencies": {
"@univerjs/core": "workspace:*"
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"typescript": "^6.0.3",
"vitest": "^5.0.0"
}
}

View File

@@ -0,0 +1,17 @@
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './services/telemetry.service';

View File

@@ -0,0 +1,79 @@
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createIdentifier } from '@univerjs/core';
/**
* Univer telemetry service interface. You should implement this interface to track telemetry data.
*/
export interface ITelemetryService {
/**
* Enable the debug mode.
*/
debug: () => void;
/**
* Initialize the telemetry service.
* @param token
* @param options
*/
init: (options?: object) => void;
/**
* Identify the user.
* @param id
* @param params
* @returns
*/
identify: (id: string, params?: object) => void;
/**
* Reset the user.
*/
reset(): void;
/**
* Track the event.
* @param eventName
* @param params
*/
capture: (eventName: string, params?: object) => void;
/**
* Start the timer.
* @param functionName
*/
startTime: (functionName: string) => void;
/**
* End the timer.
* @param functionName
*/
endTime: (functionName: string) => void;
/**
* Track the performance event.
* @param params
*/
trackPerformance: (params: {
duration: number;
functionName: string;
[prop: string]: unknown;
}) => void;
/**
* Track the page view.
* @param url
*/
onPageView: (url: string) => void;
};
/**
* Univer telemetry service identifier.
*/
export const ITelemetryService = createIdentifier<ITelemetryService>('telemetry.service');

View File

@@ -0,0 +1,8 @@
{
"extends": "@univerjs-infra/shared/tsconfigs/base",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/types"
},
"include": ["src"]
}

View File

@@ -0,0 +1,18 @@
{
"extends": "@univerjs-infra/shared/tsconfigs/node",
"compilerOptions": {
"rootDir": "src",
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"outDir": "lib/types"
},
"include": [
"src"
],
"exclude": [
"src/**/__tests__/**",
"src/**/*.spec.ts",
"src/**/*.test.ts"
]
}

View File

@@ -0,0 +1,3 @@
import createConfig from '@univerjs-infra/shared/vitest';
export default createConfig();