@onlyworlds/sdk 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,3 +1,26 @@
1
+ /**
2
+ * Modern branded types for type-safe element relationships
3
+ * Provides compile-time safety while maintaining zero runtime overhead
4
+ */
5
+ declare const __brand: unique symbol;
6
+ type Brand<B> = {
7
+ [__brand]: B;
8
+ };
9
+ /**
10
+ * Branded type for element IDs - ensures type safety for relationships
11
+ * @template T The element type this ID references
12
+ */
13
+ type ElementId<T extends ElementType> = string & Brand<T>;
14
+ /**
15
+ * Branded type for arrays of element IDs
16
+ * @template T The element type these IDs reference
17
+ */
18
+ type ElementIds<T extends ElementType> = ElementId<T>[];
19
+ /**
20
+ * Special type for IDs that can reference ANY element type
21
+ * Used in cases like Pin.element_type where the target can be any OnlyWorlds element
22
+ */
23
+ type AnyElementId = ElementId<ElementType>;
1
24
  /**
2
25
  * Base fields shared by all OnlyWorlds elements
3
26
  */
@@ -57,22 +80,14 @@ interface Ability extends BaseElement {
57
80
  range?: string;
58
81
  challenges?: string;
59
82
  prevalence?: string;
60
- /** Links to Construct */
61
- tradition?: string;
62
- /** Links to Phenomenon */
63
- source?: string;
64
- /** Links to Location */
65
- locus?: string;
66
- /** Links to Phenomenon */
67
- effects?: string[];
68
- /** Links to Trait */
69
- talents?: string[];
70
- /** Links to Construct */
71
- requisites?: string[];
72
- /** Links to Object */
73
- instruments?: string[];
74
- /** Links to Construct */
75
- systems?: string[];
83
+ tradition?: ElementId<ElementType.Construct>;
84
+ source?: ElementId<ElementType.Phenomenon>;
85
+ locus?: ElementId<ElementType.Location>;
86
+ effects?: ElementIds<ElementType.Phenomenon>;
87
+ talents?: ElementIds<ElementType.Trait>;
88
+ requisites?: ElementIds<ElementType.Construct>;
89
+ instruments?: ElementIds<ElementType.Object>;
90
+ systems?: ElementIds<ElementType.Construct>;
76
91
  }
77
92
  /**
78
93
  * Object element type
@@ -81,26 +96,17 @@ interface Object$1 extends BaseElement {
81
96
  aesthetics?: string;
82
97
  weight?: string;
83
98
  amount?: string;
84
- /** Links to Object */
85
- parent_object?: string;
99
+ parent_object?: ElementId<ElementType.Object>;
86
100
  utility?: string;
87
101
  origins?: string;
88
- /** Links to Location */
89
- location?: string;
90
- /** Links to Language */
91
- language?: string;
92
- /** Links to Construct */
93
- materials?: string[];
94
- /** Links to Construct */
95
- technology?: string[];
96
- /** Links to Phenomenon */
97
- effects?: string[];
98
- /** Links to Ability */
99
- abilities?: string[];
100
- /** Links to Construct */
101
- consumes?: string[];
102
- /** Links to Trait */
103
- affinities?: string[];
102
+ location?: ElementId<ElementType.Location>;
103
+ language?: ElementId<ElementType.Language>;
104
+ materials?: ElementIds<ElementType.Construct>;
105
+ technology?: ElementIds<ElementType.Construct>;
106
+ effects?: ElementIds<ElementType.Phenomenon>;
107
+ abilities?: ElementIds<ElementType.Ability>;
108
+ consumes?: ElementIds<ElementType.Construct>;
109
+ affinities?: ElementIds<ElementType.Trait>;
104
110
  }
105
111
  /**
106
112
  * Character element type
@@ -113,11 +119,9 @@ interface Character extends BaseElement {
113
119
  background?: string;
114
120
  motivations?: string;
115
121
  birth_date?: string;
116
- /** Links to Location */
117
- birthplace?: string;
122
+ birthplace?: ElementId<ElementType.Location>;
118
123
  reputation?: string;
119
- /** Links to Location */
120
- location?: string;
124
+ location?: ElementId<ElementType.Location>;
121
125
  charisma?: string;
122
126
  coercion?: string;
123
127
  competence?: string;
@@ -132,24 +136,15 @@ interface Character extends BaseElement {
132
136
  INT?: string;
133
137
  WIS?: string;
134
138
  CHA?: string;
135
- /** Links to Species */
136
- species?: string[];
137
- /** Links to Trait */
138
- traits?: string[];
139
- /** Links to Ability */
140
- abilities?: string[];
141
- /** Links to Language */
142
- languages?: string[];
143
- /** Links to Object */
144
- objects?: string[];
145
- /** Links to Institution */
146
- institutions?: string[];
147
- /** Links to Family */
148
- family?: string[];
149
- /** Links to Character */
150
- friends?: string[];
151
- /** Links to Character */
152
- rivals?: string[];
139
+ species?: ElementIds<ElementType.Species>;
140
+ traits?: ElementIds<ElementType.Trait>;
141
+ abilities?: ElementIds<ElementType.Ability>;
142
+ languages?: ElementIds<ElementType.Language>;
143
+ objects?: ElementIds<ElementType.Object>;
144
+ institutions?: ElementIds<ElementType.Institution>;
145
+ family?: ElementIds<ElementType.Family>;
146
+ friends?: ElementIds<ElementType.Character>;
147
+ rivals?: ElementIds<ElementType.Character>;
153
148
  }
154
149
  /**
155
150
  * Collective element type
@@ -158,25 +153,17 @@ interface Collective extends BaseElement {
158
153
  composition?: string;
159
154
  count?: string;
160
155
  formation_date?: string;
161
- /** Links to Institution */
162
- operator?: string;
156
+ operator?: ElementId<ElementType.Institution>;
163
157
  activity?: string;
164
158
  disposition?: string;
