@delegance/sdk 0.2.0 → 0.2.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/README.md +245 -249
- package/dist/index.d.mts +105 -21
- package/dist/index.d.ts +105 -21
- package/dist/index.js +25 -20
- package/dist/index.mjs +25 -20
- package/package.json +9 -4
package/dist/index.d.mts
CHANGED
|
@@ -107,8 +107,11 @@ declare const DocumentStatusSchema: z.ZodEnum<{
|
|
|
107
107
|
}>;
|
|
108
108
|
type DocumentStatus = z.infer<typeof DocumentStatusSchema>;
|
|
109
109
|
interface UploadDocumentInput {
|
|
110
|
-
/**
|
|
111
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Optional. An API key belongs to one company, and the document goes there.
|
|
112
|
+
* Naming any other company answers 403 with `code: 'company_mismatch'`.
|
|
113
|
+
*/
|
|
114
|
+
companyId?: string;
|
|
112
115
|
/** File to upload (Buffer, Blob, or base64 string) */
|
|
113
116
|
file: Buffer | Blob | string;
|
|
114
117
|
/** File name */
|
|
@@ -168,8 +171,9 @@ interface APIKey {
|
|
|
168
171
|
}
|
|
169
172
|
interface CreateAPIKeyInput {
|
|
170
173
|
name: string;
|
|
171
|
-
scopes?: ('read' | 'write' | 'admin')[];
|
|
172
|
-
|
|
174
|
+
scopes?: ('read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin' | 'claims:write')[];
|
|
175
|
+
/** 1 to 365, or 'never' for a read-only key. Omitted: 90 days. */
|
|
176
|
+
expiresInDays?: number | 'never';
|
|
173
177
|
}
|
|
174
178
|
interface CreatedAPIKey extends APIKey {
|
|
175
179
|
/** The full API key - only shown once at creation time */
|
|
@@ -181,6 +185,11 @@ declare class DeleganceError extends Error {
|
|
|
181
185
|
details?: unknown | undefined;
|
|
182
186
|
/** Machine-readable `reason` from the error body, when the server sent one. */
|
|
183
187
|
reason?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Machine-readable `code` from the error body, when the server sent one
|
|
190
|
+
* (e.g. `company_mismatch` on a 403 for a company the key does not own).
|
|
191
|
+
*/
|
|
192
|
+
code?: string;
|
|
184
193
|
/** The parsed error body, for fields a caller needs (portalUrl, hint). */
|
|
185
194
|
body?: Record<string, unknown>;
|
|
186
195
|
constructor(message: string, statusCode: number, traceId?: string | undefined, details?: unknown | undefined);
|
|
@@ -223,7 +232,7 @@ interface RequestOptions {
|
|
|
223
232
|
isFormData?: boolean;
|
|
224
233
|
}
|
|
225
234
|
/** Kept equal to package.json "version"; a unit test fails on drift. */
|
|
226
|
-
declare const SDK_VERSION = "0.2.
|
|
235
|
+
declare const SDK_VERSION = "0.2.1";
|
|
227
236
|
/**
|
|
228
237
|
* Canonical default API origin (WS0/WS1 shared constant, the SDK-package
|
|
229
238
|
* source of truth; the CLI mirror lives in cli/src/utils/config.ts).
|
|
@@ -260,14 +269,21 @@ declare class HttpClient {
|
|
|
260
269
|
*/
|
|
261
270
|
|
|
262
271
|
interface ListCompaniesOptions {
|
|
263
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* @deprecated A customer API key belongs to one company and cannot create
|
|
274
|
+
* others, so this adds nothing for it.
|
|
275
|
+
*/
|
|
264
276
|
includeCreated?: boolean;
|
|
265
277
|
}
|
|
266
278
|
declare class CompaniesModule {
|
|
267
279
|
private http;
|
|
268
280
|
constructor(http: HttpClient);
|
|
269
281
|
/**
|
|
270
|
-
* Create a new company
|
|
282
|
+
* Create a new company.
|
|
283
|
+
*
|
|
284
|
+
* @deprecated A customer API key cannot create companies (403
|
|
285
|
+
* `tenant_key_cannot_create`). To open a new account, use
|
|
286
|
+
* `createSignup().createAccount()`.
|
|
271
287
|
*
|
|
272
288
|
* @example
|
|
273
289
|
* ```typescript
|
|
@@ -282,19 +298,19 @@ declare class CompaniesModule {
|
|
|
282
298
|
*/
|
|
283
299
|
create(input: CreateCompanyInput): Promise<Company>;
|
|
284
300
|
/**
|
|
285
|
-
* List
|
|
301
|
+
* List the company this API key belongs to. A key belongs to one company.
|
|
286
302
|
*
|
|
287
303
|
* @example
|
|
288
304
|
* ```typescript
|
|
289
|
-
* const
|
|
290
|
-
*
|
|
291
|
-
* // Include companies created via this API key
|
|
292
|
-
* const allCompanies = await client.companies.list({ includeCreated: true });
|
|
305
|
+
* const [company] = await client.companies.list();
|
|
293
306
|
* ```
|
|
294
307
|
*/
|
|
295
308
|
list(options?: ListCompaniesOptions): Promise<Company[]>;
|
|
296
309
|
/**
|
|
297
|
-
* Get a company by ID
|
|
310
|
+
* Get a company by ID.
|
|
311
|
+
*
|
|
312
|
+
* @deprecated The server has no `GET /api/v1/companies/{id}` route, so this
|
|
313
|
+
* returns 404. Use `list()`, which returns the key's own company.
|
|
298
314
|
*
|
|
299
315
|
* @example
|
|
300
316
|
* ```typescript
|
|
@@ -303,7 +319,10 @@ declare class CompaniesModule {
|
|
|
303
319
|
*/
|
|
304
320
|
get(companyId: string): Promise<Company>;
|
|
305
321
|
/**
|
|
306
|
-
* Create a company if it doesn't exist (using externalId for deduplication)
|
|
322
|
+
* Create a company if it doesn't exist (using externalId for deduplication).
|
|
323
|
+
*
|
|
324
|
+
* @deprecated A customer API key cannot create companies. Use
|
|
325
|
+
* `createSignup().createAccount()` for a new account.
|
|
307
326
|
*
|
|
308
327
|
* @example
|
|
309
328
|
* ```typescript
|
|
@@ -374,7 +393,6 @@ declare class DocumentsModule {
|
|
|
374
393
|
* import fs from 'fs';
|
|
375
394
|
*
|
|
376
395
|
* const doc = await client.documents.upload({
|
|
377
|
-
* companyId: 'company-uuid',
|
|
378
396
|
* file: fs.readFileSync('./policy.pdf'),
|
|
379
397
|
* fileName: 'GL-2025.pdf',
|
|
380
398
|
* documentType: 'policy'
|
|
@@ -390,8 +408,8 @@ declare class DocumentsModule {
|
|
|
390
408
|
* @example
|
|
391
409
|
* ```typescript
|
|
392
410
|
* const docs = await client.documents.uploadBatch([
|
|
393
|
-
* {
|
|
394
|
-
* {
|
|
411
|
+
* { file: buffer1, fileName: 'policy1.pdf' },
|
|
412
|
+
* { file: buffer2, fileName: 'policy2.pdf' }
|
|
395
413
|
* ]);
|
|
396
414
|
* ```
|
|
397
415
|
*/
|
|
@@ -1205,13 +1223,23 @@ interface RotateResult {
|
|
|
1205
1223
|
rotationId: string;
|
|
1206
1224
|
status: 'rotating';
|
|
1207
1225
|
}
|
|
1208
|
-
/**
|
|
1209
|
-
|
|
1226
|
+
/**
|
|
1227
|
+
* Scopes the server accepts. `appetite:read`, `mcp:*` and `claims:write` are
|
|
1228
|
+
* opt-in and never implied. `claims:write` can be created only while signed
|
|
1229
|
+
* in to the portal; an API-key call that asks for it gets a 403.
|
|
1230
|
+
*/
|
|
1231
|
+
type ApiKeyScope = 'read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin' | 'claims:write';
|
|
1210
1232
|
declare const API_KEY_SCOPES: readonly ApiKeyScope[];
|
|
1211
1233
|
interface CreateApiKeyInput {
|
|
1212
1234
|
name: string;
|
|
1213
1235
|
scopes: ApiKeyScope[];
|
|
1214
|
-
|
|
1236
|
+
/**
|
|
1237
|
+
* Days until the key expires, 1 to 365. Omitted: 90 days. `'never'`: no
|
|
1238
|
+
* expiry, allowed only for a read-only key. A key with `write`, `admin` or
|
|
1239
|
+
* `claims:write` must expire, or the server answers 400
|
|
1240
|
+
* `write_key_requires_expiry`.
|
|
1241
|
+
*/
|
|
1242
|
+
expiresInDays?: number | 'never';
|
|
1215
1243
|
}
|
|
1216
1244
|
interface ListApiKeysOptions {
|
|
1217
1245
|
limit?: number;
|
|
@@ -1903,6 +1931,29 @@ interface CarrierQuote {
|
|
|
1903
1931
|
premium: number | null;
|
|
1904
1932
|
quoteNumber: string | null;
|
|
1905
1933
|
bindable: boolean | null;
|
|
1934
|
+
/**
|
|
1935
|
+
* Human-readable limits, e.g. "$1M per occurrence / $2M aggregate" or
|
|
1936
|
+
* "Statutory / $1M employers liability". Null when the carrier sent none.
|
|
1937
|
+
* Absent on older servers.
|
|
1938
|
+
*/
|
|
1939
|
+
limits?: string | null;
|
|
1940
|
+
/**
|
|
1941
|
+
* Deductible in dollars; 0 means none. Today only cyber quotes carry one
|
|
1942
|
+
* (the retention); every other line returns null. Absent on older servers.
|
|
1943
|
+
*/
|
|
1944
|
+
deductible?: number | null;
|
|
1945
|
+
/**
|
|
1946
|
+
* The carrier result status (`needs_info`, `declined`, `failed`, ...). A
|
|
1947
|
+
* REFERRED quote with `needs_info` is closed: the carrier needs answers.
|
|
1948
|
+
* Absent on older servers.
|
|
1949
|
+
*/
|
|
1950
|
+
resultStatus?: string | null;
|
|
1951
|
+
/**
|
|
1952
|
+
* Why the carrier did not price, in the carrier's own words (a decline) or
|
|
1953
|
+
* a plain sentence (needs info, referral). Null otherwise. Absent on older
|
|
1954
|
+
* servers.
|
|
1955
|
+
*/
|
|
1956
|
+
message?: string | null;
|
|
1906
1957
|
}
|
|
1907
1958
|
interface InstantQuoteStatus {
|
|
1908
1959
|
submissionId: string;
|
|
@@ -1913,6 +1964,8 @@ interface InstantQuoteStatus {
|
|
|
1913
1964
|
carrierQuotes: CarrierQuote[];
|
|
1914
1965
|
allCarriersResolved: boolean;
|
|
1915
1966
|
awaitingBrokerReviewCount: number;
|
|
1967
|
+
/** When coverage would start, as an ISO date (YYYY-MM-DD). Absent on older servers. */
|
|
1968
|
+
effectiveDate?: string | null;
|
|
1916
1969
|
/** The newest broker task on this submission; null when none. Absent when the server could not read it. */
|
|
1917
1970
|
brokerReview?: {
|
|
1918
1971
|
taskId: string;
|
|
@@ -1938,6 +1991,35 @@ interface BrokerHandoffResult {
|
|
|
1938
1991
|
unansweredRequired: number;
|
|
1939
1992
|
alreadyHandedOff: boolean;
|
|
1940
1993
|
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Premium financing at the point of sale. Present only when Delegance has the
|
|
1996
|
+
* lane switched on. Terms are the LENDER's, reported once the insured starts
|
|
1997
|
+
* financing; they are null before that.
|
|
1998
|
+
*/
|
|
1999
|
+
interface FinancingOffer {
|
|
2000
|
+
available: boolean;
|
|
2001
|
+
availability: 'provider_confirmed' | 'precheck_passed' | 'unavailable';
|
|
2002
|
+
provider: string;
|
|
2003
|
+
lender: string;
|
|
2004
|
+
reason: string | null;
|
|
2005
|
+
/** The portal finance checkout (sign in to the portal to use it). */
|
|
2006
|
+
checkoutUrl: string | null;
|
|
2007
|
+
premiumFinal: boolean;
|
|
2008
|
+
terms: {
|
|
2009
|
+
aprBps: number | null;
|
|
2010
|
+
downPaymentCents: number | null;
|
|
2011
|
+
amountFinancedCents: number | null;
|
|
2012
|
+
financeChargeCents: number | null;
|
|
2013
|
+
installmentCents: number | null;
|
|
2014
|
+
numberOfInstallments: number | null;
|
|
2015
|
+
totalOfPaymentsCents: number | null;
|
|
2016
|
+
agreementUrl: string | null;
|
|
2017
|
+
providerQuoteRef: string | null;
|
|
2018
|
+
providerQuoteStatus: string | null;
|
|
2019
|
+
} | null;
|
|
2020
|
+
applicationStatus: string | null;
|
|
2021
|
+
disclosure: string;
|
|
2022
|
+
}
|
|
1941
2023
|
interface BindRequestResult {
|
|
1942
2024
|
bindRequestId: string;
|
|
1943
2025
|
status: string;
|
|
@@ -1952,6 +2034,8 @@ interface BindRequestResult {
|
|
|
1952
2034
|
reasons?: string[];
|
|
1953
2035
|
/** Tier A: the carrier's checkout page. The policy is bound only when the carrier confirms. */
|
|
1954
2036
|
checkoutUrl?: string;
|
|
2037
|
+
/** Point-of-sale premium financing, when offered. */
|
|
2038
|
+
financing?: FinancingOffer;
|
|
1955
2039
|
}
|
|
1956
2040
|
/** The first fast-bind call emails a code; send it back with `stepUpId`. */
|
|
1957
2041
|
interface BindStepUpRequired {
|
|
@@ -2492,4 +2576,4 @@ declare function createDeviceLogin(config?: {
|
|
|
2492
2576
|
retries?: number;
|
|
2493
2577
|
}): DeviceLoginModule;
|
|
2494
2578
|
|
|
2495
|
-
export { type APIKey, type APIResponse, API_KEY_SCOPES, type ApiKey, type ApiKeyInfo, type ApiKeyScope, ApiKeysModule, type AppetiteJobStatus, type AppetiteMatch, type AppetiteMatchInput, type AppetiteMatchResult, type AppetiteMatchStart, AppetiteModule, AuthModule, AuthenticationError, type BindRequestResult, type BindStepUpRequired, type BondToolResult, BondsModule, type BrokerHandoffQuestions, type BrokerHandoffResult, type COI, COIModule, type CancellationReason, type CancellationRequestInput, type CancellationSignInput, type CancellationSignResult, type CancellationStatus, type Carrier, type CarrierAppetiteResult, type CarrierQuote, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, type ClaimSummary, ClaimsModule, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateAccountInput, type CreateAccountResult, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreateLeadInput, type CreateLeadResult, type CreatedAPIKey, type CreatedApiKey, DEFAULT_BASE_URL, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, DeviceLoginModule, type DeviceLoginPoll, type DeviceLoginStart, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type EnrollResult, type ExchangeResult, type ExtractedPolicy, FEEDBACK_MESSAGE_MAX, type FastBindInput, type FeedbackContext, FeedbackModule, type FeedbackType, type FileClaimInput, ForbiddenError, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, type InstantQuestion, type InstantQuestionOption, type InstantQuoteStatus, InstantQuotesModule, type InstantSession, type InstantSubmitResult, KnowledgeModule, type KnowledgeSearchResult, type LeadAddress, LeadsModule, type ListApiKeysOptions, type ListCOIsResponse, type ListCarriersResponse, type ListCompaniesOptions, type ListDocumentsOptions, type ListNotecardsOptions, type ListPoliciesOptions, type ListPoliciesResponse, type ListQuotesOptions, type ListQuotesResponse, type ListSOVsOptions, type ListSOVsResponse, type MeterUsage, NotFoundError, NotImplementedError, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingState, type OnboardingStateData, type OnboardingStatus, type PaginatedResponse, type PaymentRequest, PaymentsModule, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, SignupModule, type StartBondQuoteInput, type SubmitFeedbackInput, type SubmitQuoteResponse, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, type WaitForMatchOptions, createClientFromEnv, createDeviceLogin, createSignup, newDeviceSecret };
|
|
2579
|
+
export { type APIKey, type APIResponse, API_KEY_SCOPES, type ApiKey, type ApiKeyInfo, type ApiKeyScope, ApiKeysModule, type AppetiteJobStatus, type AppetiteMatch, type AppetiteMatchInput, type AppetiteMatchResult, type AppetiteMatchStart, AppetiteModule, AuthModule, AuthenticationError, type BindRequestResult, type BindStepUpRequired, type BondToolResult, BondsModule, type BrokerHandoffQuestions, type BrokerHandoffResult, type COI, COIModule, type CancellationReason, type CancellationRequestInput, type CancellationSignInput, type CancellationSignResult, type CancellationStatus, type Carrier, type CarrierAppetiteResult, type CarrierQuote, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, type ClaimSummary, ClaimsModule, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateAccountInput, type CreateAccountResult, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreateLeadInput, type CreateLeadResult, type CreatedAPIKey, type CreatedApiKey, DEFAULT_BASE_URL, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, DeviceLoginModule, type DeviceLoginPoll, type DeviceLoginStart, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type EnrollResult, type ExchangeResult, type ExtractedPolicy, FEEDBACK_MESSAGE_MAX, type FastBindInput, type FeedbackContext, FeedbackModule, type FeedbackType, type FileClaimInput, type FinancingOffer, ForbiddenError, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, type InstantQuestion, type InstantQuestionOption, type InstantQuoteStatus, InstantQuotesModule, type InstantSession, type InstantSubmitResult, KnowledgeModule, type KnowledgeSearchResult, type LeadAddress, LeadsModule, type ListApiKeysOptions, type ListCOIsResponse, type ListCarriersResponse, type ListCompaniesOptions, type ListDocumentsOptions, type ListNotecardsOptions, type ListPoliciesOptions, type ListPoliciesResponse, type ListQuotesOptions, type ListQuotesResponse, type ListSOVsOptions, type ListSOVsResponse, type MeterUsage, NotFoundError, NotImplementedError, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingState, type OnboardingStateData, type OnboardingStatus, type PaginatedResponse, type PaymentRequest, PaymentsModule, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, SignupModule, type StartBondQuoteInput, type SubmitFeedbackInput, type SubmitQuoteResponse, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, type WaitForMatchOptions, createClientFromEnv, createDeviceLogin, createSignup, newDeviceSecret };
|
package/dist/index.d.ts
CHANGED
|
@@ -107,8 +107,11 @@ declare const DocumentStatusSchema: z.ZodEnum<{
|
|
|
107
107
|
}>;
|
|
108
108
|
type DocumentStatus = z.infer<typeof DocumentStatusSchema>;
|
|
109
109
|
interface UploadDocumentInput {
|
|
110
|
-
/**
|
|
111
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Optional. An API key belongs to one company, and the document goes there.
|
|
112
|
+
* Naming any other company answers 403 with `code: 'company_mismatch'`.
|
|
113
|
+
*/
|
|
114
|
+
companyId?: string;
|
|
112
115
|
/** File to upload (Buffer, Blob, or base64 string) */
|
|
113
116
|
file: Buffer | Blob | string;
|
|
114
117
|
/** File name */
|
|
@@ -168,8 +171,9 @@ interface APIKey {
|
|
|
168
171
|
}
|
|
169
172
|
interface CreateAPIKeyInput {
|
|
170
173
|
name: string;
|
|
171
|
-
scopes?: ('read' | 'write' | 'admin')[];
|
|
172
|
-
|
|
174
|
+
scopes?: ('read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin' | 'claims:write')[];
|
|
175
|
+
/** 1 to 365, or 'never' for a read-only key. Omitted: 90 days. */
|
|
176
|
+
expiresInDays?: number | 'never';
|
|
173
177
|
}
|
|
174
178
|
interface CreatedAPIKey extends APIKey {
|
|
175
179
|
/** The full API key - only shown once at creation time */
|
|
@@ -181,6 +185,11 @@ declare class DeleganceError extends Error {
|
|
|
181
185
|
details?: unknown | undefined;
|
|
182
186
|
/** Machine-readable `reason` from the error body, when the server sent one. */
|
|
183
187
|
reason?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Machine-readable `code` from the error body, when the server sent one
|
|
190
|
+
* (e.g. `company_mismatch` on a 403 for a company the key does not own).
|
|
191
|
+
*/
|
|
192
|
+
code?: string;
|
|
184
193
|
/** The parsed error body, for fields a caller needs (portalUrl, hint). */
|
|
185
194
|
body?: Record<string, unknown>;
|
|
186
195
|
constructor(message: string, statusCode: number, traceId?: string | undefined, details?: unknown | undefined);
|
|
@@ -223,7 +232,7 @@ interface RequestOptions {
|
|
|
223
232
|
isFormData?: boolean;
|
|
224
233
|
}
|
|
225
234
|
/** Kept equal to package.json "version"; a unit test fails on drift. */
|
|
226
|
-
declare const SDK_VERSION = "0.2.
|
|
235
|
+
declare const SDK_VERSION = "0.2.1";
|
|
227
236
|
/**
|
|
228
237
|
* Canonical default API origin (WS0/WS1 shared constant, the SDK-package
|
|
229
238
|
* source of truth; the CLI mirror lives in cli/src/utils/config.ts).
|
|
@@ -260,14 +269,21 @@ declare class HttpClient {
|
|
|
260
269
|
*/
|
|
261
270
|
|
|
262
271
|
interface ListCompaniesOptions {
|
|
263
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* @deprecated A customer API key belongs to one company and cannot create
|
|
274
|
+
* others, so this adds nothing for it.
|
|
275
|
+
*/
|
|
264
276
|
includeCreated?: boolean;
|
|
265
277
|
}
|
|
266
278
|
declare class CompaniesModule {
|
|
267
279
|
private http;
|
|
268
280
|
constructor(http: HttpClient);
|
|
269
281
|
/**
|
|
270
|
-
* Create a new company
|
|
282
|
+
* Create a new company.
|
|
283
|
+
*
|
|
284
|
+
* @deprecated A customer API key cannot create companies (403
|
|
285
|
+
* `tenant_key_cannot_create`). To open a new account, use
|
|
286
|
+
* `createSignup().createAccount()`.
|
|
271
287
|
*
|
|
272
288
|
* @example
|
|
273
289
|
* ```typescript
|
|
@@ -282,19 +298,19 @@ declare class CompaniesModule {
|
|
|
282
298
|
*/
|
|
283
299
|
create(input: CreateCompanyInput): Promise<Company>;
|
|
284
300
|
/**
|
|
285
|
-
* List
|
|
301
|
+
* List the company this API key belongs to. A key belongs to one company.
|
|
286
302
|
*
|
|
287
303
|
* @example
|
|
288
304
|
* ```typescript
|
|
289
|
-
* const
|
|
290
|
-
*
|
|
291
|
-
* // Include companies created via this API key
|
|
292
|
-
* const allCompanies = await client.companies.list({ includeCreated: true });
|
|
305
|
+
* const [company] = await client.companies.list();
|
|
293
306
|
* ```
|
|
294
307
|
*/
|
|
295
308
|
list(options?: ListCompaniesOptions): Promise<Company[]>;
|
|
296
309
|
/**
|
|
297
|
-
* Get a company by ID
|
|
310
|
+
* Get a company by ID.
|
|
311
|
+
*
|
|
312
|
+
* @deprecated The server has no `GET /api/v1/companies/{id}` route, so this
|
|
313
|
+
* returns 404. Use `list()`, which returns the key's own company.
|
|
298
314
|
*
|
|
299
315
|
* @example
|
|
300
316
|
* ```typescript
|
|
@@ -303,7 +319,10 @@ declare class CompaniesModule {
|
|
|
303
319
|
*/
|
|
304
320
|
get(companyId: string): Promise<Company>;
|
|
305
321
|
/**
|
|
306
|
-
* Create a company if it doesn't exist (using externalId for deduplication)
|
|
322
|
+
* Create a company if it doesn't exist (using externalId for deduplication).
|
|
323
|
+
*
|
|
324
|
+
* @deprecated A customer API key cannot create companies. Use
|
|
325
|
+
* `createSignup().createAccount()` for a new account.
|
|
307
326
|
*
|
|
308
327
|
* @example
|
|
309
328
|
* ```typescript
|
|
@@ -374,7 +393,6 @@ declare class DocumentsModule {
|
|
|
374
393
|
* import fs from 'fs';
|
|
375
394
|
*
|
|
376
395
|
* const doc = await client.documents.upload({
|
|
377
|
-
* companyId: 'company-uuid',
|
|
378
396
|
* file: fs.readFileSync('./policy.pdf'),
|
|
379
397
|
* fileName: 'GL-2025.pdf',
|
|
380
398
|
* documentType: 'policy'
|
|
@@ -390,8 +408,8 @@ declare class DocumentsModule {
|
|
|
390
408
|
* @example
|
|
391
409
|
* ```typescript
|
|
392
410
|
* const docs = await client.documents.uploadBatch([
|
|
393
|
-
* {
|
|
394
|
-
* {
|
|
411
|
+
* { file: buffer1, fileName: 'policy1.pdf' },
|
|
412
|
+
* { file: buffer2, fileName: 'policy2.pdf' }
|
|
395
413
|
* ]);
|
|
396
414
|
* ```
|
|
397
415
|
*/
|
|
@@ -1205,13 +1223,23 @@ interface RotateResult {
|
|
|
1205
1223
|
rotationId: string;
|
|
1206
1224
|
status: 'rotating';
|
|
1207
1225
|
}
|
|
1208
|
-
/**
|
|
1209
|
-
|
|
1226
|
+
/**
|
|
1227
|
+
* Scopes the server accepts. `appetite:read`, `mcp:*` and `claims:write` are
|
|
1228
|
+
* opt-in and never implied. `claims:write` can be created only while signed
|
|
1229
|
+
* in to the portal; an API-key call that asks for it gets a 403.
|
|
1230
|
+
*/
|
|
1231
|
+
type ApiKeyScope = 'read' | 'write' | 'admin' | 'appetite:read' | 'mcp:read' | 'mcp:orin' | 'claims:write';
|
|
1210
1232
|
declare const API_KEY_SCOPES: readonly ApiKeyScope[];
|
|
1211
1233
|
interface CreateApiKeyInput {
|
|
1212
1234
|
name: string;
|
|
1213
1235
|
scopes: ApiKeyScope[];
|
|
1214
|
-
|
|
1236
|
+
/**
|
|
1237
|
+
* Days until the key expires, 1 to 365. Omitted: 90 days. `'never'`: no
|
|
1238
|
+
* expiry, allowed only for a read-only key. A key with `write`, `admin` or
|
|
1239
|
+
* `claims:write` must expire, or the server answers 400
|
|
1240
|
+
* `write_key_requires_expiry`.
|
|
1241
|
+
*/
|
|
1242
|
+
expiresInDays?: number | 'never';
|
|
1215
1243
|
}
|
|
1216
1244
|
interface ListApiKeysOptions {
|
|
1217
1245
|
limit?: number;
|
|
@@ -1903,6 +1931,29 @@ interface CarrierQuote {
|
|
|
1903
1931
|
premium: number | null;
|
|
1904
1932
|
quoteNumber: string | null;
|
|
1905
1933
|
bindable: boolean | null;
|
|
1934
|
+
/**
|
|
1935
|
+
* Human-readable limits, e.g. "$1M per occurrence / $2M aggregate" or
|
|
1936
|
+
* "Statutory / $1M employers liability". Null when the carrier sent none.
|
|
1937
|
+
* Absent on older servers.
|
|
1938
|
+
*/
|
|
1939
|
+
limits?: string | null;
|
|
1940
|
+
/**
|
|
1941
|
+
* Deductible in dollars; 0 means none. Today only cyber quotes carry one
|
|
1942
|
+
* (the retention); every other line returns null. Absent on older servers.
|
|
1943
|
+
*/
|
|
1944
|
+
deductible?: number | null;
|
|
1945
|
+
/**
|
|
1946
|
+
* The carrier result status (`needs_info`, `declined`, `failed`, ...). A
|
|
1947
|
+
* REFERRED quote with `needs_info` is closed: the carrier needs answers.
|
|
1948
|
+
* Absent on older servers.
|
|
1949
|
+
*/
|
|
1950
|
+
resultStatus?: string | null;
|
|
1951
|
+
/**
|
|
1952
|
+
* Why the carrier did not price, in the carrier's own words (a decline) or
|
|
1953
|
+
* a plain sentence (needs info, referral). Null otherwise. Absent on older
|
|
1954
|
+
* servers.
|
|
1955
|
+
*/
|
|
1956
|
+
message?: string | null;
|
|
1906
1957
|
}
|
|
1907
1958
|
interface InstantQuoteStatus {
|
|
1908
1959
|
submissionId: string;
|
|
@@ -1913,6 +1964,8 @@ interface InstantQuoteStatus {
|
|
|
1913
1964
|
carrierQuotes: CarrierQuote[];
|
|
1914
1965
|
allCarriersResolved: boolean;
|
|
1915
1966
|
awaitingBrokerReviewCount: number;
|
|
1967
|
+
/** When coverage would start, as an ISO date (YYYY-MM-DD). Absent on older servers. */
|
|
1968
|
+
effectiveDate?: string | null;
|
|
1916
1969
|
/** The newest broker task on this submission; null when none. Absent when the server could not read it. */
|
|
1917
1970
|
brokerReview?: {
|
|
1918
1971
|
taskId: string;
|
|
@@ -1938,6 +1991,35 @@ interface BrokerHandoffResult {
|
|
|
1938
1991
|
unansweredRequired: number;
|
|
1939
1992
|
alreadyHandedOff: boolean;
|
|
1940
1993
|
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Premium financing at the point of sale. Present only when Delegance has the
|
|
1996
|
+
* lane switched on. Terms are the LENDER's, reported once the insured starts
|
|
1997
|
+
* financing; they are null before that.
|
|
1998
|
+
*/
|
|
1999
|
+
interface FinancingOffer {
|
|
2000
|
+
available: boolean;
|
|
2001
|
+
availability: 'provider_confirmed' | 'precheck_passed' | 'unavailable';
|
|
2002
|
+
provider: string;
|
|
2003
|
+
lender: string;
|
|
2004
|
+
reason: string | null;
|
|
2005
|
+
/** The portal finance checkout (sign in to the portal to use it). */
|
|
2006
|
+
checkoutUrl: string | null;
|
|
2007
|
+
premiumFinal: boolean;
|
|
2008
|
+
terms: {
|
|
2009
|
+
aprBps: number | null;
|
|
2010
|
+
downPaymentCents: number | null;
|
|
2011
|
+
amountFinancedCents: number | null;
|
|
2012
|
+
financeChargeCents: number | null;
|
|
2013
|
+
installmentCents: number | null;
|
|
2014
|
+
numberOfInstallments: number | null;
|
|
2015
|
+
totalOfPaymentsCents: number | null;
|
|
2016
|
+
agreementUrl: string | null;
|
|
2017
|
+
providerQuoteRef: string | null;
|
|
2018
|
+
providerQuoteStatus: string | null;
|
|
2019
|
+
} | null;
|
|
2020
|
+
applicationStatus: string | null;
|
|
2021
|
+
disclosure: string;
|
|
2022
|
+
}
|
|
1941
2023
|
interface BindRequestResult {
|
|
1942
2024
|
bindRequestId: string;
|
|
1943
2025
|
status: string;
|
|
@@ -1952,6 +2034,8 @@ interface BindRequestResult {
|
|
|
1952
2034
|
reasons?: string[];
|
|
1953
2035
|
/** Tier A: the carrier's checkout page. The policy is bound only when the carrier confirms. */
|
|
1954
2036
|
checkoutUrl?: string;
|
|
2037
|
+
/** Point-of-sale premium financing, when offered. */
|
|
2038
|
+
financing?: FinancingOffer;
|
|
1955
2039
|
}
|
|
1956
2040
|
/** The first fast-bind call emails a code; send it back with `stepUpId`. */
|
|
1957
2041
|
interface BindStepUpRequired {
|
|
@@ -2492,4 +2576,4 @@ declare function createDeviceLogin(config?: {
|
|
|
2492
2576
|
retries?: number;
|
|
2493
2577
|
}): DeviceLoginModule;
|
|
2494
2578
|
|
|
2495
|
-
export { type APIKey, type APIResponse, API_KEY_SCOPES, type ApiKey, type ApiKeyInfo, type ApiKeyScope, ApiKeysModule, type AppetiteJobStatus, type AppetiteMatch, type AppetiteMatchInput, type AppetiteMatchResult, type AppetiteMatchStart, AppetiteModule, AuthModule, AuthenticationError, type BindRequestResult, type BindStepUpRequired, type BondToolResult, BondsModule, type BrokerHandoffQuestions, type BrokerHandoffResult, type COI, COIModule, type CancellationReason, type CancellationRequestInput, type CancellationSignInput, type CancellationSignResult, type CancellationStatus, type Carrier, type CarrierAppetiteResult, type CarrierQuote, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, type ClaimSummary, ClaimsModule, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateAccountInput, type CreateAccountResult, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreateLeadInput, type CreateLeadResult, type CreatedAPIKey, type CreatedApiKey, DEFAULT_BASE_URL, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, DeviceLoginModule, type DeviceLoginPoll, type DeviceLoginStart, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type EnrollResult, type ExchangeResult, type ExtractedPolicy, FEEDBACK_MESSAGE_MAX, type FastBindInput, type FeedbackContext, FeedbackModule, type FeedbackType, type FileClaimInput, ForbiddenError, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, type InstantQuestion, type InstantQuestionOption, type InstantQuoteStatus, InstantQuotesModule, type InstantSession, type InstantSubmitResult, KnowledgeModule, type KnowledgeSearchResult, type LeadAddress, LeadsModule, type ListApiKeysOptions, type ListCOIsResponse, type ListCarriersResponse, type ListCompaniesOptions, type ListDocumentsOptions, type ListNotecardsOptions, type ListPoliciesOptions, type ListPoliciesResponse, type ListQuotesOptions, type ListQuotesResponse, type ListSOVsOptions, type ListSOVsResponse, type MeterUsage, NotFoundError, NotImplementedError, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingState, type OnboardingStateData, type OnboardingStatus, type PaginatedResponse, type PaymentRequest, PaymentsModule, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, SignupModule, type StartBondQuoteInput, type SubmitFeedbackInput, type SubmitQuoteResponse, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, type WaitForMatchOptions, createClientFromEnv, createDeviceLogin, createSignup, newDeviceSecret };
|
|
2579
|
+
export { type APIKey, type APIResponse, API_KEY_SCOPES, type ApiKey, type ApiKeyInfo, type ApiKeyScope, ApiKeysModule, type AppetiteJobStatus, type AppetiteMatch, type AppetiteMatchInput, type AppetiteMatchResult, type AppetiteMatchStart, AppetiteModule, AuthModule, AuthenticationError, type BindRequestResult, type BindStepUpRequired, type BondToolResult, BondsModule, type BrokerHandoffQuestions, type BrokerHandoffResult, type COI, COIModule, type CancellationReason, type CancellationRequestInput, type CancellationSignInput, type CancellationSignResult, type CancellationStatus, type Carrier, type CarrierAppetiteResult, type CarrierQuote, type CertificateHolder, type ChatMessage, ChatModule, type ChatOptions, type ChatResponse, type ClaimSummary, ClaimsModule, CompaniesModule, type Company, type CompanySize, CompanySizeSchema, type CreateAPIKeyInput, type CreateAccountInput, type CreateAccountResult, type CreateApiKeyInput, type CreateCompanyInput, CreateCompanySchema, type CreateLeadInput, type CreateLeadResult, type CreatedAPIKey, type CreatedApiKey, DEFAULT_BASE_URL, type DailyUsage, type DailyUsageOptions, DeleganceClient, type DeleganceClientConfig, DeleganceError, DeviceLoginModule, type DeviceLoginPoll, type DeviceLoginStart, type Document, type DocumentFacts, type DocumentStatus, DocumentStatusSchema, type DocumentType, DocumentTypeSchema, type DocumentWithExtraction, DocumentsModule, type EnrollResult, type ExchangeResult, type ExtractedPolicy, FEEDBACK_MESSAGE_MAX, type FastBindInput, type FeedbackContext, FeedbackModule, type FeedbackType, type FileClaimInput, type FinancingOffer, ForbiddenError, type GenerateCOIRequest, type GenerateCOIResponse, type GetPolicyResponse, type GetQuoteResponse, type GetSOVResponse, type IdempotencyOptions, type InstantQuestion, type InstantQuestionOption, type InstantQuoteStatus, InstantQuotesModule, type InstantSession, type InstantSubmitResult, KnowledgeModule, type KnowledgeSearchResult, type LeadAddress, LeadsModule, type ListApiKeysOptions, type ListCOIsResponse, type ListCarriersResponse, type ListCompaniesOptions, type ListDocumentsOptions, type ListNotecardsOptions, type ListPoliciesOptions, type ListPoliciesResponse, type ListQuotesOptions, type ListQuotesResponse, type ListSOVsOptions, type ListSOVsResponse, type MeterUsage, NotFoundError, NotImplementedError, type Notecard, OnboardingModule, type OnboardingNextStep, type OnboardingState, type OnboardingStateData, type OnboardingStatus, type PaginatedResponse, type PaymentRequest, PaymentsModule, PoliciesModule, type Policy, type PolicyCoverage, type Quote, type QuoteRequest, QuotesModule, RateLimitError, type RateLimitStatus, type RotateResult, SDK_VERSION, type SOV, type SOVLocation, SOVModule, type SearchInput, SignupModule, type StartBondQuoteInput, type SubmitFeedbackInput, type SubmitQuoteResponse, type UploadDocumentInput, type UploadSOVRequest, type UploadSOVResponse, UsageModule, type UsageSummary, ValidationError, type WaitForExtractionOptions, type WaitForMatchOptions, createClientFromEnv, createDeviceLogin, createSignup, newDeviceSecret };
|
package/dist/index.js
CHANGED
|
@@ -157,7 +157,7 @@ var NotImplementedError = class extends DeleganceError {
|
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
// src/utils/http.ts
|
|
160
|
-
var SDK_VERSION = "0.2.
|
|
160
|
+
var SDK_VERSION = "0.2.1";
|
|
161
161
|
var DEFAULT_BASE_URL = "https://portal.delegancebrokerage.com";
|
|
162
162
|
function isRetryableStatus(status) {
|
|
163
163
|
return status >= 500 && status !== 501;
|
|
@@ -253,6 +253,7 @@ var HttpClient = class {
|
|
|
253
253
|
if (!response.ok) {
|
|
254
254
|
const err = this.handleErrorResponse(response.status, data, traceId);
|
|
255
255
|
if (typeof data.reason === "string") err.reason = data.reason;
|
|
256
|
+
if (typeof data.code === "string") err.code = data.code;
|
|
256
257
|
if (data && typeof data === "object") err.body = data;
|
|
257
258
|
if (err instanceof RateLimitError && err.retryAfter === void 0) {
|
|
258
259
|
const header = Number(response.headers?.get?.("Retry-After"));
|
|
@@ -319,7 +320,11 @@ var CompaniesModule = class {
|
|
|
319
320
|
this.http = http;
|
|
320
321
|
}
|
|
321
322
|
/**
|
|
322
|
-
* Create a new company
|
|
323
|
+
* Create a new company.
|
|
324
|
+
*
|
|
325
|
+
* @deprecated A customer API key cannot create companies (403
|
|
326
|
+
* `tenant_key_cannot_create`). To open a new account, use
|
|
327
|
+
* `createSignup().createAccount()`.
|
|
323
328
|
*
|
|
324
329
|
* @example
|
|
325
330
|
* ```typescript
|
|
@@ -348,14 +353,11 @@ var CompaniesModule = class {
|
|
|
348
353
|
return response.company;
|
|
349
354
|
}
|
|
350
355
|
/**
|
|
351
|
-
* List
|
|
352
|
-
*
|
|
356
|
+
* List the company this API key belongs to. A key belongs to one company.
|
|
357
|
+
*
|
|
353
358
|
* @example
|
|
354
359
|
* ```typescript
|
|
355
|
-
* const
|
|
356
|
-
*
|
|
357
|
-
* // Include companies created via this API key
|
|
358
|
-
* const allCompanies = await client.companies.list({ includeCreated: true });
|
|
360
|
+
* const [company] = await client.companies.list();
|
|
359
361
|
* ```
|
|
360
362
|
*/
|
|
361
363
|
async list(options = {}) {
|
|
@@ -372,7 +374,10 @@ var CompaniesModule = class {
|
|
|
372
374
|
return response.companies;
|
|
373
375
|
}
|
|
374
376
|
/**
|
|
375
|
-
* Get a company by ID
|
|
377
|
+
* Get a company by ID.
|
|
378
|
+
*
|
|
379
|
+
* @deprecated The server has no `GET /api/v1/companies/{id}` route, so this
|
|
380
|
+
* returns 404. Use `list()`, which returns the key's own company.
|
|
376
381
|
*
|
|
377
382
|
* @example
|
|
378
383
|
* ```typescript
|
|
@@ -387,7 +392,10 @@ var CompaniesModule = class {
|
|
|
387
392
|
return response.company;
|
|
388
393
|
}
|
|
389
394
|
/**
|
|
390
|
-
* Create a company if it doesn't exist (using externalId for deduplication)
|
|
395
|
+
* Create a company if it doesn't exist (using externalId for deduplication).
|
|
396
|
+
*
|
|
397
|
+
* @deprecated A customer API key cannot create companies. Use
|
|
398
|
+
* `createSignup().createAccount()` for a new account.
|
|
391
399
|
*
|
|
392
400
|
* @example
|
|
393
401
|
* ```typescript
|
|
@@ -433,7 +441,6 @@ var DocumentsModule = class {
|
|
|
433
441
|
* import fs from 'fs';
|
|
434
442
|
*
|
|
435
443
|
* const doc = await client.documents.upload({
|
|
436
|
-
* companyId: 'company-uuid',
|
|
437
444
|
* file: fs.readFileSync('./policy.pdf'),
|
|
438
445
|
* fileName: 'GL-2025.pdf',
|
|
439
446
|
* documentType: 'policy'
|
|
@@ -443,9 +450,6 @@ var DocumentsModule = class {
|
|
|
443
450
|
* ```
|
|
444
451
|
*/
|
|
445
452
|
async upload(input) {
|
|
446
|
-
if (!input.companyId) {
|
|
447
|
-
throw new ValidationError("companyId is required");
|
|
448
|
-
}
|
|
449
453
|
if (!input.file) {
|
|
450
454
|
throw new ValidationError("file is required");
|
|
451
455
|
}
|
|
@@ -458,9 +462,10 @@ var DocumentsModule = class {
|
|
|
458
462
|
} else {
|
|
459
463
|
fileData = input.file;
|
|
460
464
|
}
|
|
461
|
-
const additionalFields = {
|
|
462
|
-
|
|
463
|
-
|
|
465
|
+
const additionalFields = {};
|
|
466
|
+
if (input.companyId) {
|
|
467
|
+
additionalFields.companyId = input.companyId;
|
|
468
|
+
}
|
|
464
469
|
if (input.documentType) {
|
|
465
470
|
additionalFields.documentType = input.documentType;
|
|
466
471
|
}
|
|
@@ -484,8 +489,8 @@ var DocumentsModule = class {
|
|
|
484
489
|
* @example
|
|
485
490
|
* ```typescript
|
|
486
491
|
* const docs = await client.documents.uploadBatch([
|
|
487
|
-
* {
|
|
488
|
-
* {
|
|
492
|
+
* { file: buffer1, fileName: 'policy1.pdf' },
|
|
493
|
+
* { file: buffer2, fileName: 'policy2.pdf' }
|
|
489
494
|
* ]);
|
|
490
495
|
* ```
|
|
491
496
|
*/
|
|
@@ -1159,7 +1164,7 @@ var SOVModule = class {
|
|
|
1159
1164
|
};
|
|
1160
1165
|
|
|
1161
1166
|
// src/modules/api-keys.ts
|
|
1162
|
-
var API_KEY_SCOPES = ["read", "write", "admin", "appetite:read", "mcp:read", "mcp:orin"];
|
|
1167
|
+
var API_KEY_SCOPES = ["read", "write", "admin", "appetite:read", "mcp:read", "mcp:orin", "claims:write"];
|
|
1163
1168
|
var ApiKeysModule = class {
|
|
1164
1169
|
constructor(http) {
|
|
1165
1170
|
this.http = http;
|