@land-catalyst/batch-data-sdk 1.2.6 → 1.2.8

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.
@@ -16,7 +16,7 @@
16
16
  * .build();
17
17
  * ```
18
18
  */
19
- import { StringFilter, NumericRangeFilter, DateRangeFilter, GeoLocationDistance, GeoLocationBoundingBox, GeoLocationPolygon, AddressSearchCriteria, AssessmentSearchCriteria, BuildingSearchCriteria, CompAddressSearchCriteria, DemographicsSearchCriteria, ForeclosureSearchCriteria, GeneralSearchCriteria, IdsSearchCriteria, IntelSearchCriteria, InvoluntaryLienSearchCriteria, LegalSearchCriteria, ListingSearchCriteria, LotSearchCriteria, OpenLienSearchCriteria, OwnerSearchCriteria, PermitSearchCriteria, PropertyOwnerProfileSearchCriteria, SaleSearchCriteria, TaxSearchCriteria, ValuationSearchCriteria, OrSearchCriteria, SearchCriteria, DeliveryConfig, EventHubConfig, PropertySubscriptionRequest, QuickListValueWithNot, PropertyLookupRequest, PropertyLookupRequestItem, PropertyLookupRequestAddress, PropertyLookupOptions, PropertyPermitRequest, PropertySearchRequest, PropertySearchAsyncRequest, PropertyLookupAsyncRequest, GeoPoint } from "../core/types";
19
+ import { StringFilter, NumericRangeFilter, DateRangeFilter, GeoLocationDistance, GeoLocationBoundingBox, GeoLocationPolygon, AddressSearchCriteria, AssessmentSearchCriteria, BuildingSearchCriteria, CompAddressSearchCriteria, DemographicsSearchCriteria, ForeclosureSearchCriteria, GeneralSearchCriteria, IdsSearchCriteria, IntelSearchCriteria, InvoluntaryLienSearchCriteria, LegalSearchCriteria, ListingSearchCriteria, LotSearchCriteria, OpenLienSearchCriteria, OwnerSearchCriteria, PermitSearchCriteria, PropertyOwnerProfileSearchCriteria, SaleSearchCriteria, TaxSearchCriteria, ValuationSearchCriteria, OrSearchCriteria, SearchCriteria, DeliveryConfig, EventHubConfig, PropertySubscriptionRequest, QuickListValueWithNot, PropertyLookupRequest, PropertyLookupRequestItem, PropertyLookupRequestAddress, PropertyLookupOptions, PropertyPermitRequest, PropertyCountRequest, PropertySearchRequest, PropertySearchAsyncRequest, PropertyLookupAsyncRequest, GeoPoint } from "../core/types";
20
20
  import type { PropertyFieldMetadata } from "../property-field/metadata";
21
21
  /**
22
22
  * Base interface for all builders
@@ -813,6 +813,17 @@ export declare class PropertyLookupRequestBuilder extends BaseBuilder<PropertyLo
813
813
  options(configurator: (builder: PropertyLookupOptionsBuilder) => void): this;
814
814
  build(): PropertyLookupRequest;
815
815
  }
816
+ /**
817
+ * Builder for property count requests
818
+ *
819
+ * Used specifically for count-only requests that should never fetch property data.
820
+ */
821
+ export declare class PropertyCountRequestBuilder extends BaseBuilder<PropertyCountRequest> {
822
+ static from(request: PropertyCountRequest): PropertyCountRequestBuilder;
823
+ searchCriteria(criteria: SearchCriteria): this;
824
+ searchCriteria(configurator: (builder: SearchCriteriaBuilder) => void): this;
825
+ build(): PropertyCountRequest;
826
+ }
816
827
  /**
817
828
  * Builder for property search requests
818
829
  */
@@ -18,7 +18,7 @@
18
18
  * ```
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.PropertyPermitRequestBuilder = exports.PropertyLookupAsyncRequestBuilder = exports.PropertySearchAsyncRequestBuilder = exports.PropertySearchRequestBuilder = exports.PropertyLookupRequestBuilder = exports.AsyncPropertyLookupOptionsBuilder = exports.PropertyLookupOptionsBuilder = exports.PropertyLookupRequestItemBuilder = exports.PropertySubscriptionBuilder = exports.DeliveryConfigBuilder = exports.SearchCriteriaBuilder = exports.OrSearchCriteriaBuilder = exports.ValuationSearchCriteriaBuilder = exports.TaxSearchCriteriaBuilder = exports.SaleSearchCriteriaBuilder = exports.PropertyOwnerProfileSearchCriteriaBuilder = exports.PermitSearchCriteriaBuilder = exports.OwnerSearchCriteriaBuilder = exports.OpenLienSearchCriteriaBuilder = exports.LotSearchCriteriaBuilder = exports.ListingSearchCriteriaBuilder = exports.LegalSearchCriteriaBuilder = exports.InvoluntaryLienSearchCriteriaBuilder = exports.IntelSearchCriteriaBuilder = exports.IdsSearchCriteriaBuilder = exports.GeneralSearchCriteriaBuilder = exports.ForeclosureSearchCriteriaBuilder = exports.DemographicsSearchCriteriaBuilder = exports.CompAddressSearchCriteriaBuilder = exports.BuildingSearchCriteriaBuilder = exports.AssessmentSearchCriteriaBuilder = exports.AddressSearchCriteriaBuilder = exports.GeoLocationFactory = exports.DateRangeFilterBuilder = exports.NumericRangeFilterBuilder = exports.StringFilterBuilder = void 0;
21
+ exports.PropertyPermitRequestBuilder = exports.PropertyLookupAsyncRequestBuilder = exports.PropertySearchAsyncRequestBuilder = exports.PropertySearchRequestBuilder = exports.PropertyCountRequestBuilder = exports.PropertyLookupRequestBuilder = exports.AsyncPropertyLookupOptionsBuilder = exports.PropertyLookupOptionsBuilder = exports.PropertyLookupRequestItemBuilder = exports.PropertySubscriptionBuilder = exports.DeliveryConfigBuilder = exports.SearchCriteriaBuilder = exports.OrSearchCriteriaBuilder = exports.ValuationSearchCriteriaBuilder = exports.TaxSearchCriteriaBuilder = exports.SaleSearchCriteriaBuilder = exports.PropertyOwnerProfileSearchCriteriaBuilder = exports.PermitSearchCriteriaBuilder = exports.OwnerSearchCriteriaBuilder = exports.OpenLienSearchCriteriaBuilder = exports.LotSearchCriteriaBuilder = exports.ListingSearchCriteriaBuilder = exports.LegalSearchCriteriaBuilder = exports.InvoluntaryLienSearchCriteriaBuilder = exports.IntelSearchCriteriaBuilder = exports.IdsSearchCriteriaBuilder = exports.GeneralSearchCriteriaBuilder = exports.ForeclosureSearchCriteriaBuilder = exports.DemographicsSearchCriteriaBuilder = exports.CompAddressSearchCriteriaBuilder = exports.BuildingSearchCriteriaBuilder = exports.AssessmentSearchCriteriaBuilder = exports.AddressSearchCriteriaBuilder = exports.GeoLocationFactory = exports.DateRangeFilterBuilder = exports.NumericRangeFilterBuilder = exports.StringFilterBuilder = void 0;
22
22
  const metadata_1 = require("../property-field/metadata");
