@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/dist/index.cjs CHANGED
@@ -45,6 +45,8 @@ __export(index_exports, {
45
45
  InsurUpTemplateClient: () => InsurUpTemplateClient,
46
46
  InsurUpVehicleClient: () => InsurUpVehicleClient,
47
47
  InsurUpWebhookClient: () => InsurUpWebhookClient,
48
+ SignalRLogLevel: () => import_signalr4.LogLevel,
49
+ SignalRTransport: () => SignalRTransport,
48
50
  VERSION: () => VERSION,
49
51
  createGraphQLErrors: () => createGraphQLErrors,
50
52
  extractError: () => extractError,
@@ -58,7 +60,7 @@ module.exports = __toCommonJS(index_exports);
58
60
  // package.json
59
61
  var package_default = {
60
62
  name: "@insurup/sdk",
61
- version: "0.1.13",
63
+ version: "0.1.15",
62
64
  description: "Type-safe TypeScript SDK for the InsurUp insurance platform with GraphQL support. Tree-shakeable, works everywhere.",
63
65
  keywords: [
64
66
  "insurup",
@@ -108,35 +110,39 @@ var package_default = {
108
110
  }
109
111
  },
110
112
  scripts: {
111
- build: "tsup",
112
- "build:tsc": "tsc",
113
+ build: "tsup && tsc -p tsconfig.build.json",
113
114
  "check-types": "tsc --noEmit",
114
115
  dev: "tsup --watch",
115
116
  docs: "typedoc",
116
117
  lint: "eslint src test --max-warnings 0",
117
118
  test: "vitest run",
119
+ "test:unit": "vitest run test/unit",
120
+ "test:integration": "vitest run test/integration",
118
121
  "test:watch": "vitest",
119
- "test:coverage": "vitest run --coverage"
122
+ "test:coverage": "vitest run --coverage",
123
+ "test:coverage:unit": "vitest run test/unit --coverage",
124
+ "test:coverage:integration": "vitest run test/integration --coverage"
120
125
  },
121
126
  publishConfig: {
122
127
  access: "public"
123
128
  },
124
129
  devDependencies: {
125
- "@eslint/js": "^9.39.2",
126
- "@vitest/coverage-v8": "^4.0.17",
127
- eslint: "^9.39.2",
130
+ "@eslint/js": "^10.0.1",
131
+ "@vitest/coverage-v8": "^4.1.6",
132
+ eslint: "^10.4.0",
128
133
  "eslint-config-prettier": "^10.1.8",
129
134
  "eslint-plugin-prettier": "^5.5.5",
130
- msw: "^2.12.7",
131
- prettier: "^3.8.0",
135
+ msw: "^2.14.6",
136
+ prettier: "^3.8.3",
132
137
  tsup: "^8.5.1",
133
- typedoc: "^0.28.16",
134
- typescript: "^5.9.3",
135
- "typescript-eslint": "^8.53.1",
136
- vitest: "^4.0.17"
138
+ typedoc: "^0.28.19",
139
+ typescript: "^6.0.3",
140
+ "typescript-eslint": "^8.59.3",
141
+ vitest: "^4.1.6"
137
142
  },
138
143
  dependencies: {
139
- "@insurup/contracts": "workspace:*"
144
+ "@insurup/contracts": "workspace:*",
145
+ "@microsoft/signalr": "^10.0.0"
140
146
  }
141
147
  };
142
148
 
@@ -452,15 +458,7 @@ function mergeWithDefaults(options) {
452
458
 
453
459
  // src/core/retry.ts
454
460
  async function withRetry(fn, options) {
455
- const {
456
- retries,
457
- factor,
458
- minTimeout,
459
- maxTimeout,
460
- randomize,
461
- backoffStrategy,
462
- onFailedAttempt
463
- } = options;
461
+ const { retries, factor, minTimeout, maxTimeout, randomize, backoffStrategy, onFailedAttempt } = options;
464
462
  let attempt = 1;
465
463
  while (true) {
466
464
  try {
@@ -624,10 +622,7 @@ var HttpTransport = class {
624
622
  );
625
623
  } catch (interceptorError) {
626
624
  if (this.options.logLevel !== "none") {
627
- this.options.logger.warn(
628
- "Response interceptor failed:",
629
- interceptorError
630
- );
625
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
631
626
  }
632
627
  }
633
628
  }
@@ -643,10 +638,7 @@ var HttpTransport = class {
643
638
  );
644
639
  } catch (interceptorError) {
645
640
  if (this.options.logLevel !== "none") {
646
- this.options.logger.warn(
647
- "Response interceptor failed:",
648
- interceptorError
649
- );
641
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
650
642
  }
651
643
  }
652
644
  }
@@ -729,13 +721,7 @@ var HttpTransport = class {
729
721
  * @returns Promise resolving to InsurUpResult (no data)
730
722
  */
731
723
  async postNoContent(path, data, options) {
732
- return this.sendInternal(
733
- "POST",
734
- path,
735
- data,
736
- options,
737
- false
738
- );
724
+ return this.sendInternal("POST", path, data, options, false);
739
725
  }
740
726
  /**
741
727
  * PUT request expecting a response with data
@@ -755,13 +741,7 @@ var HttpTransport = class {
755
741
  * @returns Promise resolving to InsurUpResult (no data)
756
742
  */
757
743
  async putNoContent(path, data, options) {
758
- return this.sendInternal(
759
- "PUT",
760
- path,
761
- data,
762
- options,
763
- false
764
- );
744
+ return this.sendInternal("PUT", path, data, options, false);
765
745
  }
766
746
  /**
767
747
  * PATCH request expecting a response with data
@@ -781,13 +761,7 @@ var HttpTransport = class {
781
761
  * @returns Promise resolving to InsurUpResult (no data)
782
762
  */
783
763
  async patchNoContent(path, data, options) {
784
- return this.sendInternal(
785
- "PATCH",
786
- path,
787
- data,
788
- options,
789
- false
790
- );
764
+ return this.sendInternal("PATCH", path, data, options, false);
791
765
  }
792
766
  /**
793
767
  * DELETE request expecting a response with data
@@ -805,13 +779,7 @@ var HttpTransport = class {
805
779
  * @returns Promise resolving to InsurUpResult (no data)
806
780
  */
807
781
  async deleteNoContent(path, options) {
808
- return this.sendInternal(
809
- "DELETE",
810
- path,
811
- null,
812
- options,
813
- false
814
- );
782
+ return this.sendInternal("DELETE", path, null, options, false);
815
783
  }
816
784
  /**
817
785
  * Downloads a binary file as a Blob
@@ -867,10 +835,7 @@ var HttpTransport = class {
867
835
  return await this.options.onResponse(networkError, requestConfig);
868
836
  } catch (interceptorError) {
869
837
  if (this.options.logLevel !== "none") {
870
- this.options.logger.warn(
871
- "Response interceptor failed:",
872
- interceptorError
873
- );
838
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
874
839
  }
875
840
  }
876
841
  }
@@ -887,10 +852,7 @@ var HttpTransport = class {
887
852
  return await this.options.onResponse(serverError, requestConfig);
888
853
  } catch (interceptorError) {
889
854
  if (this.options.logLevel !== "none") {
890
- this.options.logger.warn(
891
- "Response interceptor failed:",
892
- interceptorError
893
- );
855
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
894
856
  }
895
857
  }
896
858
  }
@@ -904,10 +866,7 @@ var HttpTransport = class {
904
866
  return await this.options.onResponse(result, requestConfig);
905
867
  } catch (interceptorError) {
906
868
  if (this.options.logLevel !== "none") {
907
- this.options.logger.warn(
908
- "Response interceptor failed:",
909
- interceptorError
910
- );
869
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
911
870
  }
912
871
  }
913
872
  }
@@ -916,16 +875,10 @@ var HttpTransport = class {
916
875
  const deserializationError = createDeserializationError(error);
917
876
  if (this.options.onResponse) {
918
877
  try {
919
- return await this.options.onResponse(
920
- deserializationError,
921
- requestConfig
922
- );
878
+ return await this.options.onResponse(deserializationError, requestConfig);
923
879
  } catch (interceptorError) {
924
880
  if (this.options.logLevel !== "none") {
925
- this.options.logger.warn(
926
- "Response interceptor failed:",
927
- interceptorError
928
- );
881
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
929
882
  }
930
883
  }
931
884
  }
@@ -963,9 +916,7 @@ var HttpTransport = class {
963
916
  * Checks if Content-Type header is present (case-insensitive)
964
917
  */
965
918
  hasContentTypeHeader(headers) {
966
- return Object.keys(headers).some(
967
- (key) => key.toLowerCase() === "content-type"
968
- );
919
+ return Object.keys(headers).some((key) => key.toLowerCase() === "content-type");
969
920
  }
970
921
  /**
971
922
  * Checks if a content type is a valid JSON content type
@@ -999,9 +950,7 @@ var HttpTransport = class {
999
950
  }
1000
951
  const contentType = response.headers.get("content-type");
1001
952
  if (contentType && !this.isJsonContentType(contentType)) {
1002
- return createDeserializationError(
1003
- new Error(`Expected JSON response but got ${contentType}`)
1004
- );
953
+ return createDeserializationError(new Error(`Expected JSON response but got ${contentType}`));
1005
954
  }
1006
955
  return this.parseSuccessResponse(responseText);
1007
956
  }
@@ -1067,16 +1016,12 @@ var HttpTransport = class {
1067
1016
  } else if (this.options.logLevel === "detailed") {
1068
1017
  if (status === "SUCCESS") {
1069
1018
  const data = result.kind === "success" && "data" in result ? this.sanitizeResponseData(result.data) : void 0;
1070
- this.options.logger.info(
1071
- `Response: ${status} in ${duration}ms${attemptInfo}`,
1072
- { data }
1073
- );
1019
+ this.options.logger.info(`Response: ${status} in ${duration}ms${attemptInfo}`, { data });
1074
1020
  } else {
1075
1021
  const sanitizedError = this.sanitizeError(result);
1076
- this.options.logger.error(
1077
- `Response: ${status} in ${duration}ms${attemptInfo}`,
1078
- { error: sanitizedError }
1079
- );
1022
+ this.options.logger.error(`Response: ${status} in ${duration}ms${attemptInfo}`, {
1023
+ error: sanitizedError
1024
+ });
1080
1025
  }
1081
1026
  }
1082
1027
  }
@@ -1088,9 +1033,7 @@ var HttpTransport = class {
1088
1033
  return;
1089
1034
  }
1090
1035
  const reason = result.kind === "server-error" ? `HTTP ${result.status}` : result.kind === "client-error" ? result.type : "Unknown error";
1091
- this.options.logger.warn(
1092
- `Retry attempt ${attemptNumber} failed due to: ${reason}`
1093
- );
1036
+ this.options.logger.warn(`Retry attempt ${attemptNumber} failed due to: ${reason}`);
1094
1037
  }
1095
1038
  /**
1096
1039
  * Sanitizes headers for logging (removes sensitive information)
@@ -1100,12 +1043,7 @@ var HttpTransport = class {
1100
1043
  return void 0;
1101
1044
  }
1102
1045
  const sanitized = {};
1103
- const sensitiveHeaders = [
1104
- "authorization",
1105
- "cookie",
1106
- "x-api-key",
1107
- "x-auth-token"
1108
- ];
1046
+ const sensitiveHeaders = ["authorization", "cookie", "x-api-key", "x-auth-token"];
1109
1047
  for (const [key, value] of Object.entries(headers)) {
1110
1048
  const lowerKey = key.toLowerCase();
1111
1049
  if (sensitiveHeaders.includes(lowerKey)) {
@@ -1168,8 +1106,7 @@ var HttpTransport = class {
1168
1106
  const keys = Object.keys(item);
1169
1107
  propertyCount += keys.length;
1170
1108
  for (const key of keys.slice(0, 10)) {
1171
- if (countProperties(item[key], depth + 1))
1172
- return true;
1109
+ if (countProperties(item[key], depth + 1)) return true;
1173
1110
  }
1174
1111
  }
1175
1112
  return false;
@@ -1269,12 +1206,10 @@ function parseExtensions(raw) {
1269
1206
  }
1270
1207
  function parseGraphQLErrors(rawErrors) {
1271
1208
  return rawErrors.map((error) => {
1272
- const locations = error.locations?.map(
1273
- (loc) => ({
1274
- line: loc.line,
1275
- column: loc.column
1276
- })
1277
- );
1209
+ const locations = error.locations?.map((loc) => ({
1210
+ line: loc.line,
1211
+ column: loc.column
1212
+ }));
1278
1213
  return {
1279
1214
  message: error.message,
1280
1215
  locations,
@@ -1299,11 +1234,7 @@ var GraphQLTransport = class {
1299
1234
  query,
1300
1235
  variables
1301
1236
  };
1302
- const result = await this.http.post(
1303
- "graphql",
1304
- payload,
1305
- options
1306
- );
1237
+ const result = await this.http.post("graphql", payload, options);
1307
1238
  if (!result.isSuccess) {
1308
1239
  return result;
1309
1240
  }
@@ -1321,6 +1252,170 @@ var GraphQLTransport = class {
1321
1252
  }
1322
1253
  };
1323
1254
 
1255
+ // src/client/signalr.ts
1256
+ var import_signalr = require("@microsoft/signalr");
1257
+ var HUB_METHODS = {
1258
+ success: "ReceiveProposalProductSuccess",
1259
+ failed: "ReceiveProposalProductFailed",
1260
+ inProgress: "ReceiveProposalProductInProgress",
1261
+ revised: "ReceiveProposalProductRevised",
1262
+ purchasing: "ReceiveProposalProductPurchasing",
1263
+ purchased: "ReceiveProposalProductPurchased",
1264
+ purchaseFailed: "ReceiveProposalProductPurchaseFailed",
1265
+ coverage: "ReceiveProposalProductCoverage"
1266
+ };
1267
+ var HUB_PATH = "/hubs/proposal-detail";
1268
+ var REGISTER_METHOD = "Register";
1269
+ var SignalRTransport = class {
1270
+ hubUrl;
1271
+ tokenProvider;
1272
+ logLevel;
1273
+ connection = null;
1274
+ /** Pending or in-flight start, shared by concurrent subscribers. */
1275
+ startPromise = null;
1276
+ /** Active subscriptions keyed by proposalId. */
1277
+ subscribers = /* @__PURE__ */ new Map();
1278
+ constructor(options) {
1279
+ this.hubUrl = new URL(HUB_PATH, ensureTrailingSlash(options.hubsBaseUrl)).toString();
1280
+ this.tokenProvider = options.tokenProvider;
1281
+ this.logLevel = options.logLevel ?? import_signalr.LogLevel.Warning;
1282
+ }
1283
+ /**
1284
+ * Subscribe to proposal-detail events for a given proposal. Opens the
1285
+ * underlying hub connection on first subscribe.
1286
+ *
1287
+ * @returns an unsubscribe function. When the last subscriber for the last
1288
+ * proposal unsubscribes, the underlying connection is stopped.
1289
+ */
1290
+ async subscribeProposalDetail(proposalId, handlers) {
1291
+ if (!proposalId) {
1292
+ throw new Error("subscribeProposalDetail: proposalId is required");
1293
+ }
1294
+ let bucket = this.subscribers.get(proposalId);
1295
+ const isFirstForProposal = bucket === void 0;
1296
+ if (bucket === void 0) {
1297
+ bucket = /* @__PURE__ */ new Set();
1298
+ this.subscribers.set(proposalId, bucket);
1299
+ }
1300
+ bucket.add(handlers);
1301
+ try {
1302
+ const connection = await this.ensureStarted();
1303
+ if (isFirstForProposal) {
1304
+ await connection.send(REGISTER_METHOD, { proposalId });
1305
+ }
1306
+ } catch (error) {
1307
+ bucket.delete(handlers);
1308
+ if (bucket.size === 0) {
1309
+ this.subscribers.delete(proposalId);
1310
+ }
1311
+ throw error;
1312
+ }
1313
+ let disposed = false;
1314
+ return () => {
1315
+ if (disposed) {
1316
+ return;
1317
+ }
1318
+ disposed = true;
1319
+ const current = this.subscribers.get(proposalId);
1320
+ if (!current) {
1321
+ return;
1322
+ }
1323
+ current.delete(handlers);
1324
+ if (current.size === 0) {
1325
+ this.subscribers.delete(proposalId);
1326
+ }
1327
+ if (this.subscribers.size === 0) {
1328
+ void this.stop();
1329
+ }
1330
+ };
1331
+ }
1332
+ /** Stop the underlying hub connection if open and drop all subscribers. */
1333
+ async close() {
1334
+ this.subscribers.clear();
1335
+ await this.stop();
1336
+ }
1337
+ async ensureStarted() {
1338
+ if (this.connection && this.connection.state === import_signalr.HubConnectionState.Connected) {
1339
+ return this.connection;
1340
+ }
1341
+ if (this.startPromise) {
1342
+ return this.startPromise;
1343
+ }
1344
+ const connection = this.buildConnection();
1345
+ this.connection = connection;
1346
+ this.startPromise = (async () => {
1347
+ await connection.start();
1348
+ return connection;
1349
+ })();
1350
+ try {
1351
+ return await this.startPromise;
1352
+ } catch (error) {
1353
+ this.connection = null;
1354
+ throw error;
1355
+ } finally {
1356
+ this.startPromise = null;
1357
+ }
1358
+ }
1359
+ buildConnection() {
1360
+ const tokenProvider = this.tokenProvider;
1361
+ const connection = new import_signalr.HubConnectionBuilder().withUrl(this.hubUrl, {
1362
+ accessTokenFactory: tokenProvider ? () => resolveToken(tokenProvider) : void 0,
1363
+ transport: import_signalr.HttpTransportType.WebSockets,
1364
+ skipNegotiation: true
1365
+ }).withAutomaticReconnect().configureLogging(this.logLevel).build();
1366
+ this.registerHandlers(connection);
1367
+ connection.onreconnected(() => {
1368
+ void this.reRegisterAll(connection);
1369
+ });
1370
+ return connection;
1371
+ }
1372
+ registerHandlers(connection) {
1373
+ const dispatch = (method, pick) => {
1374
+ connection.on(method, (event) => {
1375
+ const bucket = this.subscribers.get(event.proposalId);
1376
+ if (!bucket) {
1377
+ return;
1378
+ }
1379
+ for (const handlers of bucket) {
1380
+ const fn = pick(handlers);
1381
+ fn?.(event);
1382
+ }
1383
+ });
1384
+ };
1385
+ dispatch(HUB_METHODS.success, (h) => h.onProductSuccess);
1386
+ dispatch(HUB_METHODS.failed, (h) => h.onProductFailed);
1387
+ dispatch(HUB_METHODS.inProgress, (h) => h.onProductInProgress);
1388
+ dispatch(HUB_METHODS.revised, (h) => h.onProductRevised);
1389
+ dispatch(HUB_METHODS.purchasing, (h) => h.onProductPurchasing);
1390
+ dispatch(HUB_METHODS.purchased, (h) => h.onProductPurchased);
1391
+ dispatch(HUB_METHODS.purchaseFailed, (h) => h.onProductPurchaseFailed);
1392
+ dispatch(HUB_METHODS.coverage, (h) => h.onProductCoverage);
1393
+ }
1394
+ async reRegisterAll(connection) {
1395
+ for (const proposalId of this.subscribers.keys()) {
1396
+ await connection.send(REGISTER_METHOD, { proposalId });
1397
+ }
1398
+ }
1399
+ async stop() {
1400
+ const current = this.connection;
1401
+ if (!current) {
1402
+ return;
1403
+ }
1404
+ this.connection = null;
1405
+ if (current.state === import_signalr.HubConnectionState.Disconnected || current.state === import_signalr.HubConnectionState.Disconnecting) {
1406
+ return;
1407
+ }
1408
+ await current.stop();
1409
+ }
1410
+ };
1411
+ function ensureTrailingSlash(url) {
1412
+ return url.endsWith("/") ? url : `${url}/`;
1413
+ }
1414
+ async function resolveToken(provider) {
1415
+ const result = await provider();
1416
+ return result ?? "";
1417
+ }
1418
+
1324
1419
  // src/core/endpoints.ts
1325
1420
  var endpoints_exports = {};
1326
1421
  __export(endpoints_exports, {
@@ -1445,46 +1540,32 @@ var customers = {
1445
1540
  },
1446
1541
  getCustomer: {
1447
1542
  definition: "customers/{CustomerId}",
1448
- render: (customerId) => "customers/{CustomerId}".replace(
1449
- "{CustomerId}",
1450
- encodeURIComponent(customerId)
1451
- )
1543
+ render: (customerId) => "customers/{CustomerId}".replace("{CustomerId}", encodeURIComponent(customerId))
1452
1544
  },
1453
1545
  updateCustomer: {
1454
1546
  definition: "customers/{CustomerId}",
1455
- render: (customerId) => "customers/{CustomerId}".replace(
1456
- "{CustomerId}",
1457
- encodeURIComponent(customerId)
1458
- )
1547
+ render: (customerId) => "customers/{CustomerId}".replace("{CustomerId}", encodeURIComponent(customerId))
1459
1548
  },
1460
1549
  deleteCustomer: {
1461
1550
  definition: "customers/{CustomerId}",
1462
- render: (customerId) => "customers/{CustomerId}".replace(
1463
- "{CustomerId}",
1464
- encodeURIComponent(customerId)
1465
- )
1551
+ render: (customerId) => "customers/{CustomerId}".replace("{CustomerId}", encodeURIComponent(customerId))
1552
+ },
1553
+ getCustomerAssets: {
1554
+ definition: "customers/{CustomerId}/assets",
1555
+ render: (customerId) => "customers/{CustomerId}/assets".replace("{CustomerId}", encodeURIComponent(customerId))
1466
1556
  },
1467
1557
  getHealthInfo: {
1468
1558
  definition: "customers/{CustomerId}/health-info",
1469
- render: (customerId) => "customers/{CustomerId}/health-info".replace(
1470
- "{CustomerId}",
1471
- encodeURIComponent(customerId)
1472
- )
1559
+ render: (customerId) => "customers/{CustomerId}/health-info".replace("{CustomerId}", encodeURIComponent(customerId))
1473
1560
  },
1474
1561
  updateHealthInfo: {
1475
1562
  definition: "customers/{CustomerId}/health-info",
1476
- render: (customerId) => "customers/{CustomerId}/health-info".replace(
1477
- "{CustomerId}",
1478
- encodeURIComponent(customerId)
1479
- )
1563
+ render: (customerId) => "customers/{CustomerId}/health-info".replace("{CustomerId}", encodeURIComponent(customerId))
1480
1564
  },
1481
1565
  emails: {
1482
1566
  addCustomerEmail: {
1483
1567
  definition: "customers/{CustomerId}/emails",
1484
- render: (customerId) => "customers/{CustomerId}/emails".replace(
1485
- "{CustomerId}",
1486
- encodeURIComponent(customerId)
1487
- )
1568
+ render: (customerId) => "customers/{CustomerId}/emails".replace("{CustomerId}", encodeURIComponent(customerId))
1488
1569
  },
1489
1570
  removeCustomerEmail: {
1490
1571
  definition: "customers/{CustomerId}/emails/{Email}",
@@ -1496,7 +1577,18 @@ var customers = {
1496
1577
  },
1497
1578
  getCustomerEmails: {
1498
1579
  definition: "customers/{CustomerId}/emails",
1499
- render: (customerId) => "customers/{CustomerId}/emails".replace(
1580
+ render: (customerId) => "customers/{CustomerId}/emails".replace("{CustomerId}", encodeURIComponent(customerId))
1581
+ },
1582
+ getPrimaryCustomerEmail: {
1583
+ definition: "customers/{CustomerId}/emails/primary",
1584
+ render: (customerId) => "customers/{CustomerId}/emails/primary".replace(
1585
+ "{CustomerId}",
1586
+ encodeURIComponent(customerId)
1587
+ )
1588
+ },
1589
+ setPrimaryCustomerEmail: {
1590
+ definition: "customers/{CustomerId}/emails/primary",
1591
+ render: (customerId) => "customers/{CustomerId}/emails/primary".replace(
1500
1592
  "{CustomerId}",
1501
1593
  encodeURIComponent(customerId)
1502
1594
  )
@@ -1512,17 +1604,11 @@ var customers = {
1512
1604
  },
1513
1605
  removeCustomerPhoneNumber: {
1514
1606
  definition: "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}",
1515
- render: (request) => "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}".replace("{CustomerId}", encodeURIComponent(request.customerId)).replace(
1516
- "{CountryCode}",
1517
- encodeURIComponent(request.countryCode.toString())
1518
- ).replace("{PhoneNumber}", encodeURIComponent(request.phoneNumber))
1607
+ render: (request) => "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}".replace("{CustomerId}", encodeURIComponent(request.customerId)).replace("{CountryCode}", encodeURIComponent(request.countryCode.toString())).replace("{PhoneNumber}", encodeURIComponent(request.phoneNumber))
1519
1608
  },
1520
1609
  changePrimaryCustomerPhoneNumber: {
1521
1610
  definition: "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}/primary",
1522
- render: (request) => "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}/primary".replace("{CustomerId}", encodeURIComponent(request.customerId)).replace(
1523
- "{CountryCode}",
1524
- encodeURIComponent(request.countryCode.toString())
1525
- ).replace("{PhoneNumber}", encodeURIComponent(request.phoneNumber))
1611
+ render: (request) => "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}/primary".replace("{CustomerId}", encodeURIComponent(request.customerId)).replace("{CountryCode}", encodeURIComponent(request.countryCode.toString())).replace("{PhoneNumber}", encodeURIComponent(request.phoneNumber))
1526
1612
  },
1527
1613
  getCustomerPhoneNumbers: {
1528
1614
  definition: "customers/{CustomerId}/phone-numbers",
@@ -1530,6 +1616,20 @@ var customers = {
1530
1616
  "{CustomerId}",
1531
1617
  encodeURIComponent(customerId)
1532
1618
  )
1619
+ },
1620
+ getPrimaryCustomerPhoneNumber: {
1621
+ definition: "customers/{CustomerId}/phone-numbers/primary",
1622
+ render: (customerId) => "customers/{CustomerId}/phone-numbers/primary".replace(
1623
+ "{CustomerId}",
1624
+ encodeURIComponent(customerId)
1625
+ )
1626
+ },
1627
+ setPrimaryCustomerPhoneNumber: {
1628
+ definition: "customers/{CustomerId}/phone-numbers/primary",
1629
+ render: (customerId) => "customers/{CustomerId}/phone-numbers/primary".replace(
1630
+ "{CustomerId}",
1631
+ encodeURIComponent(customerId)
1632
+ )
1533
1633
  }
1534
1634
  },
1535
1635
  contactFlows: {
@@ -1568,26 +1668,17 @@ var customers = {
1568
1668
  },
1569
1669
  create: {
1570
1670
  definition: "customers/{CustomerId}/contacts",
1571
- render: (customerId) => "customers/{CustomerId}/contacts".replace(
1572
- "{CustomerId}",
1573
- encodeURIComponent(customerId)
1574
- )
1671
+ render: (customerId) => "customers/{CustomerId}/contacts".replace("{CustomerId}", encodeURIComponent(customerId))
1575
1672
  }
1576
1673
  },
1577
1674
  setCustomerBranch: {
1578
1675
  definition: "customers/{CustomerId}/branch",
1579
- render: (customerId) => "customers/{CustomerId}/branch".replace(
1580
- "{CustomerId}",
1581
- encodeURIComponent(customerId)
1582
- )
1676
+ render: (customerId) => "customers/{CustomerId}/branch".replace("{CustomerId}", encodeURIComponent(customerId))
1583
1677
  },
1584
1678
  addresses: {
1585
1679
  create: {
1586
1680
  definition: "customers/{CustomerId}/addresses",
1587
- render: (customerId) => "customers/{CustomerId}/addresses".replace(
1588
- "{CustomerId}",
1589
- encodeURIComponent(customerId)
1590
- )
1681
+ render: (customerId) => "customers/{CustomerId}/addresses".replace("{CustomerId}", encodeURIComponent(customerId))
1591
1682
  },
1592
1683
  update: {
1593
1684
  definition: "customers/{CustomerId}/addresses/{AddressId}",
@@ -1599,10 +1690,7 @@ var customers = {
1599
1690
  },
1600
1691
  getAll: {
1601
1692
  definition: "customers/{CustomerId}/addresses",
1602
- render: (customerId) => "customers/{CustomerId}/addresses".replace(
1603
- "{CustomerId}",
1604
- encodeURIComponent(customerId)
1605
- )
1693
+ render: (customerId) => "customers/{CustomerId}/addresses".replace("{CustomerId}", encodeURIComponent(customerId))
1606
1694
  },
1607
1695
  delete: {
1608
1696
  definition: "customers/{CustomerId}/addresses/{AddressId}",
@@ -1612,10 +1700,7 @@ var customers = {
1612
1700
  consents: {
1613
1701
  give: {
1614
1702
  definition: "customers/{CustomerId}/consents",
1615
- render: (customerId) => "customers/{CustomerId}/consents".replace(
1616
- "{CustomerId}",
1617
- encodeURIComponent(customerId)
1618
- )
1703
+ render: (customerId) => "customers/{CustomerId}/consents".replace("{CustomerId}", encodeURIComponent(customerId))
1619
1704
  },
1620
1705
  revoke: {
1621
1706
  definition: "customers/{CustomerId}/consents/revoke",
@@ -1626,10 +1711,7 @@ var customers = {
1626
1711
  },
1627
1712
  getAll: {
1628
1713
  definition: "customers/{CustomerId}/consents",
1629
- render: (customerId) => "customers/{CustomerId}/consents".replace(
1630
- "{CustomerId}",
1631
- encodeURIComponent(customerId)
1632
- )
1714
+ render: (customerId) => "customers/{CustomerId}/consents".replace("{CustomerId}", encodeURIComponent(customerId))
1633
1715
  }
1634
1716
  }
1635
1717
  };
@@ -1696,10 +1778,7 @@ var vehicles = {
1696
1778
  },
1697
1779
  create: {
1698
1780
  definition: "customers/{CustomerId}/vehicles",
1699
- render: (customerId) => "customers/{CustomerId}/vehicles".replace(
1700
- "{CustomerId}",
1701
- encodeURIComponent(customerId)
1702
- )
1781
+ render: (customerId) => "customers/{CustomerId}/vehicles".replace("{CustomerId}", encodeURIComponent(customerId))
1703
1782
  },
1704
1783
  update: {
1705
1784
  definition: "customers/{CustomerId}/vehicles/{VehicleId}",
@@ -1715,10 +1794,7 @@ var vehicles = {
1715
1794
  },
1716
1795
  getCustomerVehicles: {
1717
1796
  definition: "customers/{CustomerId}/vehicles",
1718
- render: (customerId) => "customers/{CustomerId}/vehicles".replace(
1719
- "{CustomerId}",
1720
- encodeURIComponent(customerId)
1721
- )
1797
+ render: (customerId) => "customers/{CustomerId}/vehicles".replace("{CustomerId}", encodeURIComponent(customerId))
1722
1798
  }
1723
1799
  };
1724
1800
  var insuranceServices = {
@@ -1730,17 +1806,11 @@ var properties = {
1730
1806
  getCurrentCustomerProperties: "customers/me/properties",
1731
1807
  getAll: {
1732
1808
  definition: "customers/{CustomerId}/properties",
1733
- render: (customerId) => "customers/{CustomerId}/properties".replace(
1734
- "{CustomerId}",
1735
- encodeURIComponent(customerId)
1736
- )
1809
+ render: (customerId) => "customers/{CustomerId}/properties".replace("{CustomerId}", encodeURIComponent(customerId))
1737
1810
  },
1738
1811
  create: {
1739
1812
  definition: "customers/{CustomerId}/properties",
1740
- render: (customerId) => "customers/{CustomerId}/properties".replace(
1741
- "{CustomerId}",
1742
- encodeURIComponent(customerId)
1743
- )
1813
+ render: (customerId) => "customers/{CustomerId}/properties".replace("{CustomerId}", encodeURIComponent(customerId))
1744
1814
  },
1745
1815
  getById: {
1746
1816
  definition: "customers/{CustomerId}/properties/{PropertyId}",
@@ -1759,24 +1829,15 @@ var proposals = {
1759
1829
  create: "proposals",
1760
1830
  getProposalById: {
1761
1831
  definition: "proposals/{ProposalId}",
1762
- render: (proposalId) => "proposals/{ProposalId}".replace(
1763
- "{ProposalId}",
1764
- encodeURIComponent(proposalId)
1765
- )
1832
+ render: (proposalId) => "proposals/{ProposalId}".replace("{ProposalId}", encodeURIComponent(proposalId))
1766
1833
  },
1767
1834
  getProposalSnapshot: {
1768
1835
  definition: "proposals/{ProposalId}/snapshot",
1769
- render: (proposalId) => "proposals/{ProposalId}/snapshot".replace(
1770
- "{ProposalId}",
1771
- encodeURIComponent(proposalId)
1772
- )
1836
+ render: (proposalId) => "proposals/{ProposalId}/snapshot".replace("{ProposalId}", encodeURIComponent(proposalId))
1773
1837
  },
1774
1838
  getProposalCoverage: {
1775
1839
  definition: "proposals/{ProposalId}/coverage",
1776
- render: (proposalId) => "proposals/{ProposalId}/coverage".replace(
1777
- "{ProposalId}",
1778
- encodeURIComponent(proposalId)
1779
- )
1840
+ render: (proposalId) => "proposals/{ProposalId}/coverage".replace("{ProposalId}", encodeURIComponent(proposalId))
1780
1841
  },
1781
1842
  getProposalProductCoverage: {
1782
1843
  definition: "proposals/{ProposalId}/products/{ProposalProductId}/coverage",
@@ -1788,10 +1849,7 @@ var proposals = {
1788
1849
  },
1789
1850
  getProposalProductPremiumDetail: {
1790
1851
  definition: "proposals/{ProposalId}/products/{ProposalProductId}/premium-detail/{InstallmentNumber}",
1791
- render: (proposalId, proposalProductId, installmentNumber) => "proposals/{ProposalId}/products/{ProposalProductId}/premium-detail/{InstallmentNumber}".replace("{ProposalId}", encodeURIComponent(proposalId)).replace("{ProposalProductId}", encodeURIComponent(proposalProductId)).replace(
1792
- "{InstallmentNumber}",
1793
- encodeURIComponent(installmentNumber.toString())
1794
- )
1852
+ render: (proposalId, proposalProductId, installmentNumber) => "proposals/{ProposalId}/products/{ProposalProductId}/premium-detail/{InstallmentNumber}".replace("{ProposalId}", encodeURIComponent(proposalId)).replace("{ProposalProductId}", encodeURIComponent(proposalProductId)).replace("{InstallmentNumber}", encodeURIComponent(installmentNumber.toString()))
1795
1853
  },
1796
1854
  purchaseProposalProductSync: {
1797
1855
  definition: "proposals/{ProposalId}/products/{ProposalProductId}/purchase/sync",
@@ -1803,10 +1861,7 @@ var proposals = {
1803
1861
  },
1804
1862
  reviseProposal: {
1805
1863
  definition: "proposals/{ProposalId}/revise",
1806
- render: (proposalId) => "proposals/{ProposalId}/revise".replace(
1807
- "{ProposalId}",
1808
- encodeURIComponent(proposalId)
1809
- )
1864
+ render: (proposalId) => "proposals/{ProposalId}/revise".replace("{ProposalId}", encodeURIComponent(proposalId))
1810
1865
  },
1811
1866
  reviseProposalProduct: {
1812
1867
  definition: "proposals/{ProposalId}/products/{ProposalProductId}/revise",
@@ -1851,10 +1906,7 @@ var proposals = {
1851
1906
  },
1852
1907
  setProposalBranch: {
1853
1908
  definition: "proposals/{ProposalId}/branch",
1854
- render: (proposalId) => "proposals/{ProposalId}/branch".replace(
1855
- "{ProposalId}",
1856
- encodeURIComponent(proposalId)
1857
- )
1909
+ render: (proposalId) => "proposals/{ProposalId}/branch".replace("{ProposalId}", encodeURIComponent(proposalId))
1858
1910
  },
1859
1911
  generateCustomerProposalDocumentPdf: {
1860
1912
  definition: "proposals/{ProposalId}/customer-document-pdf",
@@ -1874,41 +1926,26 @@ var policies = {
1874
1926
  },
1875
1927
  fetchPolicyDocument: {
1876
1928
  definition: "policies/{PolicyId}/document",
1877
- render: (policyId) => "policies/{PolicyId}/document".replace(
1878
- "{PolicyId}",
1879
- encodeURIComponent(policyId)
1880
- )
1929
+ render: (policyId) => "policies/{PolicyId}/document".replace("{PolicyId}", encodeURIComponent(policyId))
1881
1930
  },
1882
1931
  sendPolicyDocument: {
1883
1932
  definition: "policies/{PolicyId}/document/send",
1884
- render: (policyId) => "policies/{PolicyId}/document/send".replace(
1885
- "{PolicyId}",
1886
- encodeURIComponent(policyId)
1887
- )
1933
+ render: (policyId) => "policies/{PolicyId}/document/send".replace("{PolicyId}", encodeURIComponent(policyId))
1888
1934
  },
1889
1935
  setPolicyRepresentative: {
1890
1936
  definition: "policies/{PolicyId}/representative",
1891
- render: (policyId) => "policies/{PolicyId}/representative".replace(
1892
- "{PolicyId}",
1893
- encodeURIComponent(policyId)
1894
- )
1937
+ render: (policyId) => "policies/{PolicyId}/representative".replace("{PolicyId}", encodeURIComponent(policyId))
1895
1938
  },
1896
1939
  setPolicyBranch: {
1897
1940
  definition: "policies/{PolicyId}/branch",
1898
- render: (policyId) => "policies/{PolicyId}/branch".replace(
1899
- "{PolicyId}",
1900
- encodeURIComponent(policyId)
1901
- )
1941
+ render: (policyId) => "policies/{PolicyId}/branch".replace("{PolicyId}", encodeURIComponent(policyId))
1902
1942
  },
1903
1943
  createManualPolicy: {
1904
1944
  definition: "policies/manual"
1905
1945
  },
1906
1946
  updateManualPolicy: {
1907
1947
  definition: "policies/manual/{PolicyId}",
1908
- render: (policyId) => "policies/manual/{PolicyId}".replace(
1909
- "{PolicyId}",
1910
- encodeURIComponent(policyId)
1911
- )
1948
+ render: (policyId) => "policies/manual/{PolicyId}".replace("{PolicyId}", encodeURIComponent(policyId))
1912
1949
  },
1913
1950
  getPolicyCountAndPremiumAnalytics: {
1914
1951
  definition: "policies/analytics/count-and-premium"
@@ -1934,10 +1971,7 @@ var policyTransfers = {
1934
1971
  },
1935
1972
  getPolicyTransferTriggerDetail: {
1936
1973
  definition: "policy-transfers/{PolicyTransferId}/triggers/{PolicyTransferTriggerId}",
1937
- render: (policyTransferId, policyTransferTriggerId) => "policy-transfers/{PolicyTransferId}/triggers/{PolicyTransferTriggerId}".replace("{PolicyTransferId}", encodeURIComponent(policyTransferId)).replace(
1938
- "{PolicyTransferTriggerId}",
1939
- encodeURIComponent(policyTransferTriggerId)
1940
- )
1974
+ render: (policyTransferId, policyTransferTriggerId) => "policy-transfers/{PolicyTransferId}/triggers/{PolicyTransferTriggerId}".replace("{PolicyTransferId}", encodeURIComponent(policyTransferId)).replace("{PolicyTransferTriggerId}", encodeURIComponent(policyTransferTriggerId))
1941
1975
  },
1942
1976
  triggerPolicyTransfer: {
1943
1977
  definition: "policy-transfers/{PolicyTransferId}/trigger",
@@ -1989,10 +2023,7 @@ var agentSetupRequests = {
1989
2023
  },
1990
2024
  disableAgentSetupRequest: {
1991
2025
  definition: "agent-setup-requests/{Id}/disable",
1992
- render: (id) => "agent-setup-requests/{Id}/disable".replace(
1993
- "{Id}",
1994
- encodeURIComponent(id)
1995
- )
2026
+ render: (id) => "agent-setup-requests/{Id}/disable".replace("{Id}", encodeURIComponent(id))
1996
2027
  }
1997
2028
  };
1998
2029
  var agentUsers = {
@@ -2014,17 +2045,11 @@ var agentUsers = {
2014
2045
  },
2015
2046
  deactivate: {
2016
2047
  definition: "agent-users/{AgentUserId}/deactivate",
2017
- render: (userId) => "agent-users/{AgentUserId}/deactivate".replace(
2018
- "{AgentUserId}",
2019
- encodeURIComponent(userId)
2020
- )
2048
+ render: (userId) => "agent-users/{AgentUserId}/deactivate".replace("{AgentUserId}", encodeURIComponent(userId))
2021
2049
  },
2022
2050
  activate: {
2023
2051
  definition: "agent-users/{AgentUserId}/activate",
2024
- render: (userId) => "agent-users/{AgentUserId}/activate".replace(
2025
- "{AgentUserId}",
2026
- encodeURIComponent(userId)
2027
- )
2052
+ render: (userId) => "agent-users/{AgentUserId}/activate".replace("{AgentUserId}", encodeURIComponent(userId))
2028
2053
  },
2029
2054
  delete: {
2030
2055
  definition: "agent-users/{UserId}",
@@ -2036,10 +2061,7 @@ var agentUsers = {
2036
2061
  },
2037
2062
  checkAgentUserInviteCode: {
2038
2063
  definition: "agent-users/check-invite-code",
2039
- render: (code) => "agent-users/check-invite-code?code={code}".replace(
2040
- "{code}",
2041
- encodeURIComponent(code)
2042
- )
2064
+ render: (code) => "agent-users/check-invite-code?code={code}".replace("{code}", encodeURIComponent(code))
2043
2065
  },
2044
2066
  update: {
2045
2067
  definition: "agent-users/{Id}",
@@ -2047,10 +2069,7 @@ var agentUsers = {
2047
2069
  },
2048
2070
  migrate: {
2049
2071
  definition: "agent-users/{AgentUserId}/migrate",
2050
- render: (agentUserId) => "agent-users/{AgentUserId}/migrate".replace(
2051
- "{AgentUserId}",
2052
- encodeURIComponent(agentUserId)
2053
- )
2072
+ render: (agentUserId) => "agent-users/{AgentUserId}/migrate".replace("{AgentUserId}", encodeURIComponent(agentUserId))
2054
2073
  },
2055
2074
  migrateAll: "agent-users/migrate-all"
2056
2075
  };
@@ -2088,17 +2107,11 @@ var webhooks = {
2088
2107
  deliveries: {
2089
2108
  getById: {
2090
2109
  definition: "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}",
2091
- render: (webhookId, webhookDeliveryId) => "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}".replace("{WebhookId}", encodeURIComponent(webhookId)).replace(
2092
- "{WebhookDeliveryId}",
2093
- encodeURIComponent(webhookDeliveryId)
2094
- )
2110
+ render: (webhookId, webhookDeliveryId) => "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}".replace("{WebhookId}", encodeURIComponent(webhookId)).replace("{WebhookDeliveryId}", encodeURIComponent(webhookDeliveryId))
2095
2111
  },
2096
2112
  redeliver: {
2097
2113
  definition: "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}/redeliver",
2098
- render: (webhookId, webhookDeliveryId) => "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}/redeliver".replace("{WebhookId}", encodeURIComponent(webhookId)).replace(
2099
- "{WebhookDeliveryId}",
2100
- encodeURIComponent(webhookDeliveryId)
2101
- )
2114
+ render: (webhookId, webhookDeliveryId) => "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}/redeliver".replace("{WebhookId}", encodeURIComponent(webhookId)).replace("{WebhookDeliveryId}", encodeURIComponent(webhookDeliveryId))
2102
2115
  }
2103
2116
  }
2104
2117
  };
@@ -2273,10 +2286,7 @@ var InsurUpAgentClient = class {
2273
2286
  * @returns Agent profile information / Acente profil bilgileri
2274
2287
  */
2275
2288
  async getCurrentAgent(options) {
2276
- return this.http.get(
2277
- agents.getCurrentAgent,
2278
- options
2279
- );
2289
+ return this.http.get(agents.getCurrentAgent, options);
2280
2290
  }
2281
2291
  /**
2282
2292
  * Updates the current agent's profile information such as business details, contact information, and operational preferences.
@@ -2311,13 +2321,8 @@ var InsurUpAgentClient = class {
2311
2321
  * @returns Available product branches / Mevcut ürün dalları
2312
2322
  */
2313
2323
  async getAgentInsuranceCompanyBranchesAsync(agentInsuranceCompanyId, options) {
2314
- const endpoint = agents.insuranceCompanies.getBranches.render(
2315
- agentInsuranceCompanyId
2316
- );
2317
- return this.http.get(
2318
- endpoint,
2319
- options
2320
- );
2324
+ const endpoint = agents.insuranceCompanies.getBranches.render(agentInsuranceCompanyId);
2325
+ return this.http.get(endpoint, options);
2321
2326
  }
2322
2327
  /**
2323
2328
  * Retrieves the technical connection configuration and credentials for integrating with a specific insurance company's systems.
@@ -2328,13 +2333,8 @@ var InsurUpAgentClient = class {
2328
2333
  * @returns Connection configuration details / Bağlantı yapılandırma detayları
2329
2334
  */
2330
2335
  async getAgentInsuranceCompanyConnectionAsync(agentInsuranceCompanyId, options) {
2331
- const endpoint = agents.insuranceCompanies.getConnection.render(
2332
- agentInsuranceCompanyId
2333
- );
2334
- return this.http.get(
2335
- endpoint,
2336
- options
2337
- );
2336
+ const endpoint = agents.insuranceCompanies.getConnection.render(agentInsuranceCompanyId);
2337
+ return this.http.get(endpoint, options);
2338
2338
  }
2339
2339
  /**
2340
2340
  * Establishes a new business relationship between the agent and an insurance company, enabling the agent to offer that company's products.
@@ -2360,9 +2360,7 @@ var InsurUpAgentClient = class {
2360
2360
  * @returns Operation result / İşlem sonucu
2361
2361
  */
2362
2362
  async removeAgentInsuranceCompany(agentInsuranceCompanyId, options) {
2363
- const endpoint = agents.insuranceCompanies.remove.render(
2364
- agentInsuranceCompanyId
2365
- );
2363
+ const endpoint = agents.insuranceCompanies.remove.render(agentInsuranceCompanyId);
2366
2364
  return this.http.deleteNoContent(endpoint, options);
2367
2365
  }
2368
2366
  /**
@@ -2415,10 +2413,7 @@ var InsurUpAgentClient = class {
2415
2413
  * @returns List of B2C configuration fields
2416
2414
  */
2417
2415
  async getB2CConfigFields(options) {
2418
- return this.http.get(
2419
- b2c.configFields.getAll,
2420
- options
2421
- );
2416
+ return this.http.get(b2c.configFields.getAll, options);
2422
2417
  }
2423
2418
  /**
2424
2419
  * Updates all B2C configuration fields at once, allowing agents to customize their customer-facing interface settings and branding parameters.
@@ -2469,10 +2464,7 @@ var InsurUpAgentBranchClient = class {
2469
2464
  * @returns List of all agent branches
2470
2465
  */
2471
2466
  async getAgentBranches(options) {
2472
- return this.http.get(
2473
- agentBranches.getAll,
2474
- options
2475
- );
2467
+ return this.http.get(agentBranches.getAll, options);
2476
2468
  }
2477
2469
  /**
2478
2470
  * Updates an existing agent branch's name or parent branch relationship to reflect changing organizational needs.
@@ -2578,11 +2570,7 @@ var InsurUpAgentSetupClient = class {
2578
2570
  * @returns Setup process identifier and next steps / Kurulum süreci tanımlayıcısı ve sonraki adımlar
2579
2571
  */
2580
2572
  async enterAgentSetupRequest(request, options) {
2581
- return this.http.post(
2582
- agentSetupRequests.enter,
2583
- request,
2584
- options
2585
- );
2573
+ return this.http.post(agentSetupRequests.enter, request, options);
2586
2574
  }
2587
2575
  /**
2588
2576
  * Finalizes the agent setup process by confirming all requirements are met and activating the agent's platform access.
@@ -2593,17 +2581,118 @@ var InsurUpAgentSetupClient = class {
2593
2581
  * @returns Operation result / İşlem sonucu
2594
2582
  */
2595
2583
  async completeAgentSetupRequest(request, options) {
2596
- return this.http.postNoContent(
2597
- agentSetupRequests.complete,
2598
- request,
2599
- options
2600
- );
2584
+ return this.http.postNoContent(agentSetupRequests.complete, request, options);
2601
2585
  }
2602
2586
  };
2603
2587
 
2604
2588
  // src/clients/agentUser.ts
2605
2589
  var import_contracts = require("@insurup/contracts");
2606
2590
  var import_contracts2 = require("@insurup/contracts");
2591
+
2592
+ // src/clients/_internal/normalize-search.ts
2593
+ var TEXT_INPUT_OPS = /* @__PURE__ */ new Set([
2594
+ "eq",
2595
+ "neq",
2596
+ "textSearch",
2597
+ "wildcard",
2598
+ "autocomplete",
2599
+ "contains",
2600
+ "notContains",
2601
+ "startsWith",
2602
+ "notStartsWith",
2603
+ "endsWith",
2604
+ "notEndsWith"
2605
+ ]);
2606
+ var TEXT_LIST_INPUT_OPS = /* @__PURE__ */ new Set(["in", "nin"]);
2607
+ var COMBINATOR_OPS = /* @__PURE__ */ new Set(["and", "or"]);
2608
+ function normalizeSearchInput(search) {
2609
+ if (search === null || search === void 0) return search;
2610
+ if (typeof search !== "object") return search;
2611
+ return normalizeNode(search);
2612
+ }
2613
+ function normalizeNode(node) {
2614
+ if (node === null || typeof node !== "object") return node;
2615
+ const out = {};
2616
+ for (const [key, value] of Object.entries(node)) {
2617
+ if (COMBINATOR_OPS.has(key) && Array.isArray(value)) {
2618
+ out[key] = value.map(normalizeNode);
2619
+ } else if (value !== null && typeof value === "object" && !Array.isArray(value)) {
2620
+ out[key] = normalizeStringOps(value);
2621
+ } else {
2622
+ out[key] = value;
2623
+ }
2624
+ }
2625
+ return out;
2626
+ }
2627
+ function normalizeStringOps(field) {
2628
+ const out = {};
2629
+ for (const [op, value] of Object.entries(field)) {
2630
+ if (TEXT_INPUT_OPS.has(op) && typeof value === "string") {
2631
+ out[op] = { value };
2632
+ } else if (TEXT_LIST_INPUT_OPS.has(op) && Array.isArray(value)) {
2633
+ out[op] = { values: value };
2634
+ } else if (COMBINATOR_OPS.has(op) && Array.isArray(value)) {
2635
+ out[op] = value.map((item) => normalizeStringOps(item));
2636
+ } else {
2637
+ out[op] = value;
2638
+ }
2639
+ }
2640
+ return out;
2641
+ }
2642
+
2643
+ // src/clients/_internal/split-unified-filter.ts
2644
+ var isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
2645
+ var isSearchMarked = (v) => isObject(v) && v.$search === true;
2646
+ var stripMarker = ({ $search: _marker, ...rest }) => rest;
2647
+ var nonEmpty = (o) => Object.keys(o).length > 0;
2648
+ function splitUnifiedFilter(input) {
2649
+ if (input == null) return { filter: void 0, search: void 0 };
2650
+ const { filter, search } = splitNode(input);
2651
+ return {
2652
+ filter,
2653
+ search
2654
+ };
2655
+ }
2656
+ function splitNode(node) {
2657
+ const filter = {};
2658
+ const search = {};
2659
+ for (const [key, value] of Object.entries(node)) {
2660
+ if ((key === "and" || key === "or") && Array.isArray(value)) {
2661
+ const filterItems = [];
2662
+ const searchItems = [];
2663
+ for (const item of value) {
2664
+ if (!isObject(item)) {
2665
+ filterItems.push(item);
2666
+ continue;
2667
+ }
2668
+ const split = splitNode(item);
2669
+ if (split.filter) filterItems.push(split.filter);
2670
+ if (split.search) searchItems.push(split.search);
2671
+ }
2672
+ if (filterItems.length > 0) filter[key] = filterItems;
2673
+ if (searchItems.length > 0) search[key] = searchItems;
2674
+ } else if (isSearchMarked(value)) {
2675
+ search[key] = stripMarker(value);
2676
+ } else {
2677
+ filter[key] = value;
2678
+ }
2679
+ }
2680
+ return {
2681
+ filter: nonEmpty(filter) ? filter : void 0,
2682
+ search: nonEmpty(search) ? search : void 0
2683
+ };
2684
+ }
2685
+
2686
+ // src/clients/_internal/build-filter-search-variables.ts
2687
+ function buildFilterSearchVariables(input) {
2688
+ const { filter, search } = splitUnifiedFilter(input);
2689
+ const out = {};
2690
+ if (filter !== void 0) out.filter = filter;
2691
+ if (search !== void 0) out.search = normalizeSearchInput(search);
2692
+ return out;
2693
+ }
2694
+
2695
+ // src/clients/agentUser.ts
2607
2696
  var InsurUpAgentUserClient = class {
2608
2697
  constructor(http, graphql) {
2609
2698
  this.http = http;
@@ -2755,10 +2844,7 @@ var InsurUpAgentUserClient = class {
2755
2844
  * @returns Agent user robot code / Acente kullanıcı robot kodu
2756
2845
  */
2757
2846
  async getMyAgentUserRobotCode(options) {
2758
- return this.http.get(
2759
- agentUsers.meRobotCode,
2760
- options
2761
- );
2847
+ return this.http.get(agentUsers.meRobotCode, options);
2762
2848
  }
2763
2849
  /**
2764
2850
  * Migrates an agent user from the legacy authentication system to the AuthServer.
@@ -2782,11 +2868,7 @@ var InsurUpAgentUserClient = class {
2782
2868
  * @returns Response with the count of migrated users / Taşınan kullanıcı sayısı ile yanıt
2783
2869
  */
2784
2870
  async migrateAllAgentUsers(options) {
2785
- return this.http.post(
2786
- agentUsers.migrateAll,
2787
- void 0,
2788
- options
2789
- );
2871
+ return this.http.post(agentUsers.migrateAll, void 0, options);
2790
2872
  }
2791
2873
  // ============================================================================
2792
2874
  // GRAPHQL QUERIES
@@ -2862,8 +2944,7 @@ var InsurUpAgentUserClient = class {
2862
2944
  after: requestOptions?.after,
2863
2945
  last: requestOptions?.last,
2864
2946
  before: requestOptions?.before,
2865
- search: requestOptions?.search,
2866
- filter: requestOptions?.filter,
2947
+ ...buildFilterSearchVariables(requestOptions?.filter),
2867
2948
  order: requestOptions?.order
2868
2949
  };
2869
2950
  const result = await this.graphql.query(query, variables, options);
@@ -2926,10 +3007,7 @@ var InsurUpCustomerClient = class {
2926
3007
  * Retrieves the profile information of the currently authenticated customer.
2927
3008
  */
2928
3009
  async getCurrentCustomer(options) {
2929
- return this.http.get(
2930
- endpoints.customers.getCurrentCustomer,
2931
- options
2932
- );
3010
+ return this.http.get(endpoints.customers.getCurrentCustomer, options);
2933
3011
  }
2934
3012
  /**
2935
3013
  * Updates existing customer profile information.
@@ -2988,14 +3066,37 @@ var InsurUpCustomerClient = class {
2988
3066
  options
2989
3067
  );
2990
3068
  }
3069
+ /**
3070
+ * Retrieves the primary email address for a customer.
3071
+ *
3072
+ * Müşterinin birincil e-posta adresini getirir.
3073
+ */
3074
+ async getPrimaryCustomerEmail(customerId, options) {
3075
+ return this.http.get(
3076
+ endpoints.customers.emails.getPrimaryCustomerEmail.render(customerId),
3077
+ options
3078
+ );
3079
+ }
3080
+ /**
3081
+ * Sets the primary email address for a customer (upsert — adds to the customer's email
3082
+ * collection if missing, then marks it as primary).
3083
+ *
3084
+ * Müşterinin birincil e-posta adresini ayarlar (mevcut değilse koleksiyona ekler ve birincil
3085
+ * olarak işaretler).
3086
+ */
3087
+ async setPrimaryCustomerEmail(request, options) {
3088
+ return this.http.putNoContent(
3089
+ endpoints.customers.emails.setPrimaryCustomerEmail.render(request.customerId),
3090
+ request,
3091
+ options
3092
+ );
3093
+ }
2991
3094
  /**
2992
3095
  * Retrieves all phone numbers associated with a customer.
2993
3096
  */
2994
3097
  async getCustomerPhoneNumbers(customerId, options) {
2995
3098
  return this.http.get(
2996
- endpoints.customers.phoneNumbers.getCustomerPhoneNumbers.render(
2997
- customerId
2998
- ),
3099
+ endpoints.customers.phoneNumbers.getCustomerPhoneNumbers.render(customerId),
2999
3100
  options
3000
3101
  );
3001
3102
  }
@@ -3004,9 +3105,7 @@ var InsurUpCustomerClient = class {
3004
3105
  */
3005
3106
  async addCustomerPhoneNumber(request, options) {
3006
3107
  return this.http.postNoContent(
3007
- endpoints.customers.phoneNumbers.addCustomerPhoneNumber.render(
3008
- request.customerId
3009
- ),
3108
+ endpoints.customers.phoneNumbers.addCustomerPhoneNumber.render(request.customerId),
3010
3109
  request,
3011
3110
  options
3012
3111
  );
@@ -3016,9 +3115,7 @@ var InsurUpCustomerClient = class {
3016
3115
  */
3017
3116
  async removeCustomerPhoneNumber(request, options) {
3018
3117
  return this.http.deleteNoContent(
3019
- endpoints.customers.phoneNumbers.removeCustomerPhoneNumber.render(
3020
- request
3021
- ),
3118
+ endpoints.customers.phoneNumbers.removeCustomerPhoneNumber.render(request),
3022
3119
  options
3023
3120
  );
3024
3121
  }
@@ -3027,13 +3124,49 @@ var InsurUpCustomerClient = class {
3027
3124
  */
3028
3125
  async changePrimaryCustomerPhoneNumber(request, options) {
3029
3126
  return this.http.postNoContent(
3030
- endpoints.customers.phoneNumbers.changePrimaryCustomerPhoneNumber.render(
3031
- request
3032
- ),
3127
+ endpoints.customers.phoneNumbers.changePrimaryCustomerPhoneNumber.render(request),
3033
3128
  void 0,
3034
3129
  options
3035
3130
  );
3036
3131
  }
3132
+ /**
3133
+ * Retrieves the primary phone number for a customer.
3134
+ *
3135
+ * Müşterinin birincil telefon numarasını getirir.
3136
+ */
3137
+ async getPrimaryCustomerPhoneNumber(customerId, options) {
3138
+ return this.http.get(
3139
+ endpoints.customers.phoneNumbers.getPrimaryCustomerPhoneNumber.render(customerId),
3140
+ options
3141
+ );
3142
+ }
3143
+ /**
3144
+ * Sets the primary phone number for a customer (upsert — adds to the customer's phone
3145
+ * number collection if missing, then marks it as primary).
3146
+ *
3147
+ * Müşterinin birincil telefon numarasını ayarlar (mevcut değilse koleksiyona ekler ve
3148
+ * birincil olarak işaretler).
3149
+ */
3150
+ async setPrimaryCustomerPhoneNumber(request, options) {
3151
+ return this.http.putNoContent(
3152
+ endpoints.customers.phoneNumbers.setPrimaryCustomerPhoneNumber.render(request.customerId),
3153
+ request,
3154
+ options
3155
+ );
3156
+ }
3157
+ /**
3158
+ * Retrieves all of a customer's insurable assets (vehicles and properties) in a single
3159
+ * polymorphic list discriminated by the `$type` field.
3160
+ *
3161
+ * Müşterinin tüm sigortalanabilir varlıklarını (araçlar ve mülkler) `$type` alanı ile
3162
+ * ayırt edilen tek bir polimorfik listede getirir.
3163
+ */
3164
+ async getCustomerAssets(customerId, options) {
3165
+ return this.http.get(
3166
+ endpoints.customers.getCustomerAssets.render(customerId),
3167
+ options
3168
+ );
3169
+ }
3037
3170
  /**
3038
3171
  * Assigns a specific agent representative to manage a customer's account.
3039
3172
  */
@@ -3085,10 +3218,7 @@ var InsurUpCustomerClient = class {
3085
3218
  */
3086
3219
  async updateCustomerAddress(request, options) {
3087
3220
  return this.http.putNoContent(
3088
- endpoints.customers.addresses.update.render(
3089
- request.customerId,
3090
- request.addressId
3091
- ),
3221
+ endpoints.customers.addresses.update.render(request.customerId, request.addressId),
3092
3222
  request,
3093
3223
  options
3094
3224
  );
@@ -3208,9 +3338,7 @@ var InsurUpCustomerClient = class {
3208
3338
  */
3209
3339
  async createCustomerContactFlow(request, options) {
3210
3340
  return this.http.postNoContent(
3211
- endpoints.customers.contactFlows.createContactFlow.render(
3212
- request.customerId
3213
- ),
3341
+ endpoints.customers.contactFlows.createContactFlow.render(request.customerId),
3214
3342
  request,
3215
3343
  options
3216
3344
  );
@@ -3243,10 +3371,7 @@ var InsurUpCustomerClient = class {
3243
3371
  */
3244
3372
  async getCustomerContactFlows(customerId, caseRef, options) {
3245
3373
  return this.http.get(
3246
- endpoints.customers.contactFlows.getCustomerContactFlows.render(
3247
- customerId,
3248
- caseRef
3249
- ),
3374
+ endpoints.customers.contactFlows.getCustomerContactFlows.render(customerId, caseRef),
3250
3375
  options
3251
3376
  );
3252
3377
  }
@@ -3255,10 +3380,7 @@ var InsurUpCustomerClient = class {
3255
3380
  */
3256
3381
  async getCustomerContacts(customerId, caseRef, options) {
3257
3382
  return this.http.get(
3258
- endpoints.customers.contacts.getCustomerContacts.render(
3259
- customerId,
3260
- caseRef
3261
- ),
3383
+ endpoints.customers.contacts.getCustomerContacts.render(customerId, caseRef),
3262
3384
  options
3263
3385
  );
3264
3386
  }
@@ -3344,25 +3466,15 @@ var InsurUpCustomerClient = class {
3344
3466
  }
3345
3467
  }
3346
3468
  `;
3347
- const variables = {};
3348
- if (requestOptions?.first === void 0 && requestOptions?.last === void 0) {
3349
- variables.first = 50;
3350
- } else {
3351
- if (requestOptions?.first !== void 0)
3352
- variables.first = requestOptions.first;
3353
- if (requestOptions?.last !== void 0)
3354
- variables.last = requestOptions.last;
3355
- }
3356
- if (requestOptions?.after !== void 0)
3357
- variables.after = requestOptions.after;
3358
- if (requestOptions?.before !== void 0)
3359
- variables.before = requestOptions.before;
3360
- if (requestOptions?.search !== void 0)
3361
- variables.search = requestOptions.search;
3362
- if (requestOptions?.filter !== void 0)
3363
- variables.filter = requestOptions.filter;
3364
- if (requestOptions?.order !== void 0)
3365
- variables.order = requestOptions.order;
3469
+ const first = requestOptions?.first === void 0 && requestOptions?.last === void 0 ? 50 : requestOptions?.first;
3470
+ const variables = {
3471
+ first,
3472
+ after: requestOptions?.after,
3473
+ last: requestOptions?.last,
3474
+ before: requestOptions?.before,
3475
+ ...buildFilterSearchVariables(requestOptions?.filter),
3476
+ order: requestOptions?.order
3477
+ };
3366
3478
  const result = await this.graphql.query(query, variables, options);
3367
3479
  if (!result.isSuccess) {
3368
3480
  return result;
@@ -3405,10 +3517,7 @@ var InsurUpVehicleClient = class {
3405
3517
  * @returns Operation result / İşlem sonucu
3406
3518
  */
3407
3519
  async updateCustomerVehicle(request, options) {
3408
- const path = endpoints.vehicles.update.render(
3409
- request.customerId,
3410
- request.vehicleId
3411
- );
3520
+ const path = endpoints.vehicles.update.render(request.customerId, request.vehicleId);
3412
3521
  return this.http.putNoContent(path, request, options);
3413
3522
  }
3414
3523
  /**
@@ -3433,9 +3542,7 @@ var InsurUpVehicleClient = class {
3433
3542
  * @returns List of customer vehicles / Müşteri araçları listesi
3434
3543
  */
3435
3544
  async getCustomerVehicles(request, options) {
3436
- const path = endpoints.vehicles.getCustomerVehicles.render(
3437
- request.customerId
3438
- );
3545
+ const path = endpoints.vehicles.getCustomerVehicles.render(request.customerId);
3439
3546
  return this.http.get(path, options);
3440
3547
  }
3441
3548
  /**
@@ -3497,11 +3604,7 @@ var InsurUpVehicleClient = class {
3497
3604
  async queryVehicleByBrandCode(brandCode, options) {
3498
3605
  const path = endpoints.insuranceServices.queryVehicleByBrandCode;
3499
3606
  const request = { brandCode };
3500
- return this.http.post(
3501
- path,
3502
- request,
3503
- options
3504
- );
3607
+ return this.http.post(path, request, options);
3505
3608
  }
3506
3609
  };
3507
3610
 
@@ -3519,10 +3622,7 @@ var InsurUpPropertyClient = class {
3519
3622
  * @returns List of Turkish cities / Türk şehirleri listesi
3520
3623
  */
3521
3624
  async queryCities(options) {
3522
- return this.http.get(
3523
- addressParameters.queryCities,
3524
- options
3525
- );
3625
+ return this.http.get(addressParameters.queryCities, options);
3526
3626
  }
3527
3627
  /**
3528
3628
  * Retrieves all districts within a specific city following the Turkish administrative hierarchy.
@@ -3678,10 +3778,7 @@ var InsurUpPropertyClient = class {
3678
3778
  * @returns Operation result / İşlem sonucu
3679
3779
  */
3680
3780
  async deleteCustomerProperty(customerId, propertyId, options) {
3681
- return this.http.deleteNoContent(
3682
- properties.delete.render(customerId, propertyId),
3683
- options
3684
- );
3781
+ return this.http.deleteNoContent(properties.delete.render(customerId, propertyId), options);
3685
3782
  }
3686
3783
  /**
3687
3784
  * Retrieves property address information using the official Turkish property registration number for verification purposes.
@@ -3908,9 +4005,7 @@ var InsurUpPolicyClient = class {
3908
4005
  */
3909
4006
  async getPolicyTransferDetail(request, options) {
3910
4007
  return this.http.get(
3911
- endpoints.policyTransfers.getPolicyTransferDetail.render(
3912
- request.policyTransferId
3913
- ),
4008
+ endpoints.policyTransfers.getPolicyTransferDetail.render(request.policyTransferId),
3914
4009
  options
3915
4010
  );
3916
4011
  }
@@ -3940,11 +4035,7 @@ var InsurUpPolicyClient = class {
3940
4035
  * @returns Created transfer identifier
3941
4036
  */
3942
4037
  async createPolicyTransfer(request, options) {
3943
- return this.http.post(
3944
- endpoints.policyTransfers.create,
3945
- request,
3946
- options
3947
- );
4038
+ return this.http.post(endpoints.policyTransfers.create, request, options);
3948
4039
  }
3949
4040
  /**
3950
4041
  * Executes a prepared policy transfer, initiating the actual movement of policies according to the transfer configuration.
@@ -3956,9 +4047,7 @@ var InsurUpPolicyClient = class {
3956
4047
  */
3957
4048
  async triggerPolicyTransfer(request, options) {
3958
4049
  return this.http.postNoContent(
3959
- endpoints.policyTransfers.triggerPolicyTransfer.render(
3960
- request.policyTransferId
3961
- ),
4050
+ endpoints.policyTransfers.triggerPolicyTransfer.render(request.policyTransferId),
3962
4051
  request,
3963
4052
  options
3964
4053
  );
@@ -3975,16 +4064,9 @@ var InsurUpPolicyClient = class {
3975
4064
  */
3976
4065
  async createFilePolicyTransfer(request, file, fileName, options) {
3977
4066
  const formData = new FormData();
3978
- formData.append(
3979
- "insuranceCompanyId",
3980
- request.insuranceCompanyId.toString()
3981
- );
4067
+ formData.append("insuranceCompanyId", request.insuranceCompanyId.toString());
3982
4068
  formData.append("file", file, fileName);
3983
- return this.http.postNoContent(
3984
- endpoints.filePolicyTransfers.create,
3985
- formData,
3986
- options
3987
- );
4069
+ return this.http.postNoContent(endpoints.filePolicyTransfers.create, formData, options);
3988
4070
  }
3989
4071
  /**
3990
4072
  * Retrieves detailed information about a file-based policy transfer including processing status and results.
@@ -4077,8 +4159,7 @@ var InsurUpPolicyClient = class {
4077
4159
  after: requestOptions?.after,
4078
4160
  last: requestOptions?.last,
4079
4161
  before: requestOptions?.before,
4080
- search: requestOptions?.search,
4081
- filter: requestOptions?.filter,
4162
+ ...buildFilterSearchVariables(requestOptions?.filter),
4082
4163
  order: requestOptions?.order
4083
4164
  };
4084
4165
  const result = await this.graphql.query(query, variables, options);
@@ -4158,8 +4239,7 @@ var InsurUpPolicyClient = class {
4158
4239
  after: requestOptions?.after,
4159
4240
  last: requestOptions?.last,
4160
4241
  before: requestOptions?.before,
4161
- search: requestOptions?.search,
4162
- filter: requestOptions?.filter,
4242
+ ...buildFilterSearchVariables(requestOptions?.filter),
4163
4243
  order: requestOptions?.order
4164
4244
  };
4165
4245
  const result = await this.graphql.query(query, variables, options);
@@ -4239,8 +4319,7 @@ var InsurUpPolicyClient = class {
4239
4319
  after: requestOptions?.after,
4240
4320
  last: requestOptions?.last,
4241
4321
  before: requestOptions?.before,
4242
- search: requestOptions?.search,
4243
- filter: requestOptions?.filter,
4322
+ ...buildFilterSearchVariables(requestOptions?.filter),
4244
4323
  order: requestOptions?.order
4245
4324
  };
4246
4325
  const result = await this.graphql.query(query, variables, options);
@@ -4323,11 +4402,7 @@ var InsurUpCaseClient = class {
4323
4402
  * @returns Created case identifier / Oluşturulan talep tanımlayıcısı
4324
4403
  */
4325
4404
  async createComplaintCase(request, options) {
4326
- return await this.http.post(
4327
- cases.createComplaint,
4328
- request,
4329
- options
4330
- );
4405
+ return await this.http.post(cases.createComplaint, request, options);
4331
4406
  }
4332
4407
  /**
4333
4408
  * Creates a cross-sale opportunity case to track potential additional insurance products for existing customers.
@@ -4338,11 +4413,7 @@ var InsurUpCaseClient = class {
4338
4413
  * @returns Created case identifier / Oluşturulan talep tanımlayıcısı
4339
4414
  */
4340
4415
  async createCrossSaleOpportunityCase(request, options) {
4341
- return await this.http.post(
4342
- cases.createCrossSaleOpportunity,
4343
- request,
4344
- options
4345
- );
4416
+ return await this.http.post(cases.createCrossSaleOpportunity, request, options);
4346
4417
  }
4347
4418
  /**
4348
4419
  * Creates an endorsement case for policy modifications or updates requested by the customer.
@@ -4353,11 +4424,7 @@ var InsurUpCaseClient = class {
4353
4424
  * @returns Created case identifier / Oluşturulan talep tanımlayıcısı
4354
4425
  */
4355
4426
  async createEndorsementCase(request, options) {
4356
- return await this.http.post(
4357
- cases.createEndorsement,
4358
- request,
4359
- options
4360
- );
4427
+ return await this.http.post(cases.createEndorsement, request, options);
4361
4428
  }
4362
4429
  /**
4363
4430
  * Creates a new sale opportunity case to track potential insurance sales to prospective customers.
@@ -4368,11 +4435,7 @@ var InsurUpCaseClient = class {
4368
4435
  * @returns Created case identifier / Oluşturulan talep tanımlayıcısı
4369
4436
  */
4370
4437
  async createNewSaleOpportunityCase(request, options) {
4371
- return await this.http.post(
4372
- cases.createNewSaleOpportunity,
4373
- request,
4374
- options
4375
- );
4438
+ return await this.http.post(cases.createNewSaleOpportunity, request, options);
4376
4439
  }
4377
4440
  /**
4378
4441
  * Retrieves all policies associated with a specific case for comprehensive case context and decision making.
@@ -4524,10 +4587,7 @@ var InsurUpCaseClient = class {
4524
4587
  * @returns Available case priority templates / Mevcut talep öncelik şablonları
4525
4588
  */
4526
4589
  async getCasePriorityTemplates(options) {
4527
- return await this.http.get(
4528
- cases.getPriorityTemplates,
4529
- options
4530
- );
4590
+ return await this.http.get(cases.getPriorityTemplates, options);
4531
4591
  }
4532
4592
  // ============================================================================
4533
4593
  // GRAPHQL QUERIES
@@ -4603,8 +4663,7 @@ var InsurUpCaseClient = class {
4603
4663
  after: requestOptions?.after,
4604
4664
  last: requestOptions?.last,
4605
4665
  before: requestOptions?.before,
4606
- search: requestOptions?.search,
4607
- filter: requestOptions?.filter,
4666
+ ...buildFilterSearchVariables(requestOptions?.filter),
4608
4667
  order: requestOptions?.order
4609
4668
  };
4610
4669
  const result = await this.graphql.query(query, variables, options);
@@ -4640,11 +4699,7 @@ var InsurUpWebhookClient = class {
4640
4699
  * @returns Created webhook information / Oluşturulan webhook bilgileri
4641
4700
  */
4642
4701
  async createWebhook(request, options) {
4643
- return this.http.post(
4644
- webhooks.create,
4645
- request,
4646
- options
4647
- );
4702
+ return this.http.post(webhooks.create, request, options);
4648
4703
  }
4649
4704
  /**
4650
4705
  * Retrieves detailed information about a specific webhook including its configuration and current status.
@@ -4702,10 +4757,7 @@ var InsurUpWebhookClient = class {
4702
4757
  * @returns Webhook delivery details / Webhook teslimat detayları
4703
4758
  */
4704
4759
  async getWebhookDelivery(webhookId, webhookDeliveryId, options) {
4705
- const endpoint = webhooks.deliveries.getById.render(
4706
- webhookId,
4707
- webhookDeliveryId
4708
- );
4760
+ const endpoint = webhooks.deliveries.getById.render(webhookId, webhookDeliveryId);
4709
4761
  return this.http.get(endpoint, options);
4710
4762
  }
4711
4763
  /**
@@ -4718,10 +4770,7 @@ var InsurUpWebhookClient = class {
4718
4770
  * @returns Operation result / İşlem sonucu
4719
4771
  */
4720
4772
  async redeliverWebhookEvent(webhookId, webhookDeliveryId, options) {
4721
- const endpoint = webhooks.deliveries.redeliver.render(
4722
- webhookId,
4723
- webhookDeliveryId
4724
- );
4773
+ const endpoint = webhooks.deliveries.redeliver.render(webhookId, webhookDeliveryId);
4725
4774
  return this.http.postNoContent(endpoint, void 0, options);
4726
4775
  }
4727
4776
  // ============================================================================
@@ -4798,8 +4847,7 @@ var InsurUpWebhookClient = class {
4798
4847
  after: requestOptions?.after,
4799
4848
  last: requestOptions?.last,
4800
4849
  before: requestOptions?.before,
4801
- search: requestOptions?.search,
4802
- filter: requestOptions?.filter,
4850
+ ...buildFilterSearchVariables(requestOptions?.filter),
4803
4851
  order: requestOptions?.order
4804
4852
  };
4805
4853
  const result = await this.graphql.query(query, variables, options);
@@ -4843,11 +4891,7 @@ var InsurUpCoverageClient = class {
4843
4891
  * @returns Operation result / İşlem sonucu
4844
4892
  */
4845
4893
  async updateCoverageGroup(request, options) {
4846
- return this.http.putNoContent(
4847
- coverageGroups.update.render(request.id),
4848
- request,
4849
- options
4850
- );
4894
+ return this.http.putNoContent(coverageGroups.update.render(request.id), request, options);
4851
4895
  }
4852
4896
  /**
4853
4897
  * Removes a coverage group from the system, ensuring proper cleanup of associated coverage configurations.
@@ -4858,10 +4902,7 @@ var InsurUpCoverageClient = class {
4858
4902
  * @returns Operation result / İşlem sonucu
4859
4903
  */
4860
4904
  async deleteCoverageGroup(request, options) {
4861
- return this.http.deleteNoContent(
4862
- coverageGroups.delete.render(request.id),
4863
- options
4864
- );
4905
+ return this.http.deleteNoContent(coverageGroups.delete.render(request.id), options);
4865
4906
  }
4866
4907
  /**
4867
4908
  * Retrieves detailed information about a specific coverage group including its coverage options and configurations.
@@ -4872,10 +4913,7 @@ var InsurUpCoverageClient = class {
4872
4913
  * @returns Coverage group details / Teminat grubu detayları
4873
4914
  */
4874
4915
  async getCoverageGroupById(coverageGroupId, options) {
4875
- return this.http.get(
4876
- coverageGroups.getById.render(coverageGroupId),
4877
- options
4878
- );
4916
+ return this.http.get(coverageGroups.getById.render(coverageGroupId), options);
4879
4917
  }
4880
4918
  /**
4881
4919
  * Retrieves all available coverage groups within the agency for comprehensive coverage management overview.
@@ -4896,13 +4934,8 @@ var InsurUpCoverageClient = class {
4896
4934
  * @returns Kasko coverage choices grouped by insurance company / Sigorta şirketine göre gruplanmış Kasko teminat seçenekleri
4897
4935
  */
4898
4936
  async getKaskoCoverageChoices(vehicleUtilizationStyle, options) {
4899
- const endpoint = coverageChoices.getKaskoCoverageChoices.render(
4900
- vehicleUtilizationStyle
4901
- );
4902
- return this.http.get(
4903
- endpoint,
4904
- options
4905
- );
4937
+ const endpoint = coverageChoices.getKaskoCoverageChoices.render(vehicleUtilizationStyle);
4938
+ return this.http.get(endpoint, options);
4906
4939
  }
4907
4940
  /**
4908
4941
  * Retrieves available Konut (home/property insurance) coverage options including DASK earthquake insurance configurations.
@@ -4982,9 +5015,7 @@ var InsurUpInsuranceClient = class {
4982
5015
  * @returns List of insurance products / Sigorta ürünleri listesi
4983
5016
  */
4984
5017
  async getInsuranceCompanyProducts(insuranceCompanyId, options) {
4985
- const path = endpoints.insuranceCompanies.getInsuranceCompanyProducts.render(
4986
- insuranceCompanyId
4987
- );
5018
+ const path = endpoints.insuranceCompanies.getInsuranceCompanyProducts.render(insuranceCompanyId);
4988
5019
  return this.http.get(path, options);
4989
5020
  }
4990
5021
  /**
@@ -4995,10 +5026,7 @@ var InsurUpInsuranceClient = class {
4995
5026
  * @returns List of all insurance products / Tüm sigorta ürünleri listesi
4996
5027
  */
4997
5028
  async getAllProducts(options) {
4998
- return this.http.get(
4999
- endpoints.insuranceCompanies.getAllProducts,
5000
- options
5001
- );
5029
+ return this.http.get(endpoints.insuranceCompanies.getAllProducts, options);
5002
5030
  }
5003
5031
  /**
5004
5032
  * Retrieves agent-specific connection fields and requirements for integrating with a particular insurance company's systems.
@@ -5012,10 +5040,7 @@ var InsurUpInsuranceClient = class {
5012
5040
  const path = endpoints.insuranceCompanies.connectionFields.getAgentBasedConnectionFieldsByCompanyId.render(
5013
5041
  insuranceCompanyId
5014
5042
  );
5015
- return this.http.get(
5016
- path,
5017
- options
5018
- );
5043
+ return this.http.get(path, options);
5019
5044
  }
5020
5045
  /**
5021
5046
  * Retrieves all platform release notes including new features, bug fixes, and important updates for system awareness.
@@ -5025,10 +5050,7 @@ var InsurUpInsuranceClient = class {
5025
5050
  * @returns Platform release notes / Platform sürüm notları
5026
5051
  */
5027
5052
  async getAllReleaseNotes(options) {
5028
- return this.http.get(
5029
- endpoints.releaseNotes.getAll,
5030
- options
5031
- );
5053
+ return this.http.get(endpoints.releaseNotes.getAll, options);
5032
5054
  }
5033
5055
  /**
5034
5056
  * Retrieves all banks available for premium collection, policy financing, and customer payment processing operations.
@@ -5060,10 +5082,7 @@ var InsurUpInsuranceClient = class {
5060
5082
  * @returns List of financial institutions / Finansal kurumlar listesi
5061
5083
  */
5062
5084
  async getFinancialInstitutions(options) {
5063
- return this.http.get(
5064
- endpoints.financialInstitutions.getAll,
5065
- options
5066
- );
5085
+ return this.http.get(endpoints.financialInstitutions.getAll, options);
5067
5086
  }
5068
5087
  };
5069
5088
 
@@ -5071,9 +5090,42 @@ var InsurUpInsuranceClient = class {
5071
5090
  var import_contracts13 = require("@insurup/contracts");
5072
5091
  var import_contracts14 = require("@insurup/contracts");
5073
5092
  var InsurUpProposalClient = class {
5074
- constructor(http, graphql) {
5093
+ constructor(http, graphql, signalR) {
5075
5094
  this.http = http;
5076
5095
  this.graphql = graphql;
5096
+ this.signalR = signalR;
5097
+ }
5098
+ /**
5099
+ * Subscribe to real-time updates for a proposal via the InsurUp SignalR
5100
+ * ProposalDetailHub. The first subscriber opens the underlying hub
5101
+ * connection lazily; subscriptions for additional proposals are multiplexed
5102
+ * over the same connection. Pass only the handlers you care about.
5103
+ *
5104
+ * Teklif için gerçek zamanlı güncellemelere SignalR üzerinden abone olur.
5105
+ *
5106
+ * @param proposalId - The proposal to subscribe to / Abone olunacak teklif
5107
+ * @param handlers - Per-event callbacks; missing entries are ignored
5108
+ * @returns An unsubscribe function. When the last subscription is torn
5109
+ * down, the underlying hub connection is stopped.
5110
+ * @throws If the SDK client was constructed without SignalR support
5111
+ *
5112
+ * @example
5113
+ * ```typescript
5114
+ * const unsub = await client.proposals.subscribeToDetail(proposalId, {
5115
+ * onProductSuccess: (event) => console.log('priced', event),
5116
+ * onProductFailed: (event) => console.warn('failed', event.errorMessage),
5117
+ * });
5118
+ * // later
5119
+ * unsub();
5120
+ * ```
5121
+ */
5122
+ async subscribeToDetail(proposalId, handlers) {
5123
+ if (!this.signalR) {
5124
+ throw new Error(
5125
+ "subscribeToDetail requires SignalR support; construct the client via DefaultInsurUpClient"
5126
+ );
5127
+ }
5128
+ return this.signalR.subscribeProposalDetail(proposalId, handlers);
5077
5129
  }
5078
5130
  /**
5079
5131
  * Creates a new insurance proposal with customer information, coverage selections, and product options for quotation.
@@ -5084,11 +5136,7 @@ var InsurUpProposalClient = class {
5084
5136
  * @returns Created proposal information / Oluşturulan teklif bilgileri
5085
5137
  */
5086
5138
  async createProposal(request, options) {
5087
- return this.http.post(
5088
- endpoints.proposals.create,
5089
- request,
5090
- options
5091
- );
5139
+ return this.http.post(endpoints.proposals.create, request, options);
5092
5140
  }
5093
5141
  /**
5094
5142
  * Retries a failed proposal product calculation or processing to attempt resolution of temporary issues.
@@ -5105,10 +5153,7 @@ var InsurUpProposalClient = class {
5105
5153
  proposalProductId
5106
5154
  };
5107
5155
  return this.http.postNoContent(
5108
- endpoints.proposals.retryFailedProposalProduct.render(
5109
- proposalId,
5110
- proposalProductId
5111
- ),
5156
+ endpoints.proposals.retryFailedProposalProduct.render(proposalId, proposalProductId),
5112
5157
  request,
5113
5158
  options
5114
5159
  );
@@ -5194,10 +5239,7 @@ var InsurUpProposalClient = class {
5194
5239
  */
5195
5240
  async getProposalProductCoverage(proposalId, proposalProductId, options) {
5196
5241
  return this.http.get(
5197
- endpoints.proposals.getProposalProductCoverage.render(
5198
- proposalId,
5199
- proposalProductId
5200
- ),
5242
+ endpoints.proposals.getProposalProductCoverage.render(proposalId, proposalProductId),
5201
5243
  options
5202
5244
  );
5203
5245
  }
@@ -5314,9 +5356,7 @@ var InsurUpProposalClient = class {
5314
5356
  */
5315
5357
  async generateCompareProposalProductsPdf(request, options) {
5316
5358
  return this.http.post(
5317
- endpoints.proposals.generateCompareProposalProductsPdf.render(
5318
- request.proposalId
5319
- ),
5359
+ endpoints.proposals.generateCompareProposalProductsPdf.render(request.proposalId),
5320
5360
  request,
5321
5361
  options
5322
5362
  );
@@ -5331,9 +5371,7 @@ var InsurUpProposalClient = class {
5331
5371
  */
5332
5372
  async sendCompareProposalProductsPdf(request, options) {
5333
5373
  return this.http.postNoContent(
5334
- endpoints.proposals.sendCompareProposalProductsPdf.render(
5335
- request.proposalId
5336
- ),
5374
+ endpoints.proposals.sendCompareProposalProductsPdf.render(request.proposalId),
5337
5375
  request,
5338
5376
  options
5339
5377
  );
@@ -5348,9 +5386,7 @@ var InsurUpProposalClient = class {
5348
5386
  */
5349
5387
  async generateCustomerProposalDocumentPdf(request, options) {
5350
5388
  return this.http.post(
5351
- endpoints.proposals.generateCustomerProposalDocumentPdf.render(
5352
- request.proposalId
5353
- ),
5389
+ endpoints.proposals.generateCustomerProposalDocumentPdf.render(request.proposalId),
5354
5390
  request,
5355
5391
  options
5356
5392
  );
@@ -5474,8 +5510,7 @@ var InsurUpProposalClient = class {
5474
5510
  after: requestOptions?.after,
5475
5511
  last: requestOptions?.last,
5476
5512
  before: requestOptions?.before,
5477
- search: requestOptions?.search,
5478
- filter: requestOptions?.filter,
5513
+ ...buildFilterSearchVariables(requestOptions?.filter),
5479
5514
  order: requestOptions?.order
5480
5515
  };
5481
5516
  const result = await this.graphql.query(query, variables, options);
@@ -5517,11 +5552,7 @@ var InsurUpFileClient = class {
5517
5552
  if (request.path) {
5518
5553
  formData.append("path", request.path);
5519
5554
  }
5520
- return this.http.post(
5521
- files.uploadPublicFile,
5522
- formData,
5523
- options
5524
- );
5555
+ return this.http.post(files.uploadPublicFile, formData, options);
5525
5556
  }
5526
5557
  };
5527
5558
 
@@ -5561,10 +5592,7 @@ var InsurUpTemplateClient = class {
5561
5592
  * @returns List of all template definitions
5562
5593
  */
5563
5594
  async getTemplateDefinitions(options) {
5564
- return this.http.get(
5565
- templates.getDefinitions,
5566
- options
5567
- );
5595
+ return this.http.get(templates.getDefinitions, options);
5568
5596
  }
5569
5597
  /**
5570
5598
  * Retrieves all available templates in the system with their metadata and content.
@@ -5627,6 +5655,7 @@ var InsurUpTemplateClient = class {
5627
5655
  var DefaultInsurUpClient = class {
5628
5656
  http;
5629
5657
  graphql;
5658
+ signalR;
5630
5659
  /**
5631
5660
  * Agent Management Client
5632
5661
  *
@@ -5751,6 +5780,11 @@ var DefaultInsurUpClient = class {
5751
5780
  this.http = new HttpTransport(options);
5752
5781
  this.graphql = new GraphQLTransport(this.http);
5753
5782
  this.options = options || {};
5783
+ this.signalR = new SignalRTransport({
5784
+ hubsBaseUrl: options?.hubsBaseUrl ?? deriveHubsBaseUrl(options?.baseUrl),
5785
+ tokenProvider: options?.tokenProvider,
5786
+ logLevel: options?.signalRLogLevel
5787
+ });
5754
5788
  this.agents = new InsurUpAgentClient(this.http);
5755
5789
  this.agentBranches = new InsurUpAgentBranchClient(this.http);
5756
5790
  this.agentRoles = new InsurUpAgentRoleClient(this.http);
@@ -5764,14 +5798,27 @@ var DefaultInsurUpClient = class {
5764
5798
  this.webhooks = new InsurUpWebhookClient(this.http, this.graphql);
5765
5799
  this.coverage = new InsurUpCoverageClient(this.http);
5766
5800
  this.insurance = new InsurUpInsuranceClient(this.http);
5767
- this.proposals = new InsurUpProposalClient(this.http, this.graphql);
5801
+ this.proposals = new InsurUpProposalClient(this.http, this.graphql, this.signalR);
5768
5802
  this.files = new InsurUpFileClient(this.http);
5769
5803
  this.languages = new InsurUpLanguageClient(this.http);
5770
5804
  this.templates = new InsurUpTemplateClient(this.http);
5771
5805
  }
5806
+ /**
5807
+ * Stop any open SignalR connection and drop pending subscribers. Safe to
5808
+ * call multiple times. Call this when disposing of the SDK client (e.g. on
5809
+ * app teardown or test cleanup).
5810
+ */
5811
+ async close() {
5812
+ await this.signalR.close();
5813
+ }
5772
5814
  };
5815
+ function deriveHubsBaseUrl(baseUrl) {
5816
+ const resolved = baseUrl ?? "https://api.insurup.com/api/";
5817
+ return new URL(resolved).origin;
5818
+ }
5773
5819
 
5774
5820
  // src/index.ts
5821
+ var import_signalr4 = require("@microsoft/signalr");
5775
5822
  __reExport(index_exports, require("@insurup/contracts"), module.exports);
5776
5823
  // Annotate the CommonJS export names for ESM import in node:
5777
5824
  0 && (module.exports = {
@@ -5799,6 +5846,8 @@ __reExport(index_exports, require("@insurup/contracts"), module.exports);
5799
5846
  InsurUpTemplateClient,
5800
5847
  InsurUpVehicleClient,
5801
5848
  InsurUpWebhookClient,
5849
+ SignalRLogLevel,
5850
+ SignalRTransport,
5802
5851
  VERSION,
5803
5852
  createGraphQLErrors,
5804
5853
  extractError,