@verisure-italy/shared-types
v1.9.1
Published
Shared TypeScript types for Verisure Italy projects
Readme
@verisure-italy/shared-types
Shared primitives reused across the domain packages in this monorepo: value objects, small enums, and composable Zod schemas.
Installation
pnpm add @verisure-italy/shared-typesMain Exports
zipCodeSchemaandtype ZipCodedayOfWeekSchema,daysOfWeek, andtype DayOfWeektimestampFieldsSchemaandtype TimestampFieldsleadUserAgentInfoSchemaandtype LeadUserAgentInfo
What This Package Gives You
- a canonical ZIP-code value object
- a reusable day-of-week enum
- standard timestamp fields for persistence models
- a structured user-agent payload for lead-related domains
Schema Inventory
| Schema | Type alias | Kind | Purpose |
| --- | --- | --- | --- |
| zipCodeSchema | ZipCode | string schema | Five-digit ZIP code primitive |
| dayOfWeekSchema | DayOfWeek | enum | Weekday catalog |
| timestampFieldsSchema | TimestampFields | object schema | Shared persistence timestamps |
| leadUserAgentInfoSchema | LeadUserAgentInfo | object schema | Structured device and browser metadata |
Schema Reference
zipCodeSchema
| Rule | Value |
| --- | --- |
| Type | string |
| Required | Yes |
| Validation | Must match ^\d{5}$ |
dayOfWeekSchema
Values:
sundaymondaytuesdaywednesdaythursdayfridaysaturday
timestampFieldsSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| createdAt | number | Yes | Unix timestamp stored as a number |
| updatedAt | number | Yes | Unix timestamp stored as a number |
leadUserAgentInfoSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| cpu.architecture | string \| null | Yes (nullable) | CPU architecture |
| ua | string | Yes | Raw user-agent string |
| os.name | string | Yes | Operating-system name |
| os.version | string | Yes | Operating-system version |
| engine.name | string | Yes | Browser engine name |
| engine.version | string | Yes | Browser engine version |
| browser.name | string | Yes | Browser name |
| browser.version | string | Yes | Browser version |
| device.type | string \| null | Yes (nullable) | Device family when available |
| device.model | string | Yes | Device model |
| device.vendor | string | Yes | Device vendor |
Example
import { z } from 'zod'
import {
timestampFieldsSchema,
zipCodeSchema,
} from '@verisure-italy/shared-types'
const customerSchema = z.object({
id: z.uuid(),
zipCode: zipCodeSchema,
}).extend(timestampFieldsSchema.shape)