23
23
  /**
24
24
  * Abstract base class for builders that store nested builders
@@ -2421,6 +2421,40 @@ class PropertyLookupRequestBuilder extends BaseBuilder {
2421
2421
  }
2422
2422
  }
2423
2423
  exports.PropertyLookupRequestBuilder = PropertyLookupRequestBuilder;
2424
+ /**
2425
+ * Builder for property count requests
2426
+ *
2427
+ * Used specifically for count-only requests that should never fetch property data.
2428
+ */
2429
+ class PropertyCountRequestBuilder extends BaseBuilder {
2430
+ static from(request) {
2431
+ const builder = new PropertyCountRequestBuilder();
2432
+ builder.searchCriteria(request.searchCriteria);
2433
+ return builder;
2434
+ }
2435
+ searchCriteria(criteriaOrConfigurator) {
2436
+ if (typeof criteriaOrConfigurator === "function") {
2437
+ const builder = new SearchCriteriaBuilder("");
2438
+ criteriaOrConfigurator(builder);
2439
+ this.criteria.searchCriteria = builder.build();
2440
+ this.builders.searchCriteria = undefined;
2441
+ }
2442
+ else {
2443
+ this.criteria.searchCriteria = criteriaOrConfigurator;
2444
+ this.builders.searchCriteria = undefined;
2445
+ }
2446
+ return this;
2447
+ }
2448
+ build() {
2449
+ if (!this.criteria.searchCriteria) {
2450
+ throw new Error("Search criteria is required");
2451
+ }
2452
+ return {
2453
+ searchCriteria: this.criteria.searchCriteria,
2454
+ };
2455
+ }
2456
+ }
2457
+ exports.PropertyCountRequestBuilder = PropertyCountRequestBuilder;
2424
2458
  /**
2425
2459
  * Builder for property search requests
2426
2460
  */
