-
-
Notifications
You must be signed in to change notification settings - Fork 287
/
Copy pathcatalyst.js
124 lines (113 loc) · 3.27 KB
/
catalyst.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* @flow strict
* Copyright (C) 2017 MetaBrainz Foundation
*
* This file is part of MusicBrainz, the open internet music database,
* and is licensed under the GPL version 2, or (at your option) any
* later version: http://www.gnu.org/licenses/gpl-2.0.txt
*/
/* eslint-disable no-unused-vars */
// Most of these types are serialized in the MusicBrainz::Server package.
declare type CatalystActionT = {
+name: string,
};
declare type CatalystContextT = {
+action: CatalystActionT,
+flash: {
+message?: string,
},
+relative_uri: string,
+req: CatalystRequestContextT,
+session: CatalystSessionT | null,
+sessionid: string | null,
+stash: CatalystStashT,
+user?: UnsanitizedEditorT,
};
declare type CatalystRequestContextT = {
+body_params: {+[param: string]: string},
+headers: {+[header: string]: string},
+method: string,
+query_params: {+[param: string]: string},
+secure: boolean,
+uri: string,
};
declare type CatalystSessionT = {
+merger?: MergeQueueT,
+tport?: number,
};
declare type CatalystStashT = {
+alert?: string,
+alert_mtime?: number | null,
+can_delete?: boolean,
+collaborative_collections?: $ReadOnlyArray<CollectionT>,
+commons_image?: CommonsImageT | null,
+containment?: {
[collectionId: number]: ?1,
},
+current_action_requires_auth?: boolean,
+current_language: string,
+current_language_html: string,
+entity?: RelatableEntityT,
+event_artwork?: EventArtT,
+event_artwork_count?: number,
+genre_map?: {+[genreName: string]: GenreT, ...},
+globals_script_nonce?: string,
+hide_merge_helper?: boolean,
+jsonld_data?: {...},
+last_replication_date?: string,
+makes_no_changes?: boolean,
+more_tags?: boolean,
+new_edit_notes?: boolean,
+new_edit_notes_mtime?: number | null,
+number_of_collections?: number,
+number_of_revisions?: number,
+overlong_string?: boolean,
+own_collections?: $ReadOnlyArray<CollectionT>,
+release_artwork?: ReleaseArtT,
+release_artwork_count?: number,
+release_cdtoc_count?: number,
+seeded_relationships?: ?$ReadOnlyArray<SeededRelationshipT>,
+server_languages?: $ReadOnlyArray<ServerLanguageT>,
+source_entity?: ?RelatableEntityT,
+subscribed?: boolean,
+to_merge?: $ReadOnlyArray<MergeableEntityT>,
+top_tags?: $ReadOnlyArray<AggregatedTagT>,
+user_tags?: $ReadOnlyArray<UserTagT>,
+within_dialog?: boolean,
};
// MusicBrainz::Server::MergeQueue::TO_JSON
declare type MergeQueueT = {
+entities: $ReadOnlyArray<number>,
+ready_to_merge: boolean,
+type: MergeableEntityTypeT,
};
// root/utility/sanitizedContext.mjs
declare type SanitizedCatalystSessionT = {
+tport?: number,
};
declare type SanitizedCatalystContextT = {
+action: {
+name: string,
},
+relative_uri: string,
+req: {
+method: string,
+query_params: {+[param: string]: string},
+uri: string,
},
+session: SanitizedCatalystSessionT | null,
+stash: {
+current_language: string,
+genre_map?: {+[genreName: string]: GenreT, ...},
+seeded_relationships?: ?$ReadOnlyArray<SeededRelationshipT>,
+server_languages?: $ReadOnlyArray<ServerLanguageT>,
+source_entity?: ?RelatableEntityT,
},
+user: ActiveEditorT | null,
};
declare type ServerLanguageT = {
+id: number,
+name: string,
+native_language: string,
+native_territory: string,
};