@verisure-italy/alis-types
v1.7.13
Published
Types for ALIS service
Readme
@verisure-italy/alis-types
Domain contracts for the ALIS service: leads, blacklist rules, channels, sources, suppliers, and enrichment-related payloads.
Installation
pnpm add @verisure-italy/alis-typesMain Exports
blacklistScopes,channelTypes,sourceTypes, andleadProvenances- enums for
blacklistScope,channelType,sourceType, andleadProvenance blacklistSchemaandwritableBlacklistSchemachannelSchemaandwritableChannelSchemaenrichmentSettingsSchemaandwritableEnrichmentSettingsSchemaleadSchema,writableLeadSchema, andleadDetailsSchemapropertySchema,sourceSchemas,supplierSchema, and writable variants
What This Package Gives You
- persistence models for ALIS master data
- writable input variants for create and update flows
- a richer lead-details shape for read models
- embedded enrichment and overbooking metadata
Schema Inventory
| Schema | Type alias | Kind | Purpose |
| --- | --- | --- | --- |
| blacklistScopeSchema | BlacklistScope | enum | Supported blacklist scopes |
| channelTypeSchema | ChannelType | enum | Channel transport type |
| sourceTypeSchema | SourceType | enum | Source type |
| leadProvenanceSchema | LeadProvenance | enum | Lead provenance |
| overbookingDataSchema | OverbookingData | object schema | Embedded overbooking metadata |
| enrichmentDataSchema | EnrichmentData | object schema | Embedded enrichment metadata |
| blacklistSchema | Blacklist | object schema | Persisted blacklist rule |
| writableBlacklistSchema | WritableBlacklist | object schema | Writable blacklist payload |
| channelSchema | Channel | object schema | Persisted channel |
| writableChannelSchema | WritableChannel | object schema | Writable channel payload |
| enrichmentSettingsSchema | EnrichmentSettings | object schema | Persisted enrichment settings |
| writableEnrichmentSettingsSchema | WritableEnrichmentSettings | object schema | Writable enrichment settings payload |
| leadSchema | Lead | object schema | Persisted lead |
| writableLeadSchema | WritableLead | object schema | Writable lead payload |
| leadDetailsSchema | LeadDetails | object schema | Enriched lead read model |
| propertySchema | Property | object schema | Required-field configuration |
| writablePropertySchema | WritableProperty | object schema | Writable property payload |
| sourceSchemas | Source | object schema | Persisted source |
| writableSourceSchema | WritableSource | object schema | Writable source payload |
| supplierSchema | Supplier | object schema | Persisted supplier |
| writableSupplierSchema | WritableSupplier | object schema | Writable supplier payload |
Enum Reference
| Schema | Values |
| --- | --- |
| blacklistScopeSchema | source, supplier, channel, phone_number, zip_code, vlms_ip, ip |
| channelTypeSchema | push, pull |
| sourceTypeSchema | empty, push, pull |
| leadProvenanceSchema | funnel, c2c, api |
Schema Reference
overbookingDataSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| allocation | OverbookingAllocationType | Yes | Single selected overbooking bucket |
enrichmentDataSchema
Top-level behavior:
| Rule | Value |
| --- | --- |
| Type | object \| null |
| Required | No (default) |
| Default | null |
Fields when the value is an object:
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| overbooking | OverbookingData | No | Optional nested enrichment payload |
blacklistSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| id | string | Yes | UUID |
| scope | BlacklistScope | Yes | Blacklist scope |
| value | string | Yes | Non-empty |
| createdAt | number | Yes | Shared timestamp |
| updatedAt | number | Yes | Shared timestamp |
writableBlacklistSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| scope | BlacklistScope | Yes | Scope only, no id or timestamps |
| value | string | Yes | Non-empty |
channelSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| id | string | Yes | UUID |
| code | string | Yes | Non-empty |
| name | string | Yes | Non-empty |
| type | ChannelType | Yes | push or pull |
| createdAt | number | Yes | Shared timestamp |
| updatedAt | number | Yes | Shared timestamp |
writableChannelSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| code | string | Yes | Non-empty |
| name | string | Yes | Non-empty |
| type | ChannelType | Yes | Transport type |
enrichmentSettingsSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| id | string | Yes | UUID |
| key | string | Yes | Non-empty |
| endpoint | string | Yes | Valid URL |
| createdAt | number | Yes | Shared timestamp |
| updatedAt | number | Yes | Shared timestamp |
writableEnrichmentSettingsSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| key | string | Yes | Non-empty |
| endpoint | string | Yes | Valid URL |
leadSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| id | string | Yes | UUID |
| source | string | Yes | UUID reference |
| phoneNumber | string | Yes | Non-empty |
| transmissionEnabled | boolean | No (default) | Defaults to true |
| provenance | LeadProvenance | Yes | Lead origin |
| zipCode | ZipCode \| null | No (default) | Optional and nullable, defaults to null |
| origin | string \| null | No (default) | Optional and nullable, defaults to null |
| data | unknown | Yes | Arbitrary payload |
| createdAt | number | Yes | Shared timestamp |
| updatedAt | number | Yes | Shared timestamp |
writableLeadSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| source | string | Yes | UUID reference |
| phoneNumber | string | Yes | Non-empty |
| transmissionEnabled | boolean | No (default) | Defaults to true |
| provenance | LeadProvenance | Yes | Lead origin |
| zipCode | ZipCode \| null | No (default) | Defaults to null |
| origin | string \| null | No (default) | Defaults to null |
| data | unknown | Yes | Arbitrary payload |
leadDetailsSchema
leadDetailsSchema includes every field from leadSchema and adds the read-model fields below:
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| supplier | string | Yes | UUID reference |
| channel | string | Yes | UUID reference |
| pipelineCompletedAt | number \| null | No (default) | Defaults to null |
| blacklist.blacklisted | boolean | No (default) | Defaults to false |
| blacklist.reason | string \| null | No (default) | Defaults to null |
| transmission.enabled | boolean | No (default) | Defaults to true |
| transmission.id | number \| null | No (default) | Transmission id |
| transmission.documentId | string \| null | No (default) | UUID |
| transmission.delay | boolean | No (default) | Defaults to false |
| transmission.transmitted | boolean | No (default) | Defaults to false |
| transmission.startAt | number \| null | No (default) | Start timestamp |
| transmission.endAt | number \| null | No (default) | End timestamp |
| timeRecall.moment | string \| null | No (default) | Recall moment |
| closedDay | union | No (default) | Defaults to { isClosed: false } |
| enrichmentData | EnrichmentData | No (default) | Nullable, defaults to null |
| error | unknown \| null | No (default) | Defaults to null |
| isOutOfArea | boolean \| null | No (default) | Defaults to null |
| userAgent | LeadUserAgentInfo \| null | No (default) | Defaults to null |
| _embedded | object or null | No (default) | Embedded source, supplier, and channel summary |
closedDay variants
| Variant | Fields |
| --- | --- |
| Closed | isClosed: true, detail.openingTime, detail.closingTime, detail.nextWorkingDay |
| Open | isClosed: false |
propertySchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| id | string | Yes | UUID |
| source | string | Yes | Non-empty |
| property | string | Yes | Must match ^[A-Za-z_]+$ |
| required | boolean | No (default) | Defaults to true |
| createdAt | number | Yes | Shared timestamp |
| updatedAt | number | Yes | Shared timestamp |
writablePropertySchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| source | string | Yes | Source key |
| property | string | Yes | Format-validated field name |
| required | boolean | No (default) | Defaults to true |
sourceSchemas
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| id | string | Yes | UUID |
| identifier | string | Yes | Composite source identifier |
| code | string | Yes | Non-empty |
| origin | string | Yes | Non-empty |
| channel | string | Yes | Non-empty |
| supplier | string | Yes | Non-empty |
| name | string | Yes | Non-empty |
| allowExtraFields | boolean | No (default) | Defaults to true |
| allowMissingFields | boolean | No (default) | Defaults to true |
| type | string | Yes | Non-empty |
| createdAt | number | Yes | Shared timestamp |
| updatedAt | number | Yes | Shared timestamp |
writableSourceSchema
Same fields as sourceSchemas except id, createdAt, and updatedAt. It also adds a refinement:
identifiermust equal${code}#${channel}#${supplier}
supplierSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| id | string | Yes | UUID |
| code | string | Yes | Non-empty |
| client | string | Yes | UUID reference |
| name | string | Yes | Non-empty |
| enabled | boolean | No (default) | Defaults to true |
| createdAt | number | Yes | Shared timestamp |
| updatedAt | number | Yes | Shared timestamp |
writableSupplierSchema
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| code | string | Yes | Non-empty |
| client | string | Yes | UUID reference |
| name | string | Yes | Non-empty |
| enabled | boolean | No (default) | Defaults to true |
Example
import { writableLeadSchema } from '@verisure-italy/alis-types'
const lead = writableLeadSchema.parse({
source: '550e8400-e29b-41d4-a716-446655440000',
phoneNumber: '+390212345678',
transmissionEnabled: true,
provenance: 'api',
zipCode: '20100',
origin: 'landing-page',
data: {
campaign: 'spring',
},
})