@insurup/sdk 0.1.13 → 0.1.15

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.
Files changed (75) hide show
  1. package/README.md +100 -71
  2. package/dist/client/client.d.ts +160 -0
  3. package/dist/client/client.d.ts.map +1 -0
  4. package/dist/client/graphql.d.ts +51 -0
  5. package/dist/client/graphql.d.ts.map +1 -0
  6. package/dist/client/http.d.ts +173 -0
  7. package/dist/client/http.d.ts.map +1 -0
  8. package/dist/client/signalr.d.ts +69 -0
  9. package/dist/client/signalr.d.ts.map +1 -0
  10. package/dist/clients/_internal/build-filter-search-variables.d.ts +12 -0
  11. package/dist/clients/_internal/build-filter-search-variables.d.ts.map +1 -0
  12. package/dist/clients/_internal/normalize-search.d.ts +21 -0
  13. package/dist/clients/_internal/normalize-search.d.ts.map +1 -0
  14. package/dist/clients/_internal/split-unified-filter.d.ts +16 -0
  15. package/dist/clients/_internal/split-unified-filter.d.ts.map +1 -0
  16. package/dist/clients/agent.d.ts +121 -0
  17. package/dist/clients/agent.d.ts.map +1 -0
  18. package/dist/clients/agentBranch.d.ts +61 -0
  19. package/dist/clients/agentBranch.d.ts.map +1 -0
  20. package/dist/clients/agentRole.d.ts +60 -0
  21. package/dist/clients/agentRole.d.ts.map +1 -0
  22. package/dist/clients/agentSetup.d.ts +34 -0
  23. package/dist/clients/agentSetup.d.ts.map +1 -0
  24. package/dist/clients/agentUser.d.ts +176 -0
  25. package/dist/clients/agentUser.d.ts.map +1 -0
  26. package/dist/clients/case.d.ts +232 -0
  27. package/dist/clients/case.d.ts.map +1 -0
  28. package/dist/clients/coverage.d.ts +98 -0
  29. package/dist/clients/coverage.d.ts.map +1 -0
  30. package/dist/clients/customer.d.ts +252 -0
  31. package/dist/clients/customer.d.ts.map +1 -0
  32. package/dist/clients/file.d.ts +30 -0
  33. package/dist/clients/file.d.ts.map +1 -0
  34. package/dist/clients/insurance.d.ts +105 -0
  35. package/dist/clients/insurance.d.ts.map +1 -0
  36. package/dist/clients/language.d.ts +27 -0
  37. package/dist/clients/language.d.ts.map +1 -0
  38. package/dist/clients/policy.d.ts +251 -0
  39. package/dist/clients/policy.d.ts.map +1 -0
  40. package/dist/clients/property.d.ts +163 -0
  41. package/dist/clients/property.d.ts.map +1 -0
  42. package/dist/clients/proposal.d.ts +259 -0
  43. package/dist/clients/proposal.d.ts.map +1 -0
  44. package/dist/clients/template.d.ts +73 -0
  45. package/dist/clients/template.d.ts.map +1 -0
  46. package/dist/clients/vehicle.d.ts +112 -0
  47. package/dist/clients/vehicle.d.ts.map +1 -0
  48. package/dist/clients/webhook.d.ts +106 -0
  49. package/dist/clients/webhook.d.ts.map +1 -0
  50. package/dist/core/config.d.ts +38 -0
  51. package/dist/core/config.d.ts.map +1 -0
  52. package/dist/core/endpoints.d.ts +1371 -0
  53. package/dist/core/endpoints.d.ts.map +1 -0
  54. package/dist/core/error-types.d.ts +66 -0
  55. package/dist/core/error-types.d.ts.map +1 -0
  56. package/dist/core/errors.d.ts +42 -0
  57. package/dist/core/errors.d.ts.map +1 -0
  58. package/dist/core/options.d.ts +234 -0
  59. package/dist/core/options.d.ts.map +1 -0
  60. package/dist/core/result.d.ts +183 -0
  61. package/dist/core/result.d.ts.map +1 -0
  62. package/dist/core/retry.d.ts +15 -0
  63. package/dist/core/retry.d.ts.map +1 -0
  64. package/dist/index.browser.js +24 -24
  65. package/dist/index.browser.js.map +1 -1
  66. package/dist/index.cjs +574 -525
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.ts +34 -4225
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js +577 -525
  71. package/dist/index.js.map +1 -1
  72. package/dist/version.d.ts +10 -0
  73. package/dist/version.d.ts.map +1 -0
  74. package/package.json +18 -14
  75. package/dist/index.d.cts +0 -4226
package/README.md CHANGED
@@ -66,7 +66,7 @@ graph TB
66
66
  direction TB
67
67
  HTTP[HttpTransport]
68
68
  GQL[GraphQLTransport]
69
-
69
+
70
70
  subgraph Clients[Specialized Clients]
71
71
  direction LR
72
72
  C1[customers]
@@ -81,7 +81,7 @@ graph TB
81
81
  C10[...]
82
82
  end
83
83
  end
84
-
84
+
85
85
  App[Your Application] --> SDK
86
86
  HTTP --> API[InsurUp REST API]
87
87
  GQL --> GQLAPI[InsurUp GraphQL API]
@@ -131,10 +131,10 @@ const customer = getDataOrThrow(await client.customers.getCustomer('id'));
131
131
 
132
132
  ### Error Types
133
133
 
134
- | Kind | Types |
135
- |------|-------|
134
+ | Kind | Types |
135
+ | -------------- | ------------------------------------------------------------------------------------------------------- |
136
136
  | `server-error` | `Unauthorized`, `AccessDenied`, `ResourceNotFound`, `InputValidation`, `BusinessValidation`, `Upstream` |
137
- | `client-error` | `Timeout`, `HttpRequestFailed`, `JsonDeserialization`, `NullResponse` |
137
+ | `client-error` | `Timeout`, `HttpRequestFailed`, `JsonDeserialization`, `NullResponse` |
138
138
 
139
139
  ---
140
140
 
@@ -144,16 +144,16 @@ The SDK includes built-in GraphQL support for querying entities with advanced fi
144
144
 
145
145
  ### Available GraphQL Methods
146
146
 
147
- | Client | Method | Description |
148
- |--------|--------|-------------|
149
- | `customers` | `getCustomers()` | Query customers with filters |
150
- | `policies` | `getPolicies()` | Query policies with filters |
151
- | `policies` | `getPolicyTransfers()` | Query policy transfers |
152
- | `policies` | `getFilePolicyTransfers()` | Query file-based policy transfers |
153
- | `proposals` | `getProposals()` | Query proposals with filters |
154
- | `cases` | `getCases()` | Query cases with filters |
155
- | `agentUsers` | `getAgentUsers()` | Query agent users with filters |
156
- | `webhooks` | `getWebhookDeliveries()` | Query webhook deliveries |
147
+ | Client | Method | Description |
148
+ | ------------ | -------------------------- | --------------------------------- |
149
+ | `customers` | `getCustomers()` | Query customers with filters |
150
+ | `policies` | `getPolicies()` | Query policies with filters |
151
+ | `policies` | `getPolicyTransfers()` | Query policy transfers |
152
+ | `policies` | `getFilePolicyTransfers()` | Query file-based policy transfers |
153
+ | `proposals` | `getProposals()` | Query proposals with filters |
154
+ | `cases` | `getCases()` | Query cases with filters |
155
+ | `agentUsers` | `getAgentUsers()` | Query agent users with filters |
156
+ | `webhooks` | `getWebhookDeliveries()` | Query webhook deliveries |
157
157
 
158
158
  ### Basic Usage
159
159
 
@@ -165,9 +165,9 @@ const result = await client.customers.getCustomers({
165
165
  });
166
166
 
167
167
  if (result.isSuccess) {
168
- console.log(result.data.nodes); // Customer[]
168
+ console.log(result.data.nodes); // Customer[]
169
169
  console.log(result.data.totalCount); // Total count
170
- console.log(result.data.pageInfo); // Pagination info
170
+ console.log(result.data.pageInfo); // Pagination info
171
171
  }
172
172
  ```
173
173
 
@@ -185,37 +185,69 @@ const result = await client.policies.getPolicies({
185
185
  // { id: string; productBranch: ProductBranch; grossPremium: number | null; state: PolicyState }
186
186
  ```
187
187
 
188
- ### Filtering
188
+ ### Filtering and Searching (unified)
189
+
190
+ Every list query takes a single `filter:` field carrying the **unified** input shape. Each per-field entry is either a plain filter operator or, with a `$search: true` marker, a search clause. The SDK splits the unified input into the server's `filter:` and `search:` slots at request time.
191
+
192
+ Operator names match the wire (`notContains`, `notStartsWith`, `notEndsWith`). Search-side text ops (`textSearch`, `wildcard`, `autocomplete`, etc.) take both `string` shorthand and `{ value, score? }` long form; `in`/`nin` take `string[]` shorthand or `{ values, score? }`.
189
193
 
190
194
  ```typescript
191
- import { ProductBranch, PolicyState } from '@insurup/sdk';
195
+ import { CustomerType, ProductBranch } from '@insurup/sdk';
192
196
 
193
- const result = await client.policies.getPolicies({
197
+ // 1. Pure filter — every entry without `$search: true` routes to the wire filter slot
198
+ const filtered = await client.policies.getPolicies({
194
199
  first: 20,
195
200
  filter: {
196
201
  productBranch: { eq: ProductBranch.Traffic },
197
- state: { eq: PolicyState.Active },
198
202
  grossPremium: { gte: 1000 },
203
+ insuredCustomerName: { notContains: 'TEST' },
199
204
  },
200
205
  });
201
- ```
202
206
 
203
- ### Searching
207
+ // 2. Pure search — `$search: true` promotes a field, unlocking search-only operators
208
+ const searched = await client.customers.getCustomers({
209
+ first: 10,
210
+ filter: {
211
+ // Shorthand string — SDK normalizes to { value: 'John' }
212
+ name: { $search: true, textSearch: 'John' },
213
+ },
214
+ });
204
215
 
205
- Full-text search with score boosting:
216
+ // 3. Mixed splits across both wire slots in one call
217
+ const both = await client.customers.getCustomers({
218
+ first: 20,
219
+ filter: {
220
+ type: { eq: CustomerType.Individual }, // → wire `filter:`
221
+ name: { $search: true, textSearch: 'John' }, // → wire `search:`
222
+ identityNumber: { $search: true, in: ['123', '456'] }, // → wire `search:` (string[] shorthand)
223
+ },
224
+ });
206
225
 
207
- ```typescript
208
- const result = await client.customers.getCustomers({
226
+ // 4. Relevance score boost / constant — long-form SearchTextInput
227
+ const boosted = await client.customers.getCustomers({
209
228
  first: 10,
210
- search: {
211
- name: {
212
- text: { value: 'John' },
213
- score: { boost: 2 },
214
- },
229
+ filter: {
230
+ name: { $search: true, textSearch: { value: 'John', score: { boost: 2 } } },
231
+ primaryEmail: { $search: true, contains: { value: '@acme.com', score: { constant: 5 } } },
232
+ },
233
+ });
234
+
235
+ // 5. Combinators — and/or recursively
236
+ const compound = await client.customers.getCustomers({
237
+ first: 20,
238
+ filter: {
239
+ and: [
240
+ { type: { eq: CustomerType.Individual } },
241
+ { name: { $search: true, textSearch: 'John' } },
242
+ ],
215
243
  },
216
244
  });
217
245
  ```
218
246
 
247
+ The `$search` marker is type-checked: it's only allowed on fields the server actually exposes as searchable. Marking a filter-only field is a compile error, as is using a search-only operator (like `textSearch`) without the marker.
248
+
249
+ > If you're consuming the **table adapter** (`@insurup/table-adapter-core`), `setFilter` takes the exact same unified shape. The adapter forwards it to the SDK as-is; the SDK does the split.
250
+
219
251
  ### Sorting
220
252
 
221
253
  ```typescript
@@ -223,10 +255,7 @@ import { SortEnumType } from '@insurup/sdk';
223
255
 
224
256
  const result = await client.cases.getCases({
225
257
  first: 20,
226
- order: [
227
- { priorityScore: SortEnumType.Desc },
228
- { createdAt: SortEnumType.Desc },
229
- ],
258
+ order: [{ priorityScore: SortEnumType.Desc }, { createdAt: SortEnumType.Desc }],
230
259
  });
231
260
  ```
232
261
 
@@ -246,15 +275,15 @@ const client = new DefaultInsurUpClient({
246
275
  });
247
276
  ```
248
277
 
249
- | Option | Type | Default | Description |
250
- |--------|------|---------|-------------|
251
- | `baseUrl` | `string` | `https://api.insurup.com/api/` | API base URL |
252
- | `tokenProvider` | `() => string \| Promise<string>` | — | OAuth token provider |
253
- | `timeoutMs` | `number` | `30000` | Request timeout |
254
- | `customHeaders` | `Record<string, string>` | — | Headers for all requests |
255
- | `retry` | `RetryOptions` | — | Retry configuration |
256
- | `onRequest` | `RequestInterceptor` | — | Pre-request hook |
257
- | `onResponse` | `ResponseInterceptor` | — | Post-response hook |
278
+ | Option | Type | Default | Description |
279
+ | --------------- | --------------------------------- | ------------------------------ | ------------------------ |
280
+ | `baseUrl` | `string` | `https://api.insurup.com/api/` | API base URL |
281
+ | `tokenProvider` | `() => string \| Promise<string>` | — | OAuth token provider |
282
+ | `timeoutMs` | `number` | `30000` | Request timeout |
283
+ | `customHeaders` | `Record<string, string>` | — | Headers for all requests |
284
+ | `retry` | `RetryOptions` | — | Retry configuration |
285
+ | `onRequest` | `RequestInterceptor` | — | Pre-request hook |
286
+ | `onResponse` | `ResponseInterceptor` | — | Post-response hook |
258
287
 
259
288
  ---
260
289
 
@@ -265,7 +294,7 @@ Add logging, correlation IDs, or transform requests/responses:
265
294
  ```typescript
266
295
  const client = new DefaultInsurUpClient({
267
296
  tokenProvider: () => token,
268
-
297
+
269
298
  onRequest: (config) => {
270
299
  console.log(`→ ${config.method} ${config.url}`);
271
300
  return {
@@ -273,7 +302,7 @@ const client = new DefaultInsurUpClient({
273
302
  headers: { ...config.headers, 'X-Correlation-ID': crypto.randomUUID() },
274
303
  };
275
304
  },
276
-
305
+
277
306
  onResponse: (result, config) => {
278
307
  console.log(`← ${config.url} ${result.isSuccess ? '✓' : '✗'}`);
279
308
  return result;
@@ -287,36 +316,36 @@ const client = new DefaultInsurUpClient({
287
316
 
288
317
  Access specialized clients through the main client instance:
289
318
 
290
- | Client | Description |
291
- |--------|-------------|
292
- | `client.customers` | Customer profiles, contact info, health data |
293
- | `client.policies` | Policy details, documents, representatives |
294
- | `client.proposals` | Insurance proposals, comparisons, purchasing |
295
- | `client.vehicles` | Vehicle data, brand/model lookups |
296
- | `client.properties` | Property data, DASK earthquake insurance |
297
- | `client.coverage` | Coverage configuration, coverage groups |
298
- | `client.cases` | Service requests, claims, complaints |
299
- | `client.agents` | Agent profiles, company connections |
300
- | `client.agentBranches` | Branch management |
301
- | `client.agentRoles` | Role-based access control |
302
- | `client.agentUsers` | Agency staff management |
303
- | `client.agentSetup` | Agent onboarding |
304
- | `client.webhooks` | Event notifications, integrations |
305
- | `client.insurance` | Companies, products, resource keys |
306
- | `client.files` | File uploads and management |
307
- | `client.languages` | Localization support |
308
- | `client.templates` | Document and email templates |
319
+ | Client | Description |
320
+ | ---------------------- | -------------------------------------------- |
321
+ | `client.customers` | Customer profiles, contact info, health data |
322
+ | `client.policies` | Policy details, documents, representatives |
323
+ | `client.proposals` | Insurance proposals, comparisons, purchasing |
324
+ | `client.vehicles` | Vehicle data, brand/model lookups |
325
+ | `client.properties` | Property data, DASK earthquake insurance |
326
+ | `client.coverage` | Coverage configuration, coverage groups |
327
+ | `client.cases` | Service requests, claims, complaints |
328
+ | `client.agents` | Agent profiles, company connections |
329
+ | `client.agentBranches` | Branch management |
330
+ | `client.agentRoles` | Role-based access control |
331
+ | `client.agentUsers` | Agency staff management |
332
+ | `client.agentSetup` | Agent onboarding |
333
+ | `client.webhooks` | Event notifications, integrations |
334
+ | `client.insurance` | Companies, products, resource keys |
335
+ | `client.files` | File uploads and management |
336
+ | `client.languages` | Localization support |
337
+ | `client.templates` | Document and email templates |
309
338
 
310
339
  ---
311
340
 
312
341
  ## Compatibility
313
342
 
314
- | Environment | Support |
315
- |-------------|---------|
316
- | Node.js | 18+ |
317
- | Browsers | ES2022+ (Chrome 94+, Firefox 93+, Safari 15+) |
318
- | Bun | ✓ |
319
- | Deno | ✓ |
343
+ | Environment | Support |
344
+ | ----------- | --------------------------------------------- |
345
+ | Node.js | 18+ |
346
+ | Browsers | ES2022+ (Chrome 94+, Firefox 93+, Safari 15+) |
347
+ | Bun | ✓ |
348
+ | Deno | ✓ |
320
349
 
321
350
  Dual ESM/CJS builds included. Full tree-shaking support.
322
351
 
@@ -0,0 +1,160 @@
1
+ /**
2
+ * @fileoverview Default InsurUp Client - Main SDK client implementation
3
+ * @description Main SDK client implementation
4
+ */
5
+ import type { InsurUpClientOptions } from '../core/options.js';
6
+ import { InsurUpAgentClient } from '../clients/agent.js';
7
+ import { InsurUpAgentBranchClient } from '../clients/agentBranch.js';
8
+ import { InsurUpAgentRoleClient } from '../clients/agentRole.js';
9
+ import { InsurUpAgentSetupClient } from '../clients/agentSetup.js';
10
+ import { InsurUpAgentUserClient } from '../clients/agentUser.js';
11
+ import { InsurUpCustomerClient } from '../clients/customer.js';
12
+ import { InsurUpVehicleClient } from '../clients/vehicle.js';
13
+ import { InsurUpPropertyClient } from '../clients/property.js';
14
+ import { InsurUpPolicyClient } from '../clients/policy.js';
15
+ import { InsurUpCaseClient } from '../clients/case.js';
16
+ import { InsurUpWebhookClient } from '../clients/webhook.js';
17
+ import { InsurUpCoverageClient } from '../clients/coverage.js';
18
+ import { InsurUpInsuranceClient } from '../clients/insurance.js';
19
+ import { InsurUpProposalClient } from '../clients/proposal.js';
20
+ import { InsurUpFileClient } from '../clients/file.js';
21
+ import { InsurUpLanguageClient } from '../clients/language.js';
22
+ import { InsurUpTemplateClient } from '../clients/template.js';
23
+ /**
24
+ * Main unified client providing comprehensive access to all InsurUp platform operations.
25
+ * Aggregates specialized client interfaces for authentication, agent management, customer operations,
26
+ * vehicle and property insurance, coverage management, and policy administration.
27
+ */
28
+ export declare class DefaultInsurUpClient {
29
+ private readonly http;
30
+ private readonly graphql;
31
+ private readonly signalR;
32
+ /**
33
+ * Agent Management Client
34
+ *
35
+ * Provides agent management operations for handling agent profiles, insurance company connections,
36
+ * and business relationships within the insurance ecosystem.
37
+ */
38
+ readonly agents: InsurUpAgentClient;
39
+ /**
40
+ * Agent Branch Management Client
41
+ *
42
+ * Provides branch management operations for insurance agents, enabling the creation and administration
43
+ * of organizational branches within agency structures.
44
+ */
45
+ readonly agentBranches: InsurUpAgentBranchClient;
46
+ /**
47
+ * Agent Role Management Client
48
+ *
49
+ * Provides role management operations for insurance agents, enabling the creation and administration
50
+ * of role-based access control within agency hierarchies and permission structures.
51
+ */
52
+ readonly agentRoles: InsurUpAgentRoleClient;
53
+ /**
54
+ * Agent Setup Client
55
+ *
56
+ * Provides agent onboarding and setup operations for new insurance agents joining the InsurUp platform,
57
+ * facilitating the complete registration and configuration process required for business operations.
58
+ */
59
+ readonly agentSetup: InsurUpAgentSetupClient;
60
+ /**
61
+ * Agent User Management Client
62
+ *
63
+ * Provides comprehensive user management operations for insurance agency staff, enabling agencies to manage
64
+ * their team members, permissions, and access control within the InsurUp platform ecosystem.
65
+ */
66
+ readonly agentUsers: InsurUpAgentUserClient;
67
+ /**
68
+ * Customer Management Client
69
+ *
70
+ * Provides comprehensive customer management operations for handling customer profiles, contact information,
71
+ * health data, communication flows, and external customer data integration.
72
+ */
73
+ readonly customers: InsurUpCustomerClient;
74
+ /**
75
+ * Vehicle Management Client
76
+ *
77
+ * Provides comprehensive vehicle management operations for handling customer vehicles, vehicle data lookups,
78
+ * brand and model queries, and vehicle-based insurance operations within the automotive insurance ecosystem.
79
+ */
80
+ readonly vehicles: InsurUpVehicleClient;
81
+ /**
82
+ * Property Management Client
83
+ *
84
+ * Provides comprehensive property management operations for handling customer properties, Turkish address hierarchy queries,
85
+ * DASK earthquake insurance lookups, and property-based insurance operations within the real estate insurance ecosystem.
86
+ */
87
+ readonly properties: InsurUpPropertyClient;
88
+ /**
89
+ * Policy Management Client
90
+ *
91
+ * Provides comprehensive policy management operations for handling insurance policies, policy documents,
92
+ * representative assignments, and policy administration.
93
+ */
94
+ readonly policies: InsurUpPolicyClient;
95
+ /**
96
+ * Case Management Client
97
+ *
98
+ * Provides comprehensive case management operations for handling customer service requests, claims processing,
99
+ * sales opportunities, and complaint resolution within the insurance workflow.
100
+ */
101
+ readonly cases: InsurUpCaseClient;
102
+ /**
103
+ * Webhook Management Client
104
+ *
105
+ * Provides comprehensive webhook management operations for configuring event notifications, monitoring delivery status,
106
+ * and managing external system integrations within the InsurUp platform ecosystem.
107
+ */
108
+ readonly webhooks: InsurUpWebhookClient;
109
+ /**
110
+ * Coverage Management Client
111
+ *
112
+ * Provides coverage management operations for configuring insurance product coverages, managing coverage groups,
113
+ * and retrieving available coverage options for different insurance branches within the InsurUp platform.
114
+ */
115
+ readonly coverage: InsurUpCoverageClient;
116
+ /**
117
+ * Insurance Industry Data Client
118
+ *
119
+ * Provides comprehensive insurance industry data access for retrieving insurance companies, products, resource keys,
120
+ * release notes, and financial institution information essential for platform operations and integrations.
121
+ */
122
+ readonly insurance: InsurUpInsuranceClient;
123
+ /**
124
+ * Proposal Management Client
125
+ *
126
+ * Provides comprehensive proposal management operations for creating insurance proposals, managing proposal lifecycle,
127
+ * document generation, product purchasing, and comparison tools within the insurance sales process.
128
+ */
129
+ readonly proposals: InsurUpProposalClient;
130
+ /**
131
+ * File Management Client
132
+ *
133
+ * Provides file management operations for the InsurUp platform, enabling agents to upload and manage files
134
+ * within the insurance ecosystem.
135
+ */
136
+ readonly files: InsurUpFileClient;
137
+ /**
138
+ * Language Management Client
139
+ *
140
+ * Provides language and localization operations for retrieving available languages in the InsurUp platform.
141
+ * Essential for multi-language support and internationalization features.
142
+ */
143
+ readonly languages: InsurUpLanguageClient;
144
+ /**
145
+ * Template Management Client
146
+ *
147
+ * Provides template management operations for the InsurUp platform, enabling agents to retrieve and update
148
+ * document templates, email templates, and other content templates used in insurance workflows.
149
+ */
150
+ readonly templates: InsurUpTemplateClient;
151
+ readonly options: InsurUpClientOptions;
152
+ constructor(options?: InsurUpClientOptions);
153
+ /**
154
+ * Stop any open SignalR connection and drop pending subscribers. Safe to
155
+ * call multiple times. Call this when disposing of the SDK client (e.g. on
156
+ * app teardown or test cleanup).
157
+ */
158
+ close(): Promise<void>;
159
+ }
160
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;GAIG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgB;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAE3C;;;;;OAKG;IACH,SAAgB,MAAM,EAAE,kBAAkB,CAAC;IAE3C;;;;;OAKG;IACH,SAAgB,aAAa,EAAE,wBAAwB,CAAC;IAExD;;;;;OAKG;IACH,SAAgB,UAAU,EAAE,sBAAsB,CAAC;IAEnD;;;;;OAKG;IACH,SAAgB,UAAU,EAAE,uBAAuB,CAAC;IAEpD;;;;;OAKG;IACH,SAAgB,UAAU,EAAE,sBAAsB,CAAC;IAEnD;;;;;OAKG;IACH,SAAgB,SAAS,EAAE,qBAAqB,CAAC;IAEjD;;;;;OAKG;IACH,SAAgB,QAAQ,EAAE,oBAAoB,CAAC;IAE/C;;;;;OAKG;IACH,SAAgB,UAAU,EAAE,qBAAqB,CAAC;IAElD;;;;;OAKG;IACH,SAAgB,QAAQ,EAAE,mBAAmB,CAAC;IAE9C;;;;;OAKG;IACH,SAAgB,KAAK,EAAE,iBAAiB,CAAC;IAEzC;;;;;OAKG;IACH,SAAgB,QAAQ,EAAE,oBAAoB,CAAC;IAE/C;;;;;OAKG;IACH,SAAgB,QAAQ,EAAE,qBAAqB,CAAC;IAEhD;;;;;OAKG;IACH,SAAgB,SAAS,EAAE,sBAAsB,CAAC;IAElD;;;;;OAKG;IACH,SAAgB,SAAS,EAAE,qBAAqB,CAAC;IAEjD;;;;;OAKG;IACH,SAAgB,KAAK,EAAE,iBAAiB,CAAC;IAEzC;;;;;OAKG;IACH,SAAgB,SAAS,EAAE,qBAAqB,CAAC;IAEjD;;;;;OAKG;IACH,SAAgB,SAAS,EAAE,qBAAqB,CAAC;IAEjD,SAAgB,OAAO,EAAE,oBAAoB,CAAC;gBAElC,OAAO,CAAC,EAAE,oBAAoB;IA8B1C;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @fileoverview GraphQL Transport Layer - Fetch-based GraphQL client
3
+ * @description GraphQL transport with error handling and type safety
4
+ */
5
+ import type { InsurUpGraphQLResult } from '../core/result.js';
6
+ import type { RequestOptions } from '../core/options.js';
7
+ import type { HttpTransport } from './http.js';
8
+ /**
9
+ * Raw GraphQL error from the server response
10
+ */
11
+ interface RawGraphQLError {
12
+ message: string;
13
+ locations?: Array<{
14
+ line: number;
15
+ column: number;
16
+ }>;
17
+ path?: (string | number)[];
18
+ extensions?: Record<string, unknown>;
19
+ }
20
+ /**
21
+ * GraphQL response structure
22
+ */
23
+ export interface GraphQLResponse<T> {
24
+ data?: T;
25
+ errors?: RawGraphQLError[];
26
+ }
27
+ /**
28
+ * GraphQL request payload
29
+ */
30
+ export interface GraphQLRequest {
31
+ query: string;
32
+ variables?: Record<string, unknown>;
33
+ operationName?: string;
34
+ }
35
+ /**
36
+ * GraphQL transport class providing typed query execution
37
+ */
38
+ export declare class GraphQLTransport {
39
+ private readonly http;
40
+ constructor(http: HttpTransport);
41
+ /**
42
+ * Executes a GraphQL query or mutation
43
+ * @param query The GraphQL query string
44
+ * @param variables Optional variables for the query
45
+ * @param options Optional request options
46
+ * @returns Promise resolving to InsurUpGraphQLResult<T>
47
+ */
48
+ query<T>(query: string, variables?: Record<string, unknown>, options?: RequestOptions): Promise<InsurUpGraphQLResult<T>>;
49
+ }
50
+ export {};
51
+ //# sourceMappingURL=graphql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/client/graphql.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAIrB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;GAEG;AACH,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAyFD;;GAEG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;;;;;OAMG;IACG,KAAK,CAAC,CAAC,EACX,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;CAgCpC"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * @fileoverview HTTP Transport Layer - Fetch-based HTTP client
3
+ * @description Cross-environment HTTP transport with timeout support and error handling
4
+ */
5
+ import type { InsurUpResult } from '../core/result.js';
6
+ import type { InsurUpClientOptions, RequestOptions } from '../core/options.js';
7
+ /**
8
+ * HTTP method types
9
+ */
10
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
11
+ /**
12
+ * Valid request body types for HTTP requests
13
+ */
14
+ export type RequestBody = unknown | FormData;
15
+ /**
16
+ * HTTP transport class providing fetch-based request capabilities
17
+ * with environment detection and timeout support
18
+ */
19
+ export declare class HttpTransport {
20
+ private readonly options;
21
+ constructor(options?: InsurUpClientOptions);
22
+ /**
23
+ * Sends an HTTP request and returns the parsed result
24
+ * @template T The expected response type (void for no-content operations)
25
+ * @param method HTTP method
26
+ * @param path Relative path (will be prefixed with baseUrl)
27
+ * @param body Optional request body
28
+ * @param options Optional request options (headers, signal, timeoutMs)
29
+ * @param expectContent Whether the response should contain data (internal use)
30
+ * @returns Promise resolving to InsurUpResult<T>
31
+ */
32
+ private sendInternal;
33
+ /**
34
+ * Sends a single HTTP request without retry logic
35
+ */
36
+ private sendSingleRequest;
37
+ /**
38
+ * Convenience method for GET requests - always expects content
39
+ * @param path Relative path (will be prefixed with baseUrl)
40
+ * @param options Optional request options (headers, signal, timeoutMs)
41
+ */
42
+ get<T>(path: string, options?: RequestOptions): Promise<InsurUpResult<T>>;
43
+ /**
44
+ * POST request expecting a response with data
45
+ * @param path Relative path (will be prefixed with baseUrl)
46
+ * @param data Optional request body
47
+ * @param options Optional request options (headers, signal, timeoutMs)
48
+ * @returns Promise resolving to InsurUpResult<T> with response data
49
+ */
50
+ post<T>(path: string, data?: RequestBody, options?: RequestOptions): Promise<InsurUpResult<T>>;
51
+ /**
52
+ * POST request expecting no response content (204 No Content)
53
+ * @param path Relative path (will be prefixed with baseUrl)
54
+ * @param data Optional request body
55
+ * @param options Optional request options (headers, signal, timeoutMs)
56
+ * @returns Promise resolving to InsurUpResult (no data)
57
+ */
58
+ postNoContent(path: string, data?: RequestBody, options?: RequestOptions): Promise<InsurUpResult>;
59
+ /**
60
+ * PUT request expecting a response with data
61
+ * @param path Relative path (will be prefixed with baseUrl)
62
+ * @param data Optional request body
63
+ * @param options Optional request options (headers, signal, timeoutMs)
64
+ * @returns Promise resolving to InsurUpResult<T> with response data
65
+ */
66
+ put<T>(path: string, data?: RequestBody, options?: RequestOptions): Promise<InsurUpResult<T>>;
67
+ /**
68
+ * PUT request expecting no response content (204 No Content)
69
+ * @param path Relative path (will be prefixed with baseUrl)
70
+ * @param data Optional request body
71
+ * @param options Optional request options (headers, signal, timeoutMs)
72
+ * @returns Promise resolving to InsurUpResult (no data)
73
+ */
74
+ putNoContent(path: string, data?: RequestBody, options?: RequestOptions): Promise<InsurUpResult>;
75
+ /**
76
+ * PATCH request expecting a response with data
77
+ * @param path Relative path (will be prefixed with baseUrl)
78
+ * @param data Optional request body
79
+ * @param options Optional request options (headers, signal, timeoutMs)
80
+ * @returns Promise resolving to InsurUpResult<T> with response data
81
+ */
82
+ patch<T>(path: string, data?: RequestBody, options?: RequestOptions): Promise<InsurUpResult<T>>;
83
+ /**
84
+ * PATCH request expecting no response content (204 No Content)
85
+ * @param path Relative path (will be prefixed with baseUrl)
86
+ * @param data Optional request body
87
+ * @param options Optional request options (headers, signal, timeoutMs)
88
+ * @returns Promise resolving to InsurUpResult (no data)
89
+ */
90
+ patchNoContent(path: string, data?: RequestBody, options?: RequestOptions): Promise<InsurUpResult>;
91
+ /**
92
+ * DELETE request expecting a response with data
93
+ * @param path Relative path (will be prefixed with baseUrl)
94
+ * @param options Optional request options (headers, signal, timeoutMs)
95
+ * @returns Promise resolving to InsurUpResult<T> with response data
96
+ */
97
+ delete<T>(path: string, options?: RequestOptions): Promise<InsurUpResult<T>>;
98
+ /**
99
+ * DELETE request expecting no response content (204 No Content)
100
+ * @param path Relative path (will be prefixed with baseUrl)
101
+ * @param options Optional request options (headers, signal, timeoutMs)
102
+ * @returns Promise resolving to InsurUpResult (no data)
103
+ */
104
+ deleteNoContent(path: string, options?: RequestOptions): Promise<InsurUpResult>;
105
+ /**
106
+ * Downloads a binary file as a Blob
107
+ * Use this for downloading documents, images, or other binary content
108
+ * @param path Relative path (will be prefixed with baseUrl)
109
+ * @param options Optional request options (headers, signal, timeoutMs)
110
+ * @returns Promise resolving to InsurUpResult<Blob>
111
+ */
112
+ getBlob(path: string, options?: RequestOptions): Promise<InsurUpResult<Blob>>;
113
+ /**
114
+ * Builds request headers including defaults and custom headers
115
+ * Invokes token provider if available and adds Authorization header
116
+ */
117
+ private buildHeaders;
118
+ /**
119
+ * Checks if Content-Type header is present (case-insensitive)
120
+ */
121
+ private hasContentTypeHeader;
122
+ /**
123
+ * Checks if a content type is a valid JSON content type
124
+ */
125
+ private isJsonContentType;
126
+ /**
127
+ * Handles HTTP response and converts to InsurUpResult
128
+ * @param response The fetch Response object
129
+ * @param expectContent Whether the caller expects response data
130
+ */
131
+ private handleResponse;
132
+ /**
133
+ * Parses successful JSON response body
134
+ */
135
+ private parseSuccessResponse;
136
+ /**
137
+ * Determines if a result should be retried
138
+ */
139
+ private shouldRetryResult;
140
+ /**
141
+ * Logs outgoing request details
142
+ */
143
+ private logRequest;
144
+ /**
145
+ * Logs response details
146
+ */
147
+ private logResponse;
148
+ /**
149
+ * Logs retry attempt
150
+ */
151
+ private logRetry;
152
+ /**
153
+ * Sanitizes headers for logging (removes sensitive information)
154
+ */
155
+ private sanitizeHeaders;
156
+ /**
157
+ * Sanitizes request body for logging with memory-efficient handling
158
+ */
159
+ private sanitizeBody;
160
+ /**
161
+ * Efficiently estimates if an object is large without full serialization
162
+ */
163
+ private isLargeObject;
164
+ /**
165
+ * Sanitizes response data for logging with memory-efficient handling
166
+ */
167
+ private sanitizeResponseData;
168
+ /**
169
+ * Sanitizes error information for logging
170
+ */
171
+ private sanitizeError;
172
+ }
173
+ //# sourceMappingURL=http.d.ts.map