typedbrainz 0.1.3 → 0.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.
Files changed (2) hide show
  1. package/lib/global.d.ts +203 -47
  2. package/package.json +1 -1
package/lib/global.d.ts CHANGED
@@ -6,6 +6,7 @@ export type $ReadOnlyArray<T> = readonly T[];
6
6
  export type $ReadOnly<T> = Readonly<T>;
7
7
  export type $ReadOnlyMap<K, V> = ReadonlyMap<K, V>;
8
8
  export type $Exact<T> = T;
9
+ export type $Values<T> = T[keyof T];
9
10
  export type $_$Spread<T1, T2> = T2 & Omit<T1, keyof T2>;
10
11
  export type AliasT<T> = $ReadOnly<$_$Spread<DatePeriodRoleT, $_$Spread<EntityRoleT<"alias">, $_$Spread<PendingEditsRoleT, $_$Spread<TypeRoleT<T>, {
11
12
  locale: string | null;
@@ -89,6 +90,14 @@ export type ArtistCreditT = {
89
90
  id?: number;
90
91
  names: $ReadOnlyArray<ArtistCreditNameT>;
91
92
  };
93
+ export type IncompleteArtistCreditNameT = {
94
+ artist: ArtistT | null;
95
+ joinPhrase: string;
96
+ name: string;
97
+ };
98
+ export type IncompleteArtistCreditT = {
99
+ names: $ReadOnlyArray<IncompleteArtistCreditNameT>;
100
+ };
92
101
  export type ArtworkRoleT = $ReadOnly<$_$Spread<PendingEditsRoleT, {
93
102
  comment: string;
94
103
  event?: EventT;
@@ -587,6 +596,7 @@ export type AddPlaceEditT = $ReadOnly<$_$Spread<GenericEditT, {
587
596
  }>>;
588
597
  export type AddRelationshipEditT = $ReadOnly<$_$Spread<GenericEditT, {
589
598
  display_data: {
599
+ entered_from?: NonUrlRelatableEntityT;
590
600
  relationship: RelationshipT;
591
601
  unknown_attributes: boolean;
592
602
  };
@@ -618,7 +628,7 @@ export type AddRelationshipTypeEditT = $ReadOnly<$_$Spread<GenericEditT, {
618
628
  link_phrase: string;
619
629
  long_link_phrase: string;
620
630
  name: string;
621
- orderable_direction?: number;
631
+ orderable_direction?: OrderableDirectionT;
622
632
  relationship_type?: LinkTypeT;
623
633
  reverse_link_phrase: string;
624
634
  };
@@ -1019,6 +1029,7 @@ export type EditRecordingEditCurrentT = $ReadOnly<$_$Spread<EditRecordingEditGen
1019
1029
  export type EditRecordingEditT = EditRecordingEditHistoricLengthT | EditRecordingEditHistoricNameT | EditRecordingEditCurrentT;
1020
1030
  export type EditRelationshipEditT = $ReadOnly<$_$Spread<GenericEditT, {
1021
1031
  display_data: {
1032
+ entered_from?: NonUrlRelatableEntityT;
1022
1033
  new: RelationshipT;
1023
1034
  old: RelationshipT;
1024
1035
  unknown_attributes: boolean;
@@ -1060,7 +1071,7 @@ export type EditRelationshipTypeEditT = $ReadOnly<$_$Spread<GenericEditT, {
1060
1071
  link_phrase?: CompT<string>;
1061
1072
  long_link_phrase?: CompT<string>;
1062
1073
  name: CompT<string>;
1063
- orderable_direction?: CompT<number>;
1074
+ orderable_direction?: CompT<OrderableDirectionT>;
1064
1075
  parent?: CompT<LinkTypeT | null>;
1065
1076
  relationship_type: LinkTypeT;
1066
1077
  reverse_link_phrase: CompT<string>;
@@ -1198,8 +1209,8 @@ export type MergePlacesEditT = $ReadOnly<$_$Spread<GenericEditT, {
1198
1209
  export type MergeRecordingsEditT = $ReadOnly<$_$Spread<GenericEditT, {
1199
1210
  display_data: {
1200
1211
  large_spread: boolean;
1201
- new: RecordingWithArtistCreditT;
1202
- old: $ReadOnlyArray<RecordingWithArtistCreditT>;
1212
+ new: RecordingT;
1213
+ old: $ReadOnlyArray<RecordingT>;
1203
1214
  };
1204
1215
  edit_type: EDIT_RECORDING_MERGE_T;
1205
1216
  }>>;
@@ -1428,6 +1439,7 @@ export type RemoveRelationshipEditT = $ReadOnly<$_$Spread<GenericEditT, {
1428
1439
  };
1429
1440
  };
1430
1441
  display_data: {
1442
+ entered_from?: NonUrlRelatableEntityT;
1431
1443
  relationship: RelationshipT;
1432
1444
  };
1433
1445
  edit_type: EDIT_RELATIONSHIP_DELETE_T;
@@ -1491,6 +1503,7 @@ export type ReorderMediumsEditT = $ReadOnly<$_$Spread<GenericEditT, {
1491
1503
  }>>;
1492
1504
  export type ReorderRelationshipsEditT = $ReadOnly<$_$Spread<GenericEditT, {
1493
1505
  display_data: {
1506
+ entered_from?: NonUrlRelatableEntityT;
1494
1507
  relationships: $ReadOnlyArray<{
1495
1508
  new_order: number;
1496
1509
  old_order: number;
@@ -1907,7 +1920,7 @@ export type PartialDateFieldT = CompoundFieldT<{
1907
1920
  export type GenreT = $ReadOnly<$_$Spread<AnnotationRoleT, $_$Spread<CommentRoleT, $_$Spread<RelatableEntityRoleT<"genre">, {
1908
1921
  primaryAlias?: string | null;
1909
1922
  }>>>>;
1910
- export type N_l_T = "WIP convertTypeNode: FunctionTypeAnnotation";
1923
+ export type N_l_T = () => string;
1911
1924
  export type InstrumentT = $ReadOnly<$_$Spread<AnnotationRoleT, $_$Spread<CommentRoleT, $_$Spread<RelatableEntityRoleT<"instrument">, $_$Spread<TypeRoleT<InstrumentTypeT>, {
1912
1925
  description: string;
1913
1926
  primaryAlias?: string | null;
@@ -2016,7 +2029,7 @@ export type RecordingT = $ReadOnly<$_$Spread<AnnotationRoleT, $_$Spread<CommentR
2016
2029
  name: string;
2017
2030
  }>;
2018
2031
  artist?: string;
2019
- artistCredit?: ArtistCreditT;
2032
+ artistCredit: ArtistCreditT;
2020
2033
  first_release_date?: PartialDateT;
2021
2034
  isrcs: $ReadOnlyArray<IsrcT>;
2022
2035
  length: number;
@@ -2024,9 +2037,6 @@ export type RecordingT = $ReadOnly<$_$Spread<AnnotationRoleT, $_$Spread<CommentR
2024
2037
  related_works: $ReadOnlyArray<number>;
2025
2038
  video: boolean;
2026
2039
  }>>>>>>;
2027
- export type RecordingWithArtistCreditT = $ReadOnly<$_$Spread<RecordingT, {
2028
- artistCredit: ArtistCreditT;
2029
- }>>;
2030
2040
  export type LinkAttrT = {
2031
2041
  credited_as?: string;
2032
2042
  text_value?: string;
@@ -2075,12 +2085,13 @@ export type LinkTypeT = $_$Spread<OptionTreeT<"link_type">, {
2075
2085
  l_reverse_link_phrase?: string;
2076
2086
  link_phrase: string;
2077
2087
  long_link_phrase: string;
2078
- orderable_direction: number;
2088
+ orderable_direction: OrderableDirectionT;
2079
2089
  reverse_link_phrase: string;
2080
2090
  root_id: number | null;
2081
2091
  type0: RelatableEntityTypeT;
2082
2092
  type1: RelatableEntityTypeT;
2083
2093
  }>;
2094
+ export type OrderableDirectionT = 0 | 1 | 2;
2084
2095
  export type RelationshipT = $ReadOnly<$_$Spread<DatePeriodRoleT, $_$Spread<PendingEditsRoleT, {
2085
2096
  attributes: $ReadOnlyArray<LinkAttrT>;
2086
2097
  backward: boolean;
@@ -2265,6 +2276,7 @@ export type WsJsRelationshipCommonT = {
2265
2276
  begin_date?: PartialDateT;
2266
2277
  end_date?: PartialDateT;
2267
2278
  ended?: boolean;
2279
+ enteredFrom?: WsJsRelationshipEntityT;
2268
2280
  entities: [
2269
2281
  WsJsRelationshipEntityT,
2270
2282
  WsJsRelationshipEntityT
@@ -2284,12 +2296,14 @@ export type WsJsEditRelationshipEditT = $ReadOnly<$_$Spread<Partial<WsJsRelation
2284
2296
  }>>;
2285
2297
  export type WsJsEditRelationshipDeleteT = $ReadOnly<{
2286
2298
  edit_type: EDIT_RELATIONSHIP_DELETE_T;
2299
+ enteredFrom?: WsJsRelationshipEntityT;
2287
2300
  id: number;
2288
2301
  linkTypeID: number;
2289
2302
  }>;
2290
2303
  export type WsJsEditRelationshipT = WsJsEditRelationshipCreateT | WsJsEditRelationshipEditT | WsJsEditRelationshipDeleteT | WsJsEditRelationshipsReorderT;
2291
2304
  export type WsJsEditRelationshipsReorderT = {
2292
2305
  edit_type: EDIT_RELATIONSHIPS_REORDER_T;
2306
+ enteredFrom?: WsJsRelationshipEntityT;
2293
2307
  linkTypeID: number;
2294
2308
  relationship_order: $ReadOnlyArray<{
2295
2309
  link_order: number;
@@ -2346,7 +2360,7 @@ export type WsJsEditResponseT = {
2346
2360
  };
2347
2361
  export type SearchableTypeT = EntityItemT["entityType"];
2348
2362
  export type StateT<T extends EntityItemT> = {
2349
- canChangeType?: "WIP convertTypeNode: FunctionTypeAnnotation";
2363
+ canChangeType?: (_arg0: string) => boolean;
2350
2364
  containerClass?: string;
2351
2365
  disabled?: boolean;
2352
2366
  entityType: T["entityType"];
@@ -2355,7 +2369,7 @@ export type StateT<T extends EntityItemT> = {
2355
2369
  htmlName?: string;
2356
2370
  id: string;
2357
2371
  indexedSearch: boolean;
2358
- inputChangeHook?: "WIP convertTypeNode: FunctionTypeAnnotation";
2372
+ inputChangeHook?: (inputValue: string, state: StateT<T>, selectItem: (_arg0: OptionItemT<T>) => boolean) => boolean;
2359
2373
  inputClass?: string;
2360
2374
  inputRef?: {
2361
2375
  current: HTMLInputElement | null;
@@ -2444,7 +2458,7 @@ export type ActionItemT<T extends EntityItemT> = {
2444
2458
  type: "action";
2445
2459
  action: ActionT<T>;
2446
2460
  id: number | string;
2447
- name: string | "WIP convertTypeNode: FunctionTypeAnnotation";
2461
+ name: string | (() => string);
2448
2462
  level?: number;
2449
2463
  separator?: boolean;
2450
2464
  disabled?: boolean;
@@ -2452,7 +2466,7 @@ export type ActionItemT<T extends EntityItemT> = {
2452
2466
  export type OptionItemT<T> = {
2453
2467
  type: "option";
2454
2468
  id: number | string;
2455
- name: string | "WIP convertTypeNode: FunctionTypeAnnotation";
2469
+ name: string | (() => string);
2456
2470
  entity: T;
2457
2471
  level?: number;
2458
2472
  separator?: boolean;
@@ -2461,7 +2475,7 @@ export type OptionItemT<T> = {
2461
2475
  export type HeaderItemT = {
2462
2476
  type: "header";
2463
2477
  id: number | string;
2464
- name: string | "WIP convertTypeNode: FunctionTypeAnnotation";
2478
+ name: string | (() => string);
2465
2479
  disabled: true;
2466
2480
  separator?: boolean;
2467
2481
  };
@@ -2484,9 +2498,11 @@ export type LazyReleaseStateT = {
2484
2498
  expandedMediums: $ReadOnlyMap<number, boolean>;
2485
2499
  loadedTracks: LoadedTracksMapT;
2486
2500
  };
2487
- export type RelationshipEditStatusT = number & {
2488
- __OpaqueType__RelationshipEditStatusT: never;
2489
- };
2501
+ export type REL_STATUS_NOOP_T = 0;
2502
+ export type REL_STATUS_ADD_T = 1;
2503
+ export type REL_STATUS_EDIT_T = 2;
2504
+ export type REL_STATUS_REMOVE_T = 3;
2505
+ export type RelationshipEditStatusT = REL_STATUS_NOOP_T | REL_STATUS_ADD_T | REL_STATUS_EDIT_T | REL_STATUS_REMOVE_T;
2490
2506
  export type CreditChangeOptionT = "" | "all" | "same-entity-types" | "same-relationship-type";
2491
2507
  export type RelationshipStateForTypesT<T0 extends RelatableEntityT, T1 extends RelatableEntityT> = {
2492
2508
  _lineage: $ReadOnlyArray<string>;
@@ -2507,25 +2523,25 @@ export type RelationshipStateForTypesT<T0 extends RelatableEntityT, T1 extends R
2507
2523
  };
2508
2524
  export type RelationshipStateT = RelationshipStateForTypesT<RelatableEntityT, RelatableEntityT>;
2509
2525
  export type RelationshipPhraseGroupT = {
2510
- relationships: tree.ImmutableTree<RelationshipStateT> | null;
2526
+ relationships: tree.ImmutableTree<RelationshipStateT>;
2511
2527
  textPhrase: string;
2512
2528
  };
2513
2529
  export type RelationshipLinkTypeGroupT = {
2514
2530
  backward: boolean;
2515
- phraseGroups: tree.ImmutableTree<RelationshipPhraseGroupT> | null;
2531
+ phraseGroups: tree.ImmutableTree<RelationshipPhraseGroupT>;
2516
2532
  typeId: number;
2517
2533
  };
2518
- export type RelationshipLinkTypeGroupsT = tree.ImmutableTree<RelationshipLinkTypeGroupT> | null;
2534
+ export type RelationshipLinkTypeGroupsT = tree.ImmutableTree<RelationshipLinkTypeGroupT>;
2519
2535
  export type RelationshipTargetTypeGroupT = [
2520
2536
  RelatableEntityTypeT,
2521
2537
  RelationshipLinkTypeGroupsT
2522
2538
  ];
2523
- export type RelationshipTargetTypeGroupsT = tree.ImmutableTree<RelationshipTargetTypeGroupT> | null;
2539
+ export type RelationshipTargetTypeGroupsT = tree.ImmutableTree<RelationshipTargetTypeGroupT>;
2524
2540
  export type RelationshipSourceGroupT = [
2525
2541
  RelatableEntityT,
2526
2542
  RelationshipTargetTypeGroupsT
2527
2543
  ];
2528
- export type RelationshipSourceGroupsT = tree.ImmutableTree<RelationshipSourceGroupT> | null;
2544
+ export type RelationshipSourceGroupsT = tree.ImmutableTree<RelationshipSourceGroupT>;
2529
2545
  export type NonReleaseRelatableEntityT = AreaT | ArtistT | EventT | GenreT | InstrumentT | LabelT | PlaceT | RecordingT | ReleaseGroupT | SeriesT | UrlT | WorkT;
2530
2546
  export type RelationshipDialogLocationT = {
2531
2547
  backward?: boolean | null | undefined;
@@ -2579,7 +2595,7 @@ export type DialogAttributeT = DialogBooleanAttributeStateT | DialogMultiselectA
2579
2595
  export type DialogAttributesT = $ReadOnlyArray<DialogAttributeT>;
2580
2596
  export type DialogAttributesStateT = {
2581
2597
  attributesList: DialogAttributesT;
2582
- resultingLinkAttributes: tree.ImmutableTree<LinkAttrT> | null;
2598
+ resultingLinkAttributes: tree.ImmutableTree<LinkAttrT>;
2583
2599
  };
2584
2600
  export type DialogLinkAttributeStateT = {
2585
2601
  creditedAs?: string;
@@ -2636,18 +2652,18 @@ export type MediumWorkStateT = {
2636
2652
  targetTypeGroups: RelationshipTargetTypeGroupsT;
2637
2653
  work: WorkT;
2638
2654
  };
2639
- export type MediumWorkStateTreeT = tree.ImmutableTree<MediumWorkStateT> | null;
2655
+ export type MediumWorkStateTreeT = tree.ImmutableTree<MediumWorkStateT>;
2640
2656
  export type MediumRecordingStateT = {
2641
2657
  isSelected: boolean;
2642
2658
  recording: RecordingT;
2643
2659
  relatedWorks: MediumWorkStateTreeT;
2644
2660
  targetTypeGroups: RelationshipTargetTypeGroupsT;
2645
2661
  };
2646
- export type MediumRecordingStateTreeT = tree.ImmutableTree<MediumRecordingStateT> | null;
2662
+ export type MediumRecordingStateTreeT = tree.ImmutableTree<MediumRecordingStateT>;
2647
2663
  export type MediumStateTreeT = tree.ImmutableTree<[
2648
2664
  MediumWithRecordingsT,
2649
2665
  MediumRecordingStateTreeT
2650
- ]> | null;
2666
+ ]>;
2651
2667
  export type ReleaseRelationshipEditorStateT = $ReadOnly<$_$Spread<$Exact<LazyReleaseStateT>, $_$Spread<$Exact<RelationshipEditorStateT>, {
2652
2668
  editNoteField: FieldT<string>;
2653
2669
  enterEditForm: FormT<{
@@ -2656,8 +2672,8 @@ export type ReleaseRelationshipEditorStateT = $ReadOnly<$_$Spread<$Exact<LazyRel
2656
2672
  entity: ReleaseWithMediumsAndReleaseGroupT;
2657
2673
  mediums: MediumStateTreeT;
2658
2674
  mediumsByRecordingId: RecordingMediumsT;
2659
- selectedRecordings: tree.ImmutableTree<RecordingT> | null;
2660
- selectedWorks: tree.ImmutableTree<WorkT> | null;
2675
+ selectedRecordings: tree.ImmutableTree<RecordingT>;
2676
+ selectedWorks: tree.ImmutableTree<WorkT>;
2661
2677
  submissionError: string | null | undefined;
2662
2678
  submissionInProgress: boolean;
2663
2679
  }>>>;
@@ -2795,7 +2811,7 @@ export type RelationshipEditorActionT = {
2795
2811
  type: "update-dialog-location";
2796
2812
  } | {
2797
2813
  changes: {
2798
- [property: string]: "WIP convertTypeNode: MixedTypeAnnotation";
2814
+ [property: string]: unknown;
2799
2815
  };
2800
2816
  entityType: RelatableEntityTypeT;
2801
2817
  type: "update-entity";
@@ -2814,7 +2830,7 @@ export type DialogTargetEntityActionT = UpdateTargetEntityAutocompleteActionT |
2814
2830
  type: "update-url-text";
2815
2831
  };
2816
2832
  export type AcceptBatchCreateWorksDialogActionT = {
2817
- attributes: tree.ImmutableTree<LinkAttrT> | null;
2833
+ attributes: tree.ImmutableTree<LinkAttrT>;
2818
2834
  begin_date: PartialDateT | null;
2819
2835
  end_date: PartialDateT | null;
2820
2836
  ended: boolean;
@@ -2853,11 +2869,11 @@ export type ReleaseRelationshipEditorActionT = LazyReleaseActionT | Relationship
2853
2869
  work: WorkT;
2854
2870
  } | {
2855
2871
  isSelected: boolean;
2856
- recordingStates: MediumRecordingStateTreeT | null;
2872
+ recordingStates: MediumRecordingStateTreeT;
2857
2873
  type: "toggle-select-medium-recordings";
2858
2874
  } | {
2859
2875
  isSelected: boolean;
2860
- recordingStates: MediumRecordingStateTreeT | null;
2876
+ recordingStates: MediumRecordingStateTreeT;
2861
2877
  type: "toggle-select-medium-works";
2862
2878
  } | {
2863
2879
  editNote: string;
@@ -2917,7 +2933,7 @@ declare const PART_OF_SERIES_LINK_TYPES: {
2917
2933
  };
2918
2934
  declare const PART_OF_SERIES_LINK_TYPE_GIDS: $ReadOnlyArray<string>;
2919
2935
  declare const PART_OF_SERIES_LINK_TYPE_IDS: $ReadOnlyArray<number>;
2920
- declare const PROBABLY_CLASSICAL_LINK_TYPES = "WIP convertExpression: ArrayExpression";
2936
+ declare const PROBABLY_CLASSICAL_LINK_TYPES: number[];
2921
2937
  declare const RECORDING_OF_LINK_TYPE_ID: number;
2922
2938
  declare const RECORDING_OF_LINK_TYPE_GID: string;
2923
2939
  declare const RT_MIRROR = 2;
@@ -2929,6 +2945,20 @@ declare const MBID_REGEXP: RegExp;
2929
2945
  declare const VARTIST_GID = "89ad4ac3-39f7-470e-963a-56509c546377";
2930
2946
  declare const VARTIST_ID = 1;
2931
2947
  declare const VARTIST_NAME = "Various Artists";
2948
+ declare const ANON_ARTIST_GID = "f731ccc4-e22a-43af-a747-64213329e088";
2949
+ declare const ANON_ARTIST_ID = 15071;
2950
+ declare const DATA_ARTIST_GID = "33cf029c-63b0-41a0-9855-be2a3665fb3b";
2951
+ declare const DATA_ARTIST_ID = 41744;
2952
+ declare const DIALOGUE_ARTIST_GID = "314e1c25-dde7-4e4d-b2f4-0a7b9f7c56dc";
2953
+ declare const DIALOGUE_ARTIST_ID = 92121;
2954
+ declare const NO_ARTIST_GID = "eec63d3c-3b81-4ad4-b1e4-7c147d4d2b61";
2955
+ declare const NO_ARTIST_ID = 105725;
2956
+ declare const TRAD_ARTIST_GID = "9be7f096-97ec-4615-8957-8d40b5dcbc41";
2957
+ declare const TRAD_ARTIST_ID = 762646;
2958
+ declare const UNKNOWN_ARTIST_GID = "125ec42a-7229-4250-afc5-e057484327fe";
2959
+ declare const UNKNOWN_ARTIST_ID = 97546;
2960
+ declare const SPECIAL_ARTIST_GIDS: $ReadOnlyArray<string>;
2961
+ declare const SPECIAL_ARTIST_IDS: $ReadOnlyArray<number>;
2932
2962
  declare const NOLABEL_GID = "157afde4-4bf5-4039-8ad2-5a15acc85176";
2933
2963
  declare const NOLABEL_ID = 3267;
2934
2964
  declare const VIDEO_ATTRIBUTE_ID = 582;
@@ -2937,9 +2967,9 @@ declare const MAX_LENGTH_DIFFERENCE = 10500;
2937
2967
  declare const MAX_RECENT_ENTITIES = 10;
2938
2968
  declare const MIN_NAME_SIMILARITY = 0.75;
2939
2969
  declare const ENTITIES_WITH_RELATIONSHIP_CREDITS = "WIP convertExpression: ObjectExpression";
2940
- declare const QUALITY_NAMES: Map<QualityT, "WIP convertTypeNode: FunctionTypeAnnotation">;
2970
+ declare const QUALITY_NAMES: Map<QualityT, () => string>;
2941
2971
  declare const FLUENCY_NAMES: {
2942
- [fluency: string]: "WIP convertTypeNode: FunctionTypeAnnotation";
2972
+ [fluency: string]: () => string;
2943
2973
  };
2944
2974
  declare const LANGUAGE_ENG_ID = 120;
2945
2975
  declare const LANGUAGE_MUL_ID = 284;
@@ -2948,7 +2978,7 @@ declare const COUNTRY_JA_AREA_ID = 107;
2948
2978
  declare const DISPLAY_NONE_STYLE = "WIP convertExpression: CallExpression";
2949
2979
  declare const WS_EDIT_RESPONSE_OK: WS_EDIT_RESPONSE_OK_T;
2950
2980
  declare const WS_EDIT_RESPONSE_NO_CHANGES: WS_EDIT_RESPONSE_NO_CHANGES_T;
2951
- declare const BRACKET_PAIRS = "WIP convertExpression: ArrayExpression";
2981
+ declare const BRACKET_PAIRS: string[][];
2952
2982
  export type LinkedEntitiesT = {
2953
2983
  area: {
2954
2984
  [areaId: number]: AreaT;
@@ -3092,6 +3122,130 @@ export type LinkedEntitiesT = {
3092
3122
  [workTypeId: number]: WorkTypeT;
3093
3123
  };
3094
3124
  };
3125
+ export type EntityTypes = string | $ReadOnlyArray<string>;
3126
+ export type EntityTypesMap = {
3127
+ [entityType: RelatableEntityTypeT]: EntityTypes;
3128
+ };
3129
+ export type RelationshipTypeT = string | $ReadOnlyArray<string>;
3130
+ export type ValidationResult = {
3131
+ error?: React.ReactNode;
3132
+ result: boolean;
3133
+ target?: $Values<"WIP convertTypeNode: TypeofTypeAnnotation">;
3134
+ };
3135
+ export type CleanupEntry = {
3136
+ clean?: (url: string) => string;
3137
+ hostname: string | $ReadOnlyArray<string>;
3138
+ match: $ReadOnlyArray<RegExp>;
3139
+ restrict?: $ReadOnlyArray<EntityTypesMap>;
3140
+ select?: (url: string, sourceType: RelatableEntityTypeT) => RelationshipTypeT | false;
3141
+ validate?: (url: string, id: string) => ValidationResult;
3142
+ };
3143
+ declare class Checker {
3144
+ url: string;
3145
+ entityType: RelatableEntityTypeT;
3146
+ cleanup: CleanupEntry | null | undefined;
3147
+ constructor(url: string, entityType: RelatableEntityTypeT);
3148
+ guessType(): RelationshipTypeT | false;
3149
+ getPossibleTypes(): Array<RelationshipTypeT> | false;
3150
+ checkRelationship(id: string, entityType?: RelatableEntityTypeT): ValidationResult;
3151
+ checkRelationships(selectedTypes: $ReadOnlyArray<string>, allowedTypes: $ReadOnlyArray<RelationshipTypeT> | false): ValidationResult;
3152
+ filterApplicableTypes(sourceType?: RelatableEntityTypeT): Array<RelationshipTypeT>;
3153
+ }
3154
+ export type ErrorTarget = $Values<"WIP convertTypeNode: TypeofTypeAnnotation">;
3155
+ export type ErrorT = {
3156
+ blockMerge?: boolean;
3157
+ message: React.ReactNode;
3158
+ target: ErrorTarget;
3159
+ };
3160
+ export type LinkTypeOptionT = {
3161
+ data: LinkTypeT;
3162
+ disabled?: boolean;
3163
+ text: string;
3164
+ value: number;
3165
+ };
3166
+ export type LinkStateT = $ReadOnly<$_$Spread<DatePeriodRoleT, {
3167
+ deleted: boolean;
3168
+ editsPending: boolean;
3169
+ entity0: RelatableEntityT | {
3170
+ entityType: RelatableEntityTypeT;
3171
+ id?: void;
3172
+ isNewEntity?: true;
3173
+ name?: string;
3174
+ orderingTypeID?: number;
3175
+ relationships?: void;
3176
+ } | null;
3177
+ entity0_credit: string;
3178
+ entity1: RelatableEntityT | null;
3179
+ entity1_credit: string;
3180
+ pendingTypes: $ReadOnlyArray<number> | null;
3181
+ rawUrl: string;
3182
+ relationship: StrOrNum | null;
3183
+ submitted: boolean;
3184
+ type: number | null;
3185
+ url: string;
3186
+ video: boolean;
3187
+ }>>;
3188
+ export type LinkMapT = Map<string, LinkStateT>;
3189
+ export type LinkRelationshipT = $ReadOnly<$_$Spread<LinkStateT, {
3190
+ error: ErrorT | null;
3191
+ index: number;
3192
+ urlIndex: number;
3193
+ }>>;
3194
+ export type LinksEditorProps = {
3195
+ errorObservable?: (_arg0: boolean) => void;
3196
+ isNewEntity: boolean;
3197
+ sourceData: RelatableEntityT | {
3198
+ entityType: RelatableEntityTypeT;
3199
+ id?: void;
3200
+ isNewEntity?: true;
3201
+ name?: string;
3202
+ orderingTypeID?: number;
3203
+ relationships?: void;
3204
+ };
3205
+ };
3206
+ export type LinksEditorState = {
3207
+ links: $ReadOnlyArray<LinkStateT>;
3208
+ };
3209
+ export declare class _ExternalLinksEditor extends React.Component<LinksEditorProps, LinksEditorState> {
3210
+ creditableEntityProp: "entity0_credit" | "entity1_credit" | null;
3211
+ tableRef: {
3212
+ current: HTMLTableElement | null;
3213
+ };
3214
+ generalLinkTypes: $ReadOnlyArray<LinkTypeOptionT>;
3215
+ oldLinks: LinkMapT;
3216
+ errorObservable: (_arg0: boolean) => void;
3217
+ initialLinks: $ReadOnlyArray<LinkStateT>;
3218
+ sourceType: RelatableEntityTypeT;
3219
+ typeOptions: $ReadOnlyArray<LinkTypeOptionT>;
3220
+ submittedLinksWrapper: {
3221
+ get: () => Array<LinkStateT> | null | undefined;
3222
+ remove: () => void;
3223
+ set: (links: $ReadOnlyArray<LinkStateT>) => void;
3224
+ };
3225
+ constructor(props: LinksEditorProps);
3226
+ copyEditDataToReleaseEditor(): unknown;
3227
+ componentDidUpdate(): unknown;
3228
+ setLinkState(index: number, state: $ReadOnly<Partial<LinkStateT>>, callback?: () => void): unknown;
3229
+ cleanupUrl(url: string): string;
3230
+ handleUrlChange(linkIndexes: $ReadOnlyArray<number>, urlIndex: number, rawUrl: string): unknown;
3231
+ handleUrlBlur(index: number, isDuplicate: boolean, event: SyntheticFocusEvent<HTMLInputElement>, urlIndex: number, canMerge: boolean): unknown;
3232
+ submitPendingTypes(link: LinkStateT, index: number): unknown;
3233
+ handleLinkSubmit(index: number, urlIndex: number, event: SyntheticEvent<HTMLInputElement>, canMerge: boolean): unknown;
3234
+ handleTypeChange(index: number, event: SyntheticEvent<HTMLSelectElement>): unknown;
3235
+ handleTypeBlur(index: number, event: SyntheticFocusEvent<HTMLSelectElement>, isDuplicate: boolean, urlIndex: number, canMerge: boolean): unknown;
3236
+ handleVideoChange(index: number, event: SyntheticEvent<HTMLInputElement>): unknown;
3237
+ removeLink(index: number): unknown;
3238
+ removeLinks(indexes: $ReadOnlyArray<number>, urlIndex: number): unknown;
3239
+ addRelationship(url: string, urlIndex: number): unknown;
3240
+ getOldLinksHash(): LinkMapT;
3241
+ getEditData(): {
3242
+ allLinks: LinkMapT;
3243
+ newLinks: LinkMapT;
3244
+ oldLinks: LinkMapT;
3245
+ };
3246
+ getFormData(startingPrefix: string, startingIndex: number, pushInput: (_arg0: string, _arg1: string, _arg2: string) => void): unknown;
3247
+ validateLink(link: LinkRelationshipT | LinkStateT, checker?: Checker): ErrorT | null;
3248
+ }
3095
3249
  export type EveryPropertyIsExistsOrNot<T> = T | {
3096
3250
  [K in keyof T]?: undefined | null;
3097
3251
  };
@@ -3111,19 +3265,21 @@ export type NonReleaseRelationshipEditor = RelationshipEditorBase & EveryPropert
3111
3265
  }>;
3112
3266
  export type MaybeReleaseRelationshipEditor = ReleaseRelationshipEditor | NonReleaseRelationshipEditor;
3113
3267
  declare global {
3114
- var MB: undefined | {
3115
- constants: typeof constants;
3116
- relationshipEditor: MaybeReleaseRelationshipEditor;
3117
- /**
3118
- * If you're on a relationship editor page, this should be available.
3119
- */
3120
- tree?: typeof import("./weight-balanced-tree.js");
3121
- linkedEntities: LinkedEntitiesT;
3122
- };
3268
+ interface Window {
3269
+ MB?: undefined | {
3270
+ constants: typeof constants;
3271
+ relationshipEditor: MaybeReleaseRelationshipEditor;
3272
+ /**
3273
+ * If you're on a relationship editor page, this should be available.
3274
+ */
3275
+ tree?: typeof import("./weight-balanced-tree.js");
3276
+ linkedEntities: LinkedEntitiesT;
3277
+ };
3278
+ }
3123
3279
  }
3124
3280
 
3125
3281
  declare namespace constants {
3126
- export { AREA_TYPE_COUNTRY, ARTIST_GROUP_TYPES, ARTIST_TYPE_CHOIR, ARTIST_TYPE_GROUP, ARTIST_TYPE_ORCHESTRA, ARTIST_TYPE_PERSON, BRACKET_PAIRS, CONTACT_URL, COUNTRY_JA_AREA_ID, DARTIST_ID, DISPLAY_NONE_STYLE, DLABEL_ID, EMPTY_PARTIAL_DATE, ENTITIES_WITH_RELATIONSHIP_CREDITS, ENTITY_NAMES, FAVICON_CLASSES, FLUENCY_NAMES, INSTRUMENT_ROOT_ID, LANGUAGE_ENG_ID, LANGUAGE_MUL_ID, LANGUAGE_ZXX_ID, MAX_LENGTH_DIFFERENCE, MAX_RECENT_ENTITIES, MBID_REGEXP, MIN_NAME_SIMILARITY, NOLABEL_GID, NOLABEL_ID, PART_OF_SERIES_LINK_TYPES, PART_OF_SERIES_LINK_TYPE_GIDS, PART_OF_SERIES_LINK_TYPE_IDS, PROBABLY_CLASSICAL_LINK_TYPES, QUALITY_NAMES, RECORDING_OF_LINK_TYPE_GID, RECORDING_OF_LINK_TYPE_ID, RT_MIRROR, SERIES_ORDERING_ATTRIBUTE, SERIES_ORDERING_TYPE_AUTOMATIC, SERIES_ORDERING_TYPE_MANUAL, TASK_ATTRIBUTE_ID, TIME_ATTRIBUTE, VARTIST_GID, VARTIST_ID, VARTIST_NAME, VIDEO_ATTRIBUTE_GID, VIDEO_ATTRIBUTE_ID, VOCAL_ROOT_ID, WS_EDIT_RESPONSE_NO_CHANGES, WS_EDIT_RESPONSE_OK };
3282
+ export { ANON_ARTIST_GID, ANON_ARTIST_ID, AREA_TYPE_COUNTRY, ARTIST_GROUP_TYPES, ARTIST_TYPE_CHOIR, ARTIST_TYPE_GROUP, ARTIST_TYPE_ORCHESTRA, ARTIST_TYPE_PERSON, BRACKET_PAIRS, CONTACT_URL, COUNTRY_JA_AREA_ID, DARTIST_ID, DATA_ARTIST_GID, DATA_ARTIST_ID, DIALOGUE_ARTIST_GID, DIALOGUE_ARTIST_ID, DISPLAY_NONE_STYLE, DLABEL_ID, EMPTY_PARTIAL_DATE, ENTITIES_WITH_RELATIONSHIP_CREDITS, ENTITY_NAMES, FAVICON_CLASSES, FLUENCY_NAMES, INSTRUMENT_ROOT_ID, LANGUAGE_ENG_ID, LANGUAGE_MUL_ID, LANGUAGE_ZXX_ID, MAX_LENGTH_DIFFERENCE, MAX_RECENT_ENTITIES, MBID_REGEXP, MIN_NAME_SIMILARITY, NOLABEL_GID, NOLABEL_ID, NO_ARTIST_GID, NO_ARTIST_ID, PART_OF_SERIES_LINK_TYPES, PART_OF_SERIES_LINK_TYPE_GIDS, PART_OF_SERIES_LINK_TYPE_IDS, PROBABLY_CLASSICAL_LINK_TYPES, QUALITY_NAMES, RECORDING_OF_LINK_TYPE_GID, RECORDING_OF_LINK_TYPE_ID, RT_MIRROR, SERIES_ORDERING_ATTRIBUTE, SERIES_ORDERING_TYPE_AUTOMATIC, SERIES_ORDERING_TYPE_MANUAL, SPECIAL_ARTIST_GIDS, SPECIAL_ARTIST_IDS, TASK_ATTRIBUTE_ID, TIME_ATTRIBUTE, TRAD_ARTIST_GID, TRAD_ARTIST_ID, UNKNOWN_ARTIST_GID, UNKNOWN_ARTIST_ID, VARTIST_GID, VARTIST_ID, VARTIST_NAME, VIDEO_ATTRIBUTE_GID, VIDEO_ATTRIBUTE_ID, VOCAL_ROOT_ID, WS_EDIT_RESPONSE_NO_CHANGES, WS_EDIT_RESPONSE_OK };
3127
3283
  }
3128
3284
 
3129
3285
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typedbrainz",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",