pm server - shared

This commit is contained in:
babayaga 2026-01-29 17:59:43 +01:00
parent 8ec419b87e
commit dff0a8a2d6
13 changed files with 2003 additions and 0 deletions

View File

@ -8,6 +8,9 @@
}, },
{ {
"path": "../cad" "path": "../cad"
},
{
"path": "../tasks"
} }
], ],
"settings": {} "settings": {}

View File

@ -0,0 +1,968 @@
import { z } from 'zod/v4';
import { ZodMetaMap } from '../map.js';
export declare const CompetitorSchema: z.ZodObject<{
place_id: z.ZodString;
title: z.ZodString;
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
address: z.ZodNullable<z.ZodOptional<z.ZodString>>;
gps_coordinates: z.ZodNullable<z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>>>;
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
website: z.ZodNullable<z.ZodOptional<z.ZodString>>;
operating_hours: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
thumbnail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
types: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
continent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
country: z.ZodNullable<z.ZodOptional<z.ZodString>>;
city: z.ZodNullable<z.ZodOptional<z.ZodString>>;
updated_at: z.ZodNullable<z.ZodOptional<z.ZodString>>;
raw_data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
}, z.core.$strip>;
export declare const GpsCoordinatesSchema: z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>;
export declare const OperatingHoursSchema: z.ZodObject<{
sunday: z.ZodString;
monday: z.ZodString;
tuesday: z.ZodString;
wednesday: z.ZodString;
thursday: z.ZodString;
friday: z.ZodString;
saturday: z.ZodString;
}, z.core.$strip>;
export declare const AccessibilityExtensionSchema: z.ZodObject<{
accessibility: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
export declare const CrowdExtensionSchema: z.ZodObject<{
crowd: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
export declare const ExtensionsSchema: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
accessibility: z.ZodArray<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
crowd: z.ZodArray<z.ZodString>;
}, z.core.$strip>]>>;
export declare const AdministrativeAreaFullSchema: z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>;
export declare const AdministrativeAreaMinimalSchema: z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
}, z.core.$strip>;
export declare const AdministrativeAreaWithWikidataSchema: z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>;
export declare const AdministrativeAreaWithGeonameSchema: z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>;
export declare const InformativeAreaFullSchema: z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>;
export declare const InformativeAreaBasicSchema: z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>;
export declare const InformativeAreaWithGeonameSchema: z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>;
export declare const InformativeAreaWithWikidataSchema: z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>;
export declare const InformativeAreaMinimalSchema: z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>;
export declare const LocalityInfoSchema: z.ZodObject<{
administrative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>]>>;
informative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>]>>;
}, z.core.$strip>;
export declare const GeoSchema: z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
localityLanguageRequested: z.ZodString;
continent: z.ZodString;
continentCode: z.ZodString;
countryName: z.ZodString;
countryCode: z.ZodString;
principalSubdivision: z.ZodString;
principalSubdivisionCode: z.ZodString;
city: z.ZodString;
locality: z.ZodString;
postcode: z.ZodString;
plusCode: z.ZodString;
localityInfo: z.ZodObject<{
administrative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>]>>;
informative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>]>>;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const SearchMetadataSchema: z.ZodObject<{
id: z.ZodString;
status: z.ZodString;
json_endpoint: z.ZodString;
created_at: z.ZodString;
processed_at: z.ZodString;
google_maps_photos_url: z.ZodString;
raw_html_file: z.ZodString;
prettify_html_file: z.ZodString;
total_time_taken: z.ZodNumber;
}, z.core.$strip>;
export declare const SearchParametersSchema: z.ZodObject<{
engine: z.ZodString;
data_id: z.ZodString;
hl: z.ZodString;
}, z.core.$strip>;
export declare const CategorySchema: z.ZodObject<{
title: z.ZodString;
id: z.ZodString;
}, z.core.$strip>;
export declare const PhotoSchema: z.ZodObject<{
thumbnail: z.ZodString;
image: z.ZodString;
photo_meta_serpapi_link: z.ZodString;
}, z.core.$strip>;
export declare const SerpapiPaginationSchema: z.ZodObject<{
next: z.ZodString;
next_page_token: z.ZodString;
}, z.core.$strip>;
export declare const GoogleMediaSchema: z.ZodObject<{
search_metadata: z.ZodObject<{
id: z.ZodString;
status: z.ZodString;
json_endpoint: z.ZodString;
created_at: z.ZodString;
processed_at: z.ZodString;
google_maps_photos_url: z.ZodString;
raw_html_file: z.ZodString;
prettify_html_file: z.ZodString;
total_time_taken: z.ZodNumber;
}, z.core.$strip>;
search_parameters: z.ZodObject<{
engine: z.ZodString;
data_id: z.ZodString;
hl: z.ZodString;
}, z.core.$strip>;
categories: z.ZodArray<z.ZodObject<{
title: z.ZodString;
id: z.ZodString;
}, z.core.$strip>>;
photos: z.ZodArray<z.ZodObject<{
thumbnail: z.ZodString;
image: z.ZodString;
photo_meta_serpapi_link: z.ZodString;
}, z.core.$strip>>;
serpapi_pagination: z.ZodObject<{
next: z.ZodString;
next_page_token: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const LocationSchema: z.ZodObject<{
position: z.ZodOptional<z.ZodNumber>;
title: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
place_id: z.ZodOptional<z.ZodString>;
data_id: z.ZodOptional<z.ZodString>;
data_cid: z.ZodOptional<z.ZodString>;
reviews_link: z.ZodOptional<z.ZodString>;
photos_link: z.ZodOptional<z.ZodString>;
gps_coordinates: z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>>;
place_id_search: z.ZodOptional<z.ZodString>;
provider_id: z.ZodOptional<z.ZodString>;
type: z.ZodOptional<z.ZodString>;
types: z.ZodOptional<z.ZodArray<z.ZodString>>;
type_id: z.ZodOptional<z.ZodString>;
type_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
address: z.ZodOptional<z.ZodString>;
open_state: z.ZodOptional<z.ZodString>;
hours: z.ZodOptional<z.ZodString>;
operating_hours: z.ZodOptional<z.ZodObject<{
sunday: z.ZodString;
monday: z.ZodString;
tuesday: z.ZodString;
wednesday: z.ZodString;
thursday: z.ZodString;
friday: z.ZodString;
saturday: z.ZodString;
}, z.core.$strip>>;
phone: z.ZodOptional<z.ZodString>;
website: z.ZodOptional<z.ZodString>;
extensions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
accessibility: z.ZodArray<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
crowd: z.ZodArray<z.ZodString>;
}, z.core.$strip>]>>>;
thumbnail: z.ZodOptional<z.ZodString>;
serpapi_thumbnail: z.ZodOptional<z.ZodString>;
page: z.ZodOptional<z.ZodNumber>;
geo: z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
localityLanguageRequested: z.ZodString;
continent: z.ZodString;
continentCode: z.ZodString;
countryName: z.ZodString;
countryCode: z.ZodString;
principalSubdivision: z.ZodString;
principalSubdivisionCode: z.ZodString;
city: z.ZodString;
locality: z.ZodString;
postcode: z.ZodString;
plusCode: z.ZodString;
localityInfo: z.ZodObject<{
administrative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>]>>;
informative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>]>>;
}, z.core.$strip>;
}, z.core.$strip>>;
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
google_media: z.ZodOptional<z.ZodObject<{
search_metadata: z.ZodObject<{
id: z.ZodString;
status: z.ZodString;
json_endpoint: z.ZodString;
created_at: z.ZodString;
processed_at: z.ZodString;
google_maps_photos_url: z.ZodString;
raw_html_file: z.ZodString;
prettify_html_file: z.ZodString;
total_time_taken: z.ZodNumber;
}, z.core.$strip>;
search_parameters: z.ZodObject<{
engine: z.ZodString;
data_id: z.ZodString;
hl: z.ZodString;
}, z.core.$strip>;
categories: z.ZodArray<z.ZodObject<{
title: z.ZodString;
id: z.ZodString;
}, z.core.$strip>>;
photos: z.ZodArray<z.ZodObject<{
thumbnail: z.ZodString;
image: z.ZodString;
photo_meta_serpapi_link: z.ZodString;
}, z.core.$strip>>;
serpapi_pagination: z.ZodObject<{
next: z.ZodString;
next_page_token: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare const CompetitorSchemaFull: z.ZodObject<{
place_id: z.ZodString;
title: z.ZodString;
address: z.ZodNullable<z.ZodOptional<z.ZodString>>;
gps_coordinates: z.ZodNullable<z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>>>;
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
website: z.ZodNullable<z.ZodOptional<z.ZodString>>;
operating_hours: z.ZodNullable<z.ZodOptional<z.ZodObject<{
sunday: z.ZodString;
monday: z.ZodString;
tuesday: z.ZodString;
wednesday: z.ZodString;
thursday: z.ZodString;
friday: z.ZodString;
saturday: z.ZodString;
}, z.core.$strip>>>;
thumbnail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
types: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
raw_data: z.ZodNullable<z.ZodOptional<z.ZodObject<{
position: z.ZodOptional<z.ZodNumber>;
title: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
place_id: z.ZodOptional<z.ZodString>;
data_id: z.ZodOptional<z.ZodString>;
data_cid: z.ZodOptional<z.ZodString>;
reviews_link: z.ZodOptional<z.ZodString>;
photos_link: z.ZodOptional<z.ZodString>;
gps_coordinates: z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>>;
place_id_search: z.ZodOptional<z.ZodString>;
provider_id: z.ZodOptional<z.ZodString>;
type: z.ZodOptional<z.ZodString>;
types: z.ZodOptional<z.ZodArray<z.ZodString>>;
type_id: z.ZodOptional<z.ZodString>;
type_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
address: z.ZodOptional<z.ZodString>;
open_state: z.ZodOptional<z.ZodString>;
hours: z.ZodOptional<z.ZodString>;
operating_hours: z.ZodOptional<z.ZodObject<{
sunday: z.ZodString;
monday: z.ZodString;
tuesday: z.ZodString;
wednesday: z.ZodString;
thursday: z.ZodString;
friday: z.ZodString;
saturday: z.ZodString;
}, z.core.$strip>>;
phone: z.ZodOptional<z.ZodString>;
website: z.ZodOptional<z.ZodString>;
extensions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
accessibility: z.ZodArray<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
crowd: z.ZodArray<z.ZodString>;
}, z.core.$strip>]>>>;
thumbnail: z.ZodOptional<z.ZodString>;
serpapi_thumbnail: z.ZodOptional<z.ZodString>;
page: z.ZodOptional<z.ZodNumber>;
geo: z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
localityLanguageRequested: z.ZodString;
continent: z.ZodString;
continentCode: z.ZodString;
countryName: z.ZodString;
countryCode: z.ZodString;
principalSubdivision: z.ZodString;
principalSubdivisionCode: z.ZodString;
city: z.ZodString;
locality: z.ZodString;
postcode: z.ZodString;
plusCode: z.ZodString;
localityInfo: z.ZodObject<{
administrative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>]>>;
informative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>]>>;
}, z.core.$strip>;
}, z.core.$strip>>;
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
google_media: z.ZodOptional<z.ZodObject<{
search_metadata: z.ZodObject<{
id: z.ZodString;
status: z.ZodString;
json_endpoint: z.ZodString;
created_at: z.ZodString;
processed_at: z.ZodString;
google_maps_photos_url: z.ZodString;
raw_html_file: z.ZodString;
prettify_html_file: z.ZodString;
total_time_taken: z.ZodNumber;
}, z.core.$strip>;
search_parameters: z.ZodObject<{
engine: z.ZodString;
data_id: z.ZodString;
hl: z.ZodString;
}, z.core.$strip>;
categories: z.ZodArray<z.ZodObject<{
title: z.ZodString;
id: z.ZodString;
}, z.core.$strip>>;
photos: z.ZodArray<z.ZodObject<{
thumbnail: z.ZodString;
image: z.ZodString;
photo_meta_serpapi_link: z.ZodString;
}, z.core.$strip>>;
serpapi_pagination: z.ZodObject<{
next: z.ZodString;
next_page_token: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>>;
}, z.core.$strip>>>;
continent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
country: z.ZodNullable<z.ZodOptional<z.ZodString>>;
city: z.ZodNullable<z.ZodOptional<z.ZodString>>;
updated_at: z.ZodNullable<z.ZodOptional<z.ZodString>>;
}, z.core.$strip>;
export declare const CompetitorResponseSchema: z.ZodObject<{
message: z.ZodString;
data: z.ZodOptional<z.ZodArray<z.ZodObject<{
place_id: z.ZodString;
title: z.ZodString;
address: z.ZodNullable<z.ZodOptional<z.ZodString>>;
gps_coordinates: z.ZodNullable<z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>>>;
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
website: z.ZodNullable<z.ZodOptional<z.ZodString>>;
operating_hours: z.ZodNullable<z.ZodOptional<z.ZodObject<{
sunday: z.ZodString;
monday: z.ZodString;
tuesday: z.ZodString;
wednesday: z.ZodString;
thursday: z.ZodString;
friday: z.ZodString;
saturday: z.ZodString;
}, z.core.$strip>>>;
thumbnail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
types: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
raw_data: z.ZodNullable<z.ZodOptional<z.ZodObject<{
position: z.ZodOptional<z.ZodNumber>;
title: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
place_id: z.ZodOptional<z.ZodString>;
data_id: z.ZodOptional<z.ZodString>;
data_cid: z.ZodOptional<z.ZodString>;
reviews_link: z.ZodOptional<z.ZodString>;
photos_link: z.ZodOptional<z.ZodString>;
gps_coordinates: z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>>;
place_id_search: z.ZodOptional<z.ZodString>;
provider_id: z.ZodOptional<z.ZodString>;
type: z.ZodOptional<z.ZodString>;
types: z.ZodOptional<z.ZodArray<z.ZodString>>;
type_id: z.ZodOptional<z.ZodString>;
type_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
address: z.ZodOptional<z.ZodString>;
open_state: z.ZodOptional<z.ZodString>;
hours: z.ZodOptional<z.ZodString>;
operating_hours: z.ZodOptional<z.ZodObject<{
sunday: z.ZodString;
monday: z.ZodString;
tuesday: z.ZodString;
wednesday: z.ZodString;
thursday: z.ZodString;
friday: z.ZodString;
saturday: z.ZodString;
}, z.core.$strip>>;
phone: z.ZodOptional<z.ZodString>;
website: z.ZodOptional<z.ZodString>;
extensions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
accessibility: z.ZodArray<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
crowd: z.ZodArray<z.ZodString>;
}, z.core.$strip>]>>>;
thumbnail: z.ZodOptional<z.ZodString>;
serpapi_thumbnail: z.ZodOptional<z.ZodString>;
page: z.ZodOptional<z.ZodNumber>;
geo: z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
localityLanguageRequested: z.ZodString;
continent: z.ZodString;
continentCode: z.ZodString;
countryName: z.ZodString;
countryCode: z.ZodString;
principalSubdivision: z.ZodString;
principalSubdivisionCode: z.ZodString;
city: z.ZodString;
locality: z.ZodString;
postcode: z.ZodString;
plusCode: z.ZodString;
localityInfo: z.ZodObject<{
administrative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>]>>;
informative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>]>>;
}, z.core.$strip>;
}, z.core.$strip>>;
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
google_media: z.ZodOptional<z.ZodObject<{
search_metadata: z.ZodObject<{
id: z.ZodString;
status: z.ZodString;
json_endpoint: z.ZodString;
created_at: z.ZodString;
processed_at: z.ZodString;
google_maps_photos_url: z.ZodString;
raw_html_file: z.ZodString;
prettify_html_file: z.ZodString;
total_time_taken: z.ZodNumber;
}, z.core.$strip>;
search_parameters: z.ZodObject<{
engine: z.ZodString;
data_id: z.ZodString;
hl: z.ZodString;
}, z.core.$strip>;
categories: z.ZodArray<z.ZodObject<{
title: z.ZodString;
id: z.ZodString;
}, z.core.$strip>>;
photos: z.ZodArray<z.ZodObject<{
thumbnail: z.ZodString;
image: z.ZodString;
photo_meta_serpapi_link: z.ZodString;
}, z.core.$strip>>;
serpapi_pagination: z.ZodObject<{
next: z.ZodString;
next_page_token: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>>;
}, z.core.$strip>>>;
continent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
country: z.ZodNullable<z.ZodOptional<z.ZodString>>;
city: z.ZodNullable<z.ZodOptional<z.ZodString>>;
updated_at: z.ZodNullable<z.ZodOptional<z.ZodString>>;
}, z.core.$strip>>>;
}, z.core.$strip>;
export declare const CompetitorDetailResponseSchema: z.ZodObject<{
message: z.ZodString;
data: z.ZodOptional<z.ZodObject<{
place_id: z.ZodString;
title: z.ZodString;
address: z.ZodNullable<z.ZodOptional<z.ZodString>>;
gps_coordinates: z.ZodNullable<z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>>>;
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
website: z.ZodNullable<z.ZodOptional<z.ZodString>>;
operating_hours: z.ZodNullable<z.ZodOptional<z.ZodObject<{
sunday: z.ZodString;
monday: z.ZodString;
tuesday: z.ZodString;
wednesday: z.ZodString;
thursday: z.ZodString;
friday: z.ZodString;
saturday: z.ZodString;
}, z.core.$strip>>>;
thumbnail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
types: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
raw_data: z.ZodNullable<z.ZodOptional<z.ZodObject<{
position: z.ZodOptional<z.ZodNumber>;
title: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
place_id: z.ZodOptional<z.ZodString>;
data_id: z.ZodOptional<z.ZodString>;
data_cid: z.ZodOptional<z.ZodString>;
reviews_link: z.ZodOptional<z.ZodString>;
photos_link: z.ZodOptional<z.ZodString>;
gps_coordinates: z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, z.core.$strip>>;
place_id_search: z.ZodOptional<z.ZodString>;
provider_id: z.ZodOptional<z.ZodString>;
type: z.ZodOptional<z.ZodString>;
types: z.ZodOptional<z.ZodArray<z.ZodString>>;
type_id: z.ZodOptional<z.ZodString>;
type_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
address: z.ZodOptional<z.ZodString>;
open_state: z.ZodOptional<z.ZodString>;
hours: z.ZodOptional<z.ZodString>;
operating_hours: z.ZodOptional<z.ZodObject<{
sunday: z.ZodString;
monday: z.ZodString;
tuesday: z.ZodString;
wednesday: z.ZodString;
thursday: z.ZodString;
friday: z.ZodString;
saturday: z.ZodString;
}, z.core.$strip>>;
phone: z.ZodOptional<z.ZodString>;
website: z.ZodOptional<z.ZodString>;
extensions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
accessibility: z.ZodArray<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
crowd: z.ZodArray<z.ZodString>;
}, z.core.$strip>]>>>;
thumbnail: z.ZodOptional<z.ZodString>;
serpapi_thumbnail: z.ZodOptional<z.ZodString>;
page: z.ZodOptional<z.ZodNumber>;
geo: z.ZodOptional<z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
localityLanguageRequested: z.ZodString;
continent: z.ZodString;
continentCode: z.ZodString;
countryName: z.ZodString;
countryCode: z.ZodString;
principalSubdivision: z.ZodString;
principalSubdivisionCode: z.ZodString;
city: z.ZodString;
locality: z.ZodString;
postcode: z.ZodString;
plusCode: z.ZodString;
localityInfo: z.ZodObject<{
administrative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
adminLevel: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>]>>;
informative: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
isoName: z.ZodString;
order: z.ZodNumber;
isoCode: z.ZodString;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
geonameId: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
order: z.ZodNumber;
wikidataId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
name: z.ZodString;
order: z.ZodNumber;
}, z.core.$strip>]>>;
}, z.core.$strip>;
}, z.core.$strip>>;
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
google_media: z.ZodOptional<z.ZodObject<{
search_metadata: z.ZodObject<{
id: z.ZodString;
status: z.ZodString;
json_endpoint: z.ZodString;
created_at: z.ZodString;
processed_at: z.ZodString;
google_maps_photos_url: z.ZodString;
raw_html_file: z.ZodString;
prettify_html_file: z.ZodString;
total_time_taken: z.ZodNumber;
}, z.core.$strip>;
search_parameters: z.ZodObject<{
engine: z.ZodString;
data_id: z.ZodString;
hl: z.ZodString;
}, z.core.$strip>;
categories: z.ZodArray<z.ZodObject<{
title: z.ZodString;
id: z.ZodString;
}, z.core.$strip>>;
photos: z.ZodArray<z.ZodObject<{
thumbnail: z.ZodString;
image: z.ZodString;
photo_meta_serpapi_link: z.ZodString;
}, z.core.$strip>>;
serpapi_pagination: z.ZodObject<{
next: z.ZodString;
next_page_token: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>>;
}, z.core.$strip>>>;
continent: z.ZodNullable<z.ZodOptional<z.ZodString>>;
country: z.ZodNullable<z.ZodOptional<z.ZodString>>;
city: z.ZodNullable<z.ZodOptional<z.ZodString>>;
updated_at: z.ZodNullable<z.ZodOptional<z.ZodString>>;
}, z.core.$strip>>;
}, z.core.$strip>;
export type Competitor = z.infer<typeof CompetitorSchema>;
export type CompetitorResponse = z.infer<typeof CompetitorResponseSchema>;
export type CompetitorDetailResponse = z.infer<typeof CompetitorDetailResponseSchema>;
export type CompetitorFull = z.infer<typeof CompetitorSchemaFull>;
export type OptionsSchemaMeta = Record<string, unknown>;
export declare const CompetitorRequestSchemaMap: () => ZodMetaMap<OptionsSchemaMeta>;
export declare const CompetitorRequestSchema: any;
export declare const CompetitorUISchema: Record<string, unknown>;
export type LocationType = z.infer<typeof LocationSchema>;
export type CompetitorRequest = z.infer<typeof CompetitorRequestSchema>;

File diff suppressed because one or more lines are too long

1
packages/shared/dist/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './competitors/schemas.js';

2
packages/shared/dist/index.js vendored Normal file
View File

@ -0,0 +1,2 @@
export * from './competitors/schemas.js';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYywwQkFBMEIsQ0FBQyJ9

39
packages/shared/dist/map.d.ts vendored Normal file
View File

@ -0,0 +1,39 @@
import { ZodObject, ZodTypeAny } from 'zod/v4';
export declare class ZodMetaMap<MetaType = Record<string, unknown>> {
private fieldMap;
/**
* Adds a Zod schema under a specific key (property name),
* optionally attaching typed metadata.
*
* @param key - The name of the property in the root object.
* @param schema - The Zod schema for that property.
* @param metadata - Optional metadata object (type MetaType).
*/
add<T extends ZodTypeAny>(key: string, schema: T, metadata?: MetaType): this;
/**
* Builds and returns a root Zod object
* that combines all properties which were added.
*/
root(): ZodObject<Record<string, ZodTypeAny>>;
/**
* Retrieves the metadata for a specific key, if any.
*/
getMetadata(key: string): MetaType | undefined;
/**
* Static factory method: creates a SchemaMetaManager
* while letting you optionally specify the MetaType.
*
* Usage:
* const manager = SchemaMetaManager.create<MyFieldMeta>();
*/
static create<MT = Record<string, unknown>>(): ZodMetaMap<MT>;
/**
* Returns a basic UiSchema object that RJSF can use to render form controls.
*
* - Adds a top-level "ui:submitButtonOptions" (example).
* - For each field, we set `ui:title` (uppercase key),
* `ui:description` (from Zod's .describe() if available),
* and a naive placeholder from the default value (if parse(undefined) succeeds).
*/
getUISchema(): Record<string, unknown>;
}

102
packages/shared/dist/map.js vendored Normal file
View File

@ -0,0 +1,102 @@
import { z } from 'zod/v4';
/*
* Manages a collection of Zod schema properties
* and combines them into a single Zod object schema.
*
* @template MetaType The type of metadata you want to store for each field.
* Defaults to Record<string, unknown> if not provided.
*/
export class ZodMetaMap {
fieldMap = new Map();
/**
* Adds a Zod schema under a specific key (property name),
* optionally attaching typed metadata.
*
* @param key - The name of the property in the root object.
* @param schema - The Zod schema for that property.
* @param metadata - Optional metadata object (type MetaType).
*/
add(key, schema, metadata) {
this.fieldMap.set(key, { schema, metadata });
return this;
}
/**
* Builds and returns a root Zod object
* that combines all properties which were added.
*/
root() {
const shape = {};
for (const [key, { schema }] of this.fieldMap.entries()) {
shape[key] = schema;
}
return z.object(shape);
}
/**
* Retrieves the metadata for a specific key, if any.
*/
getMetadata(key) {
return this.fieldMap.get(key)?.metadata;
}
/**
* Static factory method: creates a SchemaMetaManager
* while letting you optionally specify the MetaType.
*
* Usage:
* const manager = SchemaMetaManager.create<MyFieldMeta>();
*/
static create() {
return new ZodMetaMap();
}
/**
* Returns a basic UiSchema object that RJSF can use to render form controls.
*
* - Adds a top-level "ui:submitButtonOptions" (example).
* - For each field, we set `ui:title` (uppercase key),
* `ui:description` (from Zod's .describe() if available),
* and a naive placeholder from the default value (if parse(undefined) succeeds).
*/
getUISchema() {
// Start with some top-level UI schema config (optional)
const uiSchema = {
'ui:submitButtonOptions': {
props: {
disabled: false,
className: 'btn btn-info',
},
norender: false,
submitText: 'Submit',
},
};
for (const [key, { schema }] of this.fieldMap.entries()) {
let fieldUi = {};
// Use the Zod description if available
// (Accessing `._def.description` is private/hacky, but commonly done.)
const sAny = schema;
if (sAny?._def?.description) {
fieldUi['ui:description'] = sAny._def.description;
}
// RJSF usually reads 'title' from JSON schema. But if you want
// to override it in UI schema, you can do so:
fieldUi['ui:title'] = key
.replace(/([A-Z])/g, ' $1') // insert space before capital letters
.replace(/^./, (str) => str.toUpperCase()) // capitalize the first letter
.trim();
// If the Zod schema allows a default, we can parse(undefined) to get it.
try {
const defaultVal = schema.parse(undefined);
// There's no official 'ui:default' in RJSF, but you could do a placeholder:
fieldUi['ui:placeholder'] = defaultVal;
}
catch {
// no default
}
fieldUi = {
...fieldUi,
...this.getMetadata(key),
};
uiSchema[key] = fieldUi;
}
return uiSchema;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL21hcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsQ0FBQyxFQUF5QixNQUFNLFFBQVEsQ0FBQztBQUNsRDs7Ozs7O0dBTUc7QUFDSCxNQUFNLE9BQU8sVUFBVTtJQUNYLFFBQVEsR0FBRyxJQUFJLEdBQUcsRUFHdkIsQ0FBQztJQUVKOzs7Ozs7O09BT0c7SUFDSCxHQUFHLENBQXVCLEdBQVcsRUFBRSxNQUFTLEVBQUUsUUFBbUI7UUFDakUsSUFBSSxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsR0FBRyxFQUFFLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBRSxDQUFDLENBQUM7UUFDN0MsT0FBTyxJQUFJLENBQUM7SUFDaEIsQ0FBQztJQUVEOzs7T0FHRztJQUNILElBQUk7UUFDQSxNQUFNLEtBQUssR0FBK0IsRUFBRSxDQUFDO1FBQzdDLEtBQUssTUFBTSxDQUFDLEdBQUcsRUFBRSxFQUFFLE1BQU0sRUFBRSxDQUFDLElBQUksSUFBSSxDQUFDLFFBQVEsQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDO1lBQ3RELEtBQUssQ0FBQyxHQUFHLENBQUMsR0FBRyxNQUFNLENBQUM7UUFDeEIsQ0FBQztRQUNELE9BQU8sQ0FBQyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQztJQUMzQixDQUFDO0lBRUQ7O09BRUc7SUFDSCxXQUFXLENBQUMsR0FBVztRQUNuQixPQUFPLElBQUksQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxFQUFFLFFBQVEsQ0FBQztJQUM1QyxDQUFDO0lBRUQ7Ozs7OztPQU1HO0lBQ0gsTUFBTSxDQUFDLE1BQU07UUFDVCxPQUFPLElBQUksVUFBVSxFQUFNLENBQUM7SUFDaEMsQ0FBQztJQUVEOzs7Ozs7O09BT0c7SUFDSCxXQUFXO1FBQ1Asd0RBQXdEO1FBQ3hELE1BQU0sUUFBUSxHQUE0QjtZQUN0Qyx3QkFBd0IsRUFBRTtnQkFDdEIsS0FBSyxFQUFFO29CQUNILFFBQVEsRUFBRSxLQUFLO29CQUNmLFNBQVMsRUFBRSxjQUFjO2lCQUM1QjtnQkFDRCxRQUFRLEVBQUUsS0FBSztnQkFDZixVQUFVLEVBQUUsUUFBUTthQUN2QjtTQUNKLENBQUM7UUFFRixLQUFLLE1BQU0sQ0FBQyxHQUFHLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxJQUFJLElBQUksQ0FBQyxRQUFRLENBQUMsT0FBTyxFQUFFLEVBQUUsQ0FBQztZQUN0RCxJQUFJLE9BQU8sR0FBNEIsRUFBRSxDQUFDO1lBQzFDLHVDQUF1QztZQUN2Qyx1RUFBdUU7WUFDdkUsTUFBTSxJQUFJLEdBQUcsTUFBYSxDQUFDO1lBQzNCLElBQUksSUFBSSxFQUFFLElBQUksRUFBRSxXQUFXLEVBQUUsQ0FBQztnQkFDMUIsT0FBTyxDQUFDLGdCQUFnQixDQUFDLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUM7WUFDdEQsQ0FBQztZQUVELCtEQUErRDtZQUMvRCw4Q0FBOEM7WUFDOUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxHQUFHLEdBQUc7aUJBQ3BCLE9BQU8sQ0FBQyxVQUFVLEVBQUUsS0FBSyxDQUFDLENBQUMsc0NBQXNDO2lCQUNqRSxPQUFPLENBQUMsSUFBSSxFQUFFLENBQUMsR0FBRyxFQUFFLEVBQUUsQ0FBQyxHQUFHLENBQUMsV0FBVyxFQUFFLENBQUMsQ0FBQyw4QkFBOEI7aUJBQ3hFLElBQUksRUFBRSxDQUFDO1lBRVoseUVBQXlFO1lBQ3pFLElBQUksQ0FBQztnQkFDRCxNQUFNLFVBQVUsR0FBRyxNQUFNLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxDQUFDO2dCQUMzQyw0RUFBNEU7Z0JBQzVFLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxHQUFHLFVBQVUsQ0FBQztZQUMzQyxDQUFDO1lBQUMsTUFBTSxDQUFDO2dCQUNMLGFBQWE7WUFDakIsQ0FBQztZQUNELE9BQU8sR0FBRztnQkFDTixHQUFHLE9BQU87Z0JBQ1YsR0FBRyxJQUFJLENBQUMsV0FBVyxDQUFDLEdBQUcsQ0FBQzthQUMzQixDQUFBO1lBQ0QsUUFBUSxDQUFDLEdBQUcsQ0FBQyxHQUFHLE9BQU8sQ0FBQztRQUM1QixDQUFDO1FBQ0QsT0FBTyxRQUFRLENBQUM7SUFDcEIsQ0FBQztDQUNKIn0=

151
packages/shared/package-lock.json generated Normal file
View File

@ -0,0 +1,151 @@
{
"name": "@polymech/shared",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@polymech/shared",
"version": "1.0.0",
"dependencies": {
"@hono/zod-openapi": "^1.1.5",
"@polymech/commons": "file:../../../polymech-mono/packages/commons"
},
"devDependencies": {
"typescript": "^5.0.0",
"zod": "^4.1.12"
}
},
"../../../polymech-mono/packages/commons": {
"name": "@polymech/commons",
"version": "0.2.6",
"license": "BSD",
"dependencies": {
"@polymech/core": "file:../core",
"@polymech/fs": "file:../fs",
"@repo/typescript-config": "file:../typescript-config",
"@schemastore/package": "^0.0.10",
"env-var": "^7.5.0",
"glob": "^10.4.5",
"js-yaml": "^4.1.0",
"jsonpath-plus": "^10.3.0",
"normalize-url": "^8.0.1",
"p-map": "^7.0.3",
"p-throttle": "^4.1.1",
"regedit": "^5.1.4",
"tslog": "^3.3.3",
"tsup": "^2.0.3",
"yargs": "^17.7.2",
"zod": "^3.24.3",
"zod-to-json-schema": "^3.24.5",
"zod-to-ts": "^1.2.0"
},
"bin": {
"pm-cli": "dist/main.js"
},
"devDependencies": {
"@types/node": "^22.12.0",
"typescript": "^5.7.3"
}
},
"node_modules/@asteasolutions/zod-to-openapi": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/@asteasolutions/zod-to-openapi/-/zod-to-openapi-8.1.0.tgz",
"integrity": "sha512-tQFxVs05J/6QXXqIzj6rTRk3nj1HFs4pe+uThwE95jL5II2JfpVXkK+CqkO7aT0Do5AYqO6LDrKpleLUFXgY+g==",
"license": "MIT",
"dependencies": {
"openapi3-ts": "^4.1.2"
},
"peerDependencies": {
"zod": "^4.0.0"
}
},
"node_modules/@hono/zod-openapi": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/@hono/zod-openapi/-/zod-openapi-1.1.5.tgz",
"integrity": "sha512-EAnY6ad4yt/MUKHx716BEGGOXSl5d0/FOLozOYB/pmSEFq07qrzefKFtBEMAgd3hlpJXjH+4lwgTtlAo+BGBgQ==",
"license": "MIT",
"dependencies": {
"@asteasolutions/zod-to-openapi": "^8.1.0",
"@hono/zod-validator": "^0.7.4",
"openapi3-ts": "^4.5.0"
},
"engines": {
"node": ">=16.0.0"
},
"peerDependencies": {
"hono": ">=4.3.6",
"zod": "^4.0.0"
}
},
"node_modules/@hono/zod-validator": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/@hono/zod-validator/-/zod-validator-0.7.5.tgz",
"integrity": "sha512-n4l4hutkfYU07PzRUHBOVzUEn38VSfrh+UVE5d0w4lyfWDOEhzxIupqo5iakRiJL44c3vTuFJBvcmUl8b9agIA==",
"license": "MIT",
"peerDependencies": {
"hono": ">=3.9.0",
"zod": "^3.25.0 || ^4.0.0"
}
},
"node_modules/@polymech/commons": {
"resolved": "../../../polymech-mono/packages/commons",
"link": true
},
"node_modules/hono": {
"version": "4.10.6",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.10.6.tgz",
"integrity": "sha512-BIdolzGpDO9MQ4nu3AUuDwHZZ+KViNm+EZ75Ae55eMXMqLVhDFqEMXxtUe9Qh8hjL+pIna/frs2j6Y2yD5Ua/g==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=16.9.0"
}
},
"node_modules/openapi3-ts": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/openapi3-ts/-/openapi3-ts-4.5.0.tgz",
"integrity": "sha512-jaL+HgTq2Gj5jRcfdutgRGLosCy/hT8sQf6VOy+P+g36cZOjI1iukdPnijC+4CmeRzg/jEllJUboEic2FhxhtQ==",
"license": "MIT",
"dependencies": {
"yaml": "^2.8.0"
}
},
"node_modules/typescript": {
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/yaml": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz",
"integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14.6"
}
},
"node_modules/zod": {
"version": "4.1.12",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.1.12.tgz",
"integrity": "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==",
"license": "MIT",
"peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
}
}
}

View File

@ -0,0 +1,22 @@
{
"name": "@polymech/shared",
"version": "1.0.0",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"exports": {
".": "./dist/index.js"
},
"scripts": {
"build": "tsc",
"dev": "tsc -w"
},
"devDependencies": {
"typescript": "^5.0.0",
"zod": "^4.1.12"
},
"dependencies": {
"@hono/zod-openapi": "^1.1.5",
"@polymech/commons": "file:../../../polymech-mono/packages/commons"
}
}

View File

@ -0,0 +1,332 @@
import { z } from 'zod/v4'
import { ZodMetaMap } from '../map.js';
import { extendZodWithOpenApi } from '@hono/zod-openapi';
extendZodWithOpenApi(z);
export const CompetitorSchema = z.object({
place_id: z.string(),
title: z.string(),
description: z.string().optional().nullable(),
address: z.string().optional().nullable(),
gps_coordinates: z.object({
latitude: z.number(),
longitude: z.number(),
}).optional().nullable(),
phone: z.string().optional().nullable(),
website: z.string().optional().nullable(),
operating_hours: z.record(z.string(), z.any()).optional().nullable(),
thumbnail: z.string().optional().nullable(),
types: z.array(z.string()).optional().nullable(),
continent: z.string().optional().nullable(),
country: z.string().optional().nullable(),
city: z.string().optional().nullable(),
updated_at: z.string().optional().nullable(),
raw_data: z.record(z.string(), z.any()).optional().nullable()
})
// Shared schemas
export const GpsCoordinatesSchema = z.object({
latitude: z.number(),
longitude: z.number()
})
export const OperatingHoursSchema = z.object({
sunday: z.string(),
monday: z.string(),
tuesday: z.string(),
wednesday: z.string(),
thursday: z.string(),
friday: z.string(),
saturday: z.string()
})
// Extension schemas
export const AccessibilityExtensionSchema = z.object({
accessibility: z.array(z.string())
})
export const CrowdExtensionSchema = z.object({
crowd: z.array(z.string())
})
export const ExtensionsSchema = z.array(
z.union([AccessibilityExtensionSchema, CrowdExtensionSchema])
)
// Locality info schemas
export const AdministrativeAreaFullSchema = z.object({
name: z.string(),
description: z.string(),
isoName: z.string(),
order: z.number(),
adminLevel: z.number(),
isoCode: z.string(),
wikidataId: z.string(),
geonameId: z.number()
})
export const AdministrativeAreaMinimalSchema = z.object({
name: z.string(),
order: z.number(),
adminLevel: z.number()
})
export const AdministrativeAreaWithWikidataSchema = z.object({
name: z.string(),
description: z.string(),
order: z.number(),
adminLevel: z.number(),
wikidataId: z.string()
})
export const AdministrativeAreaWithGeonameSchema = z.object({
name: z.string(),
description: z.string(),
order: z.number(),
adminLevel: z.number(),
wikidataId: z.string(),
geonameId: z.number()
})
export const InformativeAreaFullSchema = z.object({
name: z.string(),
description: z.string(),
isoName: z.string(),
order: z.number(),
isoCode: z.string(),
wikidataId: z.string(),
geonameId: z.number()
})
export const InformativeAreaBasicSchema = z.object({
name: z.string(),
description: z.string(),
order: z.number()
})
export const InformativeAreaWithGeonameSchema = z.object({
name: z.string(),
description: z.string(),
order: z.number(),
wikidataId: z.string(),
geonameId: z.number()
})
export const InformativeAreaWithWikidataSchema = z.object({
name: z.string(),
description: z.string(),
order: z.number(),
wikidataId: z.string()
})
export const InformativeAreaMinimalSchema = z.object({
name: z.string(),
order: z.number()
})
export const LocalityInfoSchema = z.object({
administrative: z.array(
z.union([
AdministrativeAreaFullSchema,
AdministrativeAreaMinimalSchema,
AdministrativeAreaWithWikidataSchema,
AdministrativeAreaWithGeonameSchema
])
),
informative: z.array(
z.union([
InformativeAreaFullSchema,
InformativeAreaBasicSchema,
InformativeAreaWithGeonameSchema,
InformativeAreaWithWikidataSchema,
InformativeAreaMinimalSchema
])
)
})
// Geo schema
export const GeoSchema = z.object({
latitude: z.number(),
longitude: z.number(),
localityLanguageRequested: z.string(),
continent: z.string(),
continentCode: z.string(),
countryName: z.string(),
countryCode: z.string(),
principalSubdivision: z.string(),
principalSubdivisionCode: z.string(),
city: z.string(),
locality: z.string(),
postcode: z.string(),
plusCode: z.string(),
localityInfo: LocalityInfoSchema
})
// Google Media schemas
export const SearchMetadataSchema = z.object({
id: z.string(),
status: z.string(),
json_endpoint: z.string(),
created_at: z.string(),
processed_at: z.string(),
google_maps_photos_url: z.string(),
raw_html_file: z.string(),
prettify_html_file: z.string(),
total_time_taken: z.number()
})
export const SearchParametersSchema = z.object({
engine: z.string(),
data_id: z.string(),
hl: z.string()
})
export const CategorySchema = z.object({
title: z.string(),
id: z.string()
})
export const PhotoSchema = z.object({
thumbnail: z.string(),
image: z.string(),
photo_meta_serpapi_link: z.string()
})
export const SerpapiPaginationSchema = z.object({
next: z.string(),
next_page_token: z.string()
})
export const GoogleMediaSchema = z.object({
search_metadata: SearchMetadataSchema,
search_parameters: SearchParametersSchema,
categories: z.array(CategorySchema),
photos: z.array(PhotoSchema),
serpapi_pagination: SerpapiPaginationSchema
})
// Raw data schema
export const LocationSchema = z.object({
position: z.number(),
title: z.string(),
description: z.string(),
place_id: z.string(),
data_id: z.string(),
data_cid: z.string(),
reviews_link: z.string(),
photos_link: z.string(),
gps_coordinates: GpsCoordinatesSchema,
place_id_search: z.string(),
provider_id: z.string(),
type: z.string(),
types: z.array(z.string()),
type_id: z.string(),
type_ids: z.array(z.string()),
address: z.string(),
open_state: z.string(),
hours: z.string(),
operating_hours: OperatingHoursSchema,
phone: z.string(),
website: z.string(),
extensions: ExtensionsSchema,
thumbnail: z.string(),
serpapi_thumbnail: z.string(),
page: z.number(),
geo: GeoSchema,
meta: z.record(z.string(), z.any()),
google_media: GoogleMediaSchema
}).partial()
// Main CompetitorSchemaFull
export const CompetitorSchemaFull = z.object({
place_id: z.string(),
title: z.string(),
address: z.string().optional().nullable(),
gps_coordinates: GpsCoordinatesSchema.optional().nullable(),
phone: z.string().optional().nullable(),
website: z.string().optional().nullable(),
operating_hours: OperatingHoursSchema.optional().nullable(),
thumbnail: z.string().optional().nullable(),
types: z.array(z.string()).optional().nullable(),
raw_data: LocationSchema.optional().nullable(),
continent: z.string().optional().nullable(),
country: z.string().optional().nullable(),
city: z.string().optional().nullable(),
updated_at: z.string().optional().nullable()
})
export const CompetitorResponseSchema = z.object({
message: z.string(),
data: z.array(CompetitorSchemaFull).optional(),
})
export const CompetitorDetailResponseSchema = z.object({
message: z.string(),
data: CompetitorSchemaFull.optional(),
})
export type Competitor = z.infer<typeof CompetitorSchema>;
export type CompetitorResponse = z.infer<typeof CompetitorResponseSchema>;
export type CompetitorDetailResponse = z.infer<typeof CompetitorDetailResponseSchema>;
export type CompetitorFull = z.infer<typeof CompetitorSchemaFull>;
export type OptionsSchemaMeta = Record<string, unknown>
let schemaMap: ZodMetaMap<OptionsSchemaMeta>;
export const CompetitorRequestSchemaMap = () => {
schemaMap = ZodMetaMap.create<OptionsSchemaMeta>()
schemaMap.add(
'location',
z.string().default('dresden, germany') as any
, { 'ui:group': 'Search Parameters' })
.add(
'query',
z.string().default('plastichub') as any
, { 'ui:group': 'Search Parameters' })
.add(
'filterCity',
z.string().optional() as any
, { 'ui:group': 'Filters' })
.add(
'filterContinent',
z.string().optional() as any
, { 'ui:group': 'Filters' })
.add(
'filterCountry',
z.string().optional() as any
, { 'ui:group': 'Filters' })
.add(
'filterType',
z.string().optional() as any
, { 'ui:group': 'Filters' })
.add(
'excludedTypes',
z.array(z.string()).optional() as any
, { 'ui:group': 'Filters' })
.add(
'concurrency',
z.string().optional().default('5') as any
, { 'ui:group': 'Settings' })
.add(
'refresh',
z.boolean().optional().default(false) as any
, { 'ui:group': 'Settings' })
.add(
'limit',
z.string().optional().default('250') as any
, { 'ui:group': 'Settings' })
return schemaMap;
}
export const CompetitorRequestSchema = CompetitorRequestSchemaMap().root() as any;
export const CompetitorUISchema = CompetitorRequestSchemaMap().getUISchema();
export type LocationType = z.infer<typeof LocationSchema>;
export type CompetitorRequest = z.infer<typeof CompetitorRequestSchema>;

View File

@ -0,0 +1 @@
export * from './competitors/schemas.js';

111
packages/shared/src/map.ts Normal file
View File

@ -0,0 +1,111 @@
import { z, ZodObject, ZodTypeAny } from 'zod/v4';
/*
* Manages a collection of Zod schema properties
* and combines them into a single Zod object schema.
*
* @template MetaType The type of metadata you want to store for each field.
* Defaults to Record<string, unknown> if not provided.
*/
export class ZodMetaMap<MetaType = Record<string, unknown>> {
private fieldMap = new Map<
string,
{ schema: ZodTypeAny; metadata?: MetaType }
>();
/**
* Adds a Zod schema under a specific key (property name),
* optionally attaching typed metadata.
*
* @param key - The name of the property in the root object.
* @param schema - The Zod schema for that property.
* @param metadata - Optional metadata object (type MetaType).
*/
add<T extends ZodTypeAny>(key: string, schema: T, metadata?: MetaType): this {
this.fieldMap.set(key, { schema, metadata });
return this;
}
/**
* Builds and returns a root Zod object
* that combines all properties which were added.
*/
root(): ZodObject<Record<string, ZodTypeAny>> {
const shape: Record<string, ZodTypeAny> = {};
for (const [key, { schema }] of this.fieldMap.entries()) {
shape[key] = schema;
}
return z.object(shape);
}
/**
* Retrieves the metadata for a specific key, if any.
*/
getMetadata(key: string): MetaType | undefined {
return this.fieldMap.get(key)?.metadata;
}
/**
* Static factory method: creates a SchemaMetaManager
* while letting you optionally specify the MetaType.
*
* Usage:
* const manager = SchemaMetaManager.create<MyFieldMeta>();
*/
static create<MT = Record<string, unknown>>(): ZodMetaMap<MT> {
return new ZodMetaMap<MT>();
}
/**
* Returns a basic UiSchema object that RJSF can use to render form controls.
*
* - Adds a top-level "ui:submitButtonOptions" (example).
* - For each field, we set `ui:title` (uppercase key),
* `ui:description` (from Zod's .describe() if available),
* and a naive placeholder from the default value (if parse(undefined) succeeds).
*/
getUISchema(): Record<string, unknown> {
// Start with some top-level UI schema config (optional)
const uiSchema: Record<string, unknown> = {
'ui:submitButtonOptions': {
props: {
disabled: false,
className: 'btn btn-info',
},
norender: false,
submitText: 'Submit',
},
};
for (const [key, { schema }] of this.fieldMap.entries()) {
let fieldUi: Record<string, unknown> = {};
// Use the Zod description if available
// (Accessing `._def.description` is private/hacky, but commonly done.)
const sAny = schema as any;
if (sAny?._def?.description) {
fieldUi['ui:description'] = sAny._def.description;
}
// RJSF usually reads 'title' from JSON schema. But if you want
// to override it in UI schema, you can do so:
fieldUi['ui:title'] = key
.replace(/([A-Z])/g, ' $1') // insert space before capital letters
.replace(/^./, (str) => str.toUpperCase()) // capitalize the first letter
.trim();
// If the Zod schema allows a default, we can parse(undefined) to get it.
try {
const defaultVal = schema.parse(undefined);
// There's no official 'ui:default' in RJSF, but you could do a placeholder:
fieldUi['ui:placeholder'] = defaultVal;
} catch {
// no default
}
fieldUi = {
...fieldUi,
...this.getMetadata(key),
}
uiSchema[key] = fieldUi;
}
return uiSchema;
}
}

View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"declaration": true,
"moduleResolution": "NodeNext",
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"inlineSourceMap": true,
"experimentalDecorators": true
},
"include": [
"src/**/*"
],
"files": [
"src/index.ts"
]
}