165
159
  state?: string;
166
- /** Links to Construct */
167
- equipment?: string[];
168
- /** Links to Ability */
169
- abilities?: string[];
170
- /** Links to Construct */
171
- symbolism?: string[];
172
- /** Links to Species */
173
- species?: string[];
174
- /** Links to Character */
175
- characters?: string[];
176
- /** Links to Creature */
177
- creatures?: string[];
178
- /** Links to Phenomenon */
179
- phenomena?: string[];
160
+ equipment?: ElementIds<ElementType.Construct>;
161
+ abilities?: ElementIds<ElementType.Ability>;
162
+ symbolism?: ElementIds<ElementType.Construct>;
163
+ species?: ElementIds<ElementType.Species>;
164
+ characters?: ElementIds<ElementType.Character>;
165
+ creatures?: ElementIds<ElementType.Creature>;
166
+ phenomena?: ElementIds<ElementType.Phenomenon>;
180
167
  }
181
168
  /**
182
169
  * Construct element type
@@ -188,46 +175,26 @@ interface Construct extends BaseElement {
188
175
  reach?: string;
189
176
  start_date?: string;
190
177
  end_date?: string;
191
- /** Links to Character */
192
- founder?: string;
193
- /** Links to Institution */
194
- custodian?: string;
195
- /** Links to Character */
196
- characters?: string[];
197
- /** Links to Object */
198
- objects?: string[];
199
- /** Links to Location */
200
- locations?: string[];
201
- /** Links to Species */
202
- species?: string[];
203
- /** Links to Creature */
204
- creatures?: string[];
205
- /** Links to Institution */
206
- institutions?: string[];
207
- /** Links to Trait */
208
- traits?: string[];
209
- /** Links to Collective */
210
- collectives?: string[];
211
- /** Links to Zone */
212
- zones?: string[];
213
- /** Links to Ability */
214
- abilities?: string[];
215
- /** Links to Phenomenon */
216
- phenomena?: string[];
217
- /** Links to Language */
218
- languages?: string[];
219
- /** Links to Family */
220
- families?: string[];
221
- /** Links to Relation */
222
- relations?: string[];
223
- /** Links to Title */
224
- titles?: string[];
225
- /** Links to Construct */
226
- constructs?: string[];
227
- /** Links to Event */
228
- events?: string[];
229
- /** Links to Narrative */
230
- narratives?: string[];
178
+ founder?: ElementId<ElementType.Character>;
179
+ custodian?: ElementId<ElementType.Institution>;
180
+ characters?: ElementIds<ElementType.Character>;
181
+ objects?: ElementIds<ElementType.Object>;
182
+ locations?: ElementIds<ElementType.Location>;
183
+ species?: ElementIds<ElementType.Species>;
184
+ creatures?: ElementIds<ElementType.Creature>;
185
+ institutions?: ElementIds<ElementType.Institution>;
186
+ traits?: ElementIds<ElementType.Trait>;
187
+ collectives?: ElementIds<ElementType.Collective>;
188
+ zones?: ElementIds<ElementType.Zone>;
189
+ abilities?: ElementIds<ElementType.Ability>;
190
+ phenomena?: ElementIds<ElementType.Phenomenon>;
191
+ languages?: ElementIds<ElementType.Language>;
192
+ families?: ElementIds<ElementType.Family>;
193
+ relations?: ElementIds<ElementType.Relation>;
194
+ titles?: ElementIds<ElementType.Title>;
195
+ constructs?: ElementIds<ElementType.Construct>;
196
+ events?: ElementIds<ElementType.Event>;
197
+ narratives?: ElementIds<ElementType.Narrative>;
231
198
  }
232
199
  /**
233
200
  * Creature element type
@@ -240,24 +207,17 @@ interface Creature extends BaseElement {
240
207
  demeanor?: string;
241
208
  status?: string;
242
209
  birth_date?: string;
243
- /** Links to Location */
244
- location?: string;
245
- /** Links to Zone */
246
- zone?: string;
210
+ location?: ElementId<ElementType.Location>;
211
+ zone?: ElementId<ElementType.Zone>;
247
212
  challenge_rating?: string;
248
213
  hit_points?: string;
249
214
  armor_class?: string;
250
215
  speed?: string;
251
- /** Links to Species */
252
- species?: string[];
253
- /** Links to Trait */
254
- traits?: string[];
255
- /** Links to Ability */
256
- abilities?: string[];
257
- /** Links to Language */
258
- languages?: string[];
259
- /** Links to Ability */
260
- actions?: string[];
216
+ species?: ElementIds<ElementType.Species>;
217
+ traits?: ElementIds<ElementType.Trait>;
218
+ abilities?: ElementIds<ElementType.Ability>;
219
+ languages?: ElementIds<ElementType.Language>;
220
+ actions?: ElementIds<ElementType.Ability>;
261
221
  }
