@insurup/sdk 0.1.16 → 0.1.17

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.cjs CHANGED
@@ -60,7 +60,7 @@ module.exports = __toCommonJS(index_exports);
60
60
  // package.json
61
61
  var package_default = {
62
62
  name: "@insurup/sdk",
63
- version: "0.1.16",
63
+ version: "0.1.17",
64
64
  description: "Type-safe TypeScript SDK for the InsurUp insurance platform with GraphQL support. Tree-shakeable, works everywhere.",
65
65
  keywords: [
66
66
  "insurup",
@@ -2963,6 +2963,16 @@ var InsurUpAgentUserClient = class {
2963
2963
  // src/clients/customer.ts
2964
2964
  var import_contracts3 = require("@insurup/contracts");
2965
2965
  var import_contracts4 = require("@insurup/contracts");
2966
+ function customerTypeDiscriminator(type) {
2967
+ switch (type) {
2968
+ case import_contracts3.CustomerType.Individual:
2969
+ return "individual";
2970
+ case import_contracts3.CustomerType.Company:
2971
+ return "company";
2972
+ case import_contracts3.CustomerType.Foreign:
2973
+ return "foreign";
2974
+ }
2975
+ }
2966
2976
  var InsurUpCustomerClient = class {
2967
2977
  constructor(http, graphql) {
2968
2978
  this.http = http;
@@ -2973,21 +2983,9 @@ var InsurUpCustomerClient = class {
2973
2983
  */
2974
2984
  async createCustomer(request, options) {
2975
2985
  const { type, ...rest } = request;
2976
- let $type;
2977
- switch (type) {
2978
- case import_contracts3.CustomerType.Individual:
2979
- $type = "individual";
2980
- break;
2981
- case import_contracts3.CustomerType.Company:
2982
- $type = "company";
2983
- break;
2984
- case import_contracts3.CustomerType.Foreign:
2985
- $type = "foreign";
2986
- break;
2987
- }
2988
2986
  return this.http.post(
2989
2987
  endpoints.customers.createCustomer,
2990
- { $type, ...rest },
2988
+ { $type: customerTypeDiscriminator(type), ...rest },
2991
2989
  options
2992
2990
  );
2993
2991
  }
@@ -3010,9 +3008,10 @@ var InsurUpCustomerClient = class {
3010
3008
  * Updates existing customer profile information.
3011
3009
  */
3012
3010
  async updateCustomer(request, options) {
3011
+ const { type, ...rest } = request;
3013
3012
  return this.http.putNoContent(
3014
3013
  endpoints.customers.updateCustomer.render(request.id),
3015
- request,
3014
+ { $type: customerTypeDiscriminator(type), ...rest },
3016
3015
  options
3017
3016
  );
3018
3017
  }