@dakkitor/api-contracts 1.1.1 → 1.1.3
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/client-contacts/client-contacts.contract.d.ts +2168 -117
- package/dist/client-contacts/client-contacts.contract.d.ts.map +1 -1
- package/dist/client-contacts/client-contacts.contract.js +25 -25
- package/dist/clients/clients.contract.d.ts +1455 -106
- package/dist/clients/clients.contract.d.ts.map +1 -1
- package/dist/clients/clients.contract.js +21 -20
- package/dist/common/error-schemas.d.ts +17 -1
- package/dist/common/error-schemas.d.ts.map +1 -1
- package/dist/common/pagination.schema.d.ts +12 -2
- package/dist/common/pagination.schema.d.ts.map +1 -1
- package/dist/index.d.ts +3118 -125
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clients.contract.d.ts","sourceRoot":"","sources":["../../contracts/clients/clients.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"clients.contract.d.ts","sourceRoot":"","sources":["../../contracts/clients/clients.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBvB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B5B,CAAC;AAEJ,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;;EAG3C,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;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object({
|
|
14
|
-
id: zod_1.z.uuid(),
|
|
14
|
+
id: zod_1.z.string().uuid(),
|
|
15
15
|
firstName: zod_1.z.string(),
|
|
16
16
|
lastName: zod_1.z.string(),
|
|
17
|
-
email: zod_1.z.email(),
|
|
17
|
+
email: zod_1.z.string().email(),
|
|
18
18
|
});
|
|
19
19
|
exports.ClientSchema = zod_1.z.object({
|
|
20
|
-
id: zod_1.z.uuid().describe('Client ID'),
|
|
20
|
+
id: zod_1.z.string().uuid().describe('Client ID'),
|
|
21
21
|
name: zod_1.z.string().describe('Client Name'),
|
|
22
22
|
crn: zod_1.z.string().describe('Company Registration Number'),
|
|
23
|
-
govLink: zod_1.z.url().describe('Government Registration Link'),
|
|
23
|
+
govLink: zod_1.z.string().url().describe('Government Registration Link'),
|
|
24
24
|
status: ClientStatusSchema.describe('Client Status'),
|
|
25
25
|
director: zod_1.z.string().describe('Director Name'),
|
|
26
26
|
blacklistReason: zod_1.z
|
|
@@ -29,20 +29,21 @@ exports.ClientSchema = zod_1.z.object({
|
|
|
29
29
|
.optional()
|
|
30
30
|
.describe('Reason for Blacklisting'),
|
|
31
31
|
lastUpdatedBy: UserSchema.describe('Last Updated By'),
|
|
32
|
-
createdAt: zod_1.z.
|
|
33
|
-
updatedAt: zod_1.z.
|
|
32
|
+
createdAt: zod_1.z.string().datetime().describe('Creation Date'),
|
|
33
|
+
updatedAt: zod_1.z.string().datetime().describe('Last Update Date'),
|
|
34
34
|
version: zod_1.z.number().describe('Version Number'),
|
|
35
35
|
agentClientLinks: zod_1.z.object({ agentId: zod_1.z.string() }).describe('Agent Link'),
|
|
36
36
|
});
|
|
37
37
|
exports.CreateClientSchema = zod_1.z.object({
|
|
38
38
|
name: zod_1.z.string().max(255).describe('Client Name'),
|
|
39
|
-
govLink: zod_1.z.url().max(2048).describe('Government Registration Link'),
|
|
39
|
+
govLink: zod_1.z.string().url().max(2048).describe('Government Registration Link'),
|
|
40
40
|
director: zod_1.z.string().max(255).describe('Director Name'),
|
|
41
41
|
});
|
|
42
42
|
exports.UpdateClientSchema = zod_1.z
|
|
43
43
|
.object({
|
|
44
44
|
name: zod_1.z.string().max(255).optional().describe('Client Name'),
|
|
45
45
|
govLink: zod_1.z
|
|
46
|
+
.string()
|
|
46
47
|
.url()
|
|
47
48
|
.max(2048)
|
|
48
49
|
.optional()
|
|
@@ -79,10 +80,10 @@ exports.AutocompleteQuerySchema = zod_1.z.object({
|
|
|
79
80
|
});
|
|
80
81
|
exports.PaginatedResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.ClientSchema);
|
|
81
82
|
const c = (0, core_1.initContract)();
|
|
82
|
-
|
|
83
|
+
const clientsContractConfig = {
|
|
83
84
|
create: {
|
|
84
85
|
method: 'POST',
|
|
85
|
-
path: '/clients',
|
|
86
|
+
path: '/v2/clients',
|
|
86
87
|
responses: {
|
|
87
88
|
201: exports.ClientSchema,
|
|
88
89
|
400: error_schemas_1.ErrorResponseSchema,
|
|
@@ -96,7 +97,7 @@ exports.clientsContract = c.router({
|
|
|
96
97
|
},
|
|
97
98
|
findAll: {
|
|
98
99
|
method: 'GET',
|
|
99
|
-
path: '/clients',
|
|
100
|
+
path: '/v2/clients',
|
|
100
101
|
responses: {
|
|
101
102
|
200: exports.PaginatedResponseSchema,
|
|
102
103
|
400: error_schemas_1.ErrorResponseSchema,
|
|
@@ -109,7 +110,7 @@ exports.clientsContract = c.router({
|
|
|
109
110
|
},
|
|
110
111
|
autocomplete: {
|
|
111
112
|
method: 'GET',
|
|
112
|
-
path: '/clients/autocomplete',
|
|
113
|
+
path: '/v2/clients/autocomplete',
|
|
113
114
|
responses: {
|
|
114
115
|
200: zod_1.z.array(exports.ClientAutocompleteResponseSchema),
|
|
115
116
|
400: error_schemas_1.ErrorResponseSchema,
|
|
@@ -122,7 +123,7 @@ exports.clientsContract = c.router({
|
|
|
122
123
|
},
|
|
123
124
|
findOne: {
|
|
124
125
|
method: 'GET',
|
|
125
|
-
path: '/clients/:id',
|
|
126
|
+
path: '/v2/clients/:id',
|
|
126
127
|
responses: {
|
|
127
128
|
200: exports.ClientSchema,
|
|
128
129
|
400: error_schemas_1.ErrorResponseSchema,
|
|
@@ -132,13 +133,13 @@ exports.clientsContract = c.router({
|
|
|
132
133
|
500: error_schemas_1.ErrorResponseSchema,
|
|
133
134
|
},
|
|
134
135
|
pathParams: zod_1.z.object({
|
|
135
|
-
id: zod_1.z.uuid(),
|
|
136
|
+
id: zod_1.z.string().uuid(),
|
|
136
137
|
}),
|
|
137
138
|
summary: 'Get a client by ID',
|
|
138
139
|
},
|
|
139
140
|
update: {
|
|
140
141
|
method: 'PATCH',
|
|
141
|
-
path: '/clients/:id',
|
|
142
|
+
path: '/v2/clients/:id',
|
|
142
143
|
responses: {
|
|
143
144
|
200: exports.ClientSchema,
|
|
144
145
|
400: error_schemas_1.ErrorResponseSchema,
|
|
@@ -149,14 +150,14 @@ exports.clientsContract = c.router({
|
|
|
149
150
|
500: error_schemas_1.ErrorResponseSchema,
|
|
150
151
|
},
|
|
151
152
|
pathParams: zod_1.z.object({
|
|
152
|
-
id: zod_1.z.uuid(),
|
|
153
|
+
id: zod_1.z.string().uuid(),
|
|
153
154
|
}),
|
|
154
155
|
body: exports.UpdateClientSchema,
|
|
155
156
|
summary: 'Update a client',
|
|
156
157
|
},
|
|
157
158
|
remove: {
|
|
158
159
|
method: 'DELETE',
|
|
159
|
-
path: '/clients/:id',
|
|
160
|
+
path: '/v2/clients/:id',
|
|
160
161
|
responses: {
|
|
161
162
|
204: zod_1.z.null(),
|
|
162
163
|
400: error_schemas_1.ErrorResponseSchema,
|
|
@@ -166,11 +167,11 @@ exports.clientsContract = c.router({
|
|
|
166
167
|
500: error_schemas_1.ErrorResponseSchema,
|
|
167
168
|
},
|
|
168
169
|
pathParams: zod_1.z.object({
|
|
169
|
-
id: zod_1.z.uuid(),
|
|
170
|
+
id: zod_1.z.string().uuid(),
|
|
170
171
|
}),
|
|
171
172
|
body: zod_1.z.undefined(),
|
|
172
173
|
summary: 'Delete a client',
|
|
173
174
|
},
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
};
|
|
176
|
+
const clientsContractRouter = c.router(clientsContractConfig);
|
|
177
|
+
exports.clientsContract = clientsContractRouter;
|
|
@@ -11,6 +11,22 @@ export declare const ErrorResponseSchema: z.ZodObject<{
|
|
|
11
11
|
timestamp: z.ZodString;
|
|
12
12
|
path: z.ZodString;
|
|
13
13
|
correlationId: z.ZodOptional<z.ZodString>;
|
|
14
|
-
}, z.
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
statusCode: number;
|
|
16
|
+
message: string;
|
|
17
|
+
code: string;
|
|
18
|
+
timestamp: string;
|
|
19
|
+
path: string;
|
|
20
|
+
details?: unknown;
|
|
21
|
+
correlationId?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
statusCode: number;
|
|
24
|
+
message: string;
|
|
25
|
+
code: string;
|
|
26
|
+
timestamp: string;
|
|
27
|
+
path: string;
|
|
28
|
+
details?: unknown;
|
|
29
|
+
correlationId?: string | undefined;
|
|
30
|
+
}>;
|
|
15
31
|
export type ErrorResponseV2 = z.infer<typeof ErrorResponseSchema>;
|
|
16
32
|
//# sourceMappingURL=error-schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-schemas.d.ts","sourceRoot":"","sources":["../../contracts/common/error-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"error-schemas.d.ts","sourceRoot":"","sources":["../../contracts/common/error-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAQ9B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const createPaginatedResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodObject<{
|
|
3
|
-
data: z.ZodArray<T>;
|
|
3
|
+
data: z.ZodArray<T, "many">;
|
|
4
4
|
total: z.ZodNumber;
|
|
5
5
|
limit: z.ZodNumber;
|
|
6
6
|
skip: z.ZodNumber;
|
|
7
|
-
}, z.
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
data: T["_output"][];
|
|
9
|
+
total: number;
|
|
10
|
+
limit: number;
|
|
11
|
+
skip: number;
|
|
12
|
+
}, {
|
|
13
|
+
data: T["_input"][];
|
|
14
|
+
total: number;
|
|
15
|
+
limit: number;
|
|
16
|
+
skip: number;
|
|
17
|
+
}>;
|
|
8
18
|
//# sourceMappingURL=pagination.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.schema.d.ts","sourceRoot":"","sources":["../../contracts/common/pagination.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,6BAA6B,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAClE,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"pagination.schema.d.ts","sourceRoot":"","sources":["../../contracts/common/pagination.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,6BAA6B,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAClE,YAAY,CAAC;;;;;;;;;;;;;;;EAQd,CAAC"}
|