@dakkitor/api-contracts 1.1.131 → 1.1.133

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.
Files changed (63) hide show
  1. package/dist/abilities/abilities.contract.d.ts +19 -13
  2. package/dist/abilities/abilities.contract.js +33 -18
  3. package/dist/abilities/first-agent.abilities.json +68 -56
  4. package/dist/abilities/second-agent.abilities.json +3 -3
  5. package/dist/abilities/team-leads.json +3 -6
  6. package/dist/actives/actives.contract.d.ts +6313 -6313
  7. package/dist/actives/actives.contract.js +92 -92
  8. package/dist/agent-client-links/agent-client-links.contract.d.ts +511 -511
  9. package/dist/auth/auth.contract.d.ts +16 -16
  10. package/dist/bookings/bookings.contract.d.ts +23378 -23378
  11. package/dist/call-history/call-history.contract.d.ts +366 -366
  12. package/dist/call-history/call-history.contract.js +67 -67
  13. package/dist/client-contacts/client-contacts.contract.d.ts +159 -159
  14. package/dist/clients/clients.contract.d.ts +72 -72
  15. package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts +1330 -1330
  16. package/dist/collaborations/collaborations.contract.d.ts +1198 -1198
  17. package/dist/common/call-rating.schema.d.ts +12 -12
  18. package/dist/common/call-rating.schema.js +48 -40
  19. package/dist/common/common-schemas.d.ts +4 -4
  20. package/dist/common/common-schemas.d.ts.map +1 -1
  21. package/dist/common/common-schemas.js +1 -2
  22. package/dist/common/error-schemas.d.ts +11 -5
  23. package/dist/common/error-schemas.js +11 -8
  24. package/dist/common/openapi-metadata.d.ts +54 -44
  25. package/dist/common/openapi-metadata.js +135 -129
  26. package/dist/common/pagination-query.schema.d.ts +11 -5
  27. package/dist/common/pagination-query.schema.js +11 -8
  28. package/dist/companies/companies.contract.d.ts +40 -40
  29. package/dist/cron-executions/cron-executions.contract.d.ts +14 -14
  30. package/dist/curated-workers/curated-workers.contract.d.ts +211 -211
  31. package/dist/dashboards/agent-daily-metrics.contract.d.ts +798 -616
  32. package/dist/dashboards/agent-daily-metrics.contract.js +100 -89
  33. package/dist/dashboards/dashboard-widgets.contract.d.ts +75 -75
  34. package/dist/dashboards/dashboard-widgets.contract.js +89 -89
  35. package/dist/dashboards/dashboard.contract.d.ts +305 -215
  36. package/dist/files/files.contract.d.ts +1544 -1177
  37. package/dist/files/files.contract.js +177 -162
  38. package/dist/health/health.contract.d.ts +191 -144
  39. package/dist/health/health.contract.js +53 -40
  40. package/dist/index.d.ts +67 -67
  41. package/dist/jobs/jobs.contract.d.ts +2553 -2553
  42. package/dist/jobs/jobs.contract.js +150 -150
  43. package/dist/lead-assignments/lead-assignments.contract.d.ts +587 -587
  44. package/dist/lead-distribution/agent-lead-distribution.contract.d.ts +239 -239
  45. package/dist/lead-distribution/lead-distribution-config.contract.d.ts +25 -25
  46. package/dist/leads/leads.contract.d.ts +108 -108
  47. package/dist/leads/leads.contract.js +119 -119
  48. package/dist/locations/locations.contract.d.ts +7 -7
  49. package/dist/monitoring/monitoring.contract.d.ts +13 -13
  50. package/dist/monitoring/monitoring.contract.js +37 -37
  51. package/dist/own-research/own-research.contract.d.ts +535 -134
  52. package/dist/own-research/own-research.contract.d.ts.map +1 -1
  53. package/dist/own-research/own-research.contract.js +88 -56
  54. package/dist/postcodes/postcodes.contract.d.ts +24 -24
  55. package/dist/qualifications/qualifications.contract.d.ts +1898 -1387
  56. package/dist/qualifications/qualifications.contract.js +193 -171
  57. package/dist/trades/trades.contract.d.ts +991 -763
  58. package/dist/trades/trades.contract.js +111 -89
  59. package/dist/users/users.contract.d.ts +202 -202
  60. package/dist/users/users.contract.js +121 -121
  61. package/dist/workers/workers.contract.d.ts +710 -710
  62. package/dist/workers/workers.contract.js +150 -150
  63. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"own-research.contract.d.ts","sourceRoot":"","sources":["../../contracts/own-research/own-research.contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,qBAAqB;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE/B,CAAC"}