@@ -1,7 +1,7 @@
1
1
  import { AxiosInstance, AxiosResponse, AxiosError, InternalAxiosRequestConfig } from "axios";
2
2
  import { IBatchDataClient } from "./client.interface";
3
3
  import { ILogger } from "../core/logger.interface";
4
- import { PropertySubscriptionRequest, PropertySubscriptionResponse, PropertySearchRequest, PropertySearchResponse, AddressVerifyRequest, AddressVerifyResponse, AddressAutocompleteRequest, AddressAutocompleteResponse, AddressGeocodeRequest, AddressGeocodeResponse, AddressReverseGeocodeRequest, AddressReverseGeocodeResponse, PropertyLookupRequest, PropertyLookupResponse, PropertyLookupAsyncRequest, PropertyLookupAsyncResponse, PropertySearchAsyncRequest, PropertySearchAsyncResponse, PropertySkipTraceRequest, PropertySkipTraceResponse, PropertySkipTraceAsyncRequest, PropertySkipTraceAsyncResponse, PhoneVerificationRequest, PhoneVerificationResponse, PhoneVerificationAsyncRequest, PhoneVerificationAsyncResponse, PhoneDNCRequest, PhoneDNCResponse, PhoneDNCAsyncRequest, PhoneDNCAsyncResponse, PhoneTCPARequest, PhoneTCPAResponse, PhoneTCPAAsyncRequest, PhoneTCPAAsyncResponse, GetPropertySubscriptionsResponse, GetPropertySubscriptionDetailResponse, DeletePropertySubscriptionResponse, PropertyPermitRequest, PropertyPermitResponse, PropertySkipTraceV3Request, PropertySkipTraceV3Response, PropertySkipTraceV3AsyncRequest, PropertySkipTraceV3AsyncResponse } from "../core/types";
4
+ import { PropertySubscriptionRequest, PropertySubscriptionResponse, PropertyCountRequest, PropertySearchRequest, PropertySearchResponse, AddressVerifyRequest, AddressVerifyResponse, AddressAutocompleteRequest, AddressAutocompleteResponse, AddressGeocodeRequest, AddressGeocodeResponse, AddressReverseGeocodeRequest, AddressReverseGeocodeResponse, PropertyLookupRequest, PropertyLookupResponse, PropertyLookupAsyncRequest, PropertyLookupAsyncResponse, PropertySearchAsyncRequest, PropertySearchAsyncResponse, PropertySkipTraceRequest, PropertySkipTraceResponse, PropertySkipTraceAsyncRequest, PropertySkipTraceAsyncResponse, PhoneVerificationRequest, PhoneVerificationResponse, PhoneVerificationAsyncRequest, PhoneVerificationAsyncResponse, PhoneDNCRequest, PhoneDNCResponse, PhoneDNCAsyncRequest, PhoneDNCAsyncResponse, PhoneTCPARequest, PhoneTCPAResponse, PhoneTCPAAsyncRequest, PhoneTCPAAsyncResponse, GetPropertySubscriptionsResponse, GetPropertySubscriptionDetailResponse, DeletePropertySubscriptionResponse, PropertyPermitRequest, PropertyPermitResponse, PropertySkipTraceV3Request, PropertySkipTraceV3Response, PropertySkipTraceV3AsyncRequest, PropertySkipTraceV3AsyncResponse } from "../core/types";
5
5
  /**
6
6
  * Middleware function that executes before an HTTP request is sent.
7
7
  * Can modify the request config or perform side effects (logging, metrics, etc.).
@@ -258,10 +258,14 @@ export declare class BatchDataClient implements IBatchDataClient {
258
258
  searchProperties(request: PropertySearchRequest): Promise<PropertySearchResponse>;
259
259
  /**
260
260
  * Get the count of properties matching the search criteria
261
- * @param searchCriteria Search criteria to match properties
261
+ *
262
+ * Uses PropertyCountRequest to ensure no property data is fetched (count-only).
263
+ * This prevents accidental charges for property data retrieval.
264
+ *
265
+ * @param searchRequest Count request with search criteria (no options allowed)
262
266
  * @returns Number of matching properties, or null if the endpoint is unavailable
263
267
  */