262
222
  /**
263
223
  * Event element type
@@ -268,40 +228,23 @@ interface Event extends BaseElement {
268
228
  consequences?: string;
269
229
  start_date?: string;
270
230
  end_date?: string;
271
- /** Links to Event */
272
- triggers?: string[];
273
- /** Links to Character */
274
- characters?: string[];
275
- /** Links to Object */
276
- objects?: string[];
277
- /** Links to Location */
278
- locations?: string[];
279
- /** Links to Species */
280
- species?: string[];
281
- /** Links to Creature */
282
- creatures?: string[];
283
- /** Links to Institution */
284
- institutions?: string[];
285
- /** Links to Trait */
286
- traits?: string[];
287
- /** Links to Collective */
288
- collectives?: string[];
289
- /** Links to Zone */
290
- zones?: string[];
291
- /** Links to Ability */
292
- abilities?: string[];
293
- /** Links to Phenomenon */
294
- phenomena?: string[];
295
- /** Links to Language */
296
- languages?: string[];
297
- /** Links to Family */
298
- families?: string[];
299
- /** Links to Relation */
300
- relations?: string[];
301
- /** Links to Title */
302
- titles?: string[];
303
- /** Links to Construct */
304
- constructs?: string[];
231
+ triggers?: ElementIds<ElementType.Event>;
232
+ characters?: ElementIds<ElementType.Character>;
233
+ objects?: ElementIds<ElementType.Object>;
234
+ locations?: ElementIds<ElementType.Location>;
235
+ species?: ElementIds<ElementType.Species>;
236
+ creatures?: ElementIds<ElementType.Creature>;
237
+ institutions?: ElementIds<ElementType.Institution>;
238
+ traits?: ElementIds<ElementType.Trait>;
239
+ collectives?: ElementIds<ElementType.Collective>;
240
+ zones?: ElementIds<ElementType.Zone>;
241
+ abilities?: ElementIds<ElementType.Ability>;
242
+ phenomena?: ElementIds<ElementType.Phenomenon>;
243
+ languages?: ElementIds<ElementType.Language>;
244
+ families?: ElementIds<ElementType.Family>;
245
+ relations?: ElementIds<ElementType.Relation>;
246
+ titles?: ElementIds<ElementType.Title>;
247
+ constructs?: ElementIds<ElementType.Construct>;
305
248
  }
306
249
  /**
307
250
  * Family element type
@@ -310,24 +253,15 @@ interface Family extends BaseElement {
310
253
  spirit?: string;
311
254
  history?: string;
312
255
  reputation?: string;
313
- /** Links to Construct */
314
- traditions?: string[];
315
- /** Links to Trait */
316
- traits?: string[];
317
- /** Links to Ability */
318
- abilities?: string[];
319
- /** Links to Language */
320
- languages?: string[];
321
- /** Links to Character */
322
- ancestors?: string[];
323
- /** Links to Location */
324
- estates?: string[];
325
- /** Links to Institution */
326
- governs?: string[];
327
- /** Links to Object */
328
- heirlooms?: string[];
329
- /** Links to Creature */
330
- creatures?: string[];
256
+ traditions?: ElementIds<ElementType.Construct>;
257
+ traits?: ElementIds<ElementType.Trait>;
258
+ abilities?: ElementIds<ElementType.Ability>;
259
+ languages?: ElementIds<ElementType.Language>;
260
+ ancestors?: ElementIds<ElementType.Character>;
261
+ estates?: ElementIds<ElementType.Location>;
262
+ governs?: ElementIds<ElementType.Institution>;
263
+ heirlooms?: ElementIds<ElementType.Object>;
264
+ creatures?: ElementIds<ElementType.Creature>;
331
265
  }
332
266
  /**
333
267
  * Institution element type
@@ -335,21 +269,14 @@ interface Family extends BaseElement {
335
269
  interface Institution extends BaseElement {
336
270
  doctrine?: string;
337
271
  founding_date?: string;
338
- /** Links to Institution */
339
- parent_institution?: string;
272
+ parent_institution?: ElementId<ElementType.Institution>;
340
273
  status?: string;
341
- /** Links to Zone */
342
- zones?: string[];
343
- /** Links to Object */
344
- objects?: string[];
345
- /** Links to Creature */
346
- creatures?: string[];
347
- /** Links to Institution */
348
- allies?: string[];
349
- /** Links to Institution */
350
- adversaries?: string[];
351
- /** Links to Construct */
352
- constructs?: string[];
274
+ zones?: ElementIds<ElementType.Zone>;
275
+ objects?: ElementIds<ElementType.Object>;
276
+ creatures?: ElementIds<ElementType.Creature>;
277
+ allies?: ElementIds<ElementType.Institution>;
278
+ adversaries?: ElementIds<ElementType.Institution>;
279
+ constructs?: ElementIds<ElementType.Construct>;
353
280
  }
354
281
  /**
355
282
  * Language element type
@@ -359,13 +286,10 @@ interface Language extends BaseElement {
359
286
  grammar?: string;
360
287
  lexicon?: string;
361
288
  writing?: string;
362
- /** Links to Construct */
363
- classification?: string;
289
+ classification?: ElementId<ElementType.Construct>;
364
290
  status?: string;
365
- /** Links to Location */
366
- spread?: string[];
367
- /** Links to Language */
368
- dialects?: string[];
291
+ spread?: ElementIds<ElementType.Location>;
292
+ dialects?: ElementIds<ElementType.Language>;
369
293
  }
370
294
  /**
371
295
  * Law element type
@@ -374,22 +298,14 @@ interface Law extends BaseElement {
374
298
  declaration?: string;
375
299
  purpose?: string;
376
300
  date?: string;
377
- /** Links to Law */
378
- parent_law?: string;
379
- /** Links to Institution */
380
- author?: string;
381
- /** Links to Construct */
382
- penalties?: string[];
383
- /** Links to Location */
384
- locations?: string[];
385
- /** Links to Zone */
386
- zones?: string[];
387
- /** Links to Construct */
388
- prohibitions?: string[];
389
- /** Links to Title */
390
- adjudicators?: string[];
391
- /** Links to Title */
392
- enforcers?: string[];
301
+ parent_law?: ElementId<ElementType.Law>;
302
+ author?: ElementId<ElementType.Institution>;
303
+ penalties?: ElementIds<ElementType.Construct>;
304
+ locations?: ElementIds<ElementType.Location>;
305
+ zones?: ElementIds<ElementType.Zone>;
306
+ prohibitions?: ElementIds<ElementType.Construct>;
307
+ adjudicators?: ElementIds<ElementType.Title>;
308
+ enforcers?: ElementIds<ElementType.Title>;
393
309
  }
394
310
  /**
395
311
  * Location element type
@@ -398,56 +314,34 @@ interface Location extends BaseElement {
398
314
  form?: string;
399
315
  function?: string;
400
316
  founding_date?: string;
401
- /** Links to Location */
402
- parent_location?: string;
317
+ parent_location?: ElementId<ElementType.Location>;
403
318
  political_climate?: string;
