@abella-bilhalba-engenharia/api-client 0.0.2 → 0.0.5

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/dist/index.cjs CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  authorizationHeader: () => authorizationHeader,
34
34
  commonResponses: () => commonResponses,
35
35
  commonResponsesBodySchema: () => commonResponsesBodySchema,
36
+ contract: () => contract,
36
37
  detailedUnitSchema: () => detailedUnitSchema,
37
38
  moneySchema: () => moneySchema,
38
39
  solarUnitContract: () => solarUnitContract,
@@ -140,11 +141,23 @@ var solarUnitContract = c.router({
140
141
  summary: "Show an unit by an UUID"
141
142
  }
142
143
  });
144
+
145
+ // src/contract.ts
146
+ var import_core2 = require("@ts-rest/core");
147
+ var c2 = (0, import_core2.initContract)();
148
+ var contract = c2.router(
149
+ { units: solarUnitContract },
150
+ {
151
+ strictStatusCodes: true,
152
+ commonResponses
153
+ }
154
+ );
143
155
  // Annotate the CommonJS export names for ESM import in node:
144
156
  0 && (module.exports = {
145
157
  authorizationHeader,
146
158
  commonResponses,
147
159
  commonResponsesBodySchema,
160
+ contract,
148
161
  detailedUnitSchema,
149
162
  moneySchema,
150
163
  solarUnitContract,
package/dist/index.d.cts CHANGED
@@ -1,201 +1,334 @@
1
- import z from 'zod';
1
+ import * as z from 'zod';
2
+ import z__default from 'zod';
3
+ import * as zod_v4_core from 'zod/v4/core';
2
4
 
3
- declare const authorizationHeader: z.ZodString;
5
+ declare const authorizationHeader: z__default.ZodString;
4
6
  declare const commonResponsesBodySchema: {
5
- unauthorized: z.ZodObject<{
6
- error: z.ZodObject<{
7
- type: z.ZodLiteral<"UNAUTHORIZED">;
8
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
9
- }, z.core.$strip>;
10
- }, z.core.$strip>;
11
- entityNotFound: z.ZodObject<{
12
- error: z.ZodObject<{
13
- type: z.ZodLiteral<"ENTITY_NOT_FOUND">;
14
- entity: z.ZodString;
15
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
16
- }, z.core.$strip>;
17
- }, z.core.$strip>;
18
- entityAlreadyExists: z.ZodObject<{
19
- error: z.ZodObject<{
20
- type: z.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
21
- entity: z.ZodString;
22
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
23
- }, z.core.$strip>;
24
- }, z.core.$strip>;
25
- internalServerError: z.ZodObject<{
26
- error: z.ZodObject<{
27
- type: z.ZodLiteral<"INTERNAL_SERVER_ERROR">;
28
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
29
- }, z.core.$strip>;
30
- }, z.core.$strip>;
7
+ unauthorized: z__default.ZodObject<{
8
+ error: z__default.ZodObject<{
9
+ type: z__default.ZodLiteral<"UNAUTHORIZED">;
10
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
11
+ }, z__default.core.$strip>;
12
+ }, z__default.core.$strip>;
13
+ entityNotFound: z__default.ZodObject<{
14
+ error: z__default.ZodObject<{
15
+ type: z__default.ZodLiteral<"ENTITY_NOT_FOUND">;
16
+ entity: z__default.ZodString;
17
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
18
+ }, z__default.core.$strip>;
19
+ }, z__default.core.$strip>;
20
+ entityAlreadyExists: z__default.ZodObject<{
21
+ error: z__default.ZodObject<{
22
+ type: z__default.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
23
+ entity: z__default.ZodString;
24
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
25
+ }, z__default.core.$strip>;
26
+ }, z__default.core.$strip>;
27
+ internalServerError: z__default.ZodObject<{
28
+ error: z__default.ZodObject<{
29
+ type: z__default.ZodLiteral<"INTERNAL_SERVER_ERROR">;
30
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
31
+ }, z__default.core.$strip>;
32
+ }, z__default.core.$strip>;
31
33
  };
32
34
  declare const commonResponses: {
33
- 401: z.ZodObject<{
34
- error: z.ZodObject<{
35
- type: z.ZodLiteral<"UNAUTHORIZED">;
36
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
37
- }, z.core.$strip>;
38
- }, z.core.$strip>;
39
- 404: z.ZodObject<{
40
- error: z.ZodObject<{
41
- type: z.ZodLiteral<"ENTITY_NOT_FOUND">;
42
- entity: z.ZodString;
43
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
44
- }, z.core.$strip>;
45
- }, z.core.$strip>;
46
- 409: z.ZodObject<{
47
- error: z.ZodObject<{
48
- type: z.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
49
- entity: z.ZodString;
50
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
51
- }, z.core.$strip>;
52
- }, z.core.$strip>;
53
- 500: z.ZodObject<{
54
- error: z.ZodObject<{
55
- type: z.ZodLiteral<"INTERNAL_SERVER_ERROR">;
56
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
57
- }, z.core.$strip>;
58
- }, z.core.$strip>;
35
+ 401: z__default.ZodObject<{
36
+ error: z__default.ZodObject<{
37
+ type: z__default.ZodLiteral<"UNAUTHORIZED">;
38
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
39
+ }, z__default.core.$strip>;
40
+ }, z__default.core.$strip>;
41
+ 404: z__default.ZodObject<{
42
+ error: z__default.ZodObject<{
43
+ type: z__default.ZodLiteral<"ENTITY_NOT_FOUND">;
44
+ entity: z__default.ZodString;
45
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
46
+ }, z__default.core.$strip>;
47
+ }, z__default.core.$strip>;
48
+ 409: z__default.ZodObject<{
49
+ error: z__default.ZodObject<{
50
+ type: z__default.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
51
+ entity: z__default.ZodString;
52
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
53
+ }, z__default.core.$strip>;
54
+ }, z__default.core.$strip>;
55
+ 500: z__default.ZodObject<{
56
+ error: z__default.ZodObject<{
57
+ type: z__default.ZodLiteral<"INTERNAL_SERVER_ERROR">;
58
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
59
+ }, z__default.core.$strip>;
60
+ }, z__default.core.$strip>;
59
61
  };
60
62
  type CommonResponsesType = {
61
63
  [K in keyof typeof commonResponses]: {
62
64
  status: K;
63
- body: z.infer<(typeof commonResponses)[K]>;
65
+ body: z__default.infer<(typeof commonResponses)[K]>;
64
66
  };
65
67
  }[keyof typeof commonResponses];
66
68
  type CommonResponseType<T extends keyof typeof commonResponses> = {
67
69
  status: T;
68
- body: z.infer<(typeof commonResponses)[T]>;
70
+ body: z__default.infer<(typeof commonResponses)[T]>;
69
71
  };
70
72
 
71
- declare const moneySchema: z.ZodObject<{
72
- format: z.ZodString;
73
- value: z.ZodNumber;
74
- unit: z.ZodEnum<{
73
+ declare const moneySchema: z__default.ZodObject<{
74
+ format: z__default.ZodString;
75
+ value: z__default.ZodNumber;
76
+ unit: z__default.ZodEnum<{
75
77
  BRL: "BRL";
76
78
  }>;
77
- }, z.core.$strip>;
78
- declare const unitSchema: z.ZodObject<{
79
- name: z.ZodString;
80
- uuid: z.ZodUUID;
81
- installationDate: z.ZodDate;
82
- }, z.core.$strip>;
83
- declare const detailedUnitSchema: z.ZodObject<{
84
- name: z.ZodString;
85
- uuid: z.ZodUUID;
86
- installationDate: z.ZodDate;
87
- equipments: z.ZodObject<{
88
- inverter: z.ZodString;
89
- panels: z.ZodArray<z.ZodObject<{
90
- model: z.ZodString;
91
- quantity: z.ZodNumber;
92
- }, z.core.$strip>>;
93
- }, z.core.$strip>;
94
- economies: z.ZodOptional<z.ZodArray<z.ZodObject<{
95
- date: z.ZodDate;
96
- valueWouldBe: z.ZodObject<{
97
- format: z.ZodString;
98
- value: z.ZodNumber;
99
- unit: z.ZodEnum<{
79
+ }, z__default.core.$strip>;
80
+ declare const unitSchema: z__default.ZodObject<{
81
+ name: z__default.ZodString;
82
+ uuid: z__default.ZodUUID;
83
+ installationDate: z__default.ZodDate;
84
+ }, z__default.core.$strip>;
85
+ declare const detailedUnitSchema: z__default.ZodObject<{
86
+ name: z__default.ZodString;
87
+ uuid: z__default.ZodUUID;
88
+ installationDate: z__default.ZodDate;
89
+ equipments: z__default.ZodObject<{
90
+ inverter: z__default.ZodString;
91
+ panels: z__default.ZodArray<z__default.ZodObject<{
92
+ model: z__default.ZodString;
93
+ quantity: z__default.ZodNumber;
94
+ }, z__default.core.$strip>>;
95
+ }, z__default.core.$strip>;
96
+ economies: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
97
+ date: z__default.ZodDate;
98
+ valueWouldBe: z__default.ZodObject<{
99
+ format: z__default.ZodString;
100
+ value: z__default.ZodNumber;
101
+ unit: z__default.ZodEnum<{
100
102
  BRL: "BRL";
101
103
  }>;
102
- }, z.core.$strip>;
103
- valuePaid: z.ZodObject<{
104
- format: z.ZodString;
105
- value: z.ZodNumber;
106
- unit: z.ZodEnum<{
104
+ }, z__default.core.$strip>;
105
+ valuePaid: z__default.ZodObject<{
106
+ format: z__default.ZodString;
107
+ value: z__default.ZodNumber;
108
+ unit: z__default.ZodEnum<{
107
109
  BRL: "BRL";
108
110
  }>;
109
- }, z.core.$strip>;
110
- economy: z.ZodObject<{
111
- format: z.ZodString;
112
- value: z.ZodNumber;
113
- unit: z.ZodEnum<{
111
+ }, z__default.core.$strip>;
112
+ economy: z__default.ZodObject<{
113
+ format: z__default.ZodString;
114
+ value: z__default.ZodNumber;
115
+ unit: z__default.ZodEnum<{
114
116
  BRL: "BRL";
115
117
  }>;
116
- }, z.core.$strip>;
117
- economyAccumulated: z.ZodObject<{
118
- format: z.ZodString;
119
- value: z.ZodNumber;
120
- unit: z.ZodEnum<{
118
+ }, z__default.core.$strip>;
119
+ economyAccumulated: z__default.ZodObject<{
120
+ format: z__default.ZodString;
121
+ value: z__default.ZodNumber;
122
+ unit: z__default.ZodEnum<{
121
123
  BRL: "BRL";
122
124
  }>;
123
- }, z.core.$strip>;
124
- }, z.core.$strip>>>;
125
- }, z.core.$strip>;
125
+ }, z__default.core.$strip>;
126
+ }, z__default.core.$strip>>>;
127
+ }, z__default.core.$strip>;
126
128
  declare const solarUnitContract: {
127
129
  list: {
128
130
  summary: "List all units";
129
131
  method: "GET";
130
- headers: z.ZodObject<{
131
- authorization: z.ZodString;
132
- }, z.core.$strip>;
132
+ headers: z__default.ZodObject<{
133
+ authorization: z__default.ZodString;
134
+ }, z__default.core.$strip>;
133
135
  path: "/solar/units";
134
136
  responses: {
135
- 200: z.ZodObject<{
136
- data: z.ZodArray<z.ZodObject<{
137
- name: z.ZodString;
138
- uuid: z.ZodUUID;
139
- installationDate: z.ZodDate;
140
- }, z.core.$strip>>;
141
- }, z.core.$strip>;
137
+ 200: z__default.ZodObject<{
138
+ data: z__default.ZodArray<z__default.ZodObject<{
139
+ name: z__default.ZodString;
140
+ uuid: z__default.ZodUUID;
141
+ installationDate: z__default.ZodDate;
142
+ }, z__default.core.$strip>>;
143
+ }, z__default.core.$strip>;
142
144
  };
143
145
  };
144
146
  show: {
145
- pathParams: z.ZodObject<{
146
- uuid: z.ZodUUID;
147
- }, z.core.$strip>;
147
+ pathParams: z__default.ZodObject<{
148
+ uuid: z__default.ZodUUID;
149
+ }, z__default.core.$strip>;
148
150
  summary: "Show an unit by an UUID";
149
151
  method: "GET";
150
152
  path: "/solar/units/:uuid";
151
153
  responses: {
152
- 200: z.ZodObject<{
153
- data: z.ZodObject<{
154
- name: z.ZodString;
155
- uuid: z.ZodUUID;
156
- installationDate: z.ZodDate;
157
- equipments: z.ZodObject<{
158
- inverter: z.ZodString;
159
- panels: z.ZodArray<z.ZodObject<{
160
- model: z.ZodString;
161
- quantity: z.ZodNumber;
162
- }, z.core.$strip>>;
163
- }, z.core.$strip>;
164
- economies: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
- date: z.ZodDate;
166
- valueWouldBe: z.ZodObject<{
167
- format: z.ZodString;
168
- value: z.ZodNumber;
169
- unit: z.ZodEnum<{
154
+ 200: z__default.ZodObject<{
155
+ data: z__default.ZodObject<{
156
+ name: z__default.ZodString;
157
+ uuid: z__default.ZodUUID;
158
+ installationDate: z__default.ZodDate;
159
+ equipments: z__default.ZodObject<{
160
+ inverter: z__default.ZodString;
161
+ panels: z__default.ZodArray<z__default.ZodObject<{
162
+ model: z__default.ZodString;
163
+ quantity: z__default.ZodNumber;
164
+ }, z__default.core.$strip>>;
165
+ }, z__default.core.$strip>;
166
+ economies: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
167
+ date: z__default.ZodDate;
168
+ valueWouldBe: z__default.ZodObject<{
169
+ format: z__default.ZodString;
170
+ value: z__default.ZodNumber;
171
+ unit: z__default.ZodEnum<{
170
172
  BRL: "BRL";
171
173
  }>;
172
- }, z.core.$strip>;
173
- valuePaid: z.ZodObject<{
174
- format: z.ZodString;
175
- value: z.ZodNumber;
176
- unit: z.ZodEnum<{
174
+ }, z__default.core.$strip>;
175
+ valuePaid: z__default.ZodObject<{
176
+ format: z__default.ZodString;
177
+ value: z__default.ZodNumber;
178
+ unit: z__default.ZodEnum<{
177
179
  BRL: "BRL";
178
180
  }>;
179
- }, z.core.$strip>;
180
- economy: z.ZodObject<{
181
- format: z.ZodString;
182
- value: z.ZodNumber;
183
- unit: z.ZodEnum<{
181
+ }, z__default.core.$strip>;
182
+ economy: z__default.ZodObject<{
183
+ format: z__default.ZodString;
184
+ value: z__default.ZodNumber;
185
+ unit: z__default.ZodEnum<{
184
186
  BRL: "BRL";
185
187
  }>;
186
- }, z.core.$strip>;
187
- economyAccumulated: z.ZodObject<{
188
- format: z.ZodString;
189
- value: z.ZodNumber;
190
- unit: z.ZodEnum<{
188
+ }, z__default.core.$strip>;
189
+ economyAccumulated: z__default.ZodObject<{
190
+ format: z__default.ZodString;
191
+ value: z__default.ZodNumber;
192
+ unit: z__default.ZodEnum<{
191
193
  BRL: "BRL";
192
194
  }>;
193
- }, z.core.$strip>;
194
- }, z.core.$strip>>>;
195
- }, z.core.$strip>;
196
- }, z.core.$strip>;
195
+ }, z__default.core.$strip>;
196
+ }, z__default.core.$strip>>>;
197
+ }, z__default.core.$strip>;
198
+ }, z__default.core.$strip>;
197
199
  };
198
200
  };
199
201
  };
200
202
 
201
- export { type CommonResponseType, type CommonResponsesType, authorizationHeader, commonResponses, commonResponsesBodySchema, detailedUnitSchema, moneySchema, solarUnitContract, unitSchema };
203
+ declare const contract: {
204
+ units: {
205
+ list: {
206
+ summary: "List all units";
207
+ method: "GET";
208
+ headers: z.ZodObject<{
209
+ authorization: z.ZodString;
210
+ }, zod_v4_core.$strip>;
211
+ path: "/solar/units";
212
+ responses: {
213
+ 401: z.ZodObject<{
214
+ error: z.ZodObject<{
215
+ type: z.ZodLiteral<"UNAUTHORIZED">;
216
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
217
+ }, zod_v4_core.$strip>;
218
+ }, zod_v4_core.$strip>;
219
+ 404: z.ZodObject<{
220
+ error: z.ZodObject<{
221
+ type: z.ZodLiteral<"ENTITY_NOT_FOUND">;
222
+ entity: z.ZodString;
223
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
224
+ }, zod_v4_core.$strip>;
225
+ }, zod_v4_core.$strip>;
226
+ 409: z.ZodObject<{
227
+ error: z.ZodObject<{
228
+ type: z.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
229
+ entity: z.ZodString;
230
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
231
+ }, zod_v4_core.$strip>;
232
+ }, zod_v4_core.$strip>;
233
+ 500: z.ZodObject<{
234
+ error: z.ZodObject<{
235
+ type: z.ZodLiteral<"INTERNAL_SERVER_ERROR">;
236
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
237
+ }, zod_v4_core.$strip>;
238
+ }, zod_v4_core.$strip>;
239
+ 200: z.ZodObject<{
240
+ data: z.ZodArray<z.ZodObject<{
241
+ name: z.ZodString;
242
+ uuid: z.ZodUUID;
243
+ installationDate: z.ZodDate;
244
+ }, zod_v4_core.$strip>>;
245
+ }, zod_v4_core.$strip>;
246
+ };
247
+ strictStatusCodes: true;
248
+ };
249
+ show: {
250
+ pathParams: z.ZodObject<{
251
+ uuid: z.ZodUUID;
252
+ }, zod_v4_core.$strip>;
253
+ summary: "Show an unit by an UUID";
254
+ method: "GET";
255
+ path: "/solar/units/:uuid";
256
+ responses: {
257
+ 401: z.ZodObject<{
258
+ error: z.ZodObject<{
259
+ type: z.ZodLiteral<"UNAUTHORIZED">;
260
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
261
+ }, zod_v4_core.$strip>;
262
+ }, zod_v4_core.$strip>;
263
+ 404: z.ZodObject<{
264
+ error: z.ZodObject<{
265
+ type: z.ZodLiteral<"ENTITY_NOT_FOUND">;
266
+ entity: z.ZodString;
267
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
268
+ }, zod_v4_core.$strip>;
269
+ }, zod_v4_core.$strip>;
270
+ 409: z.ZodObject<{
271
+ error: z.ZodObject<{
272
+ type: z.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
273
+ entity: z.ZodString;
274
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
275
+ }, zod_v4_core.$strip>;
276
+ }, zod_v4_core.$strip>;
277
+ 500: z.ZodObject<{
278
+ error: z.ZodObject<{
279
+ type: z.ZodLiteral<"INTERNAL_SERVER_ERROR">;
280
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
281
+ }, zod_v4_core.$strip>;
282
+ }, zod_v4_core.$strip>;
283
+ 200: z.ZodObject<{
284
+ data: z.ZodObject<{
285
+ name: z.ZodString;
286
+ uuid: z.ZodUUID;
287
+ installationDate: z.ZodDate;
288
+ equipments: z.ZodObject<{
289
+ inverter: z.ZodString;
290
+ panels: z.ZodArray<z.ZodObject<{
291
+ model: z.ZodString;
292
+ quantity: z.ZodNumber;
293
+ }, zod_v4_core.$strip>>;
294
+ }, zod_v4_core.$strip>;
295
+ economies: z.ZodOptional<z.ZodArray<z.ZodObject<{
296
+ date: z.ZodDate;
297
+ valueWouldBe: z.ZodObject<{
298
+ format: z.ZodString;
299
+ value: z.ZodNumber;
300
+ unit: z.ZodEnum<{
301
+ BRL: "BRL";
302
+ }>;
303
+ }, zod_v4_core.$strip>;
304
+ valuePaid: z.ZodObject<{
305
+ format: z.ZodString;
306
+ value: z.ZodNumber;
307
+ unit: z.ZodEnum<{
308
+ BRL: "BRL";
309
+ }>;
310
+ }, zod_v4_core.$strip>;
311
+ economy: z.ZodObject<{
312
+ format: z.ZodString;
313
+ value: z.ZodNumber;
314
+ unit: z.ZodEnum<{
315
+ BRL: "BRL";
316
+ }>;
317
+ }, zod_v4_core.$strip>;
318
+ economyAccumulated: z.ZodObject<{
319
+ format: z.ZodString;
320
+ value: z.ZodNumber;
321
+ unit: z.ZodEnum<{
322
+ BRL: "BRL";
323
+ }>;
324
+ }, zod_v4_core.$strip>;
325
+ }, zod_v4_core.$strip>>>;
326
+ }, zod_v4_core.$strip>;
327
+ }, zod_v4_core.$strip>;
328
+ };
329
+ strictStatusCodes: true;
330
+ };
331
+ };
332
+ };
333
+
334
+ export { type CommonResponseType, type CommonResponsesType, authorizationHeader, commonResponses, commonResponsesBodySchema, contract, detailedUnitSchema, moneySchema, solarUnitContract, unitSchema };
package/dist/index.d.ts CHANGED
@@ -1,201 +1,334 @@
1
- import z from 'zod';
1
+ import * as z from 'zod';
2
+ import z__default from 'zod';
3
+ import * as zod_v4_core from 'zod/v4/core';
2
4
 
3
- declare const authorizationHeader: z.ZodString;
5
+ declare const authorizationHeader: z__default.ZodString;
4
6
  declare const commonResponsesBodySchema: {
5
- unauthorized: z.ZodObject<{
6
- error: z.ZodObject<{
7
- type: z.ZodLiteral<"UNAUTHORIZED">;
8
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
9
- }, z.core.$strip>;
10
- }, z.core.$strip>;
11
- entityNotFound: z.ZodObject<{
12
- error: z.ZodObject<{
13
- type: z.ZodLiteral<"ENTITY_NOT_FOUND">;
14
- entity: z.ZodString;
15
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
16
- }, z.core.$strip>;
17
- }, z.core.$strip>;
18
- entityAlreadyExists: z.ZodObject<{
19
- error: z.ZodObject<{
20
- type: z.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
21
- entity: z.ZodString;
22
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
23
- }, z.core.$strip>;
24
- }, z.core.$strip>;
25
- internalServerError: z.ZodObject<{
26
- error: z.ZodObject<{
27
- type: z.ZodLiteral<"INTERNAL_SERVER_ERROR">;
28
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
29
- }, z.core.$strip>;
30
- }, z.core.$strip>;
7
+ unauthorized: z__default.ZodObject<{
8
+ error: z__default.ZodObject<{
9
+ type: z__default.ZodLiteral<"UNAUTHORIZED">;
10
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
11
+ }, z__default.core.$strip>;
12
+ }, z__default.core.$strip>;
13
+ entityNotFound: z__default.ZodObject<{
14
+ error: z__default.ZodObject<{
15
+ type: z__default.ZodLiteral<"ENTITY_NOT_FOUND">;
16
+ entity: z__default.ZodString;
17
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
18
+ }, z__default.core.$strip>;
19
+ }, z__default.core.$strip>;
20
+ entityAlreadyExists: z__default.ZodObject<{
21
+ error: z__default.ZodObject<{
22
+ type: z__default.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
23
+ entity: z__default.ZodString;
24
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
25
+ }, z__default.core.$strip>;
26
+ }, z__default.core.$strip>;
27
+ internalServerError: z__default.ZodObject<{
28
+ error: z__default.ZodObject<{
29
+ type: z__default.ZodLiteral<"INTERNAL_SERVER_ERROR">;
30
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
31
+ }, z__default.core.$strip>;
32
+ }, z__default.core.$strip>;
31
33
  };
32
34
  declare const commonResponses: {
33
- 401: z.ZodObject<{
34
- error: z.ZodObject<{
35
- type: z.ZodLiteral<"UNAUTHORIZED">;
36
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
37
- }, z.core.$strip>;
38
- }, z.core.$strip>;
39
- 404: z.ZodObject<{
40
- error: z.ZodObject<{
41
- type: z.ZodLiteral<"ENTITY_NOT_FOUND">;
42
- entity: z.ZodString;
43
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
44
- }, z.core.$strip>;
45
- }, z.core.$strip>;
46
- 409: z.ZodObject<{
47
- error: z.ZodObject<{
48
- type: z.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
49
- entity: z.ZodString;
50
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
51
- }, z.core.$strip>;
52
- }, z.core.$strip>;
53
- 500: z.ZodObject<{
54
- error: z.ZodObject<{
55
- type: z.ZodLiteral<"INTERNAL_SERVER_ERROR">;
56
- message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
57
- }, z.core.$strip>;
58
- }, z.core.$strip>;
35
+ 401: z__default.ZodObject<{
36
+ error: z__default.ZodObject<{
37
+ type: z__default.ZodLiteral<"UNAUTHORIZED">;
38
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
39
+ }, z__default.core.$strip>;
40
+ }, z__default.core.$strip>;
41
+ 404: z__default.ZodObject<{
42
+ error: z__default.ZodObject<{
43
+ type: z__default.ZodLiteral<"ENTITY_NOT_FOUND">;
44
+ entity: z__default.ZodString;
45
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
46
+ }, z__default.core.$strip>;
47
+ }, z__default.core.$strip>;
48
+ 409: z__default.ZodObject<{
49
+ error: z__default.ZodObject<{
50
+ type: z__default.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
51
+ entity: z__default.ZodString;
52
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
53
+ }, z__default.core.$strip>;
54
+ }, z__default.core.$strip>;
55
+ 500: z__default.ZodObject<{
56
+ error: z__default.ZodObject<{
57
+ type: z__default.ZodLiteral<"INTERNAL_SERVER_ERROR">;
58
+ message: z__default.ZodOptional<z__default.ZodDefault<z__default.ZodString>>;
59
+ }, z__default.core.$strip>;
60
+ }, z__default.core.$strip>;
59
61
  };
60
62
  type CommonResponsesType = {
61
63
  [K in keyof typeof commonResponses]: {
62
64
  status: K;
63
- body: z.infer<(typeof commonResponses)[K]>;
65
+ body: z__default.infer<(typeof commonResponses)[K]>;
64
66
  };
65
67
  }[keyof typeof commonResponses];
66
68
  type CommonResponseType<T extends keyof typeof commonResponses> = {
67
69
  status: T;
68
- body: z.infer<(typeof commonResponses)[T]>;
70
+ body: z__default.infer<(typeof commonResponses)[T]>;
69
71
  };
70
72
 
71
- declare const moneySchema: z.ZodObject<{
72
- format: z.ZodString;
73
- value: z.ZodNumber;
74
- unit: z.ZodEnum<{
73
+ declare const moneySchema: z__default.ZodObject<{
74
+ format: z__default.ZodString;
75
+ value: z__default.ZodNumber;
76
+ unit: z__default.ZodEnum<{
75
77
  BRL: "BRL";
76
78
  }>;
77
- }, z.core.$strip>;
78
- declare const unitSchema: z.ZodObject<{
79
- name: z.ZodString;
80
- uuid: z.ZodUUID;
81
- installationDate: z.ZodDate;
82
- }, z.core.$strip>;
83
- declare const detailedUnitSchema: z.ZodObject<{
84
- name: z.ZodString;
85
- uuid: z.ZodUUID;
86
- installationDate: z.ZodDate;
87
- equipments: z.ZodObject<{
88
- inverter: z.ZodString;
89
- panels: z.ZodArray<z.ZodObject<{
90
- model: z.ZodString;
91
- quantity: z.ZodNumber;
92
- }, z.core.$strip>>;
93
- }, z.core.$strip>;
94
- economies: z.ZodOptional<z.ZodArray<z.ZodObject<{
95
- date: z.ZodDate;
96
- valueWouldBe: z.ZodObject<{
97
- format: z.ZodString;
98
- value: z.ZodNumber;
99
- unit: z.ZodEnum<{
79
+ }, z__default.core.$strip>;
80
+ declare const unitSchema: z__default.ZodObject<{
81
+ name: z__default.ZodString;
82
+ uuid: z__default.ZodUUID;
83
+ installationDate: z__default.ZodDate;
84
+ }, z__default.core.$strip>;
85
+ declare const detailedUnitSchema: z__default.ZodObject<{
86
+ name: z__default.ZodString;
87
+ uuid: z__default.ZodUUID;
88
+ installationDate: z__default.ZodDate;
89
+ equipments: z__default.ZodObject<{
90
+ inverter: z__default.ZodString;
91
+ panels: z__default.ZodArray<z__default.ZodObject<{
92
+ model: z__default.ZodString;
93
+ quantity: z__default.ZodNumber;
94
+ }, z__default.core.$strip>>;
95
+ }, z__default.core.$strip>;
96
+ economies: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
97
+ date: z__default.ZodDate;
98
+ valueWouldBe: z__default.ZodObject<{
99
+ format: z__default.ZodString;
100
+ value: z__default.ZodNumber;
101
+ unit: z__default.ZodEnum<{
100
102
  BRL: "BRL";
101
103
  }>;
102
- }, z.core.$strip>;
103
- valuePaid: z.ZodObject<{
104
- format: z.ZodString;
105
- value: z.ZodNumber;
106
- unit: z.ZodEnum<{
104
+ }, z__default.core.$strip>;
105
+ valuePaid: z__default.ZodObject<{
106
+ format: z__default.ZodString;
107
+ value: z__default.ZodNumber;
108
+ unit: z__default.ZodEnum<{
107
109
  BRL: "BRL";
108
110
  }>;
109
- }, z.core.$strip>;
110
- economy: z.ZodObject<{
111
- format: z.ZodString;
112
- value: z.ZodNumber;
113
- unit: z.ZodEnum<{
111
+ }, z__default.core.$strip>;
112
+ economy: z__default.ZodObject<{
113
+ format: z__default.ZodString;
114
+ value: z__default.ZodNumber;
115
+ unit: z__default.ZodEnum<{
114
116
  BRL: "BRL";
115
117
  }>;
116
- }, z.core.$strip>;
117
- economyAccumulated: z.ZodObject<{
118
- format: z.ZodString;
119
- value: z.ZodNumber;
120
- unit: z.ZodEnum<{
118
+ }, z__default.core.$strip>;
119
+ economyAccumulated: z__default.ZodObject<{
120
+ format: z__default.ZodString;
121
+ value: z__default.ZodNumber;
122
+ unit: z__default.ZodEnum<{
121
123
  BRL: "BRL";
122
124
  }>;
123
- }, z.core.$strip>;
124
- }, z.core.$strip>>>;
125
- }, z.core.$strip>;
125
+ }, z__default.core.$strip>;
126
+ }, z__default.core.$strip>>>;
127
+ }, z__default.core.$strip>;
126
128
  declare const solarUnitContract: {
127
129
  list: {
128
130
  summary: "List all units";
129
131
  method: "GET";
130
- headers: z.ZodObject<{
131
- authorization: z.ZodString;
132
- }, z.core.$strip>;
132
+ headers: z__default.ZodObject<{
133
+ authorization: z__default.ZodString;
134
+ }, z__default.core.$strip>;
133
135
  path: "/solar/units";
134
136
  responses: {
135
- 200: z.ZodObject<{
136
- data: z.ZodArray<z.ZodObject<{
137
- name: z.ZodString;
138
- uuid: z.ZodUUID;
139
- installationDate: z.ZodDate;
140
- }, z.core.$strip>>;
141
- }, z.core.$strip>;
137
+ 200: z__default.ZodObject<{
138
+ data: z__default.ZodArray<z__default.ZodObject<{
139
+ name: z__default.ZodString;
140
+ uuid: z__default.ZodUUID;
141
+ installationDate: z__default.ZodDate;
142
+ }, z__default.core.$strip>>;
143
+ }, z__default.core.$strip>;
142
144
  };
143
145
  };
144
146
  show: {
145
- pathParams: z.ZodObject<{
146
- uuid: z.ZodUUID;
147
- }, z.core.$strip>;
147
+ pathParams: z__default.ZodObject<{
148
+ uuid: z__default.ZodUUID;
149
+ }, z__default.core.$strip>;
148
150
  summary: "Show an unit by an UUID";
149
151
  method: "GET";
150
152
  path: "/solar/units/:uuid";
151
153
  responses: {
152
- 200: z.ZodObject<{
153
- data: z.ZodObject<{
154
- name: z.ZodString;
155
- uuid: z.ZodUUID;
156
- installationDate: z.ZodDate;
157
- equipments: z.ZodObject<{
158
- inverter: z.ZodString;
159
- panels: z.ZodArray<z.ZodObject<{
160
- model: z.ZodString;
161
- quantity: z.ZodNumber;
162
- }, z.core.$strip>>;
163
- }, z.core.$strip>;
164
- economies: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
- date: z.ZodDate;
166
- valueWouldBe: z.ZodObject<{
167
- format: z.ZodString;
168
- value: z.ZodNumber;
169
- unit: z.ZodEnum<{
154
+ 200: z__default.ZodObject<{
155
+ data: z__default.ZodObject<{
156
+ name: z__default.ZodString;
157
+ uuid: z__default.ZodUUID;
158
+ installationDate: z__default.ZodDate;
159
+ equipments: z__default.ZodObject<{
160
+ inverter: z__default.ZodString;
161
+ panels: z__default.ZodArray<z__default.ZodObject<{
162
+ model: z__default.ZodString;
163
+ quantity: z__default.ZodNumber;
164
+ }, z__default.core.$strip>>;
165
+ }, z__default.core.$strip>;
166
+ economies: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
167
+ date: z__default.ZodDate;
168
+ valueWouldBe: z__default.ZodObject<{
169
+ format: z__default.ZodString;
170
+ value: z__default.ZodNumber;
171
+ unit: z__default.ZodEnum<{
170
172
  BRL: "BRL";
171
173
  }>;
172
- }, z.core.$strip>;
173
- valuePaid: z.ZodObject<{
174
- format: z.ZodString;
175
- value: z.ZodNumber;
176
- unit: z.ZodEnum<{
174
+ }, z__default.core.$strip>;
175
+ valuePaid: z__default.ZodObject<{
176
+ format: z__default.ZodString;
177
+ value: z__default.ZodNumber;
178
+ unit: z__default.ZodEnum<{
177
179
  BRL: "BRL";
178
180
  }>;
179
- }, z.core.$strip>;
180
- economy: z.ZodObject<{
181
- format: z.ZodString;
182
- value: z.ZodNumber;
183
- unit: z.ZodEnum<{
181
+ }, z__default.core.$strip>;
182
+ economy: z__default.ZodObject<{
183
+ format: z__default.ZodString;
184
+ value: z__default.ZodNumber;
185
+ unit: z__default.ZodEnum<{
184
186
  BRL: "BRL";
185
187
  }>;
186
- }, z.core.$strip>;
187
- economyAccumulated: z.ZodObject<{
188
- format: z.ZodString;
189
- value: z.ZodNumber;
190
- unit: z.ZodEnum<{
188
+ }, z__default.core.$strip>;
189
+ economyAccumulated: z__default.ZodObject<{
190
+ format: z__default.ZodString;
191
+ value: z__default.ZodNumber;
192
+ unit: z__default.ZodEnum<{
191
193
  BRL: "BRL";
192
194
  }>;
193
- }, z.core.$strip>;
194
- }, z.core.$strip>>>;
195
- }, z.core.$strip>;
196
- }, z.core.$strip>;
195
+ }, z__default.core.$strip>;
196
+ }, z__default.core.$strip>>>;
197
+ }, z__default.core.$strip>;
198
+ }, z__default.core.$strip>;
197
199
  };
198
200
  };
199
201
  };
200
202
 
201
- export { type CommonResponseType, type CommonResponsesType, authorizationHeader, commonResponses, commonResponsesBodySchema, detailedUnitSchema, moneySchema, solarUnitContract, unitSchema };
203
+ declare const contract: {
204
+ units: {
205
+ list: {
206
+ summary: "List all units";
207
+ method: "GET";
208
+ headers: z.ZodObject<{
209
+ authorization: z.ZodString;
210
+ }, zod_v4_core.$strip>;
211
+ path: "/solar/units";
212
+ responses: {
213
+ 401: z.ZodObject<{
214
+ error: z.ZodObject<{
215
+ type: z.ZodLiteral<"UNAUTHORIZED">;
216
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
217
+ }, zod_v4_core.$strip>;
218
+ }, zod_v4_core.$strip>;
219
+ 404: z.ZodObject<{
220
+ error: z.ZodObject<{
221
+ type: z.ZodLiteral<"ENTITY_NOT_FOUND">;
222
+ entity: z.ZodString;
223
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
224
+ }, zod_v4_core.$strip>;
225
+ }, zod_v4_core.$strip>;
226
+ 409: z.ZodObject<{
227
+ error: z.ZodObject<{
228
+ type: z.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
229
+ entity: z.ZodString;
230
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
231
+ }, zod_v4_core.$strip>;
232
+ }, zod_v4_core.$strip>;
233
+ 500: z.ZodObject<{
234
+ error: z.ZodObject<{
235
+ type: z.ZodLiteral<"INTERNAL_SERVER_ERROR">;
236
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
237
+ }, zod_v4_core.$strip>;
238
+ }, zod_v4_core.$strip>;
239
+ 200: z.ZodObject<{
240
+ data: z.ZodArray<z.ZodObject<{
241
+ name: z.ZodString;
242
+ uuid: z.ZodUUID;
243
+ installationDate: z.ZodDate;
244
+ }, zod_v4_core.$strip>>;
245
+ }, zod_v4_core.$strip>;
246
+ };
247
+ strictStatusCodes: true;
248
+ };
249
+ show: {
250
+ pathParams: z.ZodObject<{
251
+ uuid: z.ZodUUID;
252
+ }, zod_v4_core.$strip>;
253
+ summary: "Show an unit by an UUID";
254
+ method: "GET";
255
+ path: "/solar/units/:uuid";
256
+ responses: {
257
+ 401: z.ZodObject<{
258
+ error: z.ZodObject<{
259
+ type: z.ZodLiteral<"UNAUTHORIZED">;
260
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
261
+ }, zod_v4_core.$strip>;
262
+ }, zod_v4_core.$strip>;
263
+ 404: z.ZodObject<{
264
+ error: z.ZodObject<{
265
+ type: z.ZodLiteral<"ENTITY_NOT_FOUND">;
266
+ entity: z.ZodString;
267
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
268
+ }, zod_v4_core.$strip>;
269
+ }, zod_v4_core.$strip>;
270
+ 409: z.ZodObject<{
271
+ error: z.ZodObject<{
272
+ type: z.ZodLiteral<"ENTITY_ALREADY_EXISTS">;
273
+ entity: z.ZodString;
274
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
275
+ }, zod_v4_core.$strip>;
276
+ }, zod_v4_core.$strip>;
277
+ 500: z.ZodObject<{
278
+ error: z.ZodObject<{
279
+ type: z.ZodLiteral<"INTERNAL_SERVER_ERROR">;
280
+ message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
281
+ }, zod_v4_core.$strip>;
282
+ }, zod_v4_core.$strip>;
283
+ 200: z.ZodObject<{
284
+ data: z.ZodObject<{
285
+ name: z.ZodString;
286
+ uuid: z.ZodUUID;
287
+ installationDate: z.ZodDate;
288
+ equipments: z.ZodObject<{
289
+ inverter: z.ZodString;
290
+ panels: z.ZodArray<z.ZodObject<{
291
+ model: z.ZodString;
292
+ quantity: z.ZodNumber;
293
+ }, zod_v4_core.$strip>>;
294
+ }, zod_v4_core.$strip>;
295
+ economies: z.ZodOptional<z.ZodArray<z.ZodObject<{
296
+ date: z.ZodDate;
297
+ valueWouldBe: z.ZodObject<{
298
+ format: z.ZodString;
299
+ value: z.ZodNumber;
300
+ unit: z.ZodEnum<{
301
+ BRL: "BRL";
302
+ }>;
303
+ }, zod_v4_core.$strip>;
304
+ valuePaid: z.ZodObject<{
305
+ format: z.ZodString;
306
+ value: z.ZodNumber;
307
+ unit: z.ZodEnum<{
308
+ BRL: "BRL";
309
+ }>;
310
+ }, zod_v4_core.$strip>;
311
+ economy: z.ZodObject<{
312
+ format: z.ZodString;
313
+ value: z.ZodNumber;
314
+ unit: z.ZodEnum<{
315
+ BRL: "BRL";
316
+ }>;
317
+ }, zod_v4_core.$strip>;
318
+ economyAccumulated: z.ZodObject<{
319
+ format: z.ZodString;
320
+ value: z.ZodNumber;
321
+ unit: z.ZodEnum<{
322
+ BRL: "BRL";
323
+ }>;
324
+ }, zod_v4_core.$strip>;
325
+ }, zod_v4_core.$strip>>>;
326
+ }, zod_v4_core.$strip>;
327
+ }, zod_v4_core.$strip>;
328
+ };
329
+ strictStatusCodes: true;
330
+ };
331
+ };
332
+ };
333
+
334
+ export { type CommonResponseType, type CommonResponsesType, authorizationHeader, commonResponses, commonResponsesBodySchema, contract, detailedUnitSchema, moneySchema, solarUnitContract, unitSchema };
package/dist/index.js CHANGED
@@ -98,10 +98,22 @@ var solarUnitContract = c.router({
98
98
  summary: "Show an unit by an UUID"
99
99
  }
100
100
  });
101
+
102
+ // src/contract.ts
103
+ import { initContract as initContract2 } from "@ts-rest/core";
104
+ var c2 = initContract2();
105
+ var contract = c2.router(
106
+ { units: solarUnitContract },
107
+ {
108
+ strictStatusCodes: true,
109
+ commonResponses
110
+ }
111
+ );
101
112
  export {
102
113
  authorizationHeader,
103
114
  commonResponses,
104
115
  commonResponsesBodySchema,
116
+ contract,
105
117
  detailedUnitSchema,
106
118
  moneySchema,
107
119
  solarUnitContract,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@abella-bilhalba-engenharia/api-client",
3
3
  "description": "Type-safe Client for Abella Bilhalba Engenharia API.",
4
4
  "author": "TheDevick",
5
- "version": "0.0.2",
5
+ "version": "0.0.5",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "./dist/index.js",
@@ -14,7 +14,8 @@
14
14
  },
15
15
  "scripts": {
16
16
  "build": "tsup",
17
- "test": "vitest"
17
+ "test": "vitest",
18
+ "prepublishOnly": "npm run build"
18
19
  },
19
20
  "keywords": [
20
21
  "typescript",