@verisure-italy/shared-types

v1.7.2

Published

Shared TypeScript types for Verisure Italy projects

Readme

Shared Types

Internal Verisure Italy package

License

  • @verisure-italy/aaa-types (extends with timestamp fields)
  • @verisure-italy/alis-types (embeds timestampFieldsSchema, zipCodeSchema, leadUserAgentInfoSchema)
  • @verisure-italy/overbooking-types (uses timestampFieldsSchema, zipCodeSchema, daysOfWeek)

Related Packages

  • Reuse enums: dayOfWeekSchema inside arrays or discriminated unions.
  • Pick: leadUserAgentInfoSchema.pick({ browser: true })
  • Compose: otherSchema.extend(timestampFieldsSchema.shape)

Usage Patterns

}
  return leadUserAgentInfoSchema.safeParse(data).success
function isUA(data: unknown): data is LeadUserAgentInfo {

import { leadUserAgentInfoSchema, type LeadUserAgentInfo } from '@verisure-italy/shared-types'
```typescript
Structured browser/device environment.
### Lead User Agent Info

} updatedAt: number createdAt: number interface TimestampFields {

Type:

const withTimestamps = base.extend(timestampFieldsSchema.shape) const base = z.object({ id: z.uuid() })

import { timestampFieldsSchema } from '@verisure-italy/shared-types'

Used to extend other schemas with creation/update metadata.
### Timestamp Fields

console.log(daysOfWeek) // ['sunday', 'monday', ...]

import { dayOfWeekSchema, daysOfWeek, type DayOfWeek } from '@verisure-italy/shared-types'

### Day Of Week

Validation: exactly 5 digits (string).

} const value: ZipCode = result.data // '20100' if (result.success) { const result = zipCodeSchema.safeParse('20100')

import { zipCodeSchema, type ZipCode } from '@verisure-italy/shared-types'

### Zip Code

## Core Schemas & Types

pnpm add @verisure-italy/shared-types


## Installation

- ✅ Composable: extend or embed in service-specific schemas
- ✅ Pure TypeScript + Zod (v4) runtime validation
- ✅ User agent structured schema
- ✅ Timestamp fields for auditability
- ✅ Common value objects (zip code, day of week)

## Features

Foundation TypeScript types and Zod schemas reused across Verisure Italy services. These primitives enable consistent modeling and runtime validation.