@dakkitor/api-contracts 1.1.10 → 1.1.12
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/actives/actives.contract.d.ts +59 -60
- package/dist/actives/actives.contract.d.ts.map +1 -1
- package/dist/actives/actives.contract.js +16 -19
- package/dist/agent-client-links/agent-client-links.contract.d.ts +1909 -0
- package/dist/agent-client-links/agent-client-links.contract.d.ts.map +1 -0
- package/dist/agent-client-links/agent-client-links.contract.js +127 -0
- package/dist/auth/auth.contract.d.ts +319 -0
- package/dist/auth/auth.contract.d.ts.map +1 -0
- package/dist/auth/auth.contract.js +63 -0
- package/dist/bookings/bookings.contract.d.ts +371 -280
- package/dist/bookings/bookings.contract.d.ts.map +1 -1
- package/dist/bookings/bookings.contract.js +25 -33
- package/dist/call-history/call-history.contract.d.ts +1164 -0
- package/dist/call-history/call-history.contract.d.ts.map +1 -0
- package/dist/call-history/call-history.contract.js +254 -0
- package/dist/client-contacts/client-contacts.contract.d.ts +375 -426
- package/dist/client-contacts/client-contacts.contract.d.ts.map +1 -1
- package/dist/client-contacts/client-contacts.contract.js +24 -13
- package/dist/clients/clients.contract.d.ts +317 -289
- package/dist/clients/clients.contract.d.ts.map +1 -1
- package/dist/clients/clients.contract.js +44 -29
- package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts +3013 -0
- package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts.map +1 -0
- package/dist/collaboration-checkings/collaboration-checkings.contract.js +247 -0
- package/dist/collaborations/collaborations.contract.d.ts +2229 -0
- package/dist/collaborations/collaborations.contract.d.ts.map +1 -0
- package/dist/collaborations/collaborations.contract.js +284 -0
- package/dist/common/common-schemas.d.ts +100 -0
- package/dist/common/common-schemas.d.ts.map +1 -1
- package/dist/common/common-schemas.js +268 -1
- package/dist/common/error-schemas.d.ts +7 -7
- package/dist/common/error-schemas.d.ts.map +1 -1
- package/dist/common/openapi-metadata.d.ts +6 -0
- package/dist/common/openapi-metadata.d.ts.map +1 -1
- package/dist/companies/companies.contract.d.ts +1108 -0
- package/dist/companies/companies.contract.d.ts.map +1 -0
- package/dist/companies/companies.contract.js +164 -0
- package/dist/cron-executions/cron-executions.contract.d.ts +1643 -0
- package/dist/cron-executions/cron-executions.contract.d.ts.map +1 -0
- package/dist/cron-executions/cron-executions.contract.js +271 -0
- package/dist/curated-workers/curated-workers.contract.d.ts +3183 -0
- package/dist/curated-workers/curated-workers.contract.d.ts.map +1 -0
- package/dist/curated-workers/curated-workers.contract.js +444 -0
- package/dist/dashboards/agent-daily-metrics.contract.d.ts +639 -0
- package/dist/dashboards/agent-daily-metrics.contract.d.ts.map +1 -0
- package/dist/dashboards/agent-daily-metrics.contract.js +118 -0
- package/dist/files/files.contract.d.ts +1258 -0
- package/dist/files/files.contract.d.ts.map +1 -0
- package/dist/files/files.contract.js +205 -0
- package/dist/health/health.contract.d.ts +161 -0
- package/dist/health/health.contract.d.ts.map +1 -0
- package/dist/health/health.contract.js +52 -0
- package/dist/index.d.ts +27393 -3342
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -0
- package/dist/jobs/jobs.contract.d.ts +2303 -0
- package/dist/jobs/jobs.contract.d.ts.map +1 -0
- package/dist/jobs/jobs.contract.js +295 -0
- package/dist/lead-assignments/lead-assignments.contract.d.ts +1826 -0
- package/dist/lead-assignments/lead-assignments.contract.d.ts.map +1 -0
- package/dist/lead-assignments/lead-assignments.contract.js +187 -0
- package/dist/lead-distribution/agent-lead-distribution.contract.d.ts +1147 -0
- package/dist/lead-distribution/agent-lead-distribution.contract.d.ts.map +1 -0
- package/dist/lead-distribution/agent-lead-distribution.contract.js +154 -0
- package/dist/lead-distribution/lead-distribution-config.contract.d.ts +1085 -0
- package/dist/lead-distribution/lead-distribution-config.contract.d.ts.map +1 -0
- package/dist/lead-distribution/lead-distribution-config.contract.js +196 -0
- package/dist/leads/leads.contract.d.ts +1690 -0
- package/dist/leads/leads.contract.d.ts.map +1 -0
- package/dist/leads/leads.contract.js +328 -0
- package/dist/locations/locations.contract.d.ts +974 -0
- package/dist/locations/locations.contract.d.ts.map +1 -0
- package/dist/locations/locations.contract.js +154 -0
- package/dist/postcodes/postcodes.contract.d.ts +370 -0
- package/dist/postcodes/postcodes.contract.d.ts.map +1 -0
- package/dist/postcodes/postcodes.contract.js +90 -0
- package/dist/qualifications/qualifications.contract.d.ts +1489 -0
- package/dist/qualifications/qualifications.contract.d.ts.map +1 -0
- package/dist/qualifications/qualifications.contract.js +215 -0
- package/dist/trades/trades.contract.d.ts +799 -0
- package/dist/trades/trades.contract.d.ts.map +1 -0
- package/dist/trades/trades.contract.js +112 -0
- package/dist/users/users.contract.d.ts +162 -152
- package/dist/users/users.contract.d.ts.map +1 -1
- package/dist/users/users.contract.js +16 -28
- package/dist/workers/workers.contract.d.ts +3376 -0
- package/dist/workers/workers.contract.d.ts.map +1 -0
- package/dist/workers/workers.contract.js +363 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.contract.d.ts","sourceRoot":"","sources":["../../contracts/files/files.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EASM,CAAC;AAE3C,eAAO,MAAM,+BAA+B;;;;;;;;;EAUM,CAAC;AAEnD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CM,CAAC;AAEtC,eAAO,MAAM,6BAA6B;;;;;;;;;EAKM,CAAC;AAEjD,eAAO,MAAM,gBAAgB;;;;;;EAQM,CAAC;AAEpC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAEM,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqHzB,CAAC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filesContract = exports.FileResponseArraySchema = exports.UpdateFileSchema = exports.FileDownloadUrlResponseSchema = exports.FileResponseSchema = exports.GenerateUploadUrlResponseSchema = exports.GenerateUploadUrlSchema = void 0;
|
|
4
|
+
const core_1 = require("@ts-rest/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const error_schemas_1 = require("../common/error-schemas");
|
|
7
|
+
const c = (0, core_1.initContract)();
|
|
8
|
+
exports.GenerateUploadUrlSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
fileName: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.min(1)
|
|
13
|
+
.describe('The name of the file to be uploaded.'),
|
|
14
|
+
contentType: zod_1.z.string().min(1).describe('The MIME type of the file.'),
|
|
15
|
+
size: zod_1.z.number().min(1).describe('The size of the file in bytes.'),
|
|
16
|
+
})
|
|
17
|
+
.openapi({ title: 'GenerateUploadUrl' });
|
|
18
|
+
exports.GenerateUploadUrlResponseSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
uploadUrl: zod_1.z
|
|
21
|
+
.string()
|
|
22
|
+
.describe('The pre-signed URL for the file upload (PUT request).'),
|
|
23
|
+
fileId: zod_1.z
|
|
24
|
+
.string()
|
|
25
|
+
.uuid()
|
|
26
|
+
.describe('The unique identifier of the created file record.'),
|
|
27
|
+
})
|
|
28
|
+
.openapi({ title: 'GenerateUploadUrlResponse' });
|
|
29
|
+
exports.FileResponseSchema = zod_1.z
|
|
30
|
+
.object({
|
|
31
|
+
id: zod_1.z.string().uuid().describe('The unique identifier of the file record.'),
|
|
32
|
+
originalName: zod_1.z
|
|
33
|
+
.string()
|
|
34
|
+
.describe('The original filename as uploaded by the user.'),
|
|
35
|
+
storageKey: zod_1.z
|
|
36
|
+
.string()
|
|
37
|
+
.describe('The unique storage key where the file is stored.'),
|
|
38
|
+
mimeType: zod_1.z.string().describe('The MIME type of the file.'),
|
|
39
|
+
size: zod_1.z.number().describe('The size of the file in bytes.'),
|
|
40
|
+
location: zod_1.z
|
|
41
|
+
.string()
|
|
42
|
+
.describe('The storage location or path where the file is stored.'),
|
|
43
|
+
storageProvider: zod_1.z
|
|
44
|
+
.string()
|
|
45
|
+
.describe('The storage provider used (local, s3, azure, gcp).'),
|
|
46
|
+
description: zod_1.z
|
|
47
|
+
.string()
|
|
48
|
+
.nullable()
|
|
49
|
+
.describe('Optional user-provided description of the file.'),
|
|
50
|
+
entityType: zod_1.z
|
|
51
|
+
.string()
|
|
52
|
+
.nullable()
|
|
53
|
+
.describe('The type of entity this file is attached to (WorkerQualification, ShareCode, Worker, etc.).'),
|
|
54
|
+
entityId: zod_1.z
|
|
55
|
+
.string()
|
|
56
|
+
.uuid()
|
|
57
|
+
.nullable()
|
|
58
|
+
.describe('The UUID of the entity this file is attached to.'),
|
|
59
|
+
userId: zod_1.z
|
|
60
|
+
.string()
|
|
61
|
+
.uuid()
|
|
62
|
+
.describe('The UUID of the user who created this file.'),
|
|
63
|
+
createdAt: zod_1.z
|
|
64
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
65
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
66
|
+
.describe('The timestamp when the file record was created.'),
|
|
67
|
+
updatedAt: zod_1.z
|
|
68
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
69
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
70
|
+
.describe('The timestamp when the file record was last updated.'),
|
|
71
|
+
})
|
|
72
|
+
.openapi({ title: 'FileResponse' });
|
|
73
|
+
exports.FileDownloadUrlResponseSchema = zod_1.z
|
|
74
|
+
.object({
|
|
75
|
+
url: zod_1.z.string().describe('Pre-signed URL to download the file'),
|
|
76
|
+
mimeType: zod_1.z.string().describe('MIME type of the file'),
|
|
77
|
+
})
|
|
78
|
+
.openapi({ title: 'FileDownloadUrlResponse' });
|
|
79
|
+
exports.UpdateFileSchema = zod_1.z
|
|
80
|
+
.object({
|
|
81
|
+
description: zod_1.z
|
|
82
|
+
.string()
|
|
83
|
+
.max(500)
|
|
84
|
+
.optional()
|
|
85
|
+
.describe('Optional description of the file.'),
|
|
86
|
+
})
|
|
87
|
+
.openapi({ title: 'UpdateFile' });
|
|
88
|
+
exports.FileResponseArraySchema = zod_1.z
|
|
89
|
+
.array(exports.FileResponseSchema)
|
|
90
|
+
.openapi({ title: 'FileResponseArray' });
|
|
91
|
+
exports.filesContract = c.router({
|
|
92
|
+
generateUploadUrl: {
|
|
93
|
+
method: 'POST',
|
|
94
|
+
path: '/v2/files/generate-upload-url',
|
|
95
|
+
body: exports.GenerateUploadUrlSchema,
|
|
96
|
+
responses: {
|
|
97
|
+
201: exports.GenerateUploadUrlResponseSchema,
|
|
98
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
99
|
+
},
|
|
100
|
+
summary: 'Generate a pre-signed URL for file upload',
|
|
101
|
+
metadata: {
|
|
102
|
+
tags: ['Files'],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
findAll: {
|
|
106
|
+
method: 'GET',
|
|
107
|
+
path: '/v2/files',
|
|
108
|
+
responses: {
|
|
109
|
+
200: exports.FileResponseArraySchema,
|
|
110
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
111
|
+
},
|
|
112
|
+
summary: 'Get all files',
|
|
113
|
+
metadata: {
|
|
114
|
+
tags: ['Files'],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
findByEntity: {
|
|
118
|
+
method: 'GET',
|
|
119
|
+
path: '/v2/files/entity/:entityType/:entityId',
|
|
120
|
+
pathParams: zod_1.z.object({
|
|
121
|
+
entityType: zod_1.z.string().describe('Type of entity'),
|
|
122
|
+
entityId: zod_1.z.string().uuid().describe('UUID of the entity'),
|
|
123
|
+
}),
|
|
124
|
+
responses: {
|
|
125
|
+
200: exports.FileResponseArraySchema,
|
|
126
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
127
|
+
},
|
|
128
|
+
summary: 'Get all files for a specific entity',
|
|
129
|
+
metadata: {
|
|
130
|
+
tags: ['Files'],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
findOne: {
|
|
134
|
+
method: 'GET',
|
|
135
|
+
path: '/v2/files/:id',
|
|
136
|
+
pathParams: zod_1.z.object({
|
|
137
|
+
id: zod_1.z.string().uuid().describe('File ID'),
|
|
138
|
+
}),
|
|
139
|
+
responses: {
|
|
140
|
+
200: exports.FileResponseSchema,
|
|
141
|
+
404: error_schemas_1.ErrorResponseSchema,
|
|
142
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
143
|
+
},
|
|
144
|
+
summary: 'Get a file metadata by ID',
|
|
145
|
+
metadata: {
|
|
146
|
+
tags: ['Files'],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
getDownloadUrl: {
|
|
150
|
+
method: 'GET',
|
|
151
|
+
path: '/v2/files/:id/download',
|
|
152
|
+
pathParams: zod_1.z.object({
|
|
153
|
+
id: zod_1.z.string().uuid().describe('File ID'),
|
|
154
|
+
}),
|
|
155
|
+
responses: {
|
|
156
|
+
200: exports.FileDownloadUrlResponseSchema,
|
|
157
|
+
404: error_schemas_1.ErrorResponseSchema,
|
|
158
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
159
|
+
},
|
|
160
|
+
summary: 'Get a pre-signed URL to download a file',
|
|
161
|
+
metadata: {
|
|
162
|
+
tags: ['Files'],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
update: {
|
|
166
|
+
method: 'PATCH',
|
|
167
|
+
path: '/v2/files/:id',
|
|
168
|
+
pathParams: zod_1.z.object({
|
|
169
|
+
id: zod_1.z.string().uuid().describe('File ID'),
|
|
170
|
+
}),
|
|
171
|
+
body: exports.UpdateFileSchema,
|
|
172
|
+
responses: {
|
|
173
|
+
200: exports.FileResponseSchema,
|
|
174
|
+
404: error_schemas_1.ErrorResponseSchema,
|
|
175
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
176
|
+
},
|
|
177
|
+
summary: 'Update a file metadata',
|
|
178
|
+
metadata: {
|
|
179
|
+
tags: ['Files'],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
remove: {
|
|
183
|
+
method: 'DELETE',
|
|
184
|
+
path: '/v2/files/:id',
|
|
185
|
+
pathParams: zod_1.z.object({
|
|
186
|
+
id: zod_1.z.string().uuid().describe('File ID'),
|
|
187
|
+
}),
|
|
188
|
+
body: zod_1.z.object({}),
|
|
189
|
+
responses: {
|
|
190
|
+
204: zod_1.z.undefined(),
|
|
191
|
+
404: error_schemas_1.ErrorResponseSchema,
|
|
192
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
193
|
+
},
|
|
194
|
+
summary: 'Delete a file',
|
|
195
|
+
metadata: {
|
|
196
|
+
tags: ['Files'],
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
}, {
|
|
200
|
+
commonResponses: {
|
|
201
|
+
400: error_schemas_1.ErrorResponseSchema,
|
|
202
|
+
401: error_schemas_1.ErrorResponseSchema,
|
|
203
|
+
500: error_schemas_1.ErrorResponseSchema,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const HealthCheckStatusSchema: z.ZodEnum<["error", "ok", "shutting_down"]>;
|
|
3
|
+
export declare const HealthIndicatorResultSchema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
4
|
+
export declare const HealthCheckResultSchema: z.ZodObject<{
|
|
5
|
+
status: z.ZodEnum<["error", "ok", "shutting_down"]>;
|
|
6
|
+
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
7
|
+
error: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
8
|
+
details: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
details: Record<string, any>;
|
|
11
|
+
status: "error" | "ok" | "shutting_down";
|
|
12
|
+
error?: Record<string, any> | undefined;
|
|
13
|
+
info?: Record<string, any> | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
details: Record<string, any>;
|
|
16
|
+
status: "error" | "ok" | "shutting_down";
|
|
17
|
+
error?: Record<string, any> | undefined;
|
|
18
|
+
info?: Record<string, any> | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
export type HealthCheckStatus = z.infer<typeof HealthCheckStatusSchema>;
|
|
21
|
+
export type HealthIndicatorResult = z.infer<typeof HealthIndicatorResultSchema>;
|
|
22
|
+
export type HealthCheckResult = z.infer<typeof HealthCheckResultSchema>;
|
|
23
|
+
export declare const healthContract: {
|
|
24
|
+
check: {
|
|
25
|
+
metadata: {
|
|
26
|
+
tags: string[];
|
|
27
|
+
isPublic: boolean;
|
|
28
|
+
};
|
|
29
|
+
summary: "Check API health";
|
|
30
|
+
method: "GET";
|
|
31
|
+
path: "/v2/health";
|
|
32
|
+
responses: {
|
|
33
|
+
500: z.ZodObject<{
|
|
34
|
+
statusCode: z.ZodNumber;
|
|
35
|
+
message: z.ZodString;
|
|
36
|
+
code: z.ZodString;
|
|
37
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
38
|
+
timestamp: z.ZodString;
|
|
39
|
+
path: z.ZodString;
|
|
40
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
statusCode: number;
|
|
43
|
+
message: string;
|
|
44
|
+
code: string;
|
|
45
|
+
timestamp: string;
|
|
46
|
+
path: string;
|
|
47
|
+
details?: unknown;
|
|
48
|
+
correlationId?: string | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
statusCode: number;
|
|
51
|
+
message: string;
|
|
52
|
+
code: string;
|
|
53
|
+
timestamp: string;
|
|
54
|
+
path: string;
|
|
55
|
+
details?: unknown;
|
|
56
|
+
correlationId?: string | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
200: z.ZodObject<{
|
|
59
|
+
status: z.ZodEnum<["error", "ok", "shutting_down"]>;
|
|
60
|
+
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
61
|
+
error: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
62
|
+
details: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
details: Record<string, any>;
|
|
65
|
+
status: "error" | "ok" | "shutting_down";
|
|
66
|
+
error?: Record<string, any> | undefined;
|
|
67
|
+
info?: Record<string, any> | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
details: Record<string, any>;
|
|
70
|
+
status: "error" | "ok" | "shutting_down";
|
|
71
|
+
error?: Record<string, any> | undefined;
|
|
72
|
+
info?: Record<string, any> | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
503: z.ZodObject<{
|
|
75
|
+
status: z.ZodEnum<["error", "ok", "shutting_down"]>;
|
|
76
|
+
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
77
|
+
error: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
78
|
+
details: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
details: Record<string, any>;
|
|
81
|
+
status: "error" | "ok" | "shutting_down";
|
|
82
|
+
error?: Record<string, any> | undefined;
|
|
83
|
+
info?: Record<string, any> | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
details: Record<string, any>;
|
|
86
|
+
status: "error" | "ok" | "shutting_down";
|
|
87
|
+
error?: Record<string, any> | undefined;
|
|
88
|
+
info?: Record<string, any> | undefined;
|
|
89
|
+
}>;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
liveness: {
|
|
93
|
+
metadata: {
|
|
94
|
+
tags: string[];
|
|
95
|
+
isPublic: boolean;
|
|
96
|
+
};
|
|
97
|
+
summary: "Liveness check";
|
|
98
|
+
method: "GET";
|
|
99
|
+
path: "/v2/health/live";
|
|
100
|
+
responses: {
|
|
101
|
+
500: z.ZodObject<{
|
|
102
|
+
statusCode: z.ZodNumber;
|
|
103
|
+
message: z.ZodString;
|
|
104
|
+
code: z.ZodString;
|
|
105
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
106
|
+
timestamp: z.ZodString;
|
|
107
|
+
path: z.ZodString;
|
|
108
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
statusCode: number;
|
|
111
|
+
message: string;
|
|
112
|
+
code: string;
|
|
113
|
+
timestamp: string;
|
|
114
|
+
path: string;
|
|
115
|
+
details?: unknown;
|
|
116
|
+
correlationId?: string | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
statusCode: number;
|
|
119
|
+
message: string;
|
|
120
|
+
code: string;
|
|
121
|
+
timestamp: string;
|
|
122
|
+
path: string;
|
|
123
|
+
details?: unknown;
|
|
124
|
+
correlationId?: string | undefined;
|
|
125
|
+
}>;
|
|
126
|
+
200: z.ZodObject<{
|
|
127
|
+
status: z.ZodEnum<["error", "ok", "shutting_down"]>;
|
|
128
|
+
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
129
|
+
error: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
130
|
+
details: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
details: Record<string, any>;
|
|
133
|
+
status: "error" | "ok" | "shutting_down";
|
|
134
|
+
error?: Record<string, any> | undefined;
|
|
135
|
+
info?: Record<string, any> | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
details: Record<string, any>;
|
|
138
|
+
status: "error" | "ok" | "shutting_down";
|
|
139
|
+
error?: Record<string, any> | undefined;
|
|
140
|
+
info?: Record<string, any> | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
503: z.ZodObject<{
|
|
143
|
+
status: z.ZodEnum<["error", "ok", "shutting_down"]>;
|
|
144
|
+
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
145
|
+
error: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
146
|
+
details: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
details: Record<string, any>;
|
|
149
|
+
status: "error" | "ok" | "shutting_down";
|
|
150
|
+
error?: Record<string, any> | undefined;
|
|
151
|
+
info?: Record<string, any> | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
details: Record<string, any>;
|
|
154
|
+
status: "error" | "ok" | "shutting_down";
|
|
155
|
+
error?: Record<string, any> | undefined;
|
|
156
|
+
info?: Record<string, any> | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=health.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.contract.d.ts","sourceRoot":"","sources":["../../contracts/health/health.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,uBAAuB,6CAEM,CAAC;AAE3C,eAAO,MAAM,2BAA2B,oCAAoB,CAAC;AAE7D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAaM,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC1B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.healthContract = exports.HealthCheckResultSchema = exports.HealthIndicatorResultSchema = exports.HealthCheckStatusSchema = void 0;
|
|
4
|
+
const core_1 = require("@ts-rest/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const error_schemas_1 = require("../common/error-schemas");
|
|
7
|
+
const c = (0, core_1.initContract)();
|
|
8
|
+
exports.HealthCheckStatusSchema = zod_1.z
|
|
9
|
+
.enum(['error', 'ok', 'shutting_down'])
|
|
10
|
+
.openapi({ title: 'HealthCheckStatus' });
|
|
11
|
+
exports.HealthIndicatorResultSchema = zod_1.z.record(zod_1.z.any());
|
|
12
|
+
exports.HealthCheckResultSchema = zod_1.z
|
|
13
|
+
.object({
|
|
14
|
+
status: exports.HealthCheckStatusSchema.describe('Health status'),
|
|
15
|
+
info: exports.HealthIndicatorResultSchema.optional().describe('Information about the health check'),
|
|
16
|
+
error: exports.HealthIndicatorResultSchema.optional().describe('Error details if any'),
|
|
17
|
+
details: exports.HealthIndicatorResultSchema.describe('Detailed health check results'),
|
|
18
|
+
})
|
|
19
|
+
.openapi({ title: 'HealthCheckResult' });
|
|
20
|
+
exports.healthContract = c.router({
|
|
21
|
+
check: {
|
|
22
|
+
method: 'GET',
|
|
23
|
+
path: '/health',
|
|
24
|
+
responses: {
|
|
25
|
+
200: exports.HealthCheckResultSchema,
|
|
26
|
+
503: exports.HealthCheckResultSchema, // Health check might return 503 if unhealthy
|
|
27
|
+
},
|
|
28
|
+
summary: 'Check API health',
|
|
29
|
+
metadata: {
|
|
30
|
+
tags: ['Health'],
|
|
31
|
+
isPublic: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
liveness: {
|
|
35
|
+
method: 'GET',
|
|
36
|
+
path: '/health/live',
|
|
37
|
+
responses: {
|
|
38
|
+
200: exports.HealthCheckResultSchema,
|
|
39
|
+
503: exports.HealthCheckResultSchema,
|
|
40
|
+
},
|
|
41
|
+
summary: 'Liveness check',
|
|
42
|
+
metadata: {
|
|
43
|
+
tags: ['Health'],
|
|
44
|
+
isPublic: true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}, {
|
|
48
|
+
pathPrefix: '/v2',
|
|
49
|
+
commonResponses: {
|
|
50
|
+
500: error_schemas_1.ErrorResponseSchema,
|
|
51
|
+
},
|
|
52
|
+
});
|