@opendoor/partner-sdk-server-js-core 0.0.1-alpha.43.1 → 0.0.1-beta.44.1

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.
package/dist/client.d.ts CHANGED
@@ -11,8 +11,6 @@
11
11
  *
12
12
  * const client = new OpendoorClient({
13
13
  * apiKey: process.env.OPENDOOR_API_KEY!,
14
- * apiEndpoint: 'https://partner.simplersell.com/api/graphql', // staging (default)
15
- * addressEndpoint: 'https://demo.simplersell.com', // staging (default)
16
14
  * });
17
15
  *
18
16
  * const offer = await client.createOffer({
@@ -23,20 +21,23 @@
23
21
  * @packageDocumentation
24
22
  */
25
23
  import type { AddressSuggestionsResponse, Address, CreateOfferRequest, CreateOfferResponse, UpdateOfferRequest, UpdateOfferResponse, GetOfferResponse, GetOfferWithPricingResponse, AddressUnitCheckResponse, GetAssessmentSlotsRequest, GetAssessmentSlotsResponse, GetHomeDetailRequest, GetHomeDetailResponse } from './types.js';
24
+ export type OpendoorEnvironment = 'staging' | 'production';
26
25
  /**
27
26
  * Configuration for the OpendoorClient.
28
27
  *
29
28
  * @param apiKey - Partner API key. Used as `Authorization: Basic <apiKey>`.
30
- * @param apiEndpoint - GraphQL API endpoint. Defaults to staging (partner.simplersell.com). For production, use 'https://partner.opendoor.com/api/graphql'.
29
+ * @param environment - Target environment. Defaults to 'staging'. Set to 'production' with a production API key when ready.
31
30
  * @param timeout - Request timeout in milliseconds. Defaults to 30000.
32
31
  * @param debug - Enable debug logging to console. Defaults to false.
33
- * @param addressEndpoint - CF Worker base URL for address autocomplete. Defaults to staging (demo.simplersell.com). For production, use 'https://www.opendoor.com'.
32
+ * @param apiEndpoint - Override the GraphQL API endpoint. Normally set automatically by `environment`.
33
+ * @param addressEndpoint - Override the address autocomplete endpoint. Normally set automatically by `environment`.
34
34
  */
35
35
  export interface OpendoorClientConfig {
36
36
  apiKey: string;
37
- apiEndpoint?: string;
37
+ environment?: OpendoorEnvironment;
38
38
  timeout?: number;
39
39
  debug?: boolean;
40
+ apiEndpoint?: string;
40
41
  addressEndpoint?: string;
41
42
  }
42
43
  export declare class OpendoorClient {
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EACV,0BAA0B,EAC1B,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AA2FpB;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAkED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;gBAE7B,MAAM,EAAE,oBAAoB;IAiBxC;;;;;;;OAOG;IACG,qBAAqB,CACzB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,0BAA0B,CAAC;IAiDtC;;;OAGG;YACW,iBAAiB;IA4B/B;;OAEG;YACW,eAAe;IAqC7B;;;;;OAKG;IACG,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAoBzE;;;;;;;OAOG;IACG,WAAW,CACf,OAAO,EAAE,MAAM,E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* apiEndpoint: 'https://partner.simplersell.com/api/graphql', // staging (default)
15
- * addressEndpoint: 'https://demo.simplersell.com', // staging (default)
16
14
  * });
17
15
  *
18
16
  * const offer = await client.createOffer({
@@ -94,12 +92,17 @@ const ENUM_FIELDS = new Set([
94
92
  'sellerRelationToOwner',
95
93
  'sellerSaleTimeline',
96
94
  ]);
97
- const DEFAULT_CONFIG = {
98
- apiEndpoint: 'https://partner.simplersell.com/api/graphql',
99
- timeout: 30000,
100
- debug: false,
101
- addressEndpoint: 'https://demo.simplersell.com',
95
+ const ENDPOINTS = {
96
+ production: {
97
+ apiEndpoint: 'https://partner.opendoor.com/api/graphql',
98
+ addressEndpoint: 'https://www.opendoor.com',
99
+ },
100
+ staging: {
101
+ apiEndpoint: 'https://partner.simplersell.com/api/graphql',
102
+ addressEndpoint: 'https://demo.simplersell.com',
103
+ },
102
104
  };
105
+ const DEFAULT_TIMEOUT = 30000;
103
106
  // ============================================================================
104
107
  // Client
105
108
  // ============================================================================
@@ -108,12 +111,13 @@ export class OpendoorClient {
108
111
  if (!config.apiKey?.trim()) {
109
112
  throw new ValidationError('apiKey is required', 'apiKey');
110
113
  }
114
+ const env = config.environment ?? 'staging';
115
+ const endpoints = ENDPOINTS[env];
111
116
  this.apiKey = config.apiKey;
112
- this.apiEndpoint = config.apiEndpoint ?? DEFAULT_CONFIG.apiEndpoint;
113
- this.timeout = config.timeout ?? DEFAULT_CONFIG.timeout;
114
- this.debug = config.debug ?? DEFAULT_CONFIG.debug;
115
- this.addressEndpoint =
116
- config.addressEndpoint ?? DEFAULT_CONFIG.addressEndpoint;
117
+ this.apiEndpoint = config.apiEndpoint ?? endpoints.apiEndpoint;
118
+ this.timeout = config.timeout ?? DEFAULT_TIMEOUT;
119
+ this.debug = config.debug ?? false;
120
+ this.addressEndpoint = config.addressEndpoint ?? endpoints.addressEndpoint;
117
121
  }
118
122
  // --------------------------------------------------------------------------
119
123
  // Address suggestions (REST — CF Worker)
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
- export declare const VERSION = "0.2.0";
9
+ export declare const VERSION = "1.0.0";
10
10
  export { OpendoorClient } from './client.js';
11
- export type { OpendoorClientConfig } from './client.js';
11
+ export type { OpendoorClientConfig, OpendoorEnvironment } from './client.js';
12
12
  export type { Address, AddressSuggestionsRequest, AddressSuggestionsResponse, CreateOfferRequest, CreateOfferResponse, UpdateOfferRequest, UpdateOfferResponse, GetOfferRequest, GetOfferResponse, GetOfferWithPricingResponse, OfferData, OfferDataWithPricing, DenialInfo, OfferStatus, ExperimentalQuestionAnswer, AddressUnitCheckResponse, GetAssessmentSlotsRequest, GetAssessmentSlotsResponse, GetHomeDetailRequest, GetHomeDetailResponse, } from './types.js';
13
13
  export { ValidationError, OpendoorAPIError } from './errors.js';
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGxD,YAAY,EACV,OAAO,EACP,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3B,SAAS,EACT,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAG7E,YAAY,EACV,OAAO,EACP,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3B,SAAS,EACT,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
- export const VERSION = '0.2.0';
9
+ export const VERSION = '1.0.0';
10
10
  // Client
11
11
  export { OpendoorClient } from './client.js';
12
12
  // Errors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendoor/partner-sdk-server-js-core",
3
- "version": "0.0.1-alpha.43.1",
3
+ "version": "0.0.1-beta.44.1",
4
4
  "description": "Server-side SDK for Opendoor partner integrations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",