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
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:
35
packages/telemetry/README.md
Normal file
35
packages/telemetry/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# @univerjs/telemetry
|
||||
|
||||
[](https://npmjs.com/package/@univerjs/telemetry)
|
||||
[](https://npmjs.com/package/@univerjs/telemetry)
|
||||
[](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)
|
||||
74
packages/telemetry/package.json
Normal file
74
packages/telemetry/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
17
packages/telemetry/src/index.ts
Normal file
17
packages/telemetry/src/index.ts
Normal 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';
|
||||
79
packages/telemetry/src/services/telemetry.service.ts
Normal file
79
packages/telemetry/src/services/telemetry.service.ts
Normal 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');
|
||||
8
packages/telemetry/tsconfig.json
Normal file
8
packages/telemetry/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@univerjs-infra/shared/tsconfigs/base",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "lib/types"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
18
packages/telemetry/tsconfig.node.json
Normal file
18
packages/telemetry/tsconfig.node.json
Normal 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"
|
||||
]
|
||||
}
|
||||
3
packages/telemetry/vitest.config.ts
Normal file
3
packages/telemetry/vitest.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import createConfig from '@univerjs-infra/shared/vitest';
|
||||
|
||||
export default createConfig();
|
||||
Reference in New Issue
Block a user