@happyvertical/smrt-places 0.57.35 → 0.57.37

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,249 +2,124 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-places",
5
- "packageVersion": "0.57.35",
5
+ "packageVersion": "0.57.37",
6
6
  "objects": {
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",
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",
13
13
  "packageName": "@happyvertical/smrt-places",
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
- },
14
+ "fields": {},
125
15
  "methods": {
126
- "getParent": {
127
- "name": "getParent",
128
- "async": true,
129
- "parameters": [],
130
- "returnType": "Promise<this | null>",
131
- "isStatic": false,
132
- "isPublic": true
133
- },
134
- "getChildren": {
135
- "name": "getChildren",
136
- "async": true,
137
- "parameters": [],
138
- "returnType": "Promise<this[]>",
139
- "isStatic": false,
140
- "isPublic": true
141
- },
142
- "getAncestors": {
143
- "name": "getAncestors",
144
- "async": true,
145
- "parameters": [],
146
- "returnType": "Promise<this[]>",
147
- "isStatic": false,
148
- "isPublic": true
149
- },
150
- "getDescendants": {
151
- "name": "getDescendants",
152
- "async": true,
153
- "parameters": [],
154
- "returnType": "Promise<this[]>",
155
- "isStatic": false,
156
- "isPublic": true
157
- },
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",
16
+ "byRight": {
17
+ "name": "byRight",
168
18
  "async": true,
169
19
  "parameters": [
170
20
  {
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
- ]
21
+ "name": "rightId",
22
+ "type": "string",
23
+ "optional": false
24
+ },
25
+ {
26
+ "name": "opts",
27
+ "type": "JunctionFilterOptions",
28
+ "optional": true
185
29
  }
186
30
  ],
187
- "returnType": "Promise<void>",
188
- "isStatic": false,
189
- "isPublic": true
190
- },
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>",
31
+ "returnType": "Promise<TItem[]>",
212
32
  "isStatic": false,
213
33
  "isPublic": true
214
34
  },