404
- /** Links to Institution */
405
- primary_power?: string;
406
- /** Links to Title */
407
- governing_title?: string;
408
- /** Links to Zone */
409
- zone?: string;
410
- /** Links to Location */
411
- rival?: string;
412
- /** Links to Location */
413
- partner?: string;
319
+ primary_power?: ElementId<ElementType.Institution>;
320
+ governing_title?: ElementId<ElementType.Title>;
321
+ zone?: ElementId<ElementType.Zone>;
322
+ rival?: ElementId<ElementType.Location>;
323
+ partner?: ElementId<ElementType.Location>;
414
324
  customs?: string;
415
325
  infrastructure?: string;
416
326
  architecture?: string;
417
327
  defensibility?: string;
418
328
  elevation?: string;
419
- /** Links to Collective */
420
- populations?: string[];
421
- /** Links to Institution */
422
- secondary_powers?: string[];
423
- /** Links to Character */
424
- founders?: string[];
425
- /** Links to Construct */
426
- cults?: string[];
427
- /** Links to Species */
428
- delicacies?: string[];
429
- /** Links to Construct */
430
- extraction_methods?: string[];
431
- /** Links to Construct */
432
- extraction_goods?: string[];
433
- /** Links to Construct */
434
- industry_methods?: string[];
435
- /** Links to Construct */
436
- industry_goods?: string[];
437
- /** Links to Location */
438
- extraction_markets?: string[];
439
- /** Links to Location */
440
- industry_markets?: string[];
441
- /** Links to Construct */
442
- currencies?: string[];
443
- /** Links to Object */
444
- buildings?: string[];
445
- /** Links to Construct */
446
- building_methods?: string[];
447
- /** Links to Construct */
448
- fighters?: string[];
449
- /** Links to Object */
450
- defensive_objects?: string[];
329
+ populations?: ElementIds<ElementType.Collective>;
330
+ secondary_powers?: ElementIds<ElementType.Institution>;
331
+ founders?: ElementIds<ElementType.Character>;
332
+ cults?: ElementIds<ElementType.Construct>;
333
+ delicacies?: ElementIds<ElementType.Species>;
334
+ extraction_methods?: ElementIds<ElementType.Construct>;
335
+ extraction_goods?: ElementIds<ElementType.Construct>;
336
+ industry_methods?: ElementIds<ElementType.Construct>;
337
+ industry_goods?: ElementIds<ElementType.Construct>;
338
+ extraction_markets?: ElementIds<ElementType.Location>;
339
+ industry_markets?: ElementIds<ElementType.Location>;
340
+ currencies?: ElementIds<ElementType.Construct>;
341
+ buildings?: ElementIds<ElementType.Object>;
342
+ building_methods?: ElementIds<ElementType.Construct>;
343
+ fighters?: ElementIds<ElementType.Construct>;
344
+ defensive_objects?: ElementIds<ElementType.Object>;
451
345
  }
452
346
  /**
453
347
  * Phenomenon element type
@@ -457,18 +351,12 @@ interface Phenomenon extends BaseElement {
457
351
  effects?: string;
458
352
  duration?: string;
459
353
  mythology?: string;
460
- /** Links to Phenomenon */
461
- system?: string;
462
- /** Links to Object */
463
- catalysts?: string[];
464
- /** Links to Ability */
465
- empowerments?: string[];
466
- /** Links to Construct */
467
- triggers?: string[];
468
- /** Links to Character */
469
- wielders?: string[];
470
- /** Links to Location */
471
- environments?: string[];
354
+ system?: ElementId<ElementType.Phenomenon>;
355
+ catalysts?: ElementIds<ElementType.Object>;
356
+ empowerments?: ElementIds<ElementType.Ability>;
357
+ triggers?: ElementIds<ElementType.Construct>;
358
+ wielders?: ElementIds<ElementType.Character>;
359
+ environments?: ElementIds<ElementType.Location>;
472
360
  }
473
361
  /**
474
362
  * Relation element type
@@ -478,42 +366,24 @@ interface Relation extends BaseElement {
478
366
  start_date?: string;
479
367
  end_date?: string;
480
368
  intensity?: string;
481
- /** Links to Character */
482
- actor?: string;
483
- /** Links to Character */
484
- characters?: string[];
485
- /** Links to Object */
486
- objects?: string[];
487
- /** Links to Location */
488
- locations?: string[];
489
- /** Links to Species */
490
- species?: string[];
491
- /** Links to Creature */
492
- creatures?: string[];
493
- /** Links to Institution */
494
- institutions?: string[];
495
- /** Links to Trait */
496
- traits?: string[];
497
- /** Links to Collective */
498
- collectives?: string[];
499
- /** Links to Zone */
500
- zones?: string[];
501
- /** Links to Ability */
502
- abilities?: string[];
503
- /** Links to Phenomenon */
504
- phenomena?: string[];
505
- /** Links to Language */
506
- languages?: string[];
507
- /** Links to Family */
508
- families?: string[];
509
- /** Links to Title */
510
- titles?: string[];
511
- /** Links to Construct */
512
- constructs?: string[];
513
- /** Links to Event */
514
- events?: string[];
515
- /** Links to Narrative */
516
- narratives?: string[];
369
+ actor?: ElementId<ElementType.Character>;
370
+ characters?: ElementIds<ElementType.Character>;
371
+ objects?: ElementIds<ElementType.Object>;
372
+ locations?: ElementIds<ElementType.Location>;
373
+ species?: ElementIds<ElementType.Species>;
374
+ creatures?: ElementIds<ElementType.Creature>;
375
+ institutions?: ElementIds<ElementType.Institution>;
376
+ traits?: ElementIds<ElementType.Trait>;
377
+ collectives?: ElementIds<ElementType.Collective>;
378
+ zones?: ElementIds<ElementType.Zone>;
379
+ abilities?: ElementIds<ElementType.Ability>;
380
+ phenomena?: ElementIds<ElementType.Phenomenon>;
381
+ languages?: ElementIds<ElementType.Language>;
382
+ families?: ElementIds<ElementType.Family>;
383
+ titles?: ElementIds<ElementType.Title>;
384
+ constructs?: ElementIds<ElementType.Construct>;
385
+ events?: ElementIds<ElementType.Event>;
386
+ narratives?: ElementIds<ElementType.Narrative>;
517
387
  }
