@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.mjs
CHANGED
|
@@ -91,7 +91,7 @@ var NotImplementedError = class extends DeleganceError {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
// src/utils/http.ts
|
|
94
|
-
var SDK_VERSION = "0.2.
|
|
94
|
+
var SDK_VERSION = "0.2.1";
|
|
95
95
|
var DEFAULT_BASE_URL = "https://portal.delegancebrokerage.com";
|
|
96
96
|
function isRetryableStatus(status) {
|
|
97
97
|
return status >= 500 && status !== 501;
|
|
@@ -187,6 +187,7 @@ var HttpClient = class {
|
|
|
187
187
|
if (!response.ok) {
|
|
188
188
|
const err = this.handleErrorResponse(response.status, data, traceId);
|
|
189
189
|
if (typeof data.reason === "string") err.reason = data.reason;
|
|
190
|
+
if (typeof data.code === "string") err.code = data.code;
|
|
190
191
|
if (data && typeof data === "object") err.body = data;
|
|
191
192
|
if (err instanceof RateLimitError && err.retryAfter === void 0) {
|
|
192
193
|
const header = Number(response.headers?.get?.("Retry-After"));
|
|
@@ -253,7 +254,11 @@ var CompaniesModule = class {
|
|
|
253
254
|
this.http = http;
|
|
254
255
|
}
|
|
255
256
|
/**
|
|
256
|
-
* Create a new company
|
|
257
|
+
* Create a new company.
|
|
258
|
+
*
|
|
259
|
+
* @deprecated A customer API key cannot create companies (403
|
|
260
|
+
* `tenant_key_cannot_create`). To open a new account, use
|
|
261
|
+
* `createSignup().createAccount()`.
|
|
257
262
|
*
|
|
258
263
|
* @example
|
|
259
264
|
* ```typescript
|
|
@@ -282,14 +287,11 @@ var CompaniesModule = class {
|
|
|
282
287
|
return response.company;
|
|
283
288
|
}
|
|
284
289
|
/**
|
|
285
|
-
* List
|
|
286
|
-
*
|
|
290
|
+
* List the company this API key belongs to. A key belongs to one company.
|
|
291
|
+
*
|
|
287
292
|
* @example
|
|
288
293
|
* ```typescript
|
|
289
|
-
* const
|
|
290
|
-
*
|
|
291
|
-
* // Include companies created via this API key
|
|
292
|
-
* const allCompanies = await client.companies.list({ includeCreated: true });
|
|
294
|
+
* const [company] = await client.companies.list();
|
|
293
295
|
* ```
|
|
294
296
|
*/
|
|
295
297
|
async list(options = {}) {
|
|
@@ -306,7 +308,10 @@ var CompaniesModule = class {
|
|
|
306
308
|
return response.companies;
|
|
307
309
|
}
|
|
308
310
|
/**
|
|
309
|
-
* Get a company by ID
|
|
311
|
+
* Get a company by ID.
|
|
312
|
+
*
|
|
313
|
+
* @deprecated The server has no `GET /api/v1/companies/{id}` route, so this
|
|
314
|
+
* returns 404. Use `list()`, which returns the key's own company.
|
|
310
315
|
*
|
|
311
316
|
* @example
|
|
312
317
|
* ```typescript
|
|
@@ -321,7 +326,10 @@ var CompaniesModule = class {
|
|
|
321
326
|
return response.company;
|
|
322
327
|
}
|
|
323
328
|
/**
|
|
324
|
-
* Create a company if it doesn't exist (using externalId for deduplication)
|
|
329
|
+
* Create a company if it doesn't exist (using externalId for deduplication).
|
|
330
|
+
*
|
|
331
|
+
* @deprecated A customer API key cannot create companies. Use
|
|
332
|
+
* `createSignup().createAccount()` for a new account.
|
|
325
333
|
*
|
|
326
334
|
* @example
|
|
327
335
|
* ```typescript
|
|
@@ -367,7 +375,6 @@ var DocumentsModule = class {
|
|
|
367
375
|
* import fs from 'fs';
|
|
368
376
|
*
|
|
369
377
|
* const doc = await client.documents.upload({
|
|
370
|
-
* companyId: 'company-uuid',
|
|
371
378
|
* file: fs.readFileSync('./policy.pdf'),
|
|
372
379
|
* fileName: 'GL-2025.pdf',
|
|
373
380
|
* documentType: 'policy'
|
|
@@ -377,9 +384,6 @@ var DocumentsModule = class {
|
|
|
377
384
|
* ```
|
|
378
385
|
*/
|
|
379
386
|
async upload(input) {
|
|
380
|
-
if (!input.companyId) {
|
|
381
|
-
throw new ValidationError("companyId is required");
|
|
382
|
-
}
|
|
383
387
|
if (!input.file) {
|
|
384
388
|
throw new ValidationError("file is required");
|
|
385
389
|
}
|
|
@@ -392,9 +396,10 @@ var DocumentsModule = class {
|
|
|
392
396
|
} else {
|
|
393
397
|
fileData = input.file;
|
|
394
398
|
}
|
|
395
|
-
const additionalFields = {
|
|
396
|
-
|
|
397
|
-
|
|
399
|
+
const additionalFields = {};
|
|
400
|
+
if (input.companyId) {
|
|
401
|
+
additionalFields.companyId = input.companyId;
|
|
402
|
+
}
|
|
398
403
|
if (input.documentType) {
|
|
399
404
|
additionalFields.documentType = input.documentType;
|
|
400
405
|
}
|
|
@@ -418,8 +423,8 @@ var DocumentsModule = class {
|
|
|
418
423
|
* @example
|
|
419
424
|
* ```typescript
|
|
420
425
|
* const docs = await client.documents.uploadBatch([
|
|
421
|
-
* {
|
|
422
|
-
* {
|
|
426
|
+
* { file: buffer1, fileName: 'policy1.pdf' },
|
|
427
|
+
* { file: buffer2, fileName: 'policy2.pdf' }
|
|
423
428
|
* ]);
|
|
424
429
|
* ```
|
|
425
430
|
*/
|
|
@@ -1093,7 +1098,7 @@ var SOVModule = class {
|
|
|
1093
1098
|
};
|
|
1094
1099
|
|
|
1095
1100
|
// src/modules/api-keys.ts
|
|
1096
|
-
var API_KEY_SCOPES = ["read", "write", "admin", "appetite:read", "mcp:read", "mcp:orin"];
|
|
1101
|
+
var API_KEY_SCOPES = ["read", "write", "admin", "appetite:read", "mcp:read", "mcp:orin", "claims:write"];
|
|
1097
1102
|
var ApiKeysModule = class {
|
|
1098
1103
|
constructor(http) {
|
|
1099
1104
|
this.http = http;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delegance/sdk",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "TypeScript SDK for
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Get commercial insurance quotes from your code: TypeScript SDK for the Delegance API (instant quotes, signup, policies, certificates)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -36,11 +36,13 @@
|
|
|
36
36
|
"insurance-quote",
|
|
37
37
|
"brokerage",
|
|
38
38
|
"sdk",
|
|
39
|
-
"api"
|
|
39
|
+
"api",
|
|
40
|
+
"ai-agent",
|
|
41
|
+
"mcp"
|
|
40
42
|
],
|
|
41
43
|
"author": "Delegance Inc.",
|
|
42
44
|
"license": "MIT",
|
|
43
|
-
"homepage": "https://delegancebrokerage.com",
|
|
45
|
+
"homepage": "https://portal.delegancebrokerage.com/docs/sdk",
|
|
44
46
|
"bugs": {
|
|
45
47
|
"email": "support@delegancebrokerage.com"
|
|
46
48
|
},
|
|
@@ -66,5 +68,8 @@
|
|
|
66
68
|
"typescript": {
|
|
67
69
|
"optional": true
|
|
68
70
|
}
|
|
71
|
+
},
|
|
72
|
+
"overrides": {
|
|
73
|
+
"esbuild": "^0.28.1"
|
|
69
74
|
}
|
|
70
75
|
}
|