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