518
388
  /**
519
389
  * Species element type
@@ -528,22 +398,14 @@ interface Species extends BaseElement {
528
398
  communication?: string;
529
399
  aggression?: string;
530
400
  role?: string;
531
- /** Links to Species */
532
- parent_species?: string;
533
- /** Links to Species */
534
- nourishment?: string[];
535
- /** Links to Construct */
536
- reproduction?: string[];
537
- /** Links to Ability */
538
- adaptations?: string[];
539
- /** Links to Trait */
540
- traits?: string[];
541
- /** Links to Location */
542
- locations?: string[];
543
- /** Links to Zone */
544
- zones?: string[];
545
- /** Links to Phenomenon */
546
- affinities?: string[];
401
+ parent_species?: ElementId<ElementType.Species>;
402
+ nourishment?: ElementIds<ElementType.Species>;
403
+ reproduction?: ElementIds<ElementType.Construct>;
404
+ adaptations?: ElementIds<ElementType.Ability>;
405
+ traits?: ElementIds<ElementType.Trait>;
406
+ locations?: ElementIds<ElementType.Location>;
407
+ zones?: ElementIds<ElementType.Zone>;
408
+ affinities?: ElementIds<ElementType.Phenomenon>;
547
409
  }
548
410
  /**
549
411
  * Zone element type
@@ -553,16 +415,11 @@ interface Zone extends BaseElement {
553
415
  start_date?: string;
554
416
  end_date?: string;
555
417
  context?: string;
556
- /** Links to Phenomenon */
557
- phenomena?: string[];
558
- /** Links to Zone */
559
- linked_zones?: string[];
560
- /** Links to Collective */
561
- populations?: string[];
562
- /** Links to Title */
563
- titles?: string[];
564
- /** Links to Construct */
565
- principles?: string[];
418
+ phenomena?: ElementIds<ElementType.Phenomenon>;
419
+ linked_zones?: ElementIds<ElementType.Zone>;
420
+ populations?: ElementIds<ElementType.Collective>;
421
+ titles?: ElementIds<ElementType.Title>;
422
+ principles?: ElementIds<ElementType.Construct>;
566
423
  }
567
424
  /**
568
425
  * Title element type
@@ -572,44 +429,26 @@ interface Title extends BaseElement {
572
429
  eligibility?: string;
573
430
  grant_date?: string;
574
431
  revoke_date?: string;
575
- /** Links to Institution */
576
- issuer?: string;
577
- /** Links to Institution */
578
- body?: string;
579
- /** Links to Title */
580
- superior_title?: string;
432
+ issuer?: ElementId<ElementType.Institution>;
433
+ body?: ElementId<ElementType.Institution>;
434
+ superior_title?: ElementId<ElementType.Title>;
581
435
  status?: string;
582
436
  history?: string;
583
- /** Links to Character */
584
- holders?: string[];
585
- /** Links to Object */
586
- symbols?: string[];
587
- /** Links to Character */
588
- characters?: string[];
589
- /** Links to Institution */
590
- institutions?: string[];
591
- /** Links to Family */
592
- families?: string[];
593
- /** Links to Zone */
594
- zones?: string[];
595
- /** Links to Location */
596
- locations?: string[];
597
- /** Links to Object */
598
- objects?: string[];
599
- /** Links to Construct */
600
- constructs?: string[];
601
- /** Links to Law */
602
- laws?: string[];
603
- /** Links to Collective */
604
- collectives?: string[];
605
- /** Links to Creature */
606
- creatures?: string[];
607
- /** Links to Phenomenon */
608
- phenomena?: string[];
609
- /** Links to Species */
610
- species?: string[];
611
- /** Links to Language */
612
- languages?: string[];
437
+ holders?: ElementIds<ElementType.Character>;
438
+ symbols?: ElementIds<ElementType.Object>;
439
+ characters?: ElementIds<ElementType.Character>;
440
+ institutions?: ElementIds<ElementType.Institution>;
441
+ families?: ElementIds<ElementType.Family>;
442
+ zones?: ElementIds<ElementType.Zone>;
443
+ locations?: ElementIds<ElementType.Location>;
444
+ objects?: ElementIds<ElementType.Object>;
445
+ constructs?: ElementIds<ElementType.Construct>;
446
+ laws?: ElementIds<ElementType.Law>;
447
+ collectives?: ElementIds<ElementType.Collective>;
448
+ creatures?: ElementIds<ElementType.Creature>;
449
+ phenomena?: ElementIds<ElementType.Phenomenon>;
450
+ species?: ElementIds<ElementType.Species>;
451
+ languages?: ElementIds<ElementType.Language>;
613
452
  }
614
453
  /**
615
454
  * Trait element type
@@ -627,10 +466,8 @@ interface Trait extends BaseElement {
627
466
  creativity?: string;
628
467
  courage?: string;
629
468
  significance?: string;
630
- /** Links to Trait */
631
- anti_trait?: string;
632
- /** Links to Ability */
633
- empowered_abilities?: string[];
469
+ anti_trait?: ElementId<ElementType.Trait>;
470
+ empowered_abilities?: ElementIds<ElementType.Ability>;
634
471
  }
