typedbrainz 0.1.4 → 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.
- package/lib/global.d.ts +147 -20
- 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;
|
|
@@ -1919,7 +1920,7 @@ export type PartialDateFieldT = CompoundFieldT<{
|
|
|
1919
1920
|
export type GenreT = $ReadOnly<$_$Spread<AnnotationRoleT, $_$Spread<CommentRoleT, $_$Spread<RelatableEntityRoleT<"genre">, {
|
|
1920
1921
|
primaryAlias?: string | null;
|
|
1921
1922
|
}>>>>;
|
|
1922
|
-
export type N_l_T =
|
|
1923
|
+
export type N_l_T = () => string;
|
|
1923
1924
|
export type InstrumentT = $ReadOnly<$_$Spread<AnnotationRoleT, $_$Spread<CommentRoleT, $_$Spread<RelatableEntityRoleT<"instrument">, $_$Spread<TypeRoleT<InstrumentTypeT>, {
|
|
1924
1925
|
description: string;
|
|
1925
1926
|
primaryAlias?: string | null;
|
|
@@ -2359,7 +2360,7 @@ export type WsJsEditResponseT = {
|
|
|
2359
2360
|
};
|
|
2360
2361
|
export type SearchableTypeT = EntityItemT["entityType"];
|
|
2361
2362
|
export type StateT<T extends EntityItemT> = {
|
|
2362
|
-
canChangeType?:
|
|
2363
|
+
canChangeType?: (_arg0: string) => boolean;
|
|
2363
2364
|
containerClass?: string;
|
|
2364
2365
|
disabled?: boolean;
|
|
2365
2366
|
entityType: T["entityType"];
|
|
@@ -2368,7 +2369,7 @@ export type StateT<T extends EntityItemT> = {
|
|
|
2368
2369
|
htmlName?: string;
|
|
2369
2370
|
id: string;
|
|
2370
2371
|
indexedSearch: boolean;
|
|
2371
|
-
inputChangeHook?:
|
|
2372
|
+
inputChangeHook?: (inputValue: string, state: StateT<T>, selectItem: (_arg0: OptionItemT<T>) => boolean) => boolean;
|
|
2372
2373
|
inputClass?: string;
|
|
2373
2374
|
inputRef?: {
|
|
2374
2375
|
current: HTMLInputElement | null;
|
|
@@ -2457,7 +2458,7 @@ export type ActionItemT<T extends EntityItemT> = {
|
|
|
2457
2458
|
type: "action";
|
|
2458
2459
|
action: ActionT<T>;
|
|
2459
2460
|
id: number | string;
|
|
2460
|
-
name: string |
|
|
2461
|
+
name: string | (() => string);
|
|
2461
2462
|
level?: number;
|
|
2462
2463
|
separator?: boolean;
|
|
2463
2464
|
disabled?: boolean;
|
|
@@ -2465,7 +2466,7 @@ export type ActionItemT<T extends EntityItemT> = {
|
|
|
2465
2466
|
export type OptionItemT<T> = {
|
|
2466
2467
|
type: "option";
|
|
2467
2468
|
id: number | string;
|
|
2468
|
-
name: string |
|
|
2469
|
+
name: string | (() => string);
|
|
2469
2470
|
entity: T;
|
|
2470
2471
|
level?: number;
|
|
2471
2472
|
separator?: boolean;
|
|
@@ -2474,7 +2475,7 @@ export type OptionItemT<T> = {
|
|
|
2474
2475
|
export type HeaderItemT = {
|
|
2475
2476
|
type: "header";
|
|
2476
2477
|
id: number | string;
|
|
2477
|
-
name: string |
|
|
2478
|
+
name: string | (() => string);
|
|
2478
2479
|
disabled: true;
|
|
2479
2480
|
separator?: boolean;
|
|
2480
2481
|
};
|
|
@@ -2810,7 +2811,7 @@ export type RelationshipEditorActionT = {
|
|
|
2810
2811
|
type: "update-dialog-location";
|
|
2811
2812
|
} | {
|
|
2812
2813
|
changes: {
|
|
2813
|
-
[property: string]:
|
|
2814
|
+
[property: string]: unknown;
|
|
2814
2815
|
};
|
|
2815
2816
|
entityType: RelatableEntityTypeT;
|
|
2816
2817
|
type: "update-entity";
|
|
@@ -2932,7 +2933,7 @@ declare const PART_OF_SERIES_LINK_TYPES: {
|
|
|
2932
2933
|
};
|
|
2933
2934
|
declare const PART_OF_SERIES_LINK_TYPE_GIDS: $ReadOnlyArray<string>;
|
|
2934
2935
|
declare const PART_OF_SERIES_LINK_TYPE_IDS: $ReadOnlyArray<number>;
|
|
2935
|
-
declare const PROBABLY_CLASSICAL_LINK_TYPES
|
|
2936
|
+
declare const PROBABLY_CLASSICAL_LINK_TYPES: number[];
|
|
2936
2937
|
declare const RECORDING_OF_LINK_TYPE_ID: number;
|
|
2937
2938
|
declare const RECORDING_OF_LINK_TYPE_GID: string;
|
|
2938
2939
|
declare const RT_MIRROR = 2;
|
|
@@ -2966,9 +2967,9 @@ declare const MAX_LENGTH_DIFFERENCE = 10500;
|
|
|
2966
2967
|
declare const MAX_RECENT_ENTITIES = 10;
|
|
2967
2968
|
declare const MIN_NAME_SIMILARITY = 0.75;
|
|
2968
2969
|
declare const ENTITIES_WITH_RELATIONSHIP_CREDITS = "WIP convertExpression: ObjectExpression";
|
|
2969
|
-
declare const QUALITY_NAMES: Map<QualityT,
|
|
2970
|
+
declare const QUALITY_NAMES: Map<QualityT, () => string>;
|
|
2970
2971
|
declare const FLUENCY_NAMES: {
|
|
2971
|
-
[fluency: string]:
|
|
2972
|
+
[fluency: string]: () => string;
|
|
2972
2973
|
};
|
|
2973
2974
|
declare const LANGUAGE_ENG_ID = 120;
|
|
2974
2975
|
declare const LANGUAGE_MUL_ID = 284;
|
|
@@ -2977,7 +2978,7 @@ declare const COUNTRY_JA_AREA_ID = 107;
|
|
|
2977
2978
|
declare const DISPLAY_NONE_STYLE = "WIP convertExpression: CallExpression";
|
|
2978
2979
|
declare const WS_EDIT_RESPONSE_OK: WS_EDIT_RESPONSE_OK_T;
|
|
2979
2980
|
declare const WS_EDIT_RESPONSE_NO_CHANGES: WS_EDIT_RESPONSE_NO_CHANGES_T;
|
|
2980
|
-
declare const BRACKET_PAIRS
|
|
2981
|
+
declare const BRACKET_PAIRS: string[][];
|
|
2981
2982
|
export type LinkedEntitiesT = {
|
|
2982
2983
|
area: {
|
|
2983
2984
|
[areaId: number]: AreaT;
|
|
@@ -3121,6 +3122,130 @@ export type LinkedEntitiesT = {
|
|
|
3121
3122
|
[workTypeId: number]: WorkTypeT;
|
|
3122
3123
|
};
|
|
3123
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
|
+
}
|
|
3124
3249
|
export type EveryPropertyIsExistsOrNot<T> = T | {
|
|
3125
3250
|
[K in keyof T]?: undefined | null;
|
|
3126
3251
|
};
|
|
@@ -3140,15 +3265,17 @@ export type NonReleaseRelationshipEditor = RelationshipEditorBase & EveryPropert
|
|
|
3140
3265
|
}>;
|
|
3141
3266
|
export type MaybeReleaseRelationshipEditor = ReleaseRelationshipEditor | NonReleaseRelationshipEditor;
|
|
3142
3267
|
declare global {
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
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
|
+
}
|
|
3152
3279
|
}
|
|
3153
3280
|
|
|
3154
3281
|
declare namespace constants {
|