@land-catalyst/batch-data-sdk 1.2.9 → 1.2.10

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.
@@ -144,6 +144,16 @@ export declare class BatchDataClient implements IBatchDataClient {
144
144
  protected readonly logger: ILogger;
145
145
  private readonly webhooks?;
146
146
  constructor(options: BatchDataClientOptions);
147
+ /**
148
+ * Obfuscate sensitive headers (like Authorization) for logging
149
+ * @param headers Headers object to obfuscate
150
+ * @returns Headers with sensitive values obfuscated
151
+ */
152
+ private obfuscateHeaders;
153
+ /**
154
+ * Set up debug logging interceptors for request/response logging
155
+ */
156
+ private setupDebugLogging;
147
157
  /**
148
158
  * Set up axios interceptors from middleware configuration
149
159
  * @param middleware The middleware configuration
@@ -254,6 +264,13 @@ export declare class BatchDataClient implements IBatchDataClient {
254
264
  * @param options.take Number of properties to return (0 for count-only)
255
265
  * @param options.skip Number of properties to skip for pagination
256
266
  * @returns Property search API response
267
+ *
268
+ * @remarks
269
+ * The returned PropertySearchResponse includes all possible fields that may be returned
270
+ * by the API. The actual fields present in the response depend on your subscription level
271
+ * and the data available for each property. Fields are optional and may be empty objects
272
+ * (e.g., foreclosure: {}) or undefined if not available. The type system ensures type
273
+ * safety while allowing for varying response structures based on subscription tier.
257
274
  */
258
275
  searchProperties(request: PropertySearchRequest): Promise<PropertySearchResponse>;
259
276
  /**
@@ -32,11 +32,100 @@ class BatchDataClient {
32
32
  Authorization: `Bearer ${options.apiKey}`,
33
33
  },
34
34
  });
35
+ // Set up debug logging interceptors
36
+ this.setupDebugLogging();
35
37
  // Set up middleware/interceptors if provided
36
38
  if (options.middleware) {
37
39
  this.setupMiddleware(options.middleware);
38
40
  }
39
41
  }
42
+ /**
43
+ * Obfuscate sensitive headers (like Authorization) for logging
44
+ * @param headers Headers object to obfuscate
45
+ * @returns Headers with sensitive values obfuscated
46
+ */
47
+ obfuscateHeaders(headers) {
48
+ if (!headers)
49
+ return headers;
50
+ const obfuscated = { ...headers };
51
+ // Obfuscate Authorization header
52
+ if (obfuscated.Authorization || obfuscated.authorization) {
53
+ const authHeader = (obfuscated.Authorization ||
54
+ obfuscated.authorization);
55
+ if (typeof authHeader === "string" && authHeader.startsWith("Bearer ")) {
56
+ const token = authHeader.substring(7);
57
+ if (token.length > 8) {
58
+ // Show first 4 and last 4 characters, obfuscate the middle
59
+ const obfuscatedToken = `${token.substring(0, 4)}${"*".repeat(Math.min(token.length - 8, 20))}${token.substring(token.length - 4)}`;
60
+ obfuscated.Authorization = `Bearer ${obfuscatedToken}`;
61
+ if (obfuscated.authorization) {
62
+ obfuscated.authorization = obfuscated.Authorization;
63
+ }
64
+ }
65
+ else {
66
+ obfuscated.Authorization = "Bearer ***";
67
+ if (obfuscated.authorization) {
68
+ obfuscated.authorization = "Bearer ***";
69
+ }
70
+ }
71
+ }
72
+ }
73
+ return obfuscated;
74
+ }
75
+ /**
76
+ * Set up debug logging interceptors for request/response logging
77
+ */
78
+ setupDebugLogging() {
79
+ // Request interceptor - log full request details
80
+ this.axiosInstance.interceptors.request.use((config) => {
81
+ const obfuscatedHeaders = this.obfuscateHeaders(config.headers);
82
+ this.logger.debug("HTTP Request", {
83
+ method: config.method?.toUpperCase(),
84
+ url: config.url,
85
+ baseURL: config.baseURL,
86
+ headers: obfuscatedHeaders,
87
+ params: config.params,
88
+ data: config.data,
89
+ });
90
+ return config;
91
+ }, (error) => {
92
+ this.logger.error("Request interceptor error", error);
93
+ return Promise.reject(error);
94
+ });
95
+ // Response interceptor - log full response details
96
+ this.axiosInstance.interceptors.response.use((response) => {
97
+ const obfuscatedHeaders = this.obfuscateHeaders(response.headers);
98
+ this.logger.debug("HTTP Response", {
99
+ status: response.status,
100
+ statusText: response.statusText,
101
+ headers: obfuscatedHeaders,
102
+ data: response.data,
103
+ config: {
104
+ method: response.config.method?.toUpperCase(),
105
+ url: response.config.url,
106
+ baseURL: response.config.baseURL,
107
+ },
108
+ });
109
+ return response;
110
+ }, (error) => {
111
+ // Log error response if available
112
+ if (error.response) {
113
+ const obfuscatedHeaders = this.obfuscateHeaders(error.response.headers);
114
+ this.logger.debug("HTTP Error Response", {
115
+ status: error.response.status,
116
+ statusText: error.response.statusText,
117
+ headers: obfuscatedHeaders,
118
+ data: error.response.data,
119
+ config: {
120
+ method: error.config?.method?.toUpperCase(),
121
+ url: error.config?.url,
122
+ baseURL: error.config?.baseURL,
123
+ },
124
+ });
125
+ }
126
+ return Promise.reject(error);
127
+ });
128
+ }
40
129
  /**
41
130
  * Set up axios interceptors from middleware configuration
42
131
  * @param middleware The middleware configuration
@@ -304,6 +393,13 @@ class BatchDataClient {
304
393
  * @param options.take Number of properties to return (0 for count-only)
305
394
  * @param options.skip Number of properties to skip for pagination
306
395
  * @returns Property search API response
396
+ *
397
+ * @remarks
398
+ * The returned PropertySearchResponse includes all possible fields that may be returned
399
+ * by the API. The actual fields present in the response depend on your subscription level
400
+ * and the data available for each property. Fields are optional and may be empty objects
401
+ * (e.g., foreclosure: {}) or undefined if not available. The type system ensures type
402
+ * safety while allowing for varying response structures based on subscription tier.
307
403
  */
308
404
  async searchProperties(request) {
309
405
  const url = `${this.v1BaseUrl}/property/search`;
@@ -1123,16 +1123,50 @@ export interface MortgageHistoryEntry {
1123
1123
  transactionTypeCode?: string;
1124
1124
  documentDate?: string;
1125
1125
  }
1126
+ /**
1127
+ * Open lien mortgage information
1128
+ */
1129
+ export interface OpenLienMortgage {
1130
+ recordingDate?: string;
1131
+ loanTypeCode?: string;
1132
+ loanType?: string;
1133
+ financingTypeCode?: string;
1134
+ financingType?: string;
1135
+ loanAmount?: number;
1136
+ lenderName?: string;
1137
+ lenderTypeCode?: string;
1138
+ lenderType?: string;
1139
+ loanTermMonths?: number;
1140
+ dueDate?: string;
1141
+ constructionLoan?: boolean;
1142
+ cashPurchase?: boolean;
1143
+ standaloneRefi?: string;
1144
+ equityCreditLine?: boolean;
1145
+ currentEstimatedBalance?: number;
1146
+ purposeOfLoan?: string;
1147
+ currentEstimatedInterestRate?: number;
1148
+ assignedLenderName?: string;
1149
+ ltv?: number;
1150
+ estimatedPaymentAmount?: number;
1151
+ }
1126
1152
  /**
1127
1153
  * Open lien information
1128
1154
  */
1129
1155
  export interface OpenLien {
1156
+ allLoanTypes?: string[];
1157
+ juniorLoanTypes?: string[];
1130
1158
  totalOpenLienCount?: number;
1159
+ totalOpenLienBalance?: number;
1160
+ firstLoanRecordingDate?: string;
1161
+ lastLoanRecordingDate?: string;
1162
+ mortgages?: OpenLienMortgage[];
1131
1163
  }
1132
1164
  /**
1133
1165
  * Owner name entry
1134
1166
  */
1135
1167
  export interface OwnerName {
1168
+ first?: string;
1169
+ middle?: string;
1136
1170
  last?: string;
1137
1171
  full?: string;
1138
1172
  }
@@ -1225,6 +1259,9 @@ export interface PriorSaleMortgage {
1225
1259
  * Sale information
1226
1260
  */
1227
1261
  export interface Sale {
1262
+ lastSale?: {
1263
+ mortgages?: PriorSaleMortgage[];
1264
+ };
1228
1265
  priorSale?: {
1229
1266
  mortgages?: PriorSaleMortgage[];
1230
1267
  };
@@ -1293,7 +1330,7 @@ export interface Property {
1293
1330
  * @dataset History (Deed)
1294
1331
  * @see {@link getPropertyFieldMetadata} to get full metadata
1295
1332
  */
1296
- foreclosure?: Foreclosure;
1333
+ foreclosure?: Foreclosure | Record<string, never>;
1297
1334
  ids?: PropertyIds;
1298
1335
  images?: PropertyImages;
1299
1336
  intel?: Intel;
@@ -1340,6 +1377,10 @@ export interface ResponseMetadata {
1340
1377
  apiVersion?: string;
1341
1378
  performance?: PerformanceMetrics;
1342
1379
  results?: ResultsMetadata;
1380
+ /**
1381
+ * Request ID for tracking/debugging purposes
1382
+ */
1383
+ requestId?: string;
1343
1384
  }
1344
1385
  /**
1345
1386
  * Property search results
@@ -3,6 +3,11 @@
3
3
  *
4
4
  * Builds complete context for AI services to generate SearchCriteria from natural language.
5
5
  * This includes all domain documentation, filter types, examples, and rules.
6
+ *
7
+ * IMPORTANT: This module only documents SEARCHABLE fields (fields that can be used in SearchCriteria).
8
+ * Response-only fields (like openLien.mortgages[], owner.names[], sale.lastSale.mortgages[], etc.)
9
+ * are intentionally excluded as they appear in Property responses but cannot be used as search filters.
10
+ * All fields documented here correspond to the SearchCriteria type interfaces in types.ts.
6
11
  */
7
12
  /**
8
13
  * Domain metadata with description
@@ -4,6 +4,11 @@
4
4
  *
5
5
  * Builds complete context for AI services to generate SearchCriteria from natural language.
6
6
  * This includes all domain documentation, filter types, examples, and rules.
7
+ *
8
+ * IMPORTANT: This module only documents SEARCHABLE fields (fields that can be used in SearchCriteria).
9
+ * Response-only fields (like openLien.mortgages[], owner.names[], sale.lastSale.mortgages[], etc.)
10
+ * are intentionally excluded as they appear in Property responses but cannot be used as search filters.
11
+ * All fields documented here correspond to the SearchCriteria type interfaces in types.ts.
7
12
  */
8
13
  Object.defineProperty(exports, "__esModule", { value: true });
9
14
  exports.SEARCH_CRITERIA_DOMAIN_NAMES = exports.SEARCH_CRITERIA_DOMAINS = void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@land-catalyst/batch-data-sdk",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "TypeScript SDK for BatchData.io Property API - Types, Builders, and Utilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",