264
- getPropertyCount(searchRequest: PropertySearchRequest): Promise<number | null>;
268
+ getPropertyCount(searchRequest: PropertyCountRequest): Promise<number | null>;
265
269
  /**
266
270
  * Verify and normalize addresses (v1 API)
267
271
  * POST /api/v1/address/verify
@@ -1,4 +1,4 @@
1
- import { PropertySubscriptionRequest, PropertySubscriptionResponse, PropertySearchRequest, PropertySearchResponse, AddressVerifyRequest, AddressVerifyResponse, AddressAutocompleteRequest, AddressAutocompleteResponse, AddressGeocodeRequest, AddressGeocodeResponse, AddressReverseGeocodeRequest, AddressReverseGeocodeResponse, PropertyLookupRequest, PropertyLookupResponse, PropertyLookupAsyncRequest, PropertyLookupAsyncResponse, PropertySearchAsyncRequest, PropertySearchAsyncResponse, PropertySkipTraceRequest, PropertySkipTraceResponse, PropertySkipTraceAsyncRequest, PropertySkipTraceAsyncResponse, PhoneVerificationRequest, PhoneVerificationResponse, PhoneVerificationAsyncRequest, PhoneVerificationAsyncResponse, PhoneDNCRequest, PhoneDNCResponse, PhoneDNCAsyncRequest, PhoneDNCAsyncResponse, PhoneTCPARequest, PhoneTCPAResponse, PhoneTCPAAsyncRequest, PhoneTCPAAsyncResponse, GetPropertySubscriptionsResponse, GetPropertySubscriptionDetailResponse, DeletePropertySubscriptionResponse, PropertyPermitRequest, PropertyPermitResponse, PropertySkipTraceV3Request, PropertySkipTraceV3Response, PropertySkipTraceV3AsyncRequest, PropertySkipTraceV3AsyncResponse } from "../core/types";
1
+ import { PropertySubscriptionRequest, PropertySubscriptionResponse, PropertyCountRequest, PropertySearchRequest, PropertySearchResponse, AddressVerifyRequest, AddressVerifyResponse, AddressAutocompleteRequest, AddressAutocompleteResponse, AddressGeocodeRequest, AddressGeocodeResponse, AddressReverseGeocodeRequest, AddressReverseGeocodeResponse, PropertyLookupRequest, PropertyLookupResponse, PropertyLookupAsyncRequest, PropertyLookupAsyncResponse, PropertySearchAsyncRequest, PropertySearchAsyncResponse, PropertySkipTraceRequest, PropertySkipTraceResponse, PropertySkipTraceAsyncRequest, PropertySkipTraceAsyncResponse, PhoneVerificationRequest, PhoneVerificationResponse, PhoneVerificationAsyncRequest, PhoneVerificationAsyncResponse, PhoneDNCRequest, PhoneDNCResponse, PhoneDNCAsyncRequest, PhoneDNCAsyncResponse, PhoneTCPARequest, PhoneTCPAResponse, PhoneTCPAAsyncRequest, PhoneTCPAAsyncResponse, GetPropertySubscriptionsResponse, GetPropertySubscriptionDetailResponse, DeletePropertySubscriptionResponse, PropertyPermitRequest, PropertyPermitResponse, PropertySkipTraceV3Request, PropertySkipTraceV3Response, PropertySkipTraceV3AsyncRequest, PropertySkipTraceV3AsyncResponse } from "../core/types";
2
2
  /**
3
3
  * BatchData API Client Interface
4
4
  *
@@ -26,10 +26,14 @@ export interface IBatchDataClient {
26
26
  searchProperties(request: PropertySearchRequest): Promise<PropertySearchResponse>;
27
27
  /**
28
28
  * Get the count of properties matching the search criteria
29
- * @param searchCriteria Search criteria to match properties
29
+ *
30
+ * Uses PropertyCountRequest to ensure no property data is fetched (count-only).
31
+ * This prevents accidental charges for property data retrieval.
32
+ *
33
+ * @param searchRequest Count request with search criteria (no options allowed)
30
34
  * @returns Number of matching properties, or null if the endpoint is unavailable
31
35
  */
