@onlyworlds/sdk 1.0.1 → 1.3.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.js CHANGED
@@ -21,7 +21,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  ElementType: () => ElementType,
24
- OnlyWorldsClient: () => OnlyWorldsClient
24
+ FIELD_MAPPINGS: () => FIELD_MAPPINGS,
25
+ FIELD_SCHEMA: () => FIELD_SCHEMA,
26
+ OnlyWorldsClient: () => OnlyWorldsClient,
27
+ createAnyElementId: () => createAnyElementId,
28
+ createElementId: () => createElementId,
29
+ createElementIds: () => createElementIds
25
30
  });
26
31
  module.exports = __toCommonJS(index_exports);
27
32
 
@@ -171,8 +176,478 @@ var ElementType = /* @__PURE__ */ ((ElementType2) => {
171
176
  ElementType2["Zone"] = "zone";
172
177
  return ElementType2;
173
178
  })(ElementType || {});
179
+ var FIELD_SCHEMA = {
180
+ ability: {
181
+ // Text fields
182
+ activation: { type: "text" },
183
+ duration: { type: "text" },
184
+ potency: { type: "text" },
185
+ range: { type: "text" },
186
+ challenges: { type: "text" },
187
+ prevalence: { type: "text" },
188
+ // Link fields
189
+ tradition: { type: "single_link", target: "construct" },
190
+ source: { type: "single_link", target: "phenomenon" },
191
+ locus: { type: "single_link", target: "location" },
192
+ effects: { type: "multi_link", target: "phenomenon" },
193
+ talents: { type: "multi_link", target: "trait" },
194
+ requisites: { type: "multi_link", target: "construct" },
195
+ instruments: { type: "multi_link", target: "object" },
196
+ systems: { type: "multi_link", target: "construct" }
197
+ },
198
+ character: {
199
+ // Text fields
200
+ physicality: { type: "text" },
201
+ mentality: { type: "text" },
202
+ height: { type: "text" },
203
+ weight: { type: "text" },
204
+ background: { type: "text" },
205
+ motivations: { type: "text" },
206
+ birth_date: { type: "text" },
207
+ reputation: { type: "text" },
208
+ charisma: { type: "text" },
209
+ coercion: { type: "text" },
210
+ competence: { type: "text" },
211
+ compassion: { type: "text" },
212
+ creativity: { type: "text" },
213
+ courage: { type: "text" },
214
+ level: { type: "text" },
215
+ hit_points: { type: "text" },
216
+ STR: { type: "text" },
217
+ DEX: { type: "text" },
218
+ CON: { type: "text" },
219
+ INT: { type: "text" },
220
+ WIS: { type: "text" },
221
+ CHA: { type: "text" },
222
+ // Link fields
223
+ birthplace: { type: "single_link", target: "location" },
224
+ location: { type: "single_link", target: "location" },
225
+ species: { type: "multi_link", target: "species" },
226
+ traits: { type: "multi_link", target: "trait" },
227
+ abilities: { type: "multi_link", target: "ability" },
228
+ languages: { type: "multi_link", target: "language" },
229
+ objects: { type: "multi_link", target: "object" },
230
+ institutions: { type: "multi_link", target: "institution" },
231
+ family: { type: "multi_link", target: "family" },
232
+ friends: { type: "multi_link", target: "character" },
233
+ rivals: { type: "multi_link", target: "character" }
234
+ },
235
+ collective: {
236
+ // Text fields
237
+ composition: { type: "text" },
238
+ count: { type: "text" },
239
+ formation_date: { type: "text" },
240
+ activity: { type: "text" },
241
+ disposition: { type: "text" },
242
+ state: { type: "text" },
243
+ // Link fields
244
+ operator: { type: "single_link", target: "institution" },
245
+ equipment: { type: "multi_link", target: "construct" },
246
+ abilities: { type: "multi_link", target: "ability" },
247
+ symbolism: { type: "multi_link", target: "construct" },
248
+ species: { type: "multi_link", target: "species" },
249
+ characters: { type: "multi_link", target: "character" },
250
+ creatures: { type: "multi_link", target: "creature" },
251
+ phenomena: { type: "multi_link", target: "phenomenon" }
252
+ },
253
+ construct: {
254
+ // Text fields
255
+ rationale: { type: "text" },
256
+ history: { type: "text" },
257
+ status: { type: "text" },
258
+ reach: { type: "text" },
259
+ start_date: { type: "text" },
260
+ end_date: { type: "text" },
261
+ // Link fields
262
+ founder: { type: "single_link", target: "character" },
263
+ custodian: { type: "single_link", target: "institution" },
264
+ characters: { type: "multi_link", target: "character" },
265
+ objects: { type: "multi_link", target: "object" },
266
+ locations: { type: "multi_link", target: "location" },
267
+ species: { type: "multi_link", target: "species" },
268
+ creatures: { type: "multi_link", target: "creature" },
269
+ institutions: { type: "multi_link", target: "institution" },
270
+ traits: { type: "multi_link", target: "trait" },
271
+ collectives: { type: "multi_link", target: "collective" },
272
+ zones: { type: "multi_link", target: "zone" },
273
+ abilities: { type: "multi_link", target: "ability" },
274
+ phenomena: { type: "multi_link", target: "phenomenon" },
275
+ languages: { type: "multi_link", target: "language" },
276
+ families: { type: "multi_link", target: "family" },
277
+ relations: { type: "multi_link", target: "relation" },
278
+ titles: { type: "multi_link", target: "title" },
279
+ constructs: { type: "multi_link", target: "construct" },
280
+ events: { type: "multi_link", target: "event" },
281
+ narratives: { type: "multi_link", target: "narrative" }
282
+ },
283
+ creature: {
284
+ // Text fields
285
+ appearance: { type: "text" },
286
+ weight: { type: "text" },
287
+ height: { type: "text" },
288
+ habits: { type: "text" },
289
+ demeanor: { type: "text" },
290
+ status: { type: "text" },
291
+ birth_date: { type: "text" },
292
+ challenge_rating: { type: "text" },
293
+ hit_points: { type: "text" },
294
+ armor_class: { type: "text" },
295
+ speed: { type: "text" },
296
+ // Link fields
297
+ location: { type: "single_link", target: "location" },
298
+ zone: { type: "single_link", target: "zone" },
299
+ species: { type: "multi_link", target: "species" },
300
+ traits: { type: "multi_link", target: "trait" },
301
+ abilities: { type: "multi_link", target: "ability" },
302
+ languages: { type: "multi_link", target: "language" },
303
+ actions: { type: "multi_link", target: "ability" }
304
+ },
305
+ event: {
306
+ // Text fields
307
+ history: { type: "text" },
308
+ challenges: { type: "text" },
309
+ consequences: { type: "text" },
310
+ start_date: { type: "text" },
311
+ end_date: { type: "text" },
312
+ // Link fields
313
+ triggers: { type: "multi_link", target: "event" },
314
+ characters: { type: "multi_link", target: "character" },
315
+ objects: { type: "multi_link", target: "object" },
316
+ locations: { type: "multi_link", target: "location" },
317
+ species: { type: "multi_link", target: "species" },
318
+ creatures: { type: "multi_link", target: "creature" },
319
+ institutions: { type: "multi_link", target: "institution" },
320
+ traits: { type: "multi_link", target: "trait" },
321
+ collectives: { type: "multi_link", target: "collective" },
322
+ zones: { type: "multi_link", target: "zone" },
323
+ abilities: { type: "multi_link", target: "ability" },
324
+ phenomena: { type: "multi_link", target: "phenomenon" },
325
+ languages: { type: "multi_link", target: "language" },
326
+ families: { type: "multi_link", target: "family" },
327
+ relations: { type: "multi_link", target: "relation" },
328
+ titles: { type: "multi_link", target: "title" },
329
+ constructs: { type: "multi_link", target: "construct" }
330
+ },
331
+ family: {
332
+ // Text fields
333
+ spirit: { type: "text" },
334
+ history: { type: "text" },
335
+ reputation: { type: "text" },
336
+ // Link fields
337
+ traditions: { type: "multi_link", target: "construct" },
338
+ traits: { type: "multi_link", target: "trait" },
339
+ abilities: { type: "multi_link", target: "ability" },
340
+ languages: { type: "multi_link", target: "language" },
341
+ ancestors: { type: "multi_link", target: "character" },
342
+ estates: { type: "multi_link", target: "location" },
343
+ governs: { type: "multi_link", target: "institution" },
344
+ heirlooms: { type: "multi_link", target: "object" },
345
+ creatures: { type: "multi_link", target: "creature" }
346
+ },
347
+ institution: {
348
+ // Text fields
349
+ doctrine: { type: "text" },
350
+ founding_date: { type: "text" },
351
+ status: { type: "text" },
352
+ // Link fields
353
+ parent_institution: { type: "single_link", target: "institution" },
354
+ zones: { type: "multi_link", target: "zone" },
355
+ objects: { type: "multi_link", target: "object" },
356
+ creatures: { type: "multi_link", target: "creature" },
357
+ allies: { type: "multi_link", target: "institution" },
358
+ adversaries: { type: "multi_link", target: "institution" },
359
+ constructs: { type: "multi_link", target: "construct" }
360
+ },
361
+ language: {
362
+ // Text fields
363
+ phonology: { type: "text" },
364
+ grammar: { type: "text" },
365
+ lexicon: { type: "text" },
366
+ writing: { type: "text" },
367
+ status: { type: "text" },
368
+ // Link fields
369
+ classification: { type: "single_link", target: "construct" },
370
+ spread: { type: "multi_link", target: "location" },
371
+ dialects: { type: "multi_link", target: "language" }
372
+ },
373
+ law: {
374
+ // Text fields
375
+ declaration: { type: "text" },
376
+ purpose: { type: "text" },
377
+ date: { type: "text" },
378
+ // Link fields
379
+ parent_law: { type: "single_link", target: "law" },
380
+ author: { type: "single_link", target: "institution" },
381
+ penalties: { type: "multi_link", target: "construct" },
382
+ locations: { type: "multi_link", target: "location" },
383
+ zones: { type: "multi_link", target: "zone" },
384
+ prohibitions: { type: "multi_link", target: "construct" },
385
+ adjudicators: { type: "multi_link", target: "title" },
386
+ enforcers: { type: "multi_link", target: "title" }
387
+ },
388
+ location: {
389
+ // Text fields
390
+ form: { type: "text" },
391
+ function: { type: "text" },
392
+ founding_date: { type: "text" },
393
+ political_climate: { type: "text" },
394
+ customs: { type: "text" },
395
+ infrastructure: { type: "text" },
396
+ architecture: { type: "text" },
397
+ defensibility: { type: "text" },
398
+ elevation: { type: "text" },
399
+ // Link fields
400
+ parent_location: { type: "single_link", target: "location" },
401
+ primary_power: { type: "single_link", target: "institution" },
402
+ governing_title: { type: "single_link", target: "title" },
403
+ zone: { type: "single_link", target: "zone" },
404
+ rival: { type: "single_link", target: "location" },
405
+ partner: { type: "single_link", target: "location" },
406
+ populations: { type: "multi_link", target: "collective" },
407
+ secondary_powers: { type: "multi_link", target: "institution" },
408
+ founders: { type: "multi_link", target: "character" },
409
+ cults: { type: "multi_link", target: "construct" },
410
+ delicacies: { type: "multi_link", target: "species" },
411
+ extraction_methods: { type: "multi_link", target: "construct" },
412
+ extraction_goods: { type: "multi_link", target: "construct" },
413
+ industry_methods: { type: "multi_link", target: "construct" },
414
+ industry_goods: { type: "multi_link", target: "construct" },
415
+ extraction_markets: { type: "multi_link", target: "location" },
416
+ industry_markets: { type: "multi_link", target: "location" },
417
+ currencies: { type: "multi_link", target: "construct" },
418
+ buildings: { type: "multi_link", target: "object" },
419
+ building_methods: { type: "multi_link", target: "construct" },
420
+ fighters: { type: "multi_link", target: "construct" },
421
+ defensive_objects: { type: "multi_link", target: "object" }
422
+ },
423
+ map: {
424
+ // Text fields
425
+ background_color: { type: "text" },
426
+ hierarchy: { type: "text" },
427
+ width: { type: "text" },
428
+ height: { type: "text" },
429
+ depth: { type: "text" },
430
+ // Link fields
431
+ parent_map: { type: "single_link", target: "map" },
432
+ location: { type: "single_link", target: "location" }
433
+ },
434
+ marker: {
435
+ // Integer fields
436
+ x: { type: "integer" },
437
+ y: { type: "integer" },
438
+ z: { type: "integer" },
439
+ // Link fields
440
+ map: { type: "single_link", target: "map" },
441
+ zone: { type: "single_link", target: "zone" }
442
+ },
443
+ narrative: {
444
+ // Text fields
445
+ story: { type: "text" },
446
+ consequences: { type: "text" },
447
+ start_date: { type: "text" },
448
+ end_date: { type: "text" },
449
+ order: { type: "text" },
450
+ // Link fields
451
+ parent_narrative: { type: "single_link", target: "narrative" },
452
+ protagonist: { type: "single_link", target: "character" },
453
+ antagonist: { type: "single_link", target: "character" },
454
+ narrator: { type: "single_link", target: "character" },
455
+ conservator: { type: "single_link", target: "institution" },
456
+ events: { type: "multi_link", target: "event" },
457
+ characters: { type: "multi_link", target: "character" },
458
+ objects: { type: "multi_link", target: "object" },
459
+ locations: { type: "multi_link", target: "location" },
460
+ species: { type: "multi_link", target: "species" },
461
+ creatures: { type: "multi_link", target: "creature" },
462
+ institutions: { type: "multi_link", target: "institution" },
463
+ traits: { type: "multi_link", target: "trait" },
464
+ collectives: { type: "multi_link", target: "collective" },
465
+ zones: { type: "multi_link", target: "zone" },
466
+ abilities: { type: "multi_link", target: "ability" },
467
+ phenomena: { type: "multi_link", target: "phenomenon" },
468
+ languages: { type: "multi_link", target: "language" },
469
+ families: { type: "multi_link", target: "family" },
470
+ relations: { type: "multi_link", target: "relation" },
471
+ titles: { type: "multi_link", target: "title" },
472
+ constructs: { type: "multi_link", target: "construct" },
473
+ laws: { type: "multi_link", target: "law" }
474
+ },
475
+ object: {
476
+ // Text fields
477
+ aesthetics: { type: "text" },
478
+ weight: { type: "text" },
479
+ amount: { type: "text" },
480
+ utility: { type: "text" },
481
+ origins: { type: "text" },
482
+ // Link fields
483
+ parent_object: { type: "single_link", target: "object" },
484
+ location: { type: "single_link", target: "location" },
485
+ language: { type: "single_link", target: "language" },
486
+ materials: { type: "multi_link", target: "construct" },
487
+ technology: { type: "multi_link", target: "construct" },
488
+ effects: { type: "multi_link", target: "phenomenon" },
489
+ abilities: { type: "multi_link", target: "ability" },
490
+ consumes: { type: "multi_link", target: "construct" },
491
+ affinities: { type: "multi_link", target: "trait" }
492
+ },
493
+ phenomenon: {
494
+ // Text fields
495
+ expression: { type: "text" },
496
+ effects: { type: "text" },
497
+ duration: { type: "text" },
498
+ mythology: { type: "text" },
499
+ // Link fields
500
+ system: { type: "single_link", target: "phenomenon" },
501
+ catalysts: { type: "multi_link", target: "object" },
502
+ empowerments: { type: "multi_link", target: "ability" },
503
+ triggers: { type: "multi_link", target: "construct" },
504
+ wielders: { type: "multi_link", target: "character" },
505
+ environments: { type: "multi_link", target: "location" }
506
+ },
507
+ pin: {
508
+ // Special fields
509
+ element_type: { type: "text" },
510
+ // ElementType enum value
511
+ // Integer fields
512
+ x: { type: "integer" },
513
+ y: { type: "integer" },
514
+ z: { type: "integer" },
515
+ // Link fields
516
+ map: { type: "single_link", target: "map" },
517
+ element_id: { type: "single_link", target: "any" }
518
+ // Can reference any element
519
+ },
520
+ relation: {
521
+ // Text fields
522
+ background: { type: "text" },
523
+ start_date: { type: "text" },
524
+ end_date: { type: "text" },
525
+ intensity: { type: "text" },
526
+ // Link fields
527
+ actor: { type: "single_link", target: "character" },
528
+ characters: { type: "multi_link", target: "character" },
529
+ objects: { type: "multi_link", target: "object" },
530
+ locations: { type: "multi_link", target: "location" },
531
+ species: { type: "multi_link", target: "species" },
532
+ creatures: { type: "multi_link", target: "creature" },
533
+ institutions: { type: "multi_link", target: "institution" },
534
+ traits: { type: "multi_link", target: "trait" },
535
+ collectives: { type: "multi_link", target: "collective" },
536
+ zones: { type: "multi_link", target: "zone" },
537
+ abilities: { type: "multi_link", target: "ability" },
538
+ phenomena: { type: "multi_link", target: "phenomenon" },
539
+ languages: { type: "multi_link", target: "language" },
540
+ families: { type: "multi_link", target: "family" },
541
+ titles: { type: "multi_link", target: "title" },
542
+ constructs: { type: "multi_link", target: "construct" },
543
+ events: { type: "multi_link", target: "event" },
544
+ narratives: { type: "multi_link", target: "narrative" }
545
+ },
546
+ species: {
547
+ // Text fields
548
+ appearance: { type: "text" },
549
+ life_span: { type: "text" },
550
+ weight: { type: "text" },
551
+ instincts: { type: "text" },
552
+ sociality: { type: "text" },
553
+ temperament: { type: "text" },
554
+ communication: { type: "text" },
555
+ aggression: { type: "text" },
556
+ role: { type: "text" },
557
+ // Link fields
558
+ parent_species: { type: "single_link", target: "species" },
559
+ nourishment: { type: "multi_link", target: "species" },
560
+ reproduction: { type: "multi_link", target: "construct" },
561
+ adaptations: { type: "multi_link", target: "ability" },
562
+ traits: { type: "multi_link", target: "trait" },
563
+ locations: { type: "multi_link", target: "location" },
564
+ zones: { type: "multi_link", target: "zone" },
565
+ affinities: { type: "multi_link", target: "phenomenon" }
566
+ },
567
+ title: {
568
+ // Text fields
569
+ authority: { type: "text" },
570
+ eligibility: { type: "text" },
571
+ grant_date: { type: "text" },
572
+ revoke_date: { type: "text" },
573
+ status: { type: "text" },
574
+ history: { type: "text" },
575
+ // Link fields
576
+ issuer: { type: "single_link", target: "institution" },
577
+ body: { type: "single_link", target: "institution" },
578
+ superior_title: { type: "single_link", target: "title" },
579
+ holders: { type: "multi_link", target: "character" },
580
+ symbols: { type: "multi_link", target: "object" },
581
+ characters: { type: "multi_link", target: "character" },
582
+ institutions: { type: "multi_link", target: "institution" },
583
+ families: { type: "multi_link", target: "family" },
584
+ zones: { type: "multi_link", target: "zone" },
585
+ locations: { type: "multi_link", target: "location" },
586
+ objects: { type: "multi_link", target: "object" },
587
+ constructs: { type: "multi_link", target: "construct" },
588
+ laws: { type: "multi_link", target: "law" },
589
+ collectives: { type: "multi_link", target: "collective" },
590
+ creatures: { type: "multi_link", target: "creature" },
591
+ phenomena: { type: "multi_link", target: "phenomenon" },
592
+ species: { type: "multi_link", target: "species" },
593
+ languages: { type: "multi_link", target: "language" }
594
+ },
595
+ trait: {
596
+ // Text fields
597
+ social_effects: { type: "text" },
598
+ physical_effects: { type: "text" },
599
+ functional_effects: { type: "text" },
600
+ personality_effects: { type: "text" },
601
+ behaviour_effects: { type: "text" },
602
+ charisma: { type: "text" },
603
+ coercion: { type: "text" },
604
+ competence: { type: "text" },
605
+ compassion: { type: "text" },
606
+ creativity: { type: "text" },
607
+ courage: { type: "text" },
608
+ significance: { type: "text" },
609
+ // Link fields
610
+ anti_trait: { type: "single_link", target: "trait" },
611
+ empowered_abilities: { type: "multi_link", target: "ability" }
612
+ },
613
+ zone: {
614
+ // Text fields
615
+ role: { type: "text" },
616
+ start_date: { type: "text" },
617
+ end_date: { type: "text" },
618
+ context: { type: "text" },
619
+ // Link fields
620
+ phenomena: { type: "multi_link", target: "phenomenon" },
621
+ linked_zones: { type: "multi_link", target: "zone" },
622
+ populations: { type: "multi_link", target: "collective" },
623
+ titles: { type: "multi_link", target: "title" },
624
+ principles: { type: "multi_link", target: "construct" }
625
+ }
626
+ };
627
+ var FIELD_MAPPINGS = Object.fromEntries(
628
+ Object.entries(FIELD_SCHEMA).map(([elementType, fields]) => [
629
+ elementType,
630
+ Object.fromEntries(
631
+ Object.entries(fields).filter(([_, fieldInfo]) => ["single_link", "multi_link"].includes(fieldInfo.type)).map(([fieldName, fieldInfo]) => [fieldName, fieldInfo.target])
632
+ )
633
+ ])
634
+ );
635
+ function createElementId(id) {
636
+ return id;
637
+ }
638
+ function createElementIds(ids) {
639
+ return ids;
640
+ }
641
+ function createAnyElementId(id) {
642
+ return id;
643
+ }
174
644
  // Annotate the CommonJS export names for ESM import in node:
175
645
  0 && (module.exports = {
176
646
  ElementType,
177
- OnlyWorldsClient
647
+ FIELD_MAPPINGS,
648
+ FIELD_SCHEMA,
649
+ OnlyWorldsClient,
650
+ createAnyElementId,
651
+ createElementId,
652
+ createElementIds
178
653
  });