@superbright/indexeddb-orm 0.1.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.cjs +2 -0
- package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/_virtual/_commonjsHelpers.mjs +9 -0
- package/dist/_virtual/_commonjsHelpers.mjs.map +1 -0
- package/dist/_virtual/dexie.min.cjs +2 -0
- package/dist/_virtual/dexie.min.cjs.map +1 -0
- package/dist/_virtual/dexie.min.mjs +5 -0
- package/dist/_virtual/dexie.min.mjs.map +1 -0
- package/dist/adapters/dexie.cjs +2 -0
- package/dist/adapters/dexie.cjs.map +1 -0
- package/dist/adapters/dexie.mjs +14 -0
- package/dist/adapters/dexie.mjs.map +1 -0
- package/dist/adapters/structured-store.cjs +2 -0
- package/dist/adapters/structured-store.cjs.map +1 -0
- package/dist/adapters/structured-store.mjs +50 -0
- package/dist/adapters/structured-store.mjs.map +1 -0
- package/dist/adapters/zustand-store.cjs +2 -0
- package/dist/adapters/zustand-store.cjs.map +1 -0
- package/dist/adapters/zustand-store.mjs +169 -0
- package/dist/adapters/zustand-store.mjs.map +1 -0
- package/dist/api/favorites.cjs +2 -0
- package/dist/api/favorites.cjs.map +1 -0
- package/dist/api/favorites.mjs +34 -0
- package/dist/api/favorites.mjs.map +1 -0
- package/dist/api/properties.cjs +2 -0
- package/dist/api/properties.cjs.map +1 -0
- package/dist/api/properties.mjs +197 -0
- package/dist/api/properties.mjs.map +1 -0
- package/dist/api/users.cjs +2 -0
- package/dist/api/users.cjs.map +1 -0
- package/dist/api/users.mjs +54 -0
- package/dist/api/users.mjs.map +1 -0
- package/dist/db.cjs +2 -0
- package/dist/db.cjs.map +1 -0
- package/dist/db.mjs +116 -0
- package/dist/db.mjs.map +1 -0
- package/dist/debug.cjs +2 -0
- package/dist/debug.cjs.map +1 -0
- package/dist/debug.mjs +18 -0
- package/dist/debug.mjs.map +1 -0
- package/dist/errors.cjs +2 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.mjs +15 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/features/analytics/MixpanelProvider.cjs +2 -0
- package/dist/features/analytics/MixpanelProvider.cjs.map +1 -0
- package/dist/features/analytics/MixpanelProvider.mjs +40 -0
- package/dist/features/analytics/MixpanelProvider.mjs.map +1 -0
- package/dist/features/analytics/analytics.cjs +2 -0
- package/dist/features/analytics/analytics.cjs.map +1 -0
- package/dist/features/analytics/analytics.d.ts +520 -397
- package/dist/features/analytics/analytics.mjs +230 -0
- package/dist/features/analytics/analytics.mjs.map +1 -0
- package/dist/features/analytics/generateUserUUID.cjs +2 -0
- package/dist/features/analytics/generateUserUUID.cjs.map +1 -0
- package/dist/features/analytics/generateUserUUID.mjs +6 -0
- package/dist/features/analytics/generateUserUUID.mjs.map +1 -0
- package/dist/features/units/transformers.cjs +2 -0
- package/dist/features/units/transformers.cjs.map +1 -0
- package/dist/features/units/transformers.mjs +69 -0
- package/dist/features/units/transformers.mjs.map +1 -0
- package/dist/index.cjs +1 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +84 -14875
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.cjs +4 -0
- package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.cjs.map +1 -0
- package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.mjs +3048 -0
- package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.mjs.map +1 -0
- package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.cjs +2 -0
- package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.cjs.map +1 -0
- package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.mjs +33 -0
- package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.mjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.cjs +2 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.cjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.mjs +88 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.mjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.cjs +2 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.cjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.mjs +10 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.mjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.cjs +2 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.cjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.mjs +8 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.mjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.cjs +2 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.cjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.mjs +98 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.mjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.cjs +2 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.cjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.mjs +95 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.mjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.cjs +2 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.cjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.mjs +62 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.mjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.cjs +2 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.cjs.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.mjs +2402 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.mjs.map +1 -0
- package/dist/schema.cjs +2 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.ts +165 -0
- package/dist/schema.mjs +209 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/storage.cjs +2 -0
- package/dist/storage.cjs.map +1 -0
- package/dist/storage.mjs +54 -0
- package/dist/storage.mjs.map +1 -0
- package/dist/stores/store.cjs +2 -0
- package/dist/stores/store.cjs.map +1 -0
- package/dist/stores/store.mjs +607 -0
- package/dist/stores/store.mjs.map +1 -0
- package/dist/units/favorites.cjs +2 -0
- package/dist/units/favorites.cjs.map +1 -0
- package/dist/units/favorites.mjs +19 -0
- package/dist/units/favorites.mjs.map +1 -0
- package/dist/utils/casing.cjs +2 -0
- package/dist/utils/casing.cjs.map +1 -0
- package/dist/utils/casing.d.ts +6 -0
- package/dist/utils/casing.mjs +12 -0
- package/dist/utils/casing.mjs.map +1 -0
- package/dist/utils/collections.cjs +2 -0
- package/dist/utils/collections.cjs.map +1 -0
- package/dist/utils/collections.d.ts +1 -0
- package/dist/utils/collections.mjs +13 -0
- package/dist/utils/collections.mjs.map +1 -0
- package/dist/utils/dimensions.cjs +2 -0
- package/dist/utils/dimensions.cjs.map +1 -0
- package/dist/utils/dimensions.d.ts +32 -0
- package/dist/utils/dimensions.mjs +29 -0
- package/dist/utils/dimensions.mjs.map +1 -0
- package/dist/validation.cjs +2 -0
- package/dist/validation.cjs.map +1 -0
- package/dist/validation.mjs +18 -0
- package/dist/validation.mjs.map +1 -0
- package/package.json +18 -4
package/dist/schema.d.ts
CHANGED
|
@@ -292,6 +292,39 @@ export declare const UnitSchema: z.ZodObject<{
|
|
|
292
292
|
}>;
|
|
293
293
|
export type Unit = z.infer<typeof UnitSchema>;
|
|
294
294
|
export declare const PropertySchema: z.ZodObject<{
|
|
295
|
+
/**
|
|
296
|
+
* Property (readable shape)
|
|
297
|
+
*
|
|
298
|
+
* interface Property {
|
|
299
|
+
* id: number | string
|
|
300
|
+
* createdAt: string // ISO
|
|
301
|
+
* updatedAt: string // ISO
|
|
302
|
+
* title: string
|
|
303
|
+
* slug?: string | null
|
|
304
|
+
* description: string
|
|
305
|
+
* contactName?: string | null
|
|
306
|
+
* contactEmail?: string
|
|
307
|
+
* contactPhone?: string | null
|
|
308
|
+
* notificationEmail?: string | null
|
|
309
|
+
* logo?: unknown | null
|
|
310
|
+
* leadMedia?: unknown | null
|
|
311
|
+
* overviewImages?: unknown[]
|
|
312
|
+
* amenityImages?: unknown[]
|
|
313
|
+
* street?: string
|
|
314
|
+
* city?: string
|
|
315
|
+
* state?: string | null
|
|
316
|
+
* zip?: string
|
|
317
|
+
* country?: string
|
|
318
|
+
* units?: Unit[]
|
|
319
|
+
* amenities?: unknown[]
|
|
320
|
+
* highlights?: unknown[]
|
|
321
|
+
* externalServices?: unknown[]
|
|
322
|
+
* userId?: number | string
|
|
323
|
+
* user?: unknown
|
|
324
|
+
* status?: string
|
|
325
|
+
* floorPlans?: unknown[]
|
|
326
|
+
* }
|
|
327
|
+
*/
|
|
295
328
|
id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
296
329
|
createdAt: z.ZodString;
|
|
297
330
|
updatedAt: z.ZodString;
|
|
@@ -529,6 +562,39 @@ export declare const ApiUserSchema: z.ZodObject<{
|
|
|
529
562
|
salt: z.ZodOptional<z.ZodString>;
|
|
530
563
|
role: z.ZodOptional<z.ZodString>;
|
|
531
564
|
Property: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
565
|
+
/**
|
|
566
|
+
* Property (readable shape)
|
|
567
|
+
*
|
|
568
|
+
* interface Property {
|
|
569
|
+
* id: number | string
|
|
570
|
+
* createdAt: string // ISO
|
|
571
|
+
* updatedAt: string // ISO
|
|
572
|
+
* title: string
|
|
573
|
+
* slug?: string | null
|
|
574
|
+
* description: string
|
|
575
|
+
* contactName?: string | null
|
|
576
|
+
* contactEmail?: string
|
|
577
|
+
* contactPhone?: string | null
|
|
578
|
+
* notificationEmail?: string | null
|
|
579
|
+
* logo?: unknown | null
|
|
580
|
+
* leadMedia?: unknown | null
|
|
581
|
+
* overviewImages?: unknown[]
|
|
582
|
+
* amenityImages?: unknown[]
|
|
583
|
+
* street?: string
|
|
584
|
+
* city?: string
|
|
585
|
+
* state?: string | null
|
|
586
|
+
* zip?: string
|
|
587
|
+
* country?: string
|
|
588
|
+
* units?: Unit[]
|
|
589
|
+
* amenities?: unknown[]
|
|
590
|
+
* highlights?: unknown[]
|
|
591
|
+
* externalServices?: unknown[]
|
|
592
|
+
* userId?: number | string
|
|
593
|
+
* user?: unknown
|
|
594
|
+
* status?: string
|
|
595
|
+
* floorPlans?: unknown[]
|
|
596
|
+
* }
|
|
597
|
+
*/
|
|
532
598
|
id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
533
599
|
createdAt: z.ZodString;
|
|
534
600
|
updatedAt: z.ZodString;
|
|
@@ -1097,6 +1163,39 @@ export declare const UserPropertyStateSchema: z.ZodObject<{
|
|
|
1097
1163
|
preferences?: Record<string, unknown> | undefined;
|
|
1098
1164
|
}>>>;
|
|
1099
1165
|
data: z.ZodOptional<z.ZodObject<{
|
|
1166
|
+
/**
|
|
1167
|
+
* Property (readable shape)
|
|
1168
|
+
*
|
|
1169
|
+
* interface Property {
|
|
1170
|
+
* id: number | string
|
|
1171
|
+
* createdAt: string // ISO
|
|
1172
|
+
* updatedAt: string // ISO
|
|
1173
|
+
* title: string
|
|
1174
|
+
* slug?: string | null
|
|
1175
|
+
* description: string
|
|
1176
|
+
* contactName?: string | null
|
|
1177
|
+
* contactEmail?: string
|
|
1178
|
+
* contactPhone?: string | null
|
|
1179
|
+
* notificationEmail?: string | null
|
|
1180
|
+
* logo?: unknown | null
|
|
1181
|
+
* leadMedia?: unknown | null
|
|
1182
|
+
* overviewImages?: unknown[]
|
|
1183
|
+
* amenityImages?: unknown[]
|
|
1184
|
+
* street?: string
|
|
1185
|
+
* city?: string
|
|
1186
|
+
* state?: string | null
|
|
1187
|
+
* zip?: string
|
|
1188
|
+
* country?: string
|
|
1189
|
+
* units?: Unit[]
|
|
1190
|
+
* amenities?: unknown[]
|
|
1191
|
+
* highlights?: unknown[]
|
|
1192
|
+
* externalServices?: unknown[]
|
|
1193
|
+
* userId?: number | string
|
|
1194
|
+
* user?: unknown
|
|
1195
|
+
* status?: string
|
|
1196
|
+
* floorPlans?: unknown[]
|
|
1197
|
+
* }
|
|
1198
|
+
*/
|
|
1100
1199
|
id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
1101
1200
|
createdAt: z.ZodString;
|
|
1102
1201
|
updatedAt: z.ZodString;
|
|
@@ -1503,6 +1602,39 @@ export declare const PropertyStoreDataSchema: z.ZodObject<{
|
|
|
1503
1602
|
preferences?: Record<string, unknown> | undefined;
|
|
1504
1603
|
}>>>;
|
|
1505
1604
|
data: z.ZodOptional<z.ZodObject<{
|
|
1605
|
+
/**
|
|
1606
|
+
* Property (readable shape)
|
|
1607
|
+
*
|
|
1608
|
+
* interface Property {
|
|
1609
|
+
* id: number | string
|
|
1610
|
+
* createdAt: string // ISO
|
|
1611
|
+
* updatedAt: string // ISO
|
|
1612
|
+
* title: string
|
|
1613
|
+
* slug?: string | null
|
|
1614
|
+
* description: string
|
|
1615
|
+
* contactName?: string | null
|
|
1616
|
+
* contactEmail?: string
|
|
1617
|
+
* contactPhone?: string | null
|
|
1618
|
+
* notificationEmail?: string | null
|
|
1619
|
+
* logo?: unknown | null
|
|
1620
|
+
* leadMedia?: unknown | null
|
|
1621
|
+
* overviewImages?: unknown[]
|
|
1622
|
+
* amenityImages?: unknown[]
|
|
1623
|
+
* street?: string
|
|
1624
|
+
* city?: string
|
|
1625
|
+
* state?: string | null
|
|
1626
|
+
* zip?: string
|
|
1627
|
+
* country?: string
|
|
1628
|
+
* units?: Unit[]
|
|
1629
|
+
* amenities?: unknown[]
|
|
1630
|
+
* highlights?: unknown[]
|
|
1631
|
+
* externalServices?: unknown[]
|
|
1632
|
+
* userId?: number | string
|
|
1633
|
+
* user?: unknown
|
|
1634
|
+
* status?: string
|
|
1635
|
+
* floorPlans?: unknown[]
|
|
1636
|
+
* }
|
|
1637
|
+
*/
|
|
1506
1638
|
id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
1507
1639
|
createdAt: z.ZodString;
|
|
1508
1640
|
updatedAt: z.ZodString;
|
|
@@ -2097,6 +2229,39 @@ export declare const UnifiedStoreDataSchema: z.ZodObject<{
|
|
|
2097
2229
|
preferences?: Record<string, unknown> | undefined;
|
|
2098
2230
|
}>>>;
|
|
2099
2231
|
data: z.ZodOptional<z.ZodObject<{
|
|
2232
|
+
/**
|
|
2233
|
+
* Property (readable shape)
|
|
2234
|
+
*
|
|
2235
|
+
* interface Property {
|
|
2236
|
+
* id: number | string
|
|
2237
|
+
* createdAt: string // ISO
|
|
2238
|
+
* updatedAt: string // ISO
|
|
2239
|
+
* title: string
|
|
2240
|
+
* slug?: string | null
|
|
2241
|
+
* description: string
|
|
2242
|
+
* contactName?: string | null
|
|
2243
|
+
* contactEmail?: string
|
|
2244
|
+
* contactPhone?: string | null
|
|
2245
|
+
* notificationEmail?: string | null
|
|
2246
|
+
* logo?: unknown | null
|
|
2247
|
+
* leadMedia?: unknown | null
|
|
2248
|
+
* overviewImages?: unknown[]
|
|
2249
|
+
* amenityImages?: unknown[]
|
|
2250
|
+
* street?: string
|
|
2251
|
+
* city?: string
|
|
2252
|
+
* state?: string | null
|
|
2253
|
+
* zip?: string
|
|
2254
|
+
* country?: string
|
|
2255
|
+
* units?: Unit[]
|
|
2256
|
+
* amenities?: unknown[]
|
|
2257
|
+
* highlights?: unknown[]
|
|
2258
|
+
* externalServices?: unknown[]
|
|
2259
|
+
* userId?: number | string
|
|
2260
|
+
* user?: unknown
|
|
2261
|
+
* status?: string
|
|
2262
|
+
* floorPlans?: unknown[]
|
|
2263
|
+
* }
|
|
2264
|
+
*/
|
|
2100
2265
|
id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
2101
2266
|
createdAt: z.ZodString;
|
|
2102
2267
|
updatedAt: z.ZodString;
|
package/dist/schema.mjs
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { object as l, enum as d, string as t, boolean as u, array as o, number as a, union as n, null as g, record as i, unknown as e, coerce as s } from "./node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.mjs";
|
|
2
|
+
const F = 1, T = l({
|
|
3
|
+
uuid: t().uuid(),
|
|
4
|
+
// stored as ISO string; include to match ensureUser()
|
|
5
|
+
createdAt: t().datetime().optional()
|
|
6
|
+
}), v = l({
|
|
7
|
+
isFavorite: u().optional(),
|
|
8
|
+
viewedDate: t().optional()
|
|
9
|
+
}), f = v, p = n([
|
|
10
|
+
t(),
|
|
11
|
+
a(),
|
|
12
|
+
u(),
|
|
13
|
+
i(e())
|
|
14
|
+
]), A = n([
|
|
15
|
+
p,
|
|
16
|
+
o(p)
|
|
17
|
+
]), r = l({
|
|
18
|
+
availability: A.nullable().optional(),
|
|
19
|
+
bedrooms: n([o(p), g()]).optional(),
|
|
20
|
+
cost: a().nullable().optional(),
|
|
21
|
+
highlights: o(p).optional()
|
|
22
|
+
}), m = l({
|
|
23
|
+
limit: a().default(10),
|
|
24
|
+
page: a().default(1),
|
|
25
|
+
availability: o(t()).optional(),
|
|
26
|
+
bedrooms: o(a()).optional(),
|
|
27
|
+
cost: a().nullable().optional(),
|
|
28
|
+
highlights: o(t()).optional()
|
|
29
|
+
}), b = d(["all", "bestFit", "closestMatch", "favorites", "loading"]), h = d(["relevance", "newest", "cost_low_to_high", "cost_high_to_low"]), w = l({
|
|
30
|
+
data: i(f),
|
|
31
|
+
filters: r,
|
|
32
|
+
tempFilters: r,
|
|
33
|
+
apiFilters: m,
|
|
34
|
+
resultsMode: b,
|
|
35
|
+
propertySlug: t().nullable(),
|
|
36
|
+
resolvedQuestionnaireValues: i(o(t())),
|
|
37
|
+
sortBy: h
|
|
38
|
+
}), c = l({
|
|
39
|
+
id: n([a().int(), t()]).optional(),
|
|
40
|
+
title: t(),
|
|
41
|
+
slug: t().nullable().optional(),
|
|
42
|
+
bedrooms: s.number().nullable().optional(),
|
|
43
|
+
bathrooms: s.number().nullable().optional(),
|
|
44
|
+
cost: s.number().nullable().optional(),
|
|
45
|
+
totalSqFt: s.number().nullable().optional(),
|
|
46
|
+
propertyId: n([a().int(), t()]).optional(),
|
|
47
|
+
isAvailable: u().optional(),
|
|
48
|
+
createdAt: t().datetime().optional(),
|
|
49
|
+
updatedAt: t().datetime().optional(),
|
|
50
|
+
availability: t().datetime().nullable().optional(),
|
|
51
|
+
unitSetAvailableOn: t().datetime().nullable().optional(),
|
|
52
|
+
floorPlanId: n([a().int(), t()]).nullable().optional(),
|
|
53
|
+
// Relations and nested structures kept loose to avoid coupling
|
|
54
|
+
property: e().optional(),
|
|
55
|
+
amenities: o(e()).optional(),
|
|
56
|
+
highlights: o(e()).optional(),
|
|
57
|
+
floorPlan: e().nullable().optional(),
|
|
58
|
+
renderedStyle: o(e()).optional(),
|
|
59
|
+
video: e().nullable().optional(),
|
|
60
|
+
videoThumbnail: e().nullable().optional(),
|
|
61
|
+
embedGif: e().nullable().optional(),
|
|
62
|
+
userId: n([a().int(), t()]).optional(),
|
|
63
|
+
user: e().optional(),
|
|
64
|
+
status: t().optional(),
|
|
65
|
+
externalId: t().nullable().optional(),
|
|
66
|
+
unitRenderedStyles: o(e()).optional()
|
|
67
|
+
}), y = l({
|
|
68
|
+
/**
|
|
69
|
+
* Property (readable shape)
|
|
70
|
+
*
|
|
71
|
+
* interface Property {
|
|
72
|
+
* id: number | string
|
|
73
|
+
* createdAt: string // ISO
|
|
74
|
+
* updatedAt: string // ISO
|
|
75
|
+
* title: string
|
|
76
|
+
* slug?: string | null
|
|
77
|
+
* description: string
|
|
78
|
+
* contactName?: string | null
|
|
79
|
+
* contactEmail?: string
|
|
80
|
+
* contactPhone?: string | null
|
|
81
|
+
* notificationEmail?: string | null
|
|
82
|
+
* logo?: unknown | null
|
|
83
|
+
* leadMedia?: unknown | null
|
|
84
|
+
* overviewImages?: unknown[]
|
|
85
|
+
* amenityImages?: unknown[]
|
|
86
|
+
* street?: string
|
|
87
|
+
* city?: string
|
|
88
|
+
* state?: string | null
|
|
89
|
+
* zip?: string
|
|
90
|
+
* country?: string
|
|
91
|
+
* units?: Unit[]
|
|
92
|
+
* amenities?: unknown[]
|
|
93
|
+
* highlights?: unknown[]
|
|
94
|
+
* externalServices?: unknown[]
|
|
95
|
+
* userId?: number | string
|
|
96
|
+
* user?: unknown
|
|
97
|
+
* status?: string
|
|
98
|
+
* floorPlans?: unknown[]
|
|
99
|
+
* }
|
|
100
|
+
*/
|
|
101
|
+
id: n([a().int(), t()]),
|
|
102
|
+
createdAt: t().datetime(),
|
|
103
|
+
updatedAt: t().datetime(),
|
|
104
|
+
title: t(),
|
|
105
|
+
slug: t().nullable().optional(),
|
|
106
|
+
description: t(),
|
|
107
|
+
contactName: t().nullable().optional(),
|
|
108
|
+
contactEmail: t().optional(),
|
|
109
|
+
contactPhone: t().nullable().optional(),
|
|
110
|
+
notificationEmail: t().nullable().optional(),
|
|
111
|
+
logo: e().nullable().optional(),
|
|
112
|
+
leadMedia: e().nullable().optional(),
|
|
113
|
+
overviewImages: o(e()).optional(),
|
|
114
|
+
amenityImages: o(e()).optional(),
|
|
115
|
+
street: t().optional(),
|
|
116
|
+
city: t().optional(),
|
|
117
|
+
state: t().nullable().optional(),
|
|
118
|
+
ingestionFileName: t().nullable().optional(),
|
|
119
|
+
zip: t().optional(),
|
|
120
|
+
country: t().optional(),
|
|
121
|
+
units: o(c).optional(),
|
|
122
|
+
amenities: o(e()).optional(),
|
|
123
|
+
highlights: o(e()).optional(),
|
|
124
|
+
externalServices: o(e()).optional(),
|
|
125
|
+
userId: n([a().int(), t()]).optional(),
|
|
126
|
+
user: e().optional(),
|
|
127
|
+
status: t().optional(),
|
|
128
|
+
floorPlans: o(e()).optional()
|
|
129
|
+
}), D = l({
|
|
130
|
+
id: n([a().int(), t()]).optional(),
|
|
131
|
+
email: t().email().optional(),
|
|
132
|
+
firstName: t().optional(),
|
|
133
|
+
lastName: t().optional(),
|
|
134
|
+
password: t().optional(),
|
|
135
|
+
salt: t().optional(),
|
|
136
|
+
role: t().optional(),
|
|
137
|
+
Property: o(y).optional(),
|
|
138
|
+
Unit: o(c).optional(),
|
|
139
|
+
floorPlans: o(e()).optional(),
|
|
140
|
+
createdAt: t().datetime().optional(),
|
|
141
|
+
updatedAt: t().datetime().optional()
|
|
142
|
+
}), I = l({
|
|
143
|
+
unitId: t(),
|
|
144
|
+
viewedDate: t()
|
|
145
|
+
}), P = l({
|
|
146
|
+
timezone: t().optional(),
|
|
147
|
+
favouriteUnits: o(s.string()).optional(),
|
|
148
|
+
preferences: i(e()).optional()
|
|
149
|
+
}), S = l({
|
|
150
|
+
id: s.string(),
|
|
151
|
+
slug: t(),
|
|
152
|
+
favoritedUnits: o(t()),
|
|
153
|
+
tourContactedOn: t().nullable(),
|
|
154
|
+
viewedUnits: o(I),
|
|
155
|
+
questionnaireResults: e().nullable().optional(),
|
|
156
|
+
tourContactData: P.nullable().optional(),
|
|
157
|
+
// Full property payload persisted alongside per-property state
|
|
158
|
+
data: y.optional()
|
|
159
|
+
}), _ = l({
|
|
160
|
+
data: i(S),
|
|
161
|
+
propertySlug: t().nullable(),
|
|
162
|
+
propertyId: t().nullable(),
|
|
163
|
+
hasPreviouslySearched: o(t())
|
|
164
|
+
}), E = l({
|
|
165
|
+
id: a().int(),
|
|
166
|
+
userId: a().int(),
|
|
167
|
+
unitId: a().int(),
|
|
168
|
+
createdAt: t().datetime()
|
|
169
|
+
}), M = l({
|
|
170
|
+
// per-property favorites are stored under a KV key, so propertyId is implicit
|
|
171
|
+
unitIds: o(t()),
|
|
172
|
+
updatedAt: t().datetime()
|
|
173
|
+
}), C = l({
|
|
174
|
+
// Property-related data
|
|
175
|
+
properties: i(S),
|
|
176
|
+
currentPropertyId: t().nullable(),
|
|
177
|
+
currentPropertySlug: t().nullable(),
|
|
178
|
+
hasPreviouslySearched: o(t()),
|
|
179
|
+
// App-level data
|
|
180
|
+
unitResults: o(c),
|
|
181
|
+
filters: r,
|
|
182
|
+
tempFilters: r,
|
|
183
|
+
apiFilters: m,
|
|
184
|
+
resultsMode: b,
|
|
185
|
+
resolvedQuestionnaireValues: i(o(t())),
|
|
186
|
+
sortBy: h
|
|
187
|
+
});
|
|
188
|
+
export {
|
|
189
|
+
D as ApiUserSchema,
|
|
190
|
+
w as AppStoreDataSchema,
|
|
191
|
+
M as FavoritesSchema,
|
|
192
|
+
r as FiltersSchema,
|
|
193
|
+
y as PropertySchema,
|
|
194
|
+
_ as PropertyStoreDataSchema,
|
|
195
|
+
m as QueryParamsSchema,
|
|
196
|
+
b as ResultsModeEnum,
|
|
197
|
+
F as SCHEMA_VERSION,
|
|
198
|
+
h as SortByEnum,
|
|
199
|
+
P as TourContactDataSchema,
|
|
200
|
+
C as UnifiedStoreDataSchema,
|
|
201
|
+
f as UnitDataSchema,
|
|
202
|
+
E as UnitFavoriteSchema,
|
|
203
|
+
c as UnitSchema,
|
|
204
|
+
S as UserPropertyStateSchema,
|
|
205
|
+
T as UserSchema,
|
|
206
|
+
v as UserUnitDataSchema,
|
|
207
|
+
I as ViewedUnitSchema
|
|
208
|
+
};
|
|
209
|
+
//# sourceMappingURL=schema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.mjs","sources":["../src/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const SCHEMA_VERSION = 1 as const;\n\n// Entities\nexport const UserSchema = z.object({\n uuid: z.string().uuid(),\n // stored as ISO string; include to match ensureUser()\n createdAt: z.string().datetime().optional(),\n});\nexport type User = z.infer<typeof UserSchema>;\n\n// User-specific Unit state\nexport const UserUnitDataSchema = z.object({\n isFavorite: z.boolean().optional(),\n viewedDate: z.string().optional(),\n});\n// Back-compat alias (to be deprecated): keep existing name\nexport const UnitDataSchema = UserUnitDataSchema;\nexport type UnitData = z.infer<typeof UserUnitDataSchema>;\n\n// Filters and query params\nconst FilterOptionValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.unknown()),\n]);\n\nconst FilterCollectionSchema = z.union([\n FilterOptionValueSchema,\n z.array(FilterOptionValueSchema),\n]);\n\nexport const FiltersSchema = z.object({\n availability: FilterCollectionSchema.nullable().optional(),\n bedrooms: z.union([z.array(FilterOptionValueSchema), z.null()]).optional(),\n cost: z.number().nullable().optional(),\n highlights: z.array(FilterOptionValueSchema).optional(),\n});\nexport type Filters = z.infer<typeof FiltersSchema>;\n\nexport const QueryParamsSchema = z.object({\n limit: z.number().default(10),\n page: z.number().default(1),\n availability: z.array(z.string()).optional(),\n bedrooms: z.array(z.number()).optional(),\n cost: z.number().nullable().optional(),\n highlights: z.array(z.string()).optional(),\n});\nexport type QueryParams = z.infer<typeof QueryParamsSchema>;\n\nexport const ResultsModeEnum = z.enum([\"all\", \"bestFit\", \"closestMatch\", \"favorites\", \"loading\"]);\nexport type ResultsMode = z.infer<typeof ResultsModeEnum>;\nexport const SortByEnum = z.enum([\"relevance\", \"newest\", \"cost_low_to_high\", \"cost_high_to_low\"]);\nexport type SortBy = z.infer<typeof SortByEnum>;\n\n// App (standalone) persisted state\nexport const AppStoreDataSchema = z.object({\n data: z.record(UnitDataSchema),\n filters: FiltersSchema,\n tempFilters: FiltersSchema,\n apiFilters: QueryParamsSchema,\n resultsMode: ResultsModeEnum,\n propertySlug: z.string().nullable(),\n resolvedQuestionnaireValues: z.record(z.array(z.string())),\n sortBy: SortByEnum,\n});\nexport type AppStoreData = z.infer<typeof AppStoreDataSchema>;\n\n// Domain models (optional fields to mirror API shape without breaking)\n// Mirrors the backend Unit model with relaxed optional fields\nexport const UnitSchema = z.object({\n id: z.union([z.number().int(), z.string()]).optional(),\n title: z.string(),\n slug: z.string().nullable().optional(),\n bedrooms: z.coerce.number().nullable().optional(),\n bathrooms: z.coerce.number().nullable().optional(),\n cost: z.coerce.number().nullable().optional(),\n totalSqFt: z.coerce.number().nullable().optional(),\n propertyId: z.union([z.number().int(), z.string()]).optional(),\n isAvailable: z.boolean().optional(),\n createdAt: z.string().datetime().optional(),\n updatedAt: z.string().datetime().optional(),\n availability: z.string().datetime().nullable().optional(),\n unitSetAvailableOn: z.string().datetime().nullable().optional(),\n floorPlanId: z.union([z.number().int(), z.string()]).nullable().optional(),\n // Relations and nested structures kept loose to avoid coupling\n property: z.unknown().optional(),\n amenities: z.array(z.unknown()).optional(),\n highlights: z.array(z.unknown()).optional(),\n floorPlan: z.unknown().nullable().optional(),\n renderedStyle: z.array(z.unknown()).optional(),\n video: z.unknown().nullable().optional(),\n videoThumbnail: z.unknown().nullable().optional(),\n embedGif: z.unknown().nullable().optional(),\n userId: z.union([z.number().int(), z.string()]).optional(),\n user: z.unknown().optional(),\n status: z.string().optional(),\n externalId: z.string().nullable().optional(),\n unitRenderedStyles: z.array(z.unknown()).optional(),\n});\nexport type Unit = z.infer<typeof UnitSchema>;\n\n// Mirrors the backend Property model with relaxed optional fields\nexport const PropertySchema = z.object({\n /**\n * Property (readable shape)\n *\n * interface Property {\n * id: number | string\n * createdAt: string // ISO\n * updatedAt: string // ISO\n * title: string\n * slug?: string | null\n * description: string\n * contactName?: string | null\n * contactEmail?: string\n * contactPhone?: string | null\n * notificationEmail?: string | null\n * logo?: unknown | null\n * leadMedia?: unknown | null\n * overviewImages?: unknown[]\n * amenityImages?: unknown[]\n * street?: string\n * city?: string\n * state?: string | null\n * zip?: string\n * country?: string\n * units?: Unit[]\n * amenities?: unknown[]\n * highlights?: unknown[]\n * externalServices?: unknown[]\n * userId?: number | string\n * user?: unknown\n * status?: string\n * floorPlans?: unknown[]\n * }\n */\n id: z.union([z.number().int(), z.string()]),\n createdAt: z.string().datetime(),\n updatedAt: z.string().datetime(),\n title: z.string(),\n slug: z.string().nullable().optional(),\n description: z.string(),\n contactName: z.string().nullable().optional(),\n contactEmail: z.string().optional(),\n contactPhone: z.string().nullable().optional(),\n notificationEmail: z.string().nullable().optional(),\n logo: z.unknown().nullable().optional(),\n leadMedia: z.unknown().nullable().optional(),\n overviewImages: z.array(z.unknown()).optional(),\n amenityImages: z.array(z.unknown()).optional(),\n street: z.string().optional(),\n city: z.string().optional(),\n state: z.string().nullable().optional(),\n ingestionFileName: z.string().nullable().optional(),\n zip: z.string().optional(),\n country: z.string().optional(),\n units: z.array(UnitSchema).optional(),\n amenities: z.array(z.unknown()).optional(),\n highlights: z.array(z.unknown()).optional(),\n externalServices: z.array(z.unknown()).optional(),\n userId: z.union([z.number().int(), z.string()]).optional(),\n user: z.unknown().optional(),\n status: z.string().optional(),\n floorPlans: z.array(z.unknown()).optional(),\n});\nexport type Property = z.infer<typeof PropertySchema>;\n\n// Mirrors the backend User model with relaxed optional fields\n// Named ApiUserSchema to avoid conflict with local UserSchema (uuid-only)\nexport const ApiUserSchema = z.object({\n id: z.union([z.number().int(), z.string()]).optional(),\n email: z.string().email().optional(),\n firstName: z.string().optional(),\n lastName: z.string().optional(),\n password: z.string().optional(),\n salt: z.string().optional(),\n role: z.string().optional(),\n Property: z.array(PropertySchema).optional(),\n Unit: z.array(UnitSchema).optional(),\n floorPlans: z.array(z.unknown()).optional(),\n createdAt: z.string().datetime().optional(),\n updatedAt: z.string().datetime().optional(),\n});\nexport type ApiUser = z.infer<typeof ApiUserSchema>;\n\n// Property-related schemas used by the PropertyStore and UnifiedStore\nexport const ViewedUnitSchema = z.object({\n unitId: z.string(),\n viewedDate: z.string(),\n});\nexport type ViewedUnit = z.infer<typeof ViewedUnitSchema>;\n\nexport const TourContactDataSchema = z.object({\n timezone: z.string().optional(),\n favouriteUnits: z.array(z.coerce.string()).optional(),\n preferences: z.record(z.unknown()).optional(),\n});\nexport type TourContactData = z.infer<typeof TourContactDataSchema>;\n\nexport const UserPropertyStateSchema = z.object({\n id: z.coerce.string(),\n slug: z.string(),\n favoritedUnits: z.array(z.string()),\n tourContactedOn: z.string().nullable(),\n viewedUnits: z.array(ViewedUnitSchema),\n questionnaireResults: z.unknown().nullable().optional(),\n tourContactData: TourContactDataSchema.nullable().optional(),\n // Full property payload persisted alongside per-property state\n data: PropertySchema.optional(),\n});\nexport type UserPropertyState = z.infer<typeof UserPropertyStateSchema>;\n\nexport const PropertyStoreDataSchema = z.object({\n data: z.record(UserPropertyStateSchema),\n propertySlug: z.string().nullable(),\n propertyId: z.string().nullable(),\n hasPreviouslySearched: z.array(z.string()),\n});\nexport type PropertyStoreData = z.infer<typeof PropertyStoreDataSchema>;\n\n// favorites\nexport const UnitFavoriteSchema = z.object({\n id: z.number().int(),\n userId: z.number().int(),\n unitId: z.number().int(),\n createdAt: z.string().datetime(),\n});\nexport type UnitFavorite = z.infer<typeof UnitFavoriteSchema>;\n\nexport const FavoritesSchema = z.object({\n // per-property favorites are stored under a KV key, so propertyId is implicit\n unitIds: z.array(z.string()),\n updatedAt: z.string().datetime(),\n});\nexport type Favorites = z.infer<typeof FavoritesSchema>;\n\n// Unified store schema (combines property + app persistent bits)\nexport const UnifiedStoreDataSchema = z.object({\n // Property-related data\n properties: z.record(UserPropertyStateSchema),\n currentPropertyId: z.string().nullable(),\n currentPropertySlug: z.string().nullable(),\n hasPreviouslySearched: z.array(z.string()),\n\n // App-level data\n unitResults: z.array(UnitSchema),\n filters: FiltersSchema,\n tempFilters: FiltersSchema,\n apiFilters: QueryParamsSchema,\n resultsMode: ResultsModeEnum,\n resolvedQuestionnaireValues: z.record(z.array(z.string())),\n sortBy: SortByEnum,\n});\nexport type UnifiedStoreData = z.infer<typeof UnifiedStoreDataSchema>;\n"],"names":["SCHEMA_VERSION","UserSchema","z.object","z.string","UserUnitDataSchema","z.boolean","UnitDataSchema","FilterOptionValueSchema","z.union","z.number","z.record","z.unknown","FilterCollectionSchema","z.array","FiltersSchema","z.null","QueryParamsSchema","ResultsModeEnum","z.enum","SortByEnum","AppStoreDataSchema","UnitSchema","z.coerce","PropertySchema","ApiUserSchema","ViewedUnitSchema","TourContactDataSchema","UserPropertyStateSchema","PropertyStoreDataSchema","UnitFavoriteSchema","FavoritesSchema","UnifiedStoreDataSchema"],"mappings":";AAEO,MAAMA,IAAiB,GAGjBC,IAAaC,EAAS;AAAA,EACjC,MAAMC,EAAE,EAAS,KAAA;AAAA;AAAA,EAEjB,WAAWA,EAAE,EAAS,SAAA,EAAW,SAAA;AACnC,CAAC,GAIYC,IAAqBF,EAAS;AAAA,EACzC,YAAYG,EAAE,EAAU,SAAA;AAAA,EACxB,YAAYF,EAAE,EAAS,SAAA;AACzB,CAAC,GAEYG,IAAiBF,GAIxBG,IAA0BC,EAAQ;AAAA,EACtCL,EAAE;AAAA,EACFM,EAAE;AAAA,EACFJ,EAAE;AAAA,EACFK,EAASC,EAAE,CAAS;AACtB,CAAC,GAEKC,IAAyBJ,EAAQ;AAAA,EACrCD;AAAA,EACAM,EAAQN,CAAuB;AACjC,CAAC,GAEYO,IAAgBZ,EAAS;AAAA,EACpC,cAAcU,EAAuB,SAAA,EAAW,SAAA;AAAA,EAChD,UAAUJ,EAAQ,CAACK,EAAQN,CAAu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AA,EAC5B,aAAaU,EAAQY,CAAgB;AAAA,EACrC,sBAAsBd,EAAE,EAAU,SAAA,EAAW,SAAA;AAAA,EAC7C,iBAAiBe,EAAsB,SAAA,EAAW,SAAA;AAAA;AAAA,EAElD,MAAMH,EAAe,SAAA;AACvB,CAAC,GAGYK,IAA0B1B,EAAS;AAAA,EAC9C,MAAMQ,EAASiB,CAAuB;AAAA,EACtC,cAAcxB,EAAE,EAAS,SAAA;AAAA,EACzB,YAAYA,EAAE,EAAS,SAAA;AAAA,EACvB,uBAAuBU,EAAQV,GAAU;AAC3C,CAAC,GAIY0B,IAAqB3B,EAAS;AAAA,EACzC,IAAIO,EAAE,EAAS,IAAA;AAAA,EACf,QAAQA,EAAE,EAAS,IAAA;AAAA,EACnB,QAAQA,EAAE,EAAS,IAAA;AAAA,EACnB,WAAWN,EAAE,EAAS,SAAA;AACxB,CAAC,GAGY2B,IAAkB5B,EAAS;AAAA;AAAA,EAEtC,SAASW,EAAQV,GAAU;AAAA,EAC3B,WAAWA,EAAE,EAAS,SAAA;AACxB,CAAC,GAIY4B,IAAyB7B,EAAS;AAAA;AAAA,EAE7C,YAAYQ,EAASiB,CAAuB;AAAA,EAC5C,mBAAmBxB,EAAE,EAAS,SAAA;AAAA,EAC9B,qBAAqBA,EAAE,EAAS,SAAA;AAAA,EAChC,uBAAuBU,EAAQV,GAAU;AAAA;AAAA,EAGzC,aAAaU,EAAQQ,CAAU;AAAA,EAC/B,SAASP;AAAA,EACT,aAAaA;AAAA,EACb,YAAYE;AAAA,EACZ,aAAaC;AAAA,EACb,6BAA6BP,EAASG,EAAQV,EAAE,CAAQ,CAAC;AAAA,EACzD,QAAQgB;AACV,CAAC;"}
|
package/dist/storage.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./db.cjs");async function l(e){const r=await(await i.getDB()).kv.get(e);return(r==null?void 0:r.value)??null}async function b(e,n){await(await i.getDB()).kv.put({key:e,value:n})}async function d(e){await(await i.getDB()).kv.delete(e)}function v(e){const n=new Map,r=(e==null?void 0:e.prefix)??"",c=t=>`${r}${t}`;return{async getItem(t){try{const u=await(await i.getDB()).kv.get(c(t));return u?JSON.stringify(u.value):null}catch(a){if(e!=null&&e.fallbackToMemory)return n.get(c(t))??null;throw a}},async setItem(t,a){try{await(await i.getDB()).kv.put({key:c(t),value:JSON.parse(a)})}catch(u){if(e!=null&&e.fallbackToMemory){n.set(c(t),a);return}throw u}},async removeItem(t){try{await(await i.getDB()).kv.delete(c(t))}catch(a){if(e!=null&&e.fallbackToMemory){n.delete(c(t));return}throw a}}}}exports.createORMStringStorage=v;exports.kvGet=l;exports.kvRemove=d;exports.kvSet=b;
|
|
2
|
+
//# sourceMappingURL=storage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.cjs","sources":["../src/storage.ts"],"sourcesContent":["import { getDB } from \"./db\";\n\nexport interface AsyncStringStorage {\n getItem(name: string): Promise<string | null>;\n setItem(name: string, value: string): Promise<void>;\n removeItem(name: string): Promise<void>;\n}\n\ntype storeKeys = \"property\" | \"user\" | \"app\";\n\n// Generic typed KV helpers (store raw objects in the ORM's kv table)\nexport async function kvGet<T>(key: storeKeys): Promise<T | null> {\n const db = await getDB();\n const row = await db.kv.get(key);\n return (row?.value as T | undefined) ?? null;\n}\nexport async function kvSet<T>(key: storeKeys, value: T): Promise<void> {\n const db = await getDB();\n await db.kv.put({ key, value });\n}\nexport async function kvRemove(key: storeKeys): Promise<void> {\n const db = await getDB();\n await db.kv.delete(key);\n}\n\nexport function createORMStringStorage(opts?: {\n prefix?: string;\n fallbackToMemory?: boolean;\n}): AsyncStringStorage {\n const mem = new Map<string, string>(); // optional fallback\n const prefix = opts?.prefix ?? \"\";\n\n const toKey = (name: string) => `${prefix}${name}`;\n\n return {\n async getItem(name) {\n try {\n const db = await getDB();\n const row = await db.kv.get(toKey(name));\n return row ? JSON.stringify(row.value) : null;\n } catch (e) {\n if (opts?.fallbackToMemory) return mem.get(toKey(name)) ?? null;\n throw e;\n }\n },\n async setItem(name, value) {\n try {\n const db = await getDB();\n await db.kv.put({ key: toKey(name), value: JSON.parse(value) });\n } catch (e) {\n if (opts?.fallbackToMemory) {\n mem.set(toKey(name), value);\n return;\n }\n throw e;\n }\n },\n async removeItem(name) {\n try {\n const db = await getDB();\n await db.kv.delete(toKey(name));\n } catch (e) {\n if (opts?.fallbackToMemory) {\n mem.delete(toKey(name));\n return;\n }\n throw e;\n }\n },\n };\n}\n"],"names":["kvGet","key","row","getDB","kvSet","value","kvRemove","createORMStringStorage","opts","mem","prefix","toKey","name","e"],"mappings":"4GAWA,eAAsBA,EAASC,EAAmC,CAEhE,MAAMC,EAAM,MADD,MAAMC,QAAA,GACI,GAAG,IAAIF,CAAG,EAC/B,OAAQC,GAAA,YAAAA,EAAK,QAA2B,IAC1C,CACA,eAAsBE,EAASH,EAAgBI,EAAyB,CAEtE,MADW,MAAMF,QAAA,GACR,GAAG,IAAI,CAAE,IAAAF,EAAK,MAAAI,EAAO,CAChC,CACA,eAAsBC,EAASL,EAA+B,CAE5D,MADW,MAAME,QAAA,GACR,GAAG,OAAOF,CAAG,CACxB,CAEO,SAASM,EAAuBC,EAGhB,CACrB,MAAMC,MAAU,IACVC,GAASF,GAAA,YAAAA,EAAM,SAAU,GAEzBG,EAASC,GAAiB,GAAGF,CAAM,GAAGE,CAAI,GAEhD,MAAO,CACL,MAAM,QAAQA,EAAM,CAClB,GAAI,CAEF,MAAMV,EAAM,MADD,MAAMC,QAAA,GACI,GAAG,IAAIQ,EAAMC,CAAI,CAAC,EACvC,OAAOV,EAAM,KAAK,UAAUA,EAAI,KAAK,EAAI,IAC3C,OAASW,EAAG,CACV,GAAIL,GAAA,MAAAA,EAAM,iBAAkB,OAAOC,EAAI,IAAIE,EAAMC,CAAI,CAAC,GAAK,KAC3D,MAAMC,CACR,CACF,EACA,MAAM,QAAQD,EAAMP,EAAO,CACzB,GAAI,CAEF,MADW,MAAMF,QAAA,GACR,GAAG,IAAI,CAAE,IAAKQ,EAAMC,CAAI,EAAG,MAAO,KAAK,MAAMP,CAAK,EAAG,CAChE,OAASQ,EAAG,CACV,GAAIL,GAAA,MAAAA,EAAM,iBAAkB,CAC1BC,EAAI,IAAIE,EAAMC,CAAI,EAAGP,CAAK,EAC1B,MACF,CACA,MAAMQ,CACR,CACF,EACA,MAAM,WAAWD,EAAM,CACrB,GAAI,CAEF,MADW,MAAMT,QAAA,GACR,GAAG,OAAOQ,EAAMC,CAAI,CAAC,CAChC,OAASC,EAAG,CACV,GAAIL,GAAA,MAAAA,EAAM,iBAAkB,CAC1BC,EAAI,OAAOE,EAAMC,CAAI,CAAC,EACtB,MACF,CACA,MAAMC,CACR,CACF,CAAA,CAEJ"}
|
package/dist/storage.mjs
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getDB as i } from "./db.mjs";
|
|
2
|
+
async function w(e) {
|
|
3
|
+
const r = await (await i()).kv.get(e);
|
|
4
|
+
return (r == null ? void 0 : r.value) ?? null;
|
|
5
|
+
}
|
|
6
|
+
async function b(e, n) {
|
|
7
|
+
await (await i()).kv.put({ key: e, value: n });
|
|
8
|
+
}
|
|
9
|
+
async function d(e) {
|
|
10
|
+
await (await i()).kv.delete(e);
|
|
11
|
+
}
|
|
12
|
+
function y(e) {
|
|
13
|
+
const n = /* @__PURE__ */ new Map(), r = (e == null ? void 0 : e.prefix) ?? "", c = (t) => `${r}${t}`;
|
|
14
|
+
return {
|
|
15
|
+
async getItem(t) {
|
|
16
|
+
try {
|
|
17
|
+
const l = await (await i()).kv.get(c(t));
|
|
18
|
+
return l ? JSON.stringify(l.value) : null;
|
|
19
|
+
} catch (a) {
|
|
20
|
+
if (e != null && e.fallbackToMemory) return n.get(c(t)) ?? null;
|
|
21
|
+
throw a;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
async setItem(t, a) {
|
|
25
|
+
try {
|
|
26
|
+
await (await i()).kv.put({ key: c(t), value: JSON.parse(a) });
|
|
27
|
+
} catch (l) {
|
|
28
|
+
if (e != null && e.fallbackToMemory) {
|
|
29
|
+
n.set(c(t), a);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
throw l;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
async removeItem(t) {
|
|
36
|
+
try {
|
|
37
|
+
await (await i()).kv.delete(c(t));
|
|
38
|
+
} catch (a) {
|
|
39
|
+
if (e != null && e.fallbackToMemory) {
|
|
40
|
+
n.delete(c(t));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
throw a;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
y as createORMStringStorage,
|
|
50
|
+
w as kvGet,
|
|
51
|
+
d as kvRemove,
|
|
52
|
+
b as kvSet
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=storage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.mjs","sources":["../src/storage.ts"],"sourcesContent":["import { getDB } from \"./db\";\n\nexport interface AsyncStringStorage {\n getItem(name: string): Promise<string | null>;\n setItem(name: string, value: string): Promise<void>;\n removeItem(name: string): Promise<void>;\n}\n\ntype storeKeys = \"property\" | \"user\" | \"app\";\n\n// Generic typed KV helpers (store raw objects in the ORM's kv table)\nexport async function kvGet<T>(key: storeKeys): Promise<T | null> {\n const db = await getDB();\n const row = await db.kv.get(key);\n return (row?.value as T | undefined) ?? null;\n}\nexport async function kvSet<T>(key: storeKeys, value: T): Promise<void> {\n const db = await getDB();\n await db.kv.put({ key, value });\n}\nexport async function kvRemove(key: storeKeys): Promise<void> {\n const db = await getDB();\n await db.kv.delete(key);\n}\n\nexport function createORMStringStorage(opts?: {\n prefix?: string;\n fallbackToMemory?: boolean;\n}): AsyncStringStorage {\n const mem = new Map<string, string>(); // optional fallback\n const prefix = opts?.prefix ?? \"\";\n\n const toKey = (name: string) => `${prefix}${name}`;\n\n return {\n async getItem(name) {\n try {\n const db = await getDB();\n const row = await db.kv.get(toKey(name));\n return row ? JSON.stringify(row.value) : null;\n } catch (e) {\n if (opts?.fallbackToMemory) return mem.get(toKey(name)) ?? null;\n throw e;\n }\n },\n async setItem(name, value) {\n try {\n const db = await getDB();\n await db.kv.put({ key: toKey(name), value: JSON.parse(value) });\n } catch (e) {\n if (opts?.fallbackToMemory) {\n mem.set(toKey(name), value);\n return;\n }\n throw e;\n }\n },\n async removeItem(name) {\n try {\n const db = await getDB();\n await db.kv.delete(toKey(name));\n } catch (e) {\n if (opts?.fallbackToMemory) {\n mem.delete(toKey(name));\n return;\n }\n throw e;\n }\n },\n };\n}\n"],"names":["kvGet","key","row","getDB","kvSet","value","kvRemove","createORMStringStorage","opts","mem","prefix","toKey","name","e"],"mappings":";AAWA,eAAsBA,EAASC,GAAmC;AAEhE,QAAMC,IAAM,OADD,MAAMC,EAAA,GACI,GAAG,IAAIF,CAAG;AAC/B,UAAQC,KAAA,gBAAAA,EAAK,UAA2B;AAC1C;AACA,eAAsBE,EAASH,GAAgBI,GAAyB;AAEtE,SADW,MAAMF,EAAA,GACR,GAAG,IAAI,EAAE,KAAAF,GAAK,OAAAI,GAAO;AAChC;AACA,eAAsBC,EAASL,GAA+B;AAE5D,SADW,MAAME,EAAA,GACR,GAAG,OAAOF,CAAG;AACxB;AAEO,SAASM,EAAuBC,GAGhB;AACrB,QAAMC,wBAAU,IAAA,GACVC,KAASF,KAAA,gBAAAA,EAAM,WAAU,IAEzBG,IAAQ,CAACC,MAAiB,GAAGF,CAAM,GAAGE,CAAI;AAEhD,SAAO;AAAA,IACL,MAAM,QAAQA,GAAM;AAClB,UAAI;AAEF,cAAMV,IAAM,OADD,MAAMC,EAAA,GACI,GAAG,IAAIQ,EAAMC,CAAI,CAAC;AACvC,eAAOV,IAAM,KAAK,UAAUA,EAAI,KAAK,IAAI;AAAA,MAC3C,SAASW,GAAG;AACV,YAAIL,KAAA,QAAAA,EAAM,iBAAkB,QAAOC,EAAI,IAAIE,EAAMC,CAAI,CAAC,KAAK;AAC3D,cAAMC;AAAA,MACR;AAAA,IACF;AAAA,IACA,MAAM,QAAQD,GAAMP,GAAO;AACzB,UAAI;AAEF,eADW,MAAMF,EAAA,GACR,GAAG,IAAI,EAAE,KAAKQ,EAAMC,CAAI,GAAG,OAAO,KAAK,MAAMP,CAAK,GAAG;AAAA,MAChE,SAASQ,GAAG;AACV,YAAIL,KAAA,QAAAA,EAAM,kBAAkB;AAC1B,UAAAC,EAAI,IAAIE,EAAMC,CAAI,GAAGP,CAAK;AAC1B;AAAA,QACF;AACA,cAAMQ;AAAA,MACR;AAAA,IACF;AAAA,IACA,MAAM,WAAWD,GAAM;AACrB,UAAI;AAEF,eADW,MAAMT,EAAA,GACR,GAAG,OAAOQ,EAAMC,CAAI,CAAC;AAAA,MAChC,SAASC,GAAG;AACV,YAAIL,KAAA,QAAAA,EAAM,kBAAkB;AAC1B,UAAAC,EAAI,OAAOE,EAAMC,CAAI,CAAC;AACtB;AAAA,QACF;AACA,cAAMC;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../storage.cjs"),c=require("../schema.cjs"),S=require("../validation.cjs"),h={availability:void 0,bedrooms:void 0,cost:void 0,highlights:void 0},f={properties:{},currentPropertyId:null,currentPropertySlug:null,hasPreviouslySearched:[],unitResults:[],filters:h,tempFilters:h,apiFilters:{limit:10,page:1},resultsMode:"all",resolvedQuestionnaireValues:{},sortBy:"relevance"},U=o=>o==null?[]:Array.isArray(o)?o:[o],m=o=>U(o).flatMap(t=>{if(t==null)return[];if(Array.isArray(t))return t;if(typeof t=="object"&&"value"in t){const e=t.value;return Array.isArray(e)?e:e!=null?[e]:[]}return[t]}),P=o=>m(o).flatMap(t=>Array.isArray(t)?t:[t]).map(t=>String(t)).map(t=>t.trim()).filter(t=>t.length>0),b=o=>m(o).map(t=>{if(typeof t=="number"&&Number.isFinite(t))return t;const e=Number(t);return Number.isFinite(e)?e:null}).filter(t=>t!==null),v=o=>{if(o==null)return null;if(typeof o=="number")return Number.isFinite(o)?o:null;if(typeof o=="object"&&"value"in o)return v(o.value);const t=Number(o);return Number.isFinite(t)?t:null};class w{async getState(){const t=await g.kvGet("app");if(!t)return f;const e={...f,...t,properties:t.properties??{},unitResults:t.unitResults??[],currentPropertyId:t.currentPropertyId==null?null:String(t.currentPropertyId),currentPropertySlug:t.currentPropertySlug??null,hasPreviouslySearched:Array.isArray(t.hasPreviouslySearched)?t.hasPreviouslySearched.map(String):[]},r=c.UnifiedStoreDataSchema.safeParse(e);if(r.success)return r.data;const i=Object.entries(e.properties??{}).reduce((p,[l,d])=>{const y=c.UserPropertyStateSchema.safeParse(d);return y.success&&(p[l]=y.data),p},{}),s=(Array.isArray(e.unitResults)?e.unitResults:e.unitResults&&typeof e.unitResults=="object"?Object.values(e.unitResults):[]).reduce((p,l)=>{const d=c.UnitSchema.safeParse(l);return d.success&&p.push(d.data),p},[]),a={...e,properties:i,unitResults:s},u=c.UnifiedStoreDataSchema.safeParse(a);return u.success?u.data:f}async setState(t){const e=await this.getState(),r=t(e),i=c.UnifiedStoreDataSchema.parse(r);await g.kvSet("app",i)}async waitForCurrentProperty(t=1e3){const e=Date.now()+t;for(;Date.now()<e;){const n=await this.getState(),s=n.currentPropertyId;if(s&&n.properties[s])return s;await new Promise(a=>setTimeout(a,16))}const r=await this.getState(),i=r.currentPropertyId;if(i&&r.properties[i])return i;throw new Error("UnifiedStore: current property was not initialized in time")}async initializeProperty(t,e){const r=String(t);await this.setState(i=>i.properties&&i.properties[r]?{...i,currentPropertyId:r,currentPropertySlug:e}:{...i,currentPropertyId:r,currentPropertySlug:e,properties:{...i.properties,[r]:{id:r,slug:e,favoritedUnits:[],tourContactedOn:null,viewedUnits:[],questionnaireResults:null,tourContactData:null}}})}async setUnitResults(t,e){const r=e??c.UnitSchema,i=[];(Array.isArray(t)?t:t&&typeof t=="object"?Object.values(t):[]).forEach((s,a)=>{const u=S.validate(r,s,`unitResults[${a}]`);u&&i.push(u)}),await this.setState(s=>({...s,unitResults:i}))}async clearUnitResults(){await this.setState(t=>({...t,unitResults:[]}))}async setPropertyData(t,e,r){const i=String(t),n=r??c.PropertySchema;await this.setState(s=>{const a=s.properties[i];if(!a)return s;const u=S.validate(n,e,`properties.${i}.data`);return u?{...s,properties:{...s.properties,[i]:{...a,data:u}}}:s})}async mergePropertyData(t,e,r){const i=String(t),n=r??c.PropertySchema;await this.setState(s=>{const a=s.properties[i];if(!a)return s;const u=a.data;if(!u){const y=S.validate(n,e,`properties.${i}.data`);return y?{...s,properties:{...s.properties,[i]:{...a,data:y}}}:s}const p=n.partial(),l=S.validate(p,e,`properties.${i}.data.partial`);if(!l)return s;const d=S.validate(n,{...u,...l},`properties.${i}.data`);return d?{...s,properties:{...s.properties,[i]:{...a,data:d}}}:s})}async upsertPropertyFromApi(t,e){const i=(e??c.PropertySchema).parse(t),n=i.id??i.propertyId;if(n==null)throw new Error("upsertPropertyFromApi: property id is required");const s=String(n),a=i.slug??void 0;await this.setState(u=>{const p=u.properties[s],l=p?{...p,...a?{slug:a}:{},data:i}:{id:s,slug:a??"",favoritedUnits:[],tourContactedOn:null,viewedUnits:[],questionnaireResults:null,tourContactData:null,data:i};return{...u,properties:{...u.properties,[s]:l}}})}async setCurrentProperty(t,e){const r=String(t);await this.setState(i=>({...i,currentPropertyId:r,currentPropertySlug:e||i.currentPropertySlug}))}async setCurrentPropertySlug(t){await this.setState(e=>({...e,currentPropertySlug:t}))}async setHasPreviouslySearched(t){await this.setState(e=>({...e,hasPreviouslySearched:Array.from(new Set([...e.hasPreviouslySearched,t]))}))}async toggleFavorite(t){await this.setState(e=>{const r=e.currentPropertyId;if(!r)return e;const i=e.properties[r];if(!i)return e;const s=i.favoritedUnits.includes(t)?i.favoritedUnits.filter(a=>a!==t):[...i.favoritedUnits,t];return{...e,properties:{...e.properties,[r]:{...i,favoritedUnits:s}}}})}async markUnitAsViewed(t,e){const r=new Date,i=`${String(r.getMonth()+1).padStart(2,"0")}/${String(r.getDate()).padStart(2,"0")}`;await this.setState(n=>{const s=n.currentPropertyId;if(!s)return n;const a=n.properties[s];if(!a)return n;const u=[...a.viewedUnits.filter(p=>p.unitId!==t),{unitId:t,viewedDate:i}];return{...n,properties:{...n.properties,[s]:{...a,viewedUnits:u}}}}),typeof window<"u"&&window.open(`//${e}`,"_blank")}async setTourContactedOn(){await this.setState(t=>{const e=t.currentPropertyId;if(!e)return t;const r=t.properties[e];return r?{...t,properties:{...t.properties,[e]:{...r,tourContactedOn:new Date().toISOString()}}}:t})}async getTourContactedOn(){var r;const t=await this.getState(),e=t.currentPropertyId;return e?((r=t.properties[e])==null?void 0:r.tourContactedOn)??null:null}async setQuestionnaireResults(t){await this.setState(e=>{const r=e.currentPropertyId;if(!r)return e;const i=e.properties[r];return i?{...e,properties:{...e.properties,[r]:{...i,questionnaireResults:t}}}:e})}async setTourContactData(t){const e=await this.waitForCurrentProperty();await this.setState(r=>{const i=r.properties[e];return i?{...r,properties:{...r.properties,[e]:{...i,tourContactData:t}}}:r})}async setFilters(t){await this.setState(e=>({...e,filters:{...e.filters,...t}}))}async setTempFilters(t){await this.setState(e=>({...e,tempFilters:{...e.tempFilters,...t}}))}async setFiltersToDefault(){await this.setState(t=>({...t,filters:h}))}async setApiFilters(t){await this.setState(e=>({...e,apiFilters:{...e.apiFilters,...t}}))}async handleTempFilterChange(t,e){await this.setState(r=>({...r,tempFilters:{...r.tempFilters,[t]:e}}))}async submitFilterUpdate(){await this.setState(t=>{const e={...t.apiFilters,availability:P(t.filters.availability),bedrooms:b(t.filters.bedrooms),cost:v(t.filters.cost),highlights:P(t.filters.highlights)};return{...t,apiFilters:e}})}async setResultsMode(t){await this.setState(e=>({...e,resultsMode:t}))}async setSortBy(t){await this.setState(e=>({...e,sortBy:t}))}async setResolvedQuestionnaireValues(t,e){await this.setState(r=>({...r,resolvedQuestionnaireValues:{...r.resolvedQuestionnaireValues,[t]:e}}))}async getUnitState(t){var i;const e=await this.getState(),r=e.currentPropertyId?e.properties[e.currentPropertyId]:null;return{isFavorite:(r==null?void 0:r.favoritedUnits.includes(t))??!1,viewedDate:((i=r==null?void 0:r.viewedUnits.find(n=>n.unitId===t))==null?void 0:i.viewedDate)??""}}async getResultsUrl(){const t=await this.getState();return t.currentPropertySlug?`/${t.currentPropertySlug}/results`:null}async getCurrentProperty(){const t=await this.getState();return t.currentPropertyId?t.properties[t.currentPropertyId]??null:null}async getPropertyData(t){const e=await this.getState(),r=t==null?e.currentPropertyId:String(t);return r?e.properties[r]??null:null}async getFullState(){return this.getState()}async initialize(){await this.setState(t=>({...f,...t}))}}const F=new w;exports.Store=w;exports.UnifiedStore=w;exports.store=F;
|
|
2
|
+
//# sourceMappingURL=store.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.cjs","sources":["../../src/stores/store.ts"],"sourcesContent":["import { kvGet, kvSet } from \"../storage\";\nimport type { ZodObject, ZodType, ZodTypeAny } from \"zod\";\nimport {\n UnifiedStoreDataSchema,\n UserPropertyStateSchema,\n type UnifiedStoreData,\n type UserPropertyState,\n type Property,\n type Filters,\n type QueryParams,\n type ResultsMode,\n type SortBy,\n type TourContactData,\n type Unit,\n PropertySchema,\n TourContactDataSchema,\n UnitSchema,\n} from \"../schema\";\nimport { validate } from \"../validation\";\n\n// Default values\nconst defaultFilters: Filters = {\n availability: undefined,\n bedrooms: undefined,\n cost: undefined,\n highlights: undefined,\n};\n\nconst defaultUnifiedStoreData: UnifiedStoreData = {\n // Property data\n properties: {},\n currentPropertyId: null,\n currentPropertySlug: null,\n hasPreviouslySearched: [],\n\n // App data\n unitResults: [],\n filters: defaultFilters,\n tempFilters: defaultFilters,\n apiFilters: {\n limit: 10,\n page: 1,\n },\n resultsMode: \"all\",\n resolvedQuestionnaireValues: {},\n sortBy: \"relevance\",\n};\n\nconst toArray = (input: unknown): unknown[] => {\n if (input == null) return [];\n return Array.isArray(input) ? input : [input];\n};\n\nconst extractFilterValues = (value: unknown): unknown[] => {\n return toArray(value).flatMap(item => {\n if (item == null) return [];\n if (Array.isArray(item)) return item;\n if (typeof item === \"object\" && \"value\" in (item as any)) {\n const v = (item as any).value;\n return Array.isArray(v) ? v : v != null ? [v] : [];\n }\n return [item];\n });\n};\n\nconst toStringArray = (value: unknown): string[] =>\n extractFilterValues(value)\n .flatMap(v => (Array.isArray(v) ? v : [v]))\n .map(v => String(v))\n .map(v => v.trim())\n .filter(v => v.length > 0);\n\nconst toNumberArray = (value: unknown): number[] =>\n extractFilterValues(value)\n .map(v => {\n if (typeof v === \"number\" && Number.isFinite(v)) return v;\n const num = Number(v);\n return Number.isFinite(num) ? num : null;\n })\n .filter((v): v is number => v !== null);\n\nconst toNumberValue = (value: unknown): number | null => {\n if (value == null) return null;\n if (typeof value === \"number\") return Number.isFinite(value) ? value : null;\n if (typeof value === \"object\" && \"value\" in (value as any)) {\n return toNumberValue((value as any).value);\n }\n const num = Number(value);\n return Number.isFinite(num) ? num : null;\n};\n\n// Unified store class\nexport class UnifiedStore {\n /**\n * Resolves the persisted unified store snapshot, coercing legacy shapes into the latest schema\n * and sanitizing invalid entries where possible.\n */\n private async getState(): Promise<UnifiedStoreData> {\n const state = await kvGet<UnifiedStoreData>(\"app\");\n if (!state) {\n return defaultUnifiedStoreData;\n }\n\n const merged = {\n ...defaultUnifiedStoreData,\n ...state,\n properties: state.properties ?? {},\n unitResults: state.unitResults ?? [],\n currentPropertyId:\n state.currentPropertyId == null ? null : String(state.currentPropertyId),\n currentPropertySlug: state.currentPropertySlug ?? null,\n hasPreviouslySearched: Array.isArray(state.hasPreviouslySearched)\n ? state.hasPreviouslySearched.map(String)\n : [],\n };\n\n const parsed = UnifiedStoreDataSchema.safeParse(merged);\n if (parsed.success) return parsed.data;\n\n // Sanitize by dropping invalid property entries and unit results\n const sanitizedProperties = Object.entries(merged.properties ?? {}).reduce<\n Record<string, UserPropertyState>\n >((acc, [key, value]) => {\n const entry = UserPropertyStateSchema.safeParse(value);\n if (entry.success) acc[key] = entry.data;\n return acc;\n }, {});\n\n const rawUnitResults = Array.isArray(merged.unitResults)\n ? merged.unitResults\n : merged.unitResults && typeof merged.unitResults === \"object\"\n ? Object.values(merged.unitResults as Record<string, unknown>)\n : [];\n\n const sanitizedUnitResults = rawUnitResults.reduce<Unit[]>((acc, value) => {\n const entry = UnitSchema.safeParse(value);\n if (entry.success) acc.push(entry.data);\n return acc;\n }, []);\n\n const fallback = {\n ...merged,\n properties: sanitizedProperties,\n unitResults: sanitizedUnitResults,\n };\n\n const fallbackParsed = UnifiedStoreDataSchema.safeParse(fallback);\n return fallbackParsed.success ? fallbackParsed.data : defaultUnifiedStoreData;\n }\n\n /**\n * Applies an updater function to the current store state, validates the result, and persists it.\n *\n * @param updater - Pure function that maps the current state to the next state.\n */\n private async setState(updater: (state: UnifiedStoreData) => UnifiedStoreData): Promise<void> {\n const currentState = await this.getState();\n const newState = updater(currentState);\n const validatedState = UnifiedStoreDataSchema.parse(newState);\n await kvSet(\"app\", validatedState);\n }\n\n /**\n * Polls the persisted state until a current property pointer is available or the timeout elapses.\n *\n * @param timeoutMs - Maximum time in milliseconds to wait before failing.\n * @returns The active property ID once it becomes available.\n * @throws Error if the property pointer is not set before the timeout expires.\n */\n private async waitForCurrentProperty(timeoutMs = 1000): Promise<string> {\n const deadline = Date.now() + timeoutMs;\n\n while (Date.now() < deadline) {\n const state = await this.getState();\n const propertyId = state.currentPropertyId;\n if (propertyId && state.properties[propertyId]) return propertyId;\n\n await new Promise(resolve => setTimeout(resolve, 16));\n }\n\n const finalState = await this.getState();\n const propertyId = finalState.currentPropertyId;\n if (propertyId && finalState.properties[propertyId]) return propertyId;\n\n throw new Error(\"UnifiedStore: current property was not initialized in time\");\n }\n\n // === PROPERTY OPERATIONS ===\n\n /**\n * Ensures a property entry exists and registers it as the current property.\n *\n * @param propertyId - Identifier used to track the property.\n * @param slug - Canonical slug associated with the property.\n */\n async initializeProperty(propertyId: string | number, slug: string): Promise<void> {\n const id = String(propertyId);\n await this.setState(state => {\n if (state.properties && state.properties[id]) {\n return {\n ...state,\n currentPropertyId: id,\n currentPropertySlug: slug\n };\n }\n\n return {\n ...state,\n currentPropertyId: id,\n currentPropertySlug: slug,\n properties: {\n ...state.properties,\n [id]: {\n id,\n slug,\n favoritedUnits: [],\n tourContactedOn: null,\n viewedUnits: [],\n questionnaireResults: null,\n tourContactData: null,\n },\n },\n };\n });\n }\n\n // === UNIT RESULTS CACHE ===\n /**\n * Persists a collection of units after validating each entry against the provided schema.\n *\n * @param units - Raw units collection returned by an API call.\n * @param schema - Optional override schema when the default `UnitSchema` is not sufficient.\n */\n async setUnitResults(\n units: unknown,\n schema?: ZodTypeAny,\n ): Promise<void> {\n const baseSchema = (schema ?? UnitSchema) as ZodType<Unit>;\n const validatedUnits: Unit[] = [];\n const collection = Array.isArray(units)\n ? units\n : units && typeof units === \"object\"\n ? Object.values(units as Record<string, unknown>)\n : [];\n\n collection.forEach((unit, index) => {\n const parsed = validate(baseSchema, unit, `unitResults[${index}]`);\n if (parsed) validatedUnits.push(parsed);\n });\n await this.setState(state => ({\n ...state,\n unitResults: validatedUnits,\n }));\n }\n\n /**\n * Clears the cached unit results array.\n */\n async clearUnitResults(): Promise<void> {\n await this.setState(state => ({\n ...state,\n unitResults: [],\n }));\n }\n\n // === PROPERTY DATA BAG (full property payloads & custom data) ===\n /**\n * Replaces the persisted property payload with validated data.\n *\n * @param propertyId - ID of the property to mutate.\n * @param data - New property payload.\n * @param schema - Optional schema override used for validation.\n */\n async setPropertyData(\n propertyId: string | number,\n data: unknown,\n schema?: ZodObject<any, any, any, any, any>,\n ): Promise<void> {\n const id = String(propertyId);\n const baseSchema = (schema ?? PropertySchema) as ZodObject<any, any, any, any, any>;\n await this.setState(state => {\n const property = state.properties[id];\n if (!property) return state;\n const validated = validate(baseSchema, data, `properties.${id}.data`) as Property | null;\n if (!validated) return state;\n return {\n ...state,\n properties: {\n ...state.properties,\n [id]: {\n ...property,\n data: validated,\n },\n },\n };\n });\n }\n\n /**\n * Merges partial property data into the persisted payload with validation safeguards.\n *\n * @param propertyId - ID of the property to update.\n * @param partial - Partial payload to merge.\n * @param schema - Optional schema override for validation.\n */\n async mergePropertyData(\n propertyId: string | number,\n partial: unknown,\n schema?: ZodObject<any, any, any, any, any>,\n ): Promise<void> {\n const id = String(propertyId);\n const baseSchema = (schema ?? PropertySchema) as ZodObject<any, any, any, any, any>;\n await this.setState(state => {\n const property = state.properties[id];\n if (!property) return state;\n const current = property.data;\n if (!current) {\n const full = validate(baseSchema, partial, `properties.${id}.data`) as Property | null;\n if (!full) return state;\n return {\n ...state,\n properties: {\n ...state.properties,\n [id]: {\n ...property,\n data: full,\n },\n },\n };\n }\n\n const partialSchema = baseSchema.partial();\n const validatedPartial = validate(\n partialSchema,\n partial,\n `properties.${id}.data.partial`,\n ) as Partial<Property> | null;\n if (!validatedPartial) return state;\n const merged = validate(\n baseSchema,\n { ...current, ...validatedPartial },\n `properties.${id}.data`,\n ) as Property | null;\n if (!merged) return state;\n return {\n ...state,\n properties: {\n ...state.properties,\n [id]: {\n ...property,\n data: merged,\n },\n },\n };\n });\n }\n\n // Accepts a full API property object, validates, and stores it into the\n // per-property `data` bag. Ensures the property entry exists/updated.\n /**\n * Inserts or updates a property entry from an API payload, enforcing schema validation.\n *\n * @param apiProperty - Raw property object returned by an API.\n * @param schema - Optional schema override.\n */\n async upsertPropertyFromApi(\n apiProperty: unknown,\n schema?: ZodTypeAny,\n ): Promise<void> {\n const s = schema ?? PropertySchema;\n const parsed: any = s.parse(apiProperty);\n const id = parsed.id ?? parsed.propertyId;\n if (id === undefined || id === null) {\n throw new Error(\"upsertPropertyFromApi: property id is required\");\n }\n const propertyId = String(id);\n const slug: string | undefined = parsed.slug ?? undefined;\n\n await this.setState(state => {\n const existing = state.properties[propertyId];\n const next: UserPropertyState = existing\n ? {\n ...existing,\n ...(slug ? { slug } : {}),\n data: parsed,\n }\n : {\n id: propertyId,\n slug: slug ?? \"\",\n favoritedUnits: [],\n tourContactedOn: null,\n viewedUnits: [],\n questionnaireResults: null,\n tourContactData: null,\n data: parsed,\n };\n\n return {\n ...state,\n properties: {\n ...state.properties,\n [propertyId]: next,\n },\n };\n });\n }\n\n /**\n * Marks the provided property as current and optionally updates the slug.\n *\n * @param propertyId - Property identifier to focus.\n * @param slug - Optional slug override.\n */\n async setCurrentProperty(propertyId: string | number, slug?: string): Promise<void> {\n const id = String(propertyId);\n await this.setState(state => ({\n ...state,\n currentPropertyId: id,\n currentPropertySlug: slug || state.currentPropertySlug,\n }));\n }\n\n /**\n * Updates the slug for the current property selection.\n *\n * @param slug - New slug to persist.\n */\n async setCurrentPropertySlug(slug: string): Promise<void> {\n await this.setState(state => ({\n ...state,\n currentPropertySlug: slug\n }));\n }\n\n /**\n * Adds a slug to the `hasPreviouslySearched` list without duplicating existing entries.\n *\n * @param slug - Slug to record.\n */\n async setHasPreviouslySearched(slug: string): Promise<void> {\n await this.setState(state => ({\n ...state,\n hasPreviouslySearched: Array.from(\n new Set([...state.hasPreviouslySearched, slug])\n ),\n }));\n }\n\n /**\n * Toggles a unit's favorite state for the currently active property.\n *\n * @param unitId - Unit identifier to toggle.\n */\n async toggleFavorite(unitId: string): Promise<void> {\n await this.setState(state => {\n const propertyId = state.currentPropertyId;\n if (!propertyId) return state;\n\n const property = state.properties[propertyId];\n if (!property) return state;\n\n const isFavorited = property.favoritedUnits.includes(unitId);\n const updatedFavoritedUnits = isFavorited\n ? property.favoritedUnits.filter((id) => id !== unitId)\n : [...property.favoritedUnits, unitId];\n\n return {\n ...state,\n properties: {\n ...state.properties,\n [propertyId]: {\n ...property,\n favoritedUnits: updatedFavoritedUnits,\n },\n },\n };\n });\n }\n\n /**\n * Records the most recent view date for a unit and opens the unit URL in the browser when available.\n *\n * @param unitId - Identifier of the viewed unit.\n * @param slug - Property slug used to construct the URL.\n */\n async markUnitAsViewed(unitId: string, slug: string): Promise<void> {\n const today = new Date();\n const formattedDate = `${String(today.getMonth() + 1).padStart(\n 2,\n \"0\"\n )}/${String(today.getDate()).padStart(2, \"0\")}`;\n\n await this.setState(state => {\n const propertyId = state.currentPropertyId;\n if (!propertyId) return state;\n\n const property = state.properties[propertyId];\n if (!property) return state;\n\n const updatedViewedUnits = [\n ...property.viewedUnits.filter((u) => u.unitId !== unitId),\n { unitId, viewedDate: formattedDate },\n ];\n\n return {\n ...state,\n properties: {\n ...state.properties,\n [propertyId]: {\n ...property,\n viewedUnits: updatedViewedUnits,\n },\n },\n };\n });\n\n if (typeof window !== 'undefined') {\n window.open(`//${slug}`, \"_blank\");\n }\n }\n\n /**\n * Stamps the current property with the moment the tour outreach occurred.\n */\n async setTourContactedOn(): Promise<void> {\n await this.setState(state => {\n const propertyId = state.currentPropertyId;\n if (!propertyId) return state;\n\n const property = state.properties[propertyId];\n if (!property) return state;\n\n return {\n ...state,\n properties: {\n ...state.properties,\n [propertyId]: {\n ...property,\n tourContactedOn: new Date().toISOString(),\n },\n },\n };\n });\n }\n\n /**\n * Reads the stored tour contact timestamp for the current property.\n *\n * @returns ISO string or null when no timestamp exists.\n */\n async getTourContactedOn(): Promise<string | null> {\n const state = await this.getState();\n const propertyId = state.currentPropertyId;\n if (!propertyId) return null;\n\n return state.properties[propertyId]?.tourContactedOn ?? null;\n }\n\n /**\n * Persists questionnaire results captured for the current property.\n *\n * @param results - Arbitrary questionnaire data.\n */\n async setQuestionnaireResults(results: unknown): Promise<void> {\n await this.setState(state => {\n const propertyId = state.currentPropertyId;\n if (!propertyId) return state;\n\n const property = state.properties[propertyId];\n if (!property) return state;\n\n return {\n ...state,\n properties: {\n ...state.properties,\n [propertyId]: {\n ...property,\n questionnaireResults: results,\n },\n },\n };\n });\n }\n\n /**\n * Persists structured tour contact preferences for the active property. The method waits until\n * a current property is available, allowing callers to invoke it before initialization completes.\n *\n * @param data - Contact preferences captured from the UI.\n */\n async setTourContactData(data: TourContactData): Promise<void> {\n const propertyId = await this.waitForCurrentProperty();\n\n await this.setState(state => {\n const property = state.properties[propertyId];\n if (!property) return state;\n\n return {\n ...state,\n properties: {\n ...state.properties,\n [propertyId]: {\n ...property,\n tourContactData: data,\n },\n },\n };\n });\n }\n\n\n\n\n\n\n\n // === FILTER OPERATIONS ===\n\n /**\n * Merges the provided filter values into the committed filter state.\n *\n * @param filters - Partial filter payload to apply.\n */\n async setFilters(filters: Partial<Filters>): Promise<void> {\n await this.setState(state => ({\n ...state,\n filters: { ...state.filters, ...filters }\n }));\n }\n\n /**\n * Updates the transient filters used for in-progress UI interactions.\n *\n * @param filters - Partial staging filter payload.\n */\n async setTempFilters(filters: Partial<Filters>): Promise<void> {\n await this.setState(state => ({\n ...state,\n tempFilters: { ...state.tempFilters, ...filters }\n }));\n }\n\n /**\n * Resets the committed filters to their default values.\n */\n async setFiltersToDefault(): Promise<void> {\n await this.setState(state => ({ ...state, filters: defaultFilters }));\n }\n\n /**\n * Merges partial values into the API filters payload used for network requests.\n *\n * @param filters - Partial query parameters to persist.\n */\n async setApiFilters(filters: Partial<QueryParams>): Promise<void> {\n await this.setState(state => ({\n ...state,\n apiFilters: { ...state.apiFilters, ...filters }\n }));\n }\n\n /**\n * Updates a single temporary filter field without touching the rest of the staged filters.\n *\n * @param key - Filter key to mutate.\n * @param value - New value to assign.\n */\n async handleTempFilterChange<K extends keyof Filters>(\n key: K,\n value: Filters[K]\n ): Promise<void> {\n await this.setState(state => ({\n ...state,\n tempFilters: { ...state.tempFilters, [key]: value }\n }));\n }\n\n /**\n * Normalizes the committed filters into API-ready structures and persists the result.\n */\n async submitFilterUpdate(): Promise<void> {\n await this.setState(state => {\n const apiParams: QueryParams = {\n ...state.apiFilters,\n availability: toStringArray(state.filters.availability),\n bedrooms: toNumberArray(state.filters.bedrooms),\n cost: toNumberValue(state.filters.cost),\n highlights: toStringArray(state.filters.highlights),\n };\n\n return {\n ...state,\n apiFilters: apiParams,\n };\n });\n }\n\n // === RESULTS AND SORTING ===\n\n /**\n * Persists the selected results mode (e.g. \"all\" or \"favorites\").\n *\n * @param mode - Mode identifier to store.\n */\n async setResultsMode(mode: ResultsMode): Promise<void> {\n await this.setState(state => ({ ...state, resultsMode: mode }));\n }\n\n /**\n * Persists the currently selected sort option.\n *\n * @param sortBy - Sort identifier.\n */\n async setSortBy(sortBy: SortBy): Promise<void> {\n await this.setState(state => ({ ...state, sortBy }));\n }\n\n // === QUESTIONNAIRE ===\n\n /**\n * Stores resolved questionnaire answers keyed by questionnaire name.\n *\n * @param name - Questionnaire identifier.\n * @param values - Selected option values.\n */\n async setResolvedQuestionnaireValues(name: string, values: string[]): Promise<void> {\n await this.setState(state => ({\n ...state,\n resolvedQuestionnaireValues: {\n ...state.resolvedQuestionnaireValues,\n [name]: values\n }\n }));\n }\n\n // === UTILITY METHODS ===\n\n /**\n * Returns convenience state for a unit within the current property.\n *\n * @param unitId - Identifier of the unit to inspect.\n * @returns Favorite flag and last viewed date.\n */\n async getUnitState(unitId: string): Promise<{\n isFavorite: boolean;\n viewedDate: string;\n }> {\n const state = await this.getState();\n const property = state.currentPropertyId ? state.properties[state.currentPropertyId] : null;\n\n return {\n isFavorite: property?.favoritedUnits.includes(unitId) ?? false,\n viewedDate:\n property?.viewedUnits.find((u) => u.unitId === unitId)?.viewedDate ?? \"\",\n };\n }\n\n /**\n * Builds a canonical results URL based on the current property slug.\n *\n * @returns Relative results URL or null when no property is selected.\n */\n async getResultsUrl(): Promise<string | null> {\n const state = await this.getState();\n return state.currentPropertySlug ? `/${state.currentPropertySlug}/results` : null;\n }\n\n /**\n * Retrieves the currently selected property entry.\n *\n * @returns Property state or null when unset.\n */\n async getCurrentProperty(): Promise<UserPropertyState | null> {\n const state = await this.getState();\n return state.currentPropertyId ? state.properties[state.currentPropertyId] ?? null : null;\n }\n\n /**\n * Retrieves property data for a specific property or defaults to the current property.\n *\n * @param propertyId - Optional property identifier to fetch.\n * @returns Property state or null when unavailable.\n */\n async getPropertyData(propertyId?: string | number): Promise<UserPropertyState | null> {\n const state = await this.getState();\n const id = propertyId == null ? state.currentPropertyId : String(propertyId);\n return id ? state.properties[id] ?? null : null;\n }\n\n /**\n * Reads and returns the full validated unified store state.\n */\n async getFullState(): Promise<UnifiedStoreData> {\n return this.getState();\n }\n\n /**\n * Hydrates the store with the default scaffold when no data has been persisted yet.\n */\n async initialize(): Promise<void> {\n // Ensure default shape is present; no-op if already initialized\n await this.setState(state => ({ ...defaultUnifiedStoreData, ...state }));\n }\n\n}\n\n// Export singleton instance\nexport const store = new UnifiedStore();\n// Alias to prefer neutral naming going forward\nexport { UnifiedStore as Store };\n// Re-export types for convenience (tests import from this module)\nexport type { UserPropertyState, Filters } from \"../schema\";\n"],"names":["defaultFilters","defaultUnifiedStoreData","toArray","input","extractFilterValues","value","item","v","toStringArray","toNumberArray","num","toNumberValue","UnifiedStore","state","kvGet","merged","parsed","UnifiedStoreDataSchema","sanitizedProperties","acc","key","entry","UserPropertyStateSchema","sanitizedUnitResults","UnitSchema","fallback","fallbackParsed","updater","currentState","newState","validatedState","kvSet","timeoutMs","deadline","propertyId","resolve","finalState","slug","id","units","schema","baseSchema","validatedUnits","unit","index","validate","data","PropertySchema","property","validated","partial","current","full","partialSchema","validatedPartial","apiProperty","existing","next","unitId","updatedFavoritedUnits","today","formattedDate","updatedViewedUnits","u","_a","results","filters","apiParams","mode","sortBy","name","values","store"],"mappings":"4KAqBMA,EAA0B,CAC9B,aAAc,OACd,SAAU,OACV,KAAM,OACN,WAAY,MACd,EAEMC,EAA4C,CAEhD,WAAY,CAAA,EACZ,kBAAmB,KACnB,oBAAqB,KACrB,sBAAuB,CAAA,EAGvB,YAAa,CAAA,EACb,QAASD,EACT,YAAaA,EACb,WAAY,CACV,MAAO,GACP,KAAM,CAAA,EAER,YAAa,MACb,4BAA6B,CAAA,EAC7B,OAAQ,WACV,EAEME,EAAWC,GACXA,GAA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