-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrtk-codegen.config.ts
More file actions
185 lines (182 loc) · 8.94 KB
/
Copy pathrtk-codegen.config.ts
File metadata and controls
185 lines (182 loc) · 8.94 KB
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
import type { ConfigFile } from '@rtk-query/codegen-openapi';
require('dotenv').config();
const config: ConfigFile = {
schemaFile: `${process.env.PUBLIC_TERRAWARE_API}/v3/api-docs`,
apiFile: './src/queries/baseApi.ts',
apiImport: 'baseApi',
exportName: 'api',
hooks: { queries: true, lazyQueries: true, mutations: true },
outputFiles: {
'./src/queries/generated/acceleratorProjects.ts': {
filterEndpoints: (_, operation) =>
operation.path === '/api/v1/accelerator/projects' ||
operation.path === '/api/v1/accelerator/projects/{projectId}',
},
'./src/queries/generated/acceleratorReportIndicators.ts': {
filterEndpoints: (_, operation) =>
operation.path.startsWith('/api/v1/accelerator/projects/{projectId}/reports/indicators') ||
operation.path.startsWith('/api/v1/accelerator/reports/autoCalculatedIndicators') ||
operation.path.startsWith('/api/v1/accelerator/reports/commonIndicators'),
},
'./src/queries/generated/acceleratorReports.ts': {
filterEndpoints: (_, operation) =>
(operation.path.startsWith('/api/v1/accelerator/projects/{projectId}/reports') &&
!operation.path.startsWith('/api/v1/accelerator/projects/{projectId}/reports/indicators')) ||
operation.path.startsWith('/api/v1/accelerator/reports/{reportId}'),
},
'./src/queries/generated/clock.ts': {
filterEndpoints: (_, operation) => operation.path === '/api/v1/seedbank/clock',
},
'./src/queries/generated/countryBoundary.ts': {
filterEndpoints: (_, operation) => operation.path === '/api/v1/countries/{countryCode}/boundary',
},
'./src/queries/generated/deliveries.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/deliveries'),
},
'./src/queries/generated/disclaimer.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/disclaimer'),
},
'./src/queries/generated/users.ts': {
filterEndpoints: (_, operation) =>
operation.path === '/api/v1/users' ||
operation.path === '/api/v1/users/me' ||
operation.path === '/api/v1/users/{userId}',
},
'./src/queries/generated/draftPlantingSites.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/draftSites'),
},
'./src/queries/generated/events.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/events/'),
},
'./src/queries/generated/activities.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/accelerator/activities'),
},
'./src/queries/generated/funderActivities.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/funder/activities'),
},
'./src/queries/generated/fundingEntities.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/funder/entities'),
},
'./src/queries/generated/globalRoles.ts': {
filterEndpoints: (_, operation) =>
operation.path.startsWith('/api/v1/globalRoles') || operation.path === '/api/v1/users/{userId}/globalRoles',
},
'./src/queries/generated/mapbox.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/mapbox'),
},
'./src/queries/generated/modules.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/accelerator/modules'),
},
'./src/queries/generated/notifications.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/notifications'),
},
'./src/queries/generated/nurseryBatches.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/nursery/batches'),
},
'./src/queries/generated/nurserySummaries.ts': {
filterEndpoints: (_, operation) =>
operation.path === '/api/v1/nursery/summary' ||
operation.path === '/api/v1/nursery/facilities/{facilityId}/summary' ||
operation.path === '/api/v1/nursery/species/{speciesId}/summary',
},
'./src/queries/generated/nurseryWithdrawals.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/nursery/withdrawals'),
},
'./src/queries/generated/observations.ts': {
filterEndpoints: (_, operation) =>
operation.path.startsWith('/api/v1/tracking/observations') &&
!operation.path.includes('{observationId}/splats'),
},
'./src/queries/generated/organizationFeatures.ts': {
filterEndpoints: (_, operation) => operation.path === '/api/v1/organizations/{organizationId}/features',
},
'./src/queries/generated/organizationMedia.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/organizations/{organizationId}/media'),
},
'./src/queries/generated/organizationSplats.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/organizations/{organizationId}/splats'),
},
'./src/queries/generated/observationSplats.ts': {
filterEndpoints: (_, operation) =>
operation.path.startsWith('/api/v1/tracking/observations/{observationId}/splats'),
},
'./src/queries/generated/plantingSites.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/sites'),
},
'./src/queries/generated/preferences.ts': {
filterEndpoints: (_, operation) =>
operation.path === '/api/v1/users/me/preferences' || operation.path === '/api/v1/users/me/cookies',
},
'./src/queries/generated/projects.ts': {
filterEndpoints: (_, operation) =>
operation.path.startsWith('/api/v1/projects') && !operation.path.includes('{id}/internalUsers'),
},
'./src/queries/generated/projectInternalUsers.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/projects/{id}/internalUsers'),
},
'./src/queries/generated/projectModules.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/accelerator/projects/{projectId}/modules'),
},
'./src/queries/generated/publishedReports.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/funder/reports'),
},
'./src/queries/generated/projectScores.ts': {
filterEndpoints: (_, operation) => operation.path === '/api/v2/accelerator/projects/{projectId}/scores',
},
'./src/queries/generated/seedFundReports.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/reports'),
},
'./src/queries/generated/substrata.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/substrata'),
},
'./src/queries/generated/strata.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/strata'),
},
'./src/queries/generated/siteThumbnail.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/sites/{id}/thumbnail'),
},
'./src/queries/generated/accessionsV1.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/seedbank/accessions'),
},
'./src/queries/generated/accessionsV2.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v2/seedbank/accessions'),
},
'./src/queries/generated/seedBankSummary.ts': {
filterEndpoints: (_, operation) => operation.path === '/api/v1/seedbank/summary' && operation.verb === 'get',
},
'./src/queries/generated/userInternalInterests.ts': {
filterEndpoints: (_, operation) => operation.path === '/api/v1/users/{userId}/internalInterests',
},
'./src/queries/generated/t0.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/t0'),
},
'./src/queries/generated/plantingSeasons.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/planting-seasons'),
},
'./src/queries/generated/species.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/species'),
},
'./src/queries/generated/stats.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/tracking/stats'),
},
'./src/queries/generated/timeZones.ts': {
filterEndpoints: (_, operation) => operation.path === '/api/v1/i18n/timeZones',
},
'./src/queries/generated/support.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/support'),
},
'./src/queries/generated/publicStatistics.ts': {
filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/public/statistics'),
},
'./src/queries/generated/projectVotes.ts': {
filterEndpoints: (_, operation) => operation.path === '/api/v1/accelerator/projects/{projectId}/votes',
},
// Disable regenerating Search API until OpenAPI annotation fix is completed.
// './src/queries/generated/search.ts': {
// filterEndpoints: (_, operation) => operation.path.startsWith('/api/v1/search'),
// },
},
prettierConfigFile: '.prettierrc',
flattenArg: true,
};
export default config;