@@ -6,60 +6,61 @@
6
6
  * Description: Contract definition for Own Research API - allows agents to add and call their own leads.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ownResearchContract = exports.AgentInfoResponseSchema = exports.AddOwnResearchLeadResponseSchema = exports.AddOwnResearchLeadSchema = exports.RecordOwnResearchCallResponseSchema = exports.RecordOwnResearchCallSchema = exports.CheckPhoneRequestSchema = exports.CheckPhoneResponseSchema = exports.OwnResearchLeadSchema = void 0;
9
+ exports.ownResearchContract = exports.PaginatedOwnResearchLeadResponseSchema = exports.FilterOwnResearchLeadSchema = exports.OwnResearchLeadSortableFieldsSchema = exports.AgentInfoResponseSchema = exports.AddOwnResearchLeadResponseSchema = exports.AddOwnResearchLeadSchema = exports.RecordOwnResearchCallResponseSchema = exports.RecordOwnResearchCallSchema = exports.CheckPhoneRequestSchema = exports.CheckPhoneResponseSchema = exports.OwnResearchLeadSchema = void 0;
10
10
  const zod_openapi_1 = require("@anatine/zod-openapi");
11
11
  const core_1 = require("@ts-rest/core");
12
12
  const zod_1 = require("zod");
13
13
  const call_rating_schema_1 = require("../common/call-rating.schema");
14
14
  const common_schemas_1 = require("../common/common-schemas");
15
15
  const error_schemas_1 = require("../common/error-schemas");
16
+ const pagination_query_schema_1 = require("../common/pagination-query.schema");
17
+ const pagination_schema_1 = require("../common/pagination.schema");
16
18
  const lead_assignments_contract_1 = require("../lead-assignments/lead-assignments.contract");
19
+ const leads_contract_1 = require("../leads/leads.contract");
17
20
  (0, zod_openapi_1.extendZodWithOpenApi)(zod_1.z);
18
21
  const c = (0, core_1.initContract)();
19
22
  // Schemas
20
- exports.OwnResearchLeadSchema = zod_1.z
21
- .object({
22
- id: zod_1.z.string().uuid().describe("Own research lead ID"),
23
- agentId: zod_1.z.string().uuid().describe("Agent who owns this lead"),
24
- name: zod_1.z.string().describe("Lead contact name"),
25
- phoneNumber: zod_1.z.string().describe("Lead phone number"),
26
- source: zod_1.z.string().describe("Lead source"),
27
- status: zod_1.z.string().describe("Lead status"),
28
- callCount: zod_1.z.number().int().describe("Number of calls made"),
23
+ exports.OwnResearchLeadSchema = zod_1.z.object({
24
+ id: zod_1.z.string().uuid().describe('Own research lead ID'),
25
+ agentId: zod_1.z.string().uuid().describe('Agent who owns this lead'),
26
+ name: zod_1.z.string().describe('Lead contact name'),
27
+ phoneNumber: zod_1.z.string().describe('Lead phone number'),
28
+ source: zod_1.z.string().describe('Lead source'),
29
+ status: leads_contract_1.LeadStatusSchema.describe('Lead status'),
30
+ callCount: zod_1.z.number().int().describe('Number of calls made'),
29
31
  lastCalledAt: zod_1.z
30
32
  .union([zod_1.z.string().datetime(), zod_1.z.date()])
31
33
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
32
34
  .nullable()
33
- .describe("Last call date"),
35
+ .describe('Last call date'),
34
36
  cooldownUntil: zod_1.z
35
37
  .union([zod_1.z.string().datetime(), zod_1.z.date()])
36
38
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
37
39
  .nullable()
38
- .describe("Cooldown expiry date"),
39
- blacklistReason: zod_1.z.string().nullable().describe("Blacklist reason"),
40
+ .describe('Cooldown expiry date'),
41
+ blacklistReason: zod_1.z.string().nullable().describe('Blacklist reason'),
40
42
  existsInLeadsTable: zod_1.z
41
43
  .boolean()
42
- .describe("Whether this lead also exists in the main leads table"),
44
+ .describe('Whether this lead also exists in the main leads table'),
43
45
  originalLeadId: zod_1.z
44
46
  .string()
45
47
  .uuid()
46
48
  .nullable()
47
- .describe("ID of the matching lead in the main leads table"),
49
+ .describe('ID of the matching lead in the main leads table'),
48
50
  createdAt: zod_1.z
49
51
  .union([zod_1.z.string().datetime(), zod_1.z.date()])
50
52
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
51
- .describe("Creation date"),
53
+ .describe('Creation date'),
52
54
  updatedAt: zod_1.z
53
55
  .union([zod_1.z.string().datetime(), zod_1.z.date()])
54
56
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
55
- .describe("Last update date"),
56
- })
57
- .openapi({ title: "OwnResearchLead" });
57
+ .describe('Last update date'),
58
+ });
58
59
  exports.CheckPhoneResponseSchema = zod_1.z
