netsuite-sdk 0.1.1 → 0.1.3

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/index.d.mts CHANGED
@@ -239,6 +239,46 @@ declare class RestletClient {
239
239
  call<T = unknown>(restlet: RestletParams, options?: RequestOptions): Promise<NetSuiteResponse<T>>;
240
240
  }
241
241
 
242
+ /**
243
+ * Known fields that are SOAP-only (not writable via REST API).
244
+ * These fields will be extracted and set via SOAP after REST creation.
245
+ */
246
+ declare const SOAP_ONLY_FIELDS: Record<string, string[]>;
247
+ interface SoapUpdateResult {
248
+ success: boolean;
249
+ internalId?: string;
250
+ error?: string;
251
+ }
252
+ /**
253
+ * Extract SOAP-only fields from a record body.
254
+ * Returns the extracted fields and a cleaned body without them.
255
+ */
256
+ declare function extractSoapOnlyFields(recordType: RecordType, body: Record<string, unknown>): {
257
+ soapFields: Record<string, unknown>;
258
+ restBody: Record<string, unknown>;
259
+ };
260
+ /**
261
+ * Lightweight SOAP client for setting fields that aren't available via REST.
262
+ * Uses the NetSuite SOAP Web Services API with Token-Based Authentication.
263
+ */
264
+ declare class SoapFieldClient {
265
+ private auth;
266
+ private accountId;
267
+ constructor(auth: OAuthConfig, accountId: string);
268
+ /**
269
+ * Update SOAP-only fields on an existing record.
270
+ */
271
+ updateFields(recordType: RecordType, internalId: string, fields: Record<string, unknown>): Promise<SoapUpdateResult>;
272
+ /**
273
+ * Create a record via SOAP (full creation, not just field update).
274
+ */
275
+ addRecord(recordType: RecordType, fields: Record<string, unknown>): Promise<SoapUpdateResult>;
276
+ private buildFieldXml;
277
+ private buildTokenPassport;
278
+ private buildUpdateEnvelope;
279
+ private buildAddEnvelope;
280
+ }
281
+
242
282
  /**
243
283
  * Main NetSuite API client.
244
284
  *
@@ -277,6 +317,8 @@ declare class NetSuiteClient {
277
317
  readonly records: RecordClient;
278
318
  /** RESTlet caller */
279
319
  readonly restlets: RestletClient;
320
+ /** SOAP client for fields not available via REST API */
321
+ readonly soap: SoapFieldClient;
280
322
  private readonly transport;
281
323
  constructor(config: NetSuiteConfig);
282
324
  /** Add middleware to all requests. Returns `this` for chaining. */
@@ -454,4 +496,4 @@ declare function parseNetSuiteError(error: unknown): {
454
496
  */
455
497
  declare function normalizeAccountId(accountId: string): string;
456
498
 
457
- export { type HttpMethod, type Logger, type Middleware, NetSuiteClient, type NetSuiteConfig, NetSuiteError, type NetSuiteErrorDetail, type NetSuiteResponse, type OAuthConfig, RateLimiter, type RecordGetOptions, type RecordListOptions, type RecordListResponse, type RecordType, type RequestContext, type RequestOptions, ResponseCache, type ResponseContext, type RestletParams, SuiteQLBuilder, type SuiteQLOptions, type SuiteQLRawResponse, type SuiteQLResult, createCacheKey, formatNetSuiteDate, normalizeAccountId, parseNetSuiteDate, parseNetSuiteError, suiteql, validateConfig };
499
+ export { type HttpMethod, type Logger, type Middleware, NetSuiteClient, type NetSuiteConfig, NetSuiteError, type NetSuiteErrorDetail, type NetSuiteResponse, type OAuthConfig, RateLimiter, type RecordGetOptions, type RecordListOptions, type RecordListResponse, type RecordType, type RequestContext, type RequestOptions, ResponseCache, type ResponseContext, type RestletParams, SOAP_ONLY_FIELDS, SoapFieldClient, type SoapUpdateResult, SuiteQLBuilder, type SuiteQLOptions, type SuiteQLRawResponse, type SuiteQLResult, createCacheKey, extractSoapOnlyFields, formatNetSuiteDate, normalizeAccountId, parseNetSuiteDate, parseNetSuiteError, suiteql, validateConfig };
package/dist/index.d.ts CHANGED
@@ -239,6 +239,46 @@ declare class RestletClient {
239
239
  call<T = unknown>(restlet: RestletParams, options?: RequestOptions): Promise<NetSuiteResponse<T>>;
240
240
  }
241
241
 
242
+ /**
243
+ * Known fields that are SOAP-only (not writable via REST API).
244
+ * These fields will be extracted and set via SOAP after REST creation.
245
+ */
246
+ declare const SOAP_ONLY_FIELDS: Record<string, string[]>;
247
+ interface SoapUpdateResult {
248
+ success: boolean;
249
+ internalId?: string;
250
+ error?: string;
251
+ }
252
+ /**
253
+ * Extract SOAP-only fields from a record body.
254
+ * Returns the extracted fields and a cleaned body without them.
255
+ */
256
+ declare function extractSoapOnlyFields(recordType: RecordType, body: Record<string, unknown>): {
257
+ soapFields: Record<string, unknown>;
258
+ restBody: Record<string, unknown>;
259
+ };
260
+ /**
261
+ * Lightweight SOAP client for setting fields that aren't available via REST.
262
+ * Uses the NetSuite SOAP Web Services API with Token-Based Authentication.
263
+ */
264
+ declare class SoapFieldClient {
265
+ private auth;
266
+ private accountId;
267
+ constructor(auth: OAuthConfig, accountId: string);
268
+ /**
269
+ * Update SOAP-only fields on an existing record.
270
+ */
271
+ updateFields(recordType: RecordType, internalId: string, fields: Record<string, unknown>): Promise<SoapUpdateResult>;
272
+ /**
273
+ * Create a record via SOAP (full creation, not just field update).
274
+ */
275
+ addRecord(recordType: RecordType, fields: Record<string, unknown>): Promise<SoapUpdateResult>;
276
+ private buildFieldXml;
277
+ private buildTokenPassport;
278
+ private buildUpdateEnvelope;
279
+ private buildAddEnvelope;
280
+ }
281
+
242
282
  /**
243
283
  * Main NetSuite API client.
244
284
  *
@@ -277,6 +317,8 @@ declare class NetSuiteClient {
277
317
  readonly records: RecordClient;
278
318
  /** RESTlet caller */
279
319
  readonly restlets: RestletClient;
320
+ /** SOAP client for fields not available via REST API */
321
+ readonly soap: SoapFieldClient;
280
322
  private readonly transport;
281
323
  constructor(config: NetSuiteConfig);
282
324
  /** Add middleware to all requests. Returns `this` for chaining. */
@@ -454,4 +496,4 @@ declare function parseNetSuiteError(error: unknown): {
454
496
  */
455
497
  declare function normalizeAccountId(accountId: string): string;
456
498
 
457
- export { type HttpMethod, type Logger, type Middleware, NetSuiteClient, type NetSuiteConfig, NetSuiteError, type NetSuiteErrorDetail, type NetSuiteResponse, type OAuthConfig, RateLimiter, type RecordGetOptions, type RecordListOptions, type RecordListResponse, type RecordType, type RequestContext, type RequestOptions, ResponseCache, type ResponseContext, type RestletParams, SuiteQLBuilder, type SuiteQLOptions, type SuiteQLRawResponse, type SuiteQLResult, createCacheKey, formatNetSuiteDate, normalizeAccountId, parseNetSuiteDate, parseNetSuiteError, suiteql, validateConfig };
499
+ export { type HttpMethod, type Logger, type Middleware, NetSuiteClient, type NetSuiteConfig, NetSuiteError, type NetSuiteErrorDetail, type NetSuiteResponse, type OAuthConfig, RateLimiter, type RecordGetOptions, type RecordListOptions, type RecordListResponse, type RecordType, type RequestContext, type RequestOptions, ResponseCache, type ResponseContext, type RestletParams, SOAP_ONLY_FIELDS, SoapFieldClient, type SoapUpdateResult, SuiteQLBuilder, type SuiteQLOptions, type SuiteQLRawResponse, type SuiteQLResult, createCacheKey, extractSoapOnlyFields, formatNetSuiteDate, normalizeAccountId, parseNetSuiteDate, parseNetSuiteError, suiteql, validateConfig };