635
472
  /**
636
473
  * Narrative element type
@@ -641,52 +478,29 @@ interface Narrative extends BaseElement {
641
478
  start_date?: string;
642
479
  end_date?: string;
643
480
  order?: string;
644
- /** Links to Narrative */
645
- parent_narrative?: string;
646
- /** Links to Character */
647
- protagonist?: string;
648
- /** Links to Character */
649
- antagonist?: string;
650
- /** Links to Character */
651
- narrator?: string;
652
- /** Links to Institution */
653
- conservator?: string;
654
- /** Links to Event */
655
- events?: string[];
656
- /** Links to Character */
657
- characters?: string[];
658
- /** Links to Object */
659
- objects?: string[];
660
- /** Links to Location */
661
- locations?: string[];
662
- /** Links to Species */
663
- species?: string[];
664
- /** Links to Creature */
665
- creatures?: string[];
666
- /** Links to Institution */
667
- institutions?: string[];
668
- /** Links to Trait */
669
- traits?: string[];
670
- /** Links to Collective */
671
- collectives?: string[];
672
- /** Links to Zone */
673
- zones?: string[];
674
- /** Links to Ability */
675
- abilities?: string[];
676
- /** Links to Phenomenon */
677
- phenomena?: string[];
678
- /** Links to Language */
679
- languages?: string[];
680
- /** Links to Family */
681
- families?: string[];
682
- /** Links to Relation */
683
- relations?: string[];
684
- /** Links to Title */
685
- titles?: string[];
686
- /** Links to Construct */
687
- constructs?: string[];
688
- /** Links to Law */
689
- laws?: string[];
481
+ parent_narrative?: ElementId<ElementType.Narrative>;
482
+ protagonist?: ElementId<ElementType.Character>;
483
+ antagonist?: ElementId<ElementType.Character>;
484
+ narrator?: ElementId<ElementType.Character>;
485
+ conservator?: ElementId<ElementType.Institution>;
486
+ events?: ElementIds<ElementType.Event>;
487
+ characters?: ElementIds<ElementType.Character>;
488
+ objects?: ElementIds<ElementType.Object>;
489
+ locations?: ElementIds<ElementType.Location>;
490
+ species?: ElementIds<ElementType.Species>;
491
+ creatures?: ElementIds<ElementType.Creature>;
492
+ institutions?: ElementIds<ElementType.Institution>;
493
+ traits?: ElementIds<ElementType.Trait>;
494
+ collectives?: ElementIds<ElementType.Collective>;
495
+ zones?: ElementIds<ElementType.Zone>;
496
+ abilities?: ElementIds<ElementType.Ability>;
497
+ phenomena?: ElementIds<ElementType.Phenomenon>;
498
+ languages?: ElementIds<ElementType.Language>;
499
+ families?: ElementIds<ElementType.Family>;
500
+ relations?: ElementIds<ElementType.Relation>;
501
+ titles?: ElementIds<ElementType.Title>;
502
+ constructs?: ElementIds<ElementType.Construct>;
503
+ laws?: ElementIds<ElementType.Law>;
690
504
  }
691
505
  /**
692
506
  * Map element type
@@ -697,19 +511,15 @@ interface Map extends BaseElement {
697
511
  width?: string;
698
512
  height?: string;
699
513
  depth?: string;
700
- /** Links to Map */
701
- parent_map?: string;
702
- /** Links to Location */
703
- location?: string;
514
+ parent_map?: ElementId<ElementType.Map>;
515
+ location?: ElementId<ElementType.Location>;
704
516
  }
705
517
  /**
706
518
  * Marker element type
707
519
  */
