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

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.
@@ -749,6 +749,8 @@ export declare class PropertySubscriptionBuilder extends BaseBuilder<PropertySub
749
749
  searchCriteria(configurator: (builder: SearchCriteriaBuilder) => void): this;
750
750
  deliveryConfig(config: DeliveryConfig): this;
751
751
  deliveryConfig(configurator: (builder: DeliveryConfigBuilder) => void): this;
752
+ options(options: PropertyLookupOptions): this;
753
+ options(configurator: (builder: PropertyLookupOptionsBuilder) => void): this;
752
754
  build(): PropertySubscriptionRequest;
753
755
  }
754
756
  /**
@@ -2214,6 +2214,9 @@ class PropertySubscriptionBuilder extends BaseBuilder {
2214
2214
  const builder = new PropertySubscriptionBuilder();
2215
2215
  builder.searchCriteria(request.searchCriteria);
2216
2216
  builder.deliveryConfig(request.deliveryConfig);
2217
+ if (request.options) {
2218
+ builder.options(request.options);
2219
+ }
2217
2220
  return builder;
2218
2221
  }
2219
2222
  searchCriteria(criteriaOrConfigurator) {
@@ -2242,6 +2245,9 @@ class PropertySubscriptionBuilder extends BaseBuilder {
2242
2245
  }
2243
2246
  return this;
2244
2247
  }
2248
+ options(optionsOrConfigurator) {
2249
+ return this.setPropertyWithBuilderClass("options", optionsOrConfigurator, PropertyLookupOptionsBuilder);
2250
+ }
2245
2251
  build() {
2246
2252
  if (!this.criteria.searchCriteria) {
2247
2253
  throw new Error("Search criteria is required");
@@ -2249,10 +2255,17 @@ class PropertySubscriptionBuilder extends BaseBuilder {
2249
2255
  if (!this.criteria.deliveryConfig) {
2250
2256
  throw new Error("Delivery configuration is required");
2251
2257
  }
2252
- return {
2258
+ const request = {
2253
2259
  searchCriteria: this.criteria.searchCriteria,
2254
2260
  deliveryConfig: this.criteria.deliveryConfig,
2255
2261
  };
2262
+ if (this.builders.options) {
2263
+ request.options = this.builders.options.build();
2264
+ }
2265
+ else if (this.criteria.options) {
2266
+ request.options = this.criteria.options;
2267
+ }
2268
+ return request;
2256
2269
  }
2257
2270
  }
2258
2271
  exports.PropertySubscriptionBuilder = PropertySubscriptionBuilder;
@@ -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`;
@@ -481,6 +481,7 @@ export interface DeliveryConfig {
481
481
  export interface PropertySubscriptionRequest {
482
482
  searchCriteria: SearchCriteria;
483
483
  deliveryConfig: DeliveryConfig;
484
+ options?: PropertyLookupOptions;
484
485
  }
485
486
  /**
486
487
  * Property subscription response
@@ -1123,16 +1124,50 @@ export interface MortgageHistoryEntry {
1123
1124
  transactionTypeCode?: string;
1124
1125
  documentDate?: string;
1125
1126
  }
1127
+ /**
1128
+ * Open lien mortgage information
1129
+ */
1130
+ export interface OpenLienMortgage {
1131
+ recordingDate?: string;
1132
+ loanTypeCode?: string;
1133
+ loanType?: string;
1134
+ financingTypeCode?: string;
1135
+ financingType?: string;
1136
+ loanAmount?: number;
1137
+ lenderName?: string;
1138
+ lenderTypeCode?: string;
1139
+ lenderType?: string;
1140
+ loanTermMonths?: number;
1141
+ dueDate?: string;
1142
+ constructionLoan?: boolean;
1143
+ cashPurchase?: boolean;
1144
+ standaloneRefi?: string;
1145
+ equityCreditLine?: boolean;
1146
+ currentEstimatedBalance?: number;
1147
+ purposeOfLoan?: string;
1148
+ currentEstimatedInterestRate?: number;
1149
+ assignedLenderName?: string;
1150
+ ltv?: number;
1151
+ estimatedPaymentAmount?: number;
1152
+ }
1126
1153
  /**
1127
1154
  * Open lien information
1128
1155
  */
1129
1156
  export interface OpenLien {
1157
+ allLoanTypes?: string[];
1158
+ juniorLoanTypes?: string[];
1130
1159
  totalOpenLienCount?: number;
1160
+ totalOpenLienBalance?: number;
1161
+ firstLoanRecordingDate?: string;
1162
+ lastLoanRecordingDate?: string;
1163
+ mortgages?: OpenLienMortgage[];
1131
1164
  }
1132
1165
  /**
1133
1166
  * Owner name entry
1134
1167
  */
1135
1168
  export interface OwnerName {
1169
+ first?: string;
1170
+ middle?: string;
1136
1171
  last?: string;
1137
1172
  full?: string;
1138
1173
  }
@@ -1225,6 +1260,9 @@ export interface PriorSaleMortgage {
1225
1260
  * Sale information
1226
1261
  */
1227
1262
  export interface Sale {
1263
+ lastSale?: {
1264
+ mortgages?: PriorSaleMortgage[];
1265
+ };
1228
1266
  priorSale?: {
1229
1267
  mortgages?: PriorSaleMortgage[];
1230
1268
  };
@@ -1293,7 +1331,7 @@ export interface Property {
1293
1331
  * @dataset History (Deed)
1294
1332
  * @see {@link getPropertyFieldMetadata} to get full metadata
1295
1333
  */
1296
- foreclosure?: Foreclosure;
1334
+ foreclosure?: Foreclosure | Record<string, never>;
1297
1335
  ids?: PropertyIds;
1298
1336
  images?: PropertyImages;
1299
1337
  intel?: Intel;
@@ -1340,6 +1378,10 @@ export interface ResponseMetadata {
1340
1378
  apiVersion?: string;
1341
1379
  performance?: PerformanceMetrics;
1342
1380
  results?: ResultsMetadata;
1381
+ /**
1382
+ * Request ID for tracking/debugging purposes
1383
+ */
1384
+ requestId?: string;
1343
1385
  }
1344
1386
  /**
1345
1387
  * 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.11",
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",
@@ -12,7 +12,7 @@
12
12
  "scripts": {
13
13
  "build": "tsc",
14
14
  "prepublishOnly": "npm run build",
15
- "test": "jest",
15
+ "test": "jest --testPathIgnorePatterns=integration",
16
16
  "test:integration": "jest --testMatch=\"**/*integration*.test.ts\"",
17
17
  "lint": "eslint src",
18
18
  "lint:fix": "eslint src --fix",