@happyvertical/smrt-places 0.57.34 → 0.57.35

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.
@@ -2,136 +2,256 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-places",
5
- "packageVersion": "0.57.34",
5
+ "packageVersion": "0.57.35",
6
6
  "objects": {
7
- "@happyvertical/smrt-places:PlaceAssetCollection": {
8
- "name": "placeassetcollection",
9
- "className": "PlaceAssetCollection",
10
- "qualifiedName": "@happyvertical/smrt-places:PlaceAssetCollection",
11
- "collection": "placeassets",
12
- "filePath": "/home/runner/work/smrt/smrt/packages/places/src/collections/PlaceAssetCollection.ts",
7
+ "@happyvertical/smrt-places:Place": {
8
+ "name": "place",
9
+ "className": "Place",
10
+ "qualifiedName": "@happyvertical/smrt-places:Place",
11
+ "collection": "places",
12
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/Place.ts",
13
13
  "packageName": "@happyvertical/smrt-places",
14
- "fields": {},
14
+ "fields": {
15
+ "created_at": {
16
+ "type": "datetime",
17
+ "required": false
18
+ },
19
+ "updated_at": {
20
+ "type": "datetime",
21
+ "required": false
22
+ },
23
+ "parentId": {
24
+ "type": "foreignKey",
25
+ "required": false,
26
+ "related": "Place",
27
+ "_meta": {
28
+ "nullable": true
29
+ }
30
+ },
31
+ "tenantId": {
32
+ "type": "text",
33
+ "required": false,
34
+ "_meta": {
35
+ "sqlType": "UUID",
36
+ "nullable": true,
37
+ "__tenancy": {
38
+ "isTenantIdField": true,
39
+ "autoFilter": true,
40
+ "required": false,
41
+ "autoPopulate": true,
42
+ "nullable": true,
43
+ "mode": "optional",
44
+ "field": "tenantId",
45
+ "allowSuperAdminBypass": false
46
+ }
47
+ }
48
+ },
49
+ "typeId": {
50
+ "type": "foreignKey",
51
+ "required": false,
52
+ "related": "PlaceType"
53
+ },
54
+ "name": {
55
+ "type": "text",
56
+ "required": false
57
+ },
58
+ "description": {
59
+ "type": "text",
60
+ "required": false
61
+ },
62
+ "latitude": {
63
+ "type": "decimal",
64
+ "required": false,
65
+ "_meta": {}
66
+ },
67
+ "longitude": {
68
+ "type": "decimal",
69
+ "required": false,
70
+ "_meta": {}
71
+ },
72
+ "streetNumber": {
73
+ "type": "text",
74
+ "required": false
75
+ },
76
+ "streetName": {
77
+ "type": "text",
78
+ "required": false
79
+ },
80
+ "city": {
81
+ "type": "text",
82
+ "required": false
83
+ },
84
+ "region": {
85
+ "type": "text",
86
+ "required": false
87
+ },
88
+ "country": {
89
+ "type": "text",
90
+ "required": false
91
+ },
92
+ "postalCode": {
93
+ "type": "text",
94
+ "required": false
95
+ },
96
+ "countryCode": {
97
+ "type": "text",
98
+ "required": false
99
+ },
100
+ "timezone": {
101
+ "type": "text",
102
+ "required": false
103
+ },
104
+ "externalId": {
105
+ "type": "text",
106
+ "required": false
107
+ },
108
+ "source": {
109
+ "type": "text",
110
+ "required": false
111
+ },
112
+ "metadata": {
113
+ "type": "text",
114
+ "required": false
115
+ },
116
+ "createdAt": {
117
+ "type": "text",
118
+ "required": false
119
+ },
120
+ "updatedAt": {
121
+ "type": "text",
122
+ "required": false
123
+ }
124
+ },
15
125
  "methods": {
16
- "byRight": {
17
- "name": "byRight",
126
+ "getParent": {
127
+ "name": "getParent",
18
128
  "async": true,
19
- "parameters": [
20
- {
21
- "name": "rightId",
22
- "type": "string",
23
- "optional": false
24
- },
25
- {
26
- "name": "opts",
27
- "type": "JunctionFilterOptions",
28
- "optional": true
29
- }
30
- ],
31
- "returnType": "Promise<TItem[]>",
129
+ "parameters": [],
130
+ "returnType": "Promise<this | null>",
32
131
  "isStatic": false,
33
132
  "isPublic": true
34
133
  },
35
- "byLeft": {
36
- "name": "byLeft",
134
+ "getChildren": {
135
+ "name": "getChildren",
37
136
  "async": true,
38
- "parameters": [
39
- {
40
- "name": "leftId",
41
- "type": "string",
42
- "optional": false
43
- },
44
- {
45
- "name": "opts",
46
- "type": "JunctionFilterOptions",
47
- "optional": true
48
- }
49
- ],
50
- "returnType": "Promise<TItem[]>",
137
+ "parameters": [],
138
+ "returnType": "Promise<this[]>",
51
139
  "isStatic": false,
52
140
  "isPublic": true
53
141
  },
54
- "attach": {
55
- "name": "attach",
142
+ "getAncestors": {
143
+ "name": "getAncestors",
56
144
  "async": true,
57
- "parameters": [
58
- {
59
- "name": "leftId",
60
- "type": "string",
61
- "optional": false
62
- },
63
- {
64
- "name": "rightId",
65
- "type": "string",
66
- "optional": false
67
- },
68
- {
69
- "name": "opts",
70
- "type": "JunctionAttachOptions",
71
- "optional": true
72
- }
73
- ],
74
- "returnType": "Promise<TItem>",
145
+ "parameters": [],
146
+ "returnType": "Promise<this[]>",
75
147
  "isStatic": false,
76
148
  "isPublic": true
77
149
  },
78
- "detach": {
79
- "name": "detach",
150
+ "getDescendants": {
151
+ "name": "getDescendants",
80
152
  "async": true,
81
- "parameters": [
82
- {
83
- "name": "leftId",
84
- "type": "string",
85
- "optional": false
86
- },
87
- {
88
- "name": "rightId",
89
- "type": "string",
90
- "optional": false
91
- },
92
- {
93
- "name": "opts",
94
- "type": "JunctionFilterOptions",
95
- "optional": true
96
- }
97
- ],
98
- "returnType": "Promise<void>",
153
+ "parameters": [],
154
+ "returnType": "Promise<this[]>",
99
155
  "isStatic": false,
100
156
  "isPublic": true
101
157
  },
102
- "setLinks": {
103
- "name": "setLinks",
158
+ "getHierarchy": {
159
+ "name": "getHierarchy",
160
+ "async": true,
161
+ "parameters": [],
162
+ "returnType": "Promise<HierarchyView<this>>",
163
+ "isStatic": false,
164
+ "isPublic": true
165
+ },
166
+ "moveTo": {
167
+ "name": "moveTo",
104
168
  "async": true,
105
169
  "parameters": [
106
170
  {
107
- "name": "leftId",
108
- "type": "string",
109
- "optional": false
110
- },
111
- {
112
- "name": "rightIds",
113
- "type": "string[]",
114
- "optional": false
115
- },
116
- {
117
- "name": "opts",
118
- "type": "JunctionAttachOptions",
119
- "optional": true
171
+ "name": "newParent",
172
+ "type": "this | string | null",
173
+ "optional": false,
174
+ "unionBranches": [
175
+ {
176
+ "type": "this"
177
+ },
178
+ {
179
+ "type": "string"
180
+ },
181
+ {
182
+ "type": "null"
183
+ }
184
+ ]
120
185
  }
121
186
  ],
122
187
  "returnType": "Promise<void>",
123
188
  "isStatic": false,
124
189
  "isPublic": true
125
190
  },
126
- "getAssets": {
127
- "name": "getAssets",
128
- "async": true,
129
- "parameters": [
130
- {
131
- "name": "placeId",
132
- "type": "string",
191
+ "getGeoData": {
192
+ "name": "getGeoData",
193
+ "async": false,
194
+ "parameters": [],
195
+ "returnType": "GeoData",
196
+ "isStatic": false,
197
+ "isPublic": true
198
+ },
199
+ "hasCoordinates": {
200
+ "name": "hasCoordinates",
201
+ "async": false,
202
+ "parameters": [],
203
+ "returnType": "boolean",
204
+ "isStatic": false,
205
+ "isPublic": true
206
+ },
207
+ "getMetadata": {
208
+ "name": "getMetadata",
209
+ "async": false,
210
+ "parameters": [],
211
+ "returnType": "Record<string, unknown>",
212
+ "isStatic": false,
213
+ "isPublic": true
214
+ },
215
+ "setMetadata": {
216
+ "name": "setMetadata",
217
+ "async": false,
218
+ "parameters": [
219
+ {
220
+ "name": "data",
221
+ "type": "Record<string, unknown>",
133
222
  "optional": false
134
- },
223
+ }
224
+ ],
225
+ "returnType": "void",
226
+ "isStatic": false,
227
+ "isPublic": true
228
+ },
229
+ "updateMetadata": {
230
+ "name": "updateMetadata",
231
+ "async": false,
232
+ "parameters": [
233
+ {
234
+ "name": "updates",
235
+ "type": "Record<string, unknown>",
236
+ "optional": false
237
+ }
238
+ ],
239
+ "returnType": "void",
240
+ "isStatic": false,
241
+ "isPublic": true
242
+ },
243
+ "getType": {
244
+ "name": "getType",
245
+ "async": true,
246
+ "parameters": [],
247
+ "returnType": "any",
248
+ "isStatic": false,
249
+ "isPublic": true
250
+ },
251
+ "getAssets": {
252
+ "name": "getAssets",
253
+ "async": true,
254
+ "parameters": [
135
255
  {
136
256
  "name": "relationship",
137
257
  "type": "string",
@@ -146,11 +266,6 @@
146
266
  "name": "addAsset",
147
267
  "async": true,
148
268
  "parameters": [
149
- {
150
- "name": "placeId",
151
- "type": "string",
152
- "optional": false
153
- },
154
269
  {
155
270
  "name": "asset",
156
271
  "type": "Asset",
@@ -172,15 +287,40 @@
172
287
  "isStatic": false,
173
288
  "isPublic": true
174
289
  },
290
+ "getMainAsset": {
291
+ "name": "getMainAsset",
292
+ "async": true,
293
+ "parameters": [],
294
+ "returnType": "Promise<Asset | null>",
295
+ "isStatic": false,
296
+ "isPublic": true
297
+ },
298
+ "setMainAsset": {
299
+ "name": "setMainAsset",
300
+ "async": true,
301
+ "parameters": [
302
+ {
303
+ "name": "asset",
304
+ "type": "Asset | null",
305
+ "optional": false,
306
+ "unionBranches": [
307
+ {
308
+ "type": "Asset"
309
+ },
310
+ {
311
+ "type": "null"
312
+ }
313
+ ]
314
+ }
315
+ ],
316
+ "returnType": "Promise<void>",
317
+ "isStatic": false,
318
+ "isPublic": true
319
+ },
175
320
  "removeAsset": {
176
321
  "name": "removeAsset",
177
322
  "async": true,
178
323
  "parameters": [
179
- {
180
- "name": "placeId",
181
- "type": "string",
182
- "optional": false
183
- },
184
324
  {
185
325
  "name": "assetId",
186
326
  "type": "string",
@@ -198,18 +338,44 @@
198
338
  }
199
339
  },
200
340
  "decoratorConfig": {
201
- "api": false,
202
- "mcp": false,
203
- "cli": false,
204
- "tableName": "place_assets"
341
+ "tableStrategy": "sti",
342
+ "api": {
343
+ "include": [
344
+ "list",
345
+ "get",
346
+ "create",
347
+ "update",
348
+ "delete"
349
+ ]
350
+ },
351
+ "mcp": {
352
+ "include": [
353
+ "list",
354
+ "get",
355
+ "create",
356
+ "update"
357
+ ]
358
+ },
359
+ "cli": {
360
+ "skipApiCheck": true
361
+ },
362
+ "tenantScoped": {
363
+ "mode": "optional"
364
+ },
365
+ "conflictColumns": [
366
+ "tenant_id",
367
+ "slug",
368
+ "context",
369
+ "_meta_type"
370
+ ]
205
371
  },
206
- "extends": "SmrtJunction",
207
- "extendsTypeArg": "PlaceAsset",
208
- "exportName": "PlaceAssetCollection",
209
- "collectionExportName": "PlaceAssetCollectionCollection",
372
+ "extends": "SmrtHierarchical",
373
+ "exportName": "Place",
374
+ "collectionExportName": "PlaceCollection",
375
+ "displayLabelField": "name",
210
376
  "schema": {
211
- "tableName": "place_assets",
212
- "ddl": "CREATE TABLE IF NOT EXISTS \"place_assets\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"place_id\" UUID NOT NULL,\n \"asset_id\" UUID NOT NULL,\n \"relationship\" TEXT NOT NULL,\n \"sort_order\" INTEGER NOT NULL DEFAULT 0\n);",
377
+ "tableName": "places",
378
+ "ddl": "CREATE TABLE IF NOT EXISTS \"places\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"parent_id\" UUID,\n \"tenant_id\" UUID,\n \"type_id\" UUID,\n \"name\" TEXT,\n \"description\" TEXT,\n \"latitude\" REAL,\n \"longitude\" REAL,\n \"street_number\" TEXT,\n \"street_name\" TEXT,\n \"city\" TEXT,\n \"region\" TEXT,\n \"country\" TEXT,\n \"postal_code\" TEXT,\n \"country_code\" TEXT,\n \"timezone\" TEXT,\n \"external_id\" TEXT,\n \"source\" TEXT,\n \"metadata\" TEXT\n);",
213
379
  "columns": {
214
380
  "id": {
215
381
  "type": "UUID",
@@ -226,6 +392,14 @@
226
392
  "notNull": true,
227
393
  "default": ""
228
394
  },
395
+ "_meta_type": {
396
+ "type": "TEXT",
397
+ "notNull": true
398
+ },
399
+ "_meta_data": {
400
+ "type": "JSON",
401
+ "notNull": false
402
+ },
229
403
  "created_at": {
230
404
  "type": "TIMESTAMP",
231
405
  "notNull": true,
@@ -236,50 +410,305 @@
236
410
  "notNull": true,
237
411
  "default": "current_timestamp"
238
412
  },
413
+ "parent_id": {
414
+ "type": "UUID",
415
+ "referenceKind": "foreignKey",
416
+ "notNull": false,
417
+ "foreignKey": {
418
+ "table": "places",
419
+ "column": "id",
420
+ "onDelete": "NO ACTION",
421
+ "onUpdate": "CASCADE"
422
+ }
423
+ },
239
424
  "tenant_id": {
240
425
  "type": "UUID",
241
426
  "referenceKind": "tenantId",
242
- "notNull": false,
243
- "unique": false
427
+ "notNull": false
244
428
  },
245
- "place_id": {
429
+ "type_id": {
246
430
  "type": "UUID",
247
431
  "referenceKind": "foreignKey",
248
- "notNull": true,
249
- "unique": false,
432
+ "notNull": false,
250
433
  "foreignKey": {
251
- "table": "places",
434
+ "table": "place_types",
252
435
  "column": "id",
253
- "onDelete": "CASCADE",
436
+ "onDelete": "NO ACTION",
254
437
  "onUpdate": "CASCADE"
255
438
  }
256
439
  },
257
- "asset_id": {
258
- "type": "UUID",
259
- "referenceKind": "crossPackageRef",
260
- "notNull": true,
261
- "unique": false
440
+ "name": {
441
+ "type": "TEXT",
442
+ "notNull": false
262
443
  },
263
- "relationship": {
444
+ "description": {
264
445
  "type": "TEXT",
265
- "notNull": true,
266
- "unique": false
446
+ "notNull": false
267
447
  },
268
- "sort_order": {
269
- "type": "INTEGER",
270
- "notNull": true,
271
- "unique": false,
272
- "default": 0
448
+ "latitude": {
449
+ "type": "REAL",
450
+ "notNull": false
451
+ },
452
+ "longitude": {
453
+ "type": "REAL",
454
+ "notNull": false
455
+ },
456
+ "street_number": {
457
+ "type": "TEXT",
458
+ "notNull": false
459
+ },
460
+ "street_name": {
461
+ "type": "TEXT",
462
+ "notNull": false
463
+ },
464
+ "city": {
465
+ "type": "TEXT",
466
+ "notNull": false
467
+ },
468
+ "region": {
469
+ "type": "TEXT",
470
+ "notNull": false
471
+ },
472
+ "country": {
473
+ "type": "TEXT",
474
+ "notNull": false
475
+ },
476
+ "postal_code": {
477
+ "type": "TEXT",
478
+ "notNull": false
479
+ },
480
+ "country_code": {
481
+ "type": "TEXT",
482
+ "notNull": false
483
+ },
484
+ "timezone": {
485
+ "type": "TEXT",
486
+ "notNull": false
487
+ },
488
+ "external_id": {
489
+ "type": "TEXT",
490
+ "notNull": false
491
+ },
492
+ "source": {
493
+ "type": "TEXT",
494
+ "notNull": false
495
+ },
496
+ "metadata": {
497
+ "type": "TEXT",
498
+ "notNull": false
273
499
  }
274
500
  },
275
501
  "indexes": [
276
502
  {
277
- "name": "place_assets_place_id_asset_id_idx",
503
+ "name": "places_slug_context_meta_type_idx",
278
504
  "columns": [
279
- "place_id",
280
- "asset_id",
281
- "relationship"
282
- ],
505
+ "tenant_id",
506
+ "slug",
507
+ "context",
508
+ "_meta_type"
509
+ ],
510
+ "unique": true,
511
+ "nullsNotDistinct": true
512
+ },
513
+ {
514
+ "name": "places_meta_type_idx",
515
+ "columns": [
516
+ "_meta_type"
517
+ ]
518
+ },
519
+ {
520
+ "name": "places_tenant_id_created_at_idx",
521
+ "columns": [
522
+ "tenant_id",
523
+ "created_at"
524
+ ]
525
+ },
526
+ {
527
+ "name": "places_parent_id_idx",
528
+ "columns": [
529
+ "parent_id"
530
+ ]
531
+ },
532
+ {
533
+ "name": "places_type_id_idx",
534
+ "columns": [
535
+ "type_id"
536
+ ]
537
+ }
538
+ ],
539
+ "version": "f670088c"
540
+ },
541
+ "importPath": "@happyvertical/smrt-places"
542
+ },
543
+ "@happyvertical/smrt-places:PlaceAsset": {
544
+ "name": "placeasset",
545
+ "className": "PlaceAsset",
546
+ "qualifiedName": "@happyvertical/smrt-places:PlaceAsset",
547
+ "collection": "placeassets",
548
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/PlaceAsset.ts",
549
+ "packageName": "@happyvertical/smrt-places",
550
+ "fields": {
551
+ "tenantId": {
552
+ "type": "text",
553
+ "required": false,
554
+ "_meta": {
555
+ "sqlType": "UUID",
556
+ "nullable": true,
557
+ "__tenancy": {
558
+ "isTenantIdField": true,
559
+ "autoFilter": true,
560
+ "required": false,
561
+ "autoPopulate": true,
562
+ "nullable": true,
563
+ "mode": "optional",
564
+ "field": "tenantId",
565
+ "allowSuperAdminBypass": false
566
+ }
567
+ }
568
+ },
569
+ "placeId": {
570
+ "type": "foreignKey",
571
+ "required": true,
572
+ "related": "Place",
573
+ "_meta": {
574
+ "required": true,
575
+ "onDelete": "CASCADE"
576
+ }
577
+ },
578
+ "assetId": {
579
+ "type": "crossPackageRef",
580
+ "required": true,
581
+ "related": "@happyvertical/smrt-assets:Asset",
582
+ "_meta": {
583
+ "onDelete": "CASCADE"
584
+ }
585
+ },
586
+ "relationship": {
587
+ "type": "text",
588
+ "required": true,
589
+ "_meta": {
590
+ "required": true
591
+ }
592
+ },
593
+ "sortOrder": {
594
+ "type": "integer",
595
+ "required": true,
596
+ "default": 0
597
+ }
598
+ },
599
+ "methods": {},
600
+ "decoratorConfig": {
601
+ "tableName": "place_assets",
602
+ "conflictColumns": [
603
+ "place_id",
604
+ "asset_id",
605
+ "relationship"
606
+ ],
607
+ "api": false,
608
+ "mcp": false,
609
+ "cli": false,
610
+ "tenantScoped": {
611
+ "mode": "optional"
612
+ }
613
+ },
614
+ "extends": "SmrtObject",
615
+ "exportName": "PlaceAsset",
616
+ "collectionExportName": "PlaceAssetCollection",
617
+ "validationRules": [
618
+ {
619
+ "field": "placeId",
620
+ "rule": "required",
621
+ "fieldType": "foreignKey"
622
+ },
623
+ {
624
+ "field": "assetId",
625
+ "rule": "required",
626
+ "fieldType": "crossPackageRef"
627
+ },
628
+ {
629
+ "field": "relationship",
630
+ "rule": "required",
631
+ "fieldType": "text"
632
+ },
633
+ {
634
+ "field": "sortOrder",
635
+ "rule": "required",
636
+ "fieldType": "integer"
637
+ }
638
+ ],
639
+ "schema": {
640
+ "tableName": "place_assets",
641
+ "ddl": "CREATE TABLE IF NOT EXISTS \"place_assets\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"place_id\" UUID NOT NULL,\n \"asset_id\" UUID NOT NULL,\n \"relationship\" TEXT NOT NULL,\n \"sort_order\" INTEGER NOT NULL DEFAULT 0\n);",
642
+ "columns": {
643
+ "id": {
644
+ "type": "UUID",
645
+ "primaryKey": true,
646
+ "referenceKind": "id",
647
+ "notNull": true
648
+ },
649
+ "slug": {
650
+ "type": "TEXT",
651
+ "notNull": true
652
+ },
653
+ "context": {
654
+ "type": "TEXT",
655
+ "notNull": true,
656
+ "default": ""
657
+ },
658
+ "created_at": {
659
+ "type": "TIMESTAMP",
660
+ "notNull": true,
661
+ "default": "current_timestamp"
662
+ },
663
+ "updated_at": {
664
+ "type": "TIMESTAMP",
665
+ "notNull": true,
666
+ "default": "current_timestamp"
667
+ },
668
+ "tenant_id": {
669
+ "type": "UUID",
670
+ "referenceKind": "tenantId",
671
+ "notNull": false,
672
+ "unique": false
673
+ },
674
+ "place_id": {
675
+ "type": "UUID",
676
+ "referenceKind": "foreignKey",
677
+ "notNull": true,
678
+ "unique": false,
679
+ "foreignKey": {
680
+ "table": "places",
681
+ "column": "id",
682
+ "onDelete": "CASCADE",
683
+ "onUpdate": "CASCADE"
684
+ }
685
+ },
686
+ "asset_id": {
687
+ "type": "UUID",
688
+ "referenceKind": "crossPackageRef",
689
+ "notNull": true,
690
+ "unique": false
691
+ },
692
+ "relationship": {
693
+ "type": "TEXT",
694
+ "notNull": true,
695
+ "unique": false
696
+ },
697
+ "sort_order": {
698
+ "type": "INTEGER",
699
+ "notNull": true,
700
+ "unique": false,
701
+ "default": 0
702
+ }
703
+ },
704
+ "indexes": [
705
+ {
706
+ "name": "place_assets_place_id_asset_id_idx",
707
+ "columns": [
708
+ "place_id",
709
+ "asset_id",
710
+ "relationship"
711
+ ],
283
712
  "unique": true
284
713
  },
285
714
  {
@@ -307,129 +736,282 @@
307
736
  },
308
737
  "importPath": "@happyvertical/smrt-places"
309
738
  },
310
- "@happyvertical/smrt-places:PlaceCollection": {
311
- "name": "placecollection",
312
- "className": "PlaceCollection",
313
- "qualifiedName": "@happyvertical/smrt-places:PlaceCollection",
314
- "collection": "places",
315
- "filePath": "/home/runner/work/smrt/smrt/packages/places/src/collections/PlaceCollection.ts",
739
+ "@happyvertical/smrt-places:PlaceType": {
740
+ "name": "placetype",
741
+ "className": "PlaceType",
742
+ "qualifiedName": "@happyvertical/smrt-places:PlaceType",
743
+ "collection": "placetypes",
744
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/PlaceType.ts",
316
745
  "packageName": "@happyvertical/smrt-places",
317
- "fields": {},
746
+ "fields": {
747
+ "created_at": {
748
+ "type": "datetime",
749
+ "required": false
750
+ },
751
+ "updated_at": {
752
+ "type": "datetime",
753
+ "required": false
754
+ },
755
+ "name": {
756
+ "type": "text",
757
+ "required": true,
758
+ "default": "",
759
+ "_meta": {
760
+ "required": true
761
+ }
762
+ },
763
+ "description": {
764
+ "type": "text",
765
+ "required": false
766
+ },
767
+ "createdAt": {
768
+ "type": "text",
769
+ "required": false
770
+ },
771
+ "updatedAt": {
772
+ "type": "text",
773
+ "required": false
774
+ }
775
+ },
318
776
  "methods": {
319
- "lookupOrCreate": {
320
- "name": "lookupOrCreate",
777
+ "getBySlug": {
778
+ "name": "getBySlug",
321
779
  "async": true,
322
780
  "parameters": [
323
781
  {
324
- "name": "query",
782
+ "name": "_slug",
325
783
  "type": "string",
326
784
  "optional": false
327
- },
328
- {
329
- "name": "options",
330
- "type": "LookupOrCreateOptions",
331
- "optional": true
332
785
  }
333
786
  ],
334
- "returnType": "Promise<Place | null>",
335
- "isStatic": false,
787
+ "returnType": "Promise<PlaceType | null>",
788
+ "isStatic": true,
336
789
  "isPublic": true
790
+ }
791
+ },
792
+ "decoratorConfig": {
793
+ "tableStrategy": "sti",
794
+ "api": {
795
+ "include": [
796
+ "list",
797
+ "get",
798
+ "create",
799
+ "update",
800
+ "delete"
801
+ ]
337
802
  },
338
- "discoverNearby": {
339
- "name": "discoverNearby",
803
+ "mcp": {
804
+ "include": [
805
+ "list",
806
+ "get",
807
+ "create"
808
+ ]
809
+ },
810
+ "cli": {
811
+ "skipApiCheck": true
812
+ }
813
+ },
814
+ "extends": "SmrtObject",
815
+ "exportName": "PlaceType",
816
+ "collectionExportName": "PlaceTypeCollection",
817
+ "displayLabelField": "name",
818
+ "validationRules": [
819
+ {
820
+ "field": "name",
821
+ "rule": "required",
822
+ "fieldType": "text"
823
+ }
824
+ ],
825
+ "schema": {
826
+ "tableName": "place_types",
827
+ "ddl": "CREATE TABLE IF NOT EXISTS \"place_types\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT\n);",
828
+ "columns": {
829
+ "id": {
830
+ "type": "UUID",
831
+ "primaryKey": true,
832
+ "referenceKind": "id",
833
+ "notNull": true
834
+ },
835
+ "slug": {
836
+ "type": "TEXT",
837
+ "notNull": true
838
+ },
839
+ "context": {
840
+ "type": "TEXT",
841
+ "notNull": true,
842
+ "default": ""
843
+ },
844
+ "_meta_type": {
845
+ "type": "TEXT",
846
+ "notNull": true
847
+ },
848
+ "_meta_data": {
849
+ "type": "JSON",
850
+ "notNull": false
851
+ },
852
+ "created_at": {
853
+ "type": "TIMESTAMP",
854
+ "notNull": true,
855
+ "default": "current_timestamp"
856
+ },
857
+ "updated_at": {
858
+ "type": "TIMESTAMP",
859
+ "notNull": true,
860
+ "default": "current_timestamp"
861
+ },
862
+ "name": {
863
+ "type": "TEXT",
864
+ "notNull": false,
865
+ "default": ""
866
+ },
867
+ "description": {
868
+ "type": "TEXT",
869
+ "notNull": false
870
+ }
871
+ },
872
+ "indexes": [
873
+ {
874
+ "name": "place_types_slug_context_meta_type_idx",
875
+ "columns": [
876
+ "slug",
877
+ "context",
878
+ "_meta_type"
879
+ ],
880
+ "unique": true
881
+ },
882
+ {
883
+ "name": "place_types_meta_type_idx",
884
+ "columns": [
885
+ "_meta_type"
886
+ ]
887
+ },
888
+ {
889
+ "name": "place_types_created_at_idx",
890
+ "columns": [
891
+ "created_at"
892
+ ]
893
+ }
894
+ ],
895
+ "version": "8c3bb691"
896
+ },
897
+ "importPath": "@happyvertical/smrt-places"
898
+ },
899
+ "@happyvertical/smrt-places:PlaceAssetCollection": {
900
+ "name": "placeassetcollection",
901
+ "className": "PlaceAssetCollection",
902
+ "qualifiedName": "@happyvertical/smrt-places:PlaceAssetCollection",
903
+ "collection": "placeassets",
904
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/collections/PlaceAssetCollection.ts",
905
+ "packageName": "@happyvertical/smrt-places",
906
+ "fields": {},
907
+ "methods": {
908
+ "byRight": {
909
+ "name": "byRight",
340
910
  "async": true,
341
911
  "parameters": [
342
912
  {
343
- "name": "latitude",
344
- "type": "number",
345
- "optional": false
346
- },
347
- {
348
- "name": "longitude",
349
- "type": "number",
350
- "optional": false
351
- },
352
- {
353
- "name": "radiusMeters",
354
- "type": "number",
913
+ "name": "rightId",
914
+ "type": "string",
355
915
  "optional": false
356
916
  },
357
917
  {
358
- "name": "options",
359
- "type": "DiscoverNearbyOptions",
918
+ "name": "opts",
919
+ "type": "JunctionFilterOptions",
360
920
  "optional": true
361
921
  }
362
922
  ],
363
- "returnType": "Promise<Place[]>",
923
+ "returnType": "Promise<TItem[]>",
364
924
  "isStatic": false,
365
925
  "isPublic": true
366
926
  },
367
- "resolveTrackPlaces": {
368
- "name": "resolveTrackPlaces",
927
+ "byLeft": {
928
+ "name": "byLeft",
369
929
  "async": true,
370
930
  "parameters": [
371
931
  {
372
- "name": "points",
373
- "type": "ReadonlyArray<TrackPoint>",
932
+ "name": "leftId",
933
+ "type": "string",
374
934
  "optional": false
375
935
  },
376
936
  {
377
- "name": "options",
378
- "type": "ResolveTrackPlacesOptions",
937
+ "name": "opts",
938
+ "type": "JunctionFilterOptions",
379
939
  "optional": true
380
940
  }
381
941
  ],
382
- "returnType": "Promise<TrackPlacesResult>",
942
+ "returnType": "Promise<TItem[]>",
383
943
  "isStatic": false,
384
944
  "isPublic": true
385
945
  },
386
- "getChildren": {
387
- "name": "getChildren",
946
+ "attach": {
947
+ "name": "attach",
388
948
  "async": true,
389
949
  "parameters": [
390
950
  {
391
- "name": "parentId",
951
+ "name": "leftId",
952
+ "type": "string",
953
+ "optional": false
954
+ },
955
+ {
956
+ "name": "rightId",
392
957
  "type": "string",
393
958
  "optional": false
959
+ },
960
+ {
961
+ "name": "opts",
962
+ "type": "JunctionAttachOptions",
963
+ "optional": true
394
964
  }
395
965
  ],
396
- "returnType": "Promise<Place[]>",
397
- "isStatic": false,
398
- "isPublic": true
399
- },
400
- "getRootPlaces": {
401
- "name": "getRootPlaces",
402
- "async": true,
403
- "parameters": [],
404
- "returnType": "Promise<Place[]>",
966
+ "returnType": "Promise<TItem>",
405
967
  "isStatic": false,
406
968
  "isPublic": true
407
969
  },
408
- "getByType": {
409
- "name": "getByType",
970
+ "detach": {
971
+ "name": "detach",
410
972
  "async": true,
411
973
  "parameters": [
412
974
  {
413
- "name": "typeSlug",
975
+ "name": "leftId",
976
+ "type": "string",
977
+ "optional": false
978
+ },
979
+ {
980
+ "name": "rightId",
414
981
  "type": "string",
415
982
  "optional": false
983
+ },
984
+ {
985
+ "name": "opts",
986
+ "type": "JunctionFilterOptions",
987
+ "optional": true
416
988
  }
417
989
  ],
418
- "returnType": "Promise<Place[]>",
990
+ "returnType": "Promise<void>",
419
991
  "isStatic": false,
420
992
  "isPublic": true
421
993
  },
422
- "getHierarchy": {
423
- "name": "getHierarchy",
994
+ "setLinks": {
995
+ "name": "setLinks",
424
996
  "async": true,
425
997
  "parameters": [
426
998
  {
427
- "name": "placeId",
999
+ "name": "leftId",
428
1000
  "type": "string",
429
1001
  "optional": false
1002
+ },
1003
+ {
1004
+ "name": "rightIds",
1005
+ "type": "string[]",
1006
+ "optional": false
1007
+ },
1008
+ {
1009
+ "name": "opts",
1010
+ "type": "JunctionAttachOptions",
1011
+ "optional": true
430
1012
  }
431
1013
  ],
432
- "returnType": "any",
1014
+ "returnType": "Promise<void>",
433
1015
  "isStatic": false,
434
1016
  "isPublic": true
435
1017
  },
@@ -505,94 +1087,21 @@
505
1087
  "returnType": "Promise<void>",
506
1088
  "isStatic": false,
507
1089
  "isPublic": true
508
- },
509
- "searchByProximity": {
510
- "name": "searchByProximity",
511
- "async": true,
512
- "parameters": [
513
- {
514
- "name": "latitude",
515
- "type": "number",
516
- "optional": false
517
- },
518
- {
519
- "name": "longitude",
520
- "type": "number",
521
- "optional": false
522
- },
523
- {
524
- "name": "radiusKm",
525
- "type": "number",
526
- "optional": true
527
- }
528
- ],
529
- "returnType": "Promise<Place[]>",
530
- "isStatic": false,
531
- "isPublic": true
532
- },
533
- "findByTenant": {
534
- "name": "findByTenant",
535
- "async": true,
536
- "parameters": [
537
- {
538
- "name": "tenantId",
539
- "type": "string",
540
- "optional": false
541
- }
542
- ],
543
- "returnType": "Promise<Place[]>",
544
- "isStatic": false,
545
- "isPublic": true
546
- },
547
- "findGlobal": {
548
- "name": "findGlobal",
549
- "async": true,
550
- "parameters": [],
551
- "returnType": "Promise<Place[]>",
552
- "isStatic": false,
553
- "isPublic": true
554
- },
555
- "findWithGlobals": {
556
- "name": "findWithGlobals",
557
- "async": true,
558
- "parameters": [
559
- {
560
- "name": "tenantId",
561
- "type": "string",
562
- "optional": false
563
- }
564
- ],
565
- "returnType": "Promise<Place[]>",
566
- "isStatic": false,
567
- "isPublic": true
568
1090
  }
569
1091
  },
570
1092
  "decoratorConfig": {
571
- "api": {
572
- "include": [
573
- "list",
574
- "get",
575
- "create",
576
- "update",
577
- "delete"
578
- ]
579
- },
580
- "mcp": {
581
- "include": [
582
- "list",
583
- "get",
584
- "create",
585
- "update"
586
- ]
587
- }
1093
+ "api": false,
1094
+ "mcp": false,
1095
+ "cli": false,
1096
+ "tableName": "place_assets"
588
1097
  },
589
- "extends": "SmrtCollection",
590
- "extendsTypeArg": "Place",
591
- "exportName": "PlaceCollection",
592
- "collectionExportName": "PlaceCollectionCollection",
1098
+ "extends": "SmrtJunction",
1099
+ "extendsTypeArg": "PlaceAsset",
1100
+ "exportName": "PlaceAssetCollection",
1101
+ "collectionExportName": "PlaceAssetCollectionCollection",
593
1102
  "schema": {
594
- "tableName": "places",
595
- "ddl": "CREATE TABLE IF NOT EXISTS \"places\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"parent_id\" UUID,\n \"tenant_id\" UUID,\n \"type_id\" UUID,\n \"name\" TEXT,\n \"description\" TEXT,\n \"latitude\" REAL,\n \"longitude\" REAL,\n \"street_number\" TEXT,\n \"street_name\" TEXT,\n \"city\" TEXT,\n \"region\" TEXT,\n \"country\" TEXT,\n \"postal_code\" TEXT,\n \"country_code\" TEXT,\n \"timezone\" TEXT,\n \"external_id\" TEXT,\n \"source\" TEXT,\n \"metadata\" TEXT\n);",
1103
+ "tableName": "place_assets",
1104
+ "ddl": "CREATE TABLE IF NOT EXISTS \"place_assets\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"place_id\" UUID NOT NULL,\n \"asset_id\" UUID NOT NULL,\n \"relationship\" TEXT NOT NULL,\n \"sort_order\" INTEGER NOT NULL DEFAULT 0\n);",
596
1105
  "columns": {
597
1106
  "id": {
598
1107
  "type": "UUID",
@@ -609,14 +1118,6 @@
609
1118
  "notNull": true,
610
1119
  "default": ""
611
1120
  },
612
- "_meta_type": {
613
- "type": "TEXT",
614
- "notNull": true
615
- },
616
- "_meta_data": {
617
- "type": "JSON",
618
- "notNull": false
619
- },
620
1121
  "created_at": {
621
1122
  "type": "TIMESTAMP",
622
1123
  "notNull": true,
@@ -627,523 +1128,199 @@
627
1128
  "notNull": true,
628
1129
  "default": "current_timestamp"
629
1130
  },
630
- "parent_id": {
631
- "type": "UUID",
632
- "referenceKind": "foreignKey",
633
- "notNull": false,
634
- "foreignKey": {
635
- "table": "places",
636
- "column": "id",
637
- "onDelete": "NO ACTION",
638
- "onUpdate": "CASCADE"
639
- }
640
- },
641
1131
  "tenant_id": {
642
1132
  "type": "UUID",
643
1133
  "referenceKind": "tenantId",
644
- "notNull": false
1134
+ "notNull": false,
1135
+ "unique": false
645
1136
  },
646
- "type_id": {
1137
+ "place_id": {
647
1138
  "type": "UUID",
648
1139
  "referenceKind": "foreignKey",
649
- "notNull": false,
1140
+ "notNull": true,
1141
+ "unique": false,
650
1142
  "foreignKey": {
651
- "table": "place_types",
1143
+ "table": "places",
652
1144
  "column": "id",
653
- "onDelete": "NO ACTION",
1145
+ "onDelete": "CASCADE",
654
1146
  "onUpdate": "CASCADE"
655
1147
  }
656
1148
  },
657
- "name": {
658
- "type": "TEXT",
659
- "notNull": false
660
- },
661
- "description": {
662
- "type": "TEXT",
663
- "notNull": false
664
- },
665
- "latitude": {
666
- "type": "REAL",
667
- "notNull": false
668
- },
669
- "longitude": {
670
- "type": "REAL",
671
- "notNull": false
672
- },
673
- "street_number": {
674
- "type": "TEXT",
675
- "notNull": false
676
- },
677
- "street_name": {
678
- "type": "TEXT",
679
- "notNull": false
680
- },
681
- "city": {
682
- "type": "TEXT",
683
- "notNull": false
684
- },
685
- "region": {
686
- "type": "TEXT",
687
- "notNull": false
688
- },
689
- "country": {
690
- "type": "TEXT",
691
- "notNull": false
692
- },
693
- "postal_code": {
694
- "type": "TEXT",
695
- "notNull": false
696
- },
697
- "country_code": {
698
- "type": "TEXT",
699
- "notNull": false
700
- },
701
- "timezone": {
702
- "type": "TEXT",
703
- "notNull": false
704
- },
705
- "external_id": {
706
- "type": "TEXT",
707
- "notNull": false
1149
+ "asset_id": {
1150
+ "type": "UUID",
1151
+ "referenceKind": "crossPackageRef",
1152
+ "notNull": true,
1153
+ "unique": false
708
1154
  },
709
- "source": {
1155
+ "relationship": {
710
1156
  "type": "TEXT",
711
- "notNull": false
1157
+ "notNull": true,
1158
+ "unique": false
712
1159
  },
713
- "metadata": {
714
- "type": "TEXT",
715
- "notNull": false
1160
+ "sort_order": {
1161
+ "type": "INTEGER",
1162
+ "notNull": true,
1163
+ "unique": false,
1164
+ "default": 0
716
1165
  }
717
1166
  },
718
1167
  "indexes": [
719
1168
  {
720
- "name": "places_slug_context_meta_type_idx",
1169
+ "name": "place_assets_place_id_asset_id_idx",
721
1170
  "columns": [
722
- "tenant_id",
723
- "slug",
724
- "context",
725
- "_meta_type"
1171
+ "place_id",
1172
+ "asset_id",
1173
+ "relationship"
726
1174
  ],
727
- "unique": true,
728
- "nullsNotDistinct": true
1175
+ "unique": true
729
1176
  },
730
1177
  {
731
- "name": "places_meta_type_idx",
1178
+ "name": "place_assets_slug_context_idx",
732
1179
  "columns": [
733
- "_meta_type"
1180
+ "slug",
1181
+ "context"
734
1182
  ]
735
1183
  },
736
1184
  {
737
- "name": "places_tenant_id_created_at_idx",
1185
+ "name": "place_assets_tenant_id_created_at_idx",
738
1186
  "columns": [
739
1187
  "tenant_id",
740
1188
  "created_at"
741
1189
  ]
742
1190
  },
743
1191
  {
744
- "name": "places_parent_id_idx",
745
- "columns": [
746
- "parent_id"
747
- ]
748
- },
749
- {
750
- "name": "places_type_id_idx",
1192
+ "name": "place_assets_asset_id_idx",
751
1193
  "columns": [
752
- "type_id"
1194
+ "asset_id"
753
1195
  ]
754
1196
  }
755
1197
  ],
756
- "version": "f670088c"
1198
+ "version": "adf47666"
757
1199
  },
758
1200
  "importPath": "@happyvertical/smrt-places"
759
1201
  },
760
- "@happyvertical/smrt-places:PlaceTypeCollection": {
761
- "name": "placetypecollection",
762
- "className": "PlaceTypeCollection",
763
- "qualifiedName": "@happyvertical/smrt-places:PlaceTypeCollection",
764
- "collection": "placetypes",
765
- "filePath": "/home/runner/work/smrt/smrt/packages/places/src/collections/PlaceTypeCollection.ts",
1202
+ "@happyvertical/smrt-places:PlaceCollection": {
1203
+ "name": "placecollection",
1204
+ "className": "PlaceCollection",
1205
+ "qualifiedName": "@happyvertical/smrt-places:PlaceCollection",
1206
+ "collection": "places",
1207
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/collections/PlaceCollection.ts",
766
1208
  "packageName": "@happyvertical/smrt-places",
767
1209
  "fields": {},
768
1210
  "methods": {
769
- "getOrCreate": {
770
- "name": "getOrCreate",
1211
+ "lookupOrCreate": {
1212
+ "name": "lookupOrCreate",
771
1213
  "async": true,
772
1214
  "parameters": [
773
1215
  {
774
- "name": "slug",
1216
+ "name": "query",
775
1217
  "type": "string",
776
1218
  "optional": false
777
1219
  },
778
1220
  {
779
- "name": "name",
780
- "type": "string",
1221
+ "name": "options",
1222
+ "type": "LookupOrCreateOptions",
781
1223
  "optional": true
782
1224
  }
783
1225
  ],
784
- "returnType": "Promise<PlaceType>",
1226
+ "returnType": "Promise<Place | null>",
785
1227
  "isStatic": false,
786
1228
  "isPublic": true
787
1229
  },
788
- "getBySlug": {
789
- "name": "getBySlug",
1230
+ "discoverNearby": {
1231
+ "name": "discoverNearby",
790
1232
  "async": true,
791
1233
  "parameters": [
792
1234
  {
793
- "name": "slug",
794
- "type": "string",
1235
+ "name": "latitude",
1236
+ "type": "number",
1237
+ "optional": false
1238
+ },
1239
+ {
1240
+ "name": "longitude",
1241
+ "type": "number",
1242
+ "optional": false
1243
+ },
1244
+ {
1245
+ "name": "radiusMeters",
1246
+ "type": "number",
795
1247
  "optional": false
1248
+ },
1249
+ {
1250
+ "name": "options",
1251
+ "type": "DiscoverNearbyOptions",
1252
+ "optional": true
796
1253
  }
797
1254
  ],
798
- "returnType": "Promise<PlaceType | null>",
1255
+ "returnType": "Promise<Place[]>",
799
1256
  "isStatic": false,
800
1257
  "isPublic": true
801
1258
  },
802
- "initializeDefaults": {
803
- "name": "initializeDefaults",
1259
+ "resolveTrackPlaces": {
1260
+ "name": "resolveTrackPlaces",
804
1261
  "async": true,
805
- "parameters": [],
806
- "returnType": "Promise<PlaceType[]>",
807
- "isStatic": false,
808
- "isPublic": true
809
- }
810
- },
811
- "decoratorConfig": {
812
- "api": {
813
- "include": [
814
- "list",
815
- "get",
816
- "create",
817
- "update",
818
- "delete"
819
- ]
820
- },
821
- "mcp": {
822
- "include": [
823
- "list",
824
- "get",
825
- "create"
826
- ]
827
- }
828
- },
829
- "extends": "SmrtCollection",
830
- "extendsTypeArg": "PlaceType",
831
- "exportName": "PlaceTypeCollection",
832
- "collectionExportName": "PlaceTypeCollectionCollection",
833
- "schema": {
834
- "tableName": "place_types",
835
- "ddl": "CREATE TABLE IF NOT EXISTS \"place_types\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT\n);",
836
- "columns": {
837
- "id": {
838
- "type": "UUID",
839
- "primaryKey": true,
840
- "referenceKind": "id",
841
- "notNull": true
842
- },
843
- "slug": {
844
- "type": "TEXT",
845
- "notNull": true
846
- },
847
- "context": {
848
- "type": "TEXT",
849
- "notNull": true,
850
- "default": ""
851
- },
852
- "_meta_type": {
853
- "type": "TEXT",
854
- "notNull": true
855
- },
856
- "_meta_data": {
857
- "type": "JSON",
858
- "notNull": false
859
- },
860
- "created_at": {
861
- "type": "TIMESTAMP",
862
- "notNull": true,
863
- "default": "current_timestamp"
864
- },
865
- "updated_at": {
866
- "type": "TIMESTAMP",
867
- "notNull": true,
868
- "default": "current_timestamp"
869
- },
870
- "name": {
871
- "type": "TEXT",
872
- "notNull": false,
873
- "default": ""
874
- },
875
- "description": {
876
- "type": "TEXT",
877
- "notNull": false
878
- }
879
- },
880
- "indexes": [
881
- {
882
- "name": "place_types_slug_context_meta_type_idx",
883
- "columns": [
884
- "slug",
885
- "context",
886
- "_meta_type"
887
- ],
888
- "unique": true
889
- },
890
- {
891
- "name": "place_types_meta_type_idx",
892
- "columns": [
893
- "_meta_type"
894
- ]
895
- },
896
- {
897
- "name": "place_types_created_at_idx",
898
- "columns": [
899
- "created_at"
900
- ]
901
- }
902
- ],
903
- "version": "8c3bb691"
904
- },
905
- "importPath": "@happyvertical/smrt-places"
906
- },
907
- "@happyvertical/smrt-places:Place": {
908
- "name": "place",
909
- "className": "Place",
910
- "qualifiedName": "@happyvertical/smrt-places:Place",
911
- "collection": "places",
912
- "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/Place.ts",
913
- "packageName": "@happyvertical/smrt-places",
914
- "fields": {
915
- "created_at": {
916
- "type": "datetime",
917
- "required": false
918
- },
919
- "updated_at": {
920
- "type": "datetime",
921
- "required": false
922
- },
923
- "parentId": {
924
- "type": "foreignKey",
925
- "required": false,
926
- "related": "Place",
927
- "_meta": {
928
- "nullable": true
929
- }
930
- },
931
- "tenantId": {
932
- "type": "text",
933
- "required": false,
934
- "_meta": {
935
- "sqlType": "UUID",
936
- "nullable": true,
937
- "__tenancy": {
938
- "isTenantIdField": true,
939
- "autoFilter": true,
940
- "required": false,
941
- "autoPopulate": true,
942
- "nullable": true,
943
- "mode": "optional",
944
- "field": "tenantId",
945
- "allowSuperAdminBypass": false
1262
+ "parameters": [
1263
+ {
1264
+ "name": "points",
1265
+ "type": "ReadonlyArray<TrackPoint>",
1266
+ "optional": false
1267
+ },
1268
+ {
1269
+ "name": "options",
1270
+ "type": "ResolveTrackPlacesOptions",
1271
+ "optional": true
946
1272
  }
947
- }
948
- },
949
- "typeId": {
950
- "type": "foreignKey",
951
- "required": false,
952
- "related": "PlaceType"
953
- },
954
- "name": {
955
- "type": "text",
956
- "required": false
957
- },
958
- "description": {
959
- "type": "text",
960
- "required": false
961
- },
962
- "latitude": {
963
- "type": "decimal",
964
- "required": false,
965
- "_meta": {}
966
- },
967
- "longitude": {
968
- "type": "decimal",
969
- "required": false,
970
- "_meta": {}
971
- },
972
- "streetNumber": {
973
- "type": "text",
974
- "required": false
975
- },
976
- "streetName": {
977
- "type": "text",
978
- "required": false
979
- },
980
- "city": {
981
- "type": "text",
982
- "required": false
983
- },
984
- "region": {
985
- "type": "text",
986
- "required": false
987
- },
988
- "country": {
989
- "type": "text",
990
- "required": false
991
- },
992
- "postalCode": {
993
- "type": "text",
994
- "required": false
995
- },
996
- "countryCode": {
997
- "type": "text",
998
- "required": false
999
- },
1000
- "timezone": {
1001
- "type": "text",
1002
- "required": false
1003
- },
1004
- "externalId": {
1005
- "type": "text",
1006
- "required": false
1007
- },
1008
- "source": {
1009
- "type": "text",
1010
- "required": false
1011
- },
1012
- "metadata": {
1013
- "type": "text",
1014
- "required": false
1015
- },
1016
- "createdAt": {
1017
- "type": "text",
1018
- "required": false
1019
- },
1020
- "updatedAt": {
1021
- "type": "text",
1022
- "required": false
1023
- }
1024
- },
1025
- "methods": {
1026
- "getParent": {
1027
- "name": "getParent",
1028
- "async": true,
1029
- "parameters": [],
1030
- "returnType": "Promise<this | null>",
1273
+ ],
1274
+ "returnType": "Promise<TrackPlacesResult>",
1031
1275
  "isStatic": false,
1032
1276
  "isPublic": true
1033
1277
  },
1034
1278
  "getChildren": {
1035
1279
  "name": "getChildren",
1036
1280
  "async": true,
1037
- "parameters": [],
1038
- "returnType": "Promise<this[]>",
1039
- "isStatic": false,
1040
- "isPublic": true
1041
- },
1042
- "getAncestors": {
1043
- "name": "getAncestors",
1044
- "async": true,
1045
- "parameters": [],
1046
- "returnType": "Promise<this[]>",
1281
+ "parameters": [
1282
+ {
1283
+ "name": "parentId",
1284
+ "type": "string",
1285
+ "optional": false
1286
+ }
1287
+ ],
1288
+ "returnType": "Promise<Place[]>",
1047
1289
  "isStatic": false,
1048
1290
  "isPublic": true
1049
1291
  },
1050
- "getDescendants": {
1051
- "name": "getDescendants",
1292
+ "getRootPlaces": {
1293
+ "name": "getRootPlaces",
1052
1294
  "async": true,
1053
1295
  "parameters": [],
1054
- "returnType": "Promise<this[]>",
1296
+ "returnType": "Promise<Place[]>",
1055
1297
  "isStatic": false,
1056
1298
  "isPublic": true
1057
1299
  },
1058
- "getHierarchy": {
1059
- "name": "getHierarchy",
1060
- "async": true,
1061
- "parameters": [],
1062
- "returnType": "Promise<HierarchyView<this>>",
1063
- "isStatic": false,
1064
- "isPublic": true
1065
- },
1066
- "moveTo": {
1067
- "name": "moveTo",
1300
+ "getByType": {
1301
+ "name": "getByType",
1068
1302
  "async": true,
1069
1303
  "parameters": [
1070
1304
  {
1071
- "name": "newParent",
1072
- "type": "this | string | null",
1073
- "optional": false,
1074
- "unionBranches": [
1075
- {
1076
- "type": "this"
1077
- },
1078
- {
1079
- "type": "string"
1080
- },
1081
- {
1082
- "type": "null"
1083
- }
1084
- ]
1085
- }
1086
- ],
1087
- "returnType": "Promise<void>",
1088
- "isStatic": false,
1089
- "isPublic": true
1090
- },
1091
- "getGeoData": {
1092
- "name": "getGeoData",
1093
- "async": false,
1094
- "parameters": [],
1095
- "returnType": "GeoData",
1096
- "isStatic": false,
1097
- "isPublic": true
1098
- },
1099
- "hasCoordinates": {
1100
- "name": "hasCoordinates",
1101
- "async": false,
1102
- "parameters": [],
1103
- "returnType": "boolean",
1104
- "isStatic": false,
1105
- "isPublic": true
1106
- },
1107
- "getMetadata": {
1108
- "name": "getMetadata",
1109
- "async": false,
1110
- "parameters": [],
1111
- "returnType": "Record<string, unknown>",
1112
- "isStatic": false,
1113
- "isPublic": true
1114
- },
1115
- "setMetadata": {
1116
- "name": "setMetadata",
1117
- "async": false,
1118
- "parameters": [
1119
- {
1120
- "name": "data",
1121
- "type": "Record<string, unknown>",
1305
+ "name": "typeSlug",
1306
+ "type": "string",
1122
1307
  "optional": false
1123
1308
  }
1124
1309
  ],
1125
- "returnType": "void",
1310
+ "returnType": "Promise<Place[]>",
1126
1311
  "isStatic": false,
1127
1312
  "isPublic": true
1128
1313
  },
1129
- "updateMetadata": {
1130
- "name": "updateMetadata",
1131
- "async": false,
1314
+ "getHierarchy": {
1315
+ "name": "getHierarchy",
1316
+ "async": true,
1132
1317
  "parameters": [
1133
1318
  {
1134
- "name": "updates",
1135
- "type": "Record<string, unknown>",
1319
+ "name": "placeId",
1320
+ "type": "string",
1136
1321
  "optional": false
1137
1322
  }
1138
1323
  ],
1139
- "returnType": "void",
1140
- "isStatic": false,
1141
- "isPublic": true
1142
- },
1143
- "getType": {
1144
- "name": "getType",
1145
- "async": true,
1146
- "parameters": [],
1147
1324
  "returnType": "any",
1148
1325
  "isStatic": false,
1149
1326
  "isPublic": true
@@ -1152,6 +1329,11 @@
1152
1329
  "name": "getAssets",
1153
1330
  "async": true,
1154
1331
  "parameters": [
1332
+ {
1333
+ "name": "placeId",
1334
+ "type": "string",
1335
+ "optional": false
1336
+ },
1155
1337
  {
1156
1338
  "name": "relationship",
1157
1339
  "type": "string",
@@ -1166,6 +1348,11 @@
1166
1348
  "name": "addAsset",
1167
1349
  "async": true,
1168
1350
  "parameters": [
1351
+ {
1352
+ "name": "placeId",
1353
+ "type": "string",
1354
+ "optional": false
1355
+ },
1169
1356
  {
1170
1357
  "name": "asset",
1171
1358
  "type": "Asset",
@@ -1187,40 +1374,15 @@
1187
1374
  "isStatic": false,
1188
1375
  "isPublic": true
1189
1376
  },
1190
- "getMainAsset": {
1191
- "name": "getMainAsset",
1192
- "async": true,
1193
- "parameters": [],
1194
- "returnType": "Promise<Asset | null>",
1195
- "isStatic": false,
1196
- "isPublic": true
1197
- },
1198
- "setMainAsset": {
1199
- "name": "setMainAsset",
1200
- "async": true,
1201
- "parameters": [
1202
- {
1203
- "name": "asset",
1204
- "type": "Asset | null",
1205
- "optional": false,
1206
- "unionBranches": [
1207
- {
1208
- "type": "Asset"
1209
- },
1210
- {
1211
- "type": "null"
1212
- }
1213
- ]
1214
- }
1215
- ],
1216
- "returnType": "Promise<void>",
1217
- "isStatic": false,
1218
- "isPublic": true
1219
- },
1220
1377
  "removeAsset": {
1221
1378
  "name": "removeAsset",
1222
1379
  "async": true,
1223
1380
  "parameters": [
1381
+ {
1382
+ "name": "placeId",
1383
+ "type": "string",
1384
+ "optional": false
1385
+ },
1224
1386
  {
1225
1387
  "name": "assetId",
1226
1388
  "type": "string",
@@ -1235,310 +1397,94 @@
1235
1397
  "returnType": "Promise<void>",
1236
1398
  "isStatic": false,
1237
1399
  "isPublic": true
1238
- }
1239
- },
1240
- "decoratorConfig": {
1241
- "tableStrategy": "sti",
1242
- "api": {
1243
- "include": [
1244
- "list",
1245
- "get",
1246
- "create",
1247
- "update",
1248
- "delete"
1249
- ]
1250
- },
1251
- "mcp": {
1252
- "include": [
1253
- "list",
1254
- "get",
1255
- "create",
1256
- "update"
1257
- ]
1258
1400
  },
1259
- "cli": {
1260
- "skipApiCheck": true
1261
- },
1262
- "tenantScoped": {
1263
- "mode": "optional"
1264
- },
1265
- "conflictColumns": [
1266
- "tenant_id",
1267
- "slug",
1268
- "context",
1269
- "_meta_type"
1270
- ]
1271
- },
1272
- "extends": "SmrtHierarchical",
1273
- "exportName": "Place",
1274
- "collectionExportName": "PlaceCollection",
1275
- "displayLabelField": "name",
1276
- "schema": {
1277
- "tableName": "places",
1278
- "ddl": "CREATE TABLE IF NOT EXISTS \"places\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"parent_id\" UUID,\n \"tenant_id\" UUID,\n \"type_id\" UUID,\n \"name\" TEXT,\n \"description\" TEXT,\n \"latitude\" REAL,\n \"longitude\" REAL,\n \"street_number\" TEXT,\n \"street_name\" TEXT,\n \"city\" TEXT,\n \"region\" TEXT,\n \"country\" TEXT,\n \"postal_code\" TEXT,\n \"country_code\" TEXT,\n \"timezone\" TEXT,\n \"external_id\" TEXT,\n \"source\" TEXT,\n \"metadata\" TEXT\n);",
1279
- "columns": {
1280
- "id": {
1281
- "type": "UUID",
1282
- "primaryKey": true,
1283
- "referenceKind": "id",
1284
- "notNull": true
1285
- },
1286
- "slug": {
1287
- "type": "TEXT",
1288
- "notNull": true
1289
- },
1290
- "context": {
1291
- "type": "TEXT",
1292
- "notNull": true,
1293
- "default": ""
1294
- },
1295
- "_meta_type": {
1296
- "type": "TEXT",
1297
- "notNull": true
1298
- },
1299
- "_meta_data": {
1300
- "type": "JSON",
1301
- "notNull": false
1302
- },
1303
- "created_at": {
1304
- "type": "TIMESTAMP",
1305
- "notNull": true,
1306
- "default": "current_timestamp"
1307
- },
1308
- "updated_at": {
1309
- "type": "TIMESTAMP",
1310
- "notNull": true,
1311
- "default": "current_timestamp"
1312
- },
1313
- "parent_id": {
1314
- "type": "UUID",
1315
- "referenceKind": "foreignKey",
1316
- "notNull": false,
1317
- "foreignKey": {
1318
- "table": "places",
1319
- "column": "id",
1320
- "onDelete": "NO ACTION",
1321
- "onUpdate": "CASCADE"
1322
- }
1323
- },
1324
- "tenant_id": {
1325
- "type": "UUID",
1326
- "referenceKind": "tenantId",
1327
- "notNull": false
1328
- },
1329
- "type_id": {
1330
- "type": "UUID",
1331
- "referenceKind": "foreignKey",
1332
- "notNull": false,
1333
- "foreignKey": {
1334
- "table": "place_types",
1335
- "column": "id",
1336
- "onDelete": "NO ACTION",
1337
- "onUpdate": "CASCADE"
1401
+ "searchByProximity": {
1402
+ "name": "searchByProximity",
1403
+ "async": true,
1404
+ "parameters": [
1405
+ {
1406
+ "name": "latitude",
1407
+ "type": "number",
1408
+ "optional": false
1409
+ },
1410
+ {
1411
+ "name": "longitude",
1412
+ "type": "number",
1413
+ "optional": false
1414
+ },
1415
+ {
1416
+ "name": "radiusKm",
1417
+ "type": "number",
1418
+ "optional": true
1338
1419
  }
1339
- },
1340
- "name": {
1341
- "type": "TEXT",
1342
- "notNull": false
1343
- },
1344
- "description": {
1345
- "type": "TEXT",
1346
- "notNull": false
1347
- },
1348
- "latitude": {
1349
- "type": "REAL",
1350
- "notNull": false
1351
- },
1352
- "longitude": {
1353
- "type": "REAL",
1354
- "notNull": false
1355
- },
1356
- "street_number": {
1357
- "type": "TEXT",
1358
- "notNull": false
1359
- },
1360
- "street_name": {
1361
- "type": "TEXT",
1362
- "notNull": false
1363
- },
1364
- "city": {
1365
- "type": "TEXT",
1366
- "notNull": false
1367
- },
1368
- "region": {
1369
- "type": "TEXT",
1370
- "notNull": false
1371
- },
1372
- "country": {
1373
- "type": "TEXT",
1374
- "notNull": false
1375
- },
1376
- "postal_code": {
1377
- "type": "TEXT",
1378
- "notNull": false
1379
- },
1380
- "country_code": {
1381
- "type": "TEXT",
1382
- "notNull": false
1383
- },
1384
- "timezone": {
1385
- "type": "TEXT",
1386
- "notNull": false
1387
- },
1388
- "external_id": {
1389
- "type": "TEXT",
1390
- "notNull": false
1391
- },
1392
- "source": {
1393
- "type": "TEXT",
1394
- "notNull": false
1395
- },
1396
- "metadata": {
1397
- "type": "TEXT",
1398
- "notNull": false
1399
- }
1420
+ ],
1421
+ "returnType": "Promise<Place[]>",
1422
+ "isStatic": false,
1423
+ "isPublic": true
1400
1424
  },
1401
- "indexes": [
1402
- {
1403
- "name": "places_slug_context_meta_type_idx",
1404
- "columns": [
1405
- "tenant_id",
1406
- "slug",
1407
- "context",
1408
- "_meta_type"
1409
- ],
1410
- "unique": true,
1411
- "nullsNotDistinct": true
1412
- },
1413
- {
1414
- "name": "places_meta_type_idx",
1415
- "columns": [
1416
- "_meta_type"
1417
- ]
1418
- },
1419
- {
1420
- "name": "places_tenant_id_created_at_idx",
1421
- "columns": [
1422
- "tenant_id",
1423
- "created_at"
1424
- ]
1425
- },
1426
- {
1427
- "name": "places_parent_id_idx",
1428
- "columns": [
1429
- "parent_id"
1430
- ]
1431
- },
1432
- {
1433
- "name": "places_type_id_idx",
1434
- "columns": [
1435
- "type_id"
1436
- ]
1437
- }
1438
- ],
1439
- "version": "f670088c"
1440
- },
1441
- "importPath": "@happyvertical/smrt-places"
1442
- },
1443
- "@happyvertical/smrt-places:PlaceAsset": {
1444
- "name": "placeasset",
1445
- "className": "PlaceAsset",
1446
- "qualifiedName": "@happyvertical/smrt-places:PlaceAsset",
1447
- "collection": "placeassets",
1448
- "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/PlaceAsset.ts",
1449
- "packageName": "@happyvertical/smrt-places",
1450
- "fields": {
1451
- "tenantId": {
1452
- "type": "text",
1453
- "required": false,
1454
- "_meta": {
1455
- "sqlType": "UUID",
1456
- "nullable": true,
1457
- "__tenancy": {
1458
- "isTenantIdField": true,
1459
- "autoFilter": true,
1460
- "required": false,
1461
- "autoPopulate": true,
1462
- "nullable": true,
1463
- "mode": "optional",
1464
- "field": "tenantId",
1465
- "allowSuperAdminBypass": false
1425
+ "findByTenant": {
1426
+ "name": "findByTenant",
1427
+ "async": true,
1428
+ "parameters": [
1429
+ {
1430
+ "name": "tenantId",
1431
+ "type": "string",
1432
+ "optional": false
1466
1433
  }
1467
- }
1468
- },
1469
- "placeId": {
1470
- "type": "foreignKey",
1471
- "required": true,
1472
- "related": "Place",
1473
- "_meta": {
1474
- "required": true,
1475
- "onDelete": "CASCADE"
1476
- }
1477
- },
1478
- "assetId": {
1479
- "type": "crossPackageRef",
1480
- "required": true,
1481
- "related": "@happyvertical/smrt-assets:Asset",
1482
- "_meta": {
1483
- "onDelete": "CASCADE"
1484
- }
1485
- },
1486
- "relationship": {
1487
- "type": "text",
1488
- "required": true,
1489
- "_meta": {
1490
- "required": true
1491
- }
1492
- },
1493
- "sortOrder": {
1494
- "type": "integer",
1495
- "required": true,
1496
- "default": 0
1497
- }
1498
- },
1499
- "methods": {},
1500
- "decoratorConfig": {
1501
- "tableName": "place_assets",
1502
- "conflictColumns": [
1503
- "place_id",
1504
- "asset_id",
1505
- "relationship"
1506
- ],
1507
- "api": false,
1508
- "mcp": false,
1509
- "cli": false,
1510
- "tenantScoped": {
1511
- "mode": "optional"
1512
- }
1513
- },
1514
- "extends": "SmrtObject",
1515
- "exportName": "PlaceAsset",
1516
- "collectionExportName": "PlaceAssetCollection",
1517
- "validationRules": [
1518
- {
1519
- "field": "placeId",
1520
- "rule": "required",
1521
- "fieldType": "foreignKey"
1434
+ ],
1435
+ "returnType": "Promise<Place[]>",
1436
+ "isStatic": false,
1437
+ "isPublic": true
1522
1438
  },
1523
- {
1524
- "field": "assetId",
1525
- "rule": "required",
1526
- "fieldType": "crossPackageRef"
1439
+ "findGlobal": {
1440
+ "name": "findGlobal",
1441
+ "async": true,
1442
+ "parameters": [],
1443
+ "returnType": "Promise<Place[]>",
1444
+ "isStatic": false,
1445
+ "isPublic": true
1527
1446
  },
1528
- {
1529
- "field": "relationship",
1530
- "rule": "required",
1531
- "fieldType": "text"
1447
+ "findWithGlobals": {
1448
+ "name": "findWithGlobals",
1449
+ "async": true,
1450
+ "parameters": [
1451
+ {
1452
+ "name": "tenantId",
1453
+ "type": "string",
1454
+ "optional": false
1455
+ }
1456
+ ],
1457
+ "returnType": "Promise<Place[]>",
1458
+ "isStatic": false,
1459
+ "isPublic": true
1460
+ }
1461
+ },
1462
+ "decoratorConfig": {
1463
+ "api": {
1464
+ "include": [
1465
+ "list",
1466
+ "get",
1467
+ "create",
1468
+ "update",
1469
+ "delete"
1470
+ ]
1532
1471
  },
1533
- {
1534
- "field": "sortOrder",
1535
- "rule": "required",
1536
- "fieldType": "integer"
1472
+ "mcp": {
1473
+ "include": [
1474
+ "list",
1475
+ "get",
1476
+ "create",
1477
+ "update"
1478
+ ]
1537
1479
  }
1538
- ],
1480
+ },
1481
+ "extends": "SmrtCollection",
1482
+ "extendsTypeArg": "Place",
1483
+ "exportName": "PlaceCollection",
1484
+ "collectionExportName": "PlaceCollectionCollection",
1539
1485
  "schema": {
1540
- "tableName": "place_assets",
1541
- "ddl": "CREATE TABLE IF NOT EXISTS \"place_assets\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"place_id\" UUID NOT NULL,\n \"asset_id\" UUID NOT NULL,\n \"relationship\" TEXT NOT NULL,\n \"sort_order\" INTEGER NOT NULL DEFAULT 0\n);",
1486
+ "tableName": "places",
1487
+ "ddl": "CREATE TABLE IF NOT EXISTS \"places\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"parent_id\" UUID,\n \"tenant_id\" UUID,\n \"type_id\" UUID,\n \"name\" TEXT,\n \"description\" TEXT,\n \"latitude\" REAL,\n \"longitude\" REAL,\n \"street_number\" TEXT,\n \"street_name\" TEXT,\n \"city\" TEXT,\n \"region\" TEXT,\n \"country\" TEXT,\n \"postal_code\" TEXT,\n \"country_code\" TEXT,\n \"timezone\" TEXT,\n \"external_id\" TEXT,\n \"source\" TEXT,\n \"metadata\" TEXT\n);",
1542
1488
  "columns": {
1543
1489
  "id": {
1544
1490
  "type": "UUID",
@@ -1555,6 +1501,14 @@
1555
1501
  "notNull": true,
1556
1502
  "default": ""
1557
1503
  },
1504
+ "_meta_type": {
1505
+ "type": "TEXT",
1506
+ "notNull": true
1507
+ },
1508
+ "_meta_data": {
1509
+ "type": "JSON",
1510
+ "notNull": false
1511
+ },
1558
1512
  "created_at": {
1559
1513
  "type": "TIMESTAMP",
1560
1514
  "notNull": true,
@@ -1565,132 +1519,188 @@
1565
1519
  "notNull": true,
1566
1520
  "default": "current_timestamp"
1567
1521
  },
1522
+ "parent_id": {
1523
+ "type": "UUID",
1524
+ "referenceKind": "foreignKey",
1525
+ "notNull": false,
1526
+ "foreignKey": {
1527
+ "table": "places",
1528
+ "column": "id",
1529
+ "onDelete": "NO ACTION",
1530
+ "onUpdate": "CASCADE"
1531
+ }
1532
+ },
1568
1533
  "tenant_id": {
1569
1534
  "type": "UUID",
1570
1535
  "referenceKind": "tenantId",
1571
- "notNull": false,
1572
- "unique": false
1536
+ "notNull": false
1573
1537
  },
1574
- "place_id": {
1538
+ "type_id": {
1575
1539
  "type": "UUID",
1576
1540
  "referenceKind": "foreignKey",
1577
- "notNull": true,
1578
- "unique": false,
1541
+ "notNull": false,
1579
1542
  "foreignKey": {
1580
- "table": "places",
1543
+ "table": "place_types",
1581
1544
  "column": "id",
1582
- "onDelete": "CASCADE",
1545
+ "onDelete": "NO ACTION",
1583
1546
  "onUpdate": "CASCADE"
1584
1547
  }
1585
1548
  },
1586
- "asset_id": {
1587
- "type": "UUID",
1588
- "referenceKind": "crossPackageRef",
1589
- "notNull": true,
1590
- "unique": false
1549
+ "name": {
1550
+ "type": "TEXT",
1551
+ "notNull": false
1591
1552
  },
1592
- "relationship": {
1553
+ "description": {
1593
1554
  "type": "TEXT",
1594
- "notNull": true,
1595
- "unique": false
1555
+ "notNull": false
1596
1556
  },
1597
- "sort_order": {
1598
- "type": "INTEGER",
1599
- "notNull": true,
1600
- "unique": false,
1601
- "default": 0
1557
+ "latitude": {
1558
+ "type": "REAL",
1559
+ "notNull": false
1560
+ },
1561
+ "longitude": {
1562
+ "type": "REAL",
1563
+ "notNull": false
1564
+ },
1565
+ "street_number": {
1566
+ "type": "TEXT",
1567
+ "notNull": false
1568
+ },
1569
+ "street_name": {
1570
+ "type": "TEXT",
1571
+ "notNull": false
1572
+ },
1573
+ "city": {
1574
+ "type": "TEXT",
1575
+ "notNull": false
1576
+ },
1577
+ "region": {
1578
+ "type": "TEXT",
1579
+ "notNull": false
1580
+ },
1581
+ "country": {
1582
+ "type": "TEXT",
1583
+ "notNull": false
1584
+ },
1585
+ "postal_code": {
1586
+ "type": "TEXT",
1587
+ "notNull": false
1588
+ },
1589
+ "country_code": {
1590
+ "type": "TEXT",
1591
+ "notNull": false
1592
+ },
1593
+ "timezone": {
1594
+ "type": "TEXT",
1595
+ "notNull": false
1596
+ },
1597
+ "external_id": {
1598
+ "type": "TEXT",
1599
+ "notNull": false
1600
+ },
1601
+ "source": {
1602
+ "type": "TEXT",
1603
+ "notNull": false
1604
+ },
1605
+ "metadata": {
1606
+ "type": "TEXT",
1607
+ "notNull": false
1602
1608
  }
1603
1609
  },
1604
1610
  "indexes": [
1605
1611
  {
1606
- "name": "place_assets_place_id_asset_id_idx",
1612
+ "name": "places_slug_context_meta_type_idx",
1607
1613
  "columns": [
1608
- "place_id",
1609
- "asset_id",
1610
- "relationship"
1614
+ "tenant_id",
1615
+ "slug",
1616
+ "context",
1617
+ "_meta_type"
1611
1618
  ],
1612
- "unique": true
1619
+ "unique": true,
1620
+ "nullsNotDistinct": true
1613
1621
  },
1614
1622
  {
1615
- "name": "place_assets_slug_context_idx",
1623
+ "name": "places_meta_type_idx",
1616
1624
  "columns": [
1617
- "slug",
1618
- "context"
1625
+ "_meta_type"
1619
1626
  ]
1620
1627
  },
1621
1628
  {
1622
- "name": "place_assets_tenant_id_created_at_idx",
1629
+ "name": "places_tenant_id_created_at_idx",
1623
1630
  "columns": [
1624
1631
  "tenant_id",
1625
1632
  "created_at"
1626
1633
  ]
1627
1634
  },
1628
1635
  {
1629
- "name": "place_assets_asset_id_idx",
1636
+ "name": "places_parent_id_idx",
1630
1637
  "columns": [
1631
- "asset_id"
1638
+ "parent_id"
1639
+ ]
1640
+ },
1641
+ {
1642
+ "name": "places_type_id_idx",
1643
+ "columns": [
1644
+ "type_id"
1632
1645
  ]
1633
1646
  }
1634
1647
  ],
1635
- "version": "adf47666"
1648
+ "version": "f670088c"
1636
1649
  },
1637
1650
  "importPath": "@happyvertical/smrt-places"
1638
1651
  },
1639
- "@happyvertical/smrt-places:PlaceType": {
1640
- "name": "placetype",
1641
- "className": "PlaceType",
1642
- "qualifiedName": "@happyvertical/smrt-places:PlaceType",
1652
+ "@happyvertical/smrt-places:PlaceTypeCollection": {
1653
+ "name": "placetypecollection",
1654
+ "className": "PlaceTypeCollection",
1655
+ "qualifiedName": "@happyvertical/smrt-places:PlaceTypeCollection",
1643
1656
  "collection": "placetypes",
1644
- "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/PlaceType.ts",
1657
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/collections/PlaceTypeCollection.ts",
1645
1658
  "packageName": "@happyvertical/smrt-places",
1646
- "fields": {
1647
- "created_at": {
1648
- "type": "datetime",
1649
- "required": false
1650
- },
1651
- "updated_at": {
1652
- "type": "datetime",
1653
- "required": false
1654
- },
1655
- "name": {
1656
- "type": "text",
1657
- "required": true,
1658
- "default": "",
1659
- "_meta": {
1660
- "required": true
1661
- }
1662
- },
1663
- "description": {
1664
- "type": "text",
1665
- "required": false
1666
- },
1667
- "createdAt": {
1668
- "type": "text",
1669
- "required": false
1670
- },
1671
- "updatedAt": {
1672
- "type": "text",
1673
- "required": false
1674
- }
1675
- },
1659
+ "fields": {},
1676
1660
  "methods": {
1661
+ "getOrCreate": {
1662
+ "name": "getOrCreate",
1663
+ "async": true,
1664
+ "parameters": [
1665
+ {
1666
+ "name": "slug",
1667
+ "type": "string",
1668
+ "optional": false
1669
+ },
1670
+ {
1671
+ "name": "name",
1672
+ "type": "string",
1673
+ "optional": true
1674
+ }
1675
+ ],
1676
+ "returnType": "Promise<PlaceType>",
1677
+ "isStatic": false,
1678
+ "isPublic": true
1679
+ },
1677
1680
  "getBySlug": {
1678
1681
  "name": "getBySlug",
1679
1682
  "async": true,
1680
1683
  "parameters": [
1681
1684
  {
1682
- "name": "_slug",
1685
+ "name": "slug",
1683
1686
  "type": "string",
1684
1687
  "optional": false
1685
1688
  }
1686
1689
  ],
1687
1690
  "returnType": "Promise<PlaceType | null>",
1688
- "isStatic": true,
1691
+ "isStatic": false,
1692
+ "isPublic": true
1693
+ },
1694
+ "initializeDefaults": {
1695
+ "name": "initializeDefaults",
1696
+ "async": true,
1697
+ "parameters": [],
1698
+ "returnType": "Promise<PlaceType[]>",
1699
+ "isStatic": false,
1689
1700
  "isPublic": true
1690
1701
  }
1691
1702
  },
1692
1703
  "decoratorConfig": {
1693
- "tableStrategy": "sti",
1694
1704
  "api": {
1695
1705
  "include": [
1696
1706
  "list",
@@ -1706,22 +1716,12 @@
1706
1716
  "get",
1707
1717
  "create"
1708
1718
  ]
1709
- },
1710
- "cli": {
1711
- "skipApiCheck": true
1712
1719
  }
1713
1720
  },
1714
- "extends": "SmrtObject",
1715
- "exportName": "PlaceType",
1716
- "collectionExportName": "PlaceTypeCollection",
1717
- "displayLabelField": "name",
1718
- "validationRules": [
1719
- {
1720
- "field": "name",
1721
- "rule": "required",
1722
- "fieldType": "text"
1723
- }
1724
- ],
1721
+ "extends": "SmrtCollection",
1722
+ "extendsTypeArg": "PlaceType",
1723
+ "exportName": "PlaceTypeCollection",
1724
+ "collectionExportName": "PlaceTypeCollectionCollection",
1725
1725
  "schema": {
1726
1726
  "tableName": "place_types",
1727
1727
  "ddl": "CREATE TABLE IF NOT EXISTS \"place_types\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"_meta_type\" TEXT NOT NULL,\n \"_meta_data\" JSON,\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT\n);",