59
60
  .object({
60
61
  existsInLeads: zod_1.z
61
62
  .boolean()
62
- .describe("Whether the phone number exists in the main leads table"),
63
+ .describe('Whether the phone number exists in the main leads table'),
63
64
  existsInOwnResearch: zod_1.z
64
65
  .boolean()
65
66
  .describe("Whether the phone number exists in the agent's own research leads"),
@@ -74,112 +75,143 @@ exports.CheckPhoneResponseSchema = zod_1.z
74
75
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
75
76
  .nullable(),
76
77
  })
78
+ .openapi({ title: 'MatchingLeadInfo' })
77
79
  .nullable()
78
80
  .optional()
79
- .describe("Existing lead from the main leads table"),
81
+ .describe('Existing lead from the main leads table'),
80
82
  ownResearchLead: exports.OwnResearchLeadSchema.nullable()
81
83
  .optional()
82
84
  .describe("Existing lead from the agent's own research"),
83
85
  isOnCooldown: zod_1.z
84
86
  .boolean()
85
- .describe("Whether the lead is currently on cooldown"),
87
+ .describe('Whether the lead is currently on cooldown'),
86
88
  cooldownUntil: zod_1.z
87
89
  .union([zod_1.z.string().datetime(), zod_1.z.date()])
88
90
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
89
91
  .nullable()
90
- .describe("Cooldown expiry date if on cooldown"),
92
+ .describe('Cooldown expiry date if on cooldown'),
91
93
  })
92
- .openapi({ title: "CheckPhoneResponse" });
94
+ .openapi({ title: 'CheckPhoneResponse' });
93
95
  exports.CheckPhoneRequestSchema = zod_1.z
94
96
  .object({
95
- phoneNumber: zod_1.z.string().min(1).max(20).describe("Phone number to check"),
97
+ phoneNumber: common_schemas_1.PhoneSchema.describe('Phone number to check'),
96
98
  })
97
- .openapi({ title: "CheckPhoneRequest" });
99
+ .openapi({ title: 'CheckPhoneRequest' });
98
100
  exports.RecordOwnResearchCallSchema = zod_1.z
99
101
  .object({
100
- phoneNumber: common_schemas_1.PhoneSchema.describe("Lead phone number"),
101
- name: zod_1.z.string().min(1).max(255).describe("Lead contact name"),
102
- rating: call_rating_schema_1.CallRatingSchema.describe("Call rating"),
102
+ phoneNumber: common_schemas_1.PhoneSchema.describe('Lead phone number'),
103
+ name: zod_1.z.string().min(1).max(255).describe('Lead contact name'),
104
+ rating: call_rating_schema_1.CallRatingSchema.describe('Call rating'),
103
105
  notes: zod_1.z
104
106
  .string()
105
107
  .max(1000)
106
108
  .optional()
107
- .describe("Optional notes about the call"),
109
+ .describe('Optional notes about the call'),
108
110
  })
109
- .openapi({ title: "RecordOwnResearchCall" });
111
+ .openapi({ title: 'RecordOwnResearchCall' });
110
112
  exports.RecordOwnResearchCallResponseSchema = zod_1.z
