@marcoturi/fastify-boilerplate 0.0.1

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 (3) hide show
  1. package/graphql.ts +70 -0
  2. package/package.json +23 -0
  3. package/rest.d.ts +323 -0
package/graphql.ts ADDED
@@ -0,0 +1,70 @@
1
+ export type Maybe<T> = T | null;
2
+ export type InputMaybe<T> = Maybe<T>;
3
+ export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
4
+ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
5
+ export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
6
+ export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
7
+ export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
8
+ /** All built-in and custom scalars, mapped to their actual values */
9
+ export type Scalars = {
10
+ ID: { input: string; output: string; }
11
+ String: { input: string; output: string; }
12
+ Boolean: { input: boolean; output: boolean; }
13
+ Int: { input: number; output: number; }
14
+ Float: { input: number; output: number; }
15
+ };
16
+
17
+ export type Mutation = {
18
+ __typename?: 'Mutation';
19
+ putUser: Scalars['ID']['output'];
20
+ };
21
+
22
+
23
+ export type MutationPutUserArgs = {
24
+ input: PutUserPayload;
25
+ };
26
+
27
+ export type PutUserPayload = {
28
+ country: Scalars['String']['input'];
29
+ email: Scalars['String']['input'];
30
+ postalCode: Scalars['String']['input'];
31
+ street: Scalars['String']['input'];
32
+ };
33
+
34
+ export type Query = {
35
+ __typename?: 'Query';
36
+ findUsers: UserPaginatedResponse;
37
+ };
38
+
39
+
40
+ export type QueryFindUsersArgs = {
41
+ country?: InputMaybe<Scalars['String']['input']>;
42
+ limit?: InputMaybe<Scalars['Int']['input']>;
43
+ page?: InputMaybe<Scalars['Int']['input']>;
44
+ postalCode?: InputMaybe<Scalars['String']['input']>;
45
+ street?: InputMaybe<Scalars['String']['input']>;
46
+ };
47
+
48
+ export type User = {
49
+ __typename?: 'User';
50
+ country: Scalars['String']['output'];
51
+ email: Scalars['String']['output'];
52
+ id: Scalars['ID']['output'];
53
+ postalCode: Scalars['String']['output'];
54
+ role: UserRole;
55
+ street: Scalars['String']['output'];
56
+ };
57
+
58
+ export type UserPaginatedResponse = {
59
+ __typename?: 'UserPaginatedResponse';
60
+ count: Scalars['Int']['output'];
61
+ data: Array<Maybe<User>>;
62
+ limit: Scalars['Int']['output'];
63
+ page: Scalars['Int']['output'];
64
+ };
65
+
66
+ export enum UserRole {
67
+ Admin = 'admin',
68
+ Guest = 'guest',
69
+ Moderator = 'moderator'
70
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@marcoturi/fastify-boilerplate",
3
+ "version": "0.0.1",
4
+ "description": "Auto-generated REST (OpenAPI) and GraphQL client types for fastify-boilerplate",
5
+ "type": "module",
6
+ "exports": {
7
+ "./rest": "./rest.d.ts",
8
+ "./graphql": "./graphql.ts"
9
+ },
10
+ "files": [
11
+ "rest.d.ts",
12
+ "graphql.ts"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/marcoturi/fastify-boilerplate.git",
21
+ "directory": "client"
22
+ }
23
+ }
package/rest.d.ts ADDED
@@ -0,0 +1,323 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface paths {
7
+ "/api/v1/users": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ /** @description Find users */
15
+ get: {
16
+ parameters: {
17
+ query?: {
18
+ /** @description Specifies a limit of returned records */
19
+ limit?: number;
20
+ /** @description Page number */
21
+ page?: number;
22
+ /** @description Country of residence */
23
+ country?: string;
24
+ /** @description Postal code */
25
+ postalCode?: string;
26
+ /** @description Street */
27
+ street?: string;
28
+ };
29
+ header?: never;
30
+ path?: never;
31
+ cookie?: never;
32
+ };
33
+ requestBody?: never;
34
+ responses: {
35
+ /** @description Default Response */
36
+ 200: {
37
+ headers: {
38
+ [name: string]: unknown;
39
+ };
40
+ content: {
41
+ "application/json": {
42
+ /**
43
+ * @description Total number of items
44
+ * @example 5
45
+ */
46
+ count: number;
47
+ /**
48
+ * @description Number of items per page
49
+ * @example 10
50
+ */
51
+ limit: number;
52
+ /**
53
+ * @description Page number
54
+ * @example 0
55
+ */
56
+ page: number;
57
+ data: unknown[];
58
+ } & {
59
+ data: (({
60
+ /**
61
+ * Format: uuid
62
+ * @description Entity's id
63
+ * @example 2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231
64
+ */
65
+ id: string;
66
+ } & {
67
+ /**
68
+ * @description Entity creation date
69
+ * @example 2020-11-24T17:43:15.970Z
70
+ */
71
+ createdAt: string;
72
+ /**
73
+ * @description Entity last update date
74
+ * @example 2020-11-24T17:43:15.970Z
75
+ */
76
+ updatedAt: string;
77
+ }) & {
78
+ /**
79
+ * Format: email
80
+ * @description User's email address
81
+ * @example test@mail.com
82
+ */
83
+ email: string;
84
+ /**
85
+ * @description User's country of residence
86
+ * @example France
87
+ */
88
+ country: string;
89
+ /**
90
+ * @description Postal code
91
+ * @example 123456
92
+ */
93
+ postalCode: string;
94
+ /**
95
+ * @description Street where the user is registered
96
+ * @example Park Avenue
97
+ */
98
+ street: string;
99
+ /**
100
+ * @description User's role
101
+ * @example guest
102
+ */
103
+ role: "admin" | "moderator" | "guest";
104
+ })[];
105
+ };
106
+ };
107
+ };
108
+ };
109
+ };
110
+ put?: never;
111
+ /** @description Create user */
112
+ post: {
113
+ parameters: {
114
+ query?: never;
115
+ header?: never;
116
+ path?: never;
117
+ cookie?: never;
118
+ };
119
+ requestBody: {
120
+ content: {
121
+ "application/json": {
122
+ /**
123
+ * Format: email
124
+ * @description User email address
125
+ * @example john@gmail.com
126
+ */
127
+ email: string;
128
+ /**
129
+ * @description Country of residence
130
+ * @example France
131
+ */
132
+ country: string;
133
+ /**
134
+ * @description Postal code
135
+ * @example 10000
136
+ */
137
+ postalCode: string;
138
+ /**
139
+ * @description Street
140
+ * @example Grande Rue
141
+ */
142
+ street: string;
143
+ };
144
+ };
145
+ };
146
+ responses: {
147
+ /** @description Default Response */
148
+ 201: {
149
+ headers: {
150
+ [name: string]: unknown;
151
+ };
152
+ content: {
153
+ "application/json": {
154
+ /**
155
+ * Format: uuid
156
+ * @description Entity's id
157
+ * @example 2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231
158
+ */
159
+ id: string;
160
+ };
161
+ };
162
+ };
163
+ };
164
+ };
165
+ delete?: never;
166
+ options?: never;
167
+ head?: never;
168
+ patch?: never;
169
+ trace?: never;
170
+ };
171
+ "/api/v1/users/{id}": {
172
+ parameters: {
173
+ query?: never;
174
+ header?: never;
175
+ path?: never;
176
+ cookie?: never;
177
+ };
178
+ get?: never;
179
+ put?: never;
180
+ post?: never;
181
+ /** @description Delete a user */
182
+ delete: {
183
+ parameters: {
184
+ query?: never;
185
+ header?: never;
186
+ path: {
187
+ /** @description Entity's id */
188
+ id: string;
189
+ };
190
+ cookie?: never;
191
+ };
192
+ requestBody?: never;
193
+ responses: {
194
+ /** @description User Deleted */
195
+ 204: {
196
+ headers: {
197
+ [name: string]: unknown;
198
+ };
199
+ content?: never;
200
+ };
201
+ };
202
+ };
203
+ options?: never;
204
+ head?: never;
205
+ patch?: never;
206
+ trace?: never;
207
+ };
208
+ "/health": {
209
+ parameters: {
210
+ query?: never;
211
+ header?: never;
212
+ path?: never;
213
+ cookie?: never;
214
+ };
215
+ get: {
216
+ parameters: {
217
+ query?: never;
218
+ header?: never;
219
+ path?: never;
220
+ cookie?: never;
221
+ };
222
+ requestBody?: never;
223
+ responses: {
224
+ /** @description Health Check Succeeded */
225
+ 200: {
226
+ headers: {
227
+ [name: string]: unknown;
228
+ };
229
+ content: {
230
+ "application/json": {
231
+ status?: string;
232
+ };
233
+ };
234
+ };
235
+ /** @description Error Performing Health Check */
236
+ 500: {
237
+ headers: {
238
+ [name: string]: unknown;
239
+ };
240
+ content: {
241
+ "application/json": {
242
+ /**
243
+ * @description Error message for failure during health check
244
+ * @example Internal Server Error
245
+ */
246
+ message?: string;
247
+ /**
248
+ * @description Code representing the error. Always matches the HTTP response code.
249
+ * @example 500
250
+ */
251
+ statusCode?: number;
252
+ };
253
+ };
254
+ };
255
+ /** @description Health Check Failed */
256
+ 503: {
257
+ headers: {
258
+ [name: string]: unknown;
259
+ };
260
+ content: {
261
+ "application/json": {
262
+ /**
263
+ * @description Error code associated with the failing check
264
+ * @example FST_UNDER_PRESSURE
265
+ */
266
+ code?: string;
267
+ /**
268
+ * @description Error thrown during health check
269
+ * @example Service Unavailable
270
+ */
271
+ error?: string;
272
+ /**
273
+ * @description Error message to explain health check failure
274
+ * @example Service Unavailable
275
+ */
276
+ message?: string;
277
+ /**
278
+ * @description Code representing the error. Always matches the HTTP response code.
279
+ * @example 503
280
+ */
281
+ statusCode?: number;
282
+ };
283
+ };
284
+ };
285
+ };
286
+ };
287
+ put?: never;
288
+ post?: never;
289
+ delete?: never;
290
+ options?: never;
291
+ head?: never;
292
+ patch?: never;
293
+ trace?: never;
294
+ };
295
+ }
296
+ export type webhooks = Record<string, never>;
297
+ export interface components {
298
+ schemas: {
299
+ /** ApiErrorResponse */
300
+ "def-0": {
301
+ /** @example 400 */
302
+ statusCode: number;
303
+ /** @example Validation Error */
304
+ message: string;
305
+ /** @example Bad Request */
306
+ error: string;
307
+ /** @example YevPQs */
308
+ correlationId: string;
309
+ /**
310
+ * @description Optional list of sub-errors
311
+ * @example incorrect email
312
+ */
313
+ subErrors?: string;
314
+ };
315
+ };
316
+ responses: never;
317
+ parameters: never;
318
+ requestBodies: never;
319
+ headers: never;
320
+ pathItems: never;
321
+ }
322
+ export type $defs = Record<string, never>;
323
+ export type operations = Record<string, never>;