215
- "setMetadata": {
216
- "name": "setMetadata",
217
- "async": false,
35
+ "byLeft": {
36
+ "name": "byLeft",
37
+ "async": true,
218
38
  "parameters": [
219
39
  {
220
- "name": "data",
221
- "type": "Record<string, unknown>",
40
+ "name": "leftId",
41
+ "type": "string",
222
42
  "optional": false
43
+ },
44
+ {
45
+ "name": "opts",
46
+ "type": "JunctionFilterOptions",
47
+ "optional": true
223
48
  }
224
49
  ],
225
- "returnType": "void",
50
+ "returnType": "Promise<TItem[]>",
226
51
  "isStatic": false,
227
52
  "isPublic": true
228
53
  },
229
- "updateMetadata": {
230
- "name": "updateMetadata",
231
- "async": false,
54
+ "attach": {
55
+ "name": "attach",
56
+ "async": true,
232
57
  "parameters": [
233
58
  {
234
- "name": "updates",
235
- "type": "Record<string, unknown>",
59
+ "name": "leftId",
60
+ "type": "string",
236
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
237
72
  }
238
73
  ],
239
- "returnType": "void",
74
+ "returnType": "Promise<TItem>",
240
75
  "isStatic": false,
241
76
  "isPublic": true
242
77
  },
243
- "getType": {
244
- "name": "getType",
78
+ "detach": {
79
+ "name": "detach",
245
80
  "async": true,
246
- "parameters": [],
247
- "returnType": "any",
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>",
99
+ "isStatic": false,
100
+ "isPublic": true
101
+ },
102
+ "setLinks": {
103
+ "name": "setLinks",
104
+ "async": true,
105
+ "parameters": [
106
+ {
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
120
+ }
121
+ ],
122
+ "returnType": "Promise<void>",
248
123
  "isStatic": false,
249
124
  "isPublic": true
250
125
  },
@@ -252,6 +127,11 @@
252
127
  "name": "getAssets",
253
128
  "async": true,
254
129
  "parameters": [
130
+ {
131
+ "name": "placeId",
132
+ "type": "string",
133
+ "optional": false
134
+ },
255
135
  {
256
136
  "name": "relationship",
257
137
  "type": "string",
@@ -266,6 +146,11 @@
266
146
  "name": "addAsset",
267
147
  "async": true,
268
148
  "parameters": [
149
+ {
150
+ "name": "placeId",
151
+ "type": "string",
152
+ "optional": false
153
+ },
269
154
  {
270
155
  "name": "asset",
271
156
  "type": "Asset",
@@ -287,40 +172,15 @@
287
172
  "isStatic": false,
288
173
  "isPublic": true
289
174
  },
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
- },
320
175
  "removeAsset": {
321
176
  "name": "removeAsset",
322
177
  "async": true,
323
178
  "parameters": [
179
+ {
180
+ "name": "placeId",
181
+ "type": "string",
182
+ "optional": false
183
+ },
324
184
  {
325
185
  "name": "assetId",
326
186
  "type": "string",
@@ -338,44 +198,18 @@
338
198
  }
339
199
  },
340
200
  "decoratorConfig": {
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
- ]
201
+ "api": false,
202
+ "mcp": false,
203
+ "cli": false,
204
+ "tableName": "place_assets"
371
205
  },
372
- "extends": "SmrtHierarchical",
373
- "exportName": "Place",
374
- "collectionExportName": "PlaceCollection",
375
- "displayLabelField": "name",
206
+ "extends": "SmrtJunction",
207
+ "extendsTypeArg": "PlaceAsset",
208
+ "exportName": "PlaceAssetCollection",
209
+ "collectionExportName": "PlaceAssetCollectionCollection",
376
210
  "schema": {
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);",
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);",
379
213
  "columns": {
380
214
  "id": {
381
215
  "type": "UUID",
@@ -392,14 +226,6 @@
392
226
  "notNull": true,
393
227
  "default": ""
394
228
  },
395
- "_meta_type": {
396
- "type": "TEXT",
397
- "notNull": true
398
- },
399
- "_meta_data": {
400
- "type": "JSON",
401
- "notNull": false
402
- },
403
229
  "created_at": {
404
230
  "type": "TIMESTAMP",
405
231
  "notNull": true,
@@ -410,235 +236,363 @@
410
236
  "notNull": true,
411
237
  "default": "current_timestamp"
412
238
  },
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
- },
424
239
  "tenant_id": {
425
240
  "type": "UUID",
426
241
  "referenceKind": "tenantId",
427
- "notNull": false
242
+ "notNull": false,
243
+ "unique": false
428
244
  },
429
- "type_id": {
245
+ "place_id": {
430
246
  "type": "UUID",
431
247
  "referenceKind": "foreignKey",
432
- "notNull": false,
248
+ "notNull": true,
249
+ "unique": false,
433
250
  "foreignKey": {
434
- "table": "place_types",
251
+ "table": "places",
435
252
  "column": "id",
436
- "onDelete": "NO ACTION",
253
+ "onDelete": "CASCADE",
437
254
  "onUpdate": "CASCADE"
438
255
  }
439
256
  },
440
- "name": {
441
- "type": "TEXT",
442
- "notNull": false
443
- },
444
- "description": {
445
- "type": "TEXT",
446
- "notNull": false
447
- },
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
257
+ "asset_id": {
258
+ "type": "UUID",
259
+ "referenceKind": "crossPackageRef",
260
+ "notNull": true,
261
+ "unique": false
491
262
  },
492
- "source": {
263
+ "relationship": {
493
264
  "type": "TEXT",
494
- "notNull": false
265
+ "notNull": true,
266
+ "unique": false
495
267
  },
496
- "metadata": {
497
- "type": "TEXT",
498
- "notNull": false
268
+ "sort_order": {
269
+ "type": "INTEGER",
270
+ "notNull": true,
271
+ "unique": false,
272
+ "default": 0
499
273
  }
500
274
  },
501
275
  "indexes": [
502
276
  {
503
- "name": "places_slug_context_meta_type_idx",
277
+ "name": "place_assets_place_id_asset_id_idx",
504
278
  "columns": [
505
- "tenant_id",
506
- "slug",
507
- "context",
508
- "_meta_type"
279
+ "place_id",
280
+ "asset_id",
281
+ "relationship"
509
282
  ],
510
- "unique": true,
511
- "nullsNotDistinct": true
283
+ "unique": true
512
284
  },
513
285
  {
514
- "name": "places_meta_type_idx",
286
+ "name": "place_assets_slug_context_idx",
515
287
  "columns": [
516
- "_meta_type"
288
+ "slug",
289
+ "context"
517
290
  ]
518
291
  },
519
292
  {
520
- "name": "places_tenant_id_created_at_idx",
293
+ "name": "place_assets_tenant_id_created_at_idx",
521
294
  "columns": [
522
295
  "tenant_id",
523
296
  "created_at"
524
297
  ]
525
298
  },
526
299
  {
527
- "name": "places_parent_id_idx",
300
+ "name": "place_assets_asset_id_idx",
528
301
  "columns": [
529
- "parent_id"
530
- ]
531
- },
532
- {
533
- "name": "places_type_id_idx",
534
- "columns": [
535
- "type_id"
302
+ "asset_id"
536
303
  ]
537
304
  }
538
305
  ],
539
- "version": "f670088c"
306
+ "version": "adf47666"
540
307
  },
541
308
  "importPath": "@happyvertical/smrt-places"
542
309
  },
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",
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",
549
316
  "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
317
+ "fields": {},
318
+ "methods": {
319
+ "lookupOrCreate": {
320
+ "name": "lookupOrCreate",
321
+ "async": true,
322
+ "parameters": [
323
+ {
324
+ "name": "query",
325
+ "type": "string",
326
+ "optional": false
327
+ },
328
+ {
329
+ "name": "options",
330
+ "type": "LookupOrCreateOptions",
331
+ "optional": true
566
332
  }
567
- }
333
+ ],
334
+ "returnType": "Promise<Place | null>",
335
+ "isStatic": false,
336
+ "isPublic": true
568
337
  },
569
- "placeId": {
570
- "type": "foreignKey",
571
- "required": true,
572
- "related": "Place",
573
- "_meta": {
574
- "required": true,
575
- "onDelete": "CASCADE"
576
- }
338
+ "discoverNearby": {
339
+ "name": "discoverNearby",
340
+ "async": true,
341
+ "parameters": [
342
+ {
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",
355
+ "optional": false
356
+ },
357
+ {
358
+ "name": "options",
359
+ "type": "DiscoverNearbyOptions",
360
+ "optional": true
361
+ }
362
+ ],
363
+ "returnType": "Promise<Place[]>",
364
+ "isStatic": false,
365
+ "isPublic": true
577
366
  },
578
- "assetId": {
579
- "type": "crossPackageRef",
580
- "required": true,
581
- "related": "@happyvertical/smrt-assets:Asset",
582
- "_meta": {
583
- "onDelete": "CASCADE"
584
- }
367
+ "resolveTrackPlaces": {
368
+ "name": "resolveTrackPlaces",
369
+ "async": true,
370
+ "parameters": [
371
+ {
372
+ "name": "points",
373
+ "type": "ReadonlyArray<TrackPoint>",
374
+ "optional": false
375
+ },
376
+ {
377
+ "name": "options",
378
+ "type": "ResolveTrackPlacesOptions",
379
+ "optional": true
380
+ }
381
+ ],
382
+ "returnType": "Promise<TrackPlacesResult>",
383
+ "isStatic": false,
384
+ "isPublic": true
585
385
  },
586
- "relationship": {
587
- "type": "text",
588
- "required": true,
589
- "_meta": {
590
- "required": true
591
- }
386
+ "getChildren": {
387
+ "name": "getChildren",
388
+ "async": true,
389
+ "parameters": [
390
+ {
391
+ "name": "parentId",
392
+ "type": "string",
393
+ "optional": false
394
+ }
395
+ ],
396
+ "returnType": "Promise<Place[]>",
397
+ "isStatic": false,
398
+ "isPublic": true
592
399
  },
593
- "sortOrder": {
594
- "type": "integer",
595
- "required": true,
596
- "default": 0
400
+ "getRootPlaces": {
401
+ "name": "getRootPlaces",
402
+ "async": true,
403
+ "parameters": [],
404
+ "returnType": "Promise<Place[]>",
405
+ "isStatic": false,
406
+ "isPublic": true
407
+ },
408
+ "getByType": {
409
+ "name": "getByType",
410
+ "async": true,
411
+ "parameters": [
412
+ {
413
+ "name": "typeSlug",
414
+ "type": "string",
415
+ "optional": false
416
+ }
417
+ ],
418
+ "returnType": "Promise<Place[]>",
419
+ "isStatic": false,
420
+ "isPublic": true
421
+ },
422
+ "getHierarchy": {
423
+ "name": "getHierarchy",
424
+ "async": true,
425
+ "parameters": [
426
+ {
427
+ "name": "placeId",
428
+ "type": "string",
429
+ "optional": false
430
+ }
431
+ ],
432
+ "returnType": "any",
433
+ "isStatic": false,
434
+ "isPublic": true
435
+ },
436
+ "getAssets": {
437
+ "name": "getAssets",
438
+ "async": true,
439
+ "parameters": [
440
+ {
441
+ "name": "placeId",
442
+ "type": "string",
443
+ "optional": false
444
+ },
445
+ {
446
+ "name": "relationship",
447
+ "type": "string",
448
+ "optional": true
449
+ }
450
+ ],
451
+ "returnType": "Promise<Asset[]>",
452
+ "isStatic": false,
453
+ "isPublic": true
454
+ },
455
+ "addAsset": {
456
+ "name": "addAsset",
457
+ "async": true,
458
+ "parameters": [
459
+ {
460
+ "name": "placeId",
461
+ "type": "string",
462
+ "optional": false
463
+ },
464
+ {
465
+ "name": "asset",
466
+ "type": "Asset",
467
+ "optional": false
468
+ },
469
+ {
470
+ "name": "relationship",
471
+ "type": "any",
472
+ "optional": true,
473
+ "default": "attachment"
474
+ },
475
+ {
476
+ "name": "sortOrder",
477
+ "type": "any",
478
+ "optional": true
479
+ }
480
+ ],
481
+ "returnType": "Promise<void>",
482
+ "isStatic": false,
483
+ "isPublic": true
484
+ },
485
+ "removeAsset": {
486
+ "name": "removeAsset",
487
+ "async": true,
488
+ "parameters": [
489
+ {
490
+ "name": "placeId",
491
+ "type": "string",
492
+ "optional": false
493
+ },
494
+ {
495
+ "name": "assetId",
496
+ "type": "string",
497
+ "optional": false
498
+ },
499
+ {
500
+ "name": "relationship",
501
+ "type": "string",
502
+ "optional": true
503
+ }
504
+ ],
505
+ "returnType": "Promise<void>",
506
+ "isStatic": false,
507
+ "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
597
568
  }
598
569
  },
599
- "methods": {},
600
570
  "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"
571
+ "api": {
572
+ "include": [
573
+ "list",
574
+ "get",
575
+ "create",
576
+ "update",
577
+ "delete"
578
+ ]
632
579
  },
633
- {
634
- "field": "sortOrder",
635
- "rule": "required",
636
- "fieldType": "integer"
580
+ "mcp": {
581
+ "include": [
582
+ "list",
583
+ "get",
584
+ "create",
585
+ "update"
586
+ ]
637
587
  }
638
- ],
588
+ },
589
+ "extends": "SmrtCollection",
590
+ "extendsTypeArg": "Place",
591
+ "exportName": "PlaceCollection",
592
+ "collectionExportName": "PlaceCollectionCollection",
639
593
  "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);",
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);",
642
596
  "columns": {
643
597
  "id": {
644
598
  "type": "UUID",
@@ -655,6 +609,14 @@
655
609
  "notNull": true,
656
610
  "default": ""
657
611
  },
612
+ "_meta_type": {
613
+ "type": "TEXT",
614
+ "notNull": true
615
+ },
616
+ "_meta_data": {
617
+ "type": "JSON",
618
+ "notNull": false
619
+ },
658
620
  "created_at": {
659
621
  "type": "TIMESTAMP",
660
622
  "notNull": true,
@@ -665,443 +627,212 @@
665
627
  "notNull": true,
666
628
  "default": "current_timestamp"
667
629
  },
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
+ },
668
641
  "tenant_id": {
669
642
  "type": "UUID",
670
643
  "referenceKind": "tenantId",
671
- "notNull": false,
672
- "unique": false
644
+ "notNull": false
673
645
  },
674
- "place_id": {
646
+ "type_id": {
675
647
  "type": "UUID",
676
648
  "referenceKind": "foreignKey",
677
- "notNull": true,
678
- "unique": false,
649
+ "notNull": false,
679
650
  "foreignKey": {
680
- "table": "places",
651
+ "table": "place_types",
681
652
  "column": "id",
682
- "onDelete": "CASCADE",
653
+ "onDelete": "NO ACTION",
683
654
  "onUpdate": "CASCADE"
684
655
  }
685
656
  },
686
- "asset_id": {
687
- "type": "UUID",
688
- "referenceKind": "crossPackageRef",
689
- "notNull": true,
690
- "unique": false
691
- },
692
- "relationship": {
657
+ "name": {
693
658
  "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
- ],
712
- "unique": true
659
+ "notNull": false
713
660
  },
714
- {
715
- "name": "place_assets_slug_context_idx",
716
- "columns": [
717
- "slug",
718
- "context"
719
- ]
661
+ "description": {
662
+ "type": "TEXT",
663
+ "notNull": false
720
664
  },
721
- {
722
- "name": "place_assets_tenant_id_created_at_idx",
723
- "columns": [
724
- "tenant_id",
725
- "created_at"
726
- ]
665
+ "latitude": {
666
+ "type": "REAL",
667
+ "notNull": false
727
668
  },
728
- {
729
- "name": "place_assets_asset_id_idx",
730
- "columns": [
731
- "asset_id"
732
- ]
733
- }
734
- ],
735
- "version": "adf47666"
736
- },
737
- "importPath": "@happyvertical/smrt-places"
738
- },
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",
745
- "packageName": "@happyvertical/smrt-places",
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
- },
776
- "methods": {
777
- "getBySlug": {
778
- "name": "getBySlug",
779
- "async": true,
780
- "parameters": [
781
- {
782
- "name": "_slug",
783
- "type": "string",
784
- "optional": false
785
- }
786
- ],
787
- "returnType": "Promise<PlaceType | null>",
788
- "isStatic": true,
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
- ]
802
- },
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
669
+ "longitude": {
670
+ "type": "REAL",
671
+ "notNull": false
834
672
  },
835
- "slug": {
673
+ "street_number": {
836
674
  "type": "TEXT",
837
- "notNull": true
675
+ "notNull": false
838
676
  },
839
- "context": {
677
+ "street_name": {
840
678
  "type": "TEXT",
841
- "notNull": true,
842
- "default": ""
679
+ "notNull": false
843
680
  },
844
- "_meta_type": {
681
+ "city": {
845
682
  "type": "TEXT",
846
- "notNull": true
683
+ "notNull": false
847
684
  },
848
- "_meta_data": {
849
- "type": "JSON",
685
+ "region": {
686
+ "type": "TEXT",
850
687
  "notNull": false
851
688
  },
852
- "created_at": {
853
- "type": "TIMESTAMP",
854
- "notNull": true,
855
- "default": "current_timestamp"
689
+ "country": {
690
+ "type": "TEXT",
691
+ "notNull": false
856
692
  },
857
- "updated_at": {
858
- "type": "TIMESTAMP",
859
- "notNull": true,
860
- "default": "current_timestamp"
693
+ "postal_code": {
694
+ "type": "TEXT",
695
+ "notNull": false
861
696
  },
862
- "name": {
697
+ "country_code": {
863
698
  "type": "TEXT",
864
- "notNull": false,
865
- "default": ""
699
+ "notNull": false
866
700
  },
867
- "description": {
701
+ "timezone": {
702
+ "type": "TEXT",
703
+ "notNull": false
704
+ },
705
+ "external_id": {
706
+ "type": "TEXT",
707
+ "notNull": false
708
+ },
709
+ "source": {
710
+ "type": "TEXT",
711
+ "notNull": false
712
+ },
713
+ "metadata": {
868
714
  "type": "TEXT",
869
715
  "notNull": false
870
716
  }
871
717
  },
872
718
  "indexes": [
873
719
  {
874
- "name": "place_types_slug_context_meta_type_idx",
720
+ "name": "places_slug_context_meta_type_idx",
875
721
  "columns": [
722
+ "tenant_id",
876
723
  "slug",
877
724
  "context",
878
725
  "_meta_type"
879
726
  ],
880
- "unique": true
727
+ "unique": true,
728
+ "nullsNotDistinct": true
881
729
  },
882
730
  {
883
- "name": "place_types_meta_type_idx",
731
+ "name": "places_meta_type_idx",
884
732
  "columns": [
885
733
  "_meta_type"
886
734
  ]
887
735
  },
888
736
  {
889
- "name": "place_types_created_at_idx",
737
+ "name": "places_tenant_id_created_at_idx",
890
738
  "columns": [
739
+ "tenant_id",
891
740
  "created_at"
892
741
  ]
742
+ },
743
+ {
744
+ "name": "places_parent_id_idx",
745
+ "columns": [
746
+ "parent_id"
747
+ ]
748
+ },
749
+ {
750
+ "name": "places_type_id_idx",
751
+ "columns": [
752
+ "type_id"
753
+ ]
893
754
  }
894
755
  ],
895
- "version": "8c3bb691"
756
+ "version": "f670088c"
896
757
  },
897
758
  "importPath": "@happyvertical/smrt-places"
898
759
  },
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",
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",
905
766
  "packageName": "@happyvertical/smrt-places",
906
767
  "fields": {},
907
768
  "methods": {
908
- "byRight": {
909
- "name": "byRight",
910
- "async": true,
911
- "parameters": [
912
- {
913
- "name": "rightId",
914
- "type": "string",
915
- "optional": false
916
- },
917
- {
918
- "name": "opts",
919
- "type": "JunctionFilterOptions",
920
- "optional": true
921
- }
922
- ],
923
- "returnType": "Promise<TItem[]>",
924
- "isStatic": false,
925
- "isPublic": true
926
- },
927
- "byLeft": {
928
- "name": "byLeft",
929
- "async": true,
930
- "parameters": [
931
- {
932
- "name": "leftId",
933
- "type": "string",
934
- "optional": false
935
- },
936
- {
937
- "name": "opts",
938
- "type": "JunctionFilterOptions",
939
- "optional": true
940
- }
941
- ],
942
- "returnType": "Promise<TItem[]>",
943
- "isStatic": false,
944
- "isPublic": true
945
- },
946
- "attach": {
947
- "name": "attach",
948
- "async": true,
949
- "parameters": [
950
- {
951
- "name": "leftId",
952
- "type": "string",
953
- "optional": false
954
- },
955
- {
956
- "name": "rightId",
957
- "type": "string",
958
- "optional": false
959
- },
960
- {
961
- "name": "opts",
962
- "type": "JunctionAttachOptions",
963
- "optional": true
964
- }
965
- ],
966
- "returnType": "Promise<TItem>",
967
- "isStatic": false,
968
- "isPublic": true
969
- },
970
- "detach": {
971
- "name": "detach",
972
- "async": true,
973
- "parameters": [
974
- {
975
- "name": "leftId",
976
- "type": "string",
977
- "optional": false
978
- },
979
- {
980
- "name": "rightId",
981
- "type": "string",
982
- "optional": false
983
- },
984
- {
985
- "name": "opts",
986
- "type": "JunctionFilterOptions",
987
- "optional": true
988
- }
989
- ],
990
- "returnType": "Promise<void>",
991
- "isStatic": false,
992
- "isPublic": true
993
- },
994
- "setLinks": {
995
- "name": "setLinks",
996
- "async": true,
997
- "parameters": [
998
- {
999
- "name": "leftId",
1000
- "type": "string",
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
1012
- }
1013
- ],
1014
- "returnType": "Promise<void>",
1015
- "isStatic": false,
1016
- "isPublic": true
1017
- },
1018
- "getAssets": {
1019
- "name": "getAssets",
769
+ "getOrCreate": {
770
+ "name": "getOrCreate",
1020
771
  "async": true,
1021
772
  "parameters": [
1022
773
  {
1023
- "name": "placeId",
774
+ "name": "slug",
1024
775
  "type": "string",
1025
776
  "optional": false
1026
777
  },
1027
778
  {
1028
- "name": "relationship",
779
+ "name": "name",
1029
780
  "type": "string",
1030
781
  "optional": true
1031
782
  }
1032
783
  ],
1033
- "returnType": "Promise<Asset[]>",
784
+ "returnType": "Promise<PlaceType>",
1034
785
  "isStatic": false,
1035
786
  "isPublic": true
1036
787
  },
1037
- "addAsset": {
1038
- "name": "addAsset",
788
+ "getBySlug": {
789
+ "name": "getBySlug",
1039
790
  "async": true,
1040
791
  "parameters": [
1041
792
  {
1042
- "name": "placeId",
793
+ "name": "slug",
1043
794
  "type": "string",
1044
795
  "optional": false
1045
- },
1046
- {
1047
- "name": "asset",
1048
- "type": "Asset",
1049
- "optional": false
1050
- },
1051
- {
1052
- "name": "relationship",
1053
- "type": "any",
1054
- "optional": true,
1055
- "default": "attachment"
1056
- },
1057
- {
1058
- "name": "sortOrder",
1059
- "type": "any",
1060
- "optional": true
1061
796
  }
1062
797
  ],
1063
- "returnType": "Promise<void>",
798
+ "returnType": "Promise<PlaceType | null>",
1064
799
  "isStatic": false,
1065
800
  "isPublic": true
1066
801
  },
1067
- "removeAsset": {
1068
- "name": "removeAsset",
1069
- "async": true,
1070
- "parameters": [
1071
- {
1072
- "name": "placeId",
1073
- "type": "string",
1074
- "optional": false
1075
- },
1076
- {
1077
- "name": "assetId",
1078
- "type": "string",
1079
- "optional": false
1080
- },
1081
- {
1082
- "name": "relationship",
1083
- "type": "string",
1084
- "optional": true
1085
- }
1086
- ],
1087
- "returnType": "Promise<void>",
802
+ "initializeDefaults": {
803
+ "name": "initializeDefaults",
804
+ "async": true,
805
+ "parameters": [],
806
+ "returnType": "Promise<PlaceType[]>",
1088
807
  "isStatic": false,
1089
808
  "isPublic": true
1090
809
  }
1091
810
  },
1092
811
  "decoratorConfig": {
1093
- "api": false,
1094
- "mcp": false,
1095
- "cli": false,
1096
- "tableName": "place_assets"
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
+ }
1097
828
  },
1098
- "extends": "SmrtJunction",
1099
- "extendsTypeArg": "PlaceAsset",
1100
- "exportName": "PlaceAssetCollection",
1101
- "collectionExportName": "PlaceAssetCollectionCollection",
829
+ "extends": "SmrtCollection",
830
+ "extendsTypeArg": "PlaceType",
831
+ "exportName": "PlaceTypeCollection",
832
+ "collectionExportName": "PlaceTypeCollectionCollection",
1102
833
  "schema": {
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);",
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);",
1105
836
  "columns": {
1106
837
  "id": {
1107
838
  "type": "UUID",
@@ -1118,6 +849,14 @@
1118
849
  "notNull": true,
1119
850
  "default": ""
1120
851
  },
852
+ "_meta_type": {
853
+ "type": "TEXT",
854
+ "notNull": true
855
+ },
856
+ "_meta_data": {
857
+ "type": "JSON",
858
+ "notNull": false
859
+ },
1121
860
  "created_at": {
1122
861
  "type": "TIMESTAMP",
1123
862
  "notNull": true,
@@ -1128,199 +867,341 @@
1128
867
  "notNull": true,
1129
868
  "default": "current_timestamp"
1130
869
  },
1131
- "tenant_id": {
1132
- "type": "UUID",
1133
- "referenceKind": "tenantId",
870
+ "name": {
871
+ "type": "TEXT",
1134
872
  "notNull": false,
1135
- "unique": false
1136
- },
1137
- "place_id": {
1138
- "type": "UUID",
1139
- "referenceKind": "foreignKey",
1140
- "notNull": true,
1141
- "unique": false,
1142
- "foreignKey": {
1143
- "table": "places",
1144
- "column": "id",
1145
- "onDelete": "CASCADE",
1146
- "onUpdate": "CASCADE"
1147
- }
1148
- },
1149
- "asset_id": {
1150
- "type": "UUID",
1151
- "referenceKind": "crossPackageRef",
1152
- "notNull": true,
1153
- "unique": false
873
+ "default": ""
1154
874
  },
1155
- "relationship": {
875
+ "description": {
1156
876
  "type": "TEXT",
1157
- "notNull": true,
1158
- "unique": false
1159
- },
1160
- "sort_order": {
1161
- "type": "INTEGER",
1162
- "notNull": true,
1163
- "unique": false,
1164
- "default": 0
877
+ "notNull": false
1165
878
  }
1166
879
  },
1167
880
  "indexes": [
1168
881
  {
1169
- "name": "place_assets_place_id_asset_id_idx",
882
+ "name": "place_types_slug_context_meta_type_idx",
1170
883
  "columns": [
1171
- "place_id",
1172
- "asset_id",
1173
- "relationship"
884
+ "slug",
885
+ "context",
886
+ "_meta_type"
1174
887
  ],
1175
888
  "unique": true
1176
889
  },
1177
890
  {
1178
- "name": "place_assets_slug_context_idx",
891
+ "name": "place_types_meta_type_idx",
1179
892
  "columns": [
1180
- "slug",
1181
- "context"
893
+ "_meta_type"
1182
894
  ]
1183
895
  },
1184
896
  {
1185
- "name": "place_assets_tenant_id_created_at_idx",
897
+ "name": "place_types_created_at_idx",
1186
898
  "columns": [
1187
- "tenant_id",
1188
899
  "created_at"
1189
900
  ]
1190
- },
1191
- {
1192
- "name": "place_assets_asset_id_idx",
1193
- "columns": [
1194
- "asset_id"
1195
- ]
1196
901
  }
1197
902
  ],
1198
- "version": "adf47666"
903
+ "version": "8c3bb691"
1199
904
  },
1200
905
  "importPath": "@happyvertical/smrt-places"
1201
906
  },
1202
- "@happyvertical/smrt-places:PlaceCollection": {
1203
- "name": "placecollection",
1204
- "className": "PlaceCollection",
1205
- "qualifiedName": "@happyvertical/smrt-places:PlaceCollection",
907
+ "@happyvertical/smrt-places:Place": {
908
+ "name": "place",
909
+ "className": "Place",
910
+ "qualifiedName": "@happyvertical/smrt-places:Place",
1206
911
  "collection": "places",
1207
- "filePath": "/home/runner/work/smrt/smrt/packages/places/src/collections/PlaceCollection.ts",
912
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/Place.ts",
1208
913
  "packageName": "@happyvertical/smrt-places",
1209
- "fields": {},
1210
- "methods": {
1211
- "lookupOrCreate": {
1212
- "name": "lookupOrCreate",
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
946
+ }
947
+ }
948
+ },
949
+ "typeId": {
950
+ "type": "foreignKey",
951
+ "required": false,
952
+ "related": "PlaceType",
953
+ "description": "What kind of place this is, such as a building, a room or a storage zone.",
954
+ "_meta": {
955
+ "description": "What kind of place this is, such as a building, a room or a storage zone."
956
+ }
957
+ },
958
+ "name": {
959
+ "type": "text",
960
+ "required": false,
961
+ "description": "What the place is called, such as \"Main warehouse\" or \"Aisle 4\".",
962
+ "_meta": {
963
+ "description": "What the place is called, such as \"Main warehouse\" or \"Aisle 4\"."
964
+ }
965
+ },
966
+ "description": {
967
+ "type": "text",
968
+ "required": false,
969
+ "description": "A few words about the place and what happens there.",
970
+ "_meta": {
971
+ "description": "A few words about the place and what happens there."
972
+ }
973
+ },
974
+ "latitude": {
975
+ "type": "decimal",
976
+ "required": false,
977
+ "description": "How far north or south the place is on a map. Leave empty for a place that is not on a map.",
978
+ "_meta": {
979
+ "description": "How far north or south the place is on a map. Leave empty for a place that is not on a map."
980
+ }
981
+ },
982
+ "longitude": {
983
+ "type": "decimal",
984
+ "required": false,
985
+ "description": "How far east or west the place is on a map. Leave empty for a place that is not on a map.",
986
+ "_meta": {
987
+ "description": "How far east or west the place is on a map. Leave empty for a place that is not on a map."
988
+ }
989
+ },
990
+ "streetNumber": {
991
+ "type": "text",
992
+ "required": false,
993
+ "description": "The number of the building on its street.",
994
+ "_meta": {
995
+ "description": "The number of the building on its street."
996
+ }
997
+ },
998
+ "streetName": {
999
+ "type": "text",
1000
+ "required": false,
1001
+ "description": "The name of the street the place is on.",
1002
+ "_meta": {
1003
+ "description": "The name of the street the place is on."
1004
+ }
1005
+ },
1006
+ "city": {
1007
+ "type": "text",
1008
+ "required": false,
1009
+ "description": "The town or city the place is in.",
1010
+ "_meta": {
1011
+ "description": "The town or city the place is in."
1012
+ }
1013
+ },
1014
+ "region": {
1015
+ "type": "text",
1016
+ "required": false,
1017
+ "description": "The state, province or region the place is in.",
1018
+ "_meta": {
1019
+ "description": "The state, province or region the place is in."
1020
+ }
1021
+ },
1022
+ "country": {
1023
+ "type": "text",
1024
+ "required": false,
1025
+ "description": "The country the place is in.",
1026
+ "_meta": {
1027
+ "description": "The country the place is in."
1028
+ }
1029
+ },
1030
+ "postalCode": {
1031
+ "type": "text",
1032
+ "required": false,
1033
+ "description": "The postal or zip code of the address.",
1034
+ "_meta": {
1035
+ "description": "The postal or zip code of the address."
1036
+ }
1037
+ },
1038
+ "countryCode": {
1039
+ "type": "text",
1040
+ "required": false,
1041
+ "description": "The short two-letter code for the country, such as CA or US.",
1042
+ "_meta": {
1043
+ "description": "The short two-letter code for the country, such as CA or US."
1044
+ }
1045
+ },
1046
+ "timezone": {
1047
+ "type": "text",
1048
+ "required": false,
1049
+ "description": "The time zone the place keeps, such as America/Toronto.",
1050
+ "_meta": {
1051
+ "description": "The time zone the place keeps, such as America/Toronto."
1052
+ }
1053
+ },
1054
+ "externalId": {
1055
+ "type": "text",
1056
+ "required": false,
1057
+ "description": "The reference the map provider uses for this place, filled in when the app looks it up.",
1058
+ "_meta": {
1059
+ "description": "The reference the map provider uses for this place, filled in when the app looks it up."
1060
+ }
1061
+ },
1062
+ "source": {
1063
+ "type": "text",
1064
+ "required": false,
1065
+ "description": "Which map provider the place was looked up from, if any.",
1066
+ "_meta": {
1067
+ "description": "Which map provider the place was looked up from, if any."
1068
+ }
1069
+ },
1070
+ "metadata": {
1071
+ "type": "text",
1072
+ "required": false
1073
+ },
1074
+ "createdAt": {
1075
+ "type": "text",
1076
+ "required": false
1077
+ },
1078
+ "updatedAt": {
1079
+ "type": "text",
1080
+ "required": false
1081
+ }
1082
+ },
1083
+ "methods": {
1084
+ "getParent": {
1085
+ "name": "getParent",
1213
1086
  "async": true,
1214
- "parameters": [
1215
- {
1216
- "name": "query",
1217
- "type": "string",
1218
- "optional": false
1219
- },
1220
- {
1221
- "name": "options",
1222
- "type": "LookupOrCreateOptions",
1223
- "optional": true
1224
- }
1225
- ],
1226
- "returnType": "Promise<Place | null>",
1087
+ "parameters": [],
1088
+ "returnType": "Promise<this | null>",
1227
1089
  "isStatic": false,
1228
1090
  "isPublic": true
1229
1091
  },
1230
- "discoverNearby": {
1231
- "name": "discoverNearby",
1092
+ "getChildren": {
1093
+ "name": "getChildren",
1232
1094
  "async": true,
1233
- "parameters": [
1234
- {
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",
1247
- "optional": false
1248
- },
1249
- {
1250
- "name": "options",
1251
- "type": "DiscoverNearbyOptions",
1252
- "optional": true
1253
- }
1254
- ],
1255
- "returnType": "Promise<Place[]>",
1095
+ "parameters": [],
1096
+ "returnType": "Promise<this[]>",
1256
1097
  "isStatic": false,
1257
1098
  "isPublic": true
1258
1099
  },
1259
- "resolveTrackPlaces": {
1260
- "name": "resolveTrackPlaces",
1100
+ "getAncestors": {
1101
+ "name": "getAncestors",
1261
1102
  "async": true,
1262
- "parameters": [
1263
- {
1264
- "name": "points",
1265
- "type": "ReadonlyArray<TrackPoint>",
1266
- "optional": false
1267
- },
1268
- {
1269
- "name": "options",
1270
- "type": "ResolveTrackPlacesOptions",
1271
- "optional": true
1272
- }
1273
- ],
1274
- "returnType": "Promise<TrackPlacesResult>",
1103
+ "parameters": [],
1104
+ "returnType": "Promise<this[]>",
1275
1105
  "isStatic": false,
1276
1106
  "isPublic": true
1277
1107
  },
1278
- "getChildren": {
1279
- "name": "getChildren",
1108
+ "getDescendants": {
1109
+ "name": "getDescendants",
1110
+ "async": true,
1111
+ "parameters": [],
1112
+ "returnType": "Promise<this[]>",
1113
+ "isStatic": false,
1114
+ "isPublic": true
1115
+ },
1116
+ "getHierarchy": {
1117
+ "name": "getHierarchy",
1118
+ "async": true,
1119
+ "parameters": [],
1120
+ "returnType": "Promise<HierarchyView<this>>",
1121
+ "isStatic": false,
1122
+ "isPublic": true
1123
+ },
1124
+ "moveTo": {
1125
+ "name": "moveTo",
1280
1126
  "async": true,
1281
1127
  "parameters": [
1282
1128
  {
1283
- "name": "parentId",
1284
- "type": "string",
1285
- "optional": false
1129
+ "name": "newParent",
1130
+ "type": "this | string | null",
1131
+ "optional": false,
1132
+ "unionBranches": [
1133
+ {
1134
+ "type": "this"
1135
+ },
1136
+ {
1137
+ "type": "string"
1138
+ },
1139
+ {
1140
+ "type": "null"
1141
+ }
1142
+ ]
1286
1143
  }
1287
1144
  ],
1288
- "returnType": "Promise<Place[]>",
1145
+ "returnType": "Promise<void>",
1289
1146
  "isStatic": false,
1290
1147
  "isPublic": true
1291
1148
  },
1292
- "getRootPlaces": {
1293
- "name": "getRootPlaces",
1294
- "async": true,
1149
+ "getGeoData": {
1150
+ "name": "getGeoData",
1151
+ "async": false,
1295
1152
  "parameters": [],
1296
- "returnType": "Promise<Place[]>",
1153
+ "returnType": "GeoData",
1297
1154
  "isStatic": false,
1298
1155
  "isPublic": true
1299
1156
  },
1300
- "getByType": {
1301
- "name": "getByType",
1302
- "async": true,
1157
+ "hasCoordinates": {
1158
+ "name": "hasCoordinates",
1159
+ "async": false,
1160
+ "parameters": [],
1161
+ "returnType": "boolean",
1162
+ "isStatic": false,
1163
+ "isPublic": true
1164
+ },
1165
+ "getMetadata": {
1166
+ "name": "getMetadata",
1167
+ "async": false,
1168
+ "parameters": [],
1169
+ "returnType": "Record<string, unknown>",
1170
+ "isStatic": false,
1171
+ "isPublic": true
1172
+ },
1173
+ "setMetadata": {
1174
+ "name": "setMetadata",
1175
+ "async": false,
1303
1176
  "parameters": [
1304
1177
  {
1305
- "name": "typeSlug",
1306
- "type": "string",
1178
+ "name": "data",
1179
+ "type": "Record<string, unknown>",
1307
1180
  "optional": false
1308
1181
  }
1309
1182
  ],
1310
- "returnType": "Promise<Place[]>",
1183
+ "returnType": "void",
1311
1184
  "isStatic": false,
1312
1185
  "isPublic": true
1313
1186
  },
1314
- "getHierarchy": {
1315
- "name": "getHierarchy",
1316
- "async": true,
1187
+ "updateMetadata": {
1188
+ "name": "updateMetadata",
1189
+ "async": false,
1317
1190
  "parameters": [
1318
1191
  {
1319
- "name": "placeId",
1320
- "type": "string",
1192
+ "name": "updates",
1193
+ "type": "Record<string, unknown>",
1321
1194
  "optional": false
1322
1195
  }
1323
1196
  ],
1197
+ "returnType": "void",
1198
+ "isStatic": false,
1199
+ "isPublic": true
1200
+ },
1201
+ "getType": {
1202
+ "name": "getType",
1203
+ "async": true,
1204
+ "parameters": [],
1324
1205
  "returnType": "any",
1325
1206
  "isStatic": false,
1326
1207
  "isPublic": true
@@ -1329,11 +1210,6 @@
1329
1210
  "name": "getAssets",
1330
1211
  "async": true,
1331
1212
  "parameters": [
1332
- {
1333
- "name": "placeId",
1334
- "type": "string",
1335
- "optional": false
1336
- },
1337
1213
  {
1338
1214
  "name": "relationship",
1339
1215
  "type": "string",
@@ -1348,11 +1224,6 @@
1348
1224
  "name": "addAsset",
1349
1225
  "async": true,
1350
1226
  "parameters": [
1351
- {
1352
- "name": "placeId",
1353
- "type": "string",
1354
- "optional": false
1355
- },
1356
1227
  {
1357
1228
  "name": "asset",
1358
1229
  "type": "Asset",
@@ -1374,92 +1245,58 @@
1374
1245
  "isStatic": false,
1375
1246
  "isPublic": true
1376
1247
  },
1377
- "removeAsset": {
1378
- "name": "removeAsset",
1248
+ "getMainAsset": {
1249
+ "name": "getMainAsset",
1379
1250
  "async": true,
1380
- "parameters": [
1381
- {
1382
- "name": "placeId",
1383
- "type": "string",
1384
- "optional": false
1385
- },
1386
- {
1387
- "name": "assetId",
1388
- "type": "string",
1389
- "optional": false
1390
- },
1391
- {
1392
- "name": "relationship",
1393
- "type": "string",
1394
- "optional": true
1395
- }
1396
- ],
1397
- "returnType": "Promise<void>",
1251
+ "parameters": [],
1252
+ "returnType": "Promise<Asset | null>",
1398
1253
  "isStatic": false,
1399
1254
  "isPublic": true
1400
1255
  },
1401
- "searchByProximity": {
1402
- "name": "searchByProximity",
1256
+ "setMainAsset": {
1257
+ "name": "setMainAsset",
1403
1258
  "async": true,
1404
1259
  "parameters": [
1405
1260
  {
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
1261
+ "name": "asset",
1262
+ "type": "Asset | null",
1263
+ "optional": false,
1264
+ "unionBranches": [
1265
+ {
1266
+ "type": "Asset"
1267
+ },
1268
+ {
1269
+ "type": "null"
1270
+ }
1271
+ ]
1419
1272
  }
1420
1273
  ],
1421
- "returnType": "Promise<Place[]>",
1274
+ "returnType": "Promise<void>",
1422
1275
  "isStatic": false,
1423
1276
  "isPublic": true
1424
1277
  },
1425
- "findByTenant": {
1426
- "name": "findByTenant",
1278
+ "removeAsset": {
1279
+ "name": "removeAsset",
1427
1280
  "async": true,
1428
1281
  "parameters": [
1429
1282
  {
1430
- "name": "tenantId",
1283
+ "name": "assetId",
1431
1284
  "type": "string",
1432
1285
  "optional": false
1433
- }
1434
- ],
1435
- "returnType": "Promise<Place[]>",
1436
- "isStatic": false,
1437
- "isPublic": true
1438
- },
1439
- "findGlobal": {
1440
- "name": "findGlobal",
1441
- "async": true,
1442
- "parameters": [],
1443
- "returnType": "Promise<Place[]>",
1444
- "isStatic": false,
1445
- "isPublic": true
1446
- },
1447
- "findWithGlobals": {
1448
- "name": "findWithGlobals",
1449
- "async": true,
1450
- "parameters": [
1286
+ },
1451
1287
  {
1452
- "name": "tenantId",
1288
+ "name": "relationship",
1453
1289
  "type": "string",
1454
- "optional": false
1290
+ "optional": true
1455
1291
  }
1456
1292
  ],
1457
- "returnType": "Promise<Place[]>",
1293
+ "returnType": "Promise<void>",
1458
1294
  "isStatic": false,
1459
1295
  "isPublic": true
1460
1296
  }
1461
1297
  },
1462
1298
  "decoratorConfig": {
1299
+ "tableStrategy": "sti",
1463
1300
  "api": {
1464
1301
  "include": [
1465
1302
  "list",
@@ -1476,12 +1313,24 @@
1476
1313
  "create",
1477
1314
  "update"
1478
1315
  ]
1479
- }
1316
+ },
1317
+ "cli": {
1318
+ "skipApiCheck": true
1319
+ },
1320
+ "tenantScoped": {
1321
+ "mode": "optional"
1322
+ },
1323
+ "conflictColumns": [
1324
+ "tenant_id",
1325
+ "slug",
1326
+ "context",
1327
+ "_meta_type"
1328
+ ]
1480
1329
  },
1481
- "extends": "SmrtCollection",
1482
- "extendsTypeArg": "Place",
1483
- "exportName": "PlaceCollection",
1484
- "collectionExportName": "PlaceCollectionCollection",
1330
+ "extends": "SmrtHierarchical",
1331
+ "exportName": "Place",
1332
+ "collectionExportName": "PlaceCollection",
1333
+ "displayLabelField": "name",
1485
1334
  "schema": {
1486
1335
  "tableName": "places",
1487
1336
  "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);",
@@ -1533,174 +1382,379 @@
1533
1382
  "tenant_id": {
1534
1383
  "type": "UUID",
1535
1384
  "referenceKind": "tenantId",
1536
- "notNull": false
1385
+ "notNull": false
1386
+ },
1387
+ "type_id": {
1388
+ "type": "UUID",
1389
+ "referenceKind": "foreignKey",
1390
+ "notNull": false,
1391
+ "foreignKey": {
1392
+ "table": "place_types",
1393
+ "column": "id",
1394
+ "onDelete": "NO ACTION",
1395
+ "onUpdate": "CASCADE"
1396
+ }
1397
+ },
1398
+ "name": {
1399
+ "type": "TEXT",
1400
+ "notNull": false
1401
+ },
1402
+ "description": {
1403
+ "type": "TEXT",
1404
+ "notNull": false
1405
+ },
1406
+ "latitude": {
1407
+ "type": "REAL",
1408
+ "notNull": false
1409
+ },
1410
+ "longitude": {
1411
+ "type": "REAL",
1412
+ "notNull": false
1413
+ },
1414
+ "street_number": {
1415
+ "type": "TEXT",
1416
+ "notNull": false
1417
+ },
1418
+ "street_name": {
1419
+ "type": "TEXT",
1420
+ "notNull": false
1421
+ },
1422
+ "city": {
1423
+ "type": "TEXT",
1424
+ "notNull": false
1425
+ },
1426
+ "region": {
1427
+ "type": "TEXT",
1428
+ "notNull": false
1429
+ },
1430
+ "country": {
1431
+ "type": "TEXT",
1432
+ "notNull": false
1433
+ },
1434
+ "postal_code": {
1435
+ "type": "TEXT",
1436
+ "notNull": false
1437
+ },
1438
+ "country_code": {
1439
+ "type": "TEXT",
1440
+ "notNull": false
1441
+ },
1442
+ "timezone": {
1443
+ "type": "TEXT",
1444
+ "notNull": false
1445
+ },
1446
+ "external_id": {
1447
+ "type": "TEXT",
1448
+ "notNull": false
1449
+ },
1450
+ "source": {
1451
+ "type": "TEXT",
1452
+ "notNull": false
1453
+ },
1454
+ "metadata": {
1455
+ "type": "TEXT",
1456
+ "notNull": false
1457
+ }
1458
+ },
1459
+ "indexes": [
1460
+ {
1461
+ "name": "places_slug_context_meta_type_idx",
1462
+ "columns": [
1463
+ "tenant_id",
1464
+ "slug",
1465
+ "context",
1466
+ "_meta_type"
1467
+ ],
1468
+ "unique": true,
1469
+ "nullsNotDistinct": true
1470
+ },
1471
+ {
1472
+ "name": "places_meta_type_idx",
1473
+ "columns": [
1474
+ "_meta_type"
1475
+ ]
1476
+ },
1477
+ {
1478
+ "name": "places_tenant_id_created_at_idx",
1479
+ "columns": [
1480
+ "tenant_id",
1481
+ "created_at"
1482
+ ]
1483
+ },
1484
+ {
1485
+ "name": "places_parent_id_idx",
1486
+ "columns": [
1487
+ "parent_id"
1488
+ ]
1489
+ },
1490
+ {
1491
+ "name": "places_type_id_idx",
1492
+ "columns": [
1493
+ "type_id"
1494
+ ]
1495
+ }
1496
+ ],
1497
+ "version": "f670088c"
1498
+ },
1499
+ "importPath": "@happyvertical/smrt-places"
1500
+ },
1501
+ "@happyvertical/smrt-places:PlaceAsset": {
1502
+ "name": "placeasset",
1503
+ "className": "PlaceAsset",
1504
+ "qualifiedName": "@happyvertical/smrt-places:PlaceAsset",
1505
+ "collection": "placeassets",
1506
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/PlaceAsset.ts",
1507
+ "packageName": "@happyvertical/smrt-places",
1508
+ "fields": {
1509
+ "tenantId": {
1510
+ "type": "text",
1511
+ "required": false,
1512
+ "_meta": {
1513
+ "sqlType": "UUID",
1514
+ "nullable": true,
1515
+ "__tenancy": {
1516
+ "isTenantIdField": true,
1517
+ "autoFilter": true,
1518
+ "required": false,
1519
+ "autoPopulate": true,
1520
+ "nullable": true,
1521
+ "mode": "optional",
1522
+ "field": "tenantId",
1523
+ "allowSuperAdminBypass": false
1524
+ }
1525
+ }
1526
+ },
1527
+ "placeId": {
1528
+ "type": "foreignKey",
1529
+ "required": true,
1530
+ "related": "Place",
1531
+ "_meta": {
1532
+ "required": true,
1533
+ "onDelete": "CASCADE"
1534
+ }
1535
+ },
1536
+ "assetId": {
1537
+ "type": "crossPackageRef",
1538
+ "required": true,
1539
+ "related": "@happyvertical/smrt-assets:Asset",
1540
+ "_meta": {
1541
+ "onDelete": "CASCADE"
1542
+ }
1543
+ },
1544
+ "relationship": {
1545
+ "type": "text",
1546
+ "required": true,
1547
+ "_meta": {
1548
+ "required": true
1549
+ }
1550
+ },
1551
+ "sortOrder": {
1552
+ "type": "integer",
1553
+ "required": true,
1554
+ "default": 0
1555
+ }
1556
+ },
1557
+ "methods": {},
1558
+ "decoratorConfig": {
1559
+ "tableName": "place_assets",
1560
+ "conflictColumns": [
1561
+ "place_id",
1562
+ "asset_id",
1563
+ "relationship"
1564
+ ],
1565
+ "api": false,
1566
+ "mcp": false,
1567
+ "cli": false,
1568
+ "tenantScoped": {
1569
+ "mode": "optional"
1570
+ }
1571
+ },
1572
+ "extends": "SmrtObject",
1573
+ "exportName": "PlaceAsset",
1574
+ "collectionExportName": "PlaceAssetCollection",
1575
+ "validationRules": [
1576
+ {
1577
+ "field": "placeId",
1578
+ "rule": "required",
1579
+ "fieldType": "foreignKey"
1580
+ },
1581
+ {
1582
+ "field": "assetId",
1583
+ "rule": "required",
1584
+ "fieldType": "crossPackageRef"
1585
+ },
1586
+ {
1587
+ "field": "relationship",
1588
+ "rule": "required",
1589
+ "fieldType": "text"
1590
+ },
1591
+ {
1592
+ "field": "sortOrder",
1593
+ "rule": "required",
1594
+ "fieldType": "integer"
1595
+ }
1596
+ ],
1597
+ "schema": {
1598
+ "tableName": "place_assets",
1599
+ "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);",
1600
+ "columns": {
1601
+ "id": {
1602
+ "type": "UUID",
1603
+ "primaryKey": true,
1604
+ "referenceKind": "id",
1605
+ "notNull": true
1606
+ },
1607
+ "slug": {
1608
+ "type": "TEXT",
1609
+ "notNull": true
1610
+ },
1611
+ "context": {
1612
+ "type": "TEXT",
1613
+ "notNull": true,
1614
+ "default": ""
1615
+ },
1616
+ "created_at": {
1617
+ "type": "TIMESTAMP",
1618
+ "notNull": true,
1619
+ "default": "current_timestamp"
1620
+ },
1621
+ "updated_at": {
1622
+ "type": "TIMESTAMP",
1623
+ "notNull": true,
1624
+ "default": "current_timestamp"
1625
+ },
1626
+ "tenant_id": {
1627
+ "type": "UUID",
1628
+ "referenceKind": "tenantId",
1629
+ "notNull": false,
1630
+ "unique": false
1537
1631
  },
1538
- "type_id": {
1632
+ "place_id": {
1539
1633
  "type": "UUID",
1540
1634
  "referenceKind": "foreignKey",
1541
- "notNull": false,
1635
+ "notNull": true,
1636
+ "unique": false,
1542
1637
  "foreignKey": {
1543
- "table": "place_types",
1638
+ "table": "places",
1544
1639
  "column": "id",
1545
- "onDelete": "NO ACTION",
1640
+ "onDelete": "CASCADE",
1546
1641
  "onUpdate": "CASCADE"
1547
1642
  }
1548
1643
  },
1549
- "name": {
1550
- "type": "TEXT",
1551
- "notNull": false
1552
- },
1553
- "description": {
1554
- "type": "TEXT",
1555
- "notNull": false
1556
- },
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
1644
+ "asset_id": {
1645
+ "type": "UUID",
1646
+ "referenceKind": "crossPackageRef",
1647
+ "notNull": true,
1648
+ "unique": false
1600
1649
  },
1601
- "source": {
1650
+ "relationship": {
1602
1651
  "type": "TEXT",
1603
- "notNull": false
1652
+ "notNull": true,
1653
+ "unique": false
1604
1654
  },
1605
- "metadata": {
1606
- "type": "TEXT",
1607
- "notNull": false
1655
+ "sort_order": {
1656
+ "type": "INTEGER",
1657
+ "notNull": true,
1658
+ "unique": false,
1659
+ "default": 0
1608
1660
  }
1609
1661
  },
1610
1662
  "indexes": [
1611
1663
  {
1612
- "name": "places_slug_context_meta_type_idx",
1664
+ "name": "place_assets_place_id_asset_id_idx",
1613
1665
  "columns": [
1614
- "tenant_id",
1615
- "slug",
1616
- "context",
1617
- "_meta_type"
1666
+ "place_id",
1667
+ "asset_id",
1668
+ "relationship"
1618
1669
  ],
1619
- "unique": true,
1620
- "nullsNotDistinct": true
1670
+ "unique": true
1621
1671
  },
1622
1672
  {
1623
- "name": "places_meta_type_idx",
1673
+ "name": "place_assets_slug_context_idx",
1624
1674
  "columns": [
1625
- "_meta_type"
1675
+ "slug",
1676
+ "context"
1626
1677
  ]
1627
1678
  },
1628
1679
  {
1629
- "name": "places_tenant_id_created_at_idx",
1680
+ "name": "place_assets_tenant_id_created_at_idx",
1630
1681
  "columns": [
1631
1682
  "tenant_id",
1632
1683
  "created_at"
1633
1684
  ]
1634
1685
  },
1635
1686
  {
1636
- "name": "places_parent_id_idx",
1637
- "columns": [
1638
- "parent_id"
1639
- ]
1640
- },
1641
- {
1642
- "name": "places_type_id_idx",
1687
+ "name": "place_assets_asset_id_idx",
1643
1688
  "columns": [
1644
- "type_id"
1689
+ "asset_id"
1645
1690
  ]
1646
1691
  }
1647
1692
  ],
1648
- "version": "f670088c"
1693
+ "version": "adf47666"
1649
1694
  },
1650
1695
  "importPath": "@happyvertical/smrt-places"
1651
1696
  },
1652
- "@happyvertical/smrt-places:PlaceTypeCollection": {
1653
- "name": "placetypecollection",
1654
- "className": "PlaceTypeCollection",
1655
- "qualifiedName": "@happyvertical/smrt-places:PlaceTypeCollection",
1697
+ "@happyvertical/smrt-places:PlaceType": {
1698
+ "name": "placetype",
1699
+ "className": "PlaceType",
1700
+ "qualifiedName": "@happyvertical/smrt-places:PlaceType",
1656
1701
  "collection": "placetypes",
1657
- "filePath": "/home/runner/work/smrt/smrt/packages/places/src/collections/PlaceTypeCollection.ts",
1702
+ "filePath": "/home/runner/work/smrt/smrt/packages/places/src/models/PlaceType.ts",
1658
1703
  "packageName": "@happyvertical/smrt-places",
1659
- "fields": {},
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
1704
+ "fields": {
1705
+ "created_at": {
1706
+ "type": "datetime",
1707
+ "required": false
1708
+ },
1709
+ "updated_at": {
1710
+ "type": "datetime",
1711
+ "required": false
1712
+ },
1713
+ "name": {
1714
+ "type": "text",
1715
+ "required": true,
1716
+ "default": "",
1717
+ "description": "The name of the kind of place, such as \"Building\", \"Room\" or \"Zone\".",
1718
+ "_meta": {
1719
+ "required": true,
1720
+ "description": "The name of the kind of place, such as \"Building\", \"Room\" or \"Zone\"."
1721
+ }
1722
+ },
1723
+ "description": {
1724
+ "type": "text",
1725
+ "required": false,
1726
+ "description": "A few words about when to use this kind of place.",
1727
+ "_meta": {
1728
+ "description": "A few words about when to use this kind of place."
1729
+ }
1730
+ },
1731
+ "createdAt": {
1732
+ "type": "text",
1733
+ "required": false
1679
1734
  },
1735
+ "updatedAt": {
1736
+ "type": "text",
1737
+ "required": false
1738
+ }
1739
+ },
1740
+ "methods": {
1680
1741
  "getBySlug": {
1681
1742
  "name": "getBySlug",
1682
1743
  "async": true,
1683
1744
  "parameters": [
1684
1745
  {
1685
- "name": "slug",
1746
+ "name": "_slug",
1686
1747
  "type": "string",
1687
1748
  "optional": false
1688
1749
  }
1689
1750
  ],
1690
1751
  "returnType": "Promise<PlaceType | null>",
1691
- "isStatic": false,
1692
- "isPublic": true
1693
- },
1694
- "initializeDefaults": {
1695
- "name": "initializeDefaults",
1696
- "async": true,
1697
- "parameters": [],
1698
- "returnType": "Promise<PlaceType[]>",
1699
- "isStatic": false,
1752
+ "isStatic": true,
1700
1753
  "isPublic": true
1701
1754
  }
1702
1755
  },
1703
1756
  "decoratorConfig": {
1757
+ "tableStrategy": "sti",
1704
1758
  "api": {
1705
1759
  "include": [
1706
1760
  "list",
@@ -1716,12 +1770,22 @@
1716
1770
  "get",
1717
1771
  "create"
1718
1772
  ]
1773
+ },
1774
+ "cli": {
1775
+ "skipApiCheck": true
1719
1776
  }
1720
1777
  },
1721
- "extends": "SmrtCollection",
1722
- "extendsTypeArg": "PlaceType",
1723
- "exportName": "PlaceTypeCollection",
1724
- "collectionExportName": "PlaceTypeCollectionCollection",
1778
+ "extends": "SmrtObject",
1779
+ "exportName": "PlaceType",
1780
+ "collectionExportName": "PlaceTypeCollection",
1781
+ "displayLabelField": "name",
1782
+ "validationRules": [
1783
+ {
1784
+ "field": "name",
1785
+ "rule": "required",
1786
+ "fieldType": "text"
1787
+ }
1788
+ ],
1725
1789
  "schema": {
1726
1790
  "tableName": "place_types",
1727
1791
  "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);",
@@ -1798,6 +1862,165 @@
1798
1862
  }
1799
1863
  },
1800
1864
  "moduleType": "smrt",
1865
+ "recipes": [
1866
+ {
1867
+ "id": "places.locations",
1868
+ "className": "PlacesLocationsRecipe",
1869
+ "label": "Places",
1870
+ "summary": "Keep a list of the places your work happens, such as sites, buildings, rooms and storage zones, one inside another.",
1871
+ "synonyms": [
1872
+ "places",
1873
+ "locations",
1874
+ "sites",
1875
+ "buildings",
1876
+ "rooms",
1877
+ "addresses",
1878
+ "warehouses"
1879
+ ],
1880
+ "models": [
1881
+ "@happyvertical/smrt-places:Place",
1882
+ "@happyvertical/smrt-places:PlaceType"
1883
+ ],
1884
+ "nav": [
1885
+ {
1886
+ "label": "Places",
1887
+ "model": "@happyvertical/smrt-places:Place",
1888
+ "icon": "home",
1889
+ "description": "Every site, building, room and zone, with its address and what it is inside.",
1890
+ "noun": "place"
1891
+ },
1892
+ {
1893
+ "label": "Place types",
1894
+ "model": "@happyvertical/smrt-places:PlaceType",
1895
+ "icon": "tag",
1896
+ "description": "The kinds of place you keep, such as building or room.",
1897
+ "noun": "place type"
1898
+ }
1899
+ ],
1900
+ "requires": [],
1901
+ "section": {
1902
+ "id": "places",
1903
+ "label": "Locations",
1904
+ "icon": "home",
1905
+ "description": "The places your work happens."
1906
+ },
1907
+ "options": {
1908
+ "@happyvertical/smrt-places:Place": {
1909
+ "fields": {
1910
+ "name": {
1911
+ "order": 1
1912
+ },
1913
+ "typeId": {
1914
+ "label": "Type",
1915
+ "order": 2
1916
+ },
1917
+ "parentId": {
1918
+ "label": "Inside",
1919
+ "help": "The larger place this one is part of, such as the building a room is in.",
1920
+ "order": 3
1921
+ },
1922
+ "description": {
1923
+ "order": 4
1924
+ },
1925
+ "streetNumber": {
1926
+ "label": "Street number",
1927
+ "order": 5
1928
+ },
1929
+ "streetName": {
1930
+ "label": "Street name",
1931
+ "order": 6
1932
+ },
1933
+ "city": {
1934
+ "order": 7
1935
+ },
1936
+ "region": {
1937
+ "order": 8
1938
+ },
1939
+ "country": {
1940
+ "order": 9
1941
+ },
1942
+ "postalCode": {
1943
+ "label": "Postal code",
1944
+ "order": 10
1945
+ },
1946
+ "latitude": {
1947
+ "visibility": "advanced"
1948
+ },
1949
+ "longitude": {
1950
+ "visibility": "advanced"
1951
+ },
1952
+ "countryCode": {
1953
+ "label": "Country code",
1954
+ "visibility": "advanced"
1955
+ },
1956
+ "timezone": {
1957
+ "label": "Time zone",
1958
+ "visibility": "advanced"
1959
+ },
1960
+ "externalId": {
1961
+ "label": "Map reference",
1962
+ "visibility": "advanced"
1963
+ },
1964
+ "source": {
1965
+ "label": "Map provider",
1966
+ "visibility": "advanced"
1967
+ },
1968
+ "metadata": {
1969
+ "visibility": "hidden"
1970
+ },
1971
+ "tenantId": {
1972
+ "visibility": "hidden"
1973
+ },
1974
+ "createdAt": {
1975
+ "visibility": "hidden"
1976
+ },
1977
+ "updatedAt": {
1978
+ "visibility": "hidden"
1979
+ }
1980
+ }
1981
+ },
1982
+ "@happyvertical/smrt-places:PlaceType": {
1983
+ "fields": {
1984
+ "name": {
1985
+ "order": 1
1986
+ },
1987
+ "description": {
1988
+ "order": 2
1989
+ },
1990
+ "createdAt": {
1991
+ "visibility": "hidden"
1992
+ },
1993
+ "updatedAt": {
1994
+ "visibility": "hidden"
1995
+ }
1996
+ }
1997
+ }
1998
+ },
1999
+ "help": {
2000
+ "markdown": "## Overview\n\nPlaces is where you keep the sites, buildings, rooms and storage zones your\nwork happens in. Each place has a name, a type and, when it is somewhere real,\nan address. A place can sit inside a larger one, so a room belongs to a\nbuilding and a shelf to a room, and you can follow that chain either way. A\nplace does not have to be on a map: a storage zone or a work area with no\naddress is fine.\n\n## Tasks\n\n### Add a place\n\n1. Open the list of places and choose **New**.\n2. Type the **{field:Place.name}**, for example \"Main warehouse\".\n3. Pick its **{field:Place.typeId}**, such as building or room. Add a type first if the one you need is missing.\n4. Fill in the address: the **{field:Place.streetNumber}**, **{field:Place.streetName}**, **{field:Place.city}**, **{field:Place.region}**, **{field:Place.country}** and **{field:Place.postalCode}**. Leave these empty for a place that is not on a map.\n5. Save. When your app searches a map for a place, it can add the place for you with the address filled in from the map provider.\n\n### Put a place inside another\n\n1. Open the place and choose to edit it.\n2. In **{field:Place.parentId}**, pick the larger place it belongs to, such as the building a room is in.\n3. Save. The place now shows up under the one you chose.\n\n### Change or remove a place\n\n1. Open the place and choose to edit it.\n2. Change the **{field:Place.name}**, **{field:Place.description}** or address, then save.\n3. To remove a place you no longer use, open it and choose to delete it. Move anything inside it first.\n\n### Add a place type\n\n1. Open the list of place types and choose **New**.\n2. Type the **{field:PlaceType.name}**, for example \"Room\".\n3. Add a **{field:PlaceType.description}** so others know when to use it.\n4. Save. The type can now be picked when you add a place.\n",
2001
+ "fieldRefs": [
2002
+ "Place.city",
2003
+ "Place.country",
2004
+ "Place.description",
2005
+ "Place.name",
2006
+ "Place.parentId",
2007
+ "Place.postalCode",
2008
+ "Place.region",
2009
+ "Place.streetName",
2010
+ "Place.streetNumber",
2011
+ "Place.typeId",
2012
+ "PlaceType.description",
2013
+ "PlaceType.name"
2014
+ ]
2015
+ },
2016
+ "demo": {
2017
+ "mode": "server",
2018
+ "reasons": [
2019
+ "Needs a server because its package does not build for a browser: geo -> cache -> redis, node:zlib; url-signature node:crypto; and its package depends on @happyvertical/smrt-tenancy, which do not build for a browser (#3624, #3627)."
2020
+ ]
2021
+ }
2022
+ }
2023
+ ],
1801
2024
  "smrtDependencies": [
1802
2025
  "@happyvertical/smrt-assets",
1803
2026
  "@happyvertical/smrt-core",