@dakkitor/api-contracts 1.9.5 → 1.9.6

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.
@@ -13,6 +13,14 @@ export declare const CandidateLookupRowSchema: z.ZodObject<{
13
13
  matchedPostcode: z.ZodString;
14
14
  postcodeLevel: z.ZodEnum<["unit", "sector", "district", "area"]>;
15
15
  travelBorrowedKm: z.ZodNullable<z.ZodNumber>;
16
+ /**
17
+ * The postcode of the job the travel time was borrowed from, or null when no
18
+ * time could be borrowed. Travel times are never computed for the requested
19
+ * postcode itself — they come from a live job at that postcode sharing the
20
+ * requested trade. Surfacing the source keeps a borrowed number legible as
21
+ * borrowed.
22
+ */
23
+ travelFromPostcode: z.ZodNullable<z.ZodString>;
16
24
  }, "strip", z.ZodTypeAny, {
17
25
  workerName: string;
18
26
  phoneNumbers: string | null;
@@ -27,6 +35,7 @@ export declare const CandidateLookupRowSchema: z.ZodObject<{
27
35
  matchedPostcode: string;
28
36
  postcodeLevel: "unit" | "sector" | "district" | "area";
29
37
  travelBorrowedKm: number | null;
38
+ travelFromPostcode: string | null;
30
39
  }, {
31
40
  workerName: string;
32
41
  phoneNumbers: string | null;
@@ -41,10 +50,11 @@ export declare const CandidateLookupRowSchema: z.ZodObject<{
41
50
  matchedPostcode: string;
42
51
  postcodeLevel: "unit" | "sector" | "district" | "area";
43
52
  travelBorrowedKm: number | null;
53
+ travelFromPostcode: string | null;
44
54
  }>;
45
55
  export type CandidateLookupRow = z.infer<typeof CandidateLookupRowSchema>;
46
56
  export declare const CandidateLookupResponseSchema: z.ZodObject<{
47
- results: z.ZodArray<z.ZodObject<{
57
+ items: z.ZodArray<z.ZodObject<{
48
58
  workerName: z.ZodString;
49
59
  phoneNumbers: z.ZodNullable<z.ZodString>;
50
60
  distanceKm: z.ZodNumber;
@@ -58,6 +68,14 @@ export declare const CandidateLookupResponseSchema: z.ZodObject<{
58
68
  matchedPostcode: z.ZodString;
59
69
  postcodeLevel: z.ZodEnum<["unit", "sector", "district", "area"]>;
60
70
  travelBorrowedKm: z.ZodNullable<z.ZodNumber>;
71
+ /**
72
+ * The postcode of the job the travel time was borrowed from, or null when no
73
+ * time could be borrowed. Travel times are never computed for the requested
74
+ * postcode itself — they come from a live job at that postcode sharing the
75
+ * requested trade. Surfacing the source keeps a borrowed number legible as
76
+ * borrowed.
77
+ */
78
+ travelFromPostcode: z.ZodNullable<z.ZodString>;
61
79
  }, "strip", z.ZodTypeAny, {
62
80
  workerName: string;
63
81
  phoneNumbers: string | null;
@@ -72,6 +90,7 @@ export declare const CandidateLookupResponseSchema: z.ZodObject<{
72
90
  matchedPostcode: string;
73
91
  postcodeLevel: "unit" | "sector" | "district" | "area";
74
92
  travelBorrowedKm: number | null;
93
+ travelFromPostcode: string | null;
75
94
  }, {
76
95
  workerName: string;
77
96
  phoneNumbers: string | null;
@@ -86,9 +105,15 @@ export declare const CandidateLookupResponseSchema: z.ZodObject<{
86
105
  matchedPostcode: string;
87
106
  postcodeLevel: "unit" | "sector" | "district" | "area";
88
107
  travelBorrowedKm: number | null;
108
+ travelFromPostcode: string | null;
89
109
  }>, "many">;
110
+ totalCount: z.ZodNumber;
111
+ limit: z.ZodNumber;
112
+ skip: z.ZodNumber;
113
+ currentPage: z.ZodNumber;
114
+ totalPages: z.ZodNumber;
90
115
  }, "strip", z.ZodTypeAny, {
91
- results: {
116
+ items: {
92
117
  workerName: string;
93
118
  phoneNumbers: string | null;
94
119
  distanceKm: number;
@@ -102,9 +127,15 @@ export declare const CandidateLookupResponseSchema: z.ZodObject<{
102
127
  matchedPostcode: string;
103
128
  postcodeLevel: "unit" | "sector" | "district" | "area";
104
129
  travelBorrowedKm: number | null;
130
+ travelFromPostcode: string | null;
105
131
  }[];
132
+ totalCount: number;
133
+ limit: number;
134
+ skip: number;
135
+ currentPage: number;
136
+ totalPages: number;
106
137
  }, {
107
- results: {
138
+ items: {
108
139
  workerName: string;
109
140
  phoneNumbers: string | null;
110
141
  distanceKm: number;
@@ -118,7 +149,33 @@ export declare const CandidateLookupResponseSchema: z.ZodObject<{
118
149
  matchedPostcode: string;
119
150
  postcodeLevel: "unit" | "sector" | "district" | "area";
120
151
  travelBorrowedKm: number | null;
152
+ travelFromPostcode: string | null;
121
153
  }[];
154
+ totalCount: number;
155
+ limit: number;
156
+ skip: number;
157
+ currentPage: number;
158
+ totalPages: number;
159
+ }>;
160
+ export declare const CandidateLookupQuerySchema: z.ZodObject<{
161
+ limit: z.ZodDefault<z.ZodNumber>;
162
+ page: z.ZodDefault<z.ZodNumber>;
163
+ } & {
164
+ postcode: z.ZodString;
165
+ tradeId: z.ZodString;
166
+ radiusM: z.ZodDefault<z.ZodNumber>;
167
+ }, "strip", z.ZodTypeAny, {
168
+ limit: number;
169
+ page: number;
170
+ postcode: string;
171
+ tradeId: string;
172
+ radiusM: number;
173
+ }, {
174
+ postcode: string;
175
+ tradeId: string;
176
+ limit?: number | undefined;
177
+ page?: number | undefined;
178
+ radiusM?: number | undefined;
122
179
  }>;
123
180
  export declare const candidateLookupContract: {
124
181
  lookup: {
@@ -126,16 +183,23 @@ export declare const candidateLookupContract: {
126
183
  tags: string[];
127
184
  };
128
185
  query: z.ZodObject<{
186
+ limit: z.ZodDefault<z.ZodNumber>;
187
+ page: z.ZodDefault<z.ZodNumber>;
188
+ } & {
129
189
  postcode: z.ZodString;
130
190
  tradeId: z.ZodString;
131
- radiusM: z.ZodOptional<z.ZodNumber>;
191
+ radiusM: z.ZodDefault<z.ZodNumber>;
132
192
  }, "strip", z.ZodTypeAny, {
193
+ limit: number;
194
+ page: number;
133
195
  postcode: string;
134
196
  tradeId: string;
135
- radiusM?: number | undefined;
197
+ radiusM: number;
136
198
  }, {
137
199
  postcode: string;
138
200
  tradeId: string;
201
+ limit?: number | undefined;
202
+ page?: number | undefined;
139
203
  radiusM?: number | undefined;
140
204
  }>;
141
205
  summary: "Curated workers near a postcode for a given trade";
@@ -143,7 +207,7 @@ export declare const candidateLookupContract: {
143
207
  path: "/v2/candidate-lookup";
144
208
  responses: {
145
209
  200: z.ZodObject<{
146
- results: z.ZodArray<z.ZodObject<{
210
+ items: z.ZodArray<z.ZodObject<{
147
211
  workerName: z.ZodString;
148
212
  phoneNumbers: z.ZodNullable<z.ZodString>;
149
213
  distanceKm: z.ZodNumber;
@@ -157,6 +221,14 @@ export declare const candidateLookupContract: {
157
221
  matchedPostcode: z.ZodString;
158
222
  postcodeLevel: z.ZodEnum<["unit", "sector", "district", "area"]>;
159
223
  travelBorrowedKm: z.ZodNullable<z.ZodNumber>;
224
+ /**
225
+ * The postcode of the job the travel time was borrowed from, or null when no
226
+ * time could be borrowed. Travel times are never computed for the requested
227
+ * postcode itself — they come from a live job at that postcode sharing the
228
+ * requested trade. Surfacing the source keeps a borrowed number legible as
229
+ * borrowed.
230
+ */
231
+ travelFromPostcode: z.ZodNullable<z.ZodString>;
160
232
  }, "strip", z.ZodTypeAny, {
161
233
  workerName: string;
162
234
  phoneNumbers: string | null;
@@ -171,6 +243,7 @@ export declare const candidateLookupContract: {
171
243
  matchedPostcode: string;
172
244
  postcodeLevel: "unit" | "sector" | "district" | "area";
173
245
  travelBorrowedKm: number | null;
246
+ travelFromPostcode: string | null;
174
247
  }, {
175
248
  workerName: string;
176
249
  phoneNumbers: string | null;
@@ -185,9 +258,15 @@ export declare const candidateLookupContract: {
185
258
  matchedPostcode: string;
186
259
  postcodeLevel: "unit" | "sector" | "district" | "area";
187
260
  travelBorrowedKm: number | null;
261
+ travelFromPostcode: string | null;
188
262
  }>, "many">;
263
+ totalCount: z.ZodNumber;
264
+ limit: z.ZodNumber;
265
+ skip: z.ZodNumber;
266
+ currentPage: z.ZodNumber;
267
+ totalPages: z.ZodNumber;
189
268
  }, "strip", z.ZodTypeAny, {
190
- results: {
269
+ items: {
191
270
  workerName: string;
192
271
  phoneNumbers: string | null;
193
272
  distanceKm: number;
@@ -201,9 +280,15 @@ export declare const candidateLookupContract: {
201
280
  matchedPostcode: string;
202
281
  postcodeLevel: "unit" | "sector" | "district" | "area";
203
282
  travelBorrowedKm: number | null;
283
+ travelFromPostcode: string | null;
204
284
  }[];
285
+ totalCount: number;
286
+ limit: number;
287
+ skip: number;
288
+ currentPage: number;
289
+ totalPages: number;
205
290
  }, {
206
- results: {
291
+ items: {
207
292
  workerName: string;
208
293
  phoneNumbers: string | null;
209
294
  distanceKm: number;
@@ -217,7 +302,13 @@ export declare const candidateLookupContract: {
217
302
  matchedPostcode: string;
218
303
  postcodeLevel: "unit" | "sector" | "district" | "area";
219
304
  travelBorrowedKm: number | null;
305
+ travelFromPostcode: string | null;
220
306
  }[];
307
+ totalCount: number;
308
+ limit: number;
309
+ skip: number;
310
+ currentPage: number;
311
+ totalPages: number;
221
312
  }>;
222
313
  400: z.ZodObject<{
223
314
  statusCode: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"candidate-lookup.contract.d.ts","sourceRoot":"","sources":["../../contracts/candidate-lookup/candidate-lookup.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAExC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBlC,CAAC"}
1
+ {"version":3,"file":"candidate-lookup.contract.d.ts","sourceRoot":"","sources":["../../contracts/candidate-lookup/candidate-lookup.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;IAcnC;;;;;;OAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;QAZxC;;;;;;WAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQJ,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;EAIrC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAtBlC;;;;;;uBAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BH,CAAC"}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.candidateLookupContract = exports.CandidateLookupResponseSchema = exports.CandidateLookupRowSchema = void 0;
3
+ exports.candidateLookupContract = exports.CandidateLookupQuerySchema = exports.CandidateLookupResponseSchema = exports.CandidateLookupRowSchema = 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");
7
+ const pagination_query_schema_1 = require("../common/pagination-query.schema");
8
+ const pagination_schema_1 = require("../common/pagination.schema");
7
9
  const c = (0, core_1.initContract)();
8
10
  exports.CandidateLookupRowSchema = zod_1.z.object({
9
11
  workerName: zod_1.z.string(),
@@ -19,19 +21,26 @@ exports.CandidateLookupRowSchema = zod_1.z.object({
19
21
  matchedPostcode: zod_1.z.string(),
20
22
  postcodeLevel: zod_1.z.enum(['unit', 'sector', 'district', 'area']),
21
23
  travelBorrowedKm: zod_1.z.number().nullable(),
24
+ /**
25
+ * The postcode of the job the travel time was borrowed from, or null when no
26
+ * time could be borrowed. Travel times are never computed for the requested
27
+ * postcode itself — they come from a live job at that postcode sharing the
28
+ * requested trade. Surfacing the source keeps a borrowed number legible as
29
+ * borrowed.
30
+ */
31
+ travelFromPostcode: zod_1.z.string().nullable(),
22
32
  });
23
- exports.CandidateLookupResponseSchema = zod_1.z.object({
24
- results: zod_1.z.array(exports.CandidateLookupRowSchema),
33
+ exports.CandidateLookupResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.CandidateLookupRowSchema);
34
+ exports.CandidateLookupQuerySchema = pagination_query_schema_1.PaginationQuerySchema.extend({
35
+ postcode: zod_1.z.string().trim().min(1).max(10),
36
+ tradeId: zod_1.z.string().uuid(),
37
+ radiusM: zod_1.z.coerce.number().int().min(100).max(55000).default(55000),
25
38
  });
26
39
  exports.candidateLookupContract = c.router({
27
40
  lookup: {
28
41
  method: 'GET',
29
42
  path: '/v2/candidate-lookup',
30
- query: zod_1.z.object({
31
- postcode: zod_1.z.string().trim().min(1).max(10),
32
- tradeId: zod_1.z.string().uuid(),
33
- radiusM: zod_1.z.coerce.number().int().min(100).max(55000).optional(),
34
- }),
43
+ query: exports.CandidateLookupQuerySchema,
35
44
  responses: {
36
45
  200: exports.CandidateLookupResponseSchema,
37
46
  400: error_schemas_1.ErrorResponseSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dakkitor/api-contracts",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "TypeScript API contracts using ts-rest and Zod",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",