708
520
  interface Marker extends BaseElement {
709
- /** Links to Map */
710
- map?: string;
711
- /** Links to Zone */
712
- zone?: string;
521
+ map?: ElementId<ElementType.Map>;
522
+ zone?: ElementId<ElementType.Zone>;
713
523
  x?: string;
714
524
  y?: string;
715
525
  z?: string;
@@ -718,10 +528,9 @@ interface Marker extends BaseElement {
718
528
  * Pin element type
719
529
  */
720
530
  interface Pin extends BaseElement {
721
- /** Links to Map */
722
- map?: string;
723
- /** Links to ContentType */
724
- element_type?: string;
531
+ map?: ElementId<ElementType.Map>;
532
+ element_type?: ElementType;
533
+ element_id?: AnyElementId;
725
534
  x?: string;
726
535
  y?: string;
727
536
  z?: string;
@@ -984,9 +793,9 @@ interface MarkerInput extends Omit<Marker, 'map' | 'zone'> {
984
793
  map_id?: string;
985
794
  zone_id?: string;
986
795
  }
987
- interface PinInput extends Omit<Pin, 'map' | 'element_type'> {
796
+ interface PinInput extends Omit<Pin, 'map' | 'element_id'> {
988
797
  map_id?: string;
989
- element_type_id?: string;
798
+ element_id?: string;
990
799
  }
991
800
  /**
992
801
  * All available element types in OnlyWorlds
@@ -1015,6 +824,293 @@ declare enum ElementType {
1015
824
  Trait = "trait",
1016
825
  Zone = "zone"
1017
826
  }
827
+ /**
828
+ * Runtime metadata for field relationships - enables tooling and dynamic processing
829
+ * Maps element types to their field relationships for runtime introspection
830
+ */
831
+ declare const FIELD_MAPPINGS: {
832
+ readonly ability: {
833
+ readonly tradition: "construct";
834
+ readonly source: "phenomenon";
835
+ readonly locus: "location";
836
+ readonly effects: "phenomenon";
837
+ readonly talents: "trait";
838
+ readonly requisites: "construct";
839
+ readonly instruments: "object";
840
+ readonly systems: "construct";
841
+ };
842
+ readonly character: {
843
+ readonly birthplace: "location";
844
+ readonly location: "location";
845
+ readonly species: "species";
846
+ readonly traits: "trait";
847
+ readonly abilities: "ability";
848
+ readonly languages: "language";
849
+ readonly objects: "object";
850
+ readonly institutions: "institution";
851
+ readonly family: "family";
852
+ readonly friends: "character";
853
+ readonly rivals: "character";
854
+ };
855
+ readonly collective: {
856
+ readonly operator: "institution";
857
+ readonly equipment: "construct";
858
+ readonly abilities: "ability";
859
+ readonly symbolism: "construct";
860
+ readonly species: "species";
861
+ readonly characters: "character";
862
+ readonly creatures: "creature";
863
+ readonly phenomena: "phenomenon";
864
+ };
865
+ readonly construct: {
866
+ readonly founder: "character";
867
+ readonly custodian: "institution";
868
+ readonly characters: "character";
869
+ readonly objects: "object";
870
+ readonly locations: "location";
871
+ readonly species: "species";
872
+ readonly creatures: "creature";
873
+ readonly institutions: "institution";
874
+ readonly traits: "trait";
875
+ readonly collectives: "collective";
876
+ readonly zones: "zone";
877
+ readonly abilities: "ability";
878
+ readonly phenomena: "phenomenon";
879
+ readonly languages: "language";
880
+ readonly families: "family";
881
+ readonly relations: "relation";
882
+ readonly titles: "title";
883
+ readonly constructs: "construct";
884
+ readonly events: "event";
885
+ readonly narratives: "narrative";
886
+ };
887
+ readonly creature: {
888
+ readonly location: "location";
889
+ readonly zone: "zone";
890
+ readonly species: "species";
891
+ readonly traits: "trait";
892
+ readonly abilities: "ability";
893
+ readonly languages: "language";
894
+ readonly actions: "ability";
895
+ };
896
+ readonly event: {
897
+ readonly triggers: "event";
898
+ readonly characters: "character";
899
+ readonly objects: "object";
900
+ readonly locations: "location";
901
+ readonly species: "species";
902
+ readonly creatures: "creature";
903
+ readonly institutions: "institution";
904
+ readonly traits: "trait";
905
+ readonly collectives: "collective";
906
+ readonly zones: "zone";
907
+ readonly abilities: "ability";
908
+ readonly phenomena: "phenomenon";
909
+ readonly languages: "language";
910
+ readonly families: "family";
911
+ readonly relations: "relation";
912
+ readonly titles: "title";
913
+ readonly constructs: "construct";
914
+ };
915
+ readonly family: {
916
+ readonly traditions: "construct";
917
+ readonly traits: "trait";
918
+ readonly abilities: "ability";
919
+ readonly languages: "language";
920
+ readonly ancestors: "character";
921
+ readonly estates: "location";
922
+ readonly governs: "institution";
923
+ readonly heirlooms: "object";
924
+ readonly creatures: "creature";
925
+ };
926
+ readonly institution: {
927
+ readonly parent_institution: "institution";
928
+ readonly zones: "zone";
929
+ readonly objects: "object";
930
+ readonly creatures: "creature";
931
+ readonly allies: "institution";
932
+ readonly adversaries: "institution";
933
+ readonly constructs: "construct";
934
+ };
935
+ readonly language: {
936
+ readonly classification: "construct";
937
+ readonly spread: "location";
938
+ readonly dialects: "language";
939
+ };
940
+ readonly law: {
941
+ readonly parent_law: "law";
942
+ readonly author: "institution";
943
+ readonly penalties: "construct";
944
+ readonly locations: "location";
945
+ readonly zones: "zone";
946
+ readonly prohibitions: "construct";
947
+ readonly adjudicators: "title";
948
+ readonly enforcers: "title";
949
+ };
950
+ readonly location: {
951
+ readonly parent_location: "location";
952
+ readonly primary_power: "institution";
953
+ readonly governing_title: "title";
954
+ readonly zone: "zone";
955
+ readonly rival: "location";
956
+ readonly partner: "location";
957
+ readonly populations: "collective";
958
+ readonly secondary_powers: "institution";
959
+ readonly founders: "character";
960
+ readonly cults: "construct";
961
+ readonly delicacies: "species";
962
+ readonly extraction_methods: "construct";
963
+ readonly extraction_goods: "construct";
964
+ readonly industry_methods: "construct";
965
+ readonly industry_goods: "construct";
966
+ readonly extraction_markets: "location";
967
+ readonly industry_markets: "location";
968
+ readonly currencies: "construct";
969
+ readonly buildings: "object";
970
+ readonly building_methods: "construct";
971
+ readonly fighters: "construct";
972
+ readonly defensive_objects: "object";
973
+ };
974
+ readonly map: {
975
+ readonly parent_map: "map";
976
+ readonly location: "location";
977
+ };
978
+ readonly marker: {
979
+ readonly map: "map";
980
+ readonly zone: "zone";
981
+ };
982
+ readonly narrative: {
983
+ readonly parent_narrative: "narrative";
984
+ readonly protagonist: "character";
985
+ readonly antagonist: "character";
986
+ readonly narrator: "character";
987
+ readonly conservator: "institution";
988
+ readonly events: "event";
989
+ readonly characters: "character";
990
+ readonly objects: "object";
991
+ readonly locations: "location";
992
+ readonly species: "species";
993
+ readonly creatures: "creature";
994
+ readonly institutions: "institution";
995
+ readonly traits: "trait";
996
+ readonly collectives: "collective";
997
+ readonly zones: "zone";
998
+ readonly abilities: "ability";
999
+ readonly phenomena: "phenomenon";
1000
+ readonly languages: "language";
1001
+ readonly families: "family";
1002
+ readonly relations: "relation";
1003
+ readonly titles: "title";
1004
+ readonly constructs: "construct";
1005
+ readonly laws: "law";
1006
+ };
1007
+ readonly object: {
1008
+ readonly parent_object: "object";
1009
+ readonly location: "location";
1010
+ readonly language: "language";
1011
+ readonly materials: "construct";
1012
+ readonly technology: "construct";
1013
+ readonly effects: "phenomenon";
1014
+ readonly abilities: "ability";
1015
+ readonly consumes: "construct";
1016
+ readonly affinities: "trait";
1017
+ };
1018
+ readonly phenomenon: {
1019
+ readonly system: "phenomenon";
1020
+ readonly catalysts: "object";
1021
+ readonly empowerments: "ability";
1022
+ readonly triggers: "construct";
1023
+ readonly wielders: "character";
1024
+ readonly environments: "location";
1025
+ };
1026
+ readonly pin: {
1027
+ readonly map: "map";
1028
+ readonly element_id: "any_element";
1029
+ };
1030
+ readonly relation: {
1031
+ readonly actor: "character";
1032
+ readonly characters: "character";
1033
+ readonly objects: "object";
1034
+ readonly locations: "location";
1035
+ readonly species: "species";
1036
+ readonly creatures: "creature";
1037
+ readonly institutions: "institution";
1038
+ readonly traits: "trait";
1039
+ readonly collectives: "collective";
1040
+ readonly zones: "zone";
1041
+ readonly abilities: "ability";
1042
+ readonly phenomena: "phenomenon";
1043
+ readonly languages: "language";
1044
+ readonly families: "family";
1045
+ readonly titles: "title";
1046
+ readonly constructs: "construct";
1047
+ readonly events: "event";
1048
+ readonly narratives: "narrative";
1049
+ };
1050
+ readonly species: {
1051
+ readonly parent_species: "species";
1052
+ readonly nourishment: "species";
1053
+ readonly reproduction: "construct";
1054
+ readonly adaptations: "ability";
1055
+ readonly traits: "trait";
1056
+ readonly locations: "location";
1057
+ readonly zones: "zone";
1058
+ readonly affinities: "phenomenon";
1059
+ };
1060
+ readonly title: {
1061
+ readonly issuer: "institution";
1062
+ readonly body: "institution";
1063
+ readonly superior_title: "title";
1064
+ readonly holders: "character";
1065
+ readonly symbols: "object";
1066
+ readonly characters: "character";
1067
+ readonly institutions: "institution";
1068
+ readonly families: "family";
1069
+ readonly zones: "zone";
1070
+ readonly locations: "location";
1071
+ readonly objects: "object";
1072
+ readonly constructs: "construct";
1073
+ readonly laws: "law";
1074
+ readonly collectives: "collective";
1075
+ readonly creatures: "creature";
1076
+ readonly phenomena: "phenomenon";
1077
+ readonly species: "species";
1078
+ readonly languages: "language";
1079
+ };
1080
+ readonly trait: {
1081
+ readonly anti_trait: "trait";
1082
+ readonly empowered_abilities: "ability";
1083
+ };
1084
+ readonly zone: {
1085
+ readonly phenomena: "phenomenon";
1086
+ readonly linked_zones: "zone";
1087
+ readonly populations: "collective";
1088
+ readonly titles: "title";
1089
+ readonly principles: "construct";
1090
+ };
1091
+ };
1092
+ /**
1093
+ * Type for the field mappings - enables type-safe access to relationship metadata
1094
+ */
1095
+ type FieldMappingsType = typeof FIELD_MAPPINGS;
1096
+ /**
1097
+ * Creates a typed element ID from a string
1098
+ * @param id The string ID to brand
1099
+ * @returns Branded ElementId
1100
+ */
1101
+ declare function createElementId<T extends ElementType>(id: string): ElementId<T>;
1102
+ /**
1103
+ * Creates typed element IDs array from string array
1104
+ * @param ids The string IDs to brand
1105
+ * @returns Branded ElementIds array
1106
+ */
1107
+ declare function createElementIds<T extends ElementType>(ids: string[]): ElementIds<T>;
1108
+ /**
1109
+ * Creates an AnyElementId that can reference any element type
1110
+ * @param id The string ID to brand
1111
+ * @returns AnyElementId
1112
+ */
1113
+ declare function createAnyElementId(id: string): AnyElementId;
1018
1114
 
1019
1115
  interface OnlyWorldsConfig {
1020
1116
  apiKey: string;
@@ -1095,4 +1191,4 @@ declare class OnlyWorldsClient {
1095
1191
  static prepareInput<T extends Record<string, any>>(data: T): any;
1096
1192
  }
1097
1193
 
1098
- export { type Ability, type AbilityInput, type ApiResponse, type BaseElement, type Character, type CharacterInput, type Collective, type CollectiveInput, type Construct, type ConstructInput, type Creature, type CreatureInput, ElementType, type Event, type EventInput, type Family, type FamilyInput, type Institution, type InstitutionInput, type Language, type LanguageInput, type Law, type LawInput, type ListOptions, type Location, type LocationInput, type Map, type MapInput, type Marker, type MarkerInput, type Narrative, type NarrativeInput, type Object$1 as Object, type ObjectInput, OnlyWorldsClient, type OnlyWorldsConfig, type Phenomenon, type PhenomenonInput, type Pin, type PinInput, type Relation, type RelationInput, type Species, type SpeciesInput, type Title, type TitleInput, type Trait, type TraitInput, type World, type WorldInput, type Zone, type ZoneInput };
1194
+ export { type Ability, type AbilityInput, type AnyElementId, type ApiResponse, type BaseElement, type Character, type CharacterInput, type Collective, type CollectiveInput, type Construct, type ConstructInput, type Creature, type CreatureInput, type ElementId, type ElementIds, ElementType, type Event, type EventInput, FIELD_MAPPINGS, type Family, type FamilyInput, type FieldMappingsType, type Institution, type InstitutionInput, type Language, type LanguageInput, type Law, type LawInput, type ListOptions, type Location, type LocationInput, type Map, type MapInput, type Marker, type MarkerInput, type Narrative, type NarrativeInput, type Object$1 as Object, type ObjectInput, OnlyWorldsClient, type OnlyWorldsConfig, type Phenomenon, type PhenomenonInput, type Pin, type PinInput, type Relation, type RelationInput, type Species, type SpeciesInput, type Title, type TitleInput, type Trait, type TraitInput, type World, type WorldInput, type Zone, type ZoneInput, createAnyElementId, createElementId, createElementIds };