32
- getPropertyCount(searchRequest: PropertySearchRequest): Promise<number | null>;
36
+ getPropertyCount(searchRequest: PropertyCountRequest): Promise<number | null>;
33
37
  /**
34
38
  * Verify and normalize addresses (v1 API)
35
39
  * POST /api/v1/address/verify
@@ -321,14 +321,17 @@ class BatchDataClient {
321
321
  }
322
322
  /**
323
323
  * Get the count of properties matching the search criteria
324
- * @param searchCriteria Search criteria to match properties
324
+ *
325
+ * Uses PropertyCountRequest to ensure no property data is fetched (count-only).
326
+ * This prevents accidental charges for property data retrieval.
327
+ *
328
+ * @param searchRequest Count request with search criteria (no options allowed)
325
329
  * @returns Number of matching properties, or null if the endpoint is unavailable
326
330
  */
327
331
  async getPropertyCount(searchRequest) {
328
- const { searchCriteria, options } = searchRequest;
329
- const lookupOptions = options
330
- ? builders_1.PropertyLookupOptionsBuilder.from(options).take(0)
331
- : new builders_1.PropertyLookupOptionsBuilder();
332
+ const { searchCriteria } = searchRequest;
333
+ // Always use take(0) to ensure no property data is fetched
334
+ const lookupOptions = new builders_1.PropertyLookupOptionsBuilder().take(0);
332
335
  const response = await this.searchProperties({
333
336
  searchCriteria,
334
337
  options: lookupOptions.build(),
@@ -1654,6 +1654,22 @@ export interface PropertySearchRequest {
1654
1654
  searchCriteria: SearchCriteria;
1655
1655
  options?: PropertyLookupOptions;
1656
1656
  }
1657
+ /**
1658
+ * Property count request
1659
+ *
1660
+ * Used specifically for getting property counts without fetching property data.
1661
+ * This type does NOT include options to prevent accidental property data fetching
1662
+ * (which incurs charges). For count-only requests, use this type instead of
1663
+ * PropertySearchRequest to ensure no property data is retrieved.
1664
+ *
1665
+ * Note: All filtering needed for an accurate count should be specified in
1666
+ * searchCriteria. PropertyLookupOptions contains some duplicate filter fields
1667
+ * (useBedrooms, useBathrooms, useYearBuilt, etc.) that mirror SearchCriteria fields,
1668
+ * but these are redundant and should not be needed for accurate counts.
1669
+ */
1670
+ export interface PropertyCountRequest {
1671
+ searchCriteria: SearchCriteria;
1672
+ }
1657
1673
  /**
1658
1674
  * Property lookup request
1659
1675
  */
@@ -53,6 +53,10 @@ export interface PropertyFieldMetadata {
53
53
  * Whether this field is an array element (indicated by [n] in the path)
54
54
  */
55
55
  isArrayElement: boolean;
56
+ /**
57
+ * Optional array of possible values for this field (for enum-like fields)
58
+ */
59
+ possibleValues?: string[];
56
60
  }
57
61
  /**
58
62
  * Registry of all property field metadata, indexed by field path
@@ -47,6 +47,7 @@ exports.PROPERTY_FIELD_METADATA = {
47
47
  dataType: "string",
48
48
  description: "The validity of the address (e.g. Valid, Invalid, Partially Valid)",
49
49
  isArrayElement: false,
50
+ possibleValues: ["Valid", "Invalid", "Partially Valid"],
50
51
  },
51
52
  "address.city": {
52
53
  fieldPath: "address.city",
@@ -187,6 +188,7 @@ exports.PROPERTY_FIELD_METADATA = {
187
188
  dataType: "string",
188
189
  description: "The validity of the address (e.g. Valid, Invalid, Partially Valid)",
189
190
  isArrayElement: false,
191
+ possibleValues: ["Valid", "Invalid", "Partially Valid"],
190
192
  },
191
193
  "owner.names.[n].first": {
192
194
  fieldPath: "owner.names.[n].first",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@land-catalyst/batch-data-sdk",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
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",
@@ -21,6 +21,7 @@
21
21
  "generate:metadata": "node scripts/generate-property-field-metadata.js",
22
22
  "generate:docs": "npx tsx scripts/generate-property-type-docs.ts",
23
23
  "add:jsdoc": "node scripts/add-jsdoc-to-types.js",
24
+ "preversion": "npm run build",
24
25
  "v:patch": "npm version patch && git push --follow-tags",
25
26
  "v:minor": "npm version minor && git push --follow-tags",
26
27
  "v:major": "npm version major && git push --follow-tags"