111
113
  .object({
112
- assignment: lead_assignments_contract_1.LeadAssignmentSchema.describe("The completed assignment"),
113
- ownResearchLead: exports.OwnResearchLeadSchema.describe("The own research lead record"),
114
+ assignment: lead_assignments_contract_1.LeadAssignmentSchema.describe('The completed assignment'),
115
+ ownResearchLead: exports.OwnResearchLeadSchema.describe('The own research lead record'),
114
116
  })
115
- .openapi({ title: "RecordOwnResearchCallResponse" });
117
+ .openapi({ title: 'RecordOwnResearchCallResponse' });
116
118
  exports.AddOwnResearchLeadSchema = zod_1.z
117
119
  .object({
118
- phoneNumber: common_schemas_1.PhoneSchema.describe("Lead phone number"),
119
- name: zod_1.z.string().min(1).max(255).describe("Lead contact name"),
120
+ phoneNumber: common_schemas_1.PhoneSchema.describe('Lead phone number'),
121
+ name: zod_1.z.string().min(1).max(255).describe('Lead contact name'),
120
122
  })
121
- .openapi({ title: "AddOwnResearchLead" });
123
+ .openapi({ title: 'AddOwnResearchLead' });
122
124
  exports.AddOwnResearchLeadResponseSchema = zod_1.z
123
125
  .object({
124
- ownResearchLead: exports.OwnResearchLeadSchema.describe("The created or existing own research lead record"),
126
+ ownResearchLead: exports.OwnResearchLeadSchema.describe('The created or existing own research lead record'),
125
127
  })
126
- .openapi({ title: "AddOwnResearchLeadResponse" });
128
+ .openapi({ title: 'AddOwnResearchLeadResponse' });
127
129
  exports.AgentInfoResponseSchema = zod_1.z
128
130
  .object({
129
131
  companyId: zod_1.z.string().uuid().nullable().describe("Agent's company ID"),
130
132
  companyName: zod_1.z.string().nullable().describe("Agent's company name"),
131
133
  })
