@onlyworlds/sdk 2.1.3 → 2.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 +233 -216
- package/dist/index.d.ts +233 -216
- package/dist/index.js +362 -316
- package/dist/index.mjs +362 -316
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -573,265 +573,266 @@ interface Pin extends BaseElement {
|
|
|
573
573
|
z?: number;
|
|
574
574
|
}
|
|
575
575
|
/**
|
|
576
|
-
* Input types for API requests
|
|
576
|
+
* Input types for API requests
|
|
577
|
+
* Use field names without _id/_ids suffix - prepareRelations() handles conversion
|
|
577
578
|
*/
|
|
578
579
|
interface AbilityInput extends Omit<Ability, 'tradition' | 'source' | 'locus' | 'effects' | 'talents' | 'requisites' | 'instruments' | 'systems'> {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
580
|
+
tradition?: string;
|
|
581
|
+
source?: string;
|
|
582
|
+
locus?: string;
|
|
583
|
+
effects?: string[];
|
|
584
|
+
talents?: string[];
|
|
585
|
+
requisites?: string[];
|
|
586
|
+
instruments?: string[];
|
|
587
|
+
systems?: string[];
|
|
587
588
|
}
|
|
588
589
|
interface ObjectInput extends Omit<Object$1, 'parent_object' | 'location' | 'language' | 'materials' | 'technology' | 'effects' | 'abilities' | 'consumes' | 'affinities'> {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
590
|
+
parent_object?: string;
|
|
591
|
+
location?: string;
|
|
592
|
+
language?: string;
|
|
593
|
+
materials?: string[];
|
|
594
|
+
technology?: string[];
|
|
595
|
+
effects?: string[];
|
|
596
|
+
abilities?: string[];
|
|
597
|
+
consumes?: string[];
|
|
598
|
+
affinities?: string[];
|
|
598
599
|
}
|
|
599
600
|
interface CharacterInput extends Omit<Character, 'birthplace' | 'location' | 'species' | 'traits' | 'abilities' | 'languages' | 'objects' | 'institutions' | 'family' | 'friends' | 'rivals'> {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
601
|
+
birthplace?: string;
|
|
602
|
+
location?: string;
|
|
603
|
+
species?: string[];
|
|
604
|
+
traits?: string[];
|
|
605
|
+
abilities?: string[];
|
|
606
|
+
languages?: string[];
|
|
607
|
+
objects?: string[];
|
|
608
|
+
institutions?: string[];
|
|
609
|
+
family?: string[];
|
|
610
|
+
friends?: string[];
|
|
611
|
+
rivals?: string[];
|
|
611
612
|
}
|
|
612
613
|
interface CollectiveInput extends Omit<Collective, 'operator' | 'equipment' | 'abilities' | 'symbolism' | 'species' | 'characters' | 'creatures' | 'phenomena'> {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
614
|
+
operator?: string;
|
|
615
|
+
equipment?: string[];
|
|
616
|
+
abilities?: string[];
|
|
617
|
+
symbolism?: string[];
|
|
618
|
+
species?: string[];
|
|
619
|
+
characters?: string[];
|
|
620
|
+
creatures?: string[];
|
|
621
|
+
phenomena?: string[];
|
|
621
622
|
}
|
|
622
623
|
interface ConstructInput extends Omit<Construct, 'founder' | 'custodian' | 'characters' | 'objects' | 'locations' | 'species' | 'creatures' | 'institutions' | 'traits' | 'collectives' | 'zones' | 'abilities' | 'phenomena' | 'languages' | 'families' | 'relations' | 'titles' | 'constructs' | 'events' | 'narratives'> {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
624
|
+
founder?: string;
|
|
625
|
+
custodian?: string;
|
|
626
|
+
characters?: string[];
|
|
627
|
+
objects?: string[];
|
|
628
|
+
locations?: string[];
|
|
629
|
+
species?: string[];
|
|
630
|
+
creatures?: string[];
|
|
631
|
+
institutions?: string[];
|
|
632
|
+
traits?: string[];
|
|
633
|
+
collectives?: string[];
|
|
634
|
+
zones?: string[];
|
|
635
|
+
abilities?: string[];
|
|
636
|
+
phenomena?: string[];
|
|
637
|
+
languages?: string[];
|
|
638
|
+
families?: string[];
|
|
639
|
+
relations?: string[];
|
|
640
|
+
titles?: string[];
|
|
641
|
+
constructs?: string[];
|
|
642
|
+
events?: string[];
|
|
643
|
+
narratives?: string[];
|
|
643
644
|
}
|
|
644
645
|
interface CreatureInput extends Omit<Creature, 'location' | 'zone' | 'species' | 'traits' | 'abilities' | 'languages' | 'actions'> {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
646
|
+
location?: string;
|
|
647
|
+
zone?: string;
|
|
648
|
+
species?: string[];
|
|
649
|
+
traits?: string[];
|
|
650
|
+
abilities?: string[];
|
|
651
|
+
languages?: string[];
|
|
652
|
+
actions?: string[];
|
|
652
653
|
}
|
|
653
654
|
interface EventInput extends Omit<Event, 'triggers' | 'characters' | 'objects' | 'locations' | 'species' | 'creatures' | 'institutions' | 'traits' | 'collectives' | 'zones' | 'abilities' | 'phenomena' | 'languages' | 'families' | 'relations' | 'titles' | 'constructs'> {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
655
|
+
triggers?: string[];
|
|
656
|
+
characters?: string[];
|
|
657
|
+
objects?: string[];
|
|
658
|
+
locations?: string[];
|
|
659
|
+
species?: string[];
|
|
660
|
+
creatures?: string[];
|
|
661
|
+
institutions?: string[];
|
|
662
|
+
traits?: string[];
|
|
663
|
+
collectives?: string[];
|
|
664
|
+
zones?: string[];
|
|
665
|
+
abilities?: string[];
|
|
666
|
+
phenomena?: string[];
|
|
667
|
+
languages?: string[];
|
|
668
|
+
families?: string[];
|
|
669
|
+
relations?: string[];
|
|
670
|
+
titles?: string[];
|
|
671
|
+
constructs?: string[];
|
|
671
672
|
}
|
|
672
673
|
interface FamilyInput extends Omit<Family, 'traditions' | 'traits' | 'abilities' | 'languages' | 'ancestors' | 'estates' | 'governs' | 'heirlooms' | 'creatures'> {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
674
|
+
traditions?: string[];
|
|
675
|
+
traits?: string[];
|
|
676
|
+
abilities?: string[];
|
|
677
|
+
languages?: string[];
|
|
678
|
+
ancestors?: string[];
|
|
679
|
+
estates?: string[];
|
|
680
|
+
governs?: string[];
|
|
681
|
+
heirlooms?: string[];
|
|
682
|
+
creatures?: string[];
|
|
682
683
|
}
|
|
683
684
|
interface InstitutionInput extends Omit<Institution, 'parent_institution' | 'zones' | 'objects' | 'creatures' | 'allies' | 'adversaries' | 'constructs'> {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
685
|
+
parent_institution?: string;
|
|
686
|
+
zones?: string[];
|
|
687
|
+
objects?: string[];
|
|
688
|
+
creatures?: string[];
|
|
689
|
+
allies?: string[];
|
|
690
|
+
adversaries?: string[];
|
|
691
|
+
constructs?: string[];
|
|
691
692
|
}
|
|
692
693
|
interface LanguageInput extends Omit<Language, 'classification' | 'spread' | 'dialects'> {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
694
|
+
classification?: string;
|
|
695
|
+
spread?: string[];
|
|
696
|
+
dialects?: string[];
|
|
696
697
|
}
|
|
697
698
|
interface LawInput extends Omit<Law, 'parent_law' | 'author' | 'penalties' | 'locations' | 'zones' | 'prohibitions' | 'adjudicators' | 'enforcers'> {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
699
|
+
parent_law?: string;
|
|
700
|
+
author?: string;
|
|
701
|
+
penalties?: string[];
|
|
702
|
+
locations?: string[];
|
|
703
|
+
zones?: string[];
|
|
704
|
+
prohibitions?: string[];
|
|
705
|
+
adjudicators?: string[];
|
|
706
|
+
enforcers?: string[];
|
|
706
707
|
}
|
|
707
708
|
interface LocationInput extends Omit<Location, 'parent_location' | 'primary_power' | 'governing_title' | 'zone' | 'rival' | 'partner' | 'populations' | 'secondary_powers' | 'founders' | 'cults' | 'delicacies' | 'extraction_methods' | 'extraction_goods' | 'industry_methods' | 'industry_goods' | 'extraction_markets' | 'industry_markets' | 'currencies' | 'buildings' | 'building_methods' | 'fighters' | 'defensive_objects'> {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
709
|
+
parent_location?: string;
|
|
710
|
+
primary_power?: string;
|
|
711
|
+
governing_title?: string;
|
|
712
|
+
zone?: string;
|
|
713
|
+
rival?: string;
|
|
714
|
+
partner?: string;
|
|
715
|
+
populations?: string[];
|
|
716
|
+
secondary_powers?: string[];
|
|
717
|
+
founders?: string[];
|
|
718
|
+
cults?: string[];
|
|
719
|
+
delicacies?: string[];
|
|
720
|
+
extraction_methods?: string[];
|
|
721
|
+
extraction_goods?: string[];
|
|
722
|
+
industry_methods?: string[];
|
|
723
|
+
industry_goods?: string[];
|
|
724
|
+
extraction_markets?: string[];
|
|
725
|
+
industry_markets?: string[];
|
|
726
|
+
currencies?: string[];
|
|
727
|
+
buildings?: string[];
|
|
728
|
+
building_methods?: string[];
|
|
729
|
+
fighters?: string[];
|
|
730
|
+
defensive_objects?: string[];
|
|
730
731
|
}
|
|
731
732
|
interface PhenomenonInput extends Omit<Phenomenon, 'system' | 'catalysts' | 'empowerments' | 'triggers' | 'wielders' | 'environments'> {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
733
|
+
system?: string;
|
|
734
|
+
catalysts?: string[];
|
|
735
|
+
empowerments?: string[];
|
|
736
|
+
triggers?: string[];
|
|
737
|
+
wielders?: string[];
|
|
738
|
+
environments?: string[];
|
|
738
739
|
}
|
|
739
740
|
interface RelationInput extends Omit<Relation, 'actor' | 'characters' | 'objects' | 'locations' | 'species' | 'creatures' | 'institutions' | 'traits' | 'collectives' | 'zones' | 'abilities' | 'phenomena' | 'languages' | 'families' | 'titles' | 'constructs' | 'events' | 'narratives'> {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
741
|
+
actor?: string;
|
|
742
|
+
characters?: string[];
|
|
743
|
+
objects?: string[];
|
|
744
|
+
locations?: string[];
|
|
745
|
+
species?: string[];
|
|
746
|
+
creatures?: string[];
|
|
747
|
+
institutions?: string[];
|
|
748
|
+
traits?: string[];
|
|
749
|
+
collectives?: string[];
|
|
750
|
+
zones?: string[];
|
|
751
|
+
abilities?: string[];
|
|
752
|
+
phenomena?: string[];
|
|
753
|
+
languages?: string[];
|
|
754
|
+
families?: string[];
|
|
755
|
+
titles?: string[];
|
|
756
|
+
constructs?: string[];
|
|
757
|
+
events?: string[];
|
|
758
|
+
narratives?: string[];
|
|
758
759
|
}
|
|
759
760
|
interface SpeciesInput extends Omit<Species, 'parent_species' | 'nourishment' | 'reproduction' | 'adaptations' | 'traits' | 'locations' | 'zones' | 'affinities'> {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
761
|
+
parent_species?: string;
|
|
762
|
+
nourishment?: string[];
|
|
763
|
+
reproduction?: string[];
|
|
764
|
+
adaptations?: string[];
|
|
765
|
+
traits?: string[];
|
|
766
|
+
locations?: string[];
|
|
767
|
+
zones?: string[];
|
|
768
|
+
affinities?: string[];
|
|
768
769
|
}
|
|
769
770
|
interface ZoneInput extends Omit<Zone, 'phenomena' | 'linked_zones' | 'populations' | 'titles' | 'principles'> {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
771
|
+
phenomena?: string[];
|
|
772
|
+
linked_zones?: string[];
|
|
773
|
+
populations?: string[];
|
|
774
|
+
titles?: string[];
|
|
775
|
+
principles?: string[];
|
|
775
776
|
}
|
|
776
777
|
interface TitleInput extends Omit<Title, 'issuer' | 'body' | 'superior_title' | 'holders' | 'symbols' | 'characters' | 'institutions' | 'families' | 'zones' | 'locations' | 'objects' | 'constructs' | 'laws' | 'collectives' | 'creatures' | 'phenomena' | 'species' | 'languages'> {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
778
|
+
issuer?: string;
|
|
779
|
+
body?: string;
|
|
780
|
+
superior_title?: string;
|
|
781
|
+
holders?: string[];
|
|
782
|
+
symbols?: string[];
|
|
783
|
+
characters?: string[];
|
|
784
|
+
institutions?: string[];
|
|
785
|
+
families?: string[];
|
|
786
|
+
zones?: string[];
|
|
787
|
+
locations?: string[];
|
|
788
|
+
objects?: string[];
|
|
789
|
+
constructs?: string[];
|
|
790
|
+
laws?: string[];
|
|
791
|
+
collectives?: string[];
|
|
792
|
+
creatures?: string[];
|
|
793
|
+
phenomena?: string[];
|
|
794
|
+
species?: string[];
|
|
795
|
+
languages?: string[];
|
|
795
796
|
}
|
|
796
797
|
interface TraitInput extends Omit<Trait, 'anti_trait' | 'empowered_abilities'> {
|
|
797
|
-
|
|
798
|
-
|
|
798
|
+
anti_trait?: string;
|
|
799
|
+
empowered_abilities?: string[];
|
|
799
800
|
}
|
|
800
801
|
interface NarrativeInput extends Omit<Narrative, 'parent_narrative' | 'protagonist' | 'antagonist' | 'narrator' | 'conservator' | 'events' | 'characters' | 'objects' | 'locations' | 'species' | 'creatures' | 'institutions' | 'traits' | 'collectives' | 'zones' | 'abilities' | 'phenomena' | 'languages' | 'families' | 'relations' | 'titles' | 'constructs' | 'laws'> {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
802
|
+
parent_narrative?: string;
|
|
803
|
+
protagonist?: string;
|
|
804
|
+
antagonist?: string;
|
|
805
|
+
narrator?: string;
|
|
806
|
+
conservator?: string;
|
|
807
|
+
events?: string[];
|
|
808
|
+
characters?: string[];
|
|
809
|
+
objects?: string[];
|
|
810
|
+
locations?: string[];
|
|
811
|
+
species?: string[];
|
|
812
|
+
creatures?: string[];
|
|
813
|
+
institutions?: string[];
|
|
814
|
+
traits?: string[];
|
|
815
|
+
collectives?: string[];
|
|
816
|
+
zones?: string[];
|
|
817
|
+
abilities?: string[];
|
|
818
|
+
phenomena?: string[];
|
|
819
|
+
languages?: string[];
|
|
820
|
+
families?: string[];
|
|
821
|
+
relations?: string[];
|
|
822
|
+
titles?: string[];
|
|
823
|
+
constructs?: string[];
|
|
824
|
+
laws?: string[];
|
|
824
825
|
}
|
|
825
826
|
interface MapInput extends Omit<Map, 'parent_map' | 'location'> {
|
|
826
|
-
|
|
827
|
-
|
|
827
|
+
parent_map?: string;
|
|
828
|
+
location?: string;
|
|
828
829
|
}
|
|
829
830
|
interface MarkerInput extends Omit<Marker, 'map' | 'zone'> {
|
|
830
|
-
|
|
831
|
-
|
|
831
|
+
map?: string;
|
|
832
|
+
zone?: string;
|
|
832
833
|
}
|
|
833
834
|
interface PinInput extends Omit<Pin, 'map' | 'element_id'> {
|
|
834
|
-
|
|
835
|
+
map?: string;
|
|
835
836
|
element_id?: string;
|
|
836
837
|
}
|
|
837
838
|
/**
|
|
@@ -3088,9 +3089,25 @@ declare class OnlyWorldsClient {
|
|
|
3088
3089
|
body?: any;
|
|
3089
3090
|
}): Promise<T>;
|
|
3090
3091
|
/**
|
|
3091
|
-
* Helper to convert nested objects to _id/_ids format
|
|
3092
|
+
* Helper to convert nested objects to _id/_ids format (legacy method)
|
|
3093
|
+
* @deprecated Use prepareRelations instead - it's called automatically in create/update
|
|
3092
3094
|
*/
|
|
3093
3095
|
static prepareInput<T extends Record<string, any>>(data: T): any;
|
|
3096
|
+
/**
|
|
3097
|
+
* Convert relation fields to API format (_id/_ids suffix)
|
|
3098
|
+
*
|
|
3099
|
+
* The OnlyWorlds API expects:
|
|
3100
|
+
* - single_link fields: fieldname_id (e.g., birthplace_id)
|
|
3101
|
+
* - multi_link fields: fieldname_ids (e.g., species_ids)
|
|
3102
|
+
*
|
|
3103
|
+
* This method auto-converts based on FIELD_SCHEMA:
|
|
3104
|
+
* - { species: ["id1", "id2"] } → { species_ids: ["id1", "id2"] }
|
|
3105
|
+
* - { birthplace: "location-id" } → { birthplace_id: "location-id" }
|
|
3106
|
+
* - { species: [{id: "id1", name: "X"}] } → { species_ids: ["id1"] }
|
|
3107
|
+
*
|
|
3108
|
+
* Called automatically by create() and update() methods.
|
|
3109
|
+
*/
|
|
3110
|
+
static prepareRelations<T extends Record<string, any>>(data: T, elementType: string): any;
|
|
3094
3111
|
}
|
|
3095
3112
|
|
|
3096
3113
|
export { type Ability, type AbilityInput, type AccessKeyResponse, type AnyElementId, type ApiResponse, type BaseElement, type Character, type CharacterInput, type Collective, type CollectiveInput, type Construct, type ConstructInput, type Creature, type CreatureInput, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_UNICODE_ICONS, type ElementId, type ElementIds, ElementType, type EncryptionInfo, type Event, type EventInput, FIELD_SCHEMA, type Family, type FamilyInput, type FieldInfo, type FieldType, GameTier, 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, ONLYWORLDS_VERSION, type Object$1 as Object, type ObjectInput, OnlyWorldsClient, type OnlyWorldsConfig, type Phenomenon, type PhenomenonInput, type Pin, type PinInput, type Relation, type RelationInput, type RevokeAllSessionsResponse, type RevokeSessionResponse, type SectionInfo, type Species, type SpeciesInput, type Title, type TitleInput, type TokenConsumeParams, type TokenConsumeResponse, type TokenStatus, type Trait, type TraitInput, type World, type WorldInput, type Zone, type ZoneInput, createAnyElementId, createElementId, createElementIds, getElementIcon, getElementLabel, getElementSections, getElementUnicodeIcon };
|