@dakkitor/api-contracts 1.1.2 → 1.1.4

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.
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;iBAiBvB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;iBAI7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;iBA2B5B,CAAC;AAEJ,eAAO,MAAM,kBAAkB;;;;;;;;;iBAK7B,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;iBAG3C,CAAC;AAEH,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBACS,CAAC;AAI9C,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,gCAAgC,CACxC,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E,QAAA,MAAM,qBAAqB;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EjC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clientsContract = exports.PaginatedResponseSchema = exports.AutocompleteQuerySchema = exports.ClientAutocompleteResponseSchema = exports.FilterClientSchema = exports.UpdateClientSchema = exports.CreateClientSchema = exports.ClientSchema = void 0;
3
+ exports.clientsContractRouter = exports.PaginatedResponseSchema = exports.AutocompleteQuerySchema = exports.ClientAutocompleteResponseSchema = exports.FilterClientSchema = exports.UpdateClientSchema = exports.CreateClientSchema = exports.ClientSchema = exports.ClientUserSchema = void 0;
4
4
  const core_1 = require("@ts-rest/core");
5
5
  const zod_1 = require("zod");
6
6
  const error_schemas_1 = require("../common/error-schemas");
@@ -10,17 +10,17 @@ const ClientStatusSchema = zod_1.z.enum([
10
10
  'PENDING_VERIFICATION',
11
11
  'BLACKLISTED',
12
12
  ]);
13
- const UserSchema = zod_1.z.object({
14
- id: zod_1.z.uuid(),
13
+ exports.ClientUserSchema = zod_1.z.object({
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
@@ -28,21 +28,22 @@ exports.ClientSchema = zod_1.z.object({
28
28
  .nullable()
29
29
  .optional()
30
30
  .describe('Reason for Blacklisting'),
31
- lastUpdatedBy: UserSchema.describe('Last Updated By'),
32
- createdAt: zod_1.z.iso.datetime().describe('Creation Date'),
33
- updatedAt: zod_1.z.iso.datetime().describe('Last Update Date'),
31
+ lastUpdatedBy: exports.ClientUserSchema.describe('Last Updated By'),
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,17 +80,13 @@ 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
- const clientsContractConfig = {
83
+ exports.clientsContractRouter = c.router({
83
84
  create: {
84
85
  method: 'POST',
85
86
  path: '/v2/clients',
86
87
  responses: {
87
88
  201: exports.ClientSchema,
88
- 400: error_schemas_1.ErrorResponseSchema,
89
- 401: error_schemas_1.ErrorResponseSchema,
90
- 403: error_schemas_1.ErrorResponseSchema,
91
89
  409: error_schemas_1.ErrorResponseSchema,
92
- 500: error_schemas_1.ErrorResponseSchema,
93
90
  },
94
91
  body: exports.CreateClientSchema,
95
92
  summary: 'Create a new client',
@@ -99,10 +96,6 @@ const clientsContractConfig = {
99
96
  path: '/v2/clients',
100
97
  responses: {
101
98
  200: exports.PaginatedResponseSchema,
102
- 400: error_schemas_1.ErrorResponseSchema,
103
- 401: error_schemas_1.ErrorResponseSchema,
104
- 403: error_schemas_1.ErrorResponseSchema,
105
- 500: error_schemas_1.ErrorResponseSchema,
106
99
  },
107
100
  query: exports.FilterClientSchema,
108
101
  summary: 'Get all clients',
@@ -112,10 +105,6 @@ const clientsContractConfig = {
112
105
  path: '/v2/clients/autocomplete',
113
106
  responses: {
114
107
  200: zod_1.z.array(exports.ClientAutocompleteResponseSchema),
115
- 400: error_schemas_1.ErrorResponseSchema,
116
- 401: error_schemas_1.ErrorResponseSchema,
117
- 403: error_schemas_1.ErrorResponseSchema,
118
- 500: error_schemas_1.ErrorResponseSchema,
119
108
  },
120
109
  query: exports.AutocompleteQuerySchema,
121
110
  summary: 'Get clients for autocomplete',
@@ -125,14 +114,10 @@ const clientsContractConfig = {
125
114
  path: '/v2/clients/:id',
126
115
  responses: {
127
116
  200: exports.ClientSchema,
128
- 400: error_schemas_1.ErrorResponseSchema,
129
- 401: error_schemas_1.ErrorResponseSchema,
130
- 403: error_schemas_1.ErrorResponseSchema,
131
117
  404: error_schemas_1.ErrorResponseSchema,
132
- 500: error_schemas_1.ErrorResponseSchema,
133
118
  },
134
119
  pathParams: zod_1.z.object({
135
- id: zod_1.z.uuid(),
120
+ id: zod_1.z.string().uuid(),
136
121
  }),
137
122
  summary: 'Get a client by ID',
138
123
  },
@@ -141,15 +126,11 @@ const clientsContractConfig = {
141
126
  path: '/v2/clients/:id',
142
127
  responses: {
143
128
  200: exports.ClientSchema,
144
- 400: error_schemas_1.ErrorResponseSchema,
145
- 401: error_schemas_1.ErrorResponseSchema,
146
- 403: error_schemas_1.ErrorResponseSchema,
147
129
  404: error_schemas_1.ErrorResponseSchema,
148
130
  409: error_schemas_1.ErrorResponseSchema,
149
- 500: error_schemas_1.ErrorResponseSchema,
150
131
  },
151
132
  pathParams: zod_1.z.object({
152
- id: zod_1.z.uuid(),
133
+ id: zod_1.z.string().uuid(),
153
134
  }),
154
135
  body: exports.UpdateClientSchema,
155
136
  summary: 'Update a client',
@@ -158,19 +139,20 @@ const clientsContractConfig = {
158
139
  method: 'DELETE',
159
140
  path: '/v2/clients/:id',
160
141
  responses: {
161
- 204: zod_1.z.null(),
162
- 400: error_schemas_1.ErrorResponseSchema,
163
- 401: error_schemas_1.ErrorResponseSchema,
164
- 403: error_schemas_1.ErrorResponseSchema,
142
+ 204: c.noBody(),
165
143
  404: error_schemas_1.ErrorResponseSchema,
166
- 500: error_schemas_1.ErrorResponseSchema,
167
144
  },
168
145
  pathParams: zod_1.z.object({
169
- id: zod_1.z.uuid(),
146
+ id: zod_1.z.string().uuid(),
170
147
  }),
171
- body: zod_1.z.undefined(),
148
+ body: c.noBody(),
172
149
  summary: 'Delete a client',
173
150
  },
174
- };
175
- const clientsContractRouter = c.router(clientsContractConfig);
176
- exports.clientsContract = clientsContractRouter;
151
+ }, {
152
+ commonResponses: {
153
+ 400: error_schemas_1.ErrorResponseSchema,
154
+ 401: error_schemas_1.ErrorResponseSchema,
155
+ 403: error_schemas_1.ErrorResponseSchema,
156
+ 500: error_schemas_1.ErrorResponseSchema,
157
+ },
158
+ });
@@ -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.core.$strip>;
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;;;;;;;;iBAQ9B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
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,24 @@
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>;
4
- total: z.ZodNumber;
3
+ items: z.ZodArray<T, "many">;
4
+ totalCount: z.ZodNumber;
5
5
  limit: z.ZodNumber;
6
6
  skip: z.ZodNumber;
7
- }, z.core.$strip>;
7
+ currentPage: z.ZodNumber;
8
+ totalPages: z.ZodNumber;
9
+ }, "strip", z.ZodTypeAny, {
10
+ items: T["_output"][];
11
+ totalCount: number;
12
+ limit: number;
13
+ skip: number;
14
+ currentPage: number;
15
+ totalPages: number;
16
+ }, {
17
+ items: T["_input"][];
18
+ totalCount: number;
19
+ limit: number;
20
+ skip: number;
21
+ currentPage: number;
22
+ totalPages: number;
23
+ }>;
8
24
  //# 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;;;;;iBAQd,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;;;;;;;;;;;;;;;;;;;;;EAUd,CAAC"}
@@ -4,10 +4,12 @@ exports.createPaginatedResponseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const createPaginatedResponseSchema = (itemSchema) => {
6
6
  return zod_1.z.object({
7
- data: zod_1.z.array(itemSchema).describe('Records'),
8
- total: zod_1.z.number().describe('Total count'),
9
- limit: zod_1.z.number().describe('Results per page'),
10
- skip: zod_1.z.number().describe('Records skipped'),
7
+ items: zod_1.z.array(itemSchema).describe('Array of items for the current page'),
8
+ totalCount: zod_1.z.number().describe('Total number of items available'),
9
+ limit: zod_1.z.number().describe('Number of items per page'),
10
+ skip: zod_1.z.number().describe('Number of items skipped (offset)'),
11
+ currentPage: zod_1.z.number().describe('Current page number'),
12
+ totalPages: zod_1.z.number().describe('Total number of pages'),
11
13
  });
12
14
  };
13
15
  exports.createPaginatedResponseSchema = createPaginatedResponseSchema;