diff --git a/dist/base/index.cjs b/dist/base/index.cjs index a869eb8..3fdfbe4 100644 --- a/dist/base/index.cjs +++ b/dist/base/index.cjs @@ -660,8 +660,9 @@ var freeEsimSchema = zod.z.object({ enabled: zod.z.boolean(), package_specification: zod.z.object({ size: zod.z.string(), - type: zod.z.string(), - destination: zod.z.string() + package_type: zod.z.string(), + destination: zod.z.string(), + package_duration: zod.z.number() }), booking_id_verification: zod.z.boolean().default(false), booking_id_verification_pattern: zod.z.string().nullable().optional(), diff --git a/dist/base/index.cjs.map b/dist/base/index.cjs.map index 7fc3ad8..ecb5533 100644 --- a/dist/base/index.cjs.map +++ b/dist/base/index.cjs.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/builders/client.ts","../../src/common.ts","../../src/specs/user.ts","../../src/specs/common.ts","../../src/specs/booking.ts","../../src/constants.ts","../../src/specs/promocode.ts","../../src/specs/country.ts","../../src/specs/currency.ts","../../src/specs/esim.ts","../../src/specs/payment.ts","../../src/specs/message.ts","../../src/specs/traffic_policy.ts","../../src/specs/package.ts","../../src/specs/partner.ts","../../src/specs/analytics.ts","../../src/specs/apiLogs.ts","../../src/specs/role.ts","../../src/specs/permission.ts","../../src/index.client.ts"],"names":["z","packageSpecificationSchema","SUPPORTED_LOCALES"],"mappings":";AAAA,SAAS,KAAAA,UAAqB;;;ACA9B,SAAqB,SAAS;AAQvB,SAAS,cACZ,QACA,SAQU;AACV,MAAI,CAAC;AAAS,WAAO;AAErB,MAAI,UAAU;AAGd,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAEA,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAGA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAEhD,QAAI,CAAC,YAAY,UAAU,EAAE,SAAS,GAAG,KAAK,UAAU,QAAW;AAC/D;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AAwB,kBAAkB,oBAAoB;AACpE,IAAM,yBAAyB,kBAAkB,qBAAqB;AACtE,IAAM,kBAAkB,kBAAkB,cAAc;AACxD,IAAM,mBAAmB,kBAAkB,aAAa;AACxD,IAAM,cAAc,kBAAkB,cAAc;AACpD,IAAM,oBAAoB,kBAAkB,oBAAoB;AAChE,IAAM,aAAa,kBAAkB,YAAY;AACjD,IAAM,uBAAuB,kBAAkB,iBAAiB;AAChE,IAAM,sBAAsB,kBAAkB,kBAAkB;AAChE,IAAM,uBAAuB,kBAAkB,mBAAmB;AAElE,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,wBAAwB;AAC9B,IAAM,qCAAqCC;AAC3C,IAAM,mCAAmC;AACzC,IAAM,8BAA8B;AACpC,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,qBAAqB;AAC3B,IAAM,8BAA8B;AACpC,IAAM,uBAAuB;AAC7B,IAAM,8BAA8B;AAsCpC,IAAMC,qBAAoB","sourcesContent":["import { z, ZodTypeAny } from 'zod';\nimport type { FieldSpec, SchemaFromSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\n\nexport function buildClientSchema(spec: S, path: string[] = []): SchemaFromSpec {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid schema spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec) as unknown as SchemaFromSpec;\n }\n\n // Check if object might be a Zod schema (has _def property or ~standard metadata)\n if (typeof spec === 'object' && spec !== null &&\n (('_def' in spec) || ('~standard' in spec && (spec as any)['~standard']?.vendor === 'zod'))) {\n try {\n // Try to use it as a Zod schema directly\n return wrapZodSchema(spec as unknown as z.ZodTypeAny) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this fails, we'll continue with the other checks\n console.warn(`Failed to use object as Zod schema at \"${pathString}\":`, error);\n }\n }\n\n // ----- Array -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.array(buildClientSchema(spec.of, [...path, '[i]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Record -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.record(buildClientSchema(spec.of, [...path, '[key]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Timestamp -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'timestamp') {\n let schema: ZodTypeAny = z.preprocess((val) => {\n if (typeof val === 'string') {\n // Try to parse the string to a Date object\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date; // undefined will cause z.date() to fail\n }\n if (typeof val === 'number') {\n // Handle numeric timestamps\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date;\n }\n // If it's already a Date or something else, return it as is\n return val;\n }, z.date({ required_error: 'Date is required', invalid_type_error: 'Invalid date format' }));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- DocRef -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'docRef') {\n let schema: ZodTypeAny = z.string(); // only ID on client\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Object (plain nested object spec) -----\n if (\n typeof spec === 'object' &&\n spec !== null &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || (typeof spec === 'object' && spec !== null && '_type' in spec && (spec as any)._type === 'object')) {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // If we have an object with fields that look like schema specs, try to handle it as a schema object\n if (typeof spec === 'object' && spec !== null) {\n try {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this also fails, we'll throw the error below\n console.warn(`Failed to handle object as plain schema at \"${pathString}\":`, error);\n }\n }\n\n // 🔥 If we got here, the spec had a structure we didn't handle\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n}\n\n","import { ZodTypeAny, z } from 'zod';\nimport type { SchemaBuilder } from './types';\n\n/**\n * Ensures a Zod schema is wrapped to be optional and/or nullable,\n * if not already. Use this in recursive schema builders.\n * Also applies any other supported schema transformations provided in options.\n */\nexport function wrapZodSchema(\n schema: ZodTypeAny,\n options?: {\n optional?: boolean;\n nullable?: boolean;\n min?: number;\n max?: number;\n // Allow arbitrary extensions via dynamic property\n [key: string]: any;\n }\n): ZodTypeAny {\n if (!options) return schema;\n\n let wrapped = schema;\n\n // Handle nullable and optional specially since they're common\n if (options.nullable && !wrapped.isNullable?.()) {\n wrapped = wrapped.nullable();\n }\n\n if (options.optional && !wrapped.isOptional?.()) {\n wrapped = wrapped.optional();\n }\n\n // Process all other options dynamically\n for (const [key, value] of Object.entries(options)) {\n // Skip the already handled properties and undefined values\n if (['nullable', 'optional'].includes(key) || value === undefined) {\n continue;\n }\n\n // Check if the schema has a method matching the option key\n if (typeof (wrapped as any)[key] === 'function') {\n wrapped = (wrapped as any)[key](value);\n }\n }\n\n return wrapped;\n}\n\nexport function wrapObjectSchema(\n spec: any, // using any to support dynamic `spec.type === 'object'`\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n if (!('of' in spec)) {\n throw new Error(`Object spec at \"${pathString}\" is missing 'of'`);\n }\n\n const shape: Record = {};\n for (const [key, value] of Object.entries(spec.of)) {\n shape[key] = builder(value as any, [...path, key]);\n }\n\n let objectSchema: ZodTypeAny = z.object(shape);\n if (spec.nullable) objectSchema = objectSchema.nullable();\n if (spec.optional) objectSchema = objectSchema.optional();\n return objectSchema;\n}\n\n/**\n * Wraps a plain object shape (no `type: 'object'`) into a Zod schema.\n * Assumes each field is either a Zod schema or another FieldSpec.\n */\nexport function wrapPlainObjectSchema(\n spec: Record,\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n // Handle object field specs with '_type': 'object'\n if ('_type' in spec && spec._type === 'object' && 'of' in spec) {\n return wrapObjectSchema(spec, path, builder);\n }\n\n const shape: Record = {};\n\n // Only add fields to the schema if they're not special control properties\n for (const [key, val] of Object.entries(spec)) {\n if (key !== '_type' && key !== 'nullable' && key !== 'optional') {\n shape[key] = builder(val, [...path, key]);\n }\n }\n\n // Create the base object schema\n let schema: ZodTypeAny = z.object(shape);\n\n // Apply nullable/optional modifiers if needed\n if ('nullable' in spec && spec.nullable === true) {\n schema = schema.nullable();\n }\n\n if ('optional' in spec && spec.optional === true) {\n schema = schema.optional();\n }\n\n return schema;\n}\n\nexport const SCHEMA_MARKER = Symbol('ZodSchemaSpecMarker');\n\nexport function markAsSchemaSpec(spec: T): T {\n Object.defineProperty(spec, SCHEMA_MARKER, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return spec;\n}\n\nexport function isSchemaSpec(obj: unknown): obj is Record {\n return typeof obj === 'object' && obj !== null && SCHEMA_MARKER in obj;\n}","import { z } from 'zod';\nimport { PARTNER_COLLECTION, PROFILE_COLLECTION, timestampNullableOptional, timestampRequired, timestampNullable, ROLE_COLLECTION, PERMISSION_COLLECTION } from './common';\nimport { markAsSchemaSpec } from '../common'\n\nexport const apiKeySpec = {\n expires_at: { _type: 'timestamp' as const },\n secret: z.string(),\n is_active: z.boolean(),\n}\n\nexport const apiKeysSpec = {\n _type: 'record' as const,\n of: {\n _type: 'object' as const,\n of: apiKeySpec\n }\n}\n\nexport const apiKeysObjectSpec = {\n _type: 'object' as const,\n of: {\n allowed_keys: { _type: 'array' as const, nullable: true, optional: true, of: z.string() },\n keys: apiKeysSpec\n },\n nullable: true,\n optional: true\n}\n\nexport const userSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string().nullable(),\n email: z.string().email().nullable(),\n stripe_id: z.string().nullable().optional(),\n referral: z.string().nullable().optional(),\n fcm: z.string().optional(),\n deeplink: z.string().nullable().optional(),\n gender: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n coordinates: z.string().nullable().optional(),\n parameters: z.any().nullable().optional(),\n locale: z.string().nullable().optional(),\n phone_model: z.string().nullable().optional(),\n phone_os: z.string().nullable().optional(),\n phone_os_version: z.string().nullable().optional(),\n ios: z.boolean().nullable().optional(),\n has_card_saved: z.boolean().nullable().optional(),\n admin: z.boolean().nullable().optional(),\n api_keys: apiKeysObjectSpec,\n currency: z.string().nullable().optional(),\n receipt_email: z.string().nullable().optional(),\n source: z.enum(['direct', 'promo', 'platform']).nullable().optional(),\n role: { _type: 'docRef' as const, collection: ROLE_COLLECTION, optional: true, nullable: true },\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n balance: z.number().nullable().optional(),\n createdAt: { _type: 'timestamp' as const },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, optional: true, nullable: true },\n profileRef: { _type: 'docRef' as const, collection: PROFILE_COLLECTION, optional: true, nullable: true },\n review_requested: timestampNullableOptional,\n last_seen: timestampNullableOptional\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\n\n// Collection paths\nexport const PARTNER_COLLECTION = '/companies/hubby/partners';\nexport const USER_COLLECTION = 'users';\nexport const PROFILE_COLLECTION = '/companies/hubby/profiles';\nexport const PACKAGE_COLLECTION = '/companies/hubby/packages';\nexport const PROMO_CODE_COLLECTION = '/companies/hubby/promo_codes';\nexport const COUNTRY_COLLECTION = 'countries';\nexport const ESIM_COLLECTION = 'esims';\nexport const PAYMENT_COLLECTION = 'payments';\nexport const PRICE_LIST_COLLECTION = 'price_lists';\nexport const BOOKING_COLLECTION = 'bookings';\nexport const MESSAGE_COLLECTION = 'messages';\nexport const CURRENCY_COLLECTION = 'currencies';\nexport const API_LOG_COLLECTION = 'api_logs'\nexport const ROLE_COLLECTION = 'roles';\nexport const PERMISSION_COLLECTION = 'permissions';\nexport const TRAFFIC_POLICY_COLLECTION = 'traffic_policies';\n\n// Timestamp specs\nexport const timestampNullableOptional = { _type: 'timestamp' as const, nullable: true, optional: true };\nexport const timestampNullable = { _type: 'timestamp' as const, nullable: true, optional: false };\nexport const timestampRequired = { _type: 'timestamp' as const, nullable: false, optional: false };\n\nexport const hubbyModelSpec = {\n id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n created_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n updated_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n}\n\nexport const tagModelSpec = {\n ...hubbyModelSpec,\n slug: z.string(),\n name: z.string(),\n description: z.string().nullable().optional(),\n color: z.string().nullable().optional(),\n}","import { z } from 'zod';\nimport {\n PARTNER_COLLECTION,\n PROMO_CODE_COLLECTION,\n USER_COLLECTION,\n ESIM_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema } from '../constants';\nimport { packageSpecificationSchema } from './promocode';\n\n// Enum for communication channels\nexport const communicationChannelSchema = z.enum([\n 'EMAIL',\n 'WHATSAPP',\n 'PUSH_NOTIFICATION',\n 'SMS'\n]);\nexport type CommunicationChannelType = z.infer;\n\n// For backward compatibility\nexport type CommunicationChannel = CommunicationChannelType;\n\n// Add enum-like object for use in code\nexport const CommunicationChannel = {\n EMAIL: 'EMAIL' as const,\n WHATSAPP: 'WHATSAPP' as const,\n PUSH_NOTIFICATION: 'PUSH_NOTIFICATION' as const,\n SMS: 'SMS' as const\n} as const;\n\n// Status type for bookings\nexport const bookingStatusSchema = z.enum([\n 'PENDING',\n 'CONFIRMED',\n 'COMPLETED',\n 'CANCELLED',\n 'UNPAID',\n 'EXPIRED'\n]);\nexport type BookingStatus = z.infer;\n\n// Communication options schema\nexport const communicationOptionsSchema = z.object({\n should_send_message: z.boolean(),\n channels: z.array(communicationChannelSchema)\n});\n\nexport type CommunicationOptions = z.infer;\n\n// Define the booking schema spec\nexport const bookingSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n external_id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n title: z.string().nullable(),\n first_name: z.string().nullable().optional(),\n last_name: z.string().nullable().optional(),\n full_name: z.string().nullable().optional(),\n pax: z.number(),\n email: z.string().email().nullable(),\n phone: z.string().nullable(),\n booking_id: z.string().nullable(),\n flight_number: z.string().optional(),\n gender: z.enum(['M', 'F', 'O']).optional(),\n package_size: z.string().optional(),\n sent_messages: z.record(z.any()).optional(),\n locale: supportedLocalesSchema,\n status: bookingStatusSchema,\n data: {\n _type: 'object' as const,\n of: {\n source: z.string(),\n manual: z.boolean()\n }\n },\n communication_options: {\n _type: 'object' as const,\n of: {\n should_send_message: z.boolean(),\n channels: {\n _type: 'array' as const,\n of: communicationChannelSchema\n }\n }\n },\n is_processed_for_esim_restoration: z.boolean(),\n is_pseudonymized: z.boolean(),\n import_id: z.string().nullable().optional(),\n package_specifications: z.array(packageSpecificationSchema).min(1),\n departure_date: timestampRequired,\n return_date: timestampNullable,\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION },\n promo_codes: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: PROMO_CODE_COLLECTION }\n },\n users: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: USER_COLLECTION },\n nullable: true\n },\n esims: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: ESIM_COLLECTION },\n nullable: true\n }\n});\n\n","import { z } from \"zod\";\n\nexport const SUPPORTED_LOCALES = [\n \"en-US\",\n \"en-EU\",\n \"en-GB\",\n \"en-CA\",\n \"nl-NL\",\n \"de-DE\",\n \"fr-FR\",\n \"it-IT\",\n \"es-ES\",\n \"cs-CZ\",\n \"pl-PL\",\n \"pt-PT\",\n \"fr-BE\",\n \"nl-BE\",\n \"de-AT\",\n \"de-CH\",\n \"fr-CH\",\n \"it-CH\",\n \"sv-SE\",\n \"sk-SK\",\n \"de-BE\",\n \"en-AU\",\n \"da-DK\",\n] as const;\n\n// Define the type using TypeScript's typeof and indexing\n\n// Define the type using TypeScript's typeof and indexing\nexport type SupportedLocales = (typeof SUPPORTED_LOCALES)[number];\n\n// Create a Zod schema for validation\nexport const supportedLocalesSchema = z.enum(SUPPORTED_LOCALES);\n\n// Type inference from the schema (alternative way to define the type)\nexport type SupportedLocalesFromSchema = z.infer;\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n PARTNER_COLLECTION,\n COUNTRY_COLLECTION,\n PACKAGE_COLLECTION,\n BOOKING_COLLECTION,\n PROMO_CODE_COLLECTION,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// Define package specification schema for use in promo code\nexport const packageSpecificationSchema = z.object({\n destination: z.string().optional(),\n size: z.string().optional(),\n package_id: z.string().optional(),\n iata_code: z.string().optional(),\n package_duration: z.number().optional(),\n package_type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).optional(),\n traffic_policy: z.string().optional(),\n});\n\n// Define the promo code schema spec\nexport const promoCodeSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n redeemed_at: timestampNullableOptional,\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // PromoCode specific fields\n external_id: z.string(),\n code: z.string(),\n allowance_user: z.number(),\n allowance_total: z.number(),\n type: z.enum(['discount', 'booking', 'booking_without_destination']).nullable().or(z.string()),\n usage: z.array(z.string()),\n uuid_usage: z.array(z.string()),\n package_specification: packageSpecificationSchema.optional(),\n valid_from: timestampRequired,\n valid_to: timestampRequired,\n\n // Reference fields\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION, nullable: true },\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n booking: { _type: 'docRef' as const, collection: BOOKING_COLLECTION, nullable: true },\n\n // Optional fields based on the type\n discount: z.number().optional(),\n package_size: z.string().optional(),\n countries: z.array(z.string()).optional(),\n max_bytes: z.number().optional(),\n starter_data: z.number().optional()\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const countrySchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n bokun_id: z.number().nullable(),\n LTE: z.boolean().nullable(),\n apn: z.string().nullable(),\n click_count: z.number().nullable(),\n global_network: z.string().nullable(),\n global_price: z.number().nullable(),\n hubby: z.number().nullable(),\n imsi: z.number().nullable(),\n has_esim: z.boolean(),\n name: z.string().nullable(),\n region: z.boolean().nullable(),\n i18n_name: z.record(z.string()),\n is_region: z.boolean().nullable(),\n countries: z.array(z.string()).nullable(),\n tier: z.number().nullable()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define schema for conversion rates (for backward compatibility)\nexport const conversionRateSchema = z.object({\n currency: z.number()\n});\n\nexport type CoversionRate = z.infer;\n\n// Define the currency schema spec\nexport const currencySchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n // ISO 4217 currency code (e.g., \"USD\", \"EUR\")\n code: z.string().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n // Currency symbol (e.g., \"$\", \"€\")\n symbol: z.string().describe('Currency symbol (e.g., \"$\", \"€\")'),\n // Full name of the currency (e.g., \"US Dollar\")\n name: z.string().describe('Full name of the currency (e.g., \"US Dollar\")'),\n // Exchange rate relative to base currency\n rate: z.number().describe('Exchange rate relative to base currency'),\n // Whether this is the default currency\n is_default: z.boolean().describe('Whether this is the default currency')\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n USER_COLLECTION,\n PARTNER_COLLECTION,\n PAYMENT_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\n\n// Define the eSIM schema spec\nexport const esimSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Common eSIM fields\n imsi: z.number(),\n qr: z.string(),\n iccid: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable().optional(),\n total_data: z.number(),\n data_left: z.number(),\n data_used: z.boolean(),\n status: z.string().nullable(),\n name: z.string(),\n android_auto: z.boolean(),\n partner_price: z.number().nullable(),\n promo: z.string().nullable(),\n type: z.enum(['api', 'promo', 'balance', 'code', 'external', 'payment']),\n is_auto_install: z.boolean(),\n is_archived: z.boolean(),\n user: z.string().nullable(),\n payment: z.string().nullable(),\n apn: z.string().nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Timestamp fields\n time_assigned: timestampNullable,\n last_updated: timestampNullable\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n USER_COLLECTION,\n timestampRequired\n} from './common';\n\n// Define the payment schema spec\nexport const paymentSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Payment specific fields\n amount: z.number(),\n customer: z.string(),\n date: timestampRequired,\n iccid: z.string(),\n package: z.string(),\n promo: z.string(),\n topup: z.boolean(),\n\n // Reference fields\n user: { _type: 'docRef' as const, collection: USER_COLLECTION, nullable: true, optional: true }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define the message schema spec\nexport const messageSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n key: z.string(),\n method: z.enum([\"push\", \"sms\", \"email\"]),\n status: z.enum([\"pending\", \"sent\", \"failed\", \"delivered\"]),\n created_at: timestampRequired,\n updated_at: timestampRequired\n});\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const trafficPolicySpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n name: z.string(),\n description: z.string(),\n external_id: z.string(),\n provider: z.string()\n})","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n PARTNER_COLLECTION,\n TRAFFIC_POLICY_COLLECTION,\n timestampRequired,\n hubbyModelSpec\n} from './common';\n\nimport { countrySchemaSpec } from './country';\n\n// Define the package schema spec\nexport const packageSchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n // Package specific fields\n external_id: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable(),\n label: z.string(),\n bytes: z.number(),\n hidden: z.boolean(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n price: z.number(),\n partner_price: z.number(),\n days: z.number(),\n name: z.string(),\n type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).nullable(),\n throttling: z.number().optional(),\n provider_parameters: z.object({\n imsi: z.number()\n }).nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Nested country data - need to use dynamic reference to country schema\n // This would typically be handled better with a proper recursive schema definition\n // but for simplicity, we're using any type here\n country_data: {\n _type: 'object' as const,\n of: countrySchemaSpec,\n nullable: true,\n optional: true\n }\n // country_data: z.any().nullable()\n});\n\nexport const commonPackageSchema = markAsSchemaSpec({\n size: z.string(),\n iso: z.string(),\n days: z.number(),\n price: z.number(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n packageType: z.string(),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n});\n\nexport const telnaPackageSchema = markAsSchemaSpec({\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n ...commonPackageSchema,\n});\n\nexport const bondioPackageSchema = markAsSchemaSpec({\n ...commonPackageSchema,\n label: z.enum(['lambda', 'tau']),\n});","import { z, ZodLazy } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema, SUPPORTED_LOCALES, SupportedLocales } from '../constants';\nimport {\n PARTNER_COLLECTION,\n USER_COLLECTION,\n PACKAGE_COLLECTION,\n PRICE_LIST_COLLECTION,\n tagModelSpec,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// ===== Helper schemas for nested structures =====\n\n// Address schema\nexport const addressSchema = z.object({\n street: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n postal_code: z.string().nullable().optional(),\n country: z.string().nullable().optional()\n});\n\n// Emit event schema\nexport const emitEventSchema = z.object({\n topup: z.boolean().optional().default(false),\n redemption: z.boolean().optional().default(false),\n activation: z.boolean().optional().default(false),\n depletion: z.boolean().optional().default(false),\n});\n\n// Registration schema\nexport const registrationSchema = z.object({\n chamber_of_commerce_number: z.string().nullable().optional(),\n vat_number: z.string().nullable().optional(),\n anvr_number: z.number().nullable().optional(),\n tax_number: z.string().nullable().optional()\n});\n\n// Banking details schema\nexport const bankingDetailsSchema = z.object({\n account_holder: z.string().nullable().optional(),\n bank_name: z.string().nullable().optional(),\n iban: z.string().nullable().optional(),\n currency: z.string().nullable().optional()\n});\n\n// Package price schema\nexport const packagePriceSchema = z.object({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: z.object({ _type: z.literal('docRef'), collection: z.literal(PACKAGE_COLLECTION) })\n});\n\n// Package specification schema\nexport const packageSpecificationSchema = z.object({\n size: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n destination: z.string().nullable().optional()\n});\n\n// Pricing strategy schema\nexport const pricingStrategySchema = z.object({\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: z.object({\n _type: z.literal('docRef'),\n collection: z.literal(PRICE_LIST_COLLECTION),\n nullable: z.literal(true)\n }),\n custom_prices: z.array(packagePriceSchema)\n});\n\n// Visual identity banner schema\nexport const visualIdentityBannerSchema = z.object({\n image_url: z.string(),\n alt: z.string(),\n click_url: z.string(),\n locale: supportedLocalesSchema,\n properties: z.record(z.string())\n});\n\n// Schedule filter schema\nexport const scheduleFilterSchema = z.object({\n type: z.enum(['iso3', 'gender', 'percentage', 'age']),\n value: z.union([z.string(), z.number()]),\n comparison: z.enum([\n 'equal',\n 'not_equal',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal'\n ])\n});\n\n// Convert object-like schemas to proper Zod objects\nexport const visualIdentityBannersSchema = z.object({\n strategy: z.enum(['fixed', 'rotating', 'destination', 'time_of_day']),\n banners: z.array(visualIdentityBannerSchema).nullable().optional()\n});\n\nexport const visualIdentitySchema = z.object({\n primary_color: z.string(),\n secondary_color: z.string(),\n logo: z.string(),\n font: z.string().nullable().optional(),\n top_banner: visualIdentityBannersSchema.optional(),\n mid_banner: visualIdentityBannersSchema.optional()\n});\n\n// Partner contact schema\nexport const partnerContactSchema = z.object({\n name: z.string().nullable().optional(),\n email: z.string().nullable(),\n office_phone: z.string().nullable().optional()\n});\n\n// Partner data schema\nexport const partnerDataSchema = z.object({\n source: z.string(),\n manual: z.boolean()\n});\n\n// Package strategy schema\nexport const packageStrategySchema = z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any()\n});\n\n// Schedule email schema\nexport const scheduleEmailSchema = z.object({\n brevo_template_id: z.number(),\n subject: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional(),\n preview_text: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional()\n}).nullable().optional();\n\n// Schedule push schema\nexport const schedulePushSchema = z.object({\n title: z.record(z.string()).optional(),\n body: z.record(z.string()).optional(),\n target: z.string()\n}).nullable().optional();\n\n// Schedule schema\nexport const scheduleSchema = z.object({\n days: z.number(),\n email: scheduleEmailSchema,\n push: schedulePushSchema,\n hour: z.number(),\n key: z.string(),\n method: z.enum(['email', 'sms', 'whatsapp', 'push']),\n moment: z.enum(['departure_date', 'return_date', 'immediate']),\n filter: scheduleFilterSchema.nullable().optional()\n});\n\nexport const freeEsimSchema = z.object({\n enabled: z.boolean(),\n package_specification: z.object({\n size: z.string(),\n type: z.string(),\n destination: z.string()\n }),\n booking_id_verification: z.boolean().default(false),\n booking_id_verification_pattern: z.string().nullable().optional(),\n allowance: z.number(),\n total_allowance: z.number(),\n});\n\n// Platform settings schema\nexport const platformSettingsSchema = z.object({\n package_strategy: z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any(),\n supported_package_types: z.enum(['data-limited', 'unlimited']).optional()\n }).nullable().optional(),\n free_esim: freeEsimSchema.nullable().optional(),\n booking_defaults: z.object({\n locale: supportedLocalesSchema\n }).nullable().optional(),\n booking_confirmation: z.object({\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n }).nullable().optional(),\n emit_events: emitEventSchema.nullable().optional(),\n schedules: z.array(scheduleSchema).optional(),\n visual_identity_options: z.object({\n hubby_branding: z.boolean().optional().default(true),\n source_partner_branding: z.boolean().optional().default(false),\n own_branding: z.boolean().optional().default(false)\n }).nullable().optional()\n});\n\n// ===== Exportable schema specs =====\n\n// Package price schema spec\nexport const packagePriceSchemaSpec = markAsSchemaSpec({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n});\n\n// Financial properties schema spec\nexport const financialPropertiesSchemaSpec = markAsSchemaSpec({\n administration_fee: z.number().nullable(),\n income_per_gb: z.number().nullable(),\n commission_fee: z.number().nullable().optional(),\n payment_method: z.enum(['invoice', 'direct']),\n requires_card: z.boolean().nullable(),\n next_invoice: timestampNullableOptional,\n last_invoice: timestampNullableOptional,\n pricing_strategies: {\n _type: 'object' as const,\n of: {\n partner: {\n _type: 'object' as const,\n of: {\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n },\n user: {\n _type: 'object' as const,\n of: {\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n }\n },\n nullable: true\n }\n});\n\n// Platform settings schema spec\nexport const platformSettingsSchemaSpec = markAsSchemaSpec({\n package_strategy: {\n _type: 'object' as const,\n of: packageStrategySchema.shape,\n nullable: true,\n optional: true\n },\n free_esim: {\n _type: 'object' as const,\n of: freeEsimSchema.shape,\n nullable: true,\n optional: true\n },\n booking_defaults: {\n _type: 'object' as const,\n of: {\n locale: supportedLocalesSchema\n },\n nullable: true,\n optional: true\n },\n booking_confirmation: {\n _type: 'object' as const,\n of: {\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n },\n nullable: true,\n optional: true\n },\n schedules: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: scheduleSchema.shape\n },\n optional: true\n }\n});\n\n// Webhook settings schema\nexport const webhookSettingsSchema = z.object({\n url: z.string().url().nullable().optional(),\n api_key: z.string().nullable().optional(),\n enabled: z.boolean().default(false),\n events: z.object({\n promocode_redemption: z.boolean().default(false)\n }).default({})\n});\n\n// ===== Main partner schema =====\nexport const partnerSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Partner specific fields\n name: z.string().min(3),\n type: z.string().nullable(),\n is_active: z.boolean().nullable().optional(),\n external_id: z.string().nullable().optional(),\n\n // Complex nested objects\n contact: {\n _type: 'object' as const,\n of: partnerContactSchema.shape,\n nullable: true\n },\n address: {\n _type: 'object' as const,\n of: addressSchema.shape,\n nullable: true\n },\n registration: {\n _type: 'object' as const,\n of: registrationSchema.shape,\n nullable: true\n },\n banking_details: {\n _type: 'object' as const,\n of: bankingDetailsSchema.shape,\n nullable: true\n },\n\n // Reference fields\n parent: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n users: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: USER_COLLECTION }, nullable: true },\n\n // Complex nested structures\n financial_properties: financialPropertiesSchemaSpec,\n // Visual identity\n visual_identity: {\n _type: 'object' as const,\n of: visualIdentitySchema.shape,\n nullable: true\n },\n\n // Platform settings\n platform_settings: {\n _type: 'object' as const,\n of: platformSettingsSchema.shape,\n nullable: true\n },\n\n // Tags\n tags: {\n _type: 'array' as const,\n of: tagModelSpec,\n nullable: true,\n optional: true\n },\n\n // Metadata\n data: {\n _type: 'object' as const,\n of: partnerDataSchema.shape,\n nullable: true,\n optional: true\n },\n\n // Webhook settings\n webhook_settings: {\n _type: 'object' as const,\n of: webhookSettingsSchema.shape,\n nullable: true,\n optional: true\n }\n});\n\n// ===== Price list schema =====\nexport const priceListSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Price list specific fields\n name: z.string().min(3),\n description: z.string().nullable(),\n type: z.enum(['partner', 'consumer']),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec, PARTNER_COLLECTION } from './common';\n\n// Country schema spec\nexport const analyticsSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n service: z.string(),\n date: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/), // YYYY-MM-DD\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n event: z.string(),\n parameter: z.string().nullable(),\n sum: z.number(),\n});","import { z } from 'zod';\nimport { timestampRequired } from './common';\nimport { markAsSchemaSpec } from '../common';\n\nexport const payloadSpec = {\n _type: 'record' as const,\n of: z.unknown(),\n optional: true\n};\n\nexport const apiLogSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n method: z.string(),\n user_id: z.string().optional(),\n path: z.string(),\n resource_type: z.string().optional(),\n resource_id: z.string().optional(),\n partner_id: z.string().optional(),\n payload: payloadSpec,\n timestamp: timestampRequired,\n status_code: z.number()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional, PERMISSION_COLLECTION } from './common';\n\nexport const roleSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional } from './common';\n\nexport const permissionSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { buildClientSchema } from './builders/client';\nimport {\n userSchemaSpec,\n apiKeySpec,\n apiKeysSpec,\n apiKeysObjectSpec\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { bondioPackageSchema, packageSchemaSpec, telnaPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n financialPropertiesSchemaSpec as financialPropertiesSchema,\n packagePriceSchema,\n platformSettingsSchema,\n visualIdentitySchema,\n pricingStrategySchema,\n freeEsimSchema,\n} from './specs/partner';\nimport { analyticsSpec } from './specs/analytics';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { roleSchemaSpec } from './specs/role';\nimport { permissionSchemaSpec } from './specs/permission';\n\nexport const HUserSchema = buildClientSchema(userSchemaSpec);\nexport const HBookingSchema = buildClientSchema(bookingSchemaSpec);\nexport const HCountrySchema = buildClientSchema(countrySchemaSpec);\nexport const HCurrencySchema = buildClientSchema(currencySchemaSpec);\nexport const HESIMSchema = buildClientSchema(esimSchemaSpec);\nexport const HPaymentSchema = buildClientSchema(paymentSchemaSpec);\nexport const HMessageSchema = buildClientSchema(messageSchemaSpec);\nexport const HPackageSchema = buildClientSchema(packageSchemaSpec);\nexport const HPromoCodeSchema = buildClientSchema(promoCodeSchemaSpec);\nexport const HPartnerSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPriceListSchema = buildClientSchema(priceListSchemaSpec);\nexport const HFinancialPropertiesSchema = buildClientSchema(financialPropertiesSchema);\nexport const HApiLogSchema = buildClientSchema(apiLogSchemaSpec);\nexport const HPackagePriceSchema = buildClientSchema(packagePriceSchema);\nexport const HubbyModelSchema = buildClientSchema(hubbyModelSpec);\nexport const HPartnerAppSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPlatformSettingsSchema = buildClientSchema(platformSettingsSchema);\nexport const HVisualIdentitySchema = buildClientSchema(visualIdentitySchema);\nexport const HPricingStrategySchema = buildClientSchema(pricingStrategySchema);\nexport const HFreeEsimSchema = buildClientSchema(freeEsimSchema);\nexport const HAnalyticsSchema = buildClientSchema(analyticsSpec);\nexport const HRoleSchema = buildClientSchema(roleSchemaSpec);\nexport const HPermissionSchema = buildClientSchema(permissionSchemaSpec);\nexport const HTagSchema = buildClientSchema(tagModelSpec);\nexport const HTrafficPolicySchema = buildClientSchema(trafficPolicySpec);\nexport const HTelnaPackageSchema = buildClientSchema(telnaPackageSchema);\nexport const HBondioPackageSchema = buildClientSchema(bondioPackageSchema);\n// Additional lower-level schemas\nexport const HAddressSchema = addressSchema;\nexport const HRegistrationSchema = registrationSchema;\nexport const HBankingDetailsSchema = bankingDetailsSchema;\nexport const HPartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const HPromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const HVisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const HScheduleFilterSchema = scheduleFilterSchema;\nexport const HPartnerContactSchema = partnerContactSchema;\nexport const HPartnerDataSchema = partnerDataSchema;\nexport const HCommunicationChannelSchema = communicationChannelSchema;\nexport const HBookingStatusSchema = bookingStatusSchema;\nexport const HCommunicationOptionsSchema = communicationOptionsSchema;\n\nexport type HAnalytics = z.infer;\nexport type HUser = z.infer;\nexport type HBooking = z.infer;\nexport type HCountry = z.infer;\nexport type HCurrency = z.infer;\nexport type HESIM = z.infer;\nexport type HPayment = z.infer;\nexport type HMessage = z.infer;\nexport type HPackage = z.infer;\nexport type HPromoCode = z.infer;\nexport type HPartner = z.infer;\nexport type HPriceList = z.infer;\nexport type HApiLog = z.infer;\nexport type HTag = z.infer;\nexport type HTrafficPolicy = z.infer;\nexport type HBondioPackage = z.infer;\nexport type HTelnaPackage = z.infer;\n// Additional lower-level types\nexport type HAddress = z.infer;\nexport type HRegistration = z.infer;\nexport type HBankingDetails = z.infer;\nexport type HPartnerPackageSpecification = z.infer;\nexport type HPromoPackageSpecification = z.infer;\nexport type HVisualIdentityBanner = z.infer;\nexport type HFinancialProperties = z.infer;\nexport type HScheduleFilter = z.infer;\nexport type HPartnerContact = z.infer;\nexport type HPartnerData = z.infer;\nexport type HCommunicationChannel = z.infer;\nexport type HBookingStatus = z.infer;\nexport type HCommunicationOptions = z.infer;\nexport type HHubbyModel = z.infer;\n\nexport type HubbyModelApp = HHubbyModel;\n\nexport type SupportedLocales = typeof SUPPORTED_LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\nexport type HRole = z.infer;\nexport type HPermission = z.infer; "]} \ No newline at end of file +{"version":3,"sources":["../../src/builders/client.ts","../../src/common.ts","../../src/specs/user.ts","../../src/specs/common.ts","../../src/specs/booking.ts","../../src/constants.ts","../../src/specs/promocode.ts","../../src/specs/country.ts","../../src/specs/currency.ts","../../src/specs/esim.ts","../../src/specs/payment.ts","../../src/specs/message.ts","../../src/specs/traffic_policy.ts","../../src/specs/package.ts","../../src/specs/partner.ts","../../src/specs/analytics.ts","../../src/specs/apiLogs.ts","../../src/specs/role.ts","../../src/specs/permission.ts","../../src/index.client.ts"],"names":["z","packageSpecificationSchema","SUPPORTED_LOCALES"],"mappings":";AAAA,SAAS,KAAAA,UAAqB;;;ACA9B,SAAqB,SAAS;AAQvB,SAAS,cACZ,QACA,SAQU;AACV,MAAI,CAAC;AAAS,WAAO;AAErB,MAAI,UAAU;AAGd,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAEA,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAGA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAEhD,QAAI,CAAC,YAAY,UAAU,EAAE,SAAS,GAAG,KAAK,UAAU,QAAW;AAC/D;AAAA,IACJ;AAGA,QAAI,OAAQ,QAAgB,GAAG,MAAM,YAAY;AAC7C,gBAAW,QAAgB,GAAG,EAAE,KAAK;AAAA,IACzC;AAAA,EACJ;AAEA,SAAO;AACX;AAEO,SAAS,iBACZ,MACA,MACA,SACU;AACV,QAAM,aAAa,KAAK,KAAK,GAAG;AAEhC,MAAI,EAAE,QAAQ,OAAO;AACjB,UAAM,IAAI,MAAM,mBAAmB,UAAU,mBAAmB;AAAA,EACpE;A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BAAiB;AAChE,IAAM,sBAAsB,kBAAkB,kBAAkB;AAChE,IAAM,uBAAuB,kBAAkB,mBAAmB;AAElE,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,wBAAwB;AAC9B,IAAM,qCAAqCC;AAC3C,IAAM,mCAAmC;AACzC,IAAM,8BAA8B;AACpC,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,qBAAqB;AAC3B,IAAM,8BAA8B;AACpC,IAAM,uBAAuB;AAC7B,IAAM,8BAA8B;AAsCpC,IAAMC,qBAAoB","sourcesContent":["import { z, ZodTypeAny } from 'zod';\nimport type { FieldSpec, SchemaFromSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\n\nexport function buildClientSchema(spec: S, path: string[] = []): SchemaFromSpec {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid schema spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec) as unknown as SchemaFromSpec;\n }\n\n // Check if object might be a Zod schema (has _def property or ~standard metadata)\n if (typeof spec === 'object' && spec !== null &&\n (('_def' in spec) || ('~standard' in spec && (spec as any)['~standard']?.vendor === 'zod'))) {\n try {\n // Try to use it as a Zod schema directly\n return wrapZodSchema(spec as unknown as z.ZodTypeAny) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this fails, we'll continue with the other checks\n console.warn(`Failed to use object as Zod schema at \"${pathString}\":`, error);\n }\n }\n\n // ----- Array -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.array(buildClientSchema(spec.of, [...path, '[i]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Record -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.record(buildClientSchema(spec.of, [...path, '[key]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Timestamp -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'timestamp') {\n let schema: ZodTypeAny = z.preprocess((val) => {\n if (typeof val === 'string') {\n // Try to parse the string to a Date object\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date; // undefined will cause z.date() to fail\n }\n if (typeof val === 'number') {\n // Handle numeric timestamps\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date;\n }\n // If it's already a Date or something else, return it as is\n return val;\n }, z.date({ required_error: 'Date is required', invalid_type_error: 'Invalid date format' }));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- DocRef -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'docRef') {\n let schema: ZodTypeAny = z.string(); // only ID on client\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Object (plain nested object spec) -----\n if (\n typeof spec === 'object' &&\n spec !== null &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || (typeof spec === 'object' && spec !== null && '_type' in spec && (spec as any)._type === 'object')) {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // If we have an object with fields that look like schema specs, try to handle it as a schema object\n if (typeof spec === 'object' && spec !== null) {\n try {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this also fails, we'll throw the error below\n console.warn(`Failed to handle object as plain schema at \"${pathString}\":`, error);\n }\n }\n\n // 🔥 If we got here, the spec had a structure we didn't handle\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n}\n\n","import { ZodTypeAny, z } from 'zod';\nimport type { SchemaBuilder } from './types';\n\n/**\n * Ensures a Zod schema is wrapped to be optional and/or nullable,\n * if not already. Use this in recursive schema builders.\n * Also applies any other supported schema transformations provided in options.\n */\nexport function wrapZodSchema(\n schema: ZodTypeAny,\n options?: {\n optional?: boolean;\n nullable?: boolean;\n min?: number;\n max?: number;\n // Allow arbitrary extensions via dynamic property\n [key: string]: any;\n }\n): ZodTypeAny {\n if (!options) return schema;\n\n let wrapped = schema;\n\n // Handle nullable and optional specially since they're common\n if (options.nullable && !wrapped.isNullable?.()) {\n wrapped = wrapped.nullable();\n }\n\n if (options.optional && !wrapped.isOptional?.()) {\n wrapped = wrapped.optional();\n }\n\n // Process all other options dynamically\n for (const [key, value] of Object.entries(options)) {\n // Skip the already handled properties and undefined values\n if (['nullable', 'optional'].includes(key) || value === undefined) {\n continue;\n }\n\n // Check if the schema has a method matching the option key\n if (typeof (wrapped as any)[key] === 'function') {\n wrapped = (wrapped as any)[key](value);\n }\n }\n\n return wrapped;\n}\n\nexport function wrapObjectSchema(\n spec: any, // using any to support dynamic `spec.type === 'object'`\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n if (!('of' in spec)) {\n throw new Error(`Object spec at \"${pathString}\" is missing 'of'`);\n }\n\n const shape: Record = {};\n for (const [key, value] of Object.entries(spec.of)) {\n shape[key] = builder(value as any, [...path, key]);\n }\n\n let objectSchema: ZodTypeAny = z.object(shape);\n if (spec.nullable) objectSchema = objectSchema.nullable();\n if (spec.optional) objectSchema = objectSchema.optional();\n return objectSchema;\n}\n\n/**\n * Wraps a plain object shape (no `type: 'object'`) into a Zod schema.\n * Assumes each field is either a Zod schema or another FieldSpec.\n */\nexport function wrapPlainObjectSchema(\n spec: Record,\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n // Handle object field specs with '_type': 'object'\n if ('_type' in spec && spec._type === 'object' && 'of' in spec) {\n return wrapObjectSchema(spec, path, builder);\n }\n\n const shape: Record = {};\n\n // Only add fields to the schema if they're not special control properties\n for (const [key, val] of Object.entries(spec)) {\n if (key !== '_type' && key !== 'nullable' && key !== 'optional') {\n shape[key] = builder(val, [...path, key]);\n }\n }\n\n // Create the base object schema\n let schema: ZodTypeAny = z.object(shape);\n\n // Apply nullable/optional modifiers if needed\n if ('nullable' in spec && spec.nullable === true) {\n schema = schema.nullable();\n }\n\n if ('optional' in spec && spec.optional === true) {\n schema = schema.optional();\n }\n\n return schema;\n}\n\nexport const SCHEMA_MARKER = Symbol('ZodSchemaSpecMarker');\n\nexport function markAsSchemaSpec(spec: T): T {\n Object.defineProperty(spec, SCHEMA_MARKER, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return spec;\n}\n\nexport function isSchemaSpec(obj: unknown): obj is Record {\n return typeof obj === 'object' && obj !== null && SCHEMA_MARKER in obj;\n}","import { z } from 'zod';\nimport { PARTNER_COLLECTION, PROFILE_COLLECTION, timestampNullableOptional, timestampRequired, timestampNullable, ROLE_COLLECTION, PERMISSION_COLLECTION } from './common';\nimport { markAsSchemaSpec } from '../common'\n\nexport const apiKeySpec = {\n expires_at: { _type: 'timestamp' as const },\n secret: z.string(),\n is_active: z.boolean(),\n}\n\nexport const apiKeysSpec = {\n _type: 'record' as const,\n of: {\n _type: 'object' as const,\n of: apiKeySpec\n }\n}\n\nexport const apiKeysObjectSpec = {\n _type: 'object' as const,\n of: {\n allowed_keys: { _type: 'array' as const, nullable: true, optional: true, of: z.string() },\n keys: apiKeysSpec\n },\n nullable: true,\n optional: true\n}\n\nexport const userSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string().nullable(),\n email: z.string().email().nullable(),\n stripe_id: z.string().nullable().optional(),\n referral: z.string().nullable().optional(),\n fcm: z.string().optional(),\n deeplink: z.string().nullable().optional(),\n gender: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n coordinates: z.string().nullable().optional(),\n parameters: z.any().nullable().optional(),\n locale: z.string().nullable().optional(),\n phone_model: z.string().nullable().optional(),\n phone_os: z.string().nullable().optional(),\n phone_os_version: z.string().nullable().optional(),\n ios: z.boolean().nullable().optional(),\n has_card_saved: z.boolean().nullable().optional(),\n admin: z.boolean().nullable().optional(),\n api_keys: apiKeysObjectSpec,\n currency: z.string().nullable().optional(),\n receipt_email: z.string().nullable().optional(),\n source: z.enum(['direct', 'promo', 'platform']).nullable().optional(),\n role: { _type: 'docRef' as const, collection: ROLE_COLLECTION, optional: true, nullable: true },\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n balance: z.number().nullable().optional(),\n createdAt: { _type: 'timestamp' as const },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, optional: true, nullable: true },\n profileRef: { _type: 'docRef' as const, collection: PROFILE_COLLECTION, optional: true, nullable: true },\n review_requested: timestampNullableOptional,\n last_seen: timestampNullableOptional\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\n\n// Collection paths\nexport const PARTNER_COLLECTION = '/companies/hubby/partners';\nexport const USER_COLLECTION = 'users';\nexport const PROFILE_COLLECTION = '/companies/hubby/profiles';\nexport const PACKAGE_COLLECTION = '/companies/hubby/packages';\nexport const PROMO_CODE_COLLECTION = '/companies/hubby/promo_codes';\nexport const COUNTRY_COLLECTION = 'countries';\nexport const ESIM_COLLECTION = 'esims';\nexport const PAYMENT_COLLECTION = 'payments';\nexport const PRICE_LIST_COLLECTION = 'price_lists';\nexport const BOOKING_COLLECTION = 'bookings';\nexport const MESSAGE_COLLECTION = 'messages';\nexport const CURRENCY_COLLECTION = 'currencies';\nexport const API_LOG_COLLECTION = 'api_logs'\nexport const ROLE_COLLECTION = 'roles';\nexport const PERMISSION_COLLECTION = 'permissions';\nexport const TRAFFIC_POLICY_COLLECTION = 'traffic_policies';\n\n// Timestamp specs\nexport const timestampNullableOptional = { _type: 'timestamp' as const, nullable: true, optional: true };\nexport const timestampNullable = { _type: 'timestamp' as const, nullable: true, optional: false };\nexport const timestampRequired = { _type: 'timestamp' as const, nullable: false, optional: false };\n\nexport const hubbyModelSpec = {\n id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n created_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n updated_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n}\n\nexport const tagModelSpec = {\n ...hubbyModelSpec,\n slug: z.string(),\n name: z.string(),\n description: z.string().nullable().optional(),\n color: z.string().nullable().optional(),\n}","import { z } from 'zod';\nimport {\n PARTNER_COLLECTION,\n PROMO_CODE_COLLECTION,\n USER_COLLECTION,\n ESIM_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema } from '../constants';\nimport { packageSpecificationSchema } from './promocode';\n\n// Enum for communication channels\nexport const communicationChannelSchema = z.enum([\n 'EMAIL',\n 'WHATSAPP',\n 'PUSH_NOTIFICATION',\n 'SMS'\n]);\nexport type CommunicationChannelType = z.infer;\n\n// For backward compatibility\nexport type CommunicationChannel = CommunicationChannelType;\n\n// Add enum-like object for use in code\nexport const CommunicationChannel = {\n EMAIL: 'EMAIL' as const,\n WHATSAPP: 'WHATSAPP' as const,\n PUSH_NOTIFICATION: 'PUSH_NOTIFICATION' as const,\n SMS: 'SMS' as const\n} as const;\n\n// Status type for bookings\nexport const bookingStatusSchema = z.enum([\n 'PENDING',\n 'CONFIRMED',\n 'COMPLETED',\n 'CANCELLED',\n 'UNPAID',\n 'EXPIRED'\n]);\nexport type BookingStatus = z.infer;\n\n// Communication options schema\nexport const communicationOptionsSchema = z.object({\n should_send_message: z.boolean(),\n channels: z.array(communicationChannelSchema)\n});\n\nexport type CommunicationOptions = z.infer;\n\n// Define the booking schema spec\nexport const bookingSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n external_id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n title: z.string().nullable(),\n first_name: z.string().nullable().optional(),\n last_name: z.string().nullable().optional(),\n full_name: z.string().nullable().optional(),\n pax: z.number(),\n email: z.string().email().nullable(),\n phone: z.string().nullable(),\n booking_id: z.string().nullable(),\n flight_number: z.string().optional(),\n gender: z.enum(['M', 'F', 'O']).optional(),\n package_size: z.string().optional(),\n sent_messages: z.record(z.any()).optional(),\n locale: supportedLocalesSchema,\n status: bookingStatusSchema,\n data: {\n _type: 'object' as const,\n of: {\n source: z.string(),\n manual: z.boolean()\n }\n },\n communication_options: {\n _type: 'object' as const,\n of: {\n should_send_message: z.boolean(),\n channels: {\n _type: 'array' as const,\n of: communicationChannelSchema\n }\n }\n },\n is_processed_for_esim_restoration: z.boolean(),\n is_pseudonymized: z.boolean(),\n import_id: z.string().nullable().optional(),\n package_specifications: z.array(packageSpecificationSchema).min(1),\n departure_date: timestampRequired,\n return_date: timestampNullable,\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION },\n promo_codes: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: PROMO_CODE_COLLECTION }\n },\n users: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: USER_COLLECTION },\n nullable: true\n },\n esims: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: ESIM_COLLECTION },\n nullable: true\n }\n});\n\n","import { z } from \"zod\";\n\nexport const SUPPORTED_LOCALES = [\n \"en-US\",\n \"en-EU\",\n \"en-GB\",\n \"en-CA\",\n \"nl-NL\",\n \"de-DE\",\n \"fr-FR\",\n \"it-IT\",\n \"es-ES\",\n \"cs-CZ\",\n \"pl-PL\",\n \"pt-PT\",\n \"fr-BE\",\n \"nl-BE\",\n \"de-AT\",\n \"de-CH\",\n \"fr-CH\",\n \"it-CH\",\n \"sv-SE\",\n \"sk-SK\",\n \"de-BE\",\n \"en-AU\",\n \"da-DK\",\n] as const;\n\n// Define the type using TypeScript's typeof and indexing\n\n// Define the type using TypeScript's typeof and indexing\nexport type SupportedLocales = (typeof SUPPORTED_LOCALES)[number];\n\n// Create a Zod schema for validation\nexport const supportedLocalesSchema = z.enum(SUPPORTED_LOCALES);\n\n// Type inference from the schema (alternative way to define the type)\nexport type SupportedLocalesFromSchema = z.infer;\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n PARTNER_COLLECTION,\n COUNTRY_COLLECTION,\n PACKAGE_COLLECTION,\n BOOKING_COLLECTION,\n PROMO_CODE_COLLECTION,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// Define package specification schema for use in promo code\nexport const packageSpecificationSchema = z.object({\n destination: z.string().optional(),\n size: z.string().optional(),\n package_id: z.string().optional(),\n iata_code: z.string().optional(),\n package_duration: z.number().optional(),\n package_type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).optional(),\n traffic_policy: z.string().optional(),\n});\n\n// Define the promo code schema spec\nexport const promoCodeSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n redeemed_at: timestampNullableOptional,\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // PromoCode specific fields\n external_id: z.string(),\n code: z.string(),\n allowance_user: z.number(),\n allowance_total: z.number(),\n type: z.enum(['discount', 'booking', 'booking_without_destination']).nullable().or(z.string()),\n usage: z.array(z.string()),\n uuid_usage: z.array(z.string()),\n package_specification: packageSpecificationSchema.optional(),\n valid_from: timestampRequired,\n valid_to: timestampRequired,\n\n // Reference fields\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION, nullable: true },\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n booking: { _type: 'docRef' as const, collection: BOOKING_COLLECTION, nullable: true },\n\n // Optional fields based on the type\n discount: z.number().optional(),\n package_size: z.string().optional(),\n countries: z.array(z.string()).optional(),\n max_bytes: z.number().optional(),\n starter_data: z.number().optional()\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const countrySchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n bokun_id: z.number().nullable(),\n LTE: z.boolean().nullable(),\n apn: z.string().nullable(),\n click_count: z.number().nullable(),\n global_network: z.string().nullable(),\n global_price: z.number().nullable(),\n hubby: z.number().nullable(),\n imsi: z.number().nullable(),\n has_esim: z.boolean(),\n name: z.string().nullable(),\n region: z.boolean().nullable(),\n i18n_name: z.record(z.string()),\n is_region: z.boolean().nullable(),\n countries: z.array(z.string()).nullable(),\n tier: z.number().nullable()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define schema for conversion rates (for backward compatibility)\nexport const conversionRateSchema = z.object({\n currency: z.number()\n});\n\nexport type CoversionRate = z.infer;\n\n// Define the currency schema spec\nexport const currencySchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n // ISO 4217 currency code (e.g., \"USD\", \"EUR\")\n code: z.string().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n // Currency symbol (e.g., \"$\", \"€\")\n symbol: z.string().describe('Currency symbol (e.g., \"$\", \"€\")'),\n // Full name of the currency (e.g., \"US Dollar\")\n name: z.string().describe('Full name of the currency (e.g., \"US Dollar\")'),\n // Exchange rate relative to base currency\n rate: z.number().describe('Exchange rate relative to base currency'),\n // Whether this is the default currency\n is_default: z.boolean().describe('Whether this is the default currency')\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n USER_COLLECTION,\n PARTNER_COLLECTION,\n PAYMENT_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\n\n// Define the eSIM schema spec\nexport const esimSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Common eSIM fields\n imsi: z.number(),\n qr: z.string(),\n iccid: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable().optional(),\n total_data: z.number(),\n data_left: z.number(),\n data_used: z.boolean(),\n status: z.string().nullable(),\n name: z.string(),\n android_auto: z.boolean(),\n partner_price: z.number().nullable(),\n promo: z.string().nullable(),\n type: z.enum(['api', 'promo', 'balance', 'code', 'external', 'payment']),\n is_auto_install: z.boolean(),\n is_archived: z.boolean(),\n user: z.string().nullable(),\n payment: z.string().nullable(),\n apn: z.string().nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Timestamp fields\n time_assigned: timestampNullable,\n last_updated: timestampNullable\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n USER_COLLECTION,\n timestampRequired\n} from './common';\n\n// Define the payment schema spec\nexport const paymentSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Payment specific fields\n amount: z.number(),\n customer: z.string(),\n date: timestampRequired,\n iccid: z.string(),\n package: z.string(),\n promo: z.string(),\n topup: z.boolean(),\n\n // Reference fields\n user: { _type: 'docRef' as const, collection: USER_COLLECTION, nullable: true, optional: true }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define the message schema spec\nexport const messageSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n key: z.string(),\n method: z.enum([\"push\", \"sms\", \"email\"]),\n status: z.enum([\"pending\", \"sent\", \"failed\", \"delivered\"]),\n created_at: timestampRequired,\n updated_at: timestampRequired\n});\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const trafficPolicySpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n name: z.string(),\n description: z.string(),\n external_id: z.string(),\n provider: z.string()\n})","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n PARTNER_COLLECTION,\n TRAFFIC_POLICY_COLLECTION,\n timestampRequired,\n hubbyModelSpec\n} from './common';\n\nimport { countrySchemaSpec } from './country';\n\n// Define the package schema spec\nexport const packageSchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n // Package specific fields\n external_id: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable(),\n label: z.string(),\n bytes: z.number(),\n hidden: z.boolean(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n price: z.number(),\n partner_price: z.number(),\n days: z.number(),\n name: z.string(),\n type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).nullable(),\n throttling: z.number().optional(),\n provider_parameters: z.object({\n imsi: z.number()\n }).nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Nested country data - need to use dynamic reference to country schema\n // This would typically be handled better with a proper recursive schema definition\n // but for simplicity, we're using any type here\n country_data: {\n _type: 'object' as const,\n of: countrySchemaSpec,\n nullable: true,\n optional: true\n }\n // country_data: z.any().nullable()\n});\n\nexport const commonPackageSchema = markAsSchemaSpec({\n size: z.string(),\n iso: z.string(),\n days: z.number(),\n price: z.number(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n packageType: z.string(),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n});\n\nexport const telnaPackageSchema = markAsSchemaSpec({\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n ...commonPackageSchema,\n});\n\nexport const bondioPackageSchema = markAsSchemaSpec({\n ...commonPackageSchema,\n label: z.enum(['lambda', 'tau']),\n});","import { z, ZodLazy } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema, SUPPORTED_LOCALES, SupportedLocales } from '../constants';\nimport {\n PARTNER_COLLECTION,\n USER_COLLECTION,\n PACKAGE_COLLECTION,\n PRICE_LIST_COLLECTION,\n tagModelSpec,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// ===== Helper schemas for nested structures =====\n\n// Address schema\nexport const addressSchema = z.object({\n street: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n postal_code: z.string().nullable().optional(),\n country: z.string().nullable().optional()\n});\n\n// Emit event schema\nexport const emitEventSchema = z.object({\n topup: z.boolean().optional().default(false),\n redemption: z.boolean().optional().default(false),\n activation: z.boolean().optional().default(false),\n depletion: z.boolean().optional().default(false),\n});\n\n// Registration schema\nexport const registrationSchema = z.object({\n chamber_of_commerce_number: z.string().nullable().optional(),\n vat_number: z.string().nullable().optional(),\n anvr_number: z.number().nullable().optional(),\n tax_number: z.string().nullable().optional()\n});\n\n// Banking details schema\nexport const bankingDetailsSchema = z.object({\n account_holder: z.string().nullable().optional(),\n bank_name: z.string().nullable().optional(),\n iban: z.string().nullable().optional(),\n currency: z.string().nullable().optional()\n});\n\n// Package price schema\nexport const packagePriceSchema = z.object({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: z.object({ _type: z.literal('docRef'), collection: z.literal(PACKAGE_COLLECTION) })\n});\n\n// Package specification schema\nexport const packageSpecificationSchema = z.object({\n size: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n destination: z.string().nullable().optional()\n});\n\n// Pricing strategy schema\nexport const pricingStrategySchema = z.object({\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: z.object({\n _type: z.literal('docRef'),\n collection: z.literal(PRICE_LIST_COLLECTION),\n nullable: z.literal(true)\n }),\n custom_prices: z.array(packagePriceSchema)\n});\n\n// Visual identity banner schema\nexport const visualIdentityBannerSchema = z.object({\n image_url: z.string(),\n alt: z.string(),\n click_url: z.string(),\n locale: supportedLocalesSchema,\n properties: z.record(z.string())\n});\n\n// Schedule filter schema\nexport const scheduleFilterSchema = z.object({\n type: z.enum(['iso3', 'gender', 'percentage', 'age']),\n value: z.union([z.string(), z.number()]),\n comparison: z.enum([\n 'equal',\n 'not_equal',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal'\n ])\n});\n\n// Convert object-like schemas to proper Zod objects\nexport const visualIdentityBannersSchema = z.object({\n strategy: z.enum(['fixed', 'rotating', 'destination', 'time_of_day']),\n banners: z.array(visualIdentityBannerSchema).nullable().optional()\n});\n\nexport const visualIdentitySchema = z.object({\n primary_color: z.string(),\n secondary_color: z.string(),\n logo: z.string(),\n font: z.string().nullable().optional(),\n top_banner: visualIdentityBannersSchema.optional(),\n mid_banner: visualIdentityBannersSchema.optional()\n});\n\n// Partner contact schema\nexport const partnerContactSchema = z.object({\n name: z.string().nullable().optional(),\n email: z.string().nullable(),\n office_phone: z.string().nullable().optional()\n});\n\n// Partner data schema\nexport const partnerDataSchema = z.object({\n source: z.string(),\n manual: z.boolean()\n});\n\n// Package strategy schema\nexport const packageStrategySchema = z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any()\n});\n\n// Schedule email schema\nexport const scheduleEmailSchema = z.object({\n brevo_template_id: z.number(),\n subject: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional(),\n preview_text: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional()\n}).nullable().optional();\n\n// Schedule push schema\nexport const schedulePushSchema = z.object({\n title: z.record(z.string()).optional(),\n body: z.record(z.string()).optional(),\n target: z.string()\n}).nullable().optional();\n\n// Schedule schema\nexport const scheduleSchema = z.object({\n days: z.number(),\n email: scheduleEmailSchema,\n push: schedulePushSchema,\n hour: z.number(),\n key: z.string(),\n method: z.enum(['email', 'sms', 'whatsapp', 'push']),\n moment: z.enum(['departure_date', 'return_date', 'immediate']),\n filter: scheduleFilterSchema.nullable().optional()\n});\n\nexport const freeEsimSchema = z.object({\n enabled: z.boolean(),\n package_specification: z.object({\n size: z.string(),\n package_type: z.string(),\n destination: z.string(),\n package_duration: z.number()\n }),\n booking_id_verification: z.boolean().default(false),\n booking_id_verification_pattern: z.string().nullable().optional(),\n allowance: z.number(),\n total_allowance: z.number(),\n});\n\n// Platform settings schema\nexport const platformSettingsSchema = z.object({\n package_strategy: z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any(),\n supported_package_types: z.enum(['data-limited', 'unlimited']).optional()\n }).nullable().optional(),\n free_esim: freeEsimSchema.nullable().optional(),\n booking_defaults: z.object({\n locale: supportedLocalesSchema\n }).nullable().optional(),\n booking_confirmation: z.object({\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n }).nullable().optional(),\n emit_events: emitEventSchema.nullable().optional(),\n schedules: z.array(scheduleSchema).optional(),\n visual_identity_options: z.object({\n hubby_branding: z.boolean().optional().default(true),\n source_partner_branding: z.boolean().optional().default(false),\n own_branding: z.boolean().optional().default(false)\n }).nullable().optional()\n});\n\n// ===== Exportable schema specs =====\n\n// Package price schema spec\nexport const packagePriceSchemaSpec = markAsSchemaSpec({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n});\n\n// Financial properties schema spec\nexport const financialPropertiesSchemaSpec = markAsSchemaSpec({\n administration_fee: z.number().nullable(),\n income_per_gb: z.number().nullable(),\n commission_fee: z.number().nullable().optional(),\n payment_method: z.enum(['invoice', 'direct']),\n requires_card: z.boolean().nullable(),\n next_invoice: timestampNullableOptional,\n last_invoice: timestampNullableOptional,\n pricing_strategies: {\n _type: 'object' as const,\n of: {\n partner: {\n _type: 'object' as const,\n of: {\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n },\n user: {\n _type: 'object' as const,\n of: {\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n }\n },\n nullable: true\n }\n});\n\n// Platform settings schema spec\nexport const platformSettingsSchemaSpec = markAsSchemaSpec({\n package_strategy: {\n _type: 'object' as const,\n of: packageStrategySchema.shape,\n nullable: true,\n optional: true\n },\n free_esim: {\n _type: 'object' as const,\n of: freeEsimSchema.shape,\n nullable: true,\n optional: true\n },\n booking_defaults: {\n _type: 'object' as const,\n of: {\n locale: supportedLocalesSchema\n },\n nullable: true,\n optional: true\n },\n booking_confirmation: {\n _type: 'object' as const,\n of: {\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n },\n nullable: true,\n optional: true\n },\n schedules: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: scheduleSchema.shape\n },\n optional: true\n }\n});\n\n// Webhook settings schema\nexport const webhookSettingsSchema = z.object({\n url: z.string().url().nullable().optional(),\n api_key: z.string().nullable().optional(),\n enabled: z.boolean().default(false),\n events: z.object({\n promocode_redemption: z.boolean().default(false)\n }).default({})\n});\n\n// ===== Main partner schema =====\nexport const partnerSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Partner specific fields\n name: z.string().min(3),\n type: z.string().nullable(),\n is_active: z.boolean().nullable().optional(),\n external_id: z.string().nullable().optional(),\n\n // Complex nested objects\n contact: {\n _type: 'object' as const,\n of: partnerContactSchema.shape,\n nullable: true\n },\n address: {\n _type: 'object' as const,\n of: addressSchema.shape,\n nullable: true\n },\n registration: {\n _type: 'object' as const,\n of: registrationSchema.shape,\n nullable: true\n },\n banking_details: {\n _type: 'object' as const,\n of: bankingDetailsSchema.shape,\n nullable: true\n },\n\n // Reference fields\n parent: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n users: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: USER_COLLECTION }, nullable: true },\n\n // Complex nested structures\n financial_properties: financialPropertiesSchemaSpec,\n // Visual identity\n visual_identity: {\n _type: 'object' as const,\n of: visualIdentitySchema.shape,\n nullable: true\n },\n\n // Platform settings\n platform_settings: {\n _type: 'object' as const,\n of: platformSettingsSchema.shape,\n nullable: true\n },\n\n // Tags\n tags: {\n _type: 'array' as const,\n of: tagModelSpec,\n nullable: true,\n optional: true\n },\n\n // Metadata\n data: {\n _type: 'object' as const,\n of: partnerDataSchema.shape,\n nullable: true,\n optional: true\n },\n\n // Webhook settings\n webhook_settings: {\n _type: 'object' as const,\n of: webhookSettingsSchema.shape,\n nullable: true,\n optional: true\n }\n});\n\n// ===== Price list schema =====\nexport const priceListSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Price list specific fields\n name: z.string().min(3),\n description: z.string().nullable(),\n type: z.enum(['partner', 'consumer']),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec, PARTNER_COLLECTION } from './common';\n\n// Country schema spec\nexport const analyticsSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n service: z.string(),\n date: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/), // YYYY-MM-DD\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n event: z.string(),\n parameter: z.string().nullable(),\n sum: z.number(),\n});","import { z } from 'zod';\nimport { timestampRequired } from './common';\nimport { markAsSchemaSpec } from '../common';\n\nexport const payloadSpec = {\n _type: 'record' as const,\n of: z.unknown(),\n optional: true\n};\n\nexport const apiLogSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n method: z.string(),\n user_id: z.string().optional(),\n path: z.string(),\n resource_type: z.string().optional(),\n resource_id: z.string().optional(),\n partner_id: z.string().optional(),\n payload: payloadSpec,\n timestamp: timestampRequired,\n status_code: z.number()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional, PERMISSION_COLLECTION } from './common';\n\nexport const roleSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional } from './common';\n\nexport const permissionSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { buildClientSchema } from './builders/client';\nimport {\n userSchemaSpec,\n apiKeySpec,\n apiKeysSpec,\n apiKeysObjectSpec\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { bondioPackageSchema, packageSchemaSpec, telnaPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n financialPropertiesSchemaSpec as financialPropertiesSchema,\n packagePriceSchema,\n platformSettingsSchema,\n visualIdentitySchema,\n pricingStrategySchema,\n freeEsimSchema,\n} from './specs/partner';\nimport { analyticsSpec } from './specs/analytics';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { roleSchemaSpec } from './specs/role';\nimport { permissionSchemaSpec } from './specs/permission';\n\nexport const HUserSchema = buildClientSchema(userSchemaSpec);\nexport const HBookingSchema = buildClientSchema(bookingSchemaSpec);\nexport const HCountrySchema = buildClientSchema(countrySchemaSpec);\nexport const HCurrencySchema = buildClientSchema(currencySchemaSpec);\nexport const HESIMSchema = buildClientSchema(esimSchemaSpec);\nexport const HPaymentSchema = buildClientSchema(paymentSchemaSpec);\nexport const HMessageSchema = buildClientSchema(messageSchemaSpec);\nexport const HPackageSchema = buildClientSchema(packageSchemaSpec);\nexport const HPromoCodeSchema = buildClientSchema(promoCodeSchemaSpec);\nexport const HPartnerSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPriceListSchema = buildClientSchema(priceListSchemaSpec);\nexport const HFinancialPropertiesSchema = buildClientSchema(financialPropertiesSchema);\nexport const HApiLogSchema = buildClientSchema(apiLogSchemaSpec);\nexport const HPackagePriceSchema = buildClientSchema(packagePriceSchema);\nexport const HubbyModelSchema = buildClientSchema(hubbyModelSpec);\nexport const HPartnerAppSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPlatformSettingsSchema = buildClientSchema(platformSettingsSchema);\nexport const HVisualIdentitySchema = buildClientSchema(visualIdentitySchema);\nexport const HPricingStrategySchema = buildClientSchema(pricingStrategySchema);\nexport const HFreeEsimSchema = buildClientSchema(freeEsimSchema);\nexport const HAnalyticsSchema = buildClientSchema(analyticsSpec);\nexport const HRoleSchema = buildClientSchema(roleSchemaSpec);\nexport const HPermissionSchema = buildClientSchema(permissionSchemaSpec);\nexport const HTagSchema = buildClientSchema(tagModelSpec);\nexport const HTrafficPolicySchema = buildClientSchema(trafficPolicySpec);\nexport const HTelnaPackageSchema = buildClientSchema(telnaPackageSchema);\nexport const HBondioPackageSchema = buildClientSchema(bondioPackageSchema);\n// Additional lower-level schemas\nexport const HAddressSchema = addressSchema;\nexport const HRegistrationSchema = registrationSchema;\nexport const HBankingDetailsSchema = bankingDetailsSchema;\nexport const HPartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const HPromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const HVisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const HScheduleFilterSchema = scheduleFilterSchema;\nexport const HPartnerContactSchema = partnerContactSchema;\nexport const HPartnerDataSchema = partnerDataSchema;\nexport const HCommunicationChannelSchema = communicationChannelSchema;\nexport const HBookingStatusSchema = bookingStatusSchema;\nexport const HCommunicationOptionsSchema = communicationOptionsSchema;\n\nexport type HAnalytics = z.infer;\nexport type HUser = z.infer;\nexport type HBooking = z.infer;\nexport type HCountry = z.infer;\nexport type HCurrency = z.infer;\nexport type HESIM = z.infer;\nexport type HPayment = z.infer;\nexport type HMessage = z.infer;\nexport type HPackage = z.infer;\nexport type HPromoCode = z.infer;\nexport type HPartner = z.infer;\nexport type HPriceList = z.infer;\nexport type HApiLog = z.infer;\nexport type HTag = z.infer;\nexport type HTrafficPolicy = z.infer;\nexport type HBondioPackage = z.infer;\nexport type HTelnaPackage = z.infer;\n// Additional lower-level types\nexport type HAddress = z.infer;\nexport type HRegistration = z.infer;\nexport type HBankingDetails = z.infer;\nexport type HPartnerPackageSpecification = z.infer;\nexport type HPromoPackageSpecification = z.infer;\nexport type HVisualIdentityBanner = z.infer;\nexport type HFinancialProperties = z.infer;\nexport type HScheduleFilter = z.infer;\nexport type HPartnerContact = z.infer;\nexport type HPartnerData = z.infer;\nexport type HCommunicationChannel = z.infer;\nexport type HBookingStatus = z.infer;\nexport type HCommunicationOptions = z.infer;\nexport type HHubbyModel = z.infer;\n\nexport type HubbyModelApp = HHubbyModel;\n\nexport type SupportedLocales = typeof SUPPORTED_LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\nexport type HRole = z.infer;\nexport type HPermission = z.infer; "]} \ No newline at end of file diff --git a/dist/base/index.d.cts b/dist/base/index.d.cts index d489267..83f4b0e 100644 --- a/dist/base/index.d.cts +++ b/dist/base/index.d.cts @@ -1315,16 +1315,19 @@ declare const HPartnerSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -1332,9 +1335,10 @@ declare const HPartnerSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -1343,9 +1347,10 @@ declare const HPartnerSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -1496,9 +1501,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -1555,9 +1561,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -1779,9 +1786,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -1957,9 +1965,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -2839,16 +2848,19 @@ declare const HPartnerAppSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -2856,9 +2868,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -2867,9 +2880,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3020,9 +3034,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3079,9 +3094,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3303,9 +3319,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3481,9 +3498,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3575,16 +3593,19 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -3592,9 +3613,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3603,9 +3625,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3756,9 +3779,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3815,9 +3839,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -4093,16 +4118,19 @@ declare const HFreeEsimSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -4110,9 +4138,10 @@ declare const HFreeEsimSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4121,9 +4150,10 @@ declare const HFreeEsimSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; diff --git a/dist/base/index.d.ts b/dist/base/index.d.ts index d489267..83f4b0e 100644 --- a/dist/base/index.d.ts +++ b/dist/base/index.d.ts @@ -1315,16 +1315,19 @@ declare const HPartnerSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -1332,9 +1335,10 @@ declare const HPartnerSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -1343,9 +1347,10 @@ declare const HPartnerSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -1496,9 +1501,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -1555,9 +1561,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -1779,9 +1786,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -1957,9 +1965,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -2839,16 +2848,19 @@ declare const HPartnerAppSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -2856,9 +2868,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -2867,9 +2880,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3020,9 +3034,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3079,9 +3094,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3303,9 +3319,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3481,9 +3498,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3575,16 +3593,19 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -3592,9 +3613,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3603,9 +3625,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3756,9 +3779,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3815,9 +3839,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -4093,16 +4118,19 @@ declare const HFreeEsimSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -4110,9 +4138,10 @@ declare const HFreeEsimSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4121,9 +4150,10 @@ declare const HFreeEsimSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; diff --git a/dist/base/index.js b/dist/base/index.js index 5ecdf41..5629bad 100644 --- a/dist/base/index.js +++ b/dist/base/index.js @@ -658,8 +658,9 @@ var freeEsimSchema = z.object({ enabled: z.boolean(), package_specification: z.object({ size: z.string(), - type: z.string(), - destination: z.string() + package_type: z.string(), + destination: z.string(), + package_duration: z.number() }), booking_id_verification: z.boolean().default(false), booking_id_verification_pattern: z.string().nullable().optional(), diff --git a/dist/base/index.js.map b/dist/base/index.js.map index 7fc3ad8..ecb5533 100644 --- a/dist/base/index.js.map +++ b/dist/base/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/builders/client.ts","../../src/common.ts","../../src/specs/user.ts","../../src/specs/common.ts","../../src/specs/booking.ts","../../src/constants.ts","../../src/specs/promocode.ts","../../src/specs/country.ts","../../src/specs/currency.ts","../../src/specs/esim.ts","../../src/specs/payment.ts","../../src/specs/message.ts","../../src/specs/traffic_policy.ts","../../src/specs/package.ts","../../src/specs/partner.ts","../../src/specs/analytics.ts","../../src/specs/apiLogs.ts","../../src/specs/role.ts","../../src/specs/permission.ts","../../src/index.client.ts"],"names":["z","packageSpecificationSchema","SUPPORTED_LOCALES"],"mappings":";AAAA,SAAS,KAAAA,UAAqB;;;ACA9B,SAAqB,SAAS;AAQvB,SAAS,cACZ,QACA,SAQU;AACV,MAAI,CAAC;AAAS,WAAO;AAErB,MAAI,UAAU;AAGd,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAEA,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAGA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAEhD,QAAI,CAAC,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B;AAC7D,IAAM,0BAA0B,kBAAkB,sBAAsB;AACxE,IAAM,wBAAwB,kBAAkB,oBAAoB;AACpE,IAAM,yBAAyB,kBAAkB,qBAAqB;AACtE,IAAM,kBAAkB,kBAAkB,cAAc;AACxD,IAAM,mBAAmB,kBAAkB,aAAa;AACxD,IAAM,cAAc,kBAAkB,cAAc;AACpD,IAAM,oBAAoB,kBAAkB,oBAAoB;AAChE,IAAM,aAAa,kBAAkB,YAAY;AACjD,IAAM,uBAAuB,kBAAkB,iBAAiB;AAChE,IAAM,sBAAsB,kBAAkB,kBAAkB;AAChE,IAAM,uBAAuB,kBAAkB,mBAAmB;AAElE,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,wBAAwB;AAC9B,IAAM,qCAAqCC;AAC3C,IAAM,mCAAmC;AACzC,IAAM,8BAA8B;AACpC,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,qBAAqB;AAC3B,IAAM,8BAA8B;AACpC,IAAM,uBAAuB;AAC7B,IAAM,8BAA8B;AAsCpC,IAAMC,qBAAoB","sourcesContent":["import { z, ZodTypeAny } from 'zod';\nimport type { FieldSpec, SchemaFromSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\n\nexport function buildClientSchema(spec: S, path: string[] = []): SchemaFromSpec {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid schema spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec) as unknown as SchemaFromSpec;\n }\n\n // Check if object might be a Zod schema (has _def property or ~standard metadata)\n if (typeof spec === 'object' && spec !== null &&\n (('_def' in spec) || ('~standard' in spec && (spec as any)['~standard']?.vendor === 'zod'))) {\n try {\n // Try to use it as a Zod schema directly\n return wrapZodSchema(spec as unknown as z.ZodTypeAny) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this fails, we'll continue with the other checks\n console.warn(`Failed to use object as Zod schema at \"${pathString}\":`, error);\n }\n }\n\n // ----- Array -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.array(buildClientSchema(spec.of, [...path, '[i]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Record -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.record(buildClientSchema(spec.of, [...path, '[key]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Timestamp -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'timestamp') {\n let schema: ZodTypeAny = z.preprocess((val) => {\n if (typeof val === 'string') {\n // Try to parse the string to a Date object\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date; // undefined will cause z.date() to fail\n }\n if (typeof val === 'number') {\n // Handle numeric timestamps\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date;\n }\n // If it's already a Date or something else, return it as is\n return val;\n }, z.date({ required_error: 'Date is required', invalid_type_error: 'Invalid date format' }));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- DocRef -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'docRef') {\n let schema: ZodTypeAny = z.string(); // only ID on client\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Object (plain nested object spec) -----\n if (\n typeof spec === 'object' &&\n spec !== null &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || (typeof spec === 'object' && spec !== null && '_type' in spec && (spec as any)._type === 'object')) {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // If we have an object with fields that look like schema specs, try to handle it as a schema object\n if (typeof spec === 'object' && spec !== null) {\n try {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this also fails, we'll throw the error below\n console.warn(`Failed to handle object as plain schema at \"${pathString}\":`, error);\n }\n }\n\n // 🔥 If we got here, the spec had a structure we didn't handle\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n}\n\n","import { ZodTypeAny, z } from 'zod';\nimport type { SchemaBuilder } from './types';\n\n/**\n * Ensures a Zod schema is wrapped to be optional and/or nullable,\n * if not already. Use this in recursive schema builders.\n * Also applies any other supported schema transformations provided in options.\n */\nexport function wrapZodSchema(\n schema: ZodTypeAny,\n options?: {\n optional?: boolean;\n nullable?: boolean;\n min?: number;\n max?: number;\n // Allow arbitrary extensions via dynamic property\n [key: string]: any;\n }\n): ZodTypeAny {\n if (!options) return schema;\n\n let wrapped = schema;\n\n // Handle nullable and optional specially since they're common\n if (options.nullable && !wrapped.isNullable?.()) {\n wrapped = wrapped.nullable();\n }\n\n if (options.optional && !wrapped.isOptional?.()) {\n wrapped = wrapped.optional();\n }\n\n // Process all other options dynamically\n for (const [key, value] of Object.entries(options)) {\n // Skip the already handled properties and undefined values\n if (['nullable', 'optional'].includes(key) || value === undefined) {\n continue;\n }\n\n // Check if the schema has a method matching the option key\n if (typeof (wrapped as any)[key] === 'function') {\n wrapped = (wrapped as any)[key](value);\n }\n }\n\n return wrapped;\n}\n\nexport function wrapObjectSchema(\n spec: any, // using any to support dynamic `spec.type === 'object'`\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n if (!('of' in spec)) {\n throw new Error(`Object spec at \"${pathString}\" is missing 'of'`);\n }\n\n const shape: Record = {};\n for (const [key, value] of Object.entries(spec.of)) {\n shape[key] = builder(value as any, [...path, key]);\n }\n\n let objectSchema: ZodTypeAny = z.object(shape);\n if (spec.nullable) objectSchema = objectSchema.nullable();\n if (spec.optional) objectSchema = objectSchema.optional();\n return objectSchema;\n}\n\n/**\n * Wraps a plain object shape (no `type: 'object'`) into a Zod schema.\n * Assumes each field is either a Zod schema or another FieldSpec.\n */\nexport function wrapPlainObjectSchema(\n spec: Record,\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n // Handle object field specs with '_type': 'object'\n if ('_type' in spec && spec._type === 'object' && 'of' in spec) {\n return wrapObjectSchema(spec, path, builder);\n }\n\n const shape: Record = {};\n\n // Only add fields to the schema if they're not special control properties\n for (const [key, val] of Object.entries(spec)) {\n if (key !== '_type' && key !== 'nullable' && key !== 'optional') {\n shape[key] = builder(val, [...path, key]);\n }\n }\n\n // Create the base object schema\n let schema: ZodTypeAny = z.object(shape);\n\n // Apply nullable/optional modifiers if needed\n if ('nullable' in spec && spec.nullable === true) {\n schema = schema.nullable();\n }\n\n if ('optional' in spec && spec.optional === true) {\n schema = schema.optional();\n }\n\n return schema;\n}\n\nexport const SCHEMA_MARKER = Symbol('ZodSchemaSpecMarker');\n\nexport function markAsSchemaSpec(spec: T): T {\n Object.defineProperty(spec, SCHEMA_MARKER, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return spec;\n}\n\nexport function isSchemaSpec(obj: unknown): obj is Record {\n return typeof obj === 'object' && obj !== null && SCHEMA_MARKER in obj;\n}","import { z } from 'zod';\nimport { PARTNER_COLLECTION, PROFILE_COLLECTION, timestampNullableOptional, timestampRequired, timestampNullable, ROLE_COLLECTION, PERMISSION_COLLECTION } from './common';\nimport { markAsSchemaSpec } from '../common'\n\nexport const apiKeySpec = {\n expires_at: { _type: 'timestamp' as const },\n secret: z.string(),\n is_active: z.boolean(),\n}\n\nexport const apiKeysSpec = {\n _type: 'record' as const,\n of: {\n _type: 'object' as const,\n of: apiKeySpec\n }\n}\n\nexport const apiKeysObjectSpec = {\n _type: 'object' as const,\n of: {\n allowed_keys: { _type: 'array' as const, nullable: true, optional: true, of: z.string() },\n keys: apiKeysSpec\n },\n nullable: true,\n optional: true\n}\n\nexport const userSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string().nullable(),\n email: z.string().email().nullable(),\n stripe_id: z.string().nullable().optional(),\n referral: z.string().nullable().optional(),\n fcm: z.string().optional(),\n deeplink: z.string().nullable().optional(),\n gender: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n coordinates: z.string().nullable().optional(),\n parameters: z.any().nullable().optional(),\n locale: z.string().nullable().optional(),\n phone_model: z.string().nullable().optional(),\n phone_os: z.string().nullable().optional(),\n phone_os_version: z.string().nullable().optional(),\n ios: z.boolean().nullable().optional(),\n has_card_saved: z.boolean().nullable().optional(),\n admin: z.boolean().nullable().optional(),\n api_keys: apiKeysObjectSpec,\n currency: z.string().nullable().optional(),\n receipt_email: z.string().nullable().optional(),\n source: z.enum(['direct', 'promo', 'platform']).nullable().optional(),\n role: { _type: 'docRef' as const, collection: ROLE_COLLECTION, optional: true, nullable: true },\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n balance: z.number().nullable().optional(),\n createdAt: { _type: 'timestamp' as const },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, optional: true, nullable: true },\n profileRef: { _type: 'docRef' as const, collection: PROFILE_COLLECTION, optional: true, nullable: true },\n review_requested: timestampNullableOptional,\n last_seen: timestampNullableOptional\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\n\n// Collection paths\nexport const PARTNER_COLLECTION = '/companies/hubby/partners';\nexport const USER_COLLECTION = 'users';\nexport const PROFILE_COLLECTION = '/companies/hubby/profiles';\nexport const PACKAGE_COLLECTION = '/companies/hubby/packages';\nexport const PROMO_CODE_COLLECTION = '/companies/hubby/promo_codes';\nexport const COUNTRY_COLLECTION = 'countries';\nexport const ESIM_COLLECTION = 'esims';\nexport const PAYMENT_COLLECTION = 'payments';\nexport const PRICE_LIST_COLLECTION = 'price_lists';\nexport const BOOKING_COLLECTION = 'bookings';\nexport const MESSAGE_COLLECTION = 'messages';\nexport const CURRENCY_COLLECTION = 'currencies';\nexport const API_LOG_COLLECTION = 'api_logs'\nexport const ROLE_COLLECTION = 'roles';\nexport const PERMISSION_COLLECTION = 'permissions';\nexport const TRAFFIC_POLICY_COLLECTION = 'traffic_policies';\n\n// Timestamp specs\nexport const timestampNullableOptional = { _type: 'timestamp' as const, nullable: true, optional: true };\nexport const timestampNullable = { _type: 'timestamp' as const, nullable: true, optional: false };\nexport const timestampRequired = { _type: 'timestamp' as const, nullable: false, optional: false };\n\nexport const hubbyModelSpec = {\n id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n created_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n updated_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n}\n\nexport const tagModelSpec = {\n ...hubbyModelSpec,\n slug: z.string(),\n name: z.string(),\n description: z.string().nullable().optional(),\n color: z.string().nullable().optional(),\n}","import { z } from 'zod';\nimport {\n PARTNER_COLLECTION,\n PROMO_CODE_COLLECTION,\n USER_COLLECTION,\n ESIM_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema } from '../constants';\nimport { packageSpecificationSchema } from './promocode';\n\n// Enum for communication channels\nexport const communicationChannelSchema = z.enum([\n 'EMAIL',\n 'WHATSAPP',\n 'PUSH_NOTIFICATION',\n 'SMS'\n]);\nexport type CommunicationChannelType = z.infer;\n\n// For backward compatibility\nexport type CommunicationChannel = CommunicationChannelType;\n\n// Add enum-like object for use in code\nexport const CommunicationChannel = {\n EMAIL: 'EMAIL' as const,\n WHATSAPP: 'WHATSAPP' as const,\n PUSH_NOTIFICATION: 'PUSH_NOTIFICATION' as const,\n SMS: 'SMS' as const\n} as const;\n\n// Status type for bookings\nexport const bookingStatusSchema = z.enum([\n 'PENDING',\n 'CONFIRMED',\n 'COMPLETED',\n 'CANCELLED',\n 'UNPAID',\n 'EXPIRED'\n]);\nexport type BookingStatus = z.infer;\n\n// Communication options schema\nexport const communicationOptionsSchema = z.object({\n should_send_message: z.boolean(),\n channels: z.array(communicationChannelSchema)\n});\n\nexport type CommunicationOptions = z.infer;\n\n// Define the booking schema spec\nexport const bookingSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n external_id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n title: z.string().nullable(),\n first_name: z.string().nullable().optional(),\n last_name: z.string().nullable().optional(),\n full_name: z.string().nullable().optional(),\n pax: z.number(),\n email: z.string().email().nullable(),\n phone: z.string().nullable(),\n booking_id: z.string().nullable(),\n flight_number: z.string().optional(),\n gender: z.enum(['M', 'F', 'O']).optional(),\n package_size: z.string().optional(),\n sent_messages: z.record(z.any()).optional(),\n locale: supportedLocalesSchema,\n status: bookingStatusSchema,\n data: {\n _type: 'object' as const,\n of: {\n source: z.string(),\n manual: z.boolean()\n }\n },\n communication_options: {\n _type: 'object' as const,\n of: {\n should_send_message: z.boolean(),\n channels: {\n _type: 'array' as const,\n of: communicationChannelSchema\n }\n }\n },\n is_processed_for_esim_restoration: z.boolean(),\n is_pseudonymized: z.boolean(),\n import_id: z.string().nullable().optional(),\n package_specifications: z.array(packageSpecificationSchema).min(1),\n departure_date: timestampRequired,\n return_date: timestampNullable,\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION },\n promo_codes: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: PROMO_CODE_COLLECTION }\n },\n users: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: USER_COLLECTION },\n nullable: true\n },\n esims: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: ESIM_COLLECTION },\n nullable: true\n }\n});\n\n","import { z } from \"zod\";\n\nexport const SUPPORTED_LOCALES = [\n \"en-US\",\n \"en-EU\",\n \"en-GB\",\n \"en-CA\",\n \"nl-NL\",\n \"de-DE\",\n \"fr-FR\",\n \"it-IT\",\n \"es-ES\",\n \"cs-CZ\",\n \"pl-PL\",\n \"pt-PT\",\n \"fr-BE\",\n \"nl-BE\",\n \"de-AT\",\n \"de-CH\",\n \"fr-CH\",\n \"it-CH\",\n \"sv-SE\",\n \"sk-SK\",\n \"de-BE\",\n \"en-AU\",\n \"da-DK\",\n] as const;\n\n// Define the type using TypeScript's typeof and indexing\n\n// Define the type using TypeScript's typeof and indexing\nexport type SupportedLocales = (typeof SUPPORTED_LOCALES)[number];\n\n// Create a Zod schema for validation\nexport const supportedLocalesSchema = z.enum(SUPPORTED_LOCALES);\n\n// Type inference from the schema (alternative way to define the type)\nexport type SupportedLocalesFromSchema = z.infer;\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n PARTNER_COLLECTION,\n COUNTRY_COLLECTION,\n PACKAGE_COLLECTION,\n BOOKING_COLLECTION,\n PROMO_CODE_COLLECTION,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// Define package specification schema for use in promo code\nexport const packageSpecificationSchema = z.object({\n destination: z.string().optional(),\n size: z.string().optional(),\n package_id: z.string().optional(),\n iata_code: z.string().optional(),\n package_duration: z.number().optional(),\n package_type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).optional(),\n traffic_policy: z.string().optional(),\n});\n\n// Define the promo code schema spec\nexport const promoCodeSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n redeemed_at: timestampNullableOptional,\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // PromoCode specific fields\n external_id: z.string(),\n code: z.string(),\n allowance_user: z.number(),\n allowance_total: z.number(),\n type: z.enum(['discount', 'booking', 'booking_without_destination']).nullable().or(z.string()),\n usage: z.array(z.string()),\n uuid_usage: z.array(z.string()),\n package_specification: packageSpecificationSchema.optional(),\n valid_from: timestampRequired,\n valid_to: timestampRequired,\n\n // Reference fields\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION, nullable: true },\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n booking: { _type: 'docRef' as const, collection: BOOKING_COLLECTION, nullable: true },\n\n // Optional fields based on the type\n discount: z.number().optional(),\n package_size: z.string().optional(),\n countries: z.array(z.string()).optional(),\n max_bytes: z.number().optional(),\n starter_data: z.number().optional()\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const countrySchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n bokun_id: z.number().nullable(),\n LTE: z.boolean().nullable(),\n apn: z.string().nullable(),\n click_count: z.number().nullable(),\n global_network: z.string().nullable(),\n global_price: z.number().nullable(),\n hubby: z.number().nullable(),\n imsi: z.number().nullable(),\n has_esim: z.boolean(),\n name: z.string().nullable(),\n region: z.boolean().nullable(),\n i18n_name: z.record(z.string()),\n is_region: z.boolean().nullable(),\n countries: z.array(z.string()).nullable(),\n tier: z.number().nullable()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define schema for conversion rates (for backward compatibility)\nexport const conversionRateSchema = z.object({\n currency: z.number()\n});\n\nexport type CoversionRate = z.infer;\n\n// Define the currency schema spec\nexport const currencySchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n // ISO 4217 currency code (e.g., \"USD\", \"EUR\")\n code: z.string().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n // Currency symbol (e.g., \"$\", \"€\")\n symbol: z.string().describe('Currency symbol (e.g., \"$\", \"€\")'),\n // Full name of the currency (e.g., \"US Dollar\")\n name: z.string().describe('Full name of the currency (e.g., \"US Dollar\")'),\n // Exchange rate relative to base currency\n rate: z.number().describe('Exchange rate relative to base currency'),\n // Whether this is the default currency\n is_default: z.boolean().describe('Whether this is the default currency')\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n USER_COLLECTION,\n PARTNER_COLLECTION,\n PAYMENT_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\n\n// Define the eSIM schema spec\nexport const esimSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Common eSIM fields\n imsi: z.number(),\n qr: z.string(),\n iccid: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable().optional(),\n total_data: z.number(),\n data_left: z.number(),\n data_used: z.boolean(),\n status: z.string().nullable(),\n name: z.string(),\n android_auto: z.boolean(),\n partner_price: z.number().nullable(),\n promo: z.string().nullable(),\n type: z.enum(['api', 'promo', 'balance', 'code', 'external', 'payment']),\n is_auto_install: z.boolean(),\n is_archived: z.boolean(),\n user: z.string().nullable(),\n payment: z.string().nullable(),\n apn: z.string().nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Timestamp fields\n time_assigned: timestampNullable,\n last_updated: timestampNullable\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n USER_COLLECTION,\n timestampRequired\n} from './common';\n\n// Define the payment schema spec\nexport const paymentSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Payment specific fields\n amount: z.number(),\n customer: z.string(),\n date: timestampRequired,\n iccid: z.string(),\n package: z.string(),\n promo: z.string(),\n topup: z.boolean(),\n\n // Reference fields\n user: { _type: 'docRef' as const, collection: USER_COLLECTION, nullable: true, optional: true }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define the message schema spec\nexport const messageSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n key: z.string(),\n method: z.enum([\"push\", \"sms\", \"email\"]),\n status: z.enum([\"pending\", \"sent\", \"failed\", \"delivered\"]),\n created_at: timestampRequired,\n updated_at: timestampRequired\n});\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const trafficPolicySpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n name: z.string(),\n description: z.string(),\n external_id: z.string(),\n provider: z.string()\n})","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n PARTNER_COLLECTION,\n TRAFFIC_POLICY_COLLECTION,\n timestampRequired,\n hubbyModelSpec\n} from './common';\n\nimport { countrySchemaSpec } from './country';\n\n// Define the package schema spec\nexport const packageSchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n // Package specific fields\n external_id: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable(),\n label: z.string(),\n bytes: z.number(),\n hidden: z.boolean(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n price: z.number(),\n partner_price: z.number(),\n days: z.number(),\n name: z.string(),\n type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).nullable(),\n throttling: z.number().optional(),\n provider_parameters: z.object({\n imsi: z.number()\n }).nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Nested country data - need to use dynamic reference to country schema\n // This would typically be handled better with a proper recursive schema definition\n // but for simplicity, we're using any type here\n country_data: {\n _type: 'object' as const,\n of: countrySchemaSpec,\n nullable: true,\n optional: true\n }\n // country_data: z.any().nullable()\n});\n\nexport const commonPackageSchema = markAsSchemaSpec({\n size: z.string(),\n iso: z.string(),\n days: z.number(),\n price: z.number(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n packageType: z.string(),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n});\n\nexport const telnaPackageSchema = markAsSchemaSpec({\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n ...commonPackageSchema,\n});\n\nexport const bondioPackageSchema = markAsSchemaSpec({\n ...commonPackageSchema,\n label: z.enum(['lambda', 'tau']),\n});","import { z, ZodLazy } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema, SUPPORTED_LOCALES, SupportedLocales } from '../constants';\nimport {\n PARTNER_COLLECTION,\n USER_COLLECTION,\n PACKAGE_COLLECTION,\n PRICE_LIST_COLLECTION,\n tagModelSpec,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// ===== Helper schemas for nested structures =====\n\n// Address schema\nexport const addressSchema = z.object({\n street: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n postal_code: z.string().nullable().optional(),\n country: z.string().nullable().optional()\n});\n\n// Emit event schema\nexport const emitEventSchema = z.object({\n topup: z.boolean().optional().default(false),\n redemption: z.boolean().optional().default(false),\n activation: z.boolean().optional().default(false),\n depletion: z.boolean().optional().default(false),\n});\n\n// Registration schema\nexport const registrationSchema = z.object({\n chamber_of_commerce_number: z.string().nullable().optional(),\n vat_number: z.string().nullable().optional(),\n anvr_number: z.number().nullable().optional(),\n tax_number: z.string().nullable().optional()\n});\n\n// Banking details schema\nexport const bankingDetailsSchema = z.object({\n account_holder: z.string().nullable().optional(),\n bank_name: z.string().nullable().optional(),\n iban: z.string().nullable().optional(),\n currency: z.string().nullable().optional()\n});\n\n// Package price schema\nexport const packagePriceSchema = z.object({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: z.object({ _type: z.literal('docRef'), collection: z.literal(PACKAGE_COLLECTION) })\n});\n\n// Package specification schema\nexport const packageSpecificationSchema = z.object({\n size: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n destination: z.string().nullable().optional()\n});\n\n// Pricing strategy schema\nexport const pricingStrategySchema = z.object({\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: z.object({\n _type: z.literal('docRef'),\n collection: z.literal(PRICE_LIST_COLLECTION),\n nullable: z.literal(true)\n }),\n custom_prices: z.array(packagePriceSchema)\n});\n\n// Visual identity banner schema\nexport const visualIdentityBannerSchema = z.object({\n image_url: z.string(),\n alt: z.string(),\n click_url: z.string(),\n locale: supportedLocalesSchema,\n properties: z.record(z.string())\n});\n\n// Schedule filter schema\nexport const scheduleFilterSchema = z.object({\n type: z.enum(['iso3', 'gender', 'percentage', 'age']),\n value: z.union([z.string(), z.number()]),\n comparison: z.enum([\n 'equal',\n 'not_equal',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal'\n ])\n});\n\n// Convert object-like schemas to proper Zod objects\nexport const visualIdentityBannersSchema = z.object({\n strategy: z.enum(['fixed', 'rotating', 'destination', 'time_of_day']),\n banners: z.array(visualIdentityBannerSchema).nullable().optional()\n});\n\nexport const visualIdentitySchema = z.object({\n primary_color: z.string(),\n secondary_color: z.string(),\n logo: z.string(),\n font: z.string().nullable().optional(),\n top_banner: visualIdentityBannersSchema.optional(),\n mid_banner: visualIdentityBannersSchema.optional()\n});\n\n// Partner contact schema\nexport const partnerContactSchema = z.object({\n name: z.string().nullable().optional(),\n email: z.string().nullable(),\n office_phone: z.string().nullable().optional()\n});\n\n// Partner data schema\nexport const partnerDataSchema = z.object({\n source: z.string(),\n manual: z.boolean()\n});\n\n// Package strategy schema\nexport const packageStrategySchema = z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any()\n});\n\n// Schedule email schema\nexport const scheduleEmailSchema = z.object({\n brevo_template_id: z.number(),\n subject: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional(),\n preview_text: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional()\n}).nullable().optional();\n\n// Schedule push schema\nexport const schedulePushSchema = z.object({\n title: z.record(z.string()).optional(),\n body: z.record(z.string()).optional(),\n target: z.string()\n}).nullable().optional();\n\n// Schedule schema\nexport const scheduleSchema = z.object({\n days: z.number(),\n email: scheduleEmailSchema,\n push: schedulePushSchema,\n hour: z.number(),\n key: z.string(),\n method: z.enum(['email', 'sms', 'whatsapp', 'push']),\n moment: z.enum(['departure_date', 'return_date', 'immediate']),\n filter: scheduleFilterSchema.nullable().optional()\n});\n\nexport const freeEsimSchema = z.object({\n enabled: z.boolean(),\n package_specification: z.object({\n size: z.string(),\n type: z.string(),\n destination: z.string()\n }),\n booking_id_verification: z.boolean().default(false),\n booking_id_verification_pattern: z.string().nullable().optional(),\n allowance: z.number(),\n total_allowance: z.number(),\n});\n\n// Platform settings schema\nexport const platformSettingsSchema = z.object({\n package_strategy: z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any(),\n supported_package_types: z.enum(['data-limited', 'unlimited']).optional()\n }).nullable().optional(),\n free_esim: freeEsimSchema.nullable().optional(),\n booking_defaults: z.object({\n locale: supportedLocalesSchema\n }).nullable().optional(),\n booking_confirmation: z.object({\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n }).nullable().optional(),\n emit_events: emitEventSchema.nullable().optional(),\n schedules: z.array(scheduleSchema).optional(),\n visual_identity_options: z.object({\n hubby_branding: z.boolean().optional().default(true),\n source_partner_branding: z.boolean().optional().default(false),\n own_branding: z.boolean().optional().default(false)\n }).nullable().optional()\n});\n\n// ===== Exportable schema specs =====\n\n// Package price schema spec\nexport const packagePriceSchemaSpec = markAsSchemaSpec({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n});\n\n// Financial properties schema spec\nexport const financialPropertiesSchemaSpec = markAsSchemaSpec({\n administration_fee: z.number().nullable(),\n income_per_gb: z.number().nullable(),\n commission_fee: z.number().nullable().optional(),\n payment_method: z.enum(['invoice', 'direct']),\n requires_card: z.boolean().nullable(),\n next_invoice: timestampNullableOptional,\n last_invoice: timestampNullableOptional,\n pricing_strategies: {\n _type: 'object' as const,\n of: {\n partner: {\n _type: 'object' as const,\n of: {\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n },\n user: {\n _type: 'object' as const,\n of: {\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n }\n },\n nullable: true\n }\n});\n\n// Platform settings schema spec\nexport const platformSettingsSchemaSpec = markAsSchemaSpec({\n package_strategy: {\n _type: 'object' as const,\n of: packageStrategySchema.shape,\n nullable: true,\n optional: true\n },\n free_esim: {\n _type: 'object' as const,\n of: freeEsimSchema.shape,\n nullable: true,\n optional: true\n },\n booking_defaults: {\n _type: 'object' as const,\n of: {\n locale: supportedLocalesSchema\n },\n nullable: true,\n optional: true\n },\n booking_confirmation: {\n _type: 'object' as const,\n of: {\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n },\n nullable: true,\n optional: true\n },\n schedules: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: scheduleSchema.shape\n },\n optional: true\n }\n});\n\n// Webhook settings schema\nexport const webhookSettingsSchema = z.object({\n url: z.string().url().nullable().optional(),\n api_key: z.string().nullable().optional(),\n enabled: z.boolean().default(false),\n events: z.object({\n promocode_redemption: z.boolean().default(false)\n }).default({})\n});\n\n// ===== Main partner schema =====\nexport const partnerSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Partner specific fields\n name: z.string().min(3),\n type: z.string().nullable(),\n is_active: z.boolean().nullable().optional(),\n external_id: z.string().nullable().optional(),\n\n // Complex nested objects\n contact: {\n _type: 'object' as const,\n of: partnerContactSchema.shape,\n nullable: true\n },\n address: {\n _type: 'object' as const,\n of: addressSchema.shape,\n nullable: true\n },\n registration: {\n _type: 'object' as const,\n of: registrationSchema.shape,\n nullable: true\n },\n banking_details: {\n _type: 'object' as const,\n of: bankingDetailsSchema.shape,\n nullable: true\n },\n\n // Reference fields\n parent: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n users: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: USER_COLLECTION }, nullable: true },\n\n // Complex nested structures\n financial_properties: financialPropertiesSchemaSpec,\n // Visual identity\n visual_identity: {\n _type: 'object' as const,\n of: visualIdentitySchema.shape,\n nullable: true\n },\n\n // Platform settings\n platform_settings: {\n _type: 'object' as const,\n of: platformSettingsSchema.shape,\n nullable: true\n },\n\n // Tags\n tags: {\n _type: 'array' as const,\n of: tagModelSpec,\n nullable: true,\n optional: true\n },\n\n // Metadata\n data: {\n _type: 'object' as const,\n of: partnerDataSchema.shape,\n nullable: true,\n optional: true\n },\n\n // Webhook settings\n webhook_settings: {\n _type: 'object' as const,\n of: webhookSettingsSchema.shape,\n nullable: true,\n optional: true\n }\n});\n\n// ===== Price list schema =====\nexport const priceListSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Price list specific fields\n name: z.string().min(3),\n description: z.string().nullable(),\n type: z.enum(['partner', 'consumer']),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec, PARTNER_COLLECTION } from './common';\n\n// Country schema spec\nexport const analyticsSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n service: z.string(),\n date: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/), // YYYY-MM-DD\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n event: z.string(),\n parameter: z.string().nullable(),\n sum: z.number(),\n});","import { z } from 'zod';\nimport { timestampRequired } from './common';\nimport { markAsSchemaSpec } from '../common';\n\nexport const payloadSpec = {\n _type: 'record' as const,\n of: z.unknown(),\n optional: true\n};\n\nexport const apiLogSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n method: z.string(),\n user_id: z.string().optional(),\n path: z.string(),\n resource_type: z.string().optional(),\n resource_id: z.string().optional(),\n partner_id: z.string().optional(),\n payload: payloadSpec,\n timestamp: timestampRequired,\n status_code: z.number()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional, PERMISSION_COLLECTION } from './common';\n\nexport const roleSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional } from './common';\n\nexport const permissionSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { buildClientSchema } from './builders/client';\nimport {\n userSchemaSpec,\n apiKeySpec,\n apiKeysSpec,\n apiKeysObjectSpec\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { bondioPackageSchema, packageSchemaSpec, telnaPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n financialPropertiesSchemaSpec as financialPropertiesSchema,\n packagePriceSchema,\n platformSettingsSchema,\n visualIdentitySchema,\n pricingStrategySchema,\n freeEsimSchema,\n} from './specs/partner';\nimport { analyticsSpec } from './specs/analytics';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { roleSchemaSpec } from './specs/role';\nimport { permissionSchemaSpec } from './specs/permission';\n\nexport const HUserSchema = buildClientSchema(userSchemaSpec);\nexport const HBookingSchema = buildClientSchema(bookingSchemaSpec);\nexport const HCountrySchema = buildClientSchema(countrySchemaSpec);\nexport const HCurrencySchema = buildClientSchema(currencySchemaSpec);\nexport const HESIMSchema = buildClientSchema(esimSchemaSpec);\nexport const HPaymentSchema = buildClientSchema(paymentSchemaSpec);\nexport const HMessageSchema = buildClientSchema(messageSchemaSpec);\nexport const HPackageSchema = buildClientSchema(packageSchemaSpec);\nexport const HPromoCodeSchema = buildClientSchema(promoCodeSchemaSpec);\nexport const HPartnerSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPriceListSchema = buildClientSchema(priceListSchemaSpec);\nexport const HFinancialPropertiesSchema = buildClientSchema(financialPropertiesSchema);\nexport const HApiLogSchema = buildClientSchema(apiLogSchemaSpec);\nexport const HPackagePriceSchema = buildClientSchema(packagePriceSchema);\nexport const HubbyModelSchema = buildClientSchema(hubbyModelSpec);\nexport const HPartnerAppSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPlatformSettingsSchema = buildClientSchema(platformSettingsSchema);\nexport const HVisualIdentitySchema = buildClientSchema(visualIdentitySchema);\nexport const HPricingStrategySchema = buildClientSchema(pricingStrategySchema);\nexport const HFreeEsimSchema = buildClientSchema(freeEsimSchema);\nexport const HAnalyticsSchema = buildClientSchema(analyticsSpec);\nexport const HRoleSchema = buildClientSchema(roleSchemaSpec);\nexport const HPermissionSchema = buildClientSchema(permissionSchemaSpec);\nexport const HTagSchema = buildClientSchema(tagModelSpec);\nexport const HTrafficPolicySchema = buildClientSchema(trafficPolicySpec);\nexport const HTelnaPackageSchema = buildClientSchema(telnaPackageSchema);\nexport const HBondioPackageSchema = buildClientSchema(bondioPackageSchema);\n// Additional lower-level schemas\nexport const HAddressSchema = addressSchema;\nexport const HRegistrationSchema = registrationSchema;\nexport const HBankingDetailsSchema = bankingDetailsSchema;\nexport const HPartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const HPromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const HVisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const HScheduleFilterSchema = scheduleFilterSchema;\nexport const HPartnerContactSchema = partnerContactSchema;\nexport const HPartnerDataSchema = partnerDataSchema;\nexport const HCommunicationChannelSchema = communicationChannelSchema;\nexport const HBookingStatusSchema = bookingStatusSchema;\nexport const HCommunicationOptionsSchema = communicationOptionsSchema;\n\nexport type HAnalytics = z.infer;\nexport type HUser = z.infer;\nexport type HBooking = z.infer;\nexport type HCountry = z.infer;\nexport type HCurrency = z.infer;\nexport type HESIM = z.infer;\nexport type HPayment = z.infer;\nexport type HMessage = z.infer;\nexport type HPackage = z.infer;\nexport type HPromoCode = z.infer;\nexport type HPartner = z.infer;\nexport type HPriceList = z.infer;\nexport type HApiLog = z.infer;\nexport type HTag = z.infer;\nexport type HTrafficPolicy = z.infer;\nexport type HBondioPackage = z.infer;\nexport type HTelnaPackage = z.infer;\n// Additional lower-level types\nexport type HAddress = z.infer;\nexport type HRegistration = z.infer;\nexport type HBankingDetails = z.infer;\nexport type HPartnerPackageSpecification = z.infer;\nexport type HPromoPackageSpecification = z.infer;\nexport type HVisualIdentityBanner = z.infer;\nexport type HFinancialProperties = z.infer;\nexport type HScheduleFilter = z.infer;\nexport type HPartnerContact = z.infer;\nexport type HPartnerData = z.infer;\nexport type HCommunicationChannel = z.infer;\nexport type HBookingStatus = z.infer;\nexport type HCommunicationOptions = z.infer;\nexport type HHubbyModel = z.infer;\n\nexport type HubbyModelApp = HHubbyModel;\n\nexport type SupportedLocales = typeof SUPPORTED_LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\nexport type HRole = z.infer;\nexport type HPermission = z.infer; "]} \ No newline at end of file +{"version":3,"sources":["../../src/builders/client.ts","../../src/common.ts","../../src/specs/user.ts","../../src/specs/common.ts","../../src/specs/booking.ts","../../src/constants.ts","../../src/specs/promocode.ts","../../src/specs/country.ts","../../src/specs/currency.ts","../../src/specs/esim.ts","../../src/specs/payment.ts","../../src/specs/message.ts","../../src/specs/traffic_policy.ts","../../src/specs/package.ts","../../src/specs/partner.ts","../../src/specs/analytics.ts","../../src/specs/apiLogs.ts","../../src/specs/role.ts","../../src/specs/permission.ts","../../src/index.client.ts"],"names":["z","packageSpecificationSchema","SUPPORTED_LOCALES"],"mappings":";AAAA,SAAS,KAAAA,UAAqB;;;ACA9B,SAAqB,SAAS;AAQvB,SAAS,cACZ,QACA,SAQU;AACV,MAAI,CAAC;AAAS,WAAO;AAErB,MAAI,UAAU;AAGd,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAEA,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAGA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAEhD,QAAI,CAAC,YAAY,UAAU,EAAE,SAAS,GAAG,KAAK,UAAU,QAAW;AAC/D;AAAA,IACJ;AAGA,QAAI,OAAQ,QAAgB,GAAG,MAAM,YAAY;AAC7C,gBAAW,QAAgB,GAAG,EAAE,KAAK;AAAA,IACzC;AAAA,EACJ;AAEA,SAAO;AACX;AAEO,SAAS,iBACZ,MACA,MACA,SACU;AACV,QAAM,aAAa,KAAK,KAAK,GAAG;AAEhC,MAAI,EAAE,QAAQ,OAAO;AACjB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AAM,aAAa,kBAAkB,YAAY;AACjD,IAAM,uBAAuB,kBAAkB,iBAAiB;AAChE,IAAM,sBAAsB,kBAAkB,kBAAkB;AAChE,IAAM,uBAAuB,kBAAkB,mBAAmB;AAElE,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,wBAAwB;AAC9B,IAAM,qCAAqCC;AAC3C,IAAM,mCAAmC;AACzC,IAAM,8BAA8B;AACpC,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,qBAAqB;AAC3B,IAAM,8BAA8B;AACpC,IAAM,uBAAuB;AAC7B,IAAM,8BAA8B;AAsCpC,IAAMC,qBAAoB","sourcesContent":["import { z, ZodTypeAny } from 'zod';\nimport type { FieldSpec, SchemaFromSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\n\nexport function buildClientSchema(spec: S, path: string[] = []): SchemaFromSpec {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid schema spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec) as unknown as SchemaFromSpec;\n }\n\n // Check if object might be a Zod schema (has _def property or ~standard metadata)\n if (typeof spec === 'object' && spec !== null &&\n (('_def' in spec) || ('~standard' in spec && (spec as any)['~standard']?.vendor === 'zod'))) {\n try {\n // Try to use it as a Zod schema directly\n return wrapZodSchema(spec as unknown as z.ZodTypeAny) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this fails, we'll continue with the other checks\n console.warn(`Failed to use object as Zod schema at \"${pathString}\":`, error);\n }\n }\n\n // ----- Array -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.array(buildClientSchema(spec.of, [...path, '[i]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Record -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.record(buildClientSchema(spec.of, [...path, '[key]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Timestamp -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'timestamp') {\n let schema: ZodTypeAny = z.preprocess((val) => {\n if (typeof val === 'string') {\n // Try to parse the string to a Date object\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date; // undefined will cause z.date() to fail\n }\n if (typeof val === 'number') {\n // Handle numeric timestamps\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date;\n }\n // If it's already a Date or something else, return it as is\n return val;\n }, z.date({ required_error: 'Date is required', invalid_type_error: 'Invalid date format' }));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- DocRef -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'docRef') {\n let schema: ZodTypeAny = z.string(); // only ID on client\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Object (plain nested object spec) -----\n if (\n typeof spec === 'object' &&\n spec !== null &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || (typeof spec === 'object' && spec !== null && '_type' in spec && (spec as any)._type === 'object')) {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // If we have an object with fields that look like schema specs, try to handle it as a schema object\n if (typeof spec === 'object' && spec !== null) {\n try {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this also fails, we'll throw the error below\n console.warn(`Failed to handle object as plain schema at \"${pathString}\":`, error);\n }\n }\n\n // 🔥 If we got here, the spec had a structure we didn't handle\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n}\n\n","import { ZodTypeAny, z } from 'zod';\nimport type { SchemaBuilder } from './types';\n\n/**\n * Ensures a Zod schema is wrapped to be optional and/or nullable,\n * if not already. Use this in recursive schema builders.\n * Also applies any other supported schema transformations provided in options.\n */\nexport function wrapZodSchema(\n schema: ZodTypeAny,\n options?: {\n optional?: boolean;\n nullable?: boolean;\n min?: number;\n max?: number;\n // Allow arbitrary extensions via dynamic property\n [key: string]: any;\n }\n): ZodTypeAny {\n if (!options) return schema;\n\n let wrapped = schema;\n\n // Handle nullable and optional specially since they're common\n if (options.nullable && !wrapped.isNullable?.()) {\n wrapped = wrapped.nullable();\n }\n\n if (options.optional && !wrapped.isOptional?.()) {\n wrapped = wrapped.optional();\n }\n\n // Process all other options dynamically\n for (const [key, value] of Object.entries(options)) {\n // Skip the already handled properties and undefined values\n if (['nullable', 'optional'].includes(key) || value === undefined) {\n continue;\n }\n\n // Check if the schema has a method matching the option key\n if (typeof (wrapped as any)[key] === 'function') {\n wrapped = (wrapped as any)[key](value);\n }\n }\n\n return wrapped;\n}\n\nexport function wrapObjectSchema(\n spec: any, // using any to support dynamic `spec.type === 'object'`\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n if (!('of' in spec)) {\n throw new Error(`Object spec at \"${pathString}\" is missing 'of'`);\n }\n\n const shape: Record = {};\n for (const [key, value] of Object.entries(spec.of)) {\n shape[key] = builder(value as any, [...path, key]);\n }\n\n let objectSchema: ZodTypeAny = z.object(shape);\n if (spec.nullable) objectSchema = objectSchema.nullable();\n if (spec.optional) objectSchema = objectSchema.optional();\n return objectSchema;\n}\n\n/**\n * Wraps a plain object shape (no `type: 'object'`) into a Zod schema.\n * Assumes each field is either a Zod schema or another FieldSpec.\n */\nexport function wrapPlainObjectSchema(\n spec: Record,\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n // Handle object field specs with '_type': 'object'\n if ('_type' in spec && spec._type === 'object' && 'of' in spec) {\n return wrapObjectSchema(spec, path, builder);\n }\n\n const shape: Record = {};\n\n // Only add fields to the schema if they're not special control properties\n for (const [key, val] of Object.entries(spec)) {\n if (key !== '_type' && key !== 'nullable' && key !== 'optional') {\n shape[key] = builder(val, [...path, key]);\n }\n }\n\n // Create the base object schema\n let schema: ZodTypeAny = z.object(shape);\n\n // Apply nullable/optional modifiers if needed\n if ('nullable' in spec && spec.nullable === true) {\n schema = schema.nullable();\n }\n\n if ('optional' in spec && spec.optional === true) {\n schema = schema.optional();\n }\n\n return schema;\n}\n\nexport const SCHEMA_MARKER = Symbol('ZodSchemaSpecMarker');\n\nexport function markAsSchemaSpec(spec: T): T {\n Object.defineProperty(spec, SCHEMA_MARKER, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return spec;\n}\n\nexport function isSchemaSpec(obj: unknown): obj is Record {\n return typeof obj === 'object' && obj !== null && SCHEMA_MARKER in obj;\n}","import { z } from 'zod';\nimport { PARTNER_COLLECTION, PROFILE_COLLECTION, timestampNullableOptional, timestampRequired, timestampNullable, ROLE_COLLECTION, PERMISSION_COLLECTION } from './common';\nimport { markAsSchemaSpec } from '../common'\n\nexport const apiKeySpec = {\n expires_at: { _type: 'timestamp' as const },\n secret: z.string(),\n is_active: z.boolean(),\n}\n\nexport const apiKeysSpec = {\n _type: 'record' as const,\n of: {\n _type: 'object' as const,\n of: apiKeySpec\n }\n}\n\nexport const apiKeysObjectSpec = {\n _type: 'object' as const,\n of: {\n allowed_keys: { _type: 'array' as const, nullable: true, optional: true, of: z.string() },\n keys: apiKeysSpec\n },\n nullable: true,\n optional: true\n}\n\nexport const userSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string().nullable(),\n email: z.string().email().nullable(),\n stripe_id: z.string().nullable().optional(),\n referral: z.string().nullable().optional(),\n fcm: z.string().optional(),\n deeplink: z.string().nullable().optional(),\n gender: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n coordinates: z.string().nullable().optional(),\n parameters: z.any().nullable().optional(),\n locale: z.string().nullable().optional(),\n phone_model: z.string().nullable().optional(),\n phone_os: z.string().nullable().optional(),\n phone_os_version: z.string().nullable().optional(),\n ios: z.boolean().nullable().optional(),\n has_card_saved: z.boolean().nullable().optional(),\n admin: z.boolean().nullable().optional(),\n api_keys: apiKeysObjectSpec,\n currency: z.string().nullable().optional(),\n receipt_email: z.string().nullable().optional(),\n source: z.enum(['direct', 'promo', 'platform']).nullable().optional(),\n role: { _type: 'docRef' as const, collection: ROLE_COLLECTION, optional: true, nullable: true },\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n balance: z.number().nullable().optional(),\n createdAt: { _type: 'timestamp' as const },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, optional: true, nullable: true },\n profileRef: { _type: 'docRef' as const, collection: PROFILE_COLLECTION, optional: true, nullable: true },\n review_requested: timestampNullableOptional,\n last_seen: timestampNullableOptional\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\n\n// Collection paths\nexport const PARTNER_COLLECTION = '/companies/hubby/partners';\nexport const USER_COLLECTION = 'users';\nexport const PROFILE_COLLECTION = '/companies/hubby/profiles';\nexport const PACKAGE_COLLECTION = '/companies/hubby/packages';\nexport const PROMO_CODE_COLLECTION = '/companies/hubby/promo_codes';\nexport const COUNTRY_COLLECTION = 'countries';\nexport const ESIM_COLLECTION = 'esims';\nexport const PAYMENT_COLLECTION = 'payments';\nexport const PRICE_LIST_COLLECTION = 'price_lists';\nexport const BOOKING_COLLECTION = 'bookings';\nexport const MESSAGE_COLLECTION = 'messages';\nexport const CURRENCY_COLLECTION = 'currencies';\nexport const API_LOG_COLLECTION = 'api_logs'\nexport const ROLE_COLLECTION = 'roles';\nexport const PERMISSION_COLLECTION = 'permissions';\nexport const TRAFFIC_POLICY_COLLECTION = 'traffic_policies';\n\n// Timestamp specs\nexport const timestampNullableOptional = { _type: 'timestamp' as const, nullable: true, optional: true };\nexport const timestampNullable = { _type: 'timestamp' as const, nullable: true, optional: false };\nexport const timestampRequired = { _type: 'timestamp' as const, nullable: false, optional: false };\n\nexport const hubbyModelSpec = {\n id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n created_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n updated_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n}\n\nexport const tagModelSpec = {\n ...hubbyModelSpec,\n slug: z.string(),\n name: z.string(),\n description: z.string().nullable().optional(),\n color: z.string().nullable().optional(),\n}","import { z } from 'zod';\nimport {\n PARTNER_COLLECTION,\n PROMO_CODE_COLLECTION,\n USER_COLLECTION,\n ESIM_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema } from '../constants';\nimport { packageSpecificationSchema } from './promocode';\n\n// Enum for communication channels\nexport const communicationChannelSchema = z.enum([\n 'EMAIL',\n 'WHATSAPP',\n 'PUSH_NOTIFICATION',\n 'SMS'\n]);\nexport type CommunicationChannelType = z.infer;\n\n// For backward compatibility\nexport type CommunicationChannel = CommunicationChannelType;\n\n// Add enum-like object for use in code\nexport const CommunicationChannel = {\n EMAIL: 'EMAIL' as const,\n WHATSAPP: 'WHATSAPP' as const,\n PUSH_NOTIFICATION: 'PUSH_NOTIFICATION' as const,\n SMS: 'SMS' as const\n} as const;\n\n// Status type for bookings\nexport const bookingStatusSchema = z.enum([\n 'PENDING',\n 'CONFIRMED',\n 'COMPLETED',\n 'CANCELLED',\n 'UNPAID',\n 'EXPIRED'\n]);\nexport type BookingStatus = z.infer;\n\n// Communication options schema\nexport const communicationOptionsSchema = z.object({\n should_send_message: z.boolean(),\n channels: z.array(communicationChannelSchema)\n});\n\nexport type CommunicationOptions = z.infer;\n\n// Define the booking schema spec\nexport const bookingSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n external_id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n title: z.string().nullable(),\n first_name: z.string().nullable().optional(),\n last_name: z.string().nullable().optional(),\n full_name: z.string().nullable().optional(),\n pax: z.number(),\n email: z.string().email().nullable(),\n phone: z.string().nullable(),\n booking_id: z.string().nullable(),\n flight_number: z.string().optional(),\n gender: z.enum(['M', 'F', 'O']).optional(),\n package_size: z.string().optional(),\n sent_messages: z.record(z.any()).optional(),\n locale: supportedLocalesSchema,\n status: bookingStatusSchema,\n data: {\n _type: 'object' as const,\n of: {\n source: z.string(),\n manual: z.boolean()\n }\n },\n communication_options: {\n _type: 'object' as const,\n of: {\n should_send_message: z.boolean(),\n channels: {\n _type: 'array' as const,\n of: communicationChannelSchema\n }\n }\n },\n is_processed_for_esim_restoration: z.boolean(),\n is_pseudonymized: z.boolean(),\n import_id: z.string().nullable().optional(),\n package_specifications: z.array(packageSpecificationSchema).min(1),\n departure_date: timestampRequired,\n return_date: timestampNullable,\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION },\n promo_codes: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: PROMO_CODE_COLLECTION }\n },\n users: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: USER_COLLECTION },\n nullable: true\n },\n esims: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: ESIM_COLLECTION },\n nullable: true\n }\n});\n\n","import { z } from \"zod\";\n\nexport const SUPPORTED_LOCALES = [\n \"en-US\",\n \"en-EU\",\n \"en-GB\",\n \"en-CA\",\n \"nl-NL\",\n \"de-DE\",\n \"fr-FR\",\n \"it-IT\",\n \"es-ES\",\n \"cs-CZ\",\n \"pl-PL\",\n \"pt-PT\",\n \"fr-BE\",\n \"nl-BE\",\n \"de-AT\",\n \"de-CH\",\n \"fr-CH\",\n \"it-CH\",\n \"sv-SE\",\n \"sk-SK\",\n \"de-BE\",\n \"en-AU\",\n \"da-DK\",\n] as const;\n\n// Define the type using TypeScript's typeof and indexing\n\n// Define the type using TypeScript's typeof and indexing\nexport type SupportedLocales = (typeof SUPPORTED_LOCALES)[number];\n\n// Create a Zod schema for validation\nexport const supportedLocalesSchema = z.enum(SUPPORTED_LOCALES);\n\n// Type inference from the schema (alternative way to define the type)\nexport type SupportedLocalesFromSchema = z.infer;\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n PARTNER_COLLECTION,\n COUNTRY_COLLECTION,\n PACKAGE_COLLECTION,\n BOOKING_COLLECTION,\n PROMO_CODE_COLLECTION,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// Define package specification schema for use in promo code\nexport const packageSpecificationSchema = z.object({\n destination: z.string().optional(),\n size: z.string().optional(),\n package_id: z.string().optional(),\n iata_code: z.string().optional(),\n package_duration: z.number().optional(),\n package_type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).optional(),\n traffic_policy: z.string().optional(),\n});\n\n// Define the promo code schema spec\nexport const promoCodeSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n redeemed_at: timestampNullableOptional,\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // PromoCode specific fields\n external_id: z.string(),\n code: z.string(),\n allowance_user: z.number(),\n allowance_total: z.number(),\n type: z.enum(['discount', 'booking', 'booking_without_destination']).nullable().or(z.string()),\n usage: z.array(z.string()),\n uuid_usage: z.array(z.string()),\n package_specification: packageSpecificationSchema.optional(),\n valid_from: timestampRequired,\n valid_to: timestampRequired,\n\n // Reference fields\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION, nullable: true },\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n booking: { _type: 'docRef' as const, collection: BOOKING_COLLECTION, nullable: true },\n\n // Optional fields based on the type\n discount: z.number().optional(),\n package_size: z.string().optional(),\n countries: z.array(z.string()).optional(),\n max_bytes: z.number().optional(),\n starter_data: z.number().optional()\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const countrySchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n bokun_id: z.number().nullable(),\n LTE: z.boolean().nullable(),\n apn: z.string().nullable(),\n click_count: z.number().nullable(),\n global_network: z.string().nullable(),\n global_price: z.number().nullable(),\n hubby: z.number().nullable(),\n imsi: z.number().nullable(),\n has_esim: z.boolean(),\n name: z.string().nullable(),\n region: z.boolean().nullable(),\n i18n_name: z.record(z.string()),\n is_region: z.boolean().nullable(),\n countries: z.array(z.string()).nullable(),\n tier: z.number().nullable()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define schema for conversion rates (for backward compatibility)\nexport const conversionRateSchema = z.object({\n currency: z.number()\n});\n\nexport type CoversionRate = z.infer;\n\n// Define the currency schema spec\nexport const currencySchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n // ISO 4217 currency code (e.g., \"USD\", \"EUR\")\n code: z.string().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n // Currency symbol (e.g., \"$\", \"€\")\n symbol: z.string().describe('Currency symbol (e.g., \"$\", \"€\")'),\n // Full name of the currency (e.g., \"US Dollar\")\n name: z.string().describe('Full name of the currency (e.g., \"US Dollar\")'),\n // Exchange rate relative to base currency\n rate: z.number().describe('Exchange rate relative to base currency'),\n // Whether this is the default currency\n is_default: z.boolean().describe('Whether this is the default currency')\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n USER_COLLECTION,\n PARTNER_COLLECTION,\n PAYMENT_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\n\n// Define the eSIM schema spec\nexport const esimSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Common eSIM fields\n imsi: z.number(),\n qr: z.string(),\n iccid: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable().optional(),\n total_data: z.number(),\n data_left: z.number(),\n data_used: z.boolean(),\n status: z.string().nullable(),\n name: z.string(),\n android_auto: z.boolean(),\n partner_price: z.number().nullable(),\n promo: z.string().nullable(),\n type: z.enum(['api', 'promo', 'balance', 'code', 'external', 'payment']),\n is_auto_install: z.boolean(),\n is_archived: z.boolean(),\n user: z.string().nullable(),\n payment: z.string().nullable(),\n apn: z.string().nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Timestamp fields\n time_assigned: timestampNullable,\n last_updated: timestampNullable\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n USER_COLLECTION,\n timestampRequired\n} from './common';\n\n// Define the payment schema spec\nexport const paymentSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Payment specific fields\n amount: z.number(),\n customer: z.string(),\n date: timestampRequired,\n iccid: z.string(),\n package: z.string(),\n promo: z.string(),\n topup: z.boolean(),\n\n // Reference fields\n user: { _type: 'docRef' as const, collection: USER_COLLECTION, nullable: true, optional: true }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define the message schema spec\nexport const messageSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n key: z.string(),\n method: z.enum([\"push\", \"sms\", \"email\"]),\n status: z.enum([\"pending\", \"sent\", \"failed\", \"delivered\"]),\n created_at: timestampRequired,\n updated_at: timestampRequired\n});\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const trafficPolicySpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n name: z.string(),\n description: z.string(),\n external_id: z.string(),\n provider: z.string()\n})","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n PARTNER_COLLECTION,\n TRAFFIC_POLICY_COLLECTION,\n timestampRequired,\n hubbyModelSpec\n} from './common';\n\nimport { countrySchemaSpec } from './country';\n\n// Define the package schema spec\nexport const packageSchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n // Package specific fields\n external_id: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable(),\n label: z.string(),\n bytes: z.number(),\n hidden: z.boolean(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n price: z.number(),\n partner_price: z.number(),\n days: z.number(),\n name: z.string(),\n type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).nullable(),\n throttling: z.number().optional(),\n provider_parameters: z.object({\n imsi: z.number()\n }).nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Nested country data - need to use dynamic reference to country schema\n // This would typically be handled better with a proper recursive schema definition\n // but for simplicity, we're using any type here\n country_data: {\n _type: 'object' as const,\n of: countrySchemaSpec,\n nullable: true,\n optional: true\n }\n // country_data: z.any().nullable()\n});\n\nexport const commonPackageSchema = markAsSchemaSpec({\n size: z.string(),\n iso: z.string(),\n days: z.number(),\n price: z.number(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n packageType: z.string(),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n});\n\nexport const telnaPackageSchema = markAsSchemaSpec({\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n ...commonPackageSchema,\n});\n\nexport const bondioPackageSchema = markAsSchemaSpec({\n ...commonPackageSchema,\n label: z.enum(['lambda', 'tau']),\n});","import { z, ZodLazy } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema, SUPPORTED_LOCALES, SupportedLocales } from '../constants';\nimport {\n PARTNER_COLLECTION,\n USER_COLLECTION,\n PACKAGE_COLLECTION,\n PRICE_LIST_COLLECTION,\n tagModelSpec,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// ===== Helper schemas for nested structures =====\n\n// Address schema\nexport const addressSchema = z.object({\n street: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n postal_code: z.string().nullable().optional(),\n country: z.string().nullable().optional()\n});\n\n// Emit event schema\nexport const emitEventSchema = z.object({\n topup: z.boolean().optional().default(false),\n redemption: z.boolean().optional().default(false),\n activation: z.boolean().optional().default(false),\n depletion: z.boolean().optional().default(false),\n});\n\n// Registration schema\nexport const registrationSchema = z.object({\n chamber_of_commerce_number: z.string().nullable().optional(),\n vat_number: z.string().nullable().optional(),\n anvr_number: z.number().nullable().optional(),\n tax_number: z.string().nullable().optional()\n});\n\n// Banking details schema\nexport const bankingDetailsSchema = z.object({\n account_holder: z.string().nullable().optional(),\n bank_name: z.string().nullable().optional(),\n iban: z.string().nullable().optional(),\n currency: z.string().nullable().optional()\n});\n\n// Package price schema\nexport const packagePriceSchema = z.object({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: z.object({ _type: z.literal('docRef'), collection: z.literal(PACKAGE_COLLECTION) })\n});\n\n// Package specification schema\nexport const packageSpecificationSchema = z.object({\n size: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n destination: z.string().nullable().optional()\n});\n\n// Pricing strategy schema\nexport const pricingStrategySchema = z.object({\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: z.object({\n _type: z.literal('docRef'),\n collection: z.literal(PRICE_LIST_COLLECTION),\n nullable: z.literal(true)\n }),\n custom_prices: z.array(packagePriceSchema)\n});\n\n// Visual identity banner schema\nexport const visualIdentityBannerSchema = z.object({\n image_url: z.string(),\n alt: z.string(),\n click_url: z.string(),\n locale: supportedLocalesSchema,\n properties: z.record(z.string())\n});\n\n// Schedule filter schema\nexport const scheduleFilterSchema = z.object({\n type: z.enum(['iso3', 'gender', 'percentage', 'age']),\n value: z.union([z.string(), z.number()]),\n comparison: z.enum([\n 'equal',\n 'not_equal',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal'\n ])\n});\n\n// Convert object-like schemas to proper Zod objects\nexport const visualIdentityBannersSchema = z.object({\n strategy: z.enum(['fixed', 'rotating', 'destination', 'time_of_day']),\n banners: z.array(visualIdentityBannerSchema).nullable().optional()\n});\n\nexport const visualIdentitySchema = z.object({\n primary_color: z.string(),\n secondary_color: z.string(),\n logo: z.string(),\n font: z.string().nullable().optional(),\n top_banner: visualIdentityBannersSchema.optional(),\n mid_banner: visualIdentityBannersSchema.optional()\n});\n\n// Partner contact schema\nexport const partnerContactSchema = z.object({\n name: z.string().nullable().optional(),\n email: z.string().nullable(),\n office_phone: z.string().nullable().optional()\n});\n\n// Partner data schema\nexport const partnerDataSchema = z.object({\n source: z.string(),\n manual: z.boolean()\n});\n\n// Package strategy schema\nexport const packageStrategySchema = z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any()\n});\n\n// Schedule email schema\nexport const scheduleEmailSchema = z.object({\n brevo_template_id: z.number(),\n subject: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional(),\n preview_text: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional()\n}).nullable().optional();\n\n// Schedule push schema\nexport const schedulePushSchema = z.object({\n title: z.record(z.string()).optional(),\n body: z.record(z.string()).optional(),\n target: z.string()\n}).nullable().optional();\n\n// Schedule schema\nexport const scheduleSchema = z.object({\n days: z.number(),\n email: scheduleEmailSchema,\n push: schedulePushSchema,\n hour: z.number(),\n key: z.string(),\n method: z.enum(['email', 'sms', 'whatsapp', 'push']),\n moment: z.enum(['departure_date', 'return_date', 'immediate']),\n filter: scheduleFilterSchema.nullable().optional()\n});\n\nexport const freeEsimSchema = z.object({\n enabled: z.boolean(),\n package_specification: z.object({\n size: z.string(),\n package_type: z.string(),\n destination: z.string(),\n package_duration: z.number()\n }),\n booking_id_verification: z.boolean().default(false),\n booking_id_verification_pattern: z.string().nullable().optional(),\n allowance: z.number(),\n total_allowance: z.number(),\n});\n\n// Platform settings schema\nexport const platformSettingsSchema = z.object({\n package_strategy: z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any(),\n supported_package_types: z.enum(['data-limited', 'unlimited']).optional()\n }).nullable().optional(),\n free_esim: freeEsimSchema.nullable().optional(),\n booking_defaults: z.object({\n locale: supportedLocalesSchema\n }).nullable().optional(),\n booking_confirmation: z.object({\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n }).nullable().optional(),\n emit_events: emitEventSchema.nullable().optional(),\n schedules: z.array(scheduleSchema).optional(),\n visual_identity_options: z.object({\n hubby_branding: z.boolean().optional().default(true),\n source_partner_branding: z.boolean().optional().default(false),\n own_branding: z.boolean().optional().default(false)\n }).nullable().optional()\n});\n\n// ===== Exportable schema specs =====\n\n// Package price schema spec\nexport const packagePriceSchemaSpec = markAsSchemaSpec({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n});\n\n// Financial properties schema spec\nexport const financialPropertiesSchemaSpec = markAsSchemaSpec({\n administration_fee: z.number().nullable(),\n income_per_gb: z.number().nullable(),\n commission_fee: z.number().nullable().optional(),\n payment_method: z.enum(['invoice', 'direct']),\n requires_card: z.boolean().nullable(),\n next_invoice: timestampNullableOptional,\n last_invoice: timestampNullableOptional,\n pricing_strategies: {\n _type: 'object' as const,\n of: {\n partner: {\n _type: 'object' as const,\n of: {\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n },\n user: {\n _type: 'object' as const,\n of: {\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n }\n },\n nullable: true\n }\n});\n\n// Platform settings schema spec\nexport const platformSettingsSchemaSpec = markAsSchemaSpec({\n package_strategy: {\n _type: 'object' as const,\n of: packageStrategySchema.shape,\n nullable: true,\n optional: true\n },\n free_esim: {\n _type: 'object' as const,\n of: freeEsimSchema.shape,\n nullable: true,\n optional: true\n },\n booking_defaults: {\n _type: 'object' as const,\n of: {\n locale: supportedLocalesSchema\n },\n nullable: true,\n optional: true\n },\n booking_confirmation: {\n _type: 'object' as const,\n of: {\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n },\n nullable: true,\n optional: true\n },\n schedules: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: scheduleSchema.shape\n },\n optional: true\n }\n});\n\n// Webhook settings schema\nexport const webhookSettingsSchema = z.object({\n url: z.string().url().nullable().optional(),\n api_key: z.string().nullable().optional(),\n enabled: z.boolean().default(false),\n events: z.object({\n promocode_redemption: z.boolean().default(false)\n }).default({})\n});\n\n// ===== Main partner schema =====\nexport const partnerSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Partner specific fields\n name: z.string().min(3),\n type: z.string().nullable(),\n is_active: z.boolean().nullable().optional(),\n external_id: z.string().nullable().optional(),\n\n // Complex nested objects\n contact: {\n _type: 'object' as const,\n of: partnerContactSchema.shape,\n nullable: true\n },\n address: {\n _type: 'object' as const,\n of: addressSchema.shape,\n nullable: true\n },\n registration: {\n _type: 'object' as const,\n of: registrationSchema.shape,\n nullable: true\n },\n banking_details: {\n _type: 'object' as const,\n of: bankingDetailsSchema.shape,\n nullable: true\n },\n\n // Reference fields\n parent: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n users: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: USER_COLLECTION }, nullable: true },\n\n // Complex nested structures\n financial_properties: financialPropertiesSchemaSpec,\n // Visual identity\n visual_identity: {\n _type: 'object' as const,\n of: visualIdentitySchema.shape,\n nullable: true\n },\n\n // Platform settings\n platform_settings: {\n _type: 'object' as const,\n of: platformSettingsSchema.shape,\n nullable: true\n },\n\n // Tags\n tags: {\n _type: 'array' as const,\n of: tagModelSpec,\n nullable: true,\n optional: true\n },\n\n // Metadata\n data: {\n _type: 'object' as const,\n of: partnerDataSchema.shape,\n nullable: true,\n optional: true\n },\n\n // Webhook settings\n webhook_settings: {\n _type: 'object' as const,\n of: webhookSettingsSchema.shape,\n nullable: true,\n optional: true\n }\n});\n\n// ===== Price list schema =====\nexport const priceListSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Price list specific fields\n name: z.string().min(3),\n description: z.string().nullable(),\n type: z.enum(['partner', 'consumer']),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec, PARTNER_COLLECTION } from './common';\n\n// Country schema spec\nexport const analyticsSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n service: z.string(),\n date: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/), // YYYY-MM-DD\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n event: z.string(),\n parameter: z.string().nullable(),\n sum: z.number(),\n});","import { z } from 'zod';\nimport { timestampRequired } from './common';\nimport { markAsSchemaSpec } from '../common';\n\nexport const payloadSpec = {\n _type: 'record' as const,\n of: z.unknown(),\n optional: true\n};\n\nexport const apiLogSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n method: z.string(),\n user_id: z.string().optional(),\n path: z.string(),\n resource_type: z.string().optional(),\n resource_id: z.string().optional(),\n partner_id: z.string().optional(),\n payload: payloadSpec,\n timestamp: timestampRequired,\n status_code: z.number()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional, PERMISSION_COLLECTION } from './common';\n\nexport const roleSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional } from './common';\n\nexport const permissionSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { buildClientSchema } from './builders/client';\nimport {\n userSchemaSpec,\n apiKeySpec,\n apiKeysSpec,\n apiKeysObjectSpec\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { bondioPackageSchema, packageSchemaSpec, telnaPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n financialPropertiesSchemaSpec as financialPropertiesSchema,\n packagePriceSchema,\n platformSettingsSchema,\n visualIdentitySchema,\n pricingStrategySchema,\n freeEsimSchema,\n} from './specs/partner';\nimport { analyticsSpec } from './specs/analytics';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { roleSchemaSpec } from './specs/role';\nimport { permissionSchemaSpec } from './specs/permission';\n\nexport const HUserSchema = buildClientSchema(userSchemaSpec);\nexport const HBookingSchema = buildClientSchema(bookingSchemaSpec);\nexport const HCountrySchema = buildClientSchema(countrySchemaSpec);\nexport const HCurrencySchema = buildClientSchema(currencySchemaSpec);\nexport const HESIMSchema = buildClientSchema(esimSchemaSpec);\nexport const HPaymentSchema = buildClientSchema(paymentSchemaSpec);\nexport const HMessageSchema = buildClientSchema(messageSchemaSpec);\nexport const HPackageSchema = buildClientSchema(packageSchemaSpec);\nexport const HPromoCodeSchema = buildClientSchema(promoCodeSchemaSpec);\nexport const HPartnerSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPriceListSchema = buildClientSchema(priceListSchemaSpec);\nexport const HFinancialPropertiesSchema = buildClientSchema(financialPropertiesSchema);\nexport const HApiLogSchema = buildClientSchema(apiLogSchemaSpec);\nexport const HPackagePriceSchema = buildClientSchema(packagePriceSchema);\nexport const HubbyModelSchema = buildClientSchema(hubbyModelSpec);\nexport const HPartnerAppSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPlatformSettingsSchema = buildClientSchema(platformSettingsSchema);\nexport const HVisualIdentitySchema = buildClientSchema(visualIdentitySchema);\nexport const HPricingStrategySchema = buildClientSchema(pricingStrategySchema);\nexport const HFreeEsimSchema = buildClientSchema(freeEsimSchema);\nexport const HAnalyticsSchema = buildClientSchema(analyticsSpec);\nexport const HRoleSchema = buildClientSchema(roleSchemaSpec);\nexport const HPermissionSchema = buildClientSchema(permissionSchemaSpec);\nexport const HTagSchema = buildClientSchema(tagModelSpec);\nexport const HTrafficPolicySchema = buildClientSchema(trafficPolicySpec);\nexport const HTelnaPackageSchema = buildClientSchema(telnaPackageSchema);\nexport const HBondioPackageSchema = buildClientSchema(bondioPackageSchema);\n// Additional lower-level schemas\nexport const HAddressSchema = addressSchema;\nexport const HRegistrationSchema = registrationSchema;\nexport const HBankingDetailsSchema = bankingDetailsSchema;\nexport const HPartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const HPromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const HVisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const HScheduleFilterSchema = scheduleFilterSchema;\nexport const HPartnerContactSchema = partnerContactSchema;\nexport const HPartnerDataSchema = partnerDataSchema;\nexport const HCommunicationChannelSchema = communicationChannelSchema;\nexport const HBookingStatusSchema = bookingStatusSchema;\nexport const HCommunicationOptionsSchema = communicationOptionsSchema;\n\nexport type HAnalytics = z.infer;\nexport type HUser = z.infer;\nexport type HBooking = z.infer;\nexport type HCountry = z.infer;\nexport type HCurrency = z.infer;\nexport type HESIM = z.infer;\nexport type HPayment = z.infer;\nexport type HMessage = z.infer;\nexport type HPackage = z.infer;\nexport type HPromoCode = z.infer;\nexport type HPartner = z.infer;\nexport type HPriceList = z.infer;\nexport type HApiLog = z.infer;\nexport type HTag = z.infer;\nexport type HTrafficPolicy = z.infer;\nexport type HBondioPackage = z.infer;\nexport type HTelnaPackage = z.infer;\n// Additional lower-level types\nexport type HAddress = z.infer;\nexport type HRegistration = z.infer;\nexport type HBankingDetails = z.infer;\nexport type HPartnerPackageSpecification = z.infer;\nexport type HPromoPackageSpecification = z.infer;\nexport type HVisualIdentityBanner = z.infer;\nexport type HFinancialProperties = z.infer;\nexport type HScheduleFilter = z.infer;\nexport type HPartnerContact = z.infer;\nexport type HPartnerData = z.infer;\nexport type HCommunicationChannel = z.infer;\nexport type HBookingStatus = z.infer;\nexport type HCommunicationOptions = z.infer;\nexport type HHubbyModel = z.infer;\n\nexport type HubbyModelApp = HHubbyModel;\n\nexport type SupportedLocales = typeof SUPPORTED_LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\nexport type HRole = z.infer;\nexport type HPermission = z.infer; "]} \ No newline at end of file diff --git a/dist/index.cjs b/dist/index.cjs index 5b4a1e0..dec734f 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -687,8 +687,9 @@ var freeEsimSchema = zod.z.object({ enabled: zod.z.boolean(), package_specification: zod.z.object({ size: zod.z.string(), - type: zod.z.string(), - destination: zod.z.string() + package_type: zod.z.string(), + destination: zod.z.string(), + package_duration: zod.z.number() }), booking_id_verification: zod.z.boolean().default(false), booking_id_verification_pattern: zod.z.string().nullable().optional(), diff --git a/dist/index.cjs.map b/dist/index.cjs.map index 7ef4aea..553ed01 100644 --- a/dist/index.cjs.map +++ b/dist/index.cjs.map @@ -1 +1 @@ -{"version":3,"sources":["../src/builders/server.ts","../src/common.ts","../src/services/firebase.ts","../src/specs/user.ts","../src/specs/common.ts","../src/specs/booking.ts","../src/constants.ts","../src/specs/promocode.ts","../src/specs/country.ts","../src/specs/currency.ts","../src/specs/esim.ts","../src/specs/payment.ts","../src/specs/analytics.ts","../src/specs/message.ts","../src/specs/traffic_policy.ts","../src/specs/package.ts","../src/specs/partner.ts","../src/specs/apiLogs.ts","../src/utils/firestoreTransformUtils.ts","../src/builders/client.ts","../src/specs/role.ts","../src/specs/permission.ts","../src/index.client.ts","../src/utils/modelConverterFactory.ts","../src/index.server.ts"],"names":["z","packageSpecificationSchema","Timestamp","convertJSToFirestore","convertFirestoreToJS","SUPPORTED_LOCALES"],"mappings":";AAAA,SAAS,KAAAA,UAAS;AAClB,SAAS,iBAAiB;;;ACD1B,SAAqB,SAAS;AAQvB,SAAS,cACZ,QACA,SAQU;AACV,MAAI,CAAC;AAAS,WAAO;AAErB,MAAI,UAAU;AAGd,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAEA,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAGA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAEhD,QAAI,CAAC,YAAY,UAAU,EAAE,SAAS,GAAG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YAAY,kBAAkB,YAAY;AAChD,IAAM,qBAAqB,kBAAkB,kBAAkB;AAC/D,IAAM,sBAAsB,kBAAkB,mBAAmB;AACjE,IAAM,sBAAsB,kBAAkB,iBAAiB;AAG/D,IAAM,gBAAgB;AACtB,IAAM,qBAAqB;AAC3B,IAAM,uBAAuB;AAC7B,IAAM,oCAAoCA;AAC1C,IAAM,kCAAkC;AACxC,IAAM,6BAA6B;AACnC,IAAM,uBAAuB;AAC7B,IAAM,uBAAuB;AAC7B,IAAM,oBAAoB;AAC1B,IAAM,6BAA6B;AACnC,IAAM,sBAAsB;AAC5B,IAAM,6BAA6B;AACnC,IAAM,8BAA8B;AAmEpC,IAAM,uBAAuB,CAAC,YAA+B;AAChE,SAAO,qBAAqB,SAAS,iBAAiB;AAC1D;AAEO,IAAM,qBAAqB,CAAC,YAA+B;AAC9D,SAAO,qBAAqB,SAAS,iBAAiB;AAC1D;AAEO,IAAM,kBAAkB,CAAC,SAA8B;AAC1D,SAAO,qBAAqB,MAAM,cAAc;AACpD;AAEO,IAAM,oBAAoB,CAAC,SAA8B;AAC5D,SAAO,qBAAqB,MAAM,cAAc;AACpD;AAEO,IAAM,yBAAyB,CAAC,cAAqC;AACxE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,uBAAuB,CAAC,cAAqC;AACtE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,yBAAyB,CAAC,cAAqC;AACxE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,uBAAuB,CAAC,cAAqC;AACtE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,mBAAmB,kBAAkB,iBAAiB;AAG5D,IAAMI,qBAAoB","sourcesContent":["import { z } from 'zod';\nimport { Timestamp } from 'firebase-admin/firestore';\nimport type { FieldSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\nimport { FirebaseService } from '../services/firebase';\n\nexport const buildServerSchema = (spec: FieldSpec, path: string[] = []): z.ZodTypeAny => {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod schema passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec);\n }\n\n // ----- Array -----\n if ('_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n\n const itemSchema =\n spec.of instanceof z.ZodType\n ? spec.of\n : buildServerSchema(spec.of, [...path, '[i]']);\n\n let arraySchema = z.array(itemSchema);\n if (spec.nullable) arraySchema = arraySchema.nullable();\n if (spec.optional) arraySchema = arraySchema.optional();\n return arraySchema;\n }\n\n // ----- Record -----\n if ('_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n\n const valueSchema =\n spec.of instanceof z.ZodType\n ? spec.of\n : buildServerSchema(spec.of, [...path, '[key]']);\n\n let recordSchema = z.record(valueSchema);\n if (spec.nullable) recordSchema = recordSchema.nullable();\n if (spec.optional) recordSchema = recordSchema.optional();\n return recordSchema;\n }\n\n // ----- Timestamp -----\n if ('_type' in spec && spec._type === 'timestamp') {\n let tsSchema = z.date().transform(date => Timestamp.fromDate(date));\n if (spec.nullable) tsSchema = tsSchema.nullable();\n if (spec.optional) tsSchema = tsSchema.optional();\n return tsSchema;\n }\n\n // ----- Document Reference -----\n if ('_type' in spec && spec._type === 'docRef') {\n let refSchema = z.string().transform(id => {\n const firestore = FirebaseService.getDefaultInstance().getFirestore()\n return firestore.collection(spec.collection).doc(id);\n });\n if (spec.nullable) refSchema = refSchema.nullable();\n if (spec.optional) refSchema = refSchema.optional();\n return refSchema;\n }\n\n // ----- Nested object shape -----\n if (typeof spec === 'object' && !('_type' in spec)) {\n const shape: Record = {};\n for (const [key, val] of Object.entries(spec)) {\n shape[key] = buildServerSchema(val, [...path, key]);\n }\n return z.object(shape);\n }\n\n // ----- Object -----\n if (\n typeof spec === 'object' &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildServerSchema);\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || typeof spec === 'object' && '_type' in spec && spec._type === 'object') {\n return wrapPlainObjectSchema(spec, path, buildServerSchema);\n }\n\n // ----- Unknown or malformed spec -----\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n};\n","import { ZodTypeAny, z } from 'zod';\nimport type { SchemaBuilder } from './types';\n\n/**\n * Ensures a Zod schema is wrapped to be optional and/or nullable,\n * if not already. Use this in recursive schema builders.\n * Also applies any other supported schema transformations provided in options.\n */\nexport function wrapZodSchema(\n schema: ZodTypeAny,\n options?: {\n optional?: boolean;\n nullable?: boolean;\n min?: number;\n max?: number;\n // Allow arbitrary extensions via dynamic property\n [key: string]: any;\n }\n): ZodTypeAny {\n if (!options) return schema;\n\n let wrapped = schema;\n\n // Handle nullable and optional specially since they're common\n if (options.nullable && !wrapped.isNullable?.()) {\n wrapped = wrapped.nullable();\n }\n\n if (options.optional && !wrapped.isOptional?.()) {\n wrapped = wrapped.optional();\n }\n\n // Process all other options dynamically\n for (const [key, value] of Object.entries(options)) {\n // Skip the already handled properties and undefined values\n if (['nullable', 'optional'].includes(key) || value === undefined) {\n continue;\n }\n\n // Check if the schema has a method matching the option key\n if (typeof (wrapped as any)[key] === 'function') {\n wrapped = (wrapped as any)[key](value);\n }\n }\n\n return wrapped;\n}\n\nexport function wrapObjectSchema(\n spec: any, // using any to support dynamic `spec.type === 'object'`\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n if (!('of' in spec)) {\n throw new Error(`Object spec at \"${pathString}\" is missing 'of'`);\n }\n\n const shape: Record = {};\n for (const [key, value] of Object.entries(spec.of)) {\n shape[key] = builder(value as any, [...path, key]);\n }\n\n let objectSchema: ZodTypeAny = z.object(shape);\n if (spec.nullable) objectSchema = objectSchema.nullable();\n if (spec.optional) objectSchema = objectSchema.optional();\n return objectSchema;\n}\n\n/**\n * Wraps a plain object shape (no `type: 'object'`) into a Zod schema.\n * Assumes each field is either a Zod schema or another FieldSpec.\n */\nexport function wrapPlainObjectSchema(\n spec: Record,\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n // Handle object field specs with '_type': 'object'\n if ('_type' in spec && spec._type === 'object' && 'of' in spec) {\n return wrapObjectSchema(spec, path, builder);\n }\n\n const shape: Record = {};\n\n // Only add fields to the schema if they're not special control properties\n for (const [key, val] of Object.entries(spec)) {\n if (key !== '_type' && key !== 'nullable' && key !== 'optional') {\n shape[key] = builder(val, [...path, key]);\n }\n }\n\n // Create the base object schema\n let schema: ZodTypeAny = z.object(shape);\n\n // Apply nullable/optional modifiers if needed\n if ('nullable' in spec && spec.nullable === true) {\n schema = schema.nullable();\n }\n\n if ('optional' in spec && spec.optional === true) {\n schema = schema.optional();\n }\n\n return schema;\n}\n\nexport const SCHEMA_MARKER = Symbol('ZodSchemaSpecMarker');\n\nexport function markAsSchemaSpec(spec: T): T {\n Object.defineProperty(spec, SCHEMA_MARKER, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return spec;\n}\n\nexport function isSchemaSpec(obj: unknown): obj is Record {\n return typeof obj === 'object' && obj !== null && SCHEMA_MARKER in obj;\n}","import { getApps, initializeApp, cert, AppOptions, App } from \"firebase-admin/app\";\nimport { getFirestore, Firestore } from \"firebase-admin/firestore\";\nimport { applicationDefault } from \"firebase-admin/app\";\n\nexport interface FirebaseConfig {\n credential?: AppOptions['credential'];\n projectId?: string;\n storageBucket?: string;\n databaseURL?: string;\n // Options for testing\n isTest?: boolean;\n}\n\n// Define variable to hold singleton instance (must be injected by consumer/tests)\nlet defaultInstance: FirebaseService | null = null;\n\nexport class FirebaseService {\n\n private firestoreInstance: Firestore;\n constructor(db: Firestore) {\n this.firestoreInstance = db;\n }\n\n getFirestore(): Firestore {\n return this.firestoreInstance;\n }\n\n // Get default instance with singleton pattern\n public static getDefaultInstance(): FirebaseService {\n if (defaultInstance === null) {\n throw new Error(\n \"FirebaseService default instance not set. Inject a FirebaseService via FirebaseService.setDefaultInstance(...) in your application startup or test setup.\"\n );\n }\n return defaultInstance;\n }\n\n // Allow for setting a custom default instance (useful for tests)\n public static setDefaultInstance(instance: FirebaseService): void {\n defaultInstance = instance;\n }\n}\n\n// Function to create a new Firebase service instance (use in tests or by consumers before injection)\nexport function createFirebaseService(db: Firestore): FirebaseService {\n return new FirebaseService(db);\n}","import { z } from 'zod';\nimport { PARTNER_COLLECTION, PROFILE_COLLECTION, timestampNullableOptional, timestampRequired, timestampNullable, ROLE_COLLECTION, PERMISSION_COLLECTION } from './common';\nimport { markAsSchemaSpec } from '../common'\n\nexport const apiKeySpec = {\n expires_at: { _type: 'timestamp' as const },\n secret: z.string(),\n is_active: z.boolean(),\n}\n\nexport const apiKeysSpec = {\n _type: 'record' as const,\n of: {\n _type: 'object' as const,\n of: apiKeySpec\n }\n}\n\nexport const apiKeysObjectSpec = {\n _type: 'object' as const,\n of: {\n allowed_keys: { _type: 'array' as const, nullable: true, optional: true, of: z.string() },\n keys: apiKeysSpec\n },\n nullable: true,\n optional: true\n}\n\nexport const userSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string().nullable(),\n email: z.string().email().nullable(),\n stripe_id: z.string().nullable().optional(),\n referral: z.string().nullable().optional(),\n fcm: z.string().optional(),\n deeplink: z.string().nullable().optional(),\n gender: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n coordinates: z.string().nullable().optional(),\n parameters: z.any().nullable().optional(),\n locale: z.string().nullable().optional(),\n phone_model: z.string().nullable().optional(),\n phone_os: z.string().nullable().optional(),\n phone_os_version: z.string().nullable().optional(),\n ios: z.boolean().nullable().optional(),\n has_card_saved: z.boolean().nullable().optional(),\n admin: z.boolean().nullable().optional(),\n api_keys: apiKeysObjectSpec,\n currency: z.string().nullable().optional(),\n receipt_email: z.string().nullable().optional(),\n source: z.enum(['direct', 'promo', 'platform']).nullable().optional(),\n role: { _type: 'docRef' as const, collection: ROLE_COLLECTION, optional: true, nullable: true },\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n balance: z.number().nullable().optional(),\n createdAt: { _type: 'timestamp' as const },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, optional: true, nullable: true },\n profileRef: { _type: 'docRef' as const, collection: PROFILE_COLLECTION, optional: true, nullable: true },\n review_requested: timestampNullableOptional,\n last_seen: timestampNullableOptional\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\n\n// Collection paths\nexport const PARTNER_COLLECTION = '/companies/hubby/partners';\nexport const USER_COLLECTION = 'users';\nexport const PROFILE_COLLECTION = '/companies/hubby/profiles';\nexport const PACKAGE_COLLECTION = '/companies/hubby/packages';\nexport const PROMO_CODE_COLLECTION = '/companies/hubby/promo_codes';\nexport const COUNTRY_COLLECTION = 'countries';\nexport const ESIM_COLLECTION = 'esims';\nexport const PAYMENT_COLLECTION = 'payments';\nexport const PRICE_LIST_COLLECTION = 'price_lists';\nexport const BOOKING_COLLECTION = 'bookings';\nexport const MESSAGE_COLLECTION = 'messages';\nexport const CURRENCY_COLLECTION = 'currencies';\nexport const API_LOG_COLLECTION = 'api_logs'\nexport const ROLE_COLLECTION = 'roles';\nexport const PERMISSION_COLLECTION = 'permissions';\nexport const TRAFFIC_POLICY_COLLECTION = 'traffic_policies';\n\n// Timestamp specs\nexport const timestampNullableOptional = { _type: 'timestamp' as const, nullable: true, optional: true };\nexport const timestampNullable = { _type: 'timestamp' as const, nullable: true, optional: false };\nexport const timestampRequired = { _type: 'timestamp' as const, nullable: false, optional: false };\n\nexport const hubbyModelSpec = {\n id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n created_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n updated_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n}\n\nexport const tagModelSpec = {\n ...hubbyModelSpec,\n slug: z.string(),\n name: z.string(),\n description: z.string().nullable().optional(),\n color: z.string().nullable().optional(),\n}","import { z } from 'zod';\nimport {\n PARTNER_COLLECTION,\n PROMO_CODE_COLLECTION,\n USER_COLLECTION,\n ESIM_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema } from '../constants';\nimport { packageSpecificationSchema } from './promocode';\n\n// Enum for communication channels\nexport const communicationChannelSchema = z.enum([\n 'EMAIL',\n 'WHATSAPP',\n 'PUSH_NOTIFICATION',\n 'SMS'\n]);\nexport type CommunicationChannelType = z.infer;\n\n// For backward compatibility\nexport type CommunicationChannel = CommunicationChannelType;\n\n// Add enum-like object for use in code\nexport const CommunicationChannel = {\n EMAIL: 'EMAIL' as const,\n WHATSAPP: 'WHATSAPP' as const,\n PUSH_NOTIFICATION: 'PUSH_NOTIFICATION' as const,\n SMS: 'SMS' as const\n} as const;\n\n// Status type for bookings\nexport const bookingStatusSchema = z.enum([\n 'PENDING',\n 'CONFIRMED',\n 'COMPLETED',\n 'CANCELLED',\n 'UNPAID',\n 'EXPIRED'\n]);\nexport type BookingStatus = z.infer;\n\n// Communication options schema\nexport const communicationOptionsSchema = z.object({\n should_send_message: z.boolean(),\n channels: z.array(communicationChannelSchema)\n});\n\nexport type CommunicationOptions = z.infer;\n\n// Define the booking schema spec\nexport const bookingSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n external_id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n title: z.string().nullable(),\n first_name: z.string().nullable().optional(),\n last_name: z.string().nullable().optional(),\n full_name: z.string().nullable().optional(),\n pax: z.number(),\n email: z.string().email().nullable(),\n phone: z.string().nullable(),\n booking_id: z.string().nullable(),\n flight_number: z.string().optional(),\n gender: z.enum(['M', 'F', 'O']).optional(),\n package_size: z.string().optional(),\n sent_messages: z.record(z.any()).optional(),\n locale: supportedLocalesSchema,\n status: bookingStatusSchema,\n data: {\n _type: 'object' as const,\n of: {\n source: z.string(),\n manual: z.boolean()\n }\n },\n communication_options: {\n _type: 'object' as const,\n of: {\n should_send_message: z.boolean(),\n channels: {\n _type: 'array' as const,\n of: communicationChannelSchema\n }\n }\n },\n is_processed_for_esim_restoration: z.boolean(),\n is_pseudonymized: z.boolean(),\n import_id: z.string().nullable().optional(),\n package_specifications: z.array(packageSpecificationSchema).min(1),\n departure_date: timestampRequired,\n return_date: timestampNullable,\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION },\n promo_codes: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: PROMO_CODE_COLLECTION }\n },\n users: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: USER_COLLECTION },\n nullable: true\n },\n esims: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: ESIM_COLLECTION },\n nullable: true\n }\n});\n\n","import { z } from \"zod\";\n\nexport const SUPPORTED_LOCALES = [\n \"en-US\",\n \"en-EU\",\n \"en-GB\",\n \"en-CA\",\n \"nl-NL\",\n \"de-DE\",\n \"fr-FR\",\n \"it-IT\",\n \"es-ES\",\n \"cs-CZ\",\n \"pl-PL\",\n \"pt-PT\",\n \"fr-BE\",\n \"nl-BE\",\n \"de-AT\",\n \"de-CH\",\n \"fr-CH\",\n \"it-CH\",\n \"sv-SE\",\n \"sk-SK\",\n \"de-BE\",\n \"en-AU\",\n \"da-DK\",\n] as const;\n\n// Define the type using TypeScript's typeof and indexing\n\n// Define the type using TypeScript's typeof and indexing\nexport type SupportedLocales = (typeof SUPPORTED_LOCALES)[number];\n\n// Create a Zod schema for validation\nexport const supportedLocalesSchema = z.enum(SUPPORTED_LOCALES);\n\n// Type inference from the schema (alternative way to define the type)\nexport type SupportedLocalesFromSchema = z.infer;\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n PARTNER_COLLECTION,\n COUNTRY_COLLECTION,\n PACKAGE_COLLECTION,\n BOOKING_COLLECTION,\n PROMO_CODE_COLLECTION,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// Define package specification schema for use in promo code\nexport const packageSpecificationSchema = z.object({\n destination: z.string().optional(),\n size: z.string().optional(),\n package_id: z.string().optional(),\n iata_code: z.string().optional(),\n package_duration: z.number().optional(),\n package_type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).optional(),\n traffic_policy: z.string().optional(),\n});\n\n// Define the promo code schema spec\nexport const promoCodeSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n redeemed_at: timestampNullableOptional,\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // PromoCode specific fields\n external_id: z.string(),\n code: z.string(),\n allowance_user: z.number(),\n allowance_total: z.number(),\n type: z.enum(['discount', 'booking', 'booking_without_destination']).nullable().or(z.string()),\n usage: z.array(z.string()),\n uuid_usage: z.array(z.string()),\n package_specification: packageSpecificationSchema.optional(),\n valid_from: timestampRequired,\n valid_to: timestampRequired,\n\n // Reference fields\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION, nullable: true },\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n booking: { _type: 'docRef' as const, collection: BOOKING_COLLECTION, nullable: true },\n\n // Optional fields based on the type\n discount: z.number().optional(),\n package_size: z.string().optional(),\n countries: z.array(z.string()).optional(),\n max_bytes: z.number().optional(),\n starter_data: z.number().optional()\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const countrySchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n bokun_id: z.number().nullable(),\n LTE: z.boolean().nullable(),\n apn: z.string().nullable(),\n click_count: z.number().nullable(),\n global_network: z.string().nullable(),\n global_price: z.number().nullable(),\n hubby: z.number().nullable(),\n imsi: z.number().nullable(),\n has_esim: z.boolean(),\n name: z.string().nullable(),\n region: z.boolean().nullable(),\n i18n_name: z.record(z.string()),\n is_region: z.boolean().nullable(),\n countries: z.array(z.string()).nullable(),\n tier: z.number().nullable()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define schema for conversion rates (for backward compatibility)\nexport const conversionRateSchema = z.object({\n currency: z.number()\n});\n\nexport type CoversionRate = z.infer;\n\n// Define the currency schema spec\nexport const currencySchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n // ISO 4217 currency code (e.g., \"USD\", \"EUR\")\n code: z.string().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n // Currency symbol (e.g., \"$\", \"€\")\n symbol: z.string().describe('Currency symbol (e.g., \"$\", \"€\")'),\n // Full name of the currency (e.g., \"US Dollar\")\n name: z.string().describe('Full name of the currency (e.g., \"US Dollar\")'),\n // Exchange rate relative to base currency\n rate: z.number().describe('Exchange rate relative to base currency'),\n // Whether this is the default currency\n is_default: z.boolean().describe('Whether this is the default currency')\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n USER_COLLECTION,\n PARTNER_COLLECTION,\n PAYMENT_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\n\n// Define the eSIM schema spec\nexport const esimSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Common eSIM fields\n imsi: z.number(),\n qr: z.string(),\n iccid: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable().optional(),\n total_data: z.number(),\n data_left: z.number(),\n data_used: z.boolean(),\n status: z.string().nullable(),\n name: z.string(),\n android_auto: z.boolean(),\n partner_price: z.number().nullable(),\n promo: z.string().nullable(),\n type: z.enum(['api', 'promo', 'balance', 'code', 'external', 'payment']),\n is_auto_install: z.boolean(),\n is_archived: z.boolean(),\n user: z.string().nullable(),\n payment: z.string().nullable(),\n apn: z.string().nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Timestamp fields\n time_assigned: timestampNullable,\n last_updated: timestampNullable\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n USER_COLLECTION,\n timestampRequired\n} from './common';\n\n// Define the payment schema spec\nexport const paymentSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Payment specific fields\n amount: z.number(),\n customer: z.string(),\n date: timestampRequired,\n iccid: z.string(),\n package: z.string(),\n promo: z.string(),\n topup: z.boolean(),\n\n // Reference fields\n user: { _type: 'docRef' as const, collection: USER_COLLECTION, nullable: true, optional: true }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec, PARTNER_COLLECTION } from './common';\n\n// Country schema spec\nexport const analyticsSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n service: z.string(),\n date: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/), // YYYY-MM-DD\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n event: z.string(),\n parameter: z.string().nullable(),\n sum: z.number(),\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define the message schema spec\nexport const messageSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n key: z.string(),\n method: z.enum([\"push\", \"sms\", \"email\"]),\n status: z.enum([\"pending\", \"sent\", \"failed\", \"delivered\"]),\n created_at: timestampRequired,\n updated_at: timestampRequired\n});\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const trafficPolicySpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n name: z.string(),\n description: z.string(),\n external_id: z.string(),\n provider: z.string()\n})","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n PARTNER_COLLECTION,\n TRAFFIC_POLICY_COLLECTION,\n timestampRequired,\n hubbyModelSpec\n} from './common';\n\nimport { countrySchemaSpec } from './country';\n\n// Define the package schema spec\nexport const packageSchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n // Package specific fields\n external_id: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable(),\n label: z.string(),\n bytes: z.number(),\n hidden: z.boolean(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n price: z.number(),\n partner_price: z.number(),\n days: z.number(),\n name: z.string(),\n type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).nullable(),\n throttling: z.number().optional(),\n provider_parameters: z.object({\n imsi: z.number()\n }).nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Nested country data - need to use dynamic reference to country schema\n // This would typically be handled better with a proper recursive schema definition\n // but for simplicity, we're using any type here\n country_data: {\n _type: 'object' as const,\n of: countrySchemaSpec,\n nullable: true,\n optional: true\n }\n // country_data: z.any().nullable()\n});\n\nexport const commonPackageSchema = markAsSchemaSpec({\n size: z.string(),\n iso: z.string(),\n days: z.number(),\n price: z.number(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n packageType: z.string(),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n});\n\nexport const telnaPackageSchema = markAsSchemaSpec({\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n ...commonPackageSchema,\n});\n\nexport const bondioPackageSchema = markAsSchemaSpec({\n ...commonPackageSchema,\n label: z.enum(['lambda', 'tau']),\n});","import { z, ZodLazy } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema, SUPPORTED_LOCALES, SupportedLocales } from '../constants';\nimport {\n PARTNER_COLLECTION,\n USER_COLLECTION,\n PACKAGE_COLLECTION,\n PRICE_LIST_COLLECTION,\n tagModelSpec,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// ===== Helper schemas for nested structures =====\n\n// Address schema\nexport const addressSchema = z.object({\n street: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n postal_code: z.string().nullable().optional(),\n country: z.string().nullable().optional()\n});\n\n// Emit event schema\nexport const emitEventSchema = z.object({\n topup: z.boolean().optional().default(false),\n redemption: z.boolean().optional().default(false),\n activation: z.boolean().optional().default(false),\n depletion: z.boolean().optional().default(false),\n});\n\n// Registration schema\nexport const registrationSchema = z.object({\n chamber_of_commerce_number: z.string().nullable().optional(),\n vat_number: z.string().nullable().optional(),\n anvr_number: z.number().nullable().optional(),\n tax_number: z.string().nullable().optional()\n});\n\n// Banking details schema\nexport const bankingDetailsSchema = z.object({\n account_holder: z.string().nullable().optional(),\n bank_name: z.string().nullable().optional(),\n iban: z.string().nullable().optional(),\n currency: z.string().nullable().optional()\n});\n\n// Package price schema\nexport const packagePriceSchema = z.object({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: z.object({ _type: z.literal('docRef'), collection: z.literal(PACKAGE_COLLECTION) })\n});\n\n// Package specification schema\nexport const packageSpecificationSchema = z.object({\n size: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n destination: z.string().nullable().optional()\n});\n\n// Pricing strategy schema\nexport const pricingStrategySchema = z.object({\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: z.object({\n _type: z.literal('docRef'),\n collection: z.literal(PRICE_LIST_COLLECTION),\n nullable: z.literal(true)\n }),\n custom_prices: z.array(packagePriceSchema)\n});\n\n// Visual identity banner schema\nexport const visualIdentityBannerSchema = z.object({\n image_url: z.string(),\n alt: z.string(),\n click_url: z.string(),\n locale: supportedLocalesSchema,\n properties: z.record(z.string())\n});\n\n// Schedule filter schema\nexport const scheduleFilterSchema = z.object({\n type: z.enum(['iso3', 'gender', 'percentage', 'age']),\n value: z.union([z.string(), z.number()]),\n comparison: z.enum([\n 'equal',\n 'not_equal',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal'\n ])\n});\n\n// Convert object-like schemas to proper Zod objects\nexport const visualIdentityBannersSchema = z.object({\n strategy: z.enum(['fixed', 'rotating', 'destination', 'time_of_day']),\n banners: z.array(visualIdentityBannerSchema).nullable().optional()\n});\n\nexport const visualIdentitySchema = z.object({\n primary_color: z.string(),\n secondary_color: z.string(),\n logo: z.string(),\n font: z.string().nullable().optional(),\n top_banner: visualIdentityBannersSchema.optional(),\n mid_banner: visualIdentityBannersSchema.optional()\n});\n\n// Partner contact schema\nexport const partnerContactSchema = z.object({\n name: z.string().nullable().optional(),\n email: z.string().nullable(),\n office_phone: z.string().nullable().optional()\n});\n\n// Partner data schema\nexport const partnerDataSchema = z.object({\n source: z.string(),\n manual: z.boolean()\n});\n\n// Package strategy schema\nexport const packageStrategySchema = z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any()\n});\n\n// Schedule email schema\nexport const scheduleEmailSchema = z.object({\n brevo_template_id: z.number(),\n subject: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional(),\n preview_text: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional()\n}).nullable().optional();\n\n// Schedule push schema\nexport const schedulePushSchema = z.object({\n title: z.record(z.string()).optional(),\n body: z.record(z.string()).optional(),\n target: z.string()\n}).nullable().optional();\n\n// Schedule schema\nexport const scheduleSchema = z.object({\n days: z.number(),\n email: scheduleEmailSchema,\n push: schedulePushSchema,\n hour: z.number(),\n key: z.string(),\n method: z.enum(['email', 'sms', 'whatsapp', 'push']),\n moment: z.enum(['departure_date', 'return_date', 'immediate']),\n filter: scheduleFilterSchema.nullable().optional()\n});\n\nexport const freeEsimSchema = z.object({\n enabled: z.boolean(),\n package_specification: z.object({\n size: z.string(),\n type: z.string(),\n destination: z.string()\n }),\n booking_id_verification: z.boolean().default(false),\n booking_id_verification_pattern: z.string().nullable().optional(),\n allowance: z.number(),\n total_allowance: z.number(),\n});\n\n// Platform settings schema\nexport const platformSettingsSchema = z.object({\n package_strategy: z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any(),\n supported_package_types: z.enum(['data-limited', 'unlimited']).optional()\n }).nullable().optional(),\n free_esim: freeEsimSchema.nullable().optional(),\n booking_defaults: z.object({\n locale: supportedLocalesSchema\n }).nullable().optional(),\n booking_confirmation: z.object({\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n }).nullable().optional(),\n emit_events: emitEventSchema.nullable().optional(),\n schedules: z.array(scheduleSchema).optional(),\n visual_identity_options: z.object({\n hubby_branding: z.boolean().optional().default(true),\n source_partner_branding: z.boolean().optional().default(false),\n own_branding: z.boolean().optional().default(false)\n }).nullable().optional()\n});\n\n// ===== Exportable schema specs =====\n\n// Package price schema spec\nexport const packagePriceSchemaSpec = markAsSchemaSpec({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n});\n\n// Financial properties schema spec\nexport const financialPropertiesSchemaSpec = markAsSchemaSpec({\n administration_fee: z.number().nullable(),\n income_per_gb: z.number().nullable(),\n commission_fee: z.number().nullable().optional(),\n payment_method: z.enum(['invoice', 'direct']),\n requires_card: z.boolean().nullable(),\n next_invoice: timestampNullableOptional,\n last_invoice: timestampNullableOptional,\n pricing_strategies: {\n _type: 'object' as const,\n of: {\n partner: {\n _type: 'object' as const,\n of: {\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n },\n user: {\n _type: 'object' as const,\n of: {\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n }\n },\n nullable: true\n }\n});\n\n// Platform settings schema spec\nexport const platformSettingsSchemaSpec = markAsSchemaSpec({\n package_strategy: {\n _type: 'object' as const,\n of: packageStrategySchema.shape,\n nullable: true,\n optional: true\n },\n free_esim: {\n _type: 'object' as const,\n of: freeEsimSchema.shape,\n nullable: true,\n optional: true\n },\n booking_defaults: {\n _type: 'object' as const,\n of: {\n locale: supportedLocalesSchema\n },\n nullable: true,\n optional: true\n },\n booking_confirmation: {\n _type: 'object' as const,\n of: {\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n },\n nullable: true,\n optional: true\n },\n schedules: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: scheduleSchema.shape\n },\n optional: true\n }\n});\n\n// Webhook settings schema\nexport const webhookSettingsSchema = z.object({\n url: z.string().url().nullable().optional(),\n api_key: z.string().nullable().optional(),\n enabled: z.boolean().default(false),\n events: z.object({\n promocode_redemption: z.boolean().default(false)\n }).default({})\n});\n\n// ===== Main partner schema =====\nexport const partnerSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Partner specific fields\n name: z.string().min(3),\n type: z.string().nullable(),\n is_active: z.boolean().nullable().optional(),\n external_id: z.string().nullable().optional(),\n\n // Complex nested objects\n contact: {\n _type: 'object' as const,\n of: partnerContactSchema.shape,\n nullable: true\n },\n address: {\n _type: 'object' as const,\n of: addressSchema.shape,\n nullable: true\n },\n registration: {\n _type: 'object' as const,\n of: registrationSchema.shape,\n nullable: true\n },\n banking_details: {\n _type: 'object' as const,\n of: bankingDetailsSchema.shape,\n nullable: true\n },\n\n // Reference fields\n parent: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n users: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: USER_COLLECTION }, nullable: true },\n\n // Complex nested structures\n financial_properties: financialPropertiesSchemaSpec,\n // Visual identity\n visual_identity: {\n _type: 'object' as const,\n of: visualIdentitySchema.shape,\n nullable: true\n },\n\n // Platform settings\n platform_settings: {\n _type: 'object' as const,\n of: platformSettingsSchema.shape,\n nullable: true\n },\n\n // Tags\n tags: {\n _type: 'array' as const,\n of: tagModelSpec,\n nullable: true,\n optional: true\n },\n\n // Metadata\n data: {\n _type: 'object' as const,\n of: partnerDataSchema.shape,\n nullable: true,\n optional: true\n },\n\n // Webhook settings\n webhook_settings: {\n _type: 'object' as const,\n of: webhookSettingsSchema.shape,\n nullable: true,\n optional: true\n }\n});\n\n// ===== Price list schema =====\nexport const priceListSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Price list specific fields\n name: z.string().min(3),\n description: z.string().nullable(),\n type: z.enum(['partner', 'consumer']),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n});\n","import { z } from 'zod';\nimport { timestampRequired } from './common';\nimport { markAsSchemaSpec } from '../common';\n\nexport const payloadSpec = {\n _type: 'record' as const,\n of: z.unknown(),\n optional: true\n};\n\nexport const apiLogSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n method: z.string(),\n user_id: z.string().optional(),\n path: z.string(),\n resource_type: z.string().optional(),\n resource_id: z.string().optional(),\n partner_id: z.string().optional(),\n payload: payloadSpec,\n timestamp: timestampRequired,\n status_code: z.number()\n});\n","// firestoreTransformUtils.ts\n\nimport { z } from 'zod';\nimport { DocumentReference, Timestamp, Firestore } from 'firebase-admin/firestore';\nimport { FieldSpec } from '../types';\nimport { FirebaseService } from '../services/firebase';\n// Note: Firestore instance must be injected by consumers/tests via factory\n\nexport function createConvertJSToFirestore(db: Firestore) {\n return function convertJSToFirestore(input: any, spec: FieldSpec): any {\n // Handle null/undefined at the top level\n if (input === undefined || input === null) return null;\n\n if (spec instanceof z.ZodType) {\n if (input instanceof Date) return Timestamp.fromDate(input);\n return input; // already valid\n }\n\n if ('_type' in spec) {\n switch (spec._type) {\n case 'timestamp':\n if (input instanceof Date) {\n return Timestamp.fromDate(input);\n } else if (typeof input === 'string' || typeof input === 'number') {\n return Timestamp.fromDate(new Date(input));\n }\n return input;\n case 'docRef':\n return db.collection(spec.collection).doc(input);\n case 'array':\n return input.map((item: any) => convertJSToFirestore(item, spec.of));\n case 'record':\n // For records, filter out undefined values\n return Object.fromEntries(\n Object.entries(input)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [k, convertJSToFirestore(v, spec.of)])\n );\n case 'object':\n if ('of' in spec && typeof spec.of === 'object') {\n const result: any = {};\n for (const [key, fieldSpec] of Object.entries(spec.of)) {\n // Check if the field exists in the input\n if (key in input) {\n const value = input[key];\n\n // Handle based on field optionality and nullability\n if (value === undefined) {\n // Check if field is optional by looking at its spec\n const isOptional = typeof fieldSpec === 'object' && '_type' in fieldSpec && fieldSpec._type === 'optional';\n if (!isOptional) {\n // If not optional but nullable, convert to null\n result[key] = null;\n }\n // If optional, just skip it (don't add to result)\n } else {\n // Normal case - value exists and is not undefined\n result[key] = convertJSToFirestore(value, fieldSpec);\n }\n }\n }\n return result;\n }\n return input;\n default:\n throw new Error(`Unknown field type: ${spec._type}`);\n }\n }\n\n // fallback: plain object shape with explicit schema\n if (typeof input === 'object' && !Array.isArray(input) && typeof spec === 'object') {\n const result: any = {};\n\n for (const [key, fieldSpec] of Object.entries(spec)) {\n if (key in input) {\n const value = input[key];\n\n // Handle undefined values\n if (value === undefined) {\n // Check if field is optional\n const isOptional = typeof fieldSpec === 'object' && '_type' in fieldSpec && fieldSpec._type === 'optional';\n if (!isOptional) {\n // If not optional but nullable, convert to null\n result[key] = null;\n }\n // If optional, don't include in the result\n } else {\n // Normal case - value exists\n result[key] = convertJSToFirestore(value, fieldSpec);\n }\n }\n }\n\n return result;\n }\n\n return input;\n };\n}\n\nfunction isDuckTimestamp(obj: any): obj is { toDate: () => Date } {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.toDate === 'function' &&\n Object.prototype.toString.call(obj.toDate()) === '[object Date]'\n );\n}\n\nfunction isDuckDocumentRef(obj: any): obj is { id: string } {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.id === 'string' &&\n typeof obj.path === 'string'\n );\n}\n\nexport function createConvertFirestoreToJS() {\n return function convertFirestoreToJS(input: any, spec: FieldSpec, path: string[] = []): any {\n const pathString = path.join('.') || '';\n\n // ✅ Convert Firestore-native or duck-typed Timestamp\n if (input instanceof Timestamp || isDuckTimestamp(input)) {\n return input.toDate();\n }\n\n // ✅ Convert Firestore-native or duck-typed DocumentReference\n if (input instanceof DocumentReference || isDuckDocumentRef(input)) {\n return input.id;\n }\n\n if (input === null || input === undefined) return input;\n if (!spec) return input;\n\n if (spec instanceof z.ZodType) {\n // 🔁 Keep in place if it's already a native value\n return input;\n }\n\n if ('_type' in spec) {\n switch (spec._type) {\n case 'timestamp':\n return (input instanceof Timestamp || isDuckTimestamp(input)) ? input.toDate() : input;\n\n case 'docRef':\n return (input instanceof DocumentReference || isDuckDocumentRef(input)) ? input.id : input;\n\n case 'array':\n return Array.isArray(input)\n ? input.map((item, i) => convertFirestoreToJS(item, spec.of, [...path, `[${i}]`]))\n : input;\n\n case 'record':\n if (typeof input !== 'object' || input === null) return input;\n return Object.fromEntries(\n Object.entries(input)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [\n k,\n convertFirestoreToJS(v, spec.of, [...path, k]),\n ])\n );\n\n case 'object':\n if (!spec.of || typeof spec.of !== 'object') return input;\n const result: Record = {};\n for (const [key, fieldSpec] of Object.entries(spec.of)) {\n // Only include properties that exist in the input and aren't undefined\n if (key in input && input[key] !== undefined) {\n result[key] = convertFirestoreToJS(input[key], fieldSpec, [...path, key]);\n }\n }\n return result;\n }\n }\n\n if (typeof spec === 'object' && typeof input === 'object' && !Array.isArray(input)) {\n const result: Record = {};\n for (const [key, valSpec] of Object.entries(spec)) {\n // Only include properties that exist in the input and aren't undefined\n if (key in input && input[key] !== undefined) {\n result[key] = convertFirestoreToJS(input[key], valSpec, [...path, key]);\n }\n }\n return result;\n }\n\n return input;\n };\n}\n\n// For backward compatibility, export the default functions\nexport const convertFirestoreToJS = createConvertFirestoreToJS();\n\n// Backward-compatible helper that lazily uses injected default Firestore instance\nexport function convertJSToFirestore(input: any, spec: FieldSpec): any {\n const firestore = FirebaseService.getDefaultInstance().getFirestore();\n return createConvertJSToFirestore(firestore)(input, spec);\n}\n","import { z, ZodTypeAny } from 'zod';\nimport type { FieldSpec, SchemaFromSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\n\nexport function buildClientSchema(spec: S, path: string[] = []): SchemaFromSpec {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid schema spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec) as unknown as SchemaFromSpec;\n }\n\n // Check if object might be a Zod schema (has _def property or ~standard metadata)\n if (typeof spec === 'object' && spec !== null &&\n (('_def' in spec) || ('~standard' in spec && (spec as any)['~standard']?.vendor === 'zod'))) {\n try {\n // Try to use it as a Zod schema directly\n return wrapZodSchema(spec as unknown as z.ZodTypeAny) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this fails, we'll continue with the other checks\n console.warn(`Failed to use object as Zod schema at \"${pathString}\":`, error);\n }\n }\n\n // ----- Array -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.array(buildClientSchema(spec.of, [...path, '[i]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Record -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.record(buildClientSchema(spec.of, [...path, '[key]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Timestamp -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'timestamp') {\n let schema: ZodTypeAny = z.preprocess((val) => {\n if (typeof val === 'string') {\n // Try to parse the string to a Date object\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date; // undefined will cause z.date() to fail\n }\n if (typeof val === 'number') {\n // Handle numeric timestamps\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date;\n }\n // If it's already a Date or something else, return it as is\n return val;\n }, z.date({ required_error: 'Date is required', invalid_type_error: 'Invalid date format' }));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- DocRef -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'docRef') {\n let schema: ZodTypeAny = z.string(); // only ID on client\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Object (plain nested object spec) -----\n if (\n typeof spec === 'object' &&\n spec !== null &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || (typeof spec === 'object' && spec !== null && '_type' in spec && (spec as any)._type === 'object')) {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // If we have an object with fields that look like schema specs, try to handle it as a schema object\n if (typeof spec === 'object' && spec !== null) {\n try {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this also fails, we'll throw the error below\n console.warn(`Failed to handle object as plain schema at \"${pathString}\":`, error);\n }\n }\n\n // 🔥 If we got here, the spec had a structure we didn't handle\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n}\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional, PERMISSION_COLLECTION } from './common';\n\nexport const roleSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional } from './common';\n\nexport const permissionSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { buildClientSchema } from './builders/client';\nimport {\n userSchemaSpec,\n apiKeySpec,\n apiKeysSpec,\n apiKeysObjectSpec\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { bondioPackageSchema, packageSchemaSpec, telnaPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n financialPropertiesSchemaSpec as financialPropertiesSchema,\n packagePriceSchema,\n platformSettingsSchema,\n visualIdentitySchema,\n pricingStrategySchema,\n freeEsimSchema,\n} from './specs/partner';\nimport { analyticsSpec } from './specs/analytics';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { roleSchemaSpec } from './specs/role';\nimport { permissionSchemaSpec } from './specs/permission';\n\nexport const HUserSchema = buildClientSchema(userSchemaSpec);\nexport const HBookingSchema = buildClientSchema(bookingSchemaSpec);\nexport const HCountrySchema = buildClientSchema(countrySchemaSpec);\nexport const HCurrencySchema = buildClientSchema(currencySchemaSpec);\nexport const HESIMSchema = buildClientSchema(esimSchemaSpec);\nexport const HPaymentSchema = buildClientSchema(paymentSchemaSpec);\nexport const HMessageSchema = buildClientSchema(messageSchemaSpec);\nexport const HPackageSchema = buildClientSchema(packageSchemaSpec);\nexport const HPromoCodeSchema = buildClientSchema(promoCodeSchemaSpec);\nexport const HPartnerSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPriceListSchema = buildClientSchema(priceListSchemaSpec);\nexport const HFinancialPropertiesSchema = buildClientSchema(financialPropertiesSchema);\nexport const HApiLogSchema = buildClientSchema(apiLogSchemaSpec);\nexport const HPackagePriceSchema = buildClientSchema(packagePriceSchema);\nexport const HubbyModelSchema = buildClientSchema(hubbyModelSpec);\nexport const HPartnerAppSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPlatformSettingsSchema = buildClientSchema(platformSettingsSchema);\nexport const HVisualIdentitySchema = buildClientSchema(visualIdentitySchema);\nexport const HPricingStrategySchema = buildClientSchema(pricingStrategySchema);\nexport const HFreeEsimSchema = buildClientSchema(freeEsimSchema);\nexport const HAnalyticsSchema = buildClientSchema(analyticsSpec);\nexport const HRoleSchema = buildClientSchema(roleSchemaSpec);\nexport const HPermissionSchema = buildClientSchema(permissionSchemaSpec);\nexport const HTagSchema = buildClientSchema(tagModelSpec);\nexport const HTrafficPolicySchema = buildClientSchema(trafficPolicySpec);\nexport const HTelnaPackageSchema = buildClientSchema(telnaPackageSchema);\nexport const HBondioPackageSchema = buildClientSchema(bondioPackageSchema);\n// Additional lower-level schemas\nexport const HAddressSchema = addressSchema;\nexport const HRegistrationSchema = registrationSchema;\nexport const HBankingDetailsSchema = bankingDetailsSchema;\nexport const HPartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const HPromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const HVisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const HScheduleFilterSchema = scheduleFilterSchema;\nexport const HPartnerContactSchema = partnerContactSchema;\nexport const HPartnerDataSchema = partnerDataSchema;\nexport const HCommunicationChannelSchema = communicationChannelSchema;\nexport const HBookingStatusSchema = bookingStatusSchema;\nexport const HCommunicationOptionsSchema = communicationOptionsSchema;\n\nexport type HAnalytics = z.infer;\nexport type HUser = z.infer;\nexport type HBooking = z.infer;\nexport type HCountry = z.infer;\nexport type HCurrency = z.infer;\nexport type HESIM = z.infer;\nexport type HPayment = z.infer;\nexport type HMessage = z.infer;\nexport type HPackage = z.infer;\nexport type HPromoCode = z.infer;\nexport type HPartner = z.infer;\nexport type HPriceList = z.infer;\nexport type HApiLog = z.infer;\nexport type HTag = z.infer;\nexport type HTrafficPolicy = z.infer;\nexport type HBondioPackage = z.infer;\nexport type HTelnaPackage = z.infer;\n// Additional lower-level types\nexport type HAddress = z.infer;\nexport type HRegistration = z.infer;\nexport type HBankingDetails = z.infer;\nexport type HPartnerPackageSpecification = z.infer;\nexport type HPromoPackageSpecification = z.infer;\nexport type HVisualIdentityBanner = z.infer;\nexport type HFinancialProperties = z.infer;\nexport type HScheduleFilter = z.infer;\nexport type HPartnerContact = z.infer;\nexport type HPartnerData = z.infer;\nexport type HCommunicationChannel = z.infer;\nexport type HBookingStatus = z.infer;\nexport type HCommunicationOptions = z.infer;\nexport type HHubbyModel = z.infer;\n\nexport type HubbyModelApp = HHubbyModel;\n\nexport type SupportedLocales = typeof SUPPORTED_LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\nexport type HRole = z.infer;\nexport type HPermission = z.infer; ","import { Firestore } from 'firebase-admin/firestore';\nimport {\n createConvertJSToFirestore,\n createConvertFirestoreToJS\n} from './firestoreTransformUtils';\nimport { FieldSpec } from '../types';\n\n/**\n * Creates converter functions for a specific model type with dependency injection.\n * This lets you use the conversion functions with your own Firebase instance.\n * \n * @param db - Firestore instance to use for document references\n * @param modelSchemaSpec - Schema specification for the model\n * @returns Object with to/from Firestore conversion functions\n */\nexport function createModelConverters(\n db: Firestore,\n modelSchemaSpec: FieldSpec\n) {\n const convertToFirestore = createConvertJSToFirestore(db);\n const convertFromFirestore = createConvertFirestoreToJS();\n\n return {\n /**\n * Converts a model instance to Firestore format\n */\n toFirestore: (model: TModel): TFirestore => {\n return convertToFirestore(model, modelSchemaSpec);\n },\n\n /**\n * Converts Firestore data to a model instance\n */\n fromFirestore: (firestoreData: TFirestore): TModel => {\n return convertFromFirestore(firestoreData, modelSchemaSpec);\n }\n };\n} ","import { buildServerSchema } from './builders/server';\nimport {\n userSchemaSpec,\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { analyticsSpec } from './specs/analytics';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { packageSchemaSpec, telnaPackageSchema, bondioPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n visualIdentityBannersSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n scheduleSchema,\n visualIdentitySchema,\n packagePriceSchemaSpec,\n platformSettingsSchemaSpec\n} from './specs/partner';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { DocumentReference, Timestamp } from 'firebase-admin/firestore';\n\n\nimport { convertFirestoreToJS, convertJSToFirestore } from './utils/firestoreTransformUtils';\nimport { HPartner, HPriceList, HPromoCode } from './index.client';\nimport { buildClientSchema } from './builders/client';\n\nexport { partnerSchemaSpec, analyticsSpec, packageSchemaSpec };\n\nexport const UserSchema = buildServerSchema(userSchemaSpec);\nexport const UserFirestoreSchema = buildServerSchema(userSchemaSpec);\nexport const BookingSchema = buildServerSchema(bookingSchemaSpec);\nexport const CountrySchema = buildServerSchema(countrySchemaSpec);\nexport const CurrencySchema = buildServerSchema(currencySchemaSpec);\nexport const ESIMSchema = buildServerSchema(esimSchemaSpec);\nexport const PaymentSchema = buildServerSchema(paymentSchemaSpec);\nexport const MessageSchema = buildServerSchema(messageSchemaSpec);\nexport const PackageSchema = buildServerSchema(packageSchemaSpec);\nexport const PromoCodeSchema = buildServerSchema(promoCodeSchemaSpec);\nexport const PartnerSchema = buildServerSchema(partnerSchemaSpec);\nexport const PriceListSchema = buildServerSchema(priceListSchemaSpec);\nexport const ApiLogSchema = buildServerSchema(apiLogSchemaSpec);\nexport const VisualIdentitySchema = buildServerSchema(visualIdentitySchema);\nexport const PackagePriceSchema = buildServerSchema(packagePriceSchemaSpec);\nexport const PlatformSettingsSchema = buildServerSchema(platformSettingsSchemaSpec);\nexport const ScheduleSchema = buildServerSchema(scheduleSchema);\nexport const AnalyticsSchema = buildServerSchema(analyticsSpec);\nexport const TagSchema = buildServerSchema(tagModelSpec);\nexport const TelnaPackageSchema = buildServerSchema(telnaPackageSchema);\nexport const BondioPackageSchema = buildServerSchema(bondioPackageSchema);\nexport const TrafficPolicySchema = buildServerSchema(trafficPolicySpec);\n\n// Additional lower-level schemas\nexport const AddressSchema = addressSchema;\nexport const RegistrationSchema = registrationSchema;\nexport const BankingDetailsSchema = bankingDetailsSchema;\nexport const PartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const PromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const VisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const ScheduleFilterSchema = scheduleFilterSchema;\nexport const PartnerContactSchema = partnerContactSchema;\nexport const PartnerDataSchema = partnerDataSchema;\nexport const CommunicationChannelSchema = communicationChannelSchema;\nexport const BookingStatusSchema = bookingStatusSchema;\nexport const CommunicationOptionsSchema = communicationOptionsSchema;\nexport const VisualIdentityBannersSchema = visualIdentityBannersSchema;\n\nexport type User = z.infer;\nexport type UserFirestore = z.infer;\nexport type Booking = z.infer;\nexport type Country = z.infer;\nexport type Currency = z.infer;\nexport type ESIM = z.infer;\nexport type Payment = z.infer;\nexport type Message = z.infer;\nexport type Package = z.infer;\nexport type PromoCode = z.infer;\nexport type Partner = z.infer;\nexport type PriceList = z.infer;\nexport type ApiLog = z.infer;\nexport type Analytics = z.infer;\nexport type Schedule = z.infer;\nexport type TelnaPackage = z.infer;\nexport type BondioPackage = z.infer;\nexport type TrafficPolicy = z.infer;\n\n// Additional lower-level types\nexport type Address = z.infer;\nexport type Registration = z.infer;\nexport type BankingDetails = z.infer;\nexport type PartnerPackageSpecification = z.infer;\nexport type PackageSpecification = z.infer;\nexport type VisualIdentity = z.infer;\nexport type VisualIdentityBanner = z.infer;\nexport type VisualIdentityBanners = z.infer;\nexport type VisualIdentityBannerStrategy = VisualIdentityBanners;\nexport type ScheduleFilter = z.infer;\nexport type PartnerContact = z.infer;\nexport type PartnerData = z.infer;\nexport type CommunicationChannel = z.infer;\nexport type BookingStatus = z.infer;\nexport type CommunicationOptions = z.infer;\nexport type PackagePrice = z.infer;\nexport type PlatformSettings = z.infer;\nexport type BookingApiRequest = Booking;\nexport type BookingApiResponse = Booking;\nexport type PartnerApiRequest = Partner;\nexport type PartnerApiResponse = Partner;\nexport type PriceListApiRequest = PriceList;\nexport type PriceListApiResponse = PriceList;\nexport type ApiLogApiRequest = ApiLog;\nexport type ApiLogApiResponse = ApiLog;\nexport type Tag = z.infer;\n\nexport * from './index.client';\n\nexport type HubbyModel = {\n id: string;\n created_at: Date;\n updated_at: Date | null;\n created_by: string;\n updated_by: string | null;\n}\n\nexport type HubbyModelFirestore = {\n id: string;\n created_at: Timestamp;\n updated_at: Timestamp | null;\n created_by: DocumentReference | null | string;\n updated_by: DocumentReference | null | string;\n}\n\nexport const partnerFromFirestore = (partner: Partner): HPartner => {\n return convertFirestoreToJS(partner, partnerSchemaSpec);\n}\n\nexport const partnerToFirestore = (partner: HPartner): Partner => {\n return convertJSToFirestore(partner, partnerSchemaSpec);\n}\n\nexport const userToFirestore = (user: User): UserFirestore => {\n return convertJSToFirestore(user, userSchemaSpec);\n}\n\nexport const userFromFirestore = (user: UserFirestore): User => {\n return convertFirestoreToJS(user, userSchemaSpec);\n}\n\nexport const priceListFromFirestore = (priceList: PriceList): HPriceList => {\n return convertFirestoreToJS(priceList, priceListSchemaSpec);\n}\n\nexport const priceListToFirestore = (priceList: HPriceList): PriceList => {\n return convertJSToFirestore(priceList, priceListSchemaSpec);\n}\n\nexport const promoCodeFromFirestore = (promoCode: PromoCode): HPromoCode => {\n return convertFirestoreToJS(promoCode, promoCodeSchemaSpec);\n}\n\nexport const promoCodeToFirestore = (promoCode: HPromoCode): PromoCode => {\n return convertJSToFirestore(promoCode, promoCodeSchemaSpec);\n}\n\nexport const partnerAppSchema = buildClientSchema(partnerSchemaSpec);\n// Export the type and constant\nexport type SupportedLocales = typeof LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\n// Dependency Injection exports\nexport { createModelConverters } from './utils/modelConverterFactory';\nexport { createConvertJSToFirestore, createConvertFirestoreToJS } from './utils/firestoreTransformUtils';\nexport { FirebaseService, createFirebaseService } from './services/firebase';"]} \ No newline at end of file +{"version":3,"sources":["../src/builders/server.ts","../src/common.ts","../src/services/firebase.ts","../src/specs/user.ts","../src/specs/common.ts","../src/specs/booking.ts","../src/constants.ts","../src/specs/promocode.ts","../src/specs/country.ts","../src/specs/currency.ts","../src/specs/esim.ts","../src/specs/payment.ts","../src/specs/analytics.ts","../src/specs/message.ts","../src/specs/traffic_policy.ts","../src/specs/package.ts","../src/specs/partner.ts","../src/specs/apiLogs.ts","../src/utils/firestoreTransformUtils.ts","../src/builders/client.ts","../src/specs/role.ts","../src/specs/permission.ts","../src/index.client.ts","../src/utils/modelConverterFactory.ts","../src/index.server.ts"],"names":["z","packageSpecificationSchema","Timestamp","convertJSToFirestore","convertFirestoreToJS","SUPPORTED_LOCALES"],"mappings":";AAAA,SAAS,KAAAA,UAAS;AAClB,SAAS,iBAAiB;;;ACD1B,SAAqB,SAAS;AAQvB,SAAS,cACZ,QACA,SAQU;AACV,MAAI,CAAC;AAAS,WAAO;AAErB,MAAI,UAAU;AAGd,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAEA,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAGA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAEhD,QAAI,CAAC,YAAY,UAAU,EAAE,SAAS,GAAG,KAAK,UAAU,QAAW;AAC/D;AAAA,IACJ;AAGA,QAAI,OAAQ,QAAgB,GAAG,MAAM,YAAY;AAC7C,gBAAW,QAAgB,GAAG,EAAE,KAAK;AAAA,IACzC;AAAA,EACJ;AAEA,SAAO;AACX;AAEO,SAAS,iBACZ,MACA,MACA,SACU;AACV,QAAM,aAAa,KAAK,KAAK,GAAG;AAEhC,MAAI,EAAE,QAAQ,OAAO;AACjB,UAAM,IAAI,MAAM,mBAAmB,UAAU,mBAAmB;AAAA,EACpE;AAEA,QAAM,QAAoC,CAAC;AAC3C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,EAAE,GAAG;AAChD,UAAM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nC,IAAM,8BAA8B;AAmEpC,IAAM,uBAAuB,CAAC,YAA+B;AAChE,SAAO,qBAAqB,SAAS,iBAAiB;AAC1D;AAEO,IAAM,qBAAqB,CAAC,YAA+B;AAC9D,SAAO,qBAAqB,SAAS,iBAAiB;AAC1D;AAEO,IAAM,kBAAkB,CAAC,SAA8B;AAC1D,SAAO,qBAAqB,MAAM,cAAc;AACpD;AAEO,IAAM,oBAAoB,CAAC,SAA8B;AAC5D,SAAO,qBAAqB,MAAM,cAAc;AACpD;AAEO,IAAM,yBAAyB,CAAC,cAAqC;AACxE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,uBAAuB,CAAC,cAAqC;AACtE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,yBAAyB,CAAC,cAAqC;AACxE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,uBAAuB,CAAC,cAAqC;AACtE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,mBAAmB,kBAAkB,iBAAiB;AAG5D,IAAMI,qBAAoB","sourcesContent":["import { z } from 'zod';\nimport { Timestamp } from 'firebase-admin/firestore';\nimport type { FieldSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\nimport { FirebaseService } from '../services/firebase';\n\nexport const buildServerSchema = (spec: FieldSpec, path: string[] = []): z.ZodTypeAny => {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod schema passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec);\n }\n\n // ----- Array -----\n if ('_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n\n const itemSchema =\n spec.of instanceof z.ZodType\n ? spec.of\n : buildServerSchema(spec.of, [...path, '[i]']);\n\n let arraySchema = z.array(itemSchema);\n if (spec.nullable) arraySchema = arraySchema.nullable();\n if (spec.optional) arraySchema = arraySchema.optional();\n return arraySchema;\n }\n\n // ----- Record -----\n if ('_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n\n const valueSchema =\n spec.of instanceof z.ZodType\n ? spec.of\n : buildServerSchema(spec.of, [...path, '[key]']);\n\n let recordSchema = z.record(valueSchema);\n if (spec.nullable) recordSchema = recordSchema.nullable();\n if (spec.optional) recordSchema = recordSchema.optional();\n return recordSchema;\n }\n\n // ----- Timestamp -----\n if ('_type' in spec && spec._type === 'timestamp') {\n let tsSchema = z.date().transform(date => Timestamp.fromDate(date));\n if (spec.nullable) tsSchema = tsSchema.nullable();\n if (spec.optional) tsSchema = tsSchema.optional();\n return tsSchema;\n }\n\n // ----- Document Reference -----\n if ('_type' in spec && spec._type === 'docRef') {\n let refSchema = z.string().transform(id => {\n const firestore = FirebaseService.getDefaultInstance().getFirestore()\n return firestore.collection(spec.collection).doc(id);\n });\n if (spec.nullable) refSchema = refSchema.nullable();\n if (spec.optional) refSchema = refSchema.optional();\n return refSchema;\n }\n\n // ----- Nested object shape -----\n if (typeof spec === 'object' && !('_type' in spec)) {\n const shape: Record = {};\n for (const [key, val] of Object.entries(spec)) {\n shape[key] = buildServerSchema(val, [...path, key]);\n }\n return z.object(shape);\n }\n\n // ----- Object -----\n if (\n typeof spec === 'object' &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildServerSchema);\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || typeof spec === 'object' && '_type' in spec && spec._type === 'object') {\n return wrapPlainObjectSchema(spec, path, buildServerSchema);\n }\n\n // ----- Unknown or malformed spec -----\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n};\n","import { ZodTypeAny, z } from 'zod';\nimport type { SchemaBuilder } from './types';\n\n/**\n * Ensures a Zod schema is wrapped to be optional and/or nullable,\n * if not already. Use this in recursive schema builders.\n * Also applies any other supported schema transformations provided in options.\n */\nexport function wrapZodSchema(\n schema: ZodTypeAny,\n options?: {\n optional?: boolean;\n nullable?: boolean;\n min?: number;\n max?: number;\n // Allow arbitrary extensions via dynamic property\n [key: string]: any;\n }\n): ZodTypeAny {\n if (!options) return schema;\n\n let wrapped = schema;\n\n // Handle nullable and optional specially since they're common\n if (options.nullable && !wrapped.isNullable?.()) {\n wrapped = wrapped.nullable();\n }\n\n if (options.optional && !wrapped.isOptional?.()) {\n wrapped = wrapped.optional();\n }\n\n // Process all other options dynamically\n for (const [key, value] of Object.entries(options)) {\n // Skip the already handled properties and undefined values\n if (['nullable', 'optional'].includes(key) || value === undefined) {\n continue;\n }\n\n // Check if the schema has a method matching the option key\n if (typeof (wrapped as any)[key] === 'function') {\n wrapped = (wrapped as any)[key](value);\n }\n }\n\n return wrapped;\n}\n\nexport function wrapObjectSchema(\n spec: any, // using any to support dynamic `spec.type === 'object'`\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n if (!('of' in spec)) {\n throw new Error(`Object spec at \"${pathString}\" is missing 'of'`);\n }\n\n const shape: Record = {};\n for (const [key, value] of Object.entries(spec.of)) {\n shape[key] = builder(value as any, [...path, key]);\n }\n\n let objectSchema: ZodTypeAny = z.object(shape);\n if (spec.nullable) objectSchema = objectSchema.nullable();\n if (spec.optional) objectSchema = objectSchema.optional();\n return objectSchema;\n}\n\n/**\n * Wraps a plain object shape (no `type: 'object'`) into a Zod schema.\n * Assumes each field is either a Zod schema or another FieldSpec.\n */\nexport function wrapPlainObjectSchema(\n spec: Record,\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n // Handle object field specs with '_type': 'object'\n if ('_type' in spec && spec._type === 'object' && 'of' in spec) {\n return wrapObjectSchema(spec, path, builder);\n }\n\n const shape: Record = {};\n\n // Only add fields to the schema if they're not special control properties\n for (const [key, val] of Object.entries(spec)) {\n if (key !== '_type' && key !== 'nullable' && key !== 'optional') {\n shape[key] = builder(val, [...path, key]);\n }\n }\n\n // Create the base object schema\n let schema: ZodTypeAny = z.object(shape);\n\n // Apply nullable/optional modifiers if needed\n if ('nullable' in spec && spec.nullable === true) {\n schema = schema.nullable();\n }\n\n if ('optional' in spec && spec.optional === true) {\n schema = schema.optional();\n }\n\n return schema;\n}\n\nexport const SCHEMA_MARKER = Symbol('ZodSchemaSpecMarker');\n\nexport function markAsSchemaSpec(spec: T): T {\n Object.defineProperty(spec, SCHEMA_MARKER, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return spec;\n}\n\nexport function isSchemaSpec(obj: unknown): obj is Record {\n return typeof obj === 'object' && obj !== null && SCHEMA_MARKER in obj;\n}","import { getApps, initializeApp, cert, AppOptions, App } from \"firebase-admin/app\";\nimport { getFirestore, Firestore } from \"firebase-admin/firestore\";\nimport { applicationDefault } from \"firebase-admin/app\";\n\nexport interface FirebaseConfig {\n credential?: AppOptions['credential'];\n projectId?: string;\n storageBucket?: string;\n databaseURL?: string;\n // Options for testing\n isTest?: boolean;\n}\n\n// Define variable to hold singleton instance (must be injected by consumer/tests)\nlet defaultInstance: FirebaseService | null = null;\n\nexport class FirebaseService {\n\n private firestoreInstance: Firestore;\n constructor(db: Firestore) {\n this.firestoreInstance = db;\n }\n\n getFirestore(): Firestore {\n return this.firestoreInstance;\n }\n\n // Get default instance with singleton pattern\n public static getDefaultInstance(): FirebaseService {\n if (defaultInstance === null) {\n throw new Error(\n \"FirebaseService default instance not set. Inject a FirebaseService via FirebaseService.setDefaultInstance(...) in your application startup or test setup.\"\n );\n }\n return defaultInstance;\n }\n\n // Allow for setting a custom default instance (useful for tests)\n public static setDefaultInstance(instance: FirebaseService): void {\n defaultInstance = instance;\n }\n}\n\n// Function to create a new Firebase service instance (use in tests or by consumers before injection)\nexport function createFirebaseService(db: Firestore): FirebaseService {\n return new FirebaseService(db);\n}","import { z } from 'zod';\nimport { PARTNER_COLLECTION, PROFILE_COLLECTION, timestampNullableOptional, timestampRequired, timestampNullable, ROLE_COLLECTION, PERMISSION_COLLECTION } from './common';\nimport { markAsSchemaSpec } from '../common'\n\nexport const apiKeySpec = {\n expires_at: { _type: 'timestamp' as const },\n secret: z.string(),\n is_active: z.boolean(),\n}\n\nexport const apiKeysSpec = {\n _type: 'record' as const,\n of: {\n _type: 'object' as const,\n of: apiKeySpec\n }\n}\n\nexport const apiKeysObjectSpec = {\n _type: 'object' as const,\n of: {\n allowed_keys: { _type: 'array' as const, nullable: true, optional: true, of: z.string() },\n keys: apiKeysSpec\n },\n nullable: true,\n optional: true\n}\n\nexport const userSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string().nullable(),\n email: z.string().email().nullable(),\n stripe_id: z.string().nullable().optional(),\n referral: z.string().nullable().optional(),\n fcm: z.string().optional(),\n deeplink: z.string().nullable().optional(),\n gender: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n coordinates: z.string().nullable().optional(),\n parameters: z.any().nullable().optional(),\n locale: z.string().nullable().optional(),\n phone_model: z.string().nullable().optional(),\n phone_os: z.string().nullable().optional(),\n phone_os_version: z.string().nullable().optional(),\n ios: z.boolean().nullable().optional(),\n has_card_saved: z.boolean().nullable().optional(),\n admin: z.boolean().nullable().optional(),\n api_keys: apiKeysObjectSpec,\n currency: z.string().nullable().optional(),\n receipt_email: z.string().nullable().optional(),\n source: z.enum(['direct', 'promo', 'platform']).nullable().optional(),\n role: { _type: 'docRef' as const, collection: ROLE_COLLECTION, optional: true, nullable: true },\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n balance: z.number().nullable().optional(),\n createdAt: { _type: 'timestamp' as const },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, optional: true, nullable: true },\n profileRef: { _type: 'docRef' as const, collection: PROFILE_COLLECTION, optional: true, nullable: true },\n review_requested: timestampNullableOptional,\n last_seen: timestampNullableOptional\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\n\n// Collection paths\nexport const PARTNER_COLLECTION = '/companies/hubby/partners';\nexport const USER_COLLECTION = 'users';\nexport const PROFILE_COLLECTION = '/companies/hubby/profiles';\nexport const PACKAGE_COLLECTION = '/companies/hubby/packages';\nexport const PROMO_CODE_COLLECTION = '/companies/hubby/promo_codes';\nexport const COUNTRY_COLLECTION = 'countries';\nexport const ESIM_COLLECTION = 'esims';\nexport const PAYMENT_COLLECTION = 'payments';\nexport const PRICE_LIST_COLLECTION = 'price_lists';\nexport const BOOKING_COLLECTION = 'bookings';\nexport const MESSAGE_COLLECTION = 'messages';\nexport const CURRENCY_COLLECTION = 'currencies';\nexport const API_LOG_COLLECTION = 'api_logs'\nexport const ROLE_COLLECTION = 'roles';\nexport const PERMISSION_COLLECTION = 'permissions';\nexport const TRAFFIC_POLICY_COLLECTION = 'traffic_policies';\n\n// Timestamp specs\nexport const timestampNullableOptional = { _type: 'timestamp' as const, nullable: true, optional: true };\nexport const timestampNullable = { _type: 'timestamp' as const, nullable: true, optional: false };\nexport const timestampRequired = { _type: 'timestamp' as const, nullable: false, optional: false };\n\nexport const hubbyModelSpec = {\n id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n created_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n updated_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n}\n\nexport const tagModelSpec = {\n ...hubbyModelSpec,\n slug: z.string(),\n name: z.string(),\n description: z.string().nullable().optional(),\n color: z.string().nullable().optional(),\n}","import { z } from 'zod';\nimport {\n PARTNER_COLLECTION,\n PROMO_CODE_COLLECTION,\n USER_COLLECTION,\n ESIM_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema } from '../constants';\nimport { packageSpecificationSchema } from './promocode';\n\n// Enum for communication channels\nexport const communicationChannelSchema = z.enum([\n 'EMAIL',\n 'WHATSAPP',\n 'PUSH_NOTIFICATION',\n 'SMS'\n]);\nexport type CommunicationChannelType = z.infer;\n\n// For backward compatibility\nexport type CommunicationChannel = CommunicationChannelType;\n\n// Add enum-like object for use in code\nexport const CommunicationChannel = {\n EMAIL: 'EMAIL' as const,\n WHATSAPP: 'WHATSAPP' as const,\n PUSH_NOTIFICATION: 'PUSH_NOTIFICATION' as const,\n SMS: 'SMS' as const\n} as const;\n\n// Status type for bookings\nexport const bookingStatusSchema = z.enum([\n 'PENDING',\n 'CONFIRMED',\n 'COMPLETED',\n 'CANCELLED',\n 'UNPAID',\n 'EXPIRED'\n]);\nexport type BookingStatus = z.infer;\n\n// Communication options schema\nexport const communicationOptionsSchema = z.object({\n should_send_message: z.boolean(),\n channels: z.array(communicationChannelSchema)\n});\n\nexport type CommunicationOptions = z.infer;\n\n// Define the booking schema spec\nexport const bookingSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n external_id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n title: z.string().nullable(),\n first_name: z.string().nullable().optional(),\n last_name: z.string().nullable().optional(),\n full_name: z.string().nullable().optional(),\n pax: z.number(),\n email: z.string().email().nullable(),\n phone: z.string().nullable(),\n booking_id: z.string().nullable(),\n flight_number: z.string().optional(),\n gender: z.enum(['M', 'F', 'O']).optional(),\n package_size: z.string().optional(),\n sent_messages: z.record(z.any()).optional(),\n locale: supportedLocalesSchema,\n status: bookingStatusSchema,\n data: {\n _type: 'object' as const,\n of: {\n source: z.string(),\n manual: z.boolean()\n }\n },\n communication_options: {\n _type: 'object' as const,\n of: {\n should_send_message: z.boolean(),\n channels: {\n _type: 'array' as const,\n of: communicationChannelSchema\n }\n }\n },\n is_processed_for_esim_restoration: z.boolean(),\n is_pseudonymized: z.boolean(),\n import_id: z.string().nullable().optional(),\n package_specifications: z.array(packageSpecificationSchema).min(1),\n departure_date: timestampRequired,\n return_date: timestampNullable,\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION },\n promo_codes: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: PROMO_CODE_COLLECTION }\n },\n users: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: USER_COLLECTION },\n nullable: true\n },\n esims: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: ESIM_COLLECTION },\n nullable: true\n }\n});\n\n","import { z } from \"zod\";\n\nexport const SUPPORTED_LOCALES = [\n \"en-US\",\n \"en-EU\",\n \"en-GB\",\n \"en-CA\",\n \"nl-NL\",\n \"de-DE\",\n \"fr-FR\",\n \"it-IT\",\n \"es-ES\",\n \"cs-CZ\",\n \"pl-PL\",\n \"pt-PT\",\n \"fr-BE\",\n \"nl-BE\",\n \"de-AT\",\n \"de-CH\",\n \"fr-CH\",\n \"it-CH\",\n \"sv-SE\",\n \"sk-SK\",\n \"de-BE\",\n \"en-AU\",\n \"da-DK\",\n] as const;\n\n// Define the type using TypeScript's typeof and indexing\n\n// Define the type using TypeScript's typeof and indexing\nexport type SupportedLocales = (typeof SUPPORTED_LOCALES)[number];\n\n// Create a Zod schema for validation\nexport const supportedLocalesSchema = z.enum(SUPPORTED_LOCALES);\n\n// Type inference from the schema (alternative way to define the type)\nexport type SupportedLocalesFromSchema = z.infer;\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n PARTNER_COLLECTION,\n COUNTRY_COLLECTION,\n PACKAGE_COLLECTION,\n BOOKING_COLLECTION,\n PROMO_CODE_COLLECTION,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// Define package specification schema for use in promo code\nexport const packageSpecificationSchema = z.object({\n destination: z.string().optional(),\n size: z.string().optional(),\n package_id: z.string().optional(),\n iata_code: z.string().optional(),\n package_duration: z.number().optional(),\n package_type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).optional(),\n traffic_policy: z.string().optional(),\n});\n\n// Define the promo code schema spec\nexport const promoCodeSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n redeemed_at: timestampNullableOptional,\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // PromoCode specific fields\n external_id: z.string(),\n code: z.string(),\n allowance_user: z.number(),\n allowance_total: z.number(),\n type: z.enum(['discount', 'booking', 'booking_without_destination']).nullable().or(z.string()),\n usage: z.array(z.string()),\n uuid_usage: z.array(z.string()),\n package_specification: packageSpecificationSchema.optional(),\n valid_from: timestampRequired,\n valid_to: timestampRequired,\n\n // Reference fields\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION, nullable: true },\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n booking: { _type: 'docRef' as const, collection: BOOKING_COLLECTION, nullable: true },\n\n // Optional fields based on the type\n discount: z.number().optional(),\n package_size: z.string().optional(),\n countries: z.array(z.string()).optional(),\n max_bytes: z.number().optional(),\n starter_data: z.number().optional()\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const countrySchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n bokun_id: z.number().nullable(),\n LTE: z.boolean().nullable(),\n apn: z.string().nullable(),\n click_count: z.number().nullable(),\n global_network: z.string().nullable(),\n global_price: z.number().nullable(),\n hubby: z.number().nullable(),\n imsi: z.number().nullable(),\n has_esim: z.boolean(),\n name: z.string().nullable(),\n region: z.boolean().nullable(),\n i18n_name: z.record(z.string()),\n is_region: z.boolean().nullable(),\n countries: z.array(z.string()).nullable(),\n tier: z.number().nullable()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define schema for conversion rates (for backward compatibility)\nexport const conversionRateSchema = z.object({\n currency: z.number()\n});\n\nexport type CoversionRate = z.infer;\n\n// Define the currency schema spec\nexport const currencySchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n // ISO 4217 currency code (e.g., \"USD\", \"EUR\")\n code: z.string().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n // Currency symbol (e.g., \"$\", \"€\")\n symbol: z.string().describe('Currency symbol (e.g., \"$\", \"€\")'),\n // Full name of the currency (e.g., \"US Dollar\")\n name: z.string().describe('Full name of the currency (e.g., \"US Dollar\")'),\n // Exchange rate relative to base currency\n rate: z.number().describe('Exchange rate relative to base currency'),\n // Whether this is the default currency\n is_default: z.boolean().describe('Whether this is the default currency')\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n USER_COLLECTION,\n PARTNER_COLLECTION,\n PAYMENT_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\n\n// Define the eSIM schema spec\nexport const esimSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Common eSIM fields\n imsi: z.number(),\n qr: z.string(),\n iccid: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable().optional(),\n total_data: z.number(),\n data_left: z.number(),\n data_used: z.boolean(),\n status: z.string().nullable(),\n name: z.string(),\n android_auto: z.boolean(),\n partner_price: z.number().nullable(),\n promo: z.string().nullable(),\n type: z.enum(['api', 'promo', 'balance', 'code', 'external', 'payment']),\n is_auto_install: z.boolean(),\n is_archived: z.boolean(),\n user: z.string().nullable(),\n payment: z.string().nullable(),\n apn: z.string().nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Timestamp fields\n time_assigned: timestampNullable,\n last_updated: timestampNullable\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n USER_COLLECTION,\n timestampRequired\n} from './common';\n\n// Define the payment schema spec\nexport const paymentSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Payment specific fields\n amount: z.number(),\n customer: z.string(),\n date: timestampRequired,\n iccid: z.string(),\n package: z.string(),\n promo: z.string(),\n topup: z.boolean(),\n\n // Reference fields\n user: { _type: 'docRef' as const, collection: USER_COLLECTION, nullable: true, optional: true }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec, PARTNER_COLLECTION } from './common';\n\n// Country schema spec\nexport const analyticsSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n service: z.string(),\n date: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/), // YYYY-MM-DD\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n event: z.string(),\n parameter: z.string().nullable(),\n sum: z.number(),\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define the message schema spec\nexport const messageSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n key: z.string(),\n method: z.enum([\"push\", \"sms\", \"email\"]),\n status: z.enum([\"pending\", \"sent\", \"failed\", \"delivered\"]),\n created_at: timestampRequired,\n updated_at: timestampRequired\n});\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const trafficPolicySpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n name: z.string(),\n description: z.string(),\n external_id: z.string(),\n provider: z.string()\n})","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n PARTNER_COLLECTION,\n TRAFFIC_POLICY_COLLECTION,\n timestampRequired,\n hubbyModelSpec\n} from './common';\n\nimport { countrySchemaSpec } from './country';\n\n// Define the package schema spec\nexport const packageSchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n // Package specific fields\n external_id: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable(),\n label: z.string(),\n bytes: z.number(),\n hidden: z.boolean(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n price: z.number(),\n partner_price: z.number(),\n days: z.number(),\n name: z.string(),\n type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).nullable(),\n throttling: z.number().optional(),\n provider_parameters: z.object({\n imsi: z.number()\n }).nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Nested country data - need to use dynamic reference to country schema\n // This would typically be handled better with a proper recursive schema definition\n // but for simplicity, we're using any type here\n country_data: {\n _type: 'object' as const,\n of: countrySchemaSpec,\n nullable: true,\n optional: true\n }\n // country_data: z.any().nullable()\n});\n\nexport const commonPackageSchema = markAsSchemaSpec({\n size: z.string(),\n iso: z.string(),\n days: z.number(),\n price: z.number(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n packageType: z.string(),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n});\n\nexport const telnaPackageSchema = markAsSchemaSpec({\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n ...commonPackageSchema,\n});\n\nexport const bondioPackageSchema = markAsSchemaSpec({\n ...commonPackageSchema,\n label: z.enum(['lambda', 'tau']),\n});","import { z, ZodLazy } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema, SUPPORTED_LOCALES, SupportedLocales } from '../constants';\nimport {\n PARTNER_COLLECTION,\n USER_COLLECTION,\n PACKAGE_COLLECTION,\n PRICE_LIST_COLLECTION,\n tagModelSpec,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// ===== Helper schemas for nested structures =====\n\n// Address schema\nexport const addressSchema = z.object({\n street: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n postal_code: z.string().nullable().optional(),\n country: z.string().nullable().optional()\n});\n\n// Emit event schema\nexport const emitEventSchema = z.object({\n topup: z.boolean().optional().default(false),\n redemption: z.boolean().optional().default(false),\n activation: z.boolean().optional().default(false),\n depletion: z.boolean().optional().default(false),\n});\n\n// Registration schema\nexport const registrationSchema = z.object({\n chamber_of_commerce_number: z.string().nullable().optional(),\n vat_number: z.string().nullable().optional(),\n anvr_number: z.number().nullable().optional(),\n tax_number: z.string().nullable().optional()\n});\n\n// Banking details schema\nexport const bankingDetailsSchema = z.object({\n account_holder: z.string().nullable().optional(),\n bank_name: z.string().nullable().optional(),\n iban: z.string().nullable().optional(),\n currency: z.string().nullable().optional()\n});\n\n// Package price schema\nexport const packagePriceSchema = z.object({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: z.object({ _type: z.literal('docRef'), collection: z.literal(PACKAGE_COLLECTION) })\n});\n\n// Package specification schema\nexport const packageSpecificationSchema = z.object({\n size: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n destination: z.string().nullable().optional()\n});\n\n// Pricing strategy schema\nexport const pricingStrategySchema = z.object({\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: z.object({\n _type: z.literal('docRef'),\n collection: z.literal(PRICE_LIST_COLLECTION),\n nullable: z.literal(true)\n }),\n custom_prices: z.array(packagePriceSchema)\n});\n\n// Visual identity banner schema\nexport const visualIdentityBannerSchema = z.object({\n image_url: z.string(),\n alt: z.string(),\n click_url: z.string(),\n locale: supportedLocalesSchema,\n properties: z.record(z.string())\n});\n\n// Schedule filter schema\nexport const scheduleFilterSchema = z.object({\n type: z.enum(['iso3', 'gender', 'percentage', 'age']),\n value: z.union([z.string(), z.number()]),\n comparison: z.enum([\n 'equal',\n 'not_equal',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal'\n ])\n});\n\n// Convert object-like schemas to proper Zod objects\nexport const visualIdentityBannersSchema = z.object({\n strategy: z.enum(['fixed', 'rotating', 'destination', 'time_of_day']),\n banners: z.array(visualIdentityBannerSchema).nullable().optional()\n});\n\nexport const visualIdentitySchema = z.object({\n primary_color: z.string(),\n secondary_color: z.string(),\n logo: z.string(),\n font: z.string().nullable().optional(),\n top_banner: visualIdentityBannersSchema.optional(),\n mid_banner: visualIdentityBannersSchema.optional()\n});\n\n// Partner contact schema\nexport const partnerContactSchema = z.object({\n name: z.string().nullable().optional(),\n email: z.string().nullable(),\n office_phone: z.string().nullable().optional()\n});\n\n// Partner data schema\nexport const partnerDataSchema = z.object({\n source: z.string(),\n manual: z.boolean()\n});\n\n// Package strategy schema\nexport const packageStrategySchema = z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any()\n});\n\n// Schedule email schema\nexport const scheduleEmailSchema = z.object({\n brevo_template_id: z.number(),\n subject: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional(),\n preview_text: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional()\n}).nullable().optional();\n\n// Schedule push schema\nexport const schedulePushSchema = z.object({\n title: z.record(z.string()).optional(),\n body: z.record(z.string()).optional(),\n target: z.string()\n}).nullable().optional();\n\n// Schedule schema\nexport const scheduleSchema = z.object({\n days: z.number(),\n email: scheduleEmailSchema,\n push: schedulePushSchema,\n hour: z.number(),\n key: z.string(),\n method: z.enum(['email', 'sms', 'whatsapp', 'push']),\n moment: z.enum(['departure_date', 'return_date', 'immediate']),\n filter: scheduleFilterSchema.nullable().optional()\n});\n\nexport const freeEsimSchema = z.object({\n enabled: z.boolean(),\n package_specification: z.object({\n size: z.string(),\n package_type: z.string(),\n destination: z.string(),\n package_duration: z.number()\n }),\n booking_id_verification: z.boolean().default(false),\n booking_id_verification_pattern: z.string().nullable().optional(),\n allowance: z.number(),\n total_allowance: z.number(),\n});\n\n// Platform settings schema\nexport const platformSettingsSchema = z.object({\n package_strategy: z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any(),\n supported_package_types: z.enum(['data-limited', 'unlimited']).optional()\n }).nullable().optional(),\n free_esim: freeEsimSchema.nullable().optional(),\n booking_defaults: z.object({\n locale: supportedLocalesSchema\n }).nullable().optional(),\n booking_confirmation: z.object({\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n }).nullable().optional(),\n emit_events: emitEventSchema.nullable().optional(),\n schedules: z.array(scheduleSchema).optional(),\n visual_identity_options: z.object({\n hubby_branding: z.boolean().optional().default(true),\n source_partner_branding: z.boolean().optional().default(false),\n own_branding: z.boolean().optional().default(false)\n }).nullable().optional()\n});\n\n// ===== Exportable schema specs =====\n\n// Package price schema spec\nexport const packagePriceSchemaSpec = markAsSchemaSpec({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n});\n\n// Financial properties schema spec\nexport const financialPropertiesSchemaSpec = markAsSchemaSpec({\n administration_fee: z.number().nullable(),\n income_per_gb: z.number().nullable(),\n commission_fee: z.number().nullable().optional(),\n payment_method: z.enum(['invoice', 'direct']),\n requires_card: z.boolean().nullable(),\n next_invoice: timestampNullableOptional,\n last_invoice: timestampNullableOptional,\n pricing_strategies: {\n _type: 'object' as const,\n of: {\n partner: {\n _type: 'object' as const,\n of: {\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n },\n user: {\n _type: 'object' as const,\n of: {\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n }\n },\n nullable: true\n }\n});\n\n// Platform settings schema spec\nexport const platformSettingsSchemaSpec = markAsSchemaSpec({\n package_strategy: {\n _type: 'object' as const,\n of: packageStrategySchema.shape,\n nullable: true,\n optional: true\n },\n free_esim: {\n _type: 'object' as const,\n of: freeEsimSchema.shape,\n nullable: true,\n optional: true\n },\n booking_defaults: {\n _type: 'object' as const,\n of: {\n locale: supportedLocalesSchema\n },\n nullable: true,\n optional: true\n },\n booking_confirmation: {\n _type: 'object' as const,\n of: {\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n },\n nullable: true,\n optional: true\n },\n schedules: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: scheduleSchema.shape\n },\n optional: true\n }\n});\n\n// Webhook settings schema\nexport const webhookSettingsSchema = z.object({\n url: z.string().url().nullable().optional(),\n api_key: z.string().nullable().optional(),\n enabled: z.boolean().default(false),\n events: z.object({\n promocode_redemption: z.boolean().default(false)\n }).default({})\n});\n\n// ===== Main partner schema =====\nexport const partnerSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Partner specific fields\n name: z.string().min(3),\n type: z.string().nullable(),\n is_active: z.boolean().nullable().optional(),\n external_id: z.string().nullable().optional(),\n\n // Complex nested objects\n contact: {\n _type: 'object' as const,\n of: partnerContactSchema.shape,\n nullable: true\n },\n address: {\n _type: 'object' as const,\n of: addressSchema.shape,\n nullable: true\n },\n registration: {\n _type: 'object' as const,\n of: registrationSchema.shape,\n nullable: true\n },\n banking_details: {\n _type: 'object' as const,\n of: bankingDetailsSchema.shape,\n nullable: true\n },\n\n // Reference fields\n parent: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n users: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: USER_COLLECTION }, nullable: true },\n\n // Complex nested structures\n financial_properties: financialPropertiesSchemaSpec,\n // Visual identity\n visual_identity: {\n _type: 'object' as const,\n of: visualIdentitySchema.shape,\n nullable: true\n },\n\n // Platform settings\n platform_settings: {\n _type: 'object' as const,\n of: platformSettingsSchema.shape,\n nullable: true\n },\n\n // Tags\n tags: {\n _type: 'array' as const,\n of: tagModelSpec,\n nullable: true,\n optional: true\n },\n\n // Metadata\n data: {\n _type: 'object' as const,\n of: partnerDataSchema.shape,\n nullable: true,\n optional: true\n },\n\n // Webhook settings\n webhook_settings: {\n _type: 'object' as const,\n of: webhookSettingsSchema.shape,\n nullable: true,\n optional: true\n }\n});\n\n// ===== Price list schema =====\nexport const priceListSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Price list specific fields\n name: z.string().min(3),\n description: z.string().nullable(),\n type: z.enum(['partner', 'consumer']),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n});\n","import { z } from 'zod';\nimport { timestampRequired } from './common';\nimport { markAsSchemaSpec } from '../common';\n\nexport const payloadSpec = {\n _type: 'record' as const,\n of: z.unknown(),\n optional: true\n};\n\nexport const apiLogSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n method: z.string(),\n user_id: z.string().optional(),\n path: z.string(),\n resource_type: z.string().optional(),\n resource_id: z.string().optional(),\n partner_id: z.string().optional(),\n payload: payloadSpec,\n timestamp: timestampRequired,\n status_code: z.number()\n});\n","// firestoreTransformUtils.ts\n\nimport { z } from 'zod';\nimport { DocumentReference, Timestamp, Firestore } from 'firebase-admin/firestore';\nimport { FieldSpec } from '../types';\nimport { FirebaseService } from '../services/firebase';\n// Note: Firestore instance must be injected by consumers/tests via factory\n\nexport function createConvertJSToFirestore(db: Firestore) {\n return function convertJSToFirestore(input: any, spec: FieldSpec): any {\n // Handle null/undefined at the top level\n if (input === undefined || input === null) return null;\n\n if (spec instanceof z.ZodType) {\n if (input instanceof Date) return Timestamp.fromDate(input);\n return input; // already valid\n }\n\n if ('_type' in spec) {\n switch (spec._type) {\n case 'timestamp':\n if (input instanceof Date) {\n return Timestamp.fromDate(input);\n } else if (typeof input === 'string' || typeof input === 'number') {\n return Timestamp.fromDate(new Date(input));\n }\n return input;\n case 'docRef':\n return db.collection(spec.collection).doc(input);\n case 'array':\n return input.map((item: any) => convertJSToFirestore(item, spec.of));\n case 'record':\n // For records, filter out undefined values\n return Object.fromEntries(\n Object.entries(input)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [k, convertJSToFirestore(v, spec.of)])\n );\n case 'object':\n if ('of' in spec && typeof spec.of === 'object') {\n const result: any = {};\n for (const [key, fieldSpec] of Object.entries(spec.of)) {\n // Check if the field exists in the input\n if (key in input) {\n const value = input[key];\n\n // Handle based on field optionality and nullability\n if (value === undefined) {\n // Check if field is optional by looking at its spec\n const isOptional = typeof fieldSpec === 'object' && '_type' in fieldSpec && fieldSpec._type === 'optional';\n if (!isOptional) {\n // If not optional but nullable, convert to null\n result[key] = null;\n }\n // If optional, just skip it (don't add to result)\n } else {\n // Normal case - value exists and is not undefined\n result[key] = convertJSToFirestore(value, fieldSpec);\n }\n }\n }\n return result;\n }\n return input;\n default:\n throw new Error(`Unknown field type: ${spec._type}`);\n }\n }\n\n // fallback: plain object shape with explicit schema\n if (typeof input === 'object' && !Array.isArray(input) && typeof spec === 'object') {\n const result: any = {};\n\n for (const [key, fieldSpec] of Object.entries(spec)) {\n if (key in input) {\n const value = input[key];\n\n // Handle undefined values\n if (value === undefined) {\n // Check if field is optional\n const isOptional = typeof fieldSpec === 'object' && '_type' in fieldSpec && fieldSpec._type === 'optional';\n if (!isOptional) {\n // If not optional but nullable, convert to null\n result[key] = null;\n }\n // If optional, don't include in the result\n } else {\n // Normal case - value exists\n result[key] = convertJSToFirestore(value, fieldSpec);\n }\n }\n }\n\n return result;\n }\n\n return input;\n };\n}\n\nfunction isDuckTimestamp(obj: any): obj is { toDate: () => Date } {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.toDate === 'function' &&\n Object.prototype.toString.call(obj.toDate()) === '[object Date]'\n );\n}\n\nfunction isDuckDocumentRef(obj: any): obj is { id: string } {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.id === 'string' &&\n typeof obj.path === 'string'\n );\n}\n\nexport function createConvertFirestoreToJS() {\n return function convertFirestoreToJS(input: any, spec: FieldSpec, path: string[] = []): any {\n const pathString = path.join('.') || '';\n\n // ✅ Convert Firestore-native or duck-typed Timestamp\n if (input instanceof Timestamp || isDuckTimestamp(input)) {\n return input.toDate();\n }\n\n // ✅ Convert Firestore-native or duck-typed DocumentReference\n if (input instanceof DocumentReference || isDuckDocumentRef(input)) {\n return input.id;\n }\n\n if (input === null || input === undefined) return input;\n if (!spec) return input;\n\n if (spec instanceof z.ZodType) {\n // 🔁 Keep in place if it's already a native value\n return input;\n }\n\n if ('_type' in spec) {\n switch (spec._type) {\n case 'timestamp':\n return (input instanceof Timestamp || isDuckTimestamp(input)) ? input.toDate() : input;\n\n case 'docRef':\n return (input instanceof DocumentReference || isDuckDocumentRef(input)) ? input.id : input;\n\n case 'array':\n return Array.isArray(input)\n ? input.map((item, i) => convertFirestoreToJS(item, spec.of, [...path, `[${i}]`]))\n : input;\n\n case 'record':\n if (typeof input !== 'object' || input === null) return input;\n return Object.fromEntries(\n Object.entries(input)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [\n k,\n convertFirestoreToJS(v, spec.of, [...path, k]),\n ])\n );\n\n case 'object':\n if (!spec.of || typeof spec.of !== 'object') return input;\n const result: Record = {};\n for (const [key, fieldSpec] of Object.entries(spec.of)) {\n // Only include properties that exist in the input and aren't undefined\n if (key in input && input[key] !== undefined) {\n result[key] = convertFirestoreToJS(input[key], fieldSpec, [...path, key]);\n }\n }\n return result;\n }\n }\n\n if (typeof spec === 'object' && typeof input === 'object' && !Array.isArray(input)) {\n const result: Record = {};\n for (const [key, valSpec] of Object.entries(spec)) {\n // Only include properties that exist in the input and aren't undefined\n if (key in input && input[key] !== undefined) {\n result[key] = convertFirestoreToJS(input[key], valSpec, [...path, key]);\n }\n }\n return result;\n }\n\n return input;\n };\n}\n\n// For backward compatibility, export the default functions\nexport const convertFirestoreToJS = createConvertFirestoreToJS();\n\n// Backward-compatible helper that lazily uses injected default Firestore instance\nexport function convertJSToFirestore(input: any, spec: FieldSpec): any {\n const firestore = FirebaseService.getDefaultInstance().getFirestore();\n return createConvertJSToFirestore(firestore)(input, spec);\n}\n","import { z, ZodTypeAny } from 'zod';\nimport type { FieldSpec, SchemaFromSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\n\nexport function buildClientSchema(spec: S, path: string[] = []): SchemaFromSpec {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid schema spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec) as unknown as SchemaFromSpec;\n }\n\n // Check if object might be a Zod schema (has _def property or ~standard metadata)\n if (typeof spec === 'object' && spec !== null &&\n (('_def' in spec) || ('~standard' in spec && (spec as any)['~standard']?.vendor === 'zod'))) {\n try {\n // Try to use it as a Zod schema directly\n return wrapZodSchema(spec as unknown as z.ZodTypeAny) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this fails, we'll continue with the other checks\n console.warn(`Failed to use object as Zod schema at \"${pathString}\":`, error);\n }\n }\n\n // ----- Array -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.array(buildClientSchema(spec.of, [...path, '[i]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Record -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.record(buildClientSchema(spec.of, [...path, '[key]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Timestamp -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'timestamp') {\n let schema: ZodTypeAny = z.preprocess((val) => {\n if (typeof val === 'string') {\n // Try to parse the string to a Date object\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date; // undefined will cause z.date() to fail\n }\n if (typeof val === 'number') {\n // Handle numeric timestamps\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date;\n }\n // If it's already a Date or something else, return it as is\n return val;\n }, z.date({ required_error: 'Date is required', invalid_type_error: 'Invalid date format' }));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- DocRef -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'docRef') {\n let schema: ZodTypeAny = z.string(); // only ID on client\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Object (plain nested object spec) -----\n if (\n typeof spec === 'object' &&\n spec !== null &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || (typeof spec === 'object' && spec !== null && '_type' in spec && (spec as any)._type === 'object')) {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // If we have an object with fields that look like schema specs, try to handle it as a schema object\n if (typeof spec === 'object' && spec !== null) {\n try {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this also fails, we'll throw the error below\n console.warn(`Failed to handle object as plain schema at \"${pathString}\":`, error);\n }\n }\n\n // 🔥 If we got here, the spec had a structure we didn't handle\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n}\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional, PERMISSION_COLLECTION } from './common';\n\nexport const roleSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional } from './common';\n\nexport const permissionSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { buildClientSchema } from './builders/client';\nimport {\n userSchemaSpec,\n apiKeySpec,\n apiKeysSpec,\n apiKeysObjectSpec\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { bondioPackageSchema, packageSchemaSpec, telnaPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n financialPropertiesSchemaSpec as financialPropertiesSchema,\n packagePriceSchema,\n platformSettingsSchema,\n visualIdentitySchema,\n pricingStrategySchema,\n freeEsimSchema,\n} from './specs/partner';\nimport { analyticsSpec } from './specs/analytics';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { roleSchemaSpec } from './specs/role';\nimport { permissionSchemaSpec } from './specs/permission';\n\nexport const HUserSchema = buildClientSchema(userSchemaSpec);\nexport const HBookingSchema = buildClientSchema(bookingSchemaSpec);\nexport const HCountrySchema = buildClientSchema(countrySchemaSpec);\nexport const HCurrencySchema = buildClientSchema(currencySchemaSpec);\nexport const HESIMSchema = buildClientSchema(esimSchemaSpec);\nexport const HPaymentSchema = buildClientSchema(paymentSchemaSpec);\nexport const HMessageSchema = buildClientSchema(messageSchemaSpec);\nexport const HPackageSchema = buildClientSchema(packageSchemaSpec);\nexport const HPromoCodeSchema = buildClientSchema(promoCodeSchemaSpec);\nexport const HPartnerSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPriceListSchema = buildClientSchema(priceListSchemaSpec);\nexport const HFinancialPropertiesSchema = buildClientSchema(financialPropertiesSchema);\nexport const HApiLogSchema = buildClientSchema(apiLogSchemaSpec);\nexport const HPackagePriceSchema = buildClientSchema(packagePriceSchema);\nexport const HubbyModelSchema = buildClientSchema(hubbyModelSpec);\nexport const HPartnerAppSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPlatformSettingsSchema = buildClientSchema(platformSettingsSchema);\nexport const HVisualIdentitySchema = buildClientSchema(visualIdentitySchema);\nexport const HPricingStrategySchema = buildClientSchema(pricingStrategySchema);\nexport const HFreeEsimSchema = buildClientSchema(freeEsimSchema);\nexport const HAnalyticsSchema = buildClientSchema(analyticsSpec);\nexport const HRoleSchema = buildClientSchema(roleSchemaSpec);\nexport const HPermissionSchema = buildClientSchema(permissionSchemaSpec);\nexport const HTagSchema = buildClientSchema(tagModelSpec);\nexport const HTrafficPolicySchema = buildClientSchema(trafficPolicySpec);\nexport const HTelnaPackageSchema = buildClientSchema(telnaPackageSchema);\nexport const HBondioPackageSchema = buildClientSchema(bondioPackageSchema);\n// Additional lower-level schemas\nexport const HAddressSchema = addressSchema;\nexport const HRegistrationSchema = registrationSchema;\nexport const HBankingDetailsSchema = bankingDetailsSchema;\nexport const HPartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const HPromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const HVisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const HScheduleFilterSchema = scheduleFilterSchema;\nexport const HPartnerContactSchema = partnerContactSchema;\nexport const HPartnerDataSchema = partnerDataSchema;\nexport const HCommunicationChannelSchema = communicationChannelSchema;\nexport const HBookingStatusSchema = bookingStatusSchema;\nexport const HCommunicationOptionsSchema = communicationOptionsSchema;\n\nexport type HAnalytics = z.infer;\nexport type HUser = z.infer;\nexport type HBooking = z.infer;\nexport type HCountry = z.infer;\nexport type HCurrency = z.infer;\nexport type HESIM = z.infer;\nexport type HPayment = z.infer;\nexport type HMessage = z.infer;\nexport type HPackage = z.infer;\nexport type HPromoCode = z.infer;\nexport type HPartner = z.infer;\nexport type HPriceList = z.infer;\nexport type HApiLog = z.infer;\nexport type HTag = z.infer;\nexport type HTrafficPolicy = z.infer;\nexport type HBondioPackage = z.infer;\nexport type HTelnaPackage = z.infer;\n// Additional lower-level types\nexport type HAddress = z.infer;\nexport type HRegistration = z.infer;\nexport type HBankingDetails = z.infer;\nexport type HPartnerPackageSpecification = z.infer;\nexport type HPromoPackageSpecification = z.infer;\nexport type HVisualIdentityBanner = z.infer;\nexport type HFinancialProperties = z.infer;\nexport type HScheduleFilter = z.infer;\nexport type HPartnerContact = z.infer;\nexport type HPartnerData = z.infer;\nexport type HCommunicationChannel = z.infer;\nexport type HBookingStatus = z.infer;\nexport type HCommunicationOptions = z.infer;\nexport type HHubbyModel = z.infer;\n\nexport type HubbyModelApp = HHubbyModel;\n\nexport type SupportedLocales = typeof SUPPORTED_LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\nexport type HRole = z.infer;\nexport type HPermission = z.infer; ","import { Firestore } from 'firebase-admin/firestore';\nimport {\n createConvertJSToFirestore,\n createConvertFirestoreToJS\n} from './firestoreTransformUtils';\nimport { FieldSpec } from '../types';\n\n/**\n * Creates converter functions for a specific model type with dependency injection.\n * This lets you use the conversion functions with your own Firebase instance.\n * \n * @param db - Firestore instance to use for document references\n * @param modelSchemaSpec - Schema specification for the model\n * @returns Object with to/from Firestore conversion functions\n */\nexport function createModelConverters(\n db: Firestore,\n modelSchemaSpec: FieldSpec\n) {\n const convertToFirestore = createConvertJSToFirestore(db);\n const convertFromFirestore = createConvertFirestoreToJS();\n\n return {\n /**\n * Converts a model instance to Firestore format\n */\n toFirestore: (model: TModel): TFirestore => {\n return convertToFirestore(model, modelSchemaSpec);\n },\n\n /**\n * Converts Firestore data to a model instance\n */\n fromFirestore: (firestoreData: TFirestore): TModel => {\n return convertFromFirestore(firestoreData, modelSchemaSpec);\n }\n };\n} ","import { buildServerSchema } from './builders/server';\nimport {\n userSchemaSpec,\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { analyticsSpec } from './specs/analytics';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { packageSchemaSpec, telnaPackageSchema, bondioPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n visualIdentityBannersSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n scheduleSchema,\n visualIdentitySchema,\n packagePriceSchemaSpec,\n platformSettingsSchemaSpec\n} from './specs/partner';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { DocumentReference, Timestamp } from 'firebase-admin/firestore';\n\n\nimport { convertFirestoreToJS, convertJSToFirestore } from './utils/firestoreTransformUtils';\nimport { HPartner, HPriceList, HPromoCode } from './index.client';\nimport { buildClientSchema } from './builders/client';\n\nexport { partnerSchemaSpec, analyticsSpec, packageSchemaSpec };\n\nexport const UserSchema = buildServerSchema(userSchemaSpec);\nexport const UserFirestoreSchema = buildServerSchema(userSchemaSpec);\nexport const BookingSchema = buildServerSchema(bookingSchemaSpec);\nexport const CountrySchema = buildServerSchema(countrySchemaSpec);\nexport const CurrencySchema = buildServerSchema(currencySchemaSpec);\nexport const ESIMSchema = buildServerSchema(esimSchemaSpec);\nexport const PaymentSchema = buildServerSchema(paymentSchemaSpec);\nexport const MessageSchema = buildServerSchema(messageSchemaSpec);\nexport const PackageSchema = buildServerSchema(packageSchemaSpec);\nexport const PromoCodeSchema = buildServerSchema(promoCodeSchemaSpec);\nexport const PartnerSchema = buildServerSchema(partnerSchemaSpec);\nexport const PriceListSchema = buildServerSchema(priceListSchemaSpec);\nexport const ApiLogSchema = buildServerSchema(apiLogSchemaSpec);\nexport const VisualIdentitySchema = buildServerSchema(visualIdentitySchema);\nexport const PackagePriceSchema = buildServerSchema(packagePriceSchemaSpec);\nexport const PlatformSettingsSchema = buildServerSchema(platformSettingsSchemaSpec);\nexport const ScheduleSchema = buildServerSchema(scheduleSchema);\nexport const AnalyticsSchema = buildServerSchema(analyticsSpec);\nexport const TagSchema = buildServerSchema(tagModelSpec);\nexport const TelnaPackageSchema = buildServerSchema(telnaPackageSchema);\nexport const BondioPackageSchema = buildServerSchema(bondioPackageSchema);\nexport const TrafficPolicySchema = buildServerSchema(trafficPolicySpec);\n\n// Additional lower-level schemas\nexport const AddressSchema = addressSchema;\nexport const RegistrationSchema = registrationSchema;\nexport const BankingDetailsSchema = bankingDetailsSchema;\nexport const PartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const PromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const VisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const ScheduleFilterSchema = scheduleFilterSchema;\nexport const PartnerContactSchema = partnerContactSchema;\nexport const PartnerDataSchema = partnerDataSchema;\nexport const CommunicationChannelSchema = communicationChannelSchema;\nexport const BookingStatusSchema = bookingStatusSchema;\nexport const CommunicationOptionsSchema = communicationOptionsSchema;\nexport const VisualIdentityBannersSchema = visualIdentityBannersSchema;\n\nexport type User = z.infer;\nexport type UserFirestore = z.infer;\nexport type Booking = z.infer;\nexport type Country = z.infer;\nexport type Currency = z.infer;\nexport type ESIM = z.infer;\nexport type Payment = z.infer;\nexport type Message = z.infer;\nexport type Package = z.infer;\nexport type PromoCode = z.infer;\nexport type Partner = z.infer;\nexport type PriceList = z.infer;\nexport type ApiLog = z.infer;\nexport type Analytics = z.infer;\nexport type Schedule = z.infer;\nexport type TelnaPackage = z.infer;\nexport type BondioPackage = z.infer;\nexport type TrafficPolicy = z.infer;\n\n// Additional lower-level types\nexport type Address = z.infer;\nexport type Registration = z.infer;\nexport type BankingDetails = z.infer;\nexport type PartnerPackageSpecification = z.infer;\nexport type PackageSpecification = z.infer;\nexport type VisualIdentity = z.infer;\nexport type VisualIdentityBanner = z.infer;\nexport type VisualIdentityBanners = z.infer;\nexport type VisualIdentityBannerStrategy = VisualIdentityBanners;\nexport type ScheduleFilter = z.infer;\nexport type PartnerContact = z.infer;\nexport type PartnerData = z.infer;\nexport type CommunicationChannel = z.infer;\nexport type BookingStatus = z.infer;\nexport type CommunicationOptions = z.infer;\nexport type PackagePrice = z.infer;\nexport type PlatformSettings = z.infer;\nexport type BookingApiRequest = Booking;\nexport type BookingApiResponse = Booking;\nexport type PartnerApiRequest = Partner;\nexport type PartnerApiResponse = Partner;\nexport type PriceListApiRequest = PriceList;\nexport type PriceListApiResponse = PriceList;\nexport type ApiLogApiRequest = ApiLog;\nexport type ApiLogApiResponse = ApiLog;\nexport type Tag = z.infer;\n\nexport * from './index.client';\n\nexport type HubbyModel = {\n id: string;\n created_at: Date;\n updated_at: Date | null;\n created_by: string;\n updated_by: string | null;\n}\n\nexport type HubbyModelFirestore = {\n id: string;\n created_at: Timestamp;\n updated_at: Timestamp | null;\n created_by: DocumentReference | null | string;\n updated_by: DocumentReference | null | string;\n}\n\nexport const partnerFromFirestore = (partner: Partner): HPartner => {\n return convertFirestoreToJS(partner, partnerSchemaSpec);\n}\n\nexport const partnerToFirestore = (partner: HPartner): Partner => {\n return convertJSToFirestore(partner, partnerSchemaSpec);\n}\n\nexport const userToFirestore = (user: User): UserFirestore => {\n return convertJSToFirestore(user, userSchemaSpec);\n}\n\nexport const userFromFirestore = (user: UserFirestore): User => {\n return convertFirestoreToJS(user, userSchemaSpec);\n}\n\nexport const priceListFromFirestore = (priceList: PriceList): HPriceList => {\n return convertFirestoreToJS(priceList, priceListSchemaSpec);\n}\n\nexport const priceListToFirestore = (priceList: HPriceList): PriceList => {\n return convertJSToFirestore(priceList, priceListSchemaSpec);\n}\n\nexport const promoCodeFromFirestore = (promoCode: PromoCode): HPromoCode => {\n return convertFirestoreToJS(promoCode, promoCodeSchemaSpec);\n}\n\nexport const promoCodeToFirestore = (promoCode: HPromoCode): PromoCode => {\n return convertJSToFirestore(promoCode, promoCodeSchemaSpec);\n}\n\nexport const partnerAppSchema = buildClientSchema(partnerSchemaSpec);\n// Export the type and constant\nexport type SupportedLocales = typeof LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\n// Dependency Injection exports\nexport { createModelConverters } from './utils/modelConverterFactory';\nexport { createConvertJSToFirestore, createConvertFirestoreToJS } from './utils/firestoreTransformUtils';\nexport { FirebaseService, createFirebaseService } from './services/firebase';"]} \ No newline at end of file diff --git a/dist/index.d.cts b/dist/index.d.cts index 7a4f575..9918246 100644 --- a/dist/index.d.cts +++ b/dist/index.d.cts @@ -407,16 +407,19 @@ declare const partnerSchemaSpec: { enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -424,9 +427,10 @@ declare const partnerSchemaSpec: { total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -435,9 +439,10 @@ declare const partnerSchemaSpec: { booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -1961,16 +1966,19 @@ declare const HPartnerSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -1978,9 +1986,10 @@ declare const HPartnerSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -1989,9 +1998,10 @@ declare const HPartnerSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -2142,9 +2152,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -2201,9 +2212,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -2425,9 +2437,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -2603,9 +2616,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3485,16 +3499,19 @@ declare const HPartnerAppSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -3502,9 +3519,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3513,9 +3531,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3666,9 +3685,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3725,9 +3745,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3949,9 +3970,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4127,9 +4149,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -4221,16 +4244,19 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -4238,9 +4264,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4249,9 +4276,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -4402,9 +4430,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4461,9 +4490,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -4739,16 +4769,19 @@ declare const HFreeEsimSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -4756,9 +4789,10 @@ declare const HFreeEsimSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4767,9 +4801,10 @@ declare const HFreeEsimSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -5963,16 +5998,19 @@ declare const partnerAppSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -5980,9 +6018,10 @@ declare const partnerAppSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -5991,9 +6030,10 @@ declare const partnerAppSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -6144,9 +6184,10 @@ declare const partnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -6203,9 +6244,10 @@ declare const partnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -6427,9 +6469,10 @@ declare const partnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -6605,9 +6648,10 @@ declare const partnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; diff --git a/dist/index.d.ts b/dist/index.d.ts index 7a4f575..9918246 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -407,16 +407,19 @@ declare const partnerSchemaSpec: { enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -424,9 +427,10 @@ declare const partnerSchemaSpec: { total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -435,9 +439,10 @@ declare const partnerSchemaSpec: { booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -1961,16 +1966,19 @@ declare const HPartnerSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -1978,9 +1986,10 @@ declare const HPartnerSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -1989,9 +1998,10 @@ declare const HPartnerSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -2142,9 +2152,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -2201,9 +2212,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -2425,9 +2437,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -2603,9 +2616,10 @@ declare const HPartnerSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3485,16 +3499,19 @@ declare const HPartnerAppSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -3502,9 +3519,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3513,9 +3531,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3666,9 +3685,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -3725,9 +3745,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -3949,9 +3970,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4127,9 +4149,10 @@ declare const HPartnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -4221,16 +4244,19 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -4238,9 +4264,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4249,9 +4276,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -4402,9 +4430,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4461,9 +4490,10 @@ declare const HPlatformSettingsSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -4739,16 +4769,19 @@ declare const HFreeEsimSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -4756,9 +4789,10 @@ declare const HFreeEsimSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -4767,9 +4801,10 @@ declare const HFreeEsimSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -5963,16 +5998,19 @@ declare const partnerAppSchema: z.ZodObject<{ enabled: z.ZodBoolean; package_specification: z.ZodObject<{ size: z.ZodString; - type: z.ZodString; + package_type: z.ZodString; destination: z.ZodString; + package_duration: z.ZodNumber; }, "strip", z.ZodTypeAny, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }, { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }>; booking_id_verification: z.ZodDefault; booking_id_verification_pattern: z.ZodOptional>; @@ -5980,9 +6018,10 @@ declare const partnerAppSchema: z.ZodObject<{ total_allowance: z.ZodNumber; }, "strip", z.ZodTypeAny, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -5991,9 +6030,10 @@ declare const partnerAppSchema: z.ZodObject<{ booking_id_verification_pattern?: string | null | undefined; }, { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -6144,9 +6184,10 @@ declare const partnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -6203,9 +6244,10 @@ declare const partnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; @@ -6427,9 +6469,10 @@ declare const partnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; booking_id_verification: boolean; @@ -6605,9 +6648,10 @@ declare const partnerAppSchema: z.ZodObject<{ } | null | undefined; free_esim?: { package_specification: { - type: string; destination: string; size: string; + package_duration: number; + package_type: string; }; enabled: boolean; allowance: number; diff --git a/dist/index.js b/dist/index.js index fa25a17..fe5ec04 100644 --- a/dist/index.js +++ b/dist/index.js @@ -685,8 +685,9 @@ var freeEsimSchema = z.object({ enabled: z.boolean(), package_specification: z.object({ size: z.string(), - type: z.string(), - destination: z.string() + package_type: z.string(), + destination: z.string(), + package_duration: z.number() }), booking_id_verification: z.boolean().default(false), booking_id_verification_pattern: z.string().nullable().optional(), diff --git a/dist/index.js.map b/dist/index.js.map index 7ef4aea..553ed01 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/builders/server.ts","../src/common.ts","../src/services/firebase.ts","../src/specs/user.ts","../src/specs/common.ts","../src/specs/booking.ts","../src/constants.ts","../src/specs/promocode.ts","../src/specs/country.ts","../src/specs/currency.ts","../src/specs/esim.ts","../src/specs/payment.ts","../src/specs/analytics.ts","../src/specs/message.ts","../src/specs/traffic_policy.ts","../src/specs/package.ts","../src/specs/partner.ts","../src/specs/apiLogs.ts","../src/utils/firestoreTransformUtils.ts","../src/builders/client.ts","../src/specs/role.ts","../src/specs/permission.ts","../src/index.client.ts","../src/utils/modelConverterFactory.ts","../src/index.server.ts"],"names":["z","packageSpecificationSchema","Timestamp","convertJSToFirestore","convertFirestoreToJS","SUPPORTED_LOCALES"],"mappings":";AAAA,SAAS,KAAAA,UAAS;AAClB,SAAS,iBAAiB;;;ACD1B,SAAqB,SAAS;AAQvB,SAAS,cACZ,QACA,SAQU;AACV,MAAI,CAAC;AAAS,WAAO;AAErB,MAAI,UAAU;AAGd,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAEA,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAAA,EAC/B;AAGA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAEhD,QAAI,CAAC,YAAY,UAAU,EAAE,SAAS,GAAG,KAAK,UAAU,QAAW;AAC/D;AAAA,IACJ;AAGA,QAAI,OAAQ,QAAgB,GAAG,MAAM,YAAY;AAC7C,gBAAW,QAAgB,GAAG,EAAE,KAAK;AAAA,IACzC;AAAA,EACJ;AAEA,SAAO;AACX;AAEO,SAAS,iBACZ,MACA,MACA,SACU;AACV,QAAM,aAAa,KAAK,KAAK,GAAG;AAEhC,MAAI,EAAE,QAAQ,OAAO;AACjB,UAAM,IAAI,MAAM,mBAAmB,UAAU,mBAAmB;AAAA,EACpE;AAEA,QAAM,QAAoC,CAAC;AAC3C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,EAAE,GAAG;AAChD,UAAM,GAAG,IAAI,QAAQ,OAAc,CAAC,GAAG,MAAM,GAAG,CAAC;AAAA,EACrD;AAEA,MAAI,eAA2B,EAAE,OAAO,KAAK;AAC7C,MAAI,KAAK;AAAU,mBAAe,aAAa,SAAS;AACxD,MAAI,KAA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A8B;AAC1D,SAAO,qBAAqB,MAAM,cAAc;AACpD;AAEO,IAAM,oBAAoB,CAAC,SAA8B;AAC5D,SAAO,qBAAqB,MAAM,cAAc;AACpD;AAEO,IAAM,yBAAyB,CAAC,cAAqC;AACxE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,uBAAuB,CAAC,cAAqC;AACtE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,yBAAyB,CAAC,cAAqC;AACxE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,uBAAuB,CAAC,cAAqC;AACtE,SAAO,qBAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,mBAAmB,kBAAkB,iBAAiB;AAG5D,IAAMI,qBAAoB","sourcesContent":["import { z } from 'zod';\nimport { Timestamp } from 'firebase-admin/firestore';\nimport type { FieldSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\nimport { FirebaseService } from '../services/firebase';\n\nexport const buildServerSchema = (spec: FieldSpec, path: string[] = []): z.ZodTypeAny => {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod schema passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec);\n }\n\n // ----- Array -----\n if ('_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n\n const itemSchema =\n spec.of instanceof z.ZodType\n ? spec.of\n : buildServerSchema(spec.of, [...path, '[i]']);\n\n let arraySchema = z.array(itemSchema);\n if (spec.nullable) arraySchema = arraySchema.nullable();\n if (spec.optional) arraySchema = arraySchema.optional();\n return arraySchema;\n }\n\n // ----- Record -----\n if ('_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n\n const valueSchema =\n spec.of instanceof z.ZodType\n ? spec.of\n : buildServerSchema(spec.of, [...path, '[key]']);\n\n let recordSchema = z.record(valueSchema);\n if (spec.nullable) recordSchema = recordSchema.nullable();\n if (spec.optional) recordSchema = recordSchema.optional();\n return recordSchema;\n }\n\n // ----- Timestamp -----\n if ('_type' in spec && spec._type === 'timestamp') {\n let tsSchema = z.date().transform(date => Timestamp.fromDate(date));\n if (spec.nullable) tsSchema = tsSchema.nullable();\n if (spec.optional) tsSchema = tsSchema.optional();\n return tsSchema;\n }\n\n // ----- Document Reference -----\n if ('_type' in spec && spec._type === 'docRef') {\n let refSchema = z.string().transform(id => {\n const firestore = FirebaseService.getDefaultInstance().getFirestore()\n return firestore.collection(spec.collection).doc(id);\n });\n if (spec.nullable) refSchema = refSchema.nullable();\n if (spec.optional) refSchema = refSchema.optional();\n return refSchema;\n }\n\n // ----- Nested object shape -----\n if (typeof spec === 'object' && !('_type' in spec)) {\n const shape: Record = {};\n for (const [key, val] of Object.entries(spec)) {\n shape[key] = buildServerSchema(val, [...path, key]);\n }\n return z.object(shape);\n }\n\n // ----- Object -----\n if (\n typeof spec === 'object' &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildServerSchema);\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || typeof spec === 'object' && '_type' in spec && spec._type === 'object') {\n return wrapPlainObjectSchema(spec, path, buildServerSchema);\n }\n\n // ----- Unknown or malformed spec -----\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n};\n","import { ZodTypeAny, z } from 'zod';\nimport type { SchemaBuilder } from './types';\n\n/**\n * Ensures a Zod schema is wrapped to be optional and/or nullable,\n * if not already. Use this in recursive schema builders.\n * Also applies any other supported schema transformations provided in options.\n */\nexport function wrapZodSchema(\n schema: ZodTypeAny,\n options?: {\n optional?: boolean;\n nullable?: boolean;\n min?: number;\n max?: number;\n // Allow arbitrary extensions via dynamic property\n [key: string]: any;\n }\n): ZodTypeAny {\n if (!options) return schema;\n\n let wrapped = schema;\n\n // Handle nullable and optional specially since they're common\n if (options.nullable && !wrapped.isNullable?.()) {\n wrapped = wrapped.nullable();\n }\n\n if (options.optional && !wrapped.isOptional?.()) {\n wrapped = wrapped.optional();\n }\n\n // Process all other options dynamically\n for (const [key, value] of Object.entries(options)) {\n // Skip the already handled properties and undefined values\n if (['nullable', 'optional'].includes(key) || value === undefined) {\n continue;\n }\n\n // Check if the schema has a method matching the option key\n if (typeof (wrapped as any)[key] === 'function') {\n wrapped = (wrapped as any)[key](value);\n }\n }\n\n return wrapped;\n}\n\nexport function wrapObjectSchema(\n spec: any, // using any to support dynamic `spec.type === 'object'`\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n if (!('of' in spec)) {\n throw new Error(`Object spec at \"${pathString}\" is missing 'of'`);\n }\n\n const shape: Record = {};\n for (const [key, value] of Object.entries(spec.of)) {\n shape[key] = builder(value as any, [...path, key]);\n }\n\n let objectSchema: ZodTypeAny = z.object(shape);\n if (spec.nullable) objectSchema = objectSchema.nullable();\n if (spec.optional) objectSchema = objectSchema.optional();\n return objectSchema;\n}\n\n/**\n * Wraps a plain object shape (no `type: 'object'`) into a Zod schema.\n * Assumes each field is either a Zod schema or another FieldSpec.\n */\nexport function wrapPlainObjectSchema(\n spec: Record,\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n // Handle object field specs with '_type': 'object'\n if ('_type' in spec && spec._type === 'object' && 'of' in spec) {\n return wrapObjectSchema(spec, path, builder);\n }\n\n const shape: Record = {};\n\n // Only add fields to the schema if they're not special control properties\n for (const [key, val] of Object.entries(spec)) {\n if (key !== '_type' && key !== 'nullable' && key !== 'optional') {\n shape[key] = builder(val, [...path, key]);\n }\n }\n\n // Create the base object schema\n let schema: ZodTypeAny = z.object(shape);\n\n // Apply nullable/optional modifiers if needed\n if ('nullable' in spec && spec.nullable === true) {\n schema = schema.nullable();\n }\n\n if ('optional' in spec && spec.optional === true) {\n schema = schema.optional();\n }\n\n return schema;\n}\n\nexport const SCHEMA_MARKER = Symbol('ZodSchemaSpecMarker');\n\nexport function markAsSchemaSpec(spec: T): T {\n Object.defineProperty(spec, SCHEMA_MARKER, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return spec;\n}\n\nexport function isSchemaSpec(obj: unknown): obj is Record {\n return typeof obj === 'object' && obj !== null && SCHEMA_MARKER in obj;\n}","import { getApps, initializeApp, cert, AppOptions, App } from \"firebase-admin/app\";\nimport { getFirestore, Firestore } from \"firebase-admin/firestore\";\nimport { applicationDefault } from \"firebase-admin/app\";\n\nexport interface FirebaseConfig {\n credential?: AppOptions['credential'];\n projectId?: string;\n storageBucket?: string;\n databaseURL?: string;\n // Options for testing\n isTest?: boolean;\n}\n\n// Define variable to hold singleton instance (must be injected by consumer/tests)\nlet defaultInstance: FirebaseService | null = null;\n\nexport class FirebaseService {\n\n private firestoreInstance: Firestore;\n constructor(db: Firestore) {\n this.firestoreInstance = db;\n }\n\n getFirestore(): Firestore {\n return this.firestoreInstance;\n }\n\n // Get default instance with singleton pattern\n public static getDefaultInstance(): FirebaseService {\n if (defaultInstance === null) {\n throw new Error(\n \"FirebaseService default instance not set. Inject a FirebaseService via FirebaseService.setDefaultInstance(...) in your application startup or test setup.\"\n );\n }\n return defaultInstance;\n }\n\n // Allow for setting a custom default instance (useful for tests)\n public static setDefaultInstance(instance: FirebaseService): void {\n defaultInstance = instance;\n }\n}\n\n// Function to create a new Firebase service instance (use in tests or by consumers before injection)\nexport function createFirebaseService(db: Firestore): FirebaseService {\n return new FirebaseService(db);\n}","import { z } from 'zod';\nimport { PARTNER_COLLECTION, PROFILE_COLLECTION, timestampNullableOptional, timestampRequired, timestampNullable, ROLE_COLLECTION, PERMISSION_COLLECTION } from './common';\nimport { markAsSchemaSpec } from '../common'\n\nexport const apiKeySpec = {\n expires_at: { _type: 'timestamp' as const },\n secret: z.string(),\n is_active: z.boolean(),\n}\n\nexport const apiKeysSpec = {\n _type: 'record' as const,\n of: {\n _type: 'object' as const,\n of: apiKeySpec\n }\n}\n\nexport const apiKeysObjectSpec = {\n _type: 'object' as const,\n of: {\n allowed_keys: { _type: 'array' as const, nullable: true, optional: true, of: z.string() },\n keys: apiKeysSpec\n },\n nullable: true,\n optional: true\n}\n\nexport const userSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string().nullable(),\n email: z.string().email().nullable(),\n stripe_id: z.string().nullable().optional(),\n referral: z.string().nullable().optional(),\n fcm: z.string().optional(),\n deeplink: z.string().nullable().optional(),\n gender: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n coordinates: z.string().nullable().optional(),\n parameters: z.any().nullable().optional(),\n locale: z.string().nullable().optional(),\n phone_model: z.string().nullable().optional(),\n phone_os: z.string().nullable().optional(),\n phone_os_version: z.string().nullable().optional(),\n ios: z.boolean().nullable().optional(),\n has_card_saved: z.boolean().nullable().optional(),\n admin: z.boolean().nullable().optional(),\n api_keys: apiKeysObjectSpec,\n currency: z.string().nullable().optional(),\n receipt_email: z.string().nullable().optional(),\n source: z.enum(['direct', 'promo', 'platform']).nullable().optional(),\n role: { _type: 'docRef' as const, collection: ROLE_COLLECTION, optional: true, nullable: true },\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n balance: z.number().nullable().optional(),\n createdAt: { _type: 'timestamp' as const },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, optional: true, nullable: true },\n profileRef: { _type: 'docRef' as const, collection: PROFILE_COLLECTION, optional: true, nullable: true },\n review_requested: timestampNullableOptional,\n last_seen: timestampNullableOptional\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\n\n// Collection paths\nexport const PARTNER_COLLECTION = '/companies/hubby/partners';\nexport const USER_COLLECTION = 'users';\nexport const PROFILE_COLLECTION = '/companies/hubby/profiles';\nexport const PACKAGE_COLLECTION = '/companies/hubby/packages';\nexport const PROMO_CODE_COLLECTION = '/companies/hubby/promo_codes';\nexport const COUNTRY_COLLECTION = 'countries';\nexport const ESIM_COLLECTION = 'esims';\nexport const PAYMENT_COLLECTION = 'payments';\nexport const PRICE_LIST_COLLECTION = 'price_lists';\nexport const BOOKING_COLLECTION = 'bookings';\nexport const MESSAGE_COLLECTION = 'messages';\nexport const CURRENCY_COLLECTION = 'currencies';\nexport const API_LOG_COLLECTION = 'api_logs'\nexport const ROLE_COLLECTION = 'roles';\nexport const PERMISSION_COLLECTION = 'permissions';\nexport const TRAFFIC_POLICY_COLLECTION = 'traffic_policies';\n\n// Timestamp specs\nexport const timestampNullableOptional = { _type: 'timestamp' as const, nullable: true, optional: true };\nexport const timestampNullable = { _type: 'timestamp' as const, nullable: true, optional: false };\nexport const timestampRequired = { _type: 'timestamp' as const, nullable: false, optional: false };\n\nexport const hubbyModelSpec = {\n id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n created_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n updated_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n}\n\nexport const tagModelSpec = {\n ...hubbyModelSpec,\n slug: z.string(),\n name: z.string(),\n description: z.string().nullable().optional(),\n color: z.string().nullable().optional(),\n}","import { z } from 'zod';\nimport {\n PARTNER_COLLECTION,\n PROMO_CODE_COLLECTION,\n USER_COLLECTION,\n ESIM_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema } from '../constants';\nimport { packageSpecificationSchema } from './promocode';\n\n// Enum for communication channels\nexport const communicationChannelSchema = z.enum([\n 'EMAIL',\n 'WHATSAPP',\n 'PUSH_NOTIFICATION',\n 'SMS'\n]);\nexport type CommunicationChannelType = z.infer;\n\n// For backward compatibility\nexport type CommunicationChannel = CommunicationChannelType;\n\n// Add enum-like object for use in code\nexport const CommunicationChannel = {\n EMAIL: 'EMAIL' as const,\n WHATSAPP: 'WHATSAPP' as const,\n PUSH_NOTIFICATION: 'PUSH_NOTIFICATION' as const,\n SMS: 'SMS' as const\n} as const;\n\n// Status type for bookings\nexport const bookingStatusSchema = z.enum([\n 'PENDING',\n 'CONFIRMED',\n 'COMPLETED',\n 'CANCELLED',\n 'UNPAID',\n 'EXPIRED'\n]);\nexport type BookingStatus = z.infer;\n\n// Communication options schema\nexport const communicationOptionsSchema = z.object({\n should_send_message: z.boolean(),\n channels: z.array(communicationChannelSchema)\n});\n\nexport type CommunicationOptions = z.infer;\n\n// Define the booking schema spec\nexport const bookingSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n external_id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n title: z.string().nullable(),\n first_name: z.string().nullable().optional(),\n last_name: z.string().nullable().optional(),\n full_name: z.string().nullable().optional(),\n pax: z.number(),\n email: z.string().email().nullable(),\n phone: z.string().nullable(),\n booking_id: z.string().nullable(),\n flight_number: z.string().optional(),\n gender: z.enum(['M', 'F', 'O']).optional(),\n package_size: z.string().optional(),\n sent_messages: z.record(z.any()).optional(),\n locale: supportedLocalesSchema,\n status: bookingStatusSchema,\n data: {\n _type: 'object' as const,\n of: {\n source: z.string(),\n manual: z.boolean()\n }\n },\n communication_options: {\n _type: 'object' as const,\n of: {\n should_send_message: z.boolean(),\n channels: {\n _type: 'array' as const,\n of: communicationChannelSchema\n }\n }\n },\n is_processed_for_esim_restoration: z.boolean(),\n is_pseudonymized: z.boolean(),\n import_id: z.string().nullable().optional(),\n package_specifications: z.array(packageSpecificationSchema).min(1),\n departure_date: timestampRequired,\n return_date: timestampNullable,\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION },\n promo_codes: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: PROMO_CODE_COLLECTION }\n },\n users: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: USER_COLLECTION },\n nullable: true\n },\n esims: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: ESIM_COLLECTION },\n nullable: true\n }\n});\n\n","import { z } from \"zod\";\n\nexport const SUPPORTED_LOCALES = [\n \"en-US\",\n \"en-EU\",\n \"en-GB\",\n \"en-CA\",\n \"nl-NL\",\n \"de-DE\",\n \"fr-FR\",\n \"it-IT\",\n \"es-ES\",\n \"cs-CZ\",\n \"pl-PL\",\n \"pt-PT\",\n \"fr-BE\",\n \"nl-BE\",\n \"de-AT\",\n \"de-CH\",\n \"fr-CH\",\n \"it-CH\",\n \"sv-SE\",\n \"sk-SK\",\n \"de-BE\",\n \"en-AU\",\n \"da-DK\",\n] as const;\n\n// Define the type using TypeScript's typeof and indexing\n\n// Define the type using TypeScript's typeof and indexing\nexport type SupportedLocales = (typeof SUPPORTED_LOCALES)[number];\n\n// Create a Zod schema for validation\nexport const supportedLocalesSchema = z.enum(SUPPORTED_LOCALES);\n\n// Type inference from the schema (alternative way to define the type)\nexport type SupportedLocalesFromSchema = z.infer;\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n PARTNER_COLLECTION,\n COUNTRY_COLLECTION,\n PACKAGE_COLLECTION,\n BOOKING_COLLECTION,\n PROMO_CODE_COLLECTION,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// Define package specification schema for use in promo code\nexport const packageSpecificationSchema = z.object({\n destination: z.string().optional(),\n size: z.string().optional(),\n package_id: z.string().optional(),\n iata_code: z.string().optional(),\n package_duration: z.number().optional(),\n package_type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).optional(),\n traffic_policy: z.string().optional(),\n});\n\n// Define the promo code schema spec\nexport const promoCodeSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n redeemed_at: timestampNullableOptional,\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // PromoCode specific fields\n external_id: z.string(),\n code: z.string(),\n allowance_user: z.number(),\n allowance_total: z.number(),\n type: z.enum(['discount', 'booking', 'booking_without_destination']).nullable().or(z.string()),\n usage: z.array(z.string()),\n uuid_usage: z.array(z.string()),\n package_specification: packageSpecificationSchema.optional(),\n valid_from: timestampRequired,\n valid_to: timestampRequired,\n\n // Reference fields\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION, nullable: true },\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n booking: { _type: 'docRef' as const, collection: BOOKING_COLLECTION, nullable: true },\n\n // Optional fields based on the type\n discount: z.number().optional(),\n package_size: z.string().optional(),\n countries: z.array(z.string()).optional(),\n max_bytes: z.number().optional(),\n starter_data: z.number().optional()\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const countrySchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n bokun_id: z.number().nullable(),\n LTE: z.boolean().nullable(),\n apn: z.string().nullable(),\n click_count: z.number().nullable(),\n global_network: z.string().nullable(),\n global_price: z.number().nullable(),\n hubby: z.number().nullable(),\n imsi: z.number().nullable(),\n has_esim: z.boolean(),\n name: z.string().nullable(),\n region: z.boolean().nullable(),\n i18n_name: z.record(z.string()),\n is_region: z.boolean().nullable(),\n countries: z.array(z.string()).nullable(),\n tier: z.number().nullable()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define schema for conversion rates (for backward compatibility)\nexport const conversionRateSchema = z.object({\n currency: z.number()\n});\n\nexport type CoversionRate = z.infer;\n\n// Define the currency schema spec\nexport const currencySchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n // ISO 4217 currency code (e.g., \"USD\", \"EUR\")\n code: z.string().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n // Currency symbol (e.g., \"$\", \"€\")\n symbol: z.string().describe('Currency symbol (e.g., \"$\", \"€\")'),\n // Full name of the currency (e.g., \"US Dollar\")\n name: z.string().describe('Full name of the currency (e.g., \"US Dollar\")'),\n // Exchange rate relative to base currency\n rate: z.number().describe('Exchange rate relative to base currency'),\n // Whether this is the default currency\n is_default: z.boolean().describe('Whether this is the default currency')\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n USER_COLLECTION,\n PARTNER_COLLECTION,\n PAYMENT_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\n\n// Define the eSIM schema spec\nexport const esimSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Common eSIM fields\n imsi: z.number(),\n qr: z.string(),\n iccid: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable().optional(),\n total_data: z.number(),\n data_left: z.number(),\n data_used: z.boolean(),\n status: z.string().nullable(),\n name: z.string(),\n android_auto: z.boolean(),\n partner_price: z.number().nullable(),\n promo: z.string().nullable(),\n type: z.enum(['api', 'promo', 'balance', 'code', 'external', 'payment']),\n is_auto_install: z.boolean(),\n is_archived: z.boolean(),\n user: z.string().nullable(),\n payment: z.string().nullable(),\n apn: z.string().nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Timestamp fields\n time_assigned: timestampNullable,\n last_updated: timestampNullable\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n USER_COLLECTION,\n timestampRequired\n} from './common';\n\n// Define the payment schema spec\nexport const paymentSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Payment specific fields\n amount: z.number(),\n customer: z.string(),\n date: timestampRequired,\n iccid: z.string(),\n package: z.string(),\n promo: z.string(),\n topup: z.boolean(),\n\n // Reference fields\n user: { _type: 'docRef' as const, collection: USER_COLLECTION, nullable: true, optional: true }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec, PARTNER_COLLECTION } from './common';\n\n// Country schema spec\nexport const analyticsSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n service: z.string(),\n date: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/), // YYYY-MM-DD\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n event: z.string(),\n parameter: z.string().nullable(),\n sum: z.number(),\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define the message schema spec\nexport const messageSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n key: z.string(),\n method: z.enum([\"push\", \"sms\", \"email\"]),\n status: z.enum([\"pending\", \"sent\", \"failed\", \"delivered\"]),\n created_at: timestampRequired,\n updated_at: timestampRequired\n});\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const trafficPolicySpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n name: z.string(),\n description: z.string(),\n external_id: z.string(),\n provider: z.string()\n})","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n PARTNER_COLLECTION,\n TRAFFIC_POLICY_COLLECTION,\n timestampRequired,\n hubbyModelSpec\n} from './common';\n\nimport { countrySchemaSpec } from './country';\n\n// Define the package schema spec\nexport const packageSchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n // Package specific fields\n external_id: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable(),\n label: z.string(),\n bytes: z.number(),\n hidden: z.boolean(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n price: z.number(),\n partner_price: z.number(),\n days: z.number(),\n name: z.string(),\n type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).nullable(),\n throttling: z.number().optional(),\n provider_parameters: z.object({\n imsi: z.number()\n }).nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Nested country data - need to use dynamic reference to country schema\n // This would typically be handled better with a proper recursive schema definition\n // but for simplicity, we're using any type here\n country_data: {\n _type: 'object' as const,\n of: countrySchemaSpec,\n nullable: true,\n optional: true\n }\n // country_data: z.any().nullable()\n});\n\nexport const commonPackageSchema = markAsSchemaSpec({\n size: z.string(),\n iso: z.string(),\n days: z.number(),\n price: z.number(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n packageType: z.string(),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n});\n\nexport const telnaPackageSchema = markAsSchemaSpec({\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n ...commonPackageSchema,\n});\n\nexport const bondioPackageSchema = markAsSchemaSpec({\n ...commonPackageSchema,\n label: z.enum(['lambda', 'tau']),\n});","import { z, ZodLazy } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema, SUPPORTED_LOCALES, SupportedLocales } from '../constants';\nimport {\n PARTNER_COLLECTION,\n USER_COLLECTION,\n PACKAGE_COLLECTION,\n PRICE_LIST_COLLECTION,\n tagModelSpec,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// ===== Helper schemas for nested structures =====\n\n// Address schema\nexport const addressSchema = z.object({\n street: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n postal_code: z.string().nullable().optional(),\n country: z.string().nullable().optional()\n});\n\n// Emit event schema\nexport const emitEventSchema = z.object({\n topup: z.boolean().optional().default(false),\n redemption: z.boolean().optional().default(false),\n activation: z.boolean().optional().default(false),\n depletion: z.boolean().optional().default(false),\n});\n\n// Registration schema\nexport const registrationSchema = z.object({\n chamber_of_commerce_number: z.string().nullable().optional(),\n vat_number: z.string().nullable().optional(),\n anvr_number: z.number().nullable().optional(),\n tax_number: z.string().nullable().optional()\n});\n\n// Banking details schema\nexport const bankingDetailsSchema = z.object({\n account_holder: z.string().nullable().optional(),\n bank_name: z.string().nullable().optional(),\n iban: z.string().nullable().optional(),\n currency: z.string().nullable().optional()\n});\n\n// Package price schema\nexport const packagePriceSchema = z.object({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: z.object({ _type: z.literal('docRef'), collection: z.literal(PACKAGE_COLLECTION) })\n});\n\n// Package specification schema\nexport const packageSpecificationSchema = z.object({\n size: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n destination: z.string().nullable().optional()\n});\n\n// Pricing strategy schema\nexport const pricingStrategySchema = z.object({\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: z.object({\n _type: z.literal('docRef'),\n collection: z.literal(PRICE_LIST_COLLECTION),\n nullable: z.literal(true)\n }),\n custom_prices: z.array(packagePriceSchema)\n});\n\n// Visual identity banner schema\nexport const visualIdentityBannerSchema = z.object({\n image_url: z.string(),\n alt: z.string(),\n click_url: z.string(),\n locale: supportedLocalesSchema,\n properties: z.record(z.string())\n});\n\n// Schedule filter schema\nexport const scheduleFilterSchema = z.object({\n type: z.enum(['iso3', 'gender', 'percentage', 'age']),\n value: z.union([z.string(), z.number()]),\n comparison: z.enum([\n 'equal',\n 'not_equal',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal'\n ])\n});\n\n// Convert object-like schemas to proper Zod objects\nexport const visualIdentityBannersSchema = z.object({\n strategy: z.enum(['fixed', 'rotating', 'destination', 'time_of_day']),\n banners: z.array(visualIdentityBannerSchema).nullable().optional()\n});\n\nexport const visualIdentitySchema = z.object({\n primary_color: z.string(),\n secondary_color: z.string(),\n logo: z.string(),\n font: z.string().nullable().optional(),\n top_banner: visualIdentityBannersSchema.optional(),\n mid_banner: visualIdentityBannersSchema.optional()\n});\n\n// Partner contact schema\nexport const partnerContactSchema = z.object({\n name: z.string().nullable().optional(),\n email: z.string().nullable(),\n office_phone: z.string().nullable().optional()\n});\n\n// Partner data schema\nexport const partnerDataSchema = z.object({\n source: z.string(),\n manual: z.boolean()\n});\n\n// Package strategy schema\nexport const packageStrategySchema = z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any()\n});\n\n// Schedule email schema\nexport const scheduleEmailSchema = z.object({\n brevo_template_id: z.number(),\n subject: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional(),\n preview_text: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional()\n}).nullable().optional();\n\n// Schedule push schema\nexport const schedulePushSchema = z.object({\n title: z.record(z.string()).optional(),\n body: z.record(z.string()).optional(),\n target: z.string()\n}).nullable().optional();\n\n// Schedule schema\nexport const scheduleSchema = z.object({\n days: z.number(),\n email: scheduleEmailSchema,\n push: schedulePushSchema,\n hour: z.number(),\n key: z.string(),\n method: z.enum(['email', 'sms', 'whatsapp', 'push']),\n moment: z.enum(['departure_date', 'return_date', 'immediate']),\n filter: scheduleFilterSchema.nullable().optional()\n});\n\nexport const freeEsimSchema = z.object({\n enabled: z.boolean(),\n package_specification: z.object({\n size: z.string(),\n type: z.string(),\n destination: z.string()\n }),\n booking_id_verification: z.boolean().default(false),\n booking_id_verification_pattern: z.string().nullable().optional(),\n allowance: z.number(),\n total_allowance: z.number(),\n});\n\n// Platform settings schema\nexport const platformSettingsSchema = z.object({\n package_strategy: z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any(),\n supported_package_types: z.enum(['data-limited', 'unlimited']).optional()\n }).nullable().optional(),\n free_esim: freeEsimSchema.nullable().optional(),\n booking_defaults: z.object({\n locale: supportedLocalesSchema\n }).nullable().optional(),\n booking_confirmation: z.object({\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n }).nullable().optional(),\n emit_events: emitEventSchema.nullable().optional(),\n schedules: z.array(scheduleSchema).optional(),\n visual_identity_options: z.object({\n hubby_branding: z.boolean().optional().default(true),\n source_partner_branding: z.boolean().optional().default(false),\n own_branding: z.boolean().optional().default(false)\n }).nullable().optional()\n});\n\n// ===== Exportable schema specs =====\n\n// Package price schema spec\nexport const packagePriceSchemaSpec = markAsSchemaSpec({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n});\n\n// Financial properties schema spec\nexport const financialPropertiesSchemaSpec = markAsSchemaSpec({\n administration_fee: z.number().nullable(),\n income_per_gb: z.number().nullable(),\n commission_fee: z.number().nullable().optional(),\n payment_method: z.enum(['invoice', 'direct']),\n requires_card: z.boolean().nullable(),\n next_invoice: timestampNullableOptional,\n last_invoice: timestampNullableOptional,\n pricing_strategies: {\n _type: 'object' as const,\n of: {\n partner: {\n _type: 'object' as const,\n of: {\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n },\n user: {\n _type: 'object' as const,\n of: {\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n }\n },\n nullable: true\n }\n});\n\n// Platform settings schema spec\nexport const platformSettingsSchemaSpec = markAsSchemaSpec({\n package_strategy: {\n _type: 'object' as const,\n of: packageStrategySchema.shape,\n nullable: true,\n optional: true\n },\n free_esim: {\n _type: 'object' as const,\n of: freeEsimSchema.shape,\n nullable: true,\n optional: true\n },\n booking_defaults: {\n _type: 'object' as const,\n of: {\n locale: supportedLocalesSchema\n },\n nullable: true,\n optional: true\n },\n booking_confirmation: {\n _type: 'object' as const,\n of: {\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n },\n nullable: true,\n optional: true\n },\n schedules: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: scheduleSchema.shape\n },\n optional: true\n }\n});\n\n// Webhook settings schema\nexport const webhookSettingsSchema = z.object({\n url: z.string().url().nullable().optional(),\n api_key: z.string().nullable().optional(),\n enabled: z.boolean().default(false),\n events: z.object({\n promocode_redemption: z.boolean().default(false)\n }).default({})\n});\n\n// ===== Main partner schema =====\nexport const partnerSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Partner specific fields\n name: z.string().min(3),\n type: z.string().nullable(),\n is_active: z.boolean().nullable().optional(),\n external_id: z.string().nullable().optional(),\n\n // Complex nested objects\n contact: {\n _type: 'object' as const,\n of: partnerContactSchema.shape,\n nullable: true\n },\n address: {\n _type: 'object' as const,\n of: addressSchema.shape,\n nullable: true\n },\n registration: {\n _type: 'object' as const,\n of: registrationSchema.shape,\n nullable: true\n },\n banking_details: {\n _type: 'object' as const,\n of: bankingDetailsSchema.shape,\n nullable: true\n },\n\n // Reference fields\n parent: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n users: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: USER_COLLECTION }, nullable: true },\n\n // Complex nested structures\n financial_properties: financialPropertiesSchemaSpec,\n // Visual identity\n visual_identity: {\n _type: 'object' as const,\n of: visualIdentitySchema.shape,\n nullable: true\n },\n\n // Platform settings\n platform_settings: {\n _type: 'object' as const,\n of: platformSettingsSchema.shape,\n nullable: true\n },\n\n // Tags\n tags: {\n _type: 'array' as const,\n of: tagModelSpec,\n nullable: true,\n optional: true\n },\n\n // Metadata\n data: {\n _type: 'object' as const,\n of: partnerDataSchema.shape,\n nullable: true,\n optional: true\n },\n\n // Webhook settings\n webhook_settings: {\n _type: 'object' as const,\n of: webhookSettingsSchema.shape,\n nullable: true,\n optional: true\n }\n});\n\n// ===== Price list schema =====\nexport const priceListSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Price list specific fields\n name: z.string().min(3),\n description: z.string().nullable(),\n type: z.enum(['partner', 'consumer']),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n});\n","import { z } from 'zod';\nimport { timestampRequired } from './common';\nimport { markAsSchemaSpec } from '../common';\n\nexport const payloadSpec = {\n _type: 'record' as const,\n of: z.unknown(),\n optional: true\n};\n\nexport const apiLogSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n method: z.string(),\n user_id: z.string().optional(),\n path: z.string(),\n resource_type: z.string().optional(),\n resource_id: z.string().optional(),\n partner_id: z.string().optional(),\n payload: payloadSpec,\n timestamp: timestampRequired,\n status_code: z.number()\n});\n","// firestoreTransformUtils.ts\n\nimport { z } from 'zod';\nimport { DocumentReference, Timestamp, Firestore } from 'firebase-admin/firestore';\nimport { FieldSpec } from '../types';\nimport { FirebaseService } from '../services/firebase';\n// Note: Firestore instance must be injected by consumers/tests via factory\n\nexport function createConvertJSToFirestore(db: Firestore) {\n return function convertJSToFirestore(input: any, spec: FieldSpec): any {\n // Handle null/undefined at the top level\n if (input === undefined || input === null) return null;\n\n if (spec instanceof z.ZodType) {\n if (input instanceof Date) return Timestamp.fromDate(input);\n return input; // already valid\n }\n\n if ('_type' in spec) {\n switch (spec._type) {\n case 'timestamp':\n if (input instanceof Date) {\n return Timestamp.fromDate(input);\n } else if (typeof input === 'string' || typeof input === 'number') {\n return Timestamp.fromDate(new Date(input));\n }\n return input;\n case 'docRef':\n return db.collection(spec.collection).doc(input);\n case 'array':\n return input.map((item: any) => convertJSToFirestore(item, spec.of));\n case 'record':\n // For records, filter out undefined values\n return Object.fromEntries(\n Object.entries(input)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [k, convertJSToFirestore(v, spec.of)])\n );\n case 'object':\n if ('of' in spec && typeof spec.of === 'object') {\n const result: any = {};\n for (const [key, fieldSpec] of Object.entries(spec.of)) {\n // Check if the field exists in the input\n if (key in input) {\n const value = input[key];\n\n // Handle based on field optionality and nullability\n if (value === undefined) {\n // Check if field is optional by looking at its spec\n const isOptional = typeof fieldSpec === 'object' && '_type' in fieldSpec && fieldSpec._type === 'optional';\n if (!isOptional) {\n // If not optional but nullable, convert to null\n result[key] = null;\n }\n // If optional, just skip it (don't add to result)\n } else {\n // Normal case - value exists and is not undefined\n result[key] = convertJSToFirestore(value, fieldSpec);\n }\n }\n }\n return result;\n }\n return input;\n default:\n throw new Error(`Unknown field type: ${spec._type}`);\n }\n }\n\n // fallback: plain object shape with explicit schema\n if (typeof input === 'object' && !Array.isArray(input) && typeof spec === 'object') {\n const result: any = {};\n\n for (const [key, fieldSpec] of Object.entries(spec)) {\n if (key in input) {\n const value = input[key];\n\n // Handle undefined values\n if (value === undefined) {\n // Check if field is optional\n const isOptional = typeof fieldSpec === 'object' && '_type' in fieldSpec && fieldSpec._type === 'optional';\n if (!isOptional) {\n // If not optional but nullable, convert to null\n result[key] = null;\n }\n // If optional, don't include in the result\n } else {\n // Normal case - value exists\n result[key] = convertJSToFirestore(value, fieldSpec);\n }\n }\n }\n\n return result;\n }\n\n return input;\n };\n}\n\nfunction isDuckTimestamp(obj: any): obj is { toDate: () => Date } {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.toDate === 'function' &&\n Object.prototype.toString.call(obj.toDate()) === '[object Date]'\n );\n}\n\nfunction isDuckDocumentRef(obj: any): obj is { id: string } {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.id === 'string' &&\n typeof obj.path === 'string'\n );\n}\n\nexport function createConvertFirestoreToJS() {\n return function convertFirestoreToJS(input: any, spec: FieldSpec, path: string[] = []): any {\n const pathString = path.join('.') || '';\n\n // ✅ Convert Firestore-native or duck-typed Timestamp\n if (input instanceof Timestamp || isDuckTimestamp(input)) {\n return input.toDate();\n }\n\n // ✅ Convert Firestore-native or duck-typed DocumentReference\n if (input instanceof DocumentReference || isDuckDocumentRef(input)) {\n return input.id;\n }\n\n if (input === null || input === undefined) return input;\n if (!spec) return input;\n\n if (spec instanceof z.ZodType) {\n // 🔁 Keep in place if it's already a native value\n return input;\n }\n\n if ('_type' in spec) {\n switch (spec._type) {\n case 'timestamp':\n return (input instanceof Timestamp || isDuckTimestamp(input)) ? input.toDate() : input;\n\n case 'docRef':\n return (input instanceof DocumentReference || isDuckDocumentRef(input)) ? input.id : input;\n\n case 'array':\n return Array.isArray(input)\n ? input.map((item, i) => convertFirestoreToJS(item, spec.of, [...path, `[${i}]`]))\n : input;\n\n case 'record':\n if (typeof input !== 'object' || input === null) return input;\n return Object.fromEntries(\n Object.entries(input)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [\n k,\n convertFirestoreToJS(v, spec.of, [...path, k]),\n ])\n );\n\n case 'object':\n if (!spec.of || typeof spec.of !== 'object') return input;\n const result: Record = {};\n for (const [key, fieldSpec] of Object.entries(spec.of)) {\n // Only include properties that exist in the input and aren't undefined\n if (key in input && input[key] !== undefined) {\n result[key] = convertFirestoreToJS(input[key], fieldSpec, [...path, key]);\n }\n }\n return result;\n }\n }\n\n if (typeof spec === 'object' && typeof input === 'object' && !Array.isArray(input)) {\n const result: Record = {};\n for (const [key, valSpec] of Object.entries(spec)) {\n // Only include properties that exist in the input and aren't undefined\n if (key in input && input[key] !== undefined) {\n result[key] = convertFirestoreToJS(input[key], valSpec, [...path, key]);\n }\n }\n return result;\n }\n\n return input;\n };\n}\n\n// For backward compatibility, export the default functions\nexport const convertFirestoreToJS = createConvertFirestoreToJS();\n\n// Backward-compatible helper that lazily uses injected default Firestore instance\nexport function convertJSToFirestore(input: any, spec: FieldSpec): any {\n const firestore = FirebaseService.getDefaultInstance().getFirestore();\n return createConvertJSToFirestore(firestore)(input, spec);\n}\n","import { z, ZodTypeAny } from 'zod';\nimport type { FieldSpec, SchemaFromSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\n\nexport function buildClientSchema(spec: S, path: string[] = []): SchemaFromSpec {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid schema spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec) as unknown as SchemaFromSpec;\n }\n\n // Check if object might be a Zod schema (has _def property or ~standard metadata)\n if (typeof spec === 'object' && spec !== null &&\n (('_def' in spec) || ('~standard' in spec && (spec as any)['~standard']?.vendor === 'zod'))) {\n try {\n // Try to use it as a Zod schema directly\n return wrapZodSchema(spec as unknown as z.ZodTypeAny) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this fails, we'll continue with the other checks\n console.warn(`Failed to use object as Zod schema at \"${pathString}\":`, error);\n }\n }\n\n // ----- Array -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.array(buildClientSchema(spec.of, [...path, '[i]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Record -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.record(buildClientSchema(spec.of, [...path, '[key]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Timestamp -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'timestamp') {\n let schema: ZodTypeAny = z.preprocess((val) => {\n if (typeof val === 'string') {\n // Try to parse the string to a Date object\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date; // undefined will cause z.date() to fail\n }\n if (typeof val === 'number') {\n // Handle numeric timestamps\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date;\n }\n // If it's already a Date or something else, return it as is\n return val;\n }, z.date({ required_error: 'Date is required', invalid_type_error: 'Invalid date format' }));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- DocRef -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'docRef') {\n let schema: ZodTypeAny = z.string(); // only ID on client\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Object (plain nested object spec) -----\n if (\n typeof spec === 'object' &&\n spec !== null &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || (typeof spec === 'object' && spec !== null && '_type' in spec && (spec as any)._type === 'object')) {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // If we have an object with fields that look like schema specs, try to handle it as a schema object\n if (typeof spec === 'object' && spec !== null) {\n try {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this also fails, we'll throw the error below\n console.warn(`Failed to handle object as plain schema at \"${pathString}\":`, error);\n }\n }\n\n // 🔥 If we got here, the spec had a structure we didn't handle\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n}\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional, PERMISSION_COLLECTION } from './common';\n\nexport const roleSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional } from './common';\n\nexport const permissionSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { buildClientSchema } from './builders/client';\nimport {\n userSchemaSpec,\n apiKeySpec,\n apiKeysSpec,\n apiKeysObjectSpec\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { bondioPackageSchema, packageSchemaSpec, telnaPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n financialPropertiesSchemaSpec as financialPropertiesSchema,\n packagePriceSchema,\n platformSettingsSchema,\n visualIdentitySchema,\n pricingStrategySchema,\n freeEsimSchema,\n} from './specs/partner';\nimport { analyticsSpec } from './specs/analytics';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { roleSchemaSpec } from './specs/role';\nimport { permissionSchemaSpec } from './specs/permission';\n\nexport const HUserSchema = buildClientSchema(userSchemaSpec);\nexport const HBookingSchema = buildClientSchema(bookingSchemaSpec);\nexport const HCountrySchema = buildClientSchema(countrySchemaSpec);\nexport const HCurrencySchema = buildClientSchema(currencySchemaSpec);\nexport const HESIMSchema = buildClientSchema(esimSchemaSpec);\nexport const HPaymentSchema = buildClientSchema(paymentSchemaSpec);\nexport const HMessageSchema = buildClientSchema(messageSchemaSpec);\nexport const HPackageSchema = buildClientSchema(packageSchemaSpec);\nexport const HPromoCodeSchema = buildClientSchema(promoCodeSchemaSpec);\nexport const HPartnerSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPriceListSchema = buildClientSchema(priceListSchemaSpec);\nexport const HFinancialPropertiesSchema = buildClientSchema(financialPropertiesSchema);\nexport const HApiLogSchema = buildClientSchema(apiLogSchemaSpec);\nexport const HPackagePriceSchema = buildClientSchema(packagePriceSchema);\nexport const HubbyModelSchema = buildClientSchema(hubbyModelSpec);\nexport const HPartnerAppSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPlatformSettingsSchema = buildClientSchema(platformSettingsSchema);\nexport const HVisualIdentitySchema = buildClientSchema(visualIdentitySchema);\nexport const HPricingStrategySchema = buildClientSchema(pricingStrategySchema);\nexport const HFreeEsimSchema = buildClientSchema(freeEsimSchema);\nexport const HAnalyticsSchema = buildClientSchema(analyticsSpec);\nexport const HRoleSchema = buildClientSchema(roleSchemaSpec);\nexport const HPermissionSchema = buildClientSchema(permissionSchemaSpec);\nexport const HTagSchema = buildClientSchema(tagModelSpec);\nexport const HTrafficPolicySchema = buildClientSchema(trafficPolicySpec);\nexport const HTelnaPackageSchema = buildClientSchema(telnaPackageSchema);\nexport const HBondioPackageSchema = buildClientSchema(bondioPackageSchema);\n// Additional lower-level schemas\nexport const HAddressSchema = addressSchema;\nexport const HRegistrationSchema = registrationSchema;\nexport const HBankingDetailsSchema = bankingDetailsSchema;\nexport const HPartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const HPromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const HVisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const HScheduleFilterSchema = scheduleFilterSchema;\nexport const HPartnerContactSchema = partnerContactSchema;\nexport const HPartnerDataSchema = partnerDataSchema;\nexport const HCommunicationChannelSchema = communicationChannelSchema;\nexport const HBookingStatusSchema = bookingStatusSchema;\nexport const HCommunicationOptionsSchema = communicationOptionsSchema;\n\nexport type HAnalytics = z.infer;\nexport type HUser = z.infer;\nexport type HBooking = z.infer;\nexport type HCountry = z.infer;\nexport type HCurrency = z.infer;\nexport type HESIM = z.infer;\nexport type HPayment = z.infer;\nexport type HMessage = z.infer;\nexport type HPackage = z.infer;\nexport type HPromoCode = z.infer;\nexport type HPartner = z.infer;\nexport type HPriceList = z.infer;\nexport type HApiLog = z.infer;\nexport type HTag = z.infer;\nexport type HTrafficPolicy = z.infer;\nexport type HBondioPackage = z.infer;\nexport type HTelnaPackage = z.infer;\n// Additional lower-level types\nexport type HAddress = z.infer;\nexport type HRegistration = z.infer;\nexport type HBankingDetails = z.infer;\nexport type HPartnerPackageSpecification = z.infer;\nexport type HPromoPackageSpecification = z.infer;\nexport type HVisualIdentityBanner = z.infer;\nexport type HFinancialProperties = z.infer;\nexport type HScheduleFilter = z.infer;\nexport type HPartnerContact = z.infer;\nexport type HPartnerData = z.infer;\nexport type HCommunicationChannel = z.infer;\nexport type HBookingStatus = z.infer;\nexport type HCommunicationOptions = z.infer;\nexport type HHubbyModel = z.infer;\n\nexport type HubbyModelApp = HHubbyModel;\n\nexport type SupportedLocales = typeof SUPPORTED_LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\nexport type HRole = z.infer;\nexport type HPermission = z.infer; ","import { Firestore } from 'firebase-admin/firestore';\nimport {\n createConvertJSToFirestore,\n createConvertFirestoreToJS\n} from './firestoreTransformUtils';\nimport { FieldSpec } from '../types';\n\n/**\n * Creates converter functions for a specific model type with dependency injection.\n * This lets you use the conversion functions with your own Firebase instance.\n * \n * @param db - Firestore instance to use for document references\n * @param modelSchemaSpec - Schema specification for the model\n * @returns Object with to/from Firestore conversion functions\n */\nexport function createModelConverters(\n db: Firestore,\n modelSchemaSpec: FieldSpec\n) {\n const convertToFirestore = createConvertJSToFirestore(db);\n const convertFromFirestore = createConvertFirestoreToJS();\n\n return {\n /**\n * Converts a model instance to Firestore format\n */\n toFirestore: (model: TModel): TFirestore => {\n return convertToFirestore(model, modelSchemaSpec);\n },\n\n /**\n * Converts Firestore data to a model instance\n */\n fromFirestore: (firestoreData: TFirestore): TModel => {\n return convertFromFirestore(firestoreData, modelSchemaSpec);\n }\n };\n} ","import { buildServerSchema } from './builders/server';\nimport {\n userSchemaSpec,\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { analyticsSpec } from './specs/analytics';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { packageSchemaSpec, telnaPackageSchema, bondioPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n visualIdentityBannersSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n scheduleSchema,\n visualIdentitySchema,\n packagePriceSchemaSpec,\n platformSettingsSchemaSpec\n} from './specs/partner';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { DocumentReference, Timestamp } from 'firebase-admin/firestore';\n\n\nimport { convertFirestoreToJS, convertJSToFirestore } from './utils/firestoreTransformUtils';\nimport { HPartner, HPriceList, HPromoCode } from './index.client';\nimport { buildClientSchema } from './builders/client';\n\nexport { partnerSchemaSpec, analyticsSpec, packageSchemaSpec };\n\nexport const UserSchema = buildServerSchema(userSchemaSpec);\nexport const UserFirestoreSchema = buildServerSchema(userSchemaSpec);\nexport const BookingSchema = buildServerSchema(bookingSchemaSpec);\nexport const CountrySchema = buildServerSchema(countrySchemaSpec);\nexport const CurrencySchema = buildServerSchema(currencySchemaSpec);\nexport const ESIMSchema = buildServerSchema(esimSchemaSpec);\nexport const PaymentSchema = buildServerSchema(paymentSchemaSpec);\nexport const MessageSchema = buildServerSchema(messageSchemaSpec);\nexport const PackageSchema = buildServerSchema(packageSchemaSpec);\nexport const PromoCodeSchema = buildServerSchema(promoCodeSchemaSpec);\nexport const PartnerSchema = buildServerSchema(partnerSchemaSpec);\nexport const PriceListSchema = buildServerSchema(priceListSchemaSpec);\nexport const ApiLogSchema = buildServerSchema(apiLogSchemaSpec);\nexport const VisualIdentitySchema = buildServerSchema(visualIdentitySchema);\nexport const PackagePriceSchema = buildServerSchema(packagePriceSchemaSpec);\nexport const PlatformSettingsSchema = buildServerSchema(platformSettingsSchemaSpec);\nexport const ScheduleSchema = buildServerSchema(scheduleSchema);\nexport const AnalyticsSchema = buildServerSchema(analyticsSpec);\nexport const TagSchema = buildServerSchema(tagModelSpec);\nexport const TelnaPackageSchema = buildServerSchema(telnaPackageSchema);\nexport const BondioPackageSchema = buildServerSchema(bondioPackageSchema);\nexport const TrafficPolicySchema = buildServerSchema(trafficPolicySpec);\n\n// Additional lower-level schemas\nexport const AddressSchema = addressSchema;\nexport const RegistrationSchema = registrationSchema;\nexport const BankingDetailsSchema = bankingDetailsSchema;\nexport const PartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const PromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const VisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const ScheduleFilterSchema = scheduleFilterSchema;\nexport const PartnerContactSchema = partnerContactSchema;\nexport const PartnerDataSchema = partnerDataSchema;\nexport const CommunicationChannelSchema = communicationChannelSchema;\nexport const BookingStatusSchema = bookingStatusSchema;\nexport const CommunicationOptionsSchema = communicationOptionsSchema;\nexport const VisualIdentityBannersSchema = visualIdentityBannersSchema;\n\nexport type User = z.infer;\nexport type UserFirestore = z.infer;\nexport type Booking = z.infer;\nexport type Country = z.infer;\nexport type Currency = z.infer;\nexport type ESIM = z.infer;\nexport type Payment = z.infer;\nexport type Message = z.infer;\nexport type Package = z.infer;\nexport type PromoCode = z.infer;\nexport type Partner = z.infer;\nexport type PriceList = z.infer;\nexport type ApiLog = z.infer;\nexport type Analytics = z.infer;\nexport type Schedule = z.infer;\nexport type TelnaPackage = z.infer;\nexport type BondioPackage = z.infer;\nexport type TrafficPolicy = z.infer;\n\n// Additional lower-level types\nexport type Address = z.infer;\nexport type Registration = z.infer;\nexport type BankingDetails = z.infer;\nexport type PartnerPackageSpecification = z.infer;\nexport type PackageSpecification = z.infer;\nexport type VisualIdentity = z.infer;\nexport type VisualIdentityBanner = z.infer;\nexport type VisualIdentityBanners = z.infer;\nexport type VisualIdentityBannerStrategy = VisualIdentityBanners;\nexport type ScheduleFilter = z.infer;\nexport type PartnerContact = z.infer;\nexport type PartnerData = z.infer;\nexport type CommunicationChannel = z.infer;\nexport type BookingStatus = z.infer;\nexport type CommunicationOptions = z.infer;\nexport type PackagePrice = z.infer;\nexport type PlatformSettings = z.infer;\nexport type BookingApiRequest = Booking;\nexport type BookingApiResponse = Booking;\nexport type PartnerApiRequest = Partner;\nexport type PartnerApiResponse = Partner;\nexport type PriceListApiRequest = PriceList;\nexport type PriceListApiResponse = PriceList;\nexport type ApiLogApiRequest = ApiLog;\nexport type ApiLogApiResponse = ApiLog;\nexport type Tag = z.infer;\n\nexport * from './index.client';\n\nexport type HubbyModel = {\n id: string;\n created_at: Date;\n updated_at: Date | null;\n created_by: string;\n updated_by: string | null;\n}\n\nexport type HubbyModelFirestore = {\n id: string;\n created_at: Timestamp;\n updated_at: Timestamp | null;\n created_by: DocumentReference | null | string;\n updated_by: DocumentReference | null | string;\n}\n\nexport const partnerFromFirestore = (partner: Partner): HPartner => {\n return convertFirestoreToJS(partner, partnerSchemaSpec);\n}\n\nexport const partnerToFirestore = (partner: HPartner): Partner => {\n return convertJSToFirestore(partner, partnerSchemaSpec);\n}\n\nexport const userToFirestore = (user: User): UserFirestore => {\n return convertJSToFirestore(user, userSchemaSpec);\n}\n\nexport const userFromFirestore = (user: UserFirestore): User => {\n return convertFirestoreToJS(user, userSchemaSpec);\n}\n\nexport const priceListFromFirestore = (priceList: PriceList): HPriceList => {\n return convertFirestoreToJS(priceList, priceListSchemaSpec);\n}\n\nexport const priceListToFirestore = (priceList: HPriceList): PriceList => {\n return convertJSToFirestore(priceList, priceListSchemaSpec);\n}\n\nexport const promoCodeFromFirestore = (promoCode: PromoCode): HPromoCode => {\n return convertFirestoreToJS(promoCode, promoCodeSchemaSpec);\n}\n\nexport const promoCodeToFirestore = (promoCode: HPromoCode): PromoCode => {\n return convertJSToFirestore(promoCode, promoCodeSchemaSpec);\n}\n\nexport const partnerAppSchema = buildClientSchema(partnerSchemaSpec);\n// Export the type and constant\nexport type SupportedLocales = typeof LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\n// Dependency Injection exports\nexport { createModelConverters } from './utils/modelConverterFactory';\nexport { createConvertJSToFirestore, createConvertFirestoreToJS } from './utils/firestoreTransformUtils';\nexport { FirebaseService, createFirebaseService } from './services/firebase';"]} \ No newline at end of file +{"version":3,"sources":["../src/builders/server.ts","../src/common.ts","../src/services/firebase.ts","../src/specs/user.ts","../src/specs/common.ts","../src/specs/booking.ts","../src/constants.ts","../src/specs/promocode.ts","../src/specs/country.ts","../src/specs/currency.ts","../src/specs/esim.ts","../src/specs/payment.ts","../src/specs/analytics.ts","../src/specs/message.ts","../src/specs/traffic_policy.ts","../src/specs/package.ts","../src/specs/partner.ts","../src/specs/apiLogs.ts","../src/utils/firestoreTransformUtils.ts","../src/builders/client.ts","../src/specs/role.ts","../src/specs/permission.ts","../src/index.client.ts","../src/utils/modelConverterFactory.ts","../src/index.server.ts"],"names":["z","packageSpecificationSchema","Timestamp","convertJSToFirestore","convertFirestoreToJS","SUPPORTED_LOCALES"],"mappings":";AAAA,SAAS,KAAAA,UAAS;AAClB,SAAS,iBAAiB;;;ACD1B,SAAqB,SAAS;AAQvB,SAAS,cACZ,QACA,SAQU;AACV,MAAI,CAAC;AAAS,WAAO;AAErB,MAAI,UAAU;AAGd,MAAI,QAAQ,YAAY,CAAC,QAAQ,aAAa,GAAG;AAC7C,cAAU,QAAQ,SAAS;AAA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BAAqB,WAAW,mBAAmB;AAC9D;AAEO,IAAM,mBAAmB,kBAAkB,iBAAiB;AAG5D,IAAMI,qBAAoB","sourcesContent":["import { z } from 'zod';\nimport { Timestamp } from 'firebase-admin/firestore';\nimport type { FieldSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\nimport { FirebaseService } from '../services/firebase';\n\nexport const buildServerSchema = (spec: FieldSpec, path: string[] = []): z.ZodTypeAny => {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod schema passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec);\n }\n\n // ----- Array -----\n if ('_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n\n const itemSchema =\n spec.of instanceof z.ZodType\n ? spec.of\n : buildServerSchema(spec.of, [...path, '[i]']);\n\n let arraySchema = z.array(itemSchema);\n if (spec.nullable) arraySchema = arraySchema.nullable();\n if (spec.optional) arraySchema = arraySchema.optional();\n return arraySchema;\n }\n\n // ----- Record -----\n if ('_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n\n const valueSchema =\n spec.of instanceof z.ZodType\n ? spec.of\n : buildServerSchema(spec.of, [...path, '[key]']);\n\n let recordSchema = z.record(valueSchema);\n if (spec.nullable) recordSchema = recordSchema.nullable();\n if (spec.optional) recordSchema = recordSchema.optional();\n return recordSchema;\n }\n\n // ----- Timestamp -----\n if ('_type' in spec && spec._type === 'timestamp') {\n let tsSchema = z.date().transform(date => Timestamp.fromDate(date));\n if (spec.nullable) tsSchema = tsSchema.nullable();\n if (spec.optional) tsSchema = tsSchema.optional();\n return tsSchema;\n }\n\n // ----- Document Reference -----\n if ('_type' in spec && spec._type === 'docRef') {\n let refSchema = z.string().transform(id => {\n const firestore = FirebaseService.getDefaultInstance().getFirestore()\n return firestore.collection(spec.collection).doc(id);\n });\n if (spec.nullable) refSchema = refSchema.nullable();\n if (spec.optional) refSchema = refSchema.optional();\n return refSchema;\n }\n\n // ----- Nested object shape -----\n if (typeof spec === 'object' && !('_type' in spec)) {\n const shape: Record = {};\n for (const [key, val] of Object.entries(spec)) {\n shape[key] = buildServerSchema(val, [...path, key]);\n }\n return z.object(shape);\n }\n\n // ----- Object -----\n if (\n typeof spec === 'object' &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildServerSchema);\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || typeof spec === 'object' && '_type' in spec && spec._type === 'object') {\n return wrapPlainObjectSchema(spec, path, buildServerSchema);\n }\n\n // ----- Unknown or malformed spec -----\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n};\n","import { ZodTypeAny, z } from 'zod';\nimport type { SchemaBuilder } from './types';\n\n/**\n * Ensures a Zod schema is wrapped to be optional and/or nullable,\n * if not already. Use this in recursive schema builders.\n * Also applies any other supported schema transformations provided in options.\n */\nexport function wrapZodSchema(\n schema: ZodTypeAny,\n options?: {\n optional?: boolean;\n nullable?: boolean;\n min?: number;\n max?: number;\n // Allow arbitrary extensions via dynamic property\n [key: string]: any;\n }\n): ZodTypeAny {\n if (!options) return schema;\n\n let wrapped = schema;\n\n // Handle nullable and optional specially since they're common\n if (options.nullable && !wrapped.isNullable?.()) {\n wrapped = wrapped.nullable();\n }\n\n if (options.optional && !wrapped.isOptional?.()) {\n wrapped = wrapped.optional();\n }\n\n // Process all other options dynamically\n for (const [key, value] of Object.entries(options)) {\n // Skip the already handled properties and undefined values\n if (['nullable', 'optional'].includes(key) || value === undefined) {\n continue;\n }\n\n // Check if the schema has a method matching the option key\n if (typeof (wrapped as any)[key] === 'function') {\n wrapped = (wrapped as any)[key](value);\n }\n }\n\n return wrapped;\n}\n\nexport function wrapObjectSchema(\n spec: any, // using any to support dynamic `spec.type === 'object'`\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n if (!('of' in spec)) {\n throw new Error(`Object spec at \"${pathString}\" is missing 'of'`);\n }\n\n const shape: Record = {};\n for (const [key, value] of Object.entries(spec.of)) {\n shape[key] = builder(value as any, [...path, key]);\n }\n\n let objectSchema: ZodTypeAny = z.object(shape);\n if (spec.nullable) objectSchema = objectSchema.nullable();\n if (spec.optional) objectSchema = objectSchema.optional();\n return objectSchema;\n}\n\n/**\n * Wraps a plain object shape (no `type: 'object'`) into a Zod schema.\n * Assumes each field is either a Zod schema or another FieldSpec.\n */\nexport function wrapPlainObjectSchema(\n spec: Record,\n path: string[],\n builder: SchemaBuilder\n): ZodTypeAny {\n const pathString = path.join('.');\n\n // Handle object field specs with '_type': 'object'\n if ('_type' in spec && spec._type === 'object' && 'of' in spec) {\n return wrapObjectSchema(spec, path, builder);\n }\n\n const shape: Record = {};\n\n // Only add fields to the schema if they're not special control properties\n for (const [key, val] of Object.entries(spec)) {\n if (key !== '_type' && key !== 'nullable' && key !== 'optional') {\n shape[key] = builder(val, [...path, key]);\n }\n }\n\n // Create the base object schema\n let schema: ZodTypeAny = z.object(shape);\n\n // Apply nullable/optional modifiers if needed\n if ('nullable' in spec && spec.nullable === true) {\n schema = schema.nullable();\n }\n\n if ('optional' in spec && spec.optional === true) {\n schema = schema.optional();\n }\n\n return schema;\n}\n\nexport const SCHEMA_MARKER = Symbol('ZodSchemaSpecMarker');\n\nexport function markAsSchemaSpec(spec: T): T {\n Object.defineProperty(spec, SCHEMA_MARKER, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return spec;\n}\n\nexport function isSchemaSpec(obj: unknown): obj is Record {\n return typeof obj === 'object' && obj !== null && SCHEMA_MARKER in obj;\n}","import { getApps, initializeApp, cert, AppOptions, App } from \"firebase-admin/app\";\nimport { getFirestore, Firestore } from \"firebase-admin/firestore\";\nimport { applicationDefault } from \"firebase-admin/app\";\n\nexport interface FirebaseConfig {\n credential?: AppOptions['credential'];\n projectId?: string;\n storageBucket?: string;\n databaseURL?: string;\n // Options for testing\n isTest?: boolean;\n}\n\n// Define variable to hold singleton instance (must be injected by consumer/tests)\nlet defaultInstance: FirebaseService | null = null;\n\nexport class FirebaseService {\n\n private firestoreInstance: Firestore;\n constructor(db: Firestore) {\n this.firestoreInstance = db;\n }\n\n getFirestore(): Firestore {\n return this.firestoreInstance;\n }\n\n // Get default instance with singleton pattern\n public static getDefaultInstance(): FirebaseService {\n if (defaultInstance === null) {\n throw new Error(\n \"FirebaseService default instance not set. Inject a FirebaseService via FirebaseService.setDefaultInstance(...) in your application startup or test setup.\"\n );\n }\n return defaultInstance;\n }\n\n // Allow for setting a custom default instance (useful for tests)\n public static setDefaultInstance(instance: FirebaseService): void {\n defaultInstance = instance;\n }\n}\n\n// Function to create a new Firebase service instance (use in tests or by consumers before injection)\nexport function createFirebaseService(db: Firestore): FirebaseService {\n return new FirebaseService(db);\n}","import { z } from 'zod';\nimport { PARTNER_COLLECTION, PROFILE_COLLECTION, timestampNullableOptional, timestampRequired, timestampNullable, ROLE_COLLECTION, PERMISSION_COLLECTION } from './common';\nimport { markAsSchemaSpec } from '../common'\n\nexport const apiKeySpec = {\n expires_at: { _type: 'timestamp' as const },\n secret: z.string(),\n is_active: z.boolean(),\n}\n\nexport const apiKeysSpec = {\n _type: 'record' as const,\n of: {\n _type: 'object' as const,\n of: apiKeySpec\n }\n}\n\nexport const apiKeysObjectSpec = {\n _type: 'object' as const,\n of: {\n allowed_keys: { _type: 'array' as const, nullable: true, optional: true, of: z.string() },\n keys: apiKeysSpec\n },\n nullable: true,\n optional: true\n}\n\nexport const userSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string().nullable(),\n email: z.string().email().nullable(),\n stripe_id: z.string().nullable().optional(),\n referral: z.string().nullable().optional(),\n fcm: z.string().optional(),\n deeplink: z.string().nullable().optional(),\n gender: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n coordinates: z.string().nullable().optional(),\n parameters: z.any().nullable().optional(),\n locale: z.string().nullable().optional(),\n phone_model: z.string().nullable().optional(),\n phone_os: z.string().nullable().optional(),\n phone_os_version: z.string().nullable().optional(),\n ios: z.boolean().nullable().optional(),\n has_card_saved: z.boolean().nullable().optional(),\n admin: z.boolean().nullable().optional(),\n api_keys: apiKeysObjectSpec,\n currency: z.string().nullable().optional(),\n receipt_email: z.string().nullable().optional(),\n source: z.enum(['direct', 'promo', 'platform']).nullable().optional(),\n role: { _type: 'docRef' as const, collection: ROLE_COLLECTION, optional: true, nullable: true },\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n balance: z.number().nullable().optional(),\n createdAt: { _type: 'timestamp' as const },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, optional: true, nullable: true },\n profileRef: { _type: 'docRef' as const, collection: PROFILE_COLLECTION, optional: true, nullable: true },\n review_requested: timestampNullableOptional,\n last_seen: timestampNullableOptional\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\n\n// Collection paths\nexport const PARTNER_COLLECTION = '/companies/hubby/partners';\nexport const USER_COLLECTION = 'users';\nexport const PROFILE_COLLECTION = '/companies/hubby/profiles';\nexport const PACKAGE_COLLECTION = '/companies/hubby/packages';\nexport const PROMO_CODE_COLLECTION = '/companies/hubby/promo_codes';\nexport const COUNTRY_COLLECTION = 'countries';\nexport const ESIM_COLLECTION = 'esims';\nexport const PAYMENT_COLLECTION = 'payments';\nexport const PRICE_LIST_COLLECTION = 'price_lists';\nexport const BOOKING_COLLECTION = 'bookings';\nexport const MESSAGE_COLLECTION = 'messages';\nexport const CURRENCY_COLLECTION = 'currencies';\nexport const API_LOG_COLLECTION = 'api_logs'\nexport const ROLE_COLLECTION = 'roles';\nexport const PERMISSION_COLLECTION = 'permissions';\nexport const TRAFFIC_POLICY_COLLECTION = 'traffic_policies';\n\n// Timestamp specs\nexport const timestampNullableOptional = { _type: 'timestamp' as const, nullable: true, optional: true };\nexport const timestampNullable = { _type: 'timestamp' as const, nullable: true, optional: false };\nexport const timestampRequired = { _type: 'timestamp' as const, nullable: false, optional: false };\n\nexport const hubbyModelSpec = {\n id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n created_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n updated_by: { _type: 'docRef' as const, collection: 'users', nullable: true, optional: true },\n}\n\nexport const tagModelSpec = {\n ...hubbyModelSpec,\n slug: z.string(),\n name: z.string(),\n description: z.string().nullable().optional(),\n color: z.string().nullable().optional(),\n}","import { z } from 'zod';\nimport {\n PARTNER_COLLECTION,\n PROMO_CODE_COLLECTION,\n USER_COLLECTION,\n ESIM_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema } from '../constants';\nimport { packageSpecificationSchema } from './promocode';\n\n// Enum for communication channels\nexport const communicationChannelSchema = z.enum([\n 'EMAIL',\n 'WHATSAPP',\n 'PUSH_NOTIFICATION',\n 'SMS'\n]);\nexport type CommunicationChannelType = z.infer;\n\n// For backward compatibility\nexport type CommunicationChannel = CommunicationChannelType;\n\n// Add enum-like object for use in code\nexport const CommunicationChannel = {\n EMAIL: 'EMAIL' as const,\n WHATSAPP: 'WHATSAPP' as const,\n PUSH_NOTIFICATION: 'PUSH_NOTIFICATION' as const,\n SMS: 'SMS' as const\n} as const;\n\n// Status type for bookings\nexport const bookingStatusSchema = z.enum([\n 'PENDING',\n 'CONFIRMED',\n 'COMPLETED',\n 'CANCELLED',\n 'UNPAID',\n 'EXPIRED'\n]);\nexport type BookingStatus = z.infer;\n\n// Communication options schema\nexport const communicationOptionsSchema = z.object({\n should_send_message: z.boolean(),\n channels: z.array(communicationChannelSchema)\n});\n\nexport type CommunicationOptions = z.infer;\n\n// Define the booking schema spec\nexport const bookingSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n external_id: z.string().nullable().optional(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n title: z.string().nullable(),\n first_name: z.string().nullable().optional(),\n last_name: z.string().nullable().optional(),\n full_name: z.string().nullable().optional(),\n pax: z.number(),\n email: z.string().email().nullable(),\n phone: z.string().nullable(),\n booking_id: z.string().nullable(),\n flight_number: z.string().optional(),\n gender: z.enum(['M', 'F', 'O']).optional(),\n package_size: z.string().optional(),\n sent_messages: z.record(z.any()).optional(),\n locale: supportedLocalesSchema,\n status: bookingStatusSchema,\n data: {\n _type: 'object' as const,\n of: {\n source: z.string(),\n manual: z.boolean()\n }\n },\n communication_options: {\n _type: 'object' as const,\n of: {\n should_send_message: z.boolean(),\n channels: {\n _type: 'array' as const,\n of: communicationChannelSchema\n }\n }\n },\n is_processed_for_esim_restoration: z.boolean(),\n is_pseudonymized: z.boolean(),\n import_id: z.string().nullable().optional(),\n package_specifications: z.array(packageSpecificationSchema).min(1),\n departure_date: timestampRequired,\n return_date: timestampNullable,\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION },\n promo_codes: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: PROMO_CODE_COLLECTION }\n },\n users: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: USER_COLLECTION },\n nullable: true\n },\n esims: {\n _type: 'array' as const,\n of: { _type: 'docRef' as const, collection: ESIM_COLLECTION },\n nullable: true\n }\n});\n\n","import { z } from \"zod\";\n\nexport const SUPPORTED_LOCALES = [\n \"en-US\",\n \"en-EU\",\n \"en-GB\",\n \"en-CA\",\n \"nl-NL\",\n \"de-DE\",\n \"fr-FR\",\n \"it-IT\",\n \"es-ES\",\n \"cs-CZ\",\n \"pl-PL\",\n \"pt-PT\",\n \"fr-BE\",\n \"nl-BE\",\n \"de-AT\",\n \"de-CH\",\n \"fr-CH\",\n \"it-CH\",\n \"sv-SE\",\n \"sk-SK\",\n \"de-BE\",\n \"en-AU\",\n \"da-DK\",\n] as const;\n\n// Define the type using TypeScript's typeof and indexing\n\n// Define the type using TypeScript's typeof and indexing\nexport type SupportedLocales = (typeof SUPPORTED_LOCALES)[number];\n\n// Create a Zod schema for validation\nexport const supportedLocalesSchema = z.enum(SUPPORTED_LOCALES);\n\n// Type inference from the schema (alternative way to define the type)\nexport type SupportedLocalesFromSchema = z.infer;\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n PARTNER_COLLECTION,\n COUNTRY_COLLECTION,\n PACKAGE_COLLECTION,\n BOOKING_COLLECTION,\n PROMO_CODE_COLLECTION,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// Define package specification schema for use in promo code\nexport const packageSpecificationSchema = z.object({\n destination: z.string().optional(),\n size: z.string().optional(),\n package_id: z.string().optional(),\n iata_code: z.string().optional(),\n package_duration: z.number().optional(),\n package_type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).optional(),\n traffic_policy: z.string().optional(),\n});\n\n// Define the promo code schema spec\nexport const promoCodeSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n redeemed_at: timestampNullableOptional,\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // PromoCode specific fields\n external_id: z.string(),\n code: z.string(),\n allowance_user: z.number(),\n allowance_total: z.number(),\n type: z.enum(['discount', 'booking', 'booking_without_destination']).nullable().or(z.string()),\n usage: z.array(z.string()),\n uuid_usage: z.array(z.string()),\n package_specification: packageSpecificationSchema.optional(),\n valid_from: timestampRequired,\n valid_to: timestampRequired,\n\n // Reference fields\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION, nullable: true },\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n booking: { _type: 'docRef' as const, collection: BOOKING_COLLECTION, nullable: true },\n\n // Optional fields based on the type\n discount: z.number().optional(),\n package_size: z.string().optional(),\n countries: z.array(z.string()).optional(),\n max_bytes: z.number().optional(),\n starter_data: z.number().optional()\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const countrySchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n bokun_id: z.number().nullable(),\n LTE: z.boolean().nullable(),\n apn: z.string().nullable(),\n click_count: z.number().nullable(),\n global_network: z.string().nullable(),\n global_price: z.number().nullable(),\n hubby: z.number().nullable(),\n imsi: z.number().nullable(),\n has_esim: z.boolean(),\n name: z.string().nullable(),\n region: z.boolean().nullable(),\n i18n_name: z.record(z.string()),\n is_region: z.boolean().nullable(),\n countries: z.array(z.string()).nullable(),\n tier: z.number().nullable()\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define schema for conversion rates (for backward compatibility)\nexport const conversionRateSchema = z.object({\n currency: z.number()\n});\n\nexport type CoversionRate = z.infer;\n\n// Define the currency schema spec\nexport const currencySchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n // ISO 4217 currency code (e.g., \"USD\", \"EUR\")\n code: z.string().describe('ISO 4217 currency code (e.g., \"USD\", \"EUR\")'),\n // Currency symbol (e.g., \"$\", \"€\")\n symbol: z.string().describe('Currency symbol (e.g., \"$\", \"€\")'),\n // Full name of the currency (e.g., \"US Dollar\")\n name: z.string().describe('Full name of the currency (e.g., \"US Dollar\")'),\n // Exchange rate relative to base currency\n rate: z.number().describe('Exchange rate relative to base currency'),\n // Whether this is the default currency\n is_default: z.boolean().describe('Whether this is the default currency')\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n USER_COLLECTION,\n PARTNER_COLLECTION,\n PAYMENT_COLLECTION,\n timestampNullable,\n timestampRequired\n} from './common';\n\n// Define the eSIM schema spec\nexport const esimSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Common eSIM fields\n imsi: z.number(),\n qr: z.string(),\n iccid: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable().optional(),\n total_data: z.number(),\n data_left: z.number(),\n data_used: z.boolean(),\n status: z.string().nullable(),\n name: z.string(),\n android_auto: z.boolean(),\n partner_price: z.number().nullable(),\n promo: z.string().nullable(),\n type: z.enum(['api', 'promo', 'balance', 'code', 'external', 'payment']),\n is_auto_install: z.boolean(),\n is_archived: z.boolean(),\n user: z.string().nullable(),\n payment: z.string().nullable(),\n apn: z.string().nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION, nullable: true },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Timestamp fields\n time_assigned: timestampNullable,\n last_updated: timestampNullable\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n USER_COLLECTION,\n timestampRequired\n} from './common';\n\n// Define the payment schema spec\nexport const paymentSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Payment specific fields\n amount: z.number(),\n customer: z.string(),\n date: timestampRequired,\n iccid: z.string(),\n package: z.string(),\n promo: z.string(),\n topup: z.boolean(),\n\n // Reference fields\n user: { _type: 'docRef' as const, collection: USER_COLLECTION, nullable: true, optional: true }\n});\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec, PARTNER_COLLECTION } from './common';\n\n// Country schema spec\nexport const analyticsSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n service: z.string(),\n date: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/), // YYYY-MM-DD\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n event: z.string(),\n parameter: z.string().nullable(),\n sum: z.number(),\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired } from './common';\n\n// Define the message schema spec\nexport const messageSchemaSpec = markAsSchemaSpec({\n id: z.string(),\n key: z.string(),\n method: z.enum([\"push\", \"sms\", \"email\"]),\n status: z.enum([\"pending\", \"sent\", \"failed\", \"delivered\"]),\n created_at: timestampRequired,\n updated_at: timestampRequired\n});\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { hubbyModelSpec } from './common';\n\n// Country schema spec\nexport const trafficPolicySpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n name: z.string(),\n description: z.string(),\n external_id: z.string(),\n provider: z.string()\n})","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport {\n COUNTRY_COLLECTION,\n PARTNER_COLLECTION,\n TRAFFIC_POLICY_COLLECTION,\n timestampRequired,\n hubbyModelSpec\n} from './common';\n\nimport { countrySchemaSpec } from './country';\n\n// Define the package schema spec\nexport const packageSchemaSpec = markAsSchemaSpec({\n ...hubbyModelSpec,\n // Package specific fields\n external_id: z.string(),\n provider: z.string(),\n coverage_label: z.string().nullable(),\n label: z.string(),\n bytes: z.number(),\n hidden: z.boolean(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n price: z.number(),\n partner_price: z.number(),\n days: z.number(),\n name: z.string(),\n type: z.enum(['data-limited', 'time-limited', 'starter', 'unlimited']).nullable(),\n throttling: z.number().optional(),\n provider_parameters: z.object({\n imsi: z.number()\n }).nullable(),\n\n // Reference fields\n country: { _type: 'docRef' as const, collection: COUNTRY_COLLECTION },\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n\n // Nested country data - need to use dynamic reference to country schema\n // This would typically be handled better with a proper recursive schema definition\n // but for simplicity, we're using any type here\n country_data: {\n _type: 'object' as const,\n of: countrySchemaSpec,\n nullable: true,\n optional: true\n }\n // country_data: z.any().nullable()\n});\n\nexport const commonPackageSchema = markAsSchemaSpec({\n size: z.string(),\n iso: z.string(),\n days: z.number(),\n price: z.number(),\n is_hidden: z.boolean(),\n is_active: z.boolean(),\n priority: z.number(),\n packageType: z.string(),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n});\n\nexport const telnaPackageSchema = markAsSchemaSpec({\n traffic_policy: { _type: 'docRef' as const, collection: TRAFFIC_POLICY_COLLECTION, nullable: true },\n ...commonPackageSchema,\n});\n\nexport const bondioPackageSchema = markAsSchemaSpec({\n ...commonPackageSchema,\n label: z.enum(['lambda', 'tau']),\n});","import { z, ZodLazy } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { supportedLocalesSchema, SUPPORTED_LOCALES, SupportedLocales } from '../constants';\nimport {\n PARTNER_COLLECTION,\n USER_COLLECTION,\n PACKAGE_COLLECTION,\n PRICE_LIST_COLLECTION,\n tagModelSpec,\n timestampRequired,\n timestampNullableOptional\n} from './common';\n\n// ===== Helper schemas for nested structures =====\n\n// Address schema\nexport const addressSchema = z.object({\n street: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n postal_code: z.string().nullable().optional(),\n country: z.string().nullable().optional()\n});\n\n// Emit event schema\nexport const emitEventSchema = z.object({\n topup: z.boolean().optional().default(false),\n redemption: z.boolean().optional().default(false),\n activation: z.boolean().optional().default(false),\n depletion: z.boolean().optional().default(false),\n});\n\n// Registration schema\nexport const registrationSchema = z.object({\n chamber_of_commerce_number: z.string().nullable().optional(),\n vat_number: z.string().nullable().optional(),\n anvr_number: z.number().nullable().optional(),\n tax_number: z.string().nullable().optional()\n});\n\n// Banking details schema\nexport const bankingDetailsSchema = z.object({\n account_holder: z.string().nullable().optional(),\n bank_name: z.string().nullable().optional(),\n iban: z.string().nullable().optional(),\n currency: z.string().nullable().optional()\n});\n\n// Package price schema\nexport const packagePriceSchema = z.object({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: z.object({ _type: z.literal('docRef'), collection: z.literal(PACKAGE_COLLECTION) })\n});\n\n// Package specification schema\nexport const packageSpecificationSchema = z.object({\n size: z.string().nullable().optional(),\n type: z.string().nullable().optional(),\n destination: z.string().nullable().optional()\n});\n\n// Pricing strategy schema\nexport const pricingStrategySchema = z.object({\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: z.object({\n _type: z.literal('docRef'),\n collection: z.literal(PRICE_LIST_COLLECTION),\n nullable: z.literal(true)\n }),\n custom_prices: z.array(packagePriceSchema)\n});\n\n// Visual identity banner schema\nexport const visualIdentityBannerSchema = z.object({\n image_url: z.string(),\n alt: z.string(),\n click_url: z.string(),\n locale: supportedLocalesSchema,\n properties: z.record(z.string())\n});\n\n// Schedule filter schema\nexport const scheduleFilterSchema = z.object({\n type: z.enum(['iso3', 'gender', 'percentage', 'age']),\n value: z.union([z.string(), z.number()]),\n comparison: z.enum([\n 'equal',\n 'not_equal',\n 'greater_than',\n 'less_than',\n 'greater_than_or_equal',\n 'less_than_or_equal'\n ])\n});\n\n// Convert object-like schemas to proper Zod objects\nexport const visualIdentityBannersSchema = z.object({\n strategy: z.enum(['fixed', 'rotating', 'destination', 'time_of_day']),\n banners: z.array(visualIdentityBannerSchema).nullable().optional()\n});\n\nexport const visualIdentitySchema = z.object({\n primary_color: z.string(),\n secondary_color: z.string(),\n logo: z.string(),\n font: z.string().nullable().optional(),\n top_banner: visualIdentityBannersSchema.optional(),\n mid_banner: visualIdentityBannersSchema.optional()\n});\n\n// Partner contact schema\nexport const partnerContactSchema = z.object({\n name: z.string().nullable().optional(),\n email: z.string().nullable(),\n office_phone: z.string().nullable().optional()\n});\n\n// Partner data schema\nexport const partnerDataSchema = z.object({\n source: z.string(),\n manual: z.boolean()\n});\n\n// Package strategy schema\nexport const packageStrategySchema = z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any()\n});\n\n// Schedule email schema\nexport const scheduleEmailSchema = z.object({\n brevo_template_id: z.number(),\n subject: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional(),\n preview_text: z.record(z.string()).refine(\n (val: Record) => Object.keys(val).every(key => SUPPORTED_LOCALES.includes(key as SupportedLocales)),\n { message: \"Keys must be supported locales\" }\n ).optional()\n}).nullable().optional();\n\n// Schedule push schema\nexport const schedulePushSchema = z.object({\n title: z.record(z.string()).optional(),\n body: z.record(z.string()).optional(),\n target: z.string()\n}).nullable().optional();\n\n// Schedule schema\nexport const scheduleSchema = z.object({\n days: z.number(),\n email: scheduleEmailSchema,\n push: schedulePushSchema,\n hour: z.number(),\n key: z.string(),\n method: z.enum(['email', 'sms', 'whatsapp', 'push']),\n moment: z.enum(['departure_date', 'return_date', 'immediate']),\n filter: scheduleFilterSchema.nullable().optional()\n});\n\nexport const freeEsimSchema = z.object({\n enabled: z.boolean(),\n package_specification: z.object({\n size: z.string(),\n package_type: z.string(),\n destination: z.string(),\n package_duration: z.number()\n }),\n booking_id_verification: z.boolean().default(false),\n booking_id_verification_pattern: z.string().nullable().optional(),\n allowance: z.number(),\n total_allowance: z.number(),\n});\n\n// Platform settings schema\nexport const platformSettingsSchema = z.object({\n package_strategy: z.object({\n name: z.string(),\n iso3_white_list: z.array(z.string()).optional(),\n parameters: z.any(),\n supported_package_types: z.enum(['data-limited', 'unlimited']).optional()\n }).nullable().optional(),\n free_esim: freeEsimSchema.nullable().optional(),\n booking_defaults: z.object({\n locale: supportedLocalesSchema\n }).nullable().optional(),\n booking_confirmation: z.object({\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n }).nullable().optional(),\n emit_events: emitEventSchema.nullable().optional(),\n schedules: z.array(scheduleSchema).optional(),\n visual_identity_options: z.object({\n hubby_branding: z.boolean().optional().default(true),\n source_partner_branding: z.boolean().optional().default(false),\n own_branding: z.boolean().optional().default(false)\n }).nullable().optional()\n});\n\n// ===== Exportable schema specs =====\n\n// Package price schema spec\nexport const packagePriceSchemaSpec = markAsSchemaSpec({\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n});\n\n// Financial properties schema spec\nexport const financialPropertiesSchemaSpec = markAsSchemaSpec({\n administration_fee: z.number().nullable(),\n income_per_gb: z.number().nullable(),\n commission_fee: z.number().nullable().optional(),\n payment_method: z.enum(['invoice', 'direct']),\n requires_card: z.boolean().nullable(),\n next_invoice: timestampNullableOptional,\n last_invoice: timestampNullableOptional,\n pricing_strategies: {\n _type: 'object' as const,\n of: {\n partner: {\n _type: 'object' as const,\n of: {\n strategy: z.enum(['split', 'bundle']),\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n },\n user: {\n _type: 'object' as const,\n of: {\n modification_percentage: z.number(),\n default_price_list: { _type: 'docRef' as const, collection: PRICE_LIST_COLLECTION, nullable: true },\n custom_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n },\n optional: true\n }\n },\n nullable: true\n }\n});\n\n// Platform settings schema spec\nexport const platformSettingsSchemaSpec = markAsSchemaSpec({\n package_strategy: {\n _type: 'object' as const,\n of: packageStrategySchema.shape,\n nullable: true,\n optional: true\n },\n free_esim: {\n _type: 'object' as const,\n of: freeEsimSchema.shape,\n nullable: true,\n optional: true\n },\n booking_defaults: {\n _type: 'object' as const,\n of: {\n locale: supportedLocalesSchema\n },\n nullable: true,\n optional: true\n },\n booking_confirmation: {\n _type: 'object' as const,\n of: {\n brevo_template_id: z.number(),\n send_booking_confirmation: z.boolean()\n },\n nullable: true,\n optional: true\n },\n schedules: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: scheduleSchema.shape\n },\n optional: true\n }\n});\n\n// Webhook settings schema\nexport const webhookSettingsSchema = z.object({\n url: z.string().url().nullable().optional(),\n api_key: z.string().nullable().optional(),\n enabled: z.boolean().default(false),\n events: z.object({\n promocode_redemption: z.boolean().default(false)\n }).default({})\n});\n\n// ===== Main partner schema =====\nexport const partnerSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Partner specific fields\n name: z.string().min(3),\n type: z.string().nullable(),\n is_active: z.boolean().nullable().optional(),\n external_id: z.string().nullable().optional(),\n\n // Complex nested objects\n contact: {\n _type: 'object' as const,\n of: partnerContactSchema.shape,\n nullable: true\n },\n address: {\n _type: 'object' as const,\n of: addressSchema.shape,\n nullable: true\n },\n registration: {\n _type: 'object' as const,\n of: registrationSchema.shape,\n nullable: true\n },\n banking_details: {\n _type: 'object' as const,\n of: bankingDetailsSchema.shape,\n nullable: true\n },\n\n // Reference fields\n parent: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n users: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: USER_COLLECTION }, nullable: true },\n\n // Complex nested structures\n financial_properties: financialPropertiesSchemaSpec,\n // Visual identity\n visual_identity: {\n _type: 'object' as const,\n of: visualIdentitySchema.shape,\n nullable: true\n },\n\n // Platform settings\n platform_settings: {\n _type: 'object' as const,\n of: platformSettingsSchema.shape,\n nullable: true\n },\n\n // Tags\n tags: {\n _type: 'array' as const,\n of: tagModelSpec,\n nullable: true,\n optional: true\n },\n\n // Metadata\n data: {\n _type: 'object' as const,\n of: partnerDataSchema.shape,\n nullable: true,\n optional: true\n },\n\n // Webhook settings\n webhook_settings: {\n _type: 'object' as const,\n of: webhookSettingsSchema.shape,\n nullable: true,\n optional: true\n }\n});\n\n// ===== Price list schema =====\nexport const priceListSchemaSpec = markAsSchemaSpec({\n // Base model fields\n id: z.string(),\n created_at: timestampRequired,\n updated_at: timestampRequired,\n created_by: z.string().nullable(),\n updated_by: z.string().nullable(),\n\n // Price list specific fields\n name: z.string().min(3),\n description: z.string().nullable(),\n type: z.enum(['partner', 'consumer']),\n partner: { _type: 'docRef' as const, collection: PARTNER_COLLECTION, nullable: true },\n package_prices: {\n _type: 'array' as const,\n of: {\n _type: 'object' as const,\n of: {\n destination: z.string(),\n label: z.string(),\n type: z.enum(['data-limited', 'time-limited']),\n price: z.number(),\n package: { _type: 'docRef' as const, collection: PACKAGE_COLLECTION }\n }\n }\n }\n});\n","import { z } from 'zod';\nimport { timestampRequired } from './common';\nimport { markAsSchemaSpec } from '../common';\n\nexport const payloadSpec = {\n _type: 'record' as const,\n of: z.unknown(),\n optional: true\n};\n\nexport const apiLogSchemaSpec = markAsSchemaSpec({\n id: z.string().optional(),\n method: z.string(),\n user_id: z.string().optional(),\n path: z.string(),\n resource_type: z.string().optional(),\n resource_id: z.string().optional(),\n partner_id: z.string().optional(),\n payload: payloadSpec,\n timestamp: timestampRequired,\n status_code: z.number()\n});\n","// firestoreTransformUtils.ts\n\nimport { z } from 'zod';\nimport { DocumentReference, Timestamp, Firestore } from 'firebase-admin/firestore';\nimport { FieldSpec } from '../types';\nimport { FirebaseService } from '../services/firebase';\n// Note: Firestore instance must be injected by consumers/tests via factory\n\nexport function createConvertJSToFirestore(db: Firestore) {\n return function convertJSToFirestore(input: any, spec: FieldSpec): any {\n // Handle null/undefined at the top level\n if (input === undefined || input === null) return null;\n\n if (spec instanceof z.ZodType) {\n if (input instanceof Date) return Timestamp.fromDate(input);\n return input; // already valid\n }\n\n if ('_type' in spec) {\n switch (spec._type) {\n case 'timestamp':\n if (input instanceof Date) {\n return Timestamp.fromDate(input);\n } else if (typeof input === 'string' || typeof input === 'number') {\n return Timestamp.fromDate(new Date(input));\n }\n return input;\n case 'docRef':\n return db.collection(spec.collection).doc(input);\n case 'array':\n return input.map((item: any) => convertJSToFirestore(item, spec.of));\n case 'record':\n // For records, filter out undefined values\n return Object.fromEntries(\n Object.entries(input)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [k, convertJSToFirestore(v, spec.of)])\n );\n case 'object':\n if ('of' in spec && typeof spec.of === 'object') {\n const result: any = {};\n for (const [key, fieldSpec] of Object.entries(spec.of)) {\n // Check if the field exists in the input\n if (key in input) {\n const value = input[key];\n\n // Handle based on field optionality and nullability\n if (value === undefined) {\n // Check if field is optional by looking at its spec\n const isOptional = typeof fieldSpec === 'object' && '_type' in fieldSpec && fieldSpec._type === 'optional';\n if (!isOptional) {\n // If not optional but nullable, convert to null\n result[key] = null;\n }\n // If optional, just skip it (don't add to result)\n } else {\n // Normal case - value exists and is not undefined\n result[key] = convertJSToFirestore(value, fieldSpec);\n }\n }\n }\n return result;\n }\n return input;\n default:\n throw new Error(`Unknown field type: ${spec._type}`);\n }\n }\n\n // fallback: plain object shape with explicit schema\n if (typeof input === 'object' && !Array.isArray(input) && typeof spec === 'object') {\n const result: any = {};\n\n for (const [key, fieldSpec] of Object.entries(spec)) {\n if (key in input) {\n const value = input[key];\n\n // Handle undefined values\n if (value === undefined) {\n // Check if field is optional\n const isOptional = typeof fieldSpec === 'object' && '_type' in fieldSpec && fieldSpec._type === 'optional';\n if (!isOptional) {\n // If not optional but nullable, convert to null\n result[key] = null;\n }\n // If optional, don't include in the result\n } else {\n // Normal case - value exists\n result[key] = convertJSToFirestore(value, fieldSpec);\n }\n }\n }\n\n return result;\n }\n\n return input;\n };\n}\n\nfunction isDuckTimestamp(obj: any): obj is { toDate: () => Date } {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.toDate === 'function' &&\n Object.prototype.toString.call(obj.toDate()) === '[object Date]'\n );\n}\n\nfunction isDuckDocumentRef(obj: any): obj is { id: string } {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.id === 'string' &&\n typeof obj.path === 'string'\n );\n}\n\nexport function createConvertFirestoreToJS() {\n return function convertFirestoreToJS(input: any, spec: FieldSpec, path: string[] = []): any {\n const pathString = path.join('.') || '';\n\n // ✅ Convert Firestore-native or duck-typed Timestamp\n if (input instanceof Timestamp || isDuckTimestamp(input)) {\n return input.toDate();\n }\n\n // ✅ Convert Firestore-native or duck-typed DocumentReference\n if (input instanceof DocumentReference || isDuckDocumentRef(input)) {\n return input.id;\n }\n\n if (input === null || input === undefined) return input;\n if (!spec) return input;\n\n if (spec instanceof z.ZodType) {\n // 🔁 Keep in place if it's already a native value\n return input;\n }\n\n if ('_type' in spec) {\n switch (spec._type) {\n case 'timestamp':\n return (input instanceof Timestamp || isDuckTimestamp(input)) ? input.toDate() : input;\n\n case 'docRef':\n return (input instanceof DocumentReference || isDuckDocumentRef(input)) ? input.id : input;\n\n case 'array':\n return Array.isArray(input)\n ? input.map((item, i) => convertFirestoreToJS(item, spec.of, [...path, `[${i}]`]))\n : input;\n\n case 'record':\n if (typeof input !== 'object' || input === null) return input;\n return Object.fromEntries(\n Object.entries(input)\n .filter(([_, v]) => v !== undefined)\n .map(([k, v]) => [\n k,\n convertFirestoreToJS(v, spec.of, [...path, k]),\n ])\n );\n\n case 'object':\n if (!spec.of || typeof spec.of !== 'object') return input;\n const result: Record = {};\n for (const [key, fieldSpec] of Object.entries(spec.of)) {\n // Only include properties that exist in the input and aren't undefined\n if (key in input && input[key] !== undefined) {\n result[key] = convertFirestoreToJS(input[key], fieldSpec, [...path, key]);\n }\n }\n return result;\n }\n }\n\n if (typeof spec === 'object' && typeof input === 'object' && !Array.isArray(input)) {\n const result: Record = {};\n for (const [key, valSpec] of Object.entries(spec)) {\n // Only include properties that exist in the input and aren't undefined\n if (key in input && input[key] !== undefined) {\n result[key] = convertFirestoreToJS(input[key], valSpec, [...path, key]);\n }\n }\n return result;\n }\n\n return input;\n };\n}\n\n// For backward compatibility, export the default functions\nexport const convertFirestoreToJS = createConvertFirestoreToJS();\n\n// Backward-compatible helper that lazily uses injected default Firestore instance\nexport function convertJSToFirestore(input: any, spec: FieldSpec): any {\n const firestore = FirebaseService.getDefaultInstance().getFirestore();\n return createConvertJSToFirestore(firestore)(input, spec);\n}\n","import { z, ZodTypeAny } from 'zod';\nimport type { FieldSpec, SchemaFromSpec } from '../types';\nimport { wrapZodSchema, wrapObjectSchema, wrapPlainObjectSchema, isSchemaSpec } from '../common';\n\nexport function buildClientSchema(spec: S, path: string[] = []): SchemaFromSpec {\n const pathString = path.join('.');\n\n if (spec === undefined || spec === null) {\n throw new Error(`Invalid schema spec at \"${pathString || ''}\": received ${spec}`);\n }\n\n // ----- Zod passed directly -----\n if (spec instanceof z.ZodType) {\n return wrapZodSchema(spec) as unknown as SchemaFromSpec;\n }\n\n // Check if object might be a Zod schema (has _def property or ~standard metadata)\n if (typeof spec === 'object' && spec !== null &&\n (('_def' in spec) || ('~standard' in spec && (spec as any)['~standard']?.vendor === 'zod'))) {\n try {\n // Try to use it as a Zod schema directly\n return wrapZodSchema(spec as unknown as z.ZodTypeAny) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this fails, we'll continue with the other checks\n console.warn(`Failed to use object as Zod schema at \"${pathString}\":`, error);\n }\n }\n\n // ----- Array -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'array') {\n if (!('of' in spec)) {\n throw new Error(`Array spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.array(buildClientSchema(spec.of, [...path, '[i]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Record -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'record') {\n if (!('of' in spec)) {\n throw new Error(`Record spec at \"${pathString}\" is missing 'of'`);\n }\n let schema: ZodTypeAny = z.record(buildClientSchema(spec.of, [...path, '[key]']));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Timestamp -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'timestamp') {\n let schema: ZodTypeAny = z.preprocess((val) => {\n if (typeof val === 'string') {\n // Try to parse the string to a Date object\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date; // undefined will cause z.date() to fail\n }\n if (typeof val === 'number') {\n // Handle numeric timestamps\n const date = new Date(val);\n return isNaN(date.getTime()) ? undefined : date;\n }\n // If it's already a Date or something else, return it as is\n return val;\n }, z.date({ required_error: 'Date is required', invalid_type_error: 'Invalid date format' }));\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- DocRef -----\n if (typeof spec === 'object' && spec !== null && '_type' in spec && spec._type === 'docRef') {\n let schema: ZodTypeAny = z.string(); // only ID on client\n if (spec.nullable) schema = schema.nullable();\n if (spec.optional) schema = schema.optional();\n return schema as unknown as SchemaFromSpec;\n }\n\n // ----- Object (plain nested object spec) -----\n if (\n typeof spec === 'object' &&\n spec !== null &&\n '_type' in spec &&\n spec._type === 'object' &&\n 'of' in spec\n ) {\n return wrapObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // ----- Plain object shape -----\n if (isSchemaSpec(spec) || (typeof spec === 'object' && spec !== null && '_type' in spec && (spec as any)._type === 'object')) {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n }\n\n // If we have an object with fields that look like schema specs, try to handle it as a schema object\n if (typeof spec === 'object' && spec !== null) {\n try {\n return wrapPlainObjectSchema(spec, path, buildClientSchema) as unknown as SchemaFromSpec;\n } catch (error) {\n // If this also fails, we'll throw the error below\n console.warn(`Failed to handle object as plain schema at \"${pathString}\":`, error);\n }\n }\n\n // 🔥 If we got here, the spec had a structure we didn't handle\n throw new Error(`Unknown or malformed spec at \"${pathString}\": ${JSON.stringify(spec)}`);\n}\n\n","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional, PERMISSION_COLLECTION } from './common';\n\nexport const roleSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n permissions: { _type: 'array' as const, of: { _type: 'docRef' as const, collection: PERMISSION_COLLECTION }, optional: true, nullable: true },\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { z } from 'zod';\nimport { markAsSchemaSpec } from '../common';\nimport { timestampRequired, timestampNullableOptional } from './common';\n\nexport const permissionSchemaSpec = markAsSchemaSpec({\n id: z.string().nullable().optional(),\n name: z.string(),\n description: z.string(),\n created_at: timestampRequired,\n updated_at: timestampNullableOptional,\n});","import { buildClientSchema } from './builders/client';\nimport {\n userSchemaSpec,\n apiKeySpec,\n apiKeysSpec,\n apiKeysObjectSpec\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { bondioPackageSchema, packageSchemaSpec, telnaPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n financialPropertiesSchemaSpec as financialPropertiesSchema,\n packagePriceSchema,\n platformSettingsSchema,\n visualIdentitySchema,\n pricingStrategySchema,\n freeEsimSchema,\n} from './specs/partner';\nimport { analyticsSpec } from './specs/analytics';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { roleSchemaSpec } from './specs/role';\nimport { permissionSchemaSpec } from './specs/permission';\n\nexport const HUserSchema = buildClientSchema(userSchemaSpec);\nexport const HBookingSchema = buildClientSchema(bookingSchemaSpec);\nexport const HCountrySchema = buildClientSchema(countrySchemaSpec);\nexport const HCurrencySchema = buildClientSchema(currencySchemaSpec);\nexport const HESIMSchema = buildClientSchema(esimSchemaSpec);\nexport const HPaymentSchema = buildClientSchema(paymentSchemaSpec);\nexport const HMessageSchema = buildClientSchema(messageSchemaSpec);\nexport const HPackageSchema = buildClientSchema(packageSchemaSpec);\nexport const HPromoCodeSchema = buildClientSchema(promoCodeSchemaSpec);\nexport const HPartnerSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPriceListSchema = buildClientSchema(priceListSchemaSpec);\nexport const HFinancialPropertiesSchema = buildClientSchema(financialPropertiesSchema);\nexport const HApiLogSchema = buildClientSchema(apiLogSchemaSpec);\nexport const HPackagePriceSchema = buildClientSchema(packagePriceSchema);\nexport const HubbyModelSchema = buildClientSchema(hubbyModelSpec);\nexport const HPartnerAppSchema = buildClientSchema(partnerSchemaSpec);\nexport const HPlatformSettingsSchema = buildClientSchema(platformSettingsSchema);\nexport const HVisualIdentitySchema = buildClientSchema(visualIdentitySchema);\nexport const HPricingStrategySchema = buildClientSchema(pricingStrategySchema);\nexport const HFreeEsimSchema = buildClientSchema(freeEsimSchema);\nexport const HAnalyticsSchema = buildClientSchema(analyticsSpec);\nexport const HRoleSchema = buildClientSchema(roleSchemaSpec);\nexport const HPermissionSchema = buildClientSchema(permissionSchemaSpec);\nexport const HTagSchema = buildClientSchema(tagModelSpec);\nexport const HTrafficPolicySchema = buildClientSchema(trafficPolicySpec);\nexport const HTelnaPackageSchema = buildClientSchema(telnaPackageSchema);\nexport const HBondioPackageSchema = buildClientSchema(bondioPackageSchema);\n// Additional lower-level schemas\nexport const HAddressSchema = addressSchema;\nexport const HRegistrationSchema = registrationSchema;\nexport const HBankingDetailsSchema = bankingDetailsSchema;\nexport const HPartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const HPromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const HVisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const HScheduleFilterSchema = scheduleFilterSchema;\nexport const HPartnerContactSchema = partnerContactSchema;\nexport const HPartnerDataSchema = partnerDataSchema;\nexport const HCommunicationChannelSchema = communicationChannelSchema;\nexport const HBookingStatusSchema = bookingStatusSchema;\nexport const HCommunicationOptionsSchema = communicationOptionsSchema;\n\nexport type HAnalytics = z.infer;\nexport type HUser = z.infer;\nexport type HBooking = z.infer;\nexport type HCountry = z.infer;\nexport type HCurrency = z.infer;\nexport type HESIM = z.infer;\nexport type HPayment = z.infer;\nexport type HMessage = z.infer;\nexport type HPackage = z.infer;\nexport type HPromoCode = z.infer;\nexport type HPartner = z.infer;\nexport type HPriceList = z.infer;\nexport type HApiLog = z.infer;\nexport type HTag = z.infer;\nexport type HTrafficPolicy = z.infer;\nexport type HBondioPackage = z.infer;\nexport type HTelnaPackage = z.infer;\n// Additional lower-level types\nexport type HAddress = z.infer;\nexport type HRegistration = z.infer;\nexport type HBankingDetails = z.infer;\nexport type HPartnerPackageSpecification = z.infer;\nexport type HPromoPackageSpecification = z.infer;\nexport type HVisualIdentityBanner = z.infer;\nexport type HFinancialProperties = z.infer;\nexport type HScheduleFilter = z.infer;\nexport type HPartnerContact = z.infer;\nexport type HPartnerData = z.infer;\nexport type HCommunicationChannel = z.infer;\nexport type HBookingStatus = z.infer;\nexport type HCommunicationOptions = z.infer;\nexport type HHubbyModel = z.infer;\n\nexport type HubbyModelApp = HHubbyModel;\n\nexport type SupportedLocales = typeof SUPPORTED_LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\nexport type HRole = z.infer;\nexport type HPermission = z.infer; ","import { Firestore } from 'firebase-admin/firestore';\nimport {\n createConvertJSToFirestore,\n createConvertFirestoreToJS\n} from './firestoreTransformUtils';\nimport { FieldSpec } from '../types';\n\n/**\n * Creates converter functions for a specific model type with dependency injection.\n * This lets you use the conversion functions with your own Firebase instance.\n * \n * @param db - Firestore instance to use for document references\n * @param modelSchemaSpec - Schema specification for the model\n * @returns Object with to/from Firestore conversion functions\n */\nexport function createModelConverters(\n db: Firestore,\n modelSchemaSpec: FieldSpec\n) {\n const convertToFirestore = createConvertJSToFirestore(db);\n const convertFromFirestore = createConvertFirestoreToJS();\n\n return {\n /**\n * Converts a model instance to Firestore format\n */\n toFirestore: (model: TModel): TFirestore => {\n return convertToFirestore(model, modelSchemaSpec);\n },\n\n /**\n * Converts Firestore data to a model instance\n */\n fromFirestore: (firestoreData: TFirestore): TModel => {\n return convertFromFirestore(firestoreData, modelSchemaSpec);\n }\n };\n} ","import { buildServerSchema } from './builders/server';\nimport {\n userSchemaSpec,\n} from './specs/user';\nimport {\n bookingSchemaSpec,\n communicationChannelSchema,\n bookingStatusSchema,\n communicationOptionsSchema\n} from './specs/booking';\nimport { countrySchemaSpec } from './specs/country';\nimport { currencySchemaSpec } from './specs/currency';\nimport { esimSchemaSpec } from './specs/esim';\nimport { paymentSchemaSpec } from './specs/payment';\nimport { analyticsSpec } from './specs/analytics';\nimport { messageSchemaSpec } from './specs/message';\nimport { trafficPolicySpec } from './specs/traffic_policy';\nimport { packageSchemaSpec, telnaPackageSchema, bondioPackageSchema } from './specs/package';\nimport { promoCodeSchemaSpec, packageSpecificationSchema as promoPackageSpecificationSchema } from './specs/promocode';\nimport {\n partnerSchemaSpec,\n priceListSchemaSpec,\n addressSchema,\n registrationSchema,\n bankingDetailsSchema,\n packageSpecificationSchema as partnerPackageSpecificationSchema,\n visualIdentityBannerSchema,\n visualIdentityBannersSchema,\n scheduleFilterSchema,\n partnerContactSchema,\n partnerDataSchema,\n scheduleSchema,\n visualIdentitySchema,\n packagePriceSchemaSpec,\n platformSettingsSchemaSpec\n} from './specs/partner';\nimport { hubbyModelSpec, tagModelSpec } from './specs/common';\nimport { SUPPORTED_LOCALES as LOCALES } from './constants';\nimport { apiLogSchemaSpec } from './specs/apiLogs';\nimport { z } from 'zod';\nimport { DocumentReference, Timestamp } from 'firebase-admin/firestore';\n\n\nimport { convertFirestoreToJS, convertJSToFirestore } from './utils/firestoreTransformUtils';\nimport { HPartner, HPriceList, HPromoCode } from './index.client';\nimport { buildClientSchema } from './builders/client';\n\nexport { partnerSchemaSpec, analyticsSpec, packageSchemaSpec };\n\nexport const UserSchema = buildServerSchema(userSchemaSpec);\nexport const UserFirestoreSchema = buildServerSchema(userSchemaSpec);\nexport const BookingSchema = buildServerSchema(bookingSchemaSpec);\nexport const CountrySchema = buildServerSchema(countrySchemaSpec);\nexport const CurrencySchema = buildServerSchema(currencySchemaSpec);\nexport const ESIMSchema = buildServerSchema(esimSchemaSpec);\nexport const PaymentSchema = buildServerSchema(paymentSchemaSpec);\nexport const MessageSchema = buildServerSchema(messageSchemaSpec);\nexport const PackageSchema = buildServerSchema(packageSchemaSpec);\nexport const PromoCodeSchema = buildServerSchema(promoCodeSchemaSpec);\nexport const PartnerSchema = buildServerSchema(partnerSchemaSpec);\nexport const PriceListSchema = buildServerSchema(priceListSchemaSpec);\nexport const ApiLogSchema = buildServerSchema(apiLogSchemaSpec);\nexport const VisualIdentitySchema = buildServerSchema(visualIdentitySchema);\nexport const PackagePriceSchema = buildServerSchema(packagePriceSchemaSpec);\nexport const PlatformSettingsSchema = buildServerSchema(platformSettingsSchemaSpec);\nexport const ScheduleSchema = buildServerSchema(scheduleSchema);\nexport const AnalyticsSchema = buildServerSchema(analyticsSpec);\nexport const TagSchema = buildServerSchema(tagModelSpec);\nexport const TelnaPackageSchema = buildServerSchema(telnaPackageSchema);\nexport const BondioPackageSchema = buildServerSchema(bondioPackageSchema);\nexport const TrafficPolicySchema = buildServerSchema(trafficPolicySpec);\n\n// Additional lower-level schemas\nexport const AddressSchema = addressSchema;\nexport const RegistrationSchema = registrationSchema;\nexport const BankingDetailsSchema = bankingDetailsSchema;\nexport const PartnerPackageSpecificationSchema = partnerPackageSpecificationSchema;\nexport const PromoPackageSpecificationSchema = promoPackageSpecificationSchema;\nexport const VisualIdentityBannerSchema = visualIdentityBannerSchema;\nexport const ScheduleFilterSchema = scheduleFilterSchema;\nexport const PartnerContactSchema = partnerContactSchema;\nexport const PartnerDataSchema = partnerDataSchema;\nexport const CommunicationChannelSchema = communicationChannelSchema;\nexport const BookingStatusSchema = bookingStatusSchema;\nexport const CommunicationOptionsSchema = communicationOptionsSchema;\nexport const VisualIdentityBannersSchema = visualIdentityBannersSchema;\n\nexport type User = z.infer;\nexport type UserFirestore = z.infer;\nexport type Booking = z.infer;\nexport type Country = z.infer;\nexport type Currency = z.infer;\nexport type ESIM = z.infer;\nexport type Payment = z.infer;\nexport type Message = z.infer;\nexport type Package = z.infer;\nexport type PromoCode = z.infer;\nexport type Partner = z.infer;\nexport type PriceList = z.infer;\nexport type ApiLog = z.infer;\nexport type Analytics = z.infer;\nexport type Schedule = z.infer;\nexport type TelnaPackage = z.infer;\nexport type BondioPackage = z.infer;\nexport type TrafficPolicy = z.infer;\n\n// Additional lower-level types\nexport type Address = z.infer;\nexport type Registration = z.infer;\nexport type BankingDetails = z.infer;\nexport type PartnerPackageSpecification = z.infer;\nexport type PackageSpecification = z.infer;\nexport type VisualIdentity = z.infer;\nexport type VisualIdentityBanner = z.infer;\nexport type VisualIdentityBanners = z.infer;\nexport type VisualIdentityBannerStrategy = VisualIdentityBanners;\nexport type ScheduleFilter = z.infer;\nexport type PartnerContact = z.infer;\nexport type PartnerData = z.infer;\nexport type CommunicationChannel = z.infer;\nexport type BookingStatus = z.infer;\nexport type CommunicationOptions = z.infer;\nexport type PackagePrice = z.infer;\nexport type PlatformSettings = z.infer;\nexport type BookingApiRequest = Booking;\nexport type BookingApiResponse = Booking;\nexport type PartnerApiRequest = Partner;\nexport type PartnerApiResponse = Partner;\nexport type PriceListApiRequest = PriceList;\nexport type PriceListApiResponse = PriceList;\nexport type ApiLogApiRequest = ApiLog;\nexport type ApiLogApiResponse = ApiLog;\nexport type Tag = z.infer;\n\nexport * from './index.client';\n\nexport type HubbyModel = {\n id: string;\n created_at: Date;\n updated_at: Date | null;\n created_by: string;\n updated_by: string | null;\n}\n\nexport type HubbyModelFirestore = {\n id: string;\n created_at: Timestamp;\n updated_at: Timestamp | null;\n created_by: DocumentReference | null | string;\n updated_by: DocumentReference | null | string;\n}\n\nexport const partnerFromFirestore = (partner: Partner): HPartner => {\n return convertFirestoreToJS(partner, partnerSchemaSpec);\n}\n\nexport const partnerToFirestore = (partner: HPartner): Partner => {\n return convertJSToFirestore(partner, partnerSchemaSpec);\n}\n\nexport const userToFirestore = (user: User): UserFirestore => {\n return convertJSToFirestore(user, userSchemaSpec);\n}\n\nexport const userFromFirestore = (user: UserFirestore): User => {\n return convertFirestoreToJS(user, userSchemaSpec);\n}\n\nexport const priceListFromFirestore = (priceList: PriceList): HPriceList => {\n return convertFirestoreToJS(priceList, priceListSchemaSpec);\n}\n\nexport const priceListToFirestore = (priceList: HPriceList): PriceList => {\n return convertJSToFirestore(priceList, priceListSchemaSpec);\n}\n\nexport const promoCodeFromFirestore = (promoCode: PromoCode): HPromoCode => {\n return convertFirestoreToJS(promoCode, promoCodeSchemaSpec);\n}\n\nexport const promoCodeToFirestore = (promoCode: HPromoCode): PromoCode => {\n return convertJSToFirestore(promoCode, promoCodeSchemaSpec);\n}\n\nexport const partnerAppSchema = buildClientSchema(partnerSchemaSpec);\n// Export the type and constant\nexport type SupportedLocales = typeof LOCALES[number];\nexport const SUPPORTED_LOCALES = LOCALES;\n\n// Dependency Injection exports\nexport { createModelConverters } from './utils/modelConverterFactory';\nexport { createConvertJSToFirestore, createConvertFirestoreToJS } from './utils/firestoreTransformUtils';\nexport { FirebaseService, createFirebaseService } from './services/firebase';"]} \ No newline at end of file diff --git a/src/specs/partner.ts b/src/specs/partner.ts index 847f496..e345c06 100644 --- a/src/specs/partner.ts +++ b/src/specs/partner.ts @@ -167,8 +167,9 @@ export const freeEsimSchema = z.object({ enabled: z.boolean(), package_specification: z.object({ size: z.string(), - type: z.string(), - destination: z.string() + package_type: z.string(), + destination: z.string(), + package_duration: z.number() }), booking_id_verification: z.boolean().default(false), booking_id_verification_pattern: z.string().nullable().optional(),