-
Notifications
You must be signed in to change notification settings - Fork 17
/
codegen.ts
386 lines (384 loc) · 17.1 KB
/
codegen.ts
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
hooks: {
afterAllFileWrite: ['prettier --write'],
},
generates: {
'./subgraphs/playback/src/__generated__/resolvers-types.ts': {
schema: './subgraphs/playback/schema.graphql',
config: {
contextType: '../types/ContextValue#ContextValue',
defaultScalarType: 'unknown',
enumsAsTypes: true,
useIndexSignature: true,
federation: true,
makeResolverTypeCallable: true,
mappers: {
Actions: 'spotify-api#Spotify#Object.Actions',
Album:
'spotify-api#Spotify#Object.Album | Spotify.Object.AlbumSimplified',
AlbumTrackConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.TrackSimplified>',
AlbumTrackEdge: 'spotify-api#Spotify#Object.TrackSimplified',
Artist: 'spotify-api#Spotify#Object.Artist',
ArtistAlbumsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.AlbumSimplified>',
ArtistAlbumEdge: 'spotify-api#Spotify#Object.AlbumSimplified',
CurrentlyPlaying: 'spotify-api#Spotify#Object.CurrentlyPlaying',
CurrentUser: 'spotify-api#Spotify#Object.CurrentUser',
Developer: '{}',
Device: 'spotify-api#Spotify#Object.Device',
Episode:
'spotify-api#Spotify#Object.Episode | Spotify.Object.EpisodeSimplified',
FeaturedPlaylistConnection:
'spotify-api#Spotify#Object.FeaturedPlaylists',
FeaturedPlaylistEdge: 'spotify-api#Spotify#Object.PlaylistSimplified',
FollowedArtistsConnection:
'spotify-api#Spotify#Object.PaginatedCursorBased<Spotify.Object.Artist>',
FollowedArtistEdge: 'spotify-api#Spotify#Object.Artist',
NewReleasesConnection: 'spotify-api#Spotify#Object.NewReleases',
NewReleaseEdge: 'spotify-api#Spotify#Object.AlbumSimplified',
PageInfo: 'spotify-api#Spotify#Object.Paginated<unknown>',
PageInfoCursorBased:
'spotify-api#Spotify#Object.PaginatedCursorBased<unknown>',
Player: '{}',
PlaybackContext: 'spotify-api#Spotify#Object.Context',
PlaybackContextItem:
'spotify-api#Spotify#Object.Album | Spotify.Object.Artist | Spotify.Object.Playlist | Spotify.Object.Show',
PlaybackItem:
'spotify-api#Spotify#Object.Episode | Spotify.Object.Track',
PlaybackQueue: 'spotify-api#Spotify#Object.PlaybackQueue',
PlaybackState: 'spotify-api#Spotify#Object.PlaybackState',
Playlist:
'spotify-api#Spotify#Object.Playlist | Spotify.Object.PlaylistSimplified',
PlaylistEdge: 'spotify-api#Spotify#Object.Playlist',
PlaylistConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Playlist>',
PlaylistTrack:
'spotify-api#Spotify#Object.Track | Spotify.Object.Episode',
PlaylistTrackConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.PlaylistTrack>',
PlaylistTrackEdge: 'spotify-api#Spotify#Object.PlaylistTrack',
RecentlyPlayedConnection:
'spotify-api#Spotify#Object.PaginatedCursorBased<Spotify.Object.PlayHistory>',
RecentlyPlayedEdge: 'spotify-api#Spotify#Object.PlayHistory',
Recommendations: 'spotify-api#Spotify#Object.Recommendations',
ReleaseDate: './mappers#Releasable',
ResumePoint: 'spotify-api#Spotify#Object.ResumePoint',
SavedAlbumsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.SavedAlbum>',
SavedAlbumEdge: 'spotify-api#Spotify#Object.SavedAlbum',
SavedEpisodesConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.SavedEpisode>',
SavedEpisodeEdge: 'spotify-api#Spotify#Object.SavedEpisode',
SavedShowsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.SavedShow>',
SavedShowEdge: 'spotify-api#Spotify#Object.SavedShow',
SavedTracksConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.SavedTrack>',
SavedTrackEdge: 'spotify-api#Spotify#Object.SavedTrack',
SearchAlbumsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.AlbumSimplified>',
SearchAlbumEdge: 'spotify-api#Spotify#Object.AlbumSimplified',
SearchArtistsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Artist>',
SearchArtistEdge: 'spotify-api#Spotify#Object.Artist',
SearchEpisodesConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.EpisodeSimplified>',
SearchEpisodeEdge: 'spotify-api#Spotify#Object.EpisodeSimplified',
SearchPlaylistsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.PlaylistSimplified>',
SearchPlaylistEdge: 'spotify-api#Spotify#Object.PlaylistSimplified',
SearchTracksConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Track>',
SearchTrackEdge: 'spotify-api#Spotify#Object.Track',
SearchShowsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.ShowSimplified>',
SearchShowEdge: 'spotify-api#Spotify#Object.ShowSimplified',
SearchResults: 'spotify-api#Spotify#Object.SearchResults',
Show: 'spotify-api#Spotify#Object.Show | Spotify.Object.ShowSimplified',
ShowEpisodesConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.EpisodeSimplified>',
ShowEpisodeEdge: 'spotify-api#Spotify#Object.EpisodeSimplified',
TopArtistsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Artist>',
TopArtistEdge: 'spotify-api#Spotify#Object.Artist',
TopTracksConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Track>',
TopTrackEdge: 'spotify-api#Spotify#Object.Track',
Track:
'spotify-api#Spotify#Object.Track | Spotify.Object.TrackSimplified',
TrackAudioFeatures: 'spotify-api#Spotify#Object.TrackAudioFeatures',
User: 'spotify-api#Spotify#Object.User',
},
enumValues: {
Action: {
INTERRUPTING_PLAYBACK: 'interrupting_playback',
PAUSING: 'pausing',
RESUMING: 'resuming',
SEEKING: 'seeking',
SKIPPING_NEXT: 'skipping_next',
SKIPPING_PREV: 'skipping_prev',
TOGGLING_REPEAT_CONTEXT: 'toggling_repeat_context',
TOGGLING_SHUFFLE: 'toggling_shuffle',
TOGGLING_REPEAT_TRACK: 'toggling_repeat_track',
TRANSFERRING_PLAYBACK: 'transferring_playback',
},
PlaybackContextType: {
ALBUM: 'album',
ARTIST: 'artist',
AUDIO_FEATURES: 'audio_features',
COLLECTION: 'collection',
COLLECTION_YOUR_EPISODES: 'collectionyourepisodes',
EPISODE: 'episode',
GENRE: 'genre',
PLAYLIST: 'playlist',
SHOW: 'show',
TRACK: 'track',
USER: 'user',
},
RepeatMode: {
CONTEXT: 'context',
OFF: 'off',
TRACK: 'track',
},
},
scalars: {
CountryCode: 'string',
DateTime: 'Date',
ErrorRate: 'number',
},
},
plugins: ['typescript', 'typescript-resolvers'],
},
'./subgraphs/spotify/src/__generated__/resolvers-types.ts': {
schema: './subgraphs/spotify/schema.graphql',
config: {
contextType: '../types/ContextValue#ContextValue',
defaultScalarType: 'unknown',
enumsAsTypes: true,
useIndexSignature: true,
federation: true,
makeResolverTypeCallable: true,
mappers: {
Actions: 'spotify-api#Spotify#Object.Actions',
Album:
'spotify-api#Spotify#Object.Album | Spotify.Object.AlbumSimplified',
AlbumTrackConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.TrackSimplified>',
AlbumTrackEdge: 'spotify-api#Spotify#Object.TrackSimplified',
Artist: 'spotify-api#Spotify#Object.Artist',
ArtistAlbumsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.AlbumSimplified>',
ArtistAlbumEdge: 'spotify-api#Spotify#Object.AlbumSimplified',
CurrentlyPlaying: 'spotify-api#Spotify#Object.CurrentlyPlaying',
CurrentUser: 'spotify-api#Spotify#Object.CurrentUser',
CurrentUserProfile: 'spotify-api#Spotify#Object.CurrentUser',
Developer: '{}',
Device: 'spotify-api#Spotify#Object.Device',
Episode:
'spotify-api#Spotify#Object.Episode | Spotify.Object.EpisodeSimplified',
ExplicitContentSettings:
'spotify-api#Spotify#Object.ExplicitContentSettings',
FeaturedPlaylistConnection:
'spotify-api#Spotify#Object.FeaturedPlaylists',
FeaturedPlaylistEdge: 'spotify-api#Spotify#Object.PlaylistSimplified',
FieldConfig:
'@shared/field-synthetics#FieldConfig as FieldConfigType',
FollowedArtistsConnection:
'spotify-api#Spotify#Object.PaginatedCursorBased<Spotify.Object.Artist>',
FollowedArtistEdge: 'spotify-api#Spotify#Object.Artist',
NewReleasesConnection: 'spotify-api#Spotify#Object.NewReleases',
NewReleaseEdge: 'spotify-api#Spotify#Object.AlbumSimplified',
PageInfo: 'spotify-api#Spotify#Object.Paginated<unknown>',
PageInfoCursorBased:
'spotify-api#Spotify#Object.PaginatedCursorBased<unknown>',
Player: '{}',
PlaybackContext: 'spotify-api#Spotify#Object.Context',
PlaybackContextItem:
'spotify-api#Spotify#Object.Album | Spotify.Object.Artist | Spotify.Object.Playlist | Spotify.Object.Show',
PlaybackItem:
'spotify-api#Spotify#Object.Episode | Spotify.Object.Track',
PlaybackQueue: 'spotify-api#Spotify#Object.PlaybackQueue',
PlaybackState: 'spotify-api#Spotify#Object.PlaybackState',
Playlist:
'spotify-api#Spotify#Object.Playlist | Spotify.Object.PlaylistSimplified',
PlaylistEdge: 'spotify-api#Spotify#Object.Playlist',
PlaylistConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Playlist>',
PlaylistTrack:
'spotify-api#Spotify#Object.Track | Spotify.Object.Episode',
PlaylistTrackConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.PlaylistTrack>',
PlaylistTrackEdge: 'spotify-api#Spotify#Object.PlaylistTrack',
RecentlyPlayedConnection:
'spotify-api#Spotify#Object.PaginatedCursorBased<Spotify.Object.PlayHistory>',
RecentlyPlayedEdge: 'spotify-api#Spotify#Object.PlayHistory',
Recommendations: 'spotify-api#Spotify#Object.Recommendations',
ReleaseDate: './mappers#Releasable',
ResumePoint: 'spotify-api#Spotify#Object.ResumePoint',
SavedAlbumsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.SavedAlbum>',
SavedAlbumEdge: 'spotify-api#Spotify#Object.SavedAlbum',
SavedEpisodesConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.SavedEpisode>',
SavedEpisodeEdge: 'spotify-api#Spotify#Object.SavedEpisode',
SavedShowsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.SavedShow>',
SavedShowEdge: 'spotify-api#Spotify#Object.SavedShow',
SavedTracksConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.SavedTrack>',
SavedTrackEdge: 'spotify-api#Spotify#Object.SavedTrack',
SearchAlbumsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.AlbumSimplified>',
SearchAlbumEdge: 'spotify-api#Spotify#Object.AlbumSimplified',
SearchArtistsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Artist>',
SearchArtistEdge: 'spotify-api#Spotify#Object.Artist',
SearchEpisodesConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.EpisodeSimplified>',
SearchEpisodeEdge: 'spotify-api#Spotify#Object.EpisodeSimplified',
SearchPlaylistsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.PlaylistSimplified>',
SearchPlaylistEdge: 'spotify-api#Spotify#Object.PlaylistSimplified',
SearchTracksConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Track>',
SearchTrackEdge: 'spotify-api#Spotify#Object.Track',
SearchShowsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.ShowSimplified>',
SearchShowEdge: 'spotify-api#Spotify#Object.ShowSimplified',
SearchResults: 'spotify-api#Spotify#Object.SearchResults',
Show: 'spotify-api#Spotify#Object.Show | Spotify.Object.ShowSimplified',
ShowEpisodesConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.EpisodeSimplified>',
ShowEpisodeEdge: 'spotify-api#Spotify#Object.EpisodeSimplified',
TopArtistsConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Artist>',
TopArtistEdge: 'spotify-api#Spotify#Object.Artist',
TopTracksConnection:
'spotify-api#Spotify#Object.Paginated<Spotify.Object.Track>',
TopTrackEdge: 'spotify-api#Spotify#Object.Track',
Track:
'spotify-api#Spotify#Object.Track | Spotify.Object.TrackSimplified',
TrackAudioFeatures: 'spotify-api#Spotify#Object.TrackAudioFeatures',
User: 'spotify-api#Spotify#Object.User',
},
enumValues: {
Action: {
INTERRUPTING_PLAYBACK: 'interrupting_playback',
PAUSING: 'pausing',
RESUMING: 'resuming',
SEEKING: 'seeking',
SKIPPING_NEXT: 'skipping_next',
SKIPPING_PREV: 'skipping_prev',
TOGGLING_REPEAT_CONTEXT: 'toggling_repeat_context',
TOGGLING_SHUFFLE: 'toggling_shuffle',
TOGGLING_REPEAT_TRACK: 'toggling_repeat_track',
TRANSFERRING_PLAYBACK: 'transferring_playback',
},
AlbumGroup: {
ALBUM: 'album',
APPEARS_ON: 'appears_on',
COMPILATION: 'compilation',
SINGLE: 'single',
},
AlbumType: {
ALBUM: 'album',
COMPILATION: 'compilation',
SINGLE: 'single',
},
PlaybackContextType: {
ALBUM: 'album',
ARTIST: 'artist',
AUDIO_FEATURES: 'audio_features',
COLLECTION: 'collection',
COLLECTION_YOUR_EPISODES: 'collectionyourepisodes',
EPISODE: 'episode',
GENRE: 'genre',
PLAYLIST: 'playlist',
SHOW: 'show',
TRACK: 'track',
USER: 'user',
},
ReleaseDatePrecision: {
DAY: 'day',
MONTH: 'month',
YEAR: 'year',
},
RepeatMode: {
CONTEXT: 'context',
OFF: 'off',
TRACK: 'track',
},
SearchExternalValue: {
AUDIO: 'audio',
},
SearchType: {
ALBUM: 'album',
ARTIST: 'artist',
EPISODE: 'episode',
PLAYLIST: 'playlist',
TRACK: 'track',
SHOW: 'show',
},
TimeRange: {
LONG_TERM: 'long_term',
MEDIUM_TERM: 'medium_term',
SHORT_TERM: 'short_term',
},
},
scalars: {
ID: 'string',
CountryCode: 'string',
DateTime: 'Date',
ErrorRate: 'number',
},
},
plugins: ['typescript', 'typescript-resolvers'],
},
'./client/src/apollo/introspection.json': {
schema: [
'./client/schema.graphql',
'./client/src/apollo/localSchema.graphql',
],
documents: ['client/src/**/*.{ts,tsx}'],
plugins: ['fragment-matcher'],
},
'./client/src/apollo/__generated__/local-resolvers.ts': {
schema: './client/src/apollo/localSchema.graphql',
plugins: ['typescript', 'typescript-resolvers'],
},
'./client/src/types/api.ts': {
schema: [
'./client/schema.graphql',
'./client/src/apollo/localSchema.graphql',
],
documents: ['client/src/**/*.{ts,tsx}'],
config: {
avoidOptionals: {
field: true,
inputValue: false,
object: false,
defaultValue: false,
},
dedupeOperationSuffix: true,
defaultScalarType: 'unknown',
nonOptionalTypename: true,
omitOperationSuffix: true,
skipTypeNameForRoot: true,
scalars: {
CountryCode: 'string',
DateTime: 'string',
ErrorRate: 'number',
ID: 'string',
Timestamp: 'number',
},
namingConvention: {
typeNames: 'keep',
},
},
plugins: ['typescript', 'typescript-operations'],
},
},
};
export default config;