132
- .openapi({ title: "AgentInfoResponse" });
134
+ .openapi({ title: 'AgentInfoResponse' });
135
+ exports.OwnResearchLeadSortableFieldsSchema = zod_1.z
136
+ .enum(['createdAt', 'updatedAt', 'lastCalledAt', 'callCount', 'name'])
137
+ .openapi({ title: 'OwnResearchLeadSortableFields' });
138
+ exports.FilterOwnResearchLeadSchema = pagination_query_schema_1.PaginationQuerySchema.extend({
139
+ name: zod_1.z.string().optional().describe('Filter by lead contact name'),
140
+ phoneNumber: zod_1.z.string().optional().describe('Filter by lead phone number'),
141
+ status: leads_contract_1.LeadStatusSchema.optional().describe('Filter by lead status'),
142
+ minTotalCalls: zod_1.z
143
+ .number()
144
+ .optional()
145
+ .describe('Filter by minimum number of calls made'),
146
+ lastCalledAt: common_schemas_1.DateRangeSchema.optional().describe('Filter by last call date range'),
147
+ sortBy: exports.OwnResearchLeadSortableFieldsSchema.optional().describe('The field to sort the results by'),
148
+ sortOrder: common_schemas_1.SortOrderSchema.optional().describe('The order to sort the results by'),
149
+ });
150
+ exports.PaginatedOwnResearchLeadResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.OwnResearchLeadSchema)
151
+ .describe('Own research leads retrieved successfully')
152
+ .openapi({ title: 'OwnResearchLeadsPaginatedResponse' });
133
153
  exports.ownResearchContract = c.router({
134
154
  getAgentInfo: {
135
- method: "GET",
136
- path: "/own-research/agent-info",
155
+ method: 'GET',
156
+ path: '/own-research/agent-info',
137
157
  responses: {
138
158
  200: exports.AgentInfoResponseSchema,
139
159
  },
140
160
  summary: "Get the current agent's company info for own research",
141
161
  metadata: {
142
- tags: ["Own Research"],
162
+ tags: ['Own Research'],
163
+ },
164
+ },
165
+ findAll: {
166
+ method: 'GET',
167
+ path: '/own-research/leads',
168
+ query: exports.FilterOwnResearchLeadSchema,
169
+ responses: {
170
+ 200: exports.PaginatedOwnResearchLeadResponseSchema,
171
+ },
172
+ summary: 'Get all own research leads for the current agent',
173
+ metadata: {
174
+ tags: ['Own Research'],
143
175
  },
144
176
  },
145
177
  checkPhone: {
146
- method: "POST",
147
- path: "/own-research/check-phone",
178
+ method: 'POST',
179
+ path: '/own-research/check-phone',
148
180
  body: exports.CheckPhoneRequestSchema,
149
181
  responses: {
150
182
  200: exports.CheckPhoneResponseSchema,
151
183
  },
152
- summary: "Check if a phone number exists in leads or own research",
184
+ summary: 'Check if a phone number exists in leads or own research',
153
185
  metadata: {
154
- tags: ["Own Research"],
186
+ tags: ['Own Research'],
155
187
  },
156
188
  },
157
189
  addLead: {
158
- method: "POST",
159
- path: "/own-research/leads",
190
+ method: 'POST',
191
+ path: '/own-research/leads',
160
192
  body: exports.AddOwnResearchLeadSchema,
161
193
  responses: {
162
194
  201: exports.AddOwnResearchLeadResponseSchema,
163
195
  },
164
- summary: "Add a lead to own research without recording a call",
196
+ summary: 'Add a lead to own research without recording a call',
165
197
  metadata: {
166
- tags: ["Own Research"],
198
+ tags: ['Own Research'],
167
199
  },
168
200
  },
169
201
  recordCall: {
170
- method: "POST",
171
- path: "/own-research/call",
202
+ method: 'POST',
203
+ path: '/own-research/call',
172
204
  body: exports.RecordOwnResearchCallSchema,
173
205
  responses: {
174
206
  201: exports.RecordOwnResearchCallResponseSchema,
175
207
  },
176
- summary: "Record an own research call (creates lead, assignment, and call history)",
208
+ summary: 'Record an own research call (creates lead, assignment, and call history)',
177
209
  metadata: {
178
- tags: ["Own Research"],
210
+ tags: ['Own Research'],
179
211
  },
180
212
  },
181
213
  }, {
182
- pathPrefix: "/v2",
214
+ pathPrefix: '/v2',
183
215
  commonResponses: {
184
216
  400: error_schemas_1.ErrorResponseSchema,
185
217
  401: error_schemas_1.ErrorResponseSchema,
@@ -13,11 +13,11 @@ export declare const PostcodeAutocompleteResponseSchema: z.ZodObject<{
13
13
  id: z.ZodString;
14
14
  code: z.ZodString;
15
15
  }, "strip", z.ZodTypeAny, {
16
- id: string;
17
16
  code: string;
18
- }, {
19
17
  id: string;
18
+ }, {
20
19
  code: string;
20
+ id: string;
21
21
  }>;
22
22
  export declare const PostcodeSearchQuerySchema: z.ZodObject<{
23
23
  limit: z.ZodDefault<z.ZodNumber>;
@@ -25,13 +25,13 @@ export declare const PostcodeSearchQuerySchema: z.ZodObject<{
25
25
  } & {
26
26
  query: z.ZodString;
27
27
  }, "strip", z.ZodTypeAny, {
28
- query: string;
29
- limit: number;
30
28
  page: number;
29
+ limit: number;
30
+ query: string;
31
31
  }, {
32
32
  query: string;
33
- limit?: number | undefined;
34
33
  page?: number | undefined;
34
+ limit?: number | undefined;
35
35
  }>;
36
36
  export declare const PostcodeSearchResultSchema: z.ZodObject<{
37
37
  code: z.ZodString;
@@ -40,12 +40,12 @@ export declare const PostcodeSearchResultSchema: z.ZodObject<{
40
40
  relevance: z.ZodNumber;
41
41
  }, "strip", z.ZodTypeAny, {
42
42
  code: string;
43
- type: "area" | "district" | "sector" | "postcode";
43
+ type: "postcode" | "area" | "district" | "sector";
44
44
  relevance: number;
45
45
  description?: string | undefined;
46
46
  }, {
47
47
  code: string;
48
- type: "area" | "district" | "sector" | "postcode";
48
+ type: "postcode" | "area" | "district" | "sector";
49
49
  relevance: number;
50
50
  description?: string | undefined;
51
51
  }>;
@@ -53,11 +53,11 @@ export declare const PostcodeAutocompleteArraySchema: z.ZodArray<z.ZodObject<{
53
53
  id: z.ZodString;
54
54
  code: z.ZodString;
55
55
  }, "strip", z.ZodTypeAny, {
56
- id: string;
57
56
  code: string;
58
- }, {
59
57
  id: string;
58
+ }, {
60
59
  code: string;
60
+ id: string;
61
61
  }>, "many">;
62
62
  export type PostcodeAutocompleteQuery = z.infer<typeof PostcodeAutocompleteQuerySchema>;
63
63
  export type PostcodeAutocompleteResponse = z.infer<typeof PostcodeAutocompleteResponseSchema>;
@@ -66,9 +66,6 @@ export type PostcodeSearchQuery = z.infer<typeof PostcodeSearchQuerySchema>;
66
66
  export type PostcodeSearchResult = z.infer<typeof PostcodeSearchResultSchema>;
67
67
  export declare const postcodesContract: {
68
68
  autocomplete: {
69
- metadata: {
70
- tags: string[];
71
- };
72
69
  query: z.ZodObject<{
73
70
  query: z.ZodOptional<z.ZodString>;
74
71
  id: z.ZodOptional<z.ZodString>;
@@ -79,6 +76,9 @@ export declare const postcodesContract: {
79
76
  id?: string | undefined;
80
77
  query?: string | undefined;
81
78
  }>;
79
+ metadata: {
80
+ tags: string[];
81
+ };
82
82
  summary: "Get postcodes for autocomplete";
83
83
  method: "GET";
84
84
  path: "/v1/postcodes/autocomplete";
@@ -187,32 +187,32 @@ export declare const postcodesContract: {
187
187
  id: z.ZodString;
188
188
  code: z.ZodString;
189
189
  }, "strip", z.ZodTypeAny, {
190
- id: string;
191
190
  code: string;
192
- }, {
193
191
  id: string;
192
+ }, {
194
193
  code: string;
194
+ id: string;
195
195
  }>, "many">;
196
196
  };
197
197
  };
198
198
  search: {
199
- metadata: {
200
- tags: string[];
201
- };
202
199
  query: z.ZodObject<{
203
200
  limit: z.ZodDefault<z.ZodNumber>;
204
201
  page: z.ZodDefault<z.ZodNumber>;
205
202
  } & {
206
203
  query: z.ZodString;
207
204
  }, "strip", z.ZodTypeAny, {
208
- query: string;
209
- limit: number;
210
205
  page: number;
206
+ limit: number;
207
+ query: string;
211
208
  }, {
212
209
  query: string;
213
- limit?: number | undefined;
214
210
  page?: number | undefined;
211
+ limit?: number | undefined;
215
212
  }>;
213
+ metadata: {
214
+ tags: string[];
215
+ };
216
216
  summary: "Search postcodes";
217
217
  method: "GET";
218
218
  path: "/v1/postcodes/search";
@@ -325,12 +325,12 @@ export declare const postcodesContract: {
325
325
  relevance: z.ZodNumber;
326
326
  }, "strip", z.ZodTypeAny, {
327
327
  code: string;
328
- type: "area" | "district" | "sector" | "postcode";
328
+ type: "postcode" | "area" | "district" | "sector";
329
329
  relevance: number;
330
330
  description?: string | undefined;
331
331
  }, {
332
332
  code: string;
333
- type: "area" | "district" | "sector" | "postcode";
333
+ type: "postcode" | "area" | "district" | "sector";
334
334
  relevance: number;
335
335
  description?: string | undefined;
336
336
  }>, "many">;
@@ -343,7 +343,7 @@ export declare const postcodesContract: {
343
343
  limit: number;
344
344
  items: {
345
345
  code: string;
346
- type: "area" | "district" | "sector" | "postcode";
346
+ type: "postcode" | "area" | "district" | "sector";
347
347
  relevance: number;
348
348
  description?: string | undefined;
349
349
  }[];
@@ -355,7 +355,7 @@ export declare const postcodesContract: {
355
355
  limit: number;
356
356
  items: {
357
357
  code: string;
358
- type: "area" | "district" | "sector" | "postcode";
358
+ type: "postcode" | "area" | "district" | "sector";
359
359
  relevance: number;
360
360
  description?: string | undefined;
361
361
  }[];