lib/webVitals/schemas
Type Aliases
'Read the “', Type Aliases, '” section'CoreWebVitalsMetricType
'Read the “', CoreWebVitalsMetricType, '” section'type CoreWebVitalsMetricType = "CLS" | "INP" | "LCP";
Defined in: studiocms/packages/studiocms/src/lib/webVitals/schemas.ts:38
Type definition for Core Web Vitals metrics.
This type is inferred from the CoreWebVitalsMetricTypeSchema
schema using Zod.
It represents the structure of the core web vitals metrics used in the application.
WebVitalsMetricType
'Read the “', WebVitalsMetricType, '” section'type WebVitalsMetricType = "CLS" | "INP" | "LCP" | "FCP" | "FID" | "TTFB";
Defined in: studiocms/packages/studiocms/src/lib/webVitals/schemas.ts:62
Represents the type for Web Vitals metrics.
This type is inferred from the WebVitalsMetricTypeSchema
using Zod’s infer
utility.
It is used to ensure that the metrics conform to the schema defined for Web Vitals.
WebVitalsMetricTypeSchema
WebVitalsRating
'Read the “', WebVitalsRating, '” section'type WebVitalsRating = "good" | "needs-improvement" | "poor";
Defined in: studiocms/packages/studiocms/src/lib/webVitals/schemas.ts:17
Type representing the inferred type of the WebVitalsRatingSchema.
This type is generated using the z.infer
utility from the zod
library.
Variables
'Read the “', Variables, '” section'CoreWebVitalsMetricTypeSchema
'Read the “', CoreWebVitalsMetricTypeSchema, '” section'const CoreWebVitalsMetricTypeSchema: ZodEnum<CoreWebVitalsMetricType>;
Defined in: studiocms/packages/studiocms/src/lib/webVitals/schemas.ts:29
Enum schema for Core Web Vitals metric types.
This schema defines the allowed values for Core Web Vitals metrics:
CLS
: Cumulative Layout ShiftINP
: Interaction to Next PaintLCP
: Largest Contentful Paint
These metrics are used to measure the performance and user experience of web pages.
MetricSummaryRowSchema
'Read the “', MetricSummaryRowSchema, '” section'const MetricSummaryRowSchema: ZodTuple<[ZodUnion<[ZodEnum<["CLS", "INP", "LCP"]>, ZodEnum<["FCP", "FID", "TTFB"]>]>, ZodEnum<["good", "needs-improvement", "poor"]>, ZodNumber, ZodNumber], null>;
Defined in: studiocms/packages/studiocms/src/lib/webVitals/schemas.ts:99
Schema for a summary row of web vitals metrics.
The tuple consists of:
WebVitalsMetricTypeSchema
: The type of web vitals metric.WebVitalsRatingSchema
: The rating of the web vitals metric.value
: A number representing the value of the metric, must be greater than or equal to 0.density
: A number representing the density of the metric, must be greater than or equal to 0.rating end
: A boolean indicating the end of the rating, derived from a union of 0 and 1.percentile
: A number representing the percentile of the metric, or null.sample size
: A number representing the sample size.
RouteSummaryRowSchema
'Read the “', RouteSummaryRowSchema, '” section'const RouteSummaryRowSchema: ZodTuple<[ZodString, ZodEnum<["CLS", "INP", "LCP"]>, ZodEnum<["good", "needs-improvement", "poor"]>, ZodNumber, ZodNumber], null>;
Defined in: studiocms/packages/studiocms/src/lib/webVitals/schemas.ts:74
Schema for summarizing route metrics.
This schema defines a tuple with the following elements:
- Route path (string)
- Core web vitals metric type (CoreWebVitalsMetricTypeSchema)
- Web vitals rating (WebVitalsRatingSchema)
- Value (number, must be greater than or equal to 0)
- Sample size (number)
WebVitalsMetricTypeSchema
'Read the “', WebVitalsMetricTypeSchema, '” section'const WebVitalsMetricTypeSchema: ZodUnion<WebVitalsMetricType>;
Defined in: studiocms/packages/studiocms/src/lib/webVitals/schemas.ts:50
Schema for Web Vitals Metric Types.
This schema combines the CoreWebVitalsMetricTypeSchema
with an enumeration
of additional metric types: ‘FCP’, ‘FID’, and ‘TTFB’.
FCP
: First Contentful PaintFID
: First Input DelayTTFB
: Time to First Byte
WebVitalsRatingSchema
'Read the “', WebVitalsRatingSchema, '” section'const WebVitalsRatingSchema: ZodEnum<WebVitalsRating>;
Defined in: studiocms/packages/studiocms/src/lib/webVitals/schemas.ts:11
Enum schema for Web Vitals rating.
This schema defines the possible ratings for Web Vitals:
- ‘good’: Indicates that the web vitals are performing well.
- ‘needs-improvement’: Indicates that the web vitals need improvement.
- ‘poor’: Indicates that the web vitals are performing poorly.