@insurup/sdk 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "@insurup/sdk",
10
- version: "0.1.16",
10
+ version: "0.1.18",
11
11
  description: "Type-safe TypeScript SDK for the InsurUp insurance platform with GraphQL support. Tree-shakeable, works everywhere.",
12
12
  keywords: [
13
13
  "insurup",
@@ -2920,6 +2920,16 @@ import {
2920
2920
  CustomerType
2921
2921
  } from "@insurup/contracts";
2922
2922
  import { buildFieldSelection as buildFieldSelection2 } from "@insurup/contracts";
2923
+ function customerTypeDiscriminator(type) {
2924
+ switch (type) {
2925
+ case CustomerType.Individual:
2926
+ return "individual";
2927
+ case CustomerType.Company:
2928
+ return "company";
2929
+ case CustomerType.Foreign:
2930
+ return "foreign";
2931
+ }
2932
+ }
2923
2933
  var InsurUpCustomerClient = class {
2924
2934
  constructor(http, graphql) {
2925
2935
  this.http = http;
@@ -2930,21 +2940,9 @@ var InsurUpCustomerClient = class {
2930
2940
  */
2931
2941
  async createCustomer(request, options) {
2932
2942
  const { type, ...rest } = request;
2933
- let $type;
2934
- switch (type) {
2935
- case CustomerType.Individual:
2936
- $type = "individual";
2937
- break;
2938
- case CustomerType.Company:
2939
- $type = "company";
2940
- break;
2941
- case CustomerType.Foreign:
2942
- $type = "foreign";
2943
- break;
2944
- }
2945
2943
  return this.http.post(
2946
2944
  endpoints.customers.createCustomer,
2947
- { $type, ...rest },
2945
+ { $type: customerTypeDiscriminator(type), ...rest },
2948
2946
  options
2949
2947
  );
2950
2948
  }
@@ -2967,9 +2965,10 @@ var InsurUpCustomerClient = class {
2967
2965
  * Updates existing customer profile information.
2968
2966
  */
2969
2967
  async updateCustomer(request, options) {
2968
+ const { type, ...rest } = request;
2970
2969
  return this.http.putNoContent(
2971
2970
  endpoints.customers.updateCustomer.render(request.id),
2972
- request,
2971
+ { $type: customerTypeDiscriminator(type), ...rest },
2973
2972
  options
2974
2973
  );
2975
2974
  }