-
Notifications
You must be signed in to change notification settings - Fork 14
feat(quality-insights): added quality-insights package #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new quality-insights package to the monorepo, including build configuration, TypeScript setup, core utilities, API services, and package metadata.
- Registers
packages/quality-insightsinship.config.mjs - Adds Vite and TS configuration plus initial source files (utils, schema, services)
- Creates
package.json,.env, and.gitignorefor the new package
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| ship.config.mjs | Registers new package and version update hook |
| packages/quality-insights/vite.config.js | Configures Vite build and alias for the library |
| packages/quality-insights/tsconfig.json | TypeScript compiler settings for the package |
| packages/quality-insights/src/version.ts | Initializes package version export |
| packages/quality-insights/src/utils/keysOfBodyToCamelToSnake.ts | Adds utility to convert camelCase keys to snake_case |
| packages/quality-insights/src/shared/schema/telemetry.ts | Defines request/response schemas with Zod |
| packages/quality-insights/src/shared/lib/zod.ts | Implements safe parsing helper wrappers |
| packages/quality-insights/src/shared/lib/Result.ts | Introduces a Result type for operations |
| packages/quality-insights/src/api/TelemetryAPI.ts | Implements the telemetry API service |
| packages/quality-insights/src/api/BaseService.ts | Core HTTP service with GET/POST methods |
| packages/quality-insights/src/main.ts | Exposes public API exports |
| packages/quality-insights/package.json | Package metadata and scripts |
| packages/quality-insights/index.html | Development HTML entry |
| packages/quality-insights/.gitignore | Ignored files for the package |
| packages/quality-insights/.env.staging | Staging environment variables |
| packages/quality-insights/.env.production | Production environment variables |
Comments suppressed due to low confidence (3)
packages/quality-insights/src/utils/keysOfBodyToCamelToSnake.ts:1
- [nitpick] The filename and function name are verbose and a bit inconsistent. Consider renaming the file to 'snakeCaseKeys.ts' and the function to 'toSnakeCase' for clarity.
function camelToSnake(str: string): string {
| @@ -0,0 +1 @@ | |||
| export default '6.14.3' | |||
Copilot
AI
May 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded version does not match the package.json version (0.1.0-alpha.0). Either initialize it to the same version or let the versionUpdated hook overwrite it at publish time.
| export const safeParseAsync = async <TOutput, TInput>( | ||
| schema: ZodSchema<TOutput, ZodTypeDef, TInput> | undefined, | ||
| data: unknown | ||
| ): Promise<SafeParseReturnType<TInput, TOutput>> => { |
Copilot
AI
May 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generic parameters for SafeParseReturnType appear inverted. It should likely be SafeParseReturnType<TOutput, TInput> to reflect parsing output as TOutput.
| ): Promise<SafeParseReturnType<TInput, TOutput>> => { | |
| ): Promise<SafeParseReturnType<TOutput, TInput>> => { |
| "vite": "^6.3.1", | ||
| "zod": "^3.24.3" | ||
| }, | ||
| "dependencies": { | ||
| "vite-plugin-dts": "^4.5.3" |
Copilot
AI
May 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zod is imported at runtime in your schemas, so it should be listed under 'dependencies' rather than 'devDependencies' to ensure it’s included in production installs.
| "vite": "^6.3.1", | |
| "zod": "^3.24.3" | |
| }, | |
| "dependencies": { | |
| "vite-plugin-dts": "^4.5.3" | |
| "vite": "^6.3.1" | |
| }, | |
| "dependencies": { | |
| "vite-plugin-dts": "^4.5.3", | |
| "zod": "^3.24.3" |
| } | ||
|
|
||
| public async sendEvent(body: TelemetryRequest, options?: RequestInit) { | ||
| const parseResult = await safeParseAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that zod isn't bundled into the production bundle? I wish we could add size-limit here just to be sure that it will not be bundled in the future.
Description
Checklist