@insurup/sdk 0.1.1 → 0.1.2

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
@@ -20,7 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ALL_AGENT_USER_FIELDS: () => ALL_AGENT_USER_FIELDS,
24
+ ALL_CASE_FIELDS: () => ALL_CASE_FIELDS,
25
+ ALL_CUSTOMER_FIELDS: () => ALL_CUSTOMER_FIELDS,
26
+ ALL_FILE_POLICY_TRANSFER_FIELDS: () => ALL_FILE_POLICY_TRANSFER_FIELDS,
27
+ ALL_POLICY_FIELDS: () => ALL_POLICY_FIELDS,
28
+ ALL_POLICY_TRANSFER_FIELDS: () => ALL_POLICY_TRANSFER_FIELDS,
29
+ ALL_PROPOSAL_FIELDS: () => ALL_PROPOSAL_FIELDS,
30
+ ALL_WEBHOOK_DELIVERY_FIELDS: () => ALL_WEBHOOK_DELIVERY_FIELDS,
23
31
  AgentInsuranceCompanyType: () => AgentInsuranceCompanyType,
32
+ AgentUserState: () => AgentUserState,
24
33
  AracSegment: () => AracSegment,
25
34
  AssetType: () => AssetType,
26
35
  B2CConfigFieldType: () => B2CConfigFieldType,
@@ -34,17 +43,21 @@ __export(index_exports, {
34
43
  CaseType: () => CaseType,
35
44
  Channel: () => Channel,
36
45
  ComplaintCaseSubType: () => ComplaintCaseSubType,
46
+ ConsentType: () => ConsentType,
37
47
  ContactFlowState: () => ContactFlowState,
38
48
  ContactState: () => ContactState,
39
49
  ContactType: () => ContactType,
40
50
  Currency: () => Currency,
41
51
  CustomerType: () => CustomerType,
52
+ DateOnly: () => DateOnly,
53
+ DateTime: () => DateTime,
42
54
  DefaultInsurUpClient: () => DefaultInsurUpClient,
43
55
  Disease: () => Disease,
44
56
  EducationStatus: () => EducationStatus,
45
57
  EndorsementCaseSubType: () => EndorsementCaseSubType,
46
58
  Endpoints: () => endpoints_exports,
47
59
  Gender: () => Gender,
60
+ GraphQLTransport: () => GraphQLTransport,
48
61
  HastaneAgi: () => HastaneAgi,
49
62
  InsurUpAgentBranchClient: () => InsurUpAgentBranchClient,
50
63
  InsurUpAgentClient: () => InsurUpAgentClient,
@@ -88,17 +101,21 @@ __export(index_exports, {
88
101
  SaglikPaketiTedaviSekli: () => SaglikPaketiTedaviSekli,
89
102
  SaleOpportunityCaseSubType: () => SaleOpportunityCaseSubType,
90
103
  SmsImplementation: () => SmsImplementation,
104
+ SortEnumType: () => SortEnumType,
91
105
  Surgery: () => Surgery,
92
106
  TasinanYuk: () => TasinanYuk,
93
107
  TransferredPolicyFailureReason: () => TransferredPolicyFailureReason,
94
108
  TransferredPolicySkipReason: () => TransferredPolicySkipReason,
95
109
  TransferredPolicyStatus: () => TransferredPolicyStatus,
110
+ UserType: () => UserType,
96
111
  VERSION: () => VERSION,
97
112
  VehicleAccessoryType: () => VehicleAccessoryType,
98
113
  VehicleFuelType: () => VehicleFuelType,
99
114
  VehicleUtilizationStyle: () => VehicleUtilizationStyle,
115
+ WebhookDeliveryState: () => WebhookDeliveryState,
100
116
  WebhookEvent: () => WebhookEvent,
101
117
  YedekParcaTuru: () => YedekParcaTuru,
118
+ buildFieldSelection: () => buildFieldSelection,
102
119
  extractError: () => extractError,
103
120
  getDataOrThrow: () => getDataOrThrow,
104
121
  mergeCoverage: () => mergeCoverage,
@@ -109,14 +126,15 @@ module.exports = __toCommonJS(index_exports);
109
126
  // package.json
110
127
  var package_default = {
111
128
  name: "@insurup/sdk",
112
- version: "0.1.1",
113
- description: "Type-safe TypeScript SDK for the InsurUp insurance platform. Zero dependencies, tree-shakeable, works everywhere.",
129
+ version: "0.1.2",
130
+ description: "Type-safe TypeScript SDK for the InsurUp insurance platform with GraphQL support. Zero dependencies, tree-shakeable, works everywhere.",
114
131
  keywords: [
115
132
  "insurup",
116
133
  "insurance",
117
134
  "sdk",
118
135
  "typescript",
119
136
  "api-client",
137
+ "graphql",
120
138
  "policy",
121
139
  "claims",
122
140
  "coverage",
@@ -191,6 +209,7 @@ var InsurUpClientErrorType = /* @__PURE__ */ ((InsurUpClientErrorType2) => {
191
209
  InsurUpClientErrorType2["Timeout"] = "Timeout";
192
210
  InsurUpClientErrorType2["HttpRequestFailed"] = "HttpRequestFailed";
193
211
  InsurUpClientErrorType2["UnexpectedNoContent"] = "UnexpectedNoContent";
212
+ InsurUpClientErrorType2["GraphQLError"] = "GraphQLError";
194
213
  return InsurUpClientErrorType2;
195
214
  })(InsurUpClientErrorType || {});
196
215
  var InsurUpServerErrorType = /* @__PURE__ */ ((InsurUpServerErrorType2) => {
@@ -1221,6 +1240,52 @@ var HttpTransport = class {
1221
1240
  }
1222
1241
  };
1223
1242
 
1243
+ // src/client/graphql.ts
1244
+ var GraphQLTransport = class {
1245
+ constructor(http) {
1246
+ this.http = http;
1247
+ }
1248
+ /**
1249
+ * Executes a GraphQL query or mutation
1250
+ * @param query The GraphQL query string
1251
+ * @param variables Optional variables for the query
1252
+ * @param options Optional request options
1253
+ * @returns Promise resolving to InsurUpResult<T>
1254
+ */
1255
+ async query(query, variables, options) {
1256
+ const payload = {
1257
+ query,
1258
+ variables
1259
+ };
1260
+ const result = await this.http.post(
1261
+ "graphql",
1262
+ payload,
1263
+ options
1264
+ );
1265
+ if (!result.isSuccess) {
1266
+ return result;
1267
+ }
1268
+ const response = result.data;
1269
+ if (response.errors && response.errors.length > 0) {
1270
+ const firstError = response.errors[0];
1271
+ const clientError = {
1272
+ kind: "client-error",
1273
+ isSuccess: false,
1274
+ message: firstError.message,
1275
+ type: "Unknown" /* Unknown */,
1276
+ error: response.errors
1277
+ };
1278
+ return clientError;
1279
+ }
1280
+ if (!response.data) {
1281
+ return createDeserializationError(
1282
+ new Error("GraphQL response contained no data and no errors")
1283
+ );
1284
+ }
1285
+ return createSuccess(response.data);
1286
+ }
1287
+ };
1288
+
1224
1289
  // src/core/endpoints.ts
1225
1290
  var endpoints_exports = {};
1226
1291
  __export(endpoints_exports, {
@@ -2501,10 +2566,159 @@ var InsurUpAgentSetupClient = class {
2501
2566
  }
2502
2567
  };
2503
2568
 
2569
+ // src/contracts/graphql/agentUsers.ts
2570
+ var ALL_AGENT_USER_FIELDS = [
2571
+ // Primitive fields
2572
+ "id",
2573
+ "email",
2574
+ "firstName",
2575
+ "lastName",
2576
+ "name",
2577
+ "phoneNumber",
2578
+ "phoneNumberCountryCode",
2579
+ "state",
2580
+ "createdAt",
2581
+ "lastLoginAt",
2582
+ // Nested roles fields
2583
+ "roles.id",
2584
+ "roles.name",
2585
+ "roles.isAdmin",
2586
+ // Nested branches fields
2587
+ "branches.id",
2588
+ "branches.name",
2589
+ "branches.parentId",
2590
+ "branches.parentName",
2591
+ "branches.level",
2592
+ "branches.hierarchy"
2593
+ ];
2594
+
2595
+ // src/contracts/common.date.ts
2596
+ var DateTime = class _DateTime {
2597
+ _value;
2598
+ constructor(value) {
2599
+ this._value = typeof value === "string" ? new Date(value) : value;
2600
+ }
2601
+ /** Creates DateTime from a native Date object */
2602
+ static fromDate(date) {
2603
+ return new _DateTime(date);
2604
+ }
2605
+ /** Creates DateTime from current time */
2606
+ static now() {
2607
+ return new _DateTime(/* @__PURE__ */ new Date());
2608
+ }
2609
+ /** Returns the native Date object */
2610
+ toDate() {
2611
+ return this._value;
2612
+ }
2613
+ /** Returns ISO 8601 string representation */
2614
+ toISOString() {
2615
+ return this._value.toISOString();
2616
+ }
2617
+ /** Returns ISO 8601 string (for JSON serialization) */
2618
+ toJSON() {
2619
+ return this.toISOString();
2620
+ }
2621
+ /** Returns ISO 8601 string */
2622
+ toString() {
2623
+ return this.toISOString();
2624
+ }
2625
+ /** Returns timestamp in milliseconds */
2626
+ valueOf() {
2627
+ return this._value.valueOf();
2628
+ }
2629
+ };
2630
+ var DateOnly = class _DateOnly {
2631
+ _year;
2632
+ _month;
2633
+ _day;
2634
+ constructor(value) {
2635
+ if (typeof value === "string") {
2636
+ const parts = value.split("-").map(Number);
2637
+ this._year = parts[0] ?? 0;
2638
+ this._month = parts[1] ?? 1;
2639
+ this._day = parts[2] ?? 1;
2640
+ } else {
2641
+ this._year = value.getUTCFullYear();
2642
+ this._month = value.getUTCMonth() + 1;
2643
+ this._day = value.getUTCDate();
2644
+ }
2645
+ }
2646
+ /** Creates DateOnly from a native Date object */
2647
+ static fromDate(date) {
2648
+ return new _DateOnly(date);
2649
+ }
2650
+ /** Creates DateOnly from current date */
2651
+ static today() {
2652
+ return new _DateOnly(/* @__PURE__ */ new Date());
2653
+ }
2654
+ /** Returns the native Date object (at midnight UTC) */
2655
+ toDate() {
2656
+ return new Date(Date.UTC(this._year, this._month - 1, this._day));
2657
+ }
2658
+ /** Returns YYYY-MM-DD string representation */
2659
+ toString() {
2660
+ const y = this._year.toString().padStart(4, "0");
2661
+ const m = this._month.toString().padStart(2, "0");
2662
+ const d = this._day.toString().padStart(2, "0");
2663
+ return `${y}-${m}-${d}`;
2664
+ }
2665
+ /** Returns YYYY-MM-DD string (for JSON serialization) */
2666
+ toJSON() {
2667
+ return this.toString();
2668
+ }
2669
+ /** Returns timestamp in milliseconds */
2670
+ valueOf() {
2671
+ return this.toDate().valueOf();
2672
+ }
2673
+ /** Gets the year */
2674
+ get year() {
2675
+ return this._year;
2676
+ }
2677
+ /** Gets the month (1-12) */
2678
+ get month() {
2679
+ return this._month;
2680
+ }
2681
+ /** Gets the day (1-31) */
2682
+ get day() {
2683
+ return this._day;
2684
+ }
2685
+ };
2686
+
2687
+ // src/contracts/graphql/common.ts
2688
+ var SortEnumType = /* @__PURE__ */ ((SortEnumType2) => {
2689
+ SortEnumType2["ASC"] = "ASC";
2690
+ SortEnumType2["DESC"] = "DESC";
2691
+ return SortEnumType2;
2692
+ })(SortEnumType || {});
2693
+ function buildFieldSelection(fields, indent = " ") {
2694
+ const simpleFields = [];
2695
+ const nestedFields = /* @__PURE__ */ new Map();
2696
+ for (const field of fields) {
2697
+ const dotIndex = field.indexOf(".");
2698
+ if (dotIndex !== -1) {
2699
+ const parent = field.slice(0, dotIndex);
2700
+ const nested = field.slice(dotIndex + 1);
2701
+ if (!nestedFields.has(parent)) {
2702
+ nestedFields.set(parent, []);
2703
+ }
2704
+ nestedFields.get(parent).push(nested);
2705
+ } else {
2706
+ simpleFields.push(field);
2707
+ }
2708
+ }
2709
+ const selections = [...simpleFields];
2710
+ for (const [parent, nestedKeys] of nestedFields) {
2711
+ selections.push(`${parent} { ${nestedKeys.join(" ")} }`);
2712
+ }
2713
+ return selections.join(`
2714
+ ${indent}`);
2715
+ }
2716
+
2504
2717
  // src/clients/agentUser.ts
2505
2718
  var InsurUpAgentUserClient = class {
2506
- constructor(http) {
2719
+ constructor(http, graphql) {
2507
2720
  this.http = http;
2721
+ this.graphql = graphql;
2508
2722
  }
2509
2723
  /**
2510
2724
  * Retrieves the current agent user's profile information including personal details and platform settings.
@@ -2685,12 +2899,137 @@ var InsurUpAgentUserClient = class {
2685
2899
  options
2686
2900
  );
2687
2901
  }
2902
+ // ============================================================================
2903
+ // GRAPHQL QUERIES
2904
+ // ============================================================================
2905
+ /**
2906
+ * Queries agent users using GraphQL with advanced filtering, searching, sorting, and field selection.
2907
+ * Supports cursor-based pagination and type-safe field selection.
2908
+ *
2909
+ * Gelişmiş filtreleme, arama, sıralama ve alan seçimi ile GraphQL kullanarak acente kullanıcılarını sorgular.
2910
+ * İmleç tabanlı sayfalama ve tip-güvenli alan seçimini destekler.
2911
+ *
2912
+ * @example
2913
+ * // Basic query with all fields
2914
+ * const result = await client.agentUsers.getAgentUsers({ first: 10 });
2915
+ *
2916
+ * @example
2917
+ * // Type-safe field selection
2918
+ * const result = await client.agentUsers.getAgentUsers({
2919
+ * select: ['id', 'email', 'name', 'state'] as const,
2920
+ * first: 10,
2921
+ * filter: { state: { eq: AgentUserState.Active } }
2922
+ * });
2923
+ *
2924
+ * @param requestOptions Query options including pagination, filters, search, and field selection
2925
+ * @returns Paginated connection of agent users with type-narrowed fields
2926
+ */
2927
+ async getAgentUsers(requestOptions) {
2928
+ if (!this.graphql) {
2929
+ throw new Error(
2930
+ "GraphQL transport is not available. Ensure the client is properly initialized."
2931
+ );
2932
+ }
2933
+ const fields = requestOptions?.select ?? ALL_AGENT_USER_FIELDS;
2934
+ const fieldSelection = buildFieldSelection(fields);
2935
+ const query = `
2936
+ query GetAgentUsers(
2937
+ $first: Int
2938
+ $after: String
2939
+ $last: Int
2940
+ $before: String
2941
+ $search: searching_QueryAgentUserResultFilterInput
2942
+ $filter: filtering_QueryAgentUserResultFilterInput
2943
+ $order: [sorting_QueryAgentUserResultSortInput!]
2944
+ ) {
2945
+ agentUsersNew(
2946
+ first: $first
2947
+ after: $after
2948
+ last: $last
2949
+ before: $before
2950
+ search: $search
2951
+ filter: $filter
2952
+ order: $order
2953
+ ) {
2954
+ pageInfo {
2955
+ hasNextPage
2956
+ hasPreviousPage
2957
+ startCursor
2958
+ endCursor
2959
+ }
2960
+ totalCount
2961
+ edges {
2962
+ cursor
2963
+ node {
2964
+ ${fieldSelection}
2965
+ }
2966
+ }
2967
+ nodes {
2968
+ ${fieldSelection}
2969
+ }
2970
+ }
2971
+ }
2972
+ `;
2973
+ const variables = {
2974
+ first: requestOptions?.first,
2975
+ after: requestOptions?.after,
2976
+ last: requestOptions?.last,
2977
+ before: requestOptions?.before,
2978
+ search: requestOptions?.search,
2979
+ filter: requestOptions?.filter,
2980
+ order: requestOptions?.order
2981
+ };
2982
+ const result = await this.graphql.query(query, variables);
2983
+ if (!result.isSuccess) {
2984
+ return result;
2985
+ }
2986
+ return {
2987
+ ...result,
2988
+ data: result.data.agentUsersNew
2989
+ };
2990
+ }
2688
2991
  };
2689
2992
 
2993
+ // src/contracts/graphql/customers.ts
2994
+ var ALL_CUSTOMER_FIELDS = [
2995
+ // Primitive fields
2996
+ "agentBranchId",
2997
+ "id",
2998
+ "name",
2999
+ "identityNumber",
3000
+ "taxNumber",
3001
+ "type",
3002
+ "primaryEmail",
3003
+ "primaryPhoneNumber",
3004
+ "primaryPhoneNumberCountryCode",
3005
+ "cityText",
3006
+ "cityValue",
3007
+ "districtText",
3008
+ "districtValue",
3009
+ "createdAt",
3010
+ "birthDate",
3011
+ "gender",
3012
+ "educationStatus",
3013
+ "nationality",
3014
+ "maritalStatus",
3015
+ "job",
3016
+ "passportNumber",
3017
+ "searchScore",
3018
+ // Nested agentBranch fields
3019
+ "agentBranch.id",
3020
+ "agentBranch.name",
3021
+ "agentBranch.parentId",
3022
+ "agentBranch.parentName",
3023
+ // Nested consents fields
3024
+ "consents.consentType",
3025
+ "consents.isActive"
3026
+ ];
3027
+
2690
3028
  // src/clients/customer.ts
2691
3029
  var InsurUpCustomerClient = class {
2692
- constructor(http) {
3030
+ constructor(http, graphql) {
2693
3031
  this.http = http;
3032
+ this.graphql = graphql;
2694
3033
  }
2695
3034
  /**
2696
3035
  * Creates a new customer profile with essential personal and contact information.
@@ -3061,6 +3400,109 @@ var InsurUpCustomerClient = class {
3061
3400
  options
3062
3401
  );
3063
3402
  }
3403
+ // ============================================
3404
+ // GraphQL Methods
3405
+ // ============================================
3406
+ /**
3407
+ * Retrieves a paginated list of customers using GraphQL with type-safe field selection.
3408
+ *
3409
+ * GraphQL kullanarak tip güvenli alan seçimi ile sayfalanmış müşteri listesi getirir.
3410
+ *
3411
+ * @example
3412
+ * // Get all fields
3413
+ * const result = await client.customers.getCustomers({ first: 10 });
3414
+ *
3415
+ * @example
3416
+ * // Type-safe field selection
3417
+ * const result = await client.customers.getCustomers({
3418
+ * select: ['id', 'name', 'type', 'primaryEmail'] as const,
3419
+ * first: 10,
3420
+ * filter: { type: { eq: CustomerType.INDIVIDUAL } }
3421
+ * });
3422
+ * // result.data.nodes[0].id - ✓ string
3423
+ * // result.data.nodes[0].name - ✓ string | null
3424
+ * // result.data.nodes[0].type - ✓ CustomerType
3425
+ * // result.data.nodes[0].birthDate - ✗ TypeScript Error!
3426
+ *
3427
+ * @param requestOptions Query options including pagination, filters, search, and field selection
3428
+ * @returns Paginated connection of customers with type-narrowed fields
3429
+ */
3430
+ async getCustomers(requestOptions) {
3431
+ if (!this.graphql) {
3432
+ throw new Error(
3433
+ "GraphQL transport is not available. Ensure the client is properly initialized."
3434
+ );
3435
+ }
3436
+ const fields = requestOptions?.select ?? ALL_CUSTOMER_FIELDS;
3437
+ const fieldSelection = buildFieldSelection(fields);
3438
+ const query = `
3439
+ query GetCustomers(
3440
+ $first: Int
3441
+ $after: String
3442
+ $last: Int
3443
+ $before: String
3444
+ $search: QueryCustomerModelSearchInput
3445
+ $filter: QueryCustomerModelFilterInput
3446
+ $order: [QueryCustomerModelSortInput!]
3447
+ ) {
3448
+ customersNew(
3449
+ first: $first
3450
+ after: $after
3451
+ last: $last
3452
+ before: $before
3453
+ search: $search
3454
+ where: $filter
3455
+ order: $order
3456
+ ) {
3457
+ pageInfo {
3458
+ hasNextPage
3459
+ hasPreviousPage
3460
+ startCursor
3461
+ endCursor
3462
+ }
3463
+ totalCount
3464
+ edges {
3465
+ cursor
3466
+ node {
3467
+ ${fieldSelection}
3468
+ }
3469
+ }
3470
+ }
3471
+ }
3472
+ `;
3473
+ const variables = {};
3474
+ if (requestOptions?.first === void 0 && requestOptions?.last === void 0) {
3475
+ variables.first = 50;
3476
+ } else {
3477
+ if (requestOptions?.first !== void 0)
3478
+ variables.first = requestOptions.first;
3479
+ if (requestOptions?.last !== void 0)
3480
+ variables.last = requestOptions.last;
3481
+ }
3482
+ if (requestOptions?.after !== void 0)
3483
+ variables.after = requestOptions.after;
3484
+ if (requestOptions?.before !== void 0)
3485
+ variables.before = requestOptions.before;
3486
+ if (requestOptions?.search !== void 0)
3487
+ variables.search = requestOptions.search;
3488
+ if (requestOptions?.filter !== void 0)
3489
+ variables.filter = requestOptions.filter;
3490
+ if (requestOptions?.order !== void 0)
3491
+ variables.order = requestOptions.order;
3492
+ const result = await this.graphql.query(query, variables);
3493
+ if (!result.isSuccess) {
3494
+ return result;
3495
+ }
3496
+ const edges = result.data.customersNew.edges;
3497
+ const nodes = edges?.map((edge) => edge?.node ?? null) ?? null;
3498
+ return {
3499
+ ...result,
3500
+ data: {
3501
+ ...result.data.customersNew,
3502
+ nodes
3503
+ }
3504
+ };
3505
+ }
3064
3506
  };
3065
3507
 
3066
3508
  // src/clients/vehicle.ts
@@ -3401,10 +3843,125 @@ var InsurUpPropertyClient = class {
3401
3843
  }
3402
3844
  };
3403
3845
 
3846
+ // src/contracts/graphql/policies.ts
3847
+ var UserType = /* @__PURE__ */ ((UserType2) => {
3848
+ UserType2["None"] = "NONE";
3849
+ UserType2["AdminPanel"] = "ADMIN_PANEL";
3850
+ UserType2["Agent"] = "AGENT";
3851
+ UserType2["Customer"] = "CUSTOMER";
3852
+ return UserType2;
3853
+ })(UserType || {});
3854
+ var ALL_POLICY_FIELDS = [
3855
+ // Primitive fields
3856
+ "agentBranchId",
3857
+ "id",
3858
+ "insurerCustomerId",
3859
+ "insuredCustomerId",
3860
+ "installmentNumber",
3861
+ "productBranch",
3862
+ "netPremium",
3863
+ "grossPremium",
3864
+ "commission",
3865
+ "paymentType",
3866
+ "currency",
3867
+ "insuranceCompanyProposalNumber",
3868
+ "insuranceCompanyPolicyNumber",
3869
+ "createdAt",
3870
+ "startDate",
3871
+ "endDate",
3872
+ "arrangementDate",
3873
+ "insuredCustomerName",
3874
+ "insuredCustomerIdentityNumber",
3875
+ "insuredCustomerTaxNumber",
3876
+ "insuredCustomerType",
3877
+ "insuredCustomerCityText",
3878
+ "insuredCustomerCityValue",
3879
+ "insuredCustomerDistrictText",
3880
+ "insuredCustomerDistrictValue",
3881
+ "insuredCustomerBirthDate",
3882
+ "insurerCustomerName",
3883
+ "insurerCustomerIdentityNumber",
3884
+ "insurerCustomerTaxNumber",
3885
+ "insurerCustomerCityText",
3886
+ "insurerCustomerCityValue",
3887
+ "insurerCustomerDistrictText",
3888
+ "insurerCustomerDistrictValue",
3889
+ "insurerCustomerBirthDate",
3890
+ "vehiclePlateCode",
3891
+ "vehiclePlateCity",
3892
+ "vehicleDocumentSerialCode",
3893
+ "vehicleDocumentSerialNumber",
3894
+ "vehicleModelBrandText",
3895
+ "vehicleModelBrandValue",
3896
+ "vehicleModelTypeText",
3897
+ "vehicleModelTypeValue",
3898
+ "vehicleModelYear",
3899
+ "vehicleFuelType",
3900
+ "productId",
3901
+ "productName",
3902
+ "insuranceCompanyId",
3903
+ "insuranceCompanyName",
3904
+ "insuranceCompanyLogo",
3905
+ "state",
3906
+ "propertyNumber",
3907
+ "daskOldPolicyNumber",
3908
+ "daskPolicyNumber",
3909
+ "vehicleId",
3910
+ "propertyId",
3911
+ "channel",
3912
+ "campaign",
3913
+ // Nested agentBranch fields
3914
+ "agentBranch.id",
3915
+ "agentBranch.name",
3916
+ "agentBranch.parentId",
3917
+ "agentBranch.parentName",
3918
+ // Nested createdBy fields
3919
+ "createdBy.id",
3920
+ "createdBy.name",
3921
+ "createdBy.email",
3922
+ "createdBy.userType",
3923
+ // Nested representedBy fields
3924
+ "representedBy.id",
3925
+ "representedBy.name",
3926
+ "representedBy.email",
3927
+ "representedBy.userType"
3928
+ ];
3929
+
3930
+ // src/contracts/graphql/policyTransfers.ts
3931
+ var ALL_POLICY_TRANSFER_FIELDS = [
3932
+ "id",
3933
+ "startDate",
3934
+ "endDate",
3935
+ "insuranceCompanyCount",
3936
+ "policyTransferTriggerCount",
3937
+ "policyCount"
3938
+ ];
3939
+
3940
+ // src/contracts/graphql/filePolicyTransfers.ts
3941
+ var ALL_FILE_POLICY_TRANSFER_FIELDS = [
3942
+ // Primitive fields
3943
+ "id",
3944
+ "insuranceCompanyId",
3945
+ "insuranceCompanyName",
3946
+ "insuranceCompanyLogo",
3947
+ "fileName",
3948
+ "fileUrl",
3949
+ "createdAt",
3950
+ "totalPolicyCount",
3951
+ "completedPolicyCount",
3952
+ "failedPolicyCount",
3953
+ // Nested createdBy fields
3954
+ "createdBy.id",
3955
+ "createdBy.name",
3956
+ "createdBy.email",
3957
+ "createdBy.userType"
3958
+ ];
3959
+
3404
3960
  // src/clients/policy.ts
3405
3961
  var InsurUpPolicyClient = class {
3406
- constructor(http) {
3962
+ constructor(http, graphql) {
3407
3963
  this.http = http;
3964
+ this.graphql = graphql;
3408
3965
  }
3409
3966
  /**
3410
3967
  * Retrieves comprehensive details of a specific policy including coverage information, premium details, and current status.
@@ -3681,12 +4238,350 @@ var InsurUpPolicyClient = class {
3681
4238
  options
3682
4239
  );
3683
4240
  }
4241
+ // ============================================================================
4242
+ // GRAPHQL QUERIES
4243
+ // ============================================================================
4244
+ /**
4245
+ * Queries policies using GraphQL with advanced filtering, searching, sorting, and field selection.
4246
+ * Supports cursor-based pagination and type-safe field selection.
4247
+ *
4248
+ * Gelişmiş filtreleme, arama, sıralama ve alan seçimi ile GraphQL kullanarak poliçeleri sorgular.
4249
+ * İmleç tabanlı sayfalama ve tip-güvenli alan seçimini destekler.
4250
+ *
4251
+ * @example
4252
+ * // Basic query with all fields
4253
+ * const result = await client.policies.getPolicies({ first: 10 });
4254
+ *
4255
+ * @example
4256
+ * // Type-safe field selection
4257
+ * const result = await client.policies.getPolicies({
4258
+ * select: ['id', 'productBranch', 'grossPremium', 'state'] as const,
4259
+ * first: 10,
4260
+ * filter: { state: { eq: PolicyState.Active } }
4261
+ * });
4262
+ *
4263
+ * @param requestOptions Query options including pagination, filters, search, and field selection
4264
+ * @returns Paginated connection of policies with type-narrowed fields
4265
+ */
4266
+ async getPolicies(requestOptions) {
4267
+ if (!this.graphql) {
4268
+ throw new Error(
4269
+ "GraphQL transport is not available. Ensure the client is properly initialized."
4270
+ );
4271
+ }
4272
+ const fields = requestOptions?.select ?? ALL_POLICY_FIELDS;
4273
+ const fieldSelection = buildFieldSelection(fields);
4274
+ const query = `
4275
+ query GetPolicies(
4276
+ $first: Int
4277
+ $after: String
4278
+ $last: Int
4279
+ $before: String
4280
+ $search: searching_QueryPoliciesResultFilterInput
4281
+ $filter: filtering_QueryPoliciesResultFilterInput
4282
+ $order: [sorting_QueryPoliciesResultSortInput!]
4283
+ ) {
4284
+ policiesNew(
4285
+ first: $first
4286
+ after: $after
4287
+ last: $last
4288
+ before: $before
4289
+ search: $search
4290
+ filter: $filter
4291
+ order: $order
4292
+ ) {
4293
+ pageInfo {
4294
+ hasNextPage
4295
+ hasPreviousPage
4296
+ startCursor
4297
+ endCursor
4298
+ }
4299
+ totalCount
4300
+ edges {
4301
+ cursor
4302
+ node {
4303
+ ${fieldSelection}
4304
+ }
4305
+ }
4306
+ nodes {
4307
+ ${fieldSelection}
4308
+ }
4309
+ }
4310
+ }
4311
+ `;
4312
+ const variables = {
4313
+ first: requestOptions?.first,
4314
+ after: requestOptions?.after,
4315
+ last: requestOptions?.last,
4316
+ before: requestOptions?.before,
4317
+ search: requestOptions?.search,
4318
+ filter: requestOptions?.filter,
4319
+ order: requestOptions?.order
4320
+ };
4321
+ const result = await this.graphql.query(query, variables);
4322
+ if (!result.isSuccess) {
4323
+ return result;
4324
+ }
4325
+ return {
4326
+ ...result,
4327
+ data: result.data.policiesNew
4328
+ };
4329
+ }
4330
+ /**
4331
+ * Queries policy transfers using GraphQL with advanced filtering, searching, sorting, and field selection.
4332
+ * Supports cursor-based pagination and type-safe field selection.
4333
+ *
4334
+ * Gelişmiş filtreleme, arama, sıralama ve alan seçimi ile GraphQL kullanarak poliçe transferlerini sorgular.
4335
+ * İmleç tabanlı sayfalama ve tip-güvenli alan seçimini destekler.
4336
+ *
4337
+ * @example
4338
+ * // Basic query with all fields
4339
+ * const result = await client.policies.getPolicyTransfers({ first: 10 });
4340
+ *
4341
+ * @param requestOptions Query options including pagination, filters, search, and field selection
4342
+ * @returns Paginated connection of policy transfers with type-narrowed fields
4343
+ */
4344
+ async getPolicyTransfers(requestOptions) {
4345
+ if (!this.graphql) {
4346
+ throw new Error(
4347
+ "GraphQL transport is not available. Ensure the client is properly initialized."
4348
+ );
4349
+ }
4350
+ const fields = requestOptions?.select ?? ALL_POLICY_TRANSFER_FIELDS;
4351
+ const fieldSelection = buildFieldSelection(fields);
4352
+ const query = `
4353
+ query GetPolicyTransfers(
4354
+ $first: Int
4355
+ $after: String
4356
+ $last: Int
4357
+ $before: String
4358
+ $search: searching_QueryPolicyTransfersResultFilterInput
4359
+ $filter: filtering_QueryPolicyTransfersResultFilterInput
4360
+ $order: [sorting_QueryPolicyTransfersResultSortInput!]
4361
+ ) {
4362
+ policyTransfersNew(
4363
+ first: $first
4364
+ after: $after
4365
+ last: $last
4366
+ before: $before
4367
+ search: $search
4368
+ filter: $filter
4369
+ order: $order
4370
+ ) {
4371
+ pageInfo {
4372
+ hasNextPage
4373
+ hasPreviousPage
4374
+ startCursor
4375
+ endCursor
4376
+ }
4377
+ totalCount
4378
+ edges {
4379
+ cursor
4380
+ node {
4381
+ ${fieldSelection}
4382
+ }
4383
+ }
4384
+ nodes {
4385
+ ${fieldSelection}
4386
+ }
4387
+ }
4388
+ }
4389
+ `;
4390
+ const variables = {
4391
+ first: requestOptions?.first,
4392
+ after: requestOptions?.after,
4393
+ last: requestOptions?.last,
4394
+ before: requestOptions?.before,
4395
+ search: requestOptions?.search,
4396
+ filter: requestOptions?.filter,
4397
+ order: requestOptions?.order
4398
+ };
4399
+ const result = await this.graphql.query(query, variables);
4400
+ if (!result.isSuccess) {
4401
+ return result;
4402
+ }
4403
+ return {
4404
+ ...result,
4405
+ data: result.data.policyTransfersNew
4406
+ };
4407
+ }
4408
+ /**
4409
+ * Queries file policy transfers using GraphQL with advanced filtering, searching, sorting, and field selection.
4410
+ * Supports cursor-based pagination and type-safe field selection.
4411
+ *
4412
+ * Gelişmiş filtreleme, arama, sıralama ve alan seçimi ile GraphQL kullanarak dosya bazlı poliçe transferlerini sorgular.
4413
+ * İmleç tabanlı sayfalama ve tip-güvenli alan seçimini destekler.
4414
+ *
4415
+ * @example
4416
+ * // Basic query with all fields
4417
+ * const result = await client.policies.getFilePolicyTransfers({ first: 10 });
4418
+ *
4419
+ * @param requestOptions Query options including pagination, filters, search, and field selection
4420
+ * @returns Paginated connection of file policy transfers with type-narrowed fields
4421
+ */
4422
+ async getFilePolicyTransfers(requestOptions) {
4423
+ if (!this.graphql) {
4424
+ throw new Error(
4425
+ "GraphQL transport is not available. Ensure the client is properly initialized."
4426
+ );
4427
+ }
4428
+ const fields = requestOptions?.select ?? ALL_FILE_POLICY_TRANSFER_FIELDS;
4429
+ const fieldSelection = buildFieldSelection(fields);
4430
+ const query = `
4431
+ query GetFilePolicyTransfers(
4432
+ $first: Int
4433
+ $after: String
4434
+ $last: Int
4435
+ $before: String
4436
+ $search: searching_QueryFilePolicyTransfersResultFilterInput
4437
+ $filter: filtering_QueryFilePolicyTransfersResultFilterInput
4438
+ $order: [sorting_QueryFilePolicyTransfersResultSortInput!]
4439
+ ) {
4440
+ filePolicyTransfersNew(
4441
+ first: $first
4442
+ after: $after
4443
+ last: $last
4444
+ before: $before
4445
+ search: $search
4446
+ filter: $filter
4447
+ order: $order
4448
+ ) {
4449
+ pageInfo {
4450
+ hasNextPage
4451
+ hasPreviousPage
4452
+ startCursor
4453
+ endCursor
4454
+ }
4455
+ totalCount
4456
+ edges {
4457
+ cursor
4458
+ node {
4459
+ ${fieldSelection}
4460
+ }
4461
+ }
4462
+ nodes {
4463
+ ${fieldSelection}
4464
+ }
4465
+ }
4466
+ }
4467
+ `;
4468
+ const variables = {
4469
+ first: requestOptions?.first,
4470
+ after: requestOptions?.after,
4471
+ last: requestOptions?.last,
4472
+ before: requestOptions?.before,
4473
+ search: requestOptions?.search,
4474
+ filter: requestOptions?.filter,
4475
+ order: requestOptions?.order
4476
+ };
4477
+ const result = await this.graphql.query(query, variables);
4478
+ if (!result.isSuccess) {
4479
+ return result;
4480
+ }
4481
+ return {
4482
+ ...result,
4483
+ data: result.data.filePolicyTransfersNew
4484
+ };
4485
+ }
3684
4486
  };
3685
4487
 
4488
+ // src/contracts/graphql/cases.ts
4489
+ var ALL_CASE_FIELDS = [
4490
+ // Primitive fields
4491
+ "agentBranchId",
4492
+ "id",
4493
+ "ref",
4494
+ "type",
4495
+ "status",
4496
+ "cancelSubType",
4497
+ "saleOpportunitySubType",
4498
+ "endorsementSubType",
4499
+ "complaintSubType",
4500
+ "mainState",
4501
+ "subState",
4502
+ "productBranch",
4503
+ "channel",
4504
+ "createdAt",
4505
+ "createdByName",
4506
+ "createdById",
4507
+ "createdByEmail",
4508
+ "createdByType",
4509
+ "representedByName",
4510
+ "representedById",
4511
+ "representedByEmail",
4512
+ "representedByType",
4513
+ "policyEndDate",
4514
+ "assetType",
4515
+ "assetId",
4516
+ "sourceCaseId",
4517
+ "policyCount",
4518
+ "proposalCount",
4519
+ "lastProposalDate",
4520
+ "lastPolicyDate",
4521
+ "lastUpdateDate",
4522
+ "lastUpdatedByName",
4523
+ "lastUpdatedById",
4524
+ "lastUpdatedByEmail",
4525
+ "lastUpdatedByType",
4526
+ "priorityScore",
4527
+ "customerId",
4528
+ "customerName",
4529
+ "customerType",
4530
+ "customerIdentity",
4531
+ "customerCityText",
4532
+ "customerCityValue",
4533
+ "customerDistrictText",
4534
+ "customerDistrictValue",
4535
+ "customerPrimaryPhoneNumber",
4536
+ "customerPrimaryPhoneCountryCode",
4537
+ "customerPrimaryEmail",
4538
+ "customerBirthDate",
4539
+ "customerPassportNumber",
4540
+ "customerJob",
4541
+ "vehiclePlateCode",
4542
+ "vehiclePlateCity",
4543
+ "vehicleModelBrandText",
4544
+ "vehicleModelBrandValue",
4545
+ "vehicleModelTypeText",
4546
+ "vehicleModelTypeValue",
4547
+ "vehicleModelYear",
4548
+ "vehicleUtilizationStyle",
4549
+ "vehicleEngineNumber",
4550
+ "vehicleChassisNumber",
4551
+ "vehicleRegistrationDate",
4552
+ "vehicleFuelType",
4553
+ "vehicleSeatNumber",
4554
+ "vehicleDocumentSerialCode",
4555
+ "vehicleDocumentSerialNumber",
4556
+ "propertyNumber",
4557
+ "propertySquareMeter",
4558
+ "propertyConstructionYear",
4559
+ "propertyDamageStatus",
4560
+ "propertyFloorNumber",
4561
+ "propertyStructure",
4562
+ "propertyUtilizationStyle",
4563
+ "propertyOwnershipType",
4564
+ "propertyDaskPolicyNumber",
4565
+ "advertisingSource",
4566
+ "advertisingCampaign",
4567
+ "searchScore",
4568
+ // Nested agentBranch fields
4569
+ "agentBranch.id",
4570
+ "agentBranch.name",
4571
+ "agentBranch.parentId",
4572
+ "agentBranch.parentName",
4573
+ // Nested priorityRuleHits fields
4574
+ "priorityRuleHits.label",
4575
+ "priorityRuleHits.description",
4576
+ "priorityRuleHits.ruleName",
4577
+ "priorityRuleHits.score"
4578
+ ];
4579
+
3686
4580
  // src/clients/case.ts
3687
4581
  var InsurUpCaseClient = class {
3688
- constructor(http) {
4582
+ constructor(http, graphql) {
3689
4583
  this.http = http;
4584
+ this.graphql = graphql;
3690
4585
  }
3691
4586
  /**
3692
4587
  * Assigns a case representative to handle a specific customer case, ensuring proper ownership and accountability.
@@ -3949,12 +4844,121 @@ var InsurUpCaseClient = class {
3949
4844
  options
3950
4845
  );
3951
4846
  }
4847
+ // ============================================================================
4848
+ // GRAPHQL QUERIES
4849
+ // ============================================================================
4850
+ /**
4851
+ * Queries cases using GraphQL with advanced filtering, searching, sorting, and field selection.
4852
+ * Supports cursor-based pagination and type-safe field selection.
4853
+ *
4854
+ * Gelişmiş filtreleme, arama, sıralama ve alan seçimi ile GraphQL kullanarak talepleri sorgular.
4855
+ * İmleç tabanlı sayfalama ve tip-güvenli alan seçimini destekler.
4856
+ *
4857
+ * @example
4858
+ * // Basic query with all fields
4859
+ * const result = await client.cases.getCases({ first: 10 });
4860
+ *
4861
+ * @example
4862
+ * // Type-safe field selection
4863
+ * const result = await client.cases.getCases({
4864
+ * select: ['id', 'ref', 'type', 'status', 'mainState'] as const,
4865
+ * first: 10,
4866
+ * filter: { type: { eq: CaseType.NewSaleOpportunity } }
4867
+ * });
4868
+ *
4869
+ * @param requestOptions Query options including pagination, filters, search, and field selection
4870
+ * @returns Paginated connection of cases with type-narrowed fields
4871
+ */
4872
+ async getCases(requestOptions) {
4873
+ if (!this.graphql) {
4874
+ throw new Error(
4875
+ "GraphQL transport is not available. Ensure the client is properly initialized."
4876
+ );
4877
+ }
4878
+ const fields = requestOptions?.select ?? ALL_CASE_FIELDS;
4879
+ const fieldSelection = buildFieldSelection(fields);
4880
+ const query = `
4881
+ query GetCases(
4882
+ $first: Int
4883
+ $after: String
4884
+ $last: Int
4885
+ $before: String
4886
+ $search: searching_QueryCaseModelFilterInput
4887
+ $filter: filtering_QueryCaseModelFilterInput
4888
+ $order: [sorting_QueryCaseModelSortInput!]
4889
+ ) {
4890
+ casesNew(
4891
+ first: $first
4892
+ after: $after
4893
+ last: $last
4894
+ before: $before
4895
+ search: $search
4896
+ filter: $filter
4897
+ order: $order
4898
+ ) {
4899
+ pageInfo {
4900
+ hasNextPage
4901
+ hasPreviousPage
4902
+ startCursor
4903
+ endCursor
4904
+ }
4905
+ totalCount
4906
+ edges {
4907
+ cursor
4908
+ node {
4909
+ ${fieldSelection}
4910
+ }
4911
+ }
4912
+ nodes {
4913
+ ${fieldSelection}
4914
+ }
4915
+ }
4916
+ }
4917
+ `;
4918
+ const variables = {
4919
+ first: requestOptions?.first,
4920
+ after: requestOptions?.after,
4921
+ last: requestOptions?.last,
4922
+ before: requestOptions?.before,
4923
+ search: requestOptions?.search,
4924
+ filter: requestOptions?.filter,
4925
+ order: requestOptions?.order
4926
+ };
4927
+ const result = await this.graphql.query(query, variables);
4928
+ if (!result.isSuccess) {
4929
+ return result;
4930
+ }
4931
+ return {
4932
+ ...result,
4933
+ data: result.data.casesNew
4934
+ };
4935
+ }
3952
4936
  };
3953
4937
 
4938
+ // src/contracts/graphql/webhookDeliveries.ts
4939
+ var WebhookDeliveryState = /* @__PURE__ */ ((WebhookDeliveryState2) => {
4940
+ WebhookDeliveryState2["Pending"] = "PENDING";
4941
+ WebhookDeliveryState2["Success"] = "SUCCESS";
4942
+ WebhookDeliveryState2["Failed"] = "FAILED";
4943
+ return WebhookDeliveryState2;
4944
+ })(WebhookDeliveryState || {});
4945
+ var ALL_WEBHOOK_DELIVERY_FIELDS = [
4946
+ "id",
4947
+ "webhookId",
4948
+ "webhookName",
4949
+ "event",
4950
+ "state",
4951
+ "responseStatusCode",
4952
+ "createdAt",
4953
+ "completedAt",
4954
+ "retryCount"
4955
+ ];
4956
+
3954
4957
  // src/clients/webhook.ts
3955
4958
  var InsurUpWebhookClient = class {
3956
- constructor(http) {
4959
+ constructor(http, graphql) {
3957
4960
  this.http = http;
4961
+ this.graphql = graphql;
3958
4962
  }
3959
4963
  /**
3960
4964
  * Creates a new webhook configuration to receive event notifications from the InsurUp platform.
@@ -4049,6 +5053,95 @@ var InsurUpWebhookClient = class {
4049
5053
  );
4050
5054
  return this.http.postNoContent(endpoint, void 0, options);
4051
5055
  }
5056
+ // ============================================================================
5057
+ // GRAPHQL QUERIES
5058
+ // ============================================================================
5059
+ /**
5060
+ * Queries webhook deliveries using GraphQL with advanced filtering, searching, sorting, and field selection.
5061
+ * Supports cursor-based pagination and type-safe field selection.
5062
+ *
5063
+ * Gelişmiş filtreleme, arama, sıralama ve alan seçimi ile GraphQL kullanarak webhook teslimatlarını sorgular.
5064
+ * İmleç tabanlı sayfalama ve tip-güvenli alan seçimini destekler.
5065
+ *
5066
+ * @example
5067
+ * // Basic query with all fields
5068
+ * const result = await client.webhooks.getWebhookDeliveries({ first: 10 });
5069
+ *
5070
+ * @example
5071
+ * // Type-safe field selection with filter
5072
+ * const result = await client.webhooks.getWebhookDeliveries({
5073
+ * select: ['id', 'webhookId', 'event', 'state'] as const,
5074
+ * first: 10,
5075
+ * filter: { state: { eq: WebhookDeliveryState.Failed } }
5076
+ * });
5077
+ *
5078
+ * @param requestOptions Query options including pagination, filters, search, and field selection
5079
+ * @returns Paginated connection of webhook deliveries with type-narrowed fields
5080
+ */
5081
+ async getWebhookDeliveries(requestOptions) {
5082
+ if (!this.graphql) {
5083
+ throw new Error(
5084
+ "GraphQL transport is not available. Ensure the client is properly initialized."
5085
+ );
5086
+ }
5087
+ const fields = requestOptions?.select ?? ALL_WEBHOOK_DELIVERY_FIELDS;
5088
+ const fieldSelection = buildFieldSelection(fields);
5089
+ const query = `
5090
+ query GetWebhookDeliveries(
5091
+ $first: Int
5092
+ $after: String
5093
+ $last: Int
5094
+ $before: String
5095
+ $search: searching_QueryWebhookDeliveryResultFilterInput
5096
+ $filter: filtering_QueryWebhookDeliveryResultFilterInput
5097
+ $order: [sorting_QueryWebhookDeliveryResultSortInput!]
5098
+ ) {
5099
+ webhookDeliveriesNew(
5100
+ first: $first
5101
+ after: $after
5102
+ last: $last
5103
+ before: $before
5104
+ search: $search
5105
+ filter: $filter
5106
+ order: $order
5107
+ ) {
5108
+ pageInfo {
5109
+ hasNextPage
5110
+ hasPreviousPage
5111
+ startCursor
5112
+ endCursor
5113
+ }
5114
+ totalCount
5115
+ edges {
5116
+ cursor
5117
+ node {
5118
+ ${fieldSelection}
5119
+ }
5120
+ }
5121
+ nodes {
5122
+ ${fieldSelection}
5123
+ }
5124
+ }
5125
+ }
5126
+ `;
5127
+ const variables = {
5128
+ first: requestOptions?.first,
5129
+ after: requestOptions?.after,
5130
+ last: requestOptions?.last,
5131
+ before: requestOptions?.before,
5132
+ search: requestOptions?.search,
5133
+ filter: requestOptions?.filter,
5134
+ order: requestOptions?.order
5135
+ };
5136
+ const result = await this.graphql.query(query, variables);
5137
+ if (!result.isSuccess) {
5138
+ return result;
5139
+ }
5140
+ return {
5141
+ ...result,
5142
+ data: result.data.webhookDeliveriesNew
5143
+ };
5144
+ }
4052
5145
  };
4053
5146
 
4054
5147
  // src/clients/coverage.ts
@@ -4300,10 +5393,64 @@ var InsurUpInsuranceClient = class {
4300
5393
  }
4301
5394
  };
4302
5395
 
5396
+ // src/contracts/graphql/proposals.ts
5397
+ var ALL_PROPOSAL_FIELDS = [
5398
+ // Primitive fields
5399
+ "agentBranchId",
5400
+ "id",
5401
+ "productBranch",
5402
+ "state",
5403
+ "insurerCustomerId",
5404
+ "insuredCustomerId",
5405
+ "productsCount",
5406
+ "succeedProductsCount",
5407
+ "createdAt",
5408
+ "successRate",
5409
+ "insuredCustomerName",
5410
+ "insuredCustomerIdentityNumber",
5411
+ "insuredCustomerTaxNumber",
5412
+ "insuredCustomerType",
5413
+ "lowestPremium",
5414
+ "highestPremium",
5415
+ "channel",
5416
+ "insuredCustomerCityText",
5417
+ "insuredCustomerCityValue",
5418
+ "insuredCustomerDistrictText",
5419
+ "insuredCustomerDistrictValue",
5420
+ "insuredCustomerPhoneNumber",
5421
+ "insuredCustomerPhoneNumberCountryCode",
5422
+ "insuredCustomerEmail",
5423
+ "vehiclePlateCode",
5424
+ "vehiclePlateCity",
5425
+ "vehicleDocumentSerialCode",
5426
+ "vehicleDocumentSerialNumber",
5427
+ "vehicleModelBrandText",
5428
+ "vehicleModelBrandValue",
5429
+ "vehicleModelTypeText",
5430
+ "vehicleModelTypeValue",
5431
+ "vehicleModelYear",
5432
+ "vehicleFuelType",
5433
+ "utilizationStyle",
5434
+ "insuredCustomerBirthDate",
5435
+ "vehicleId",
5436
+ "propertyId",
5437
+ // Nested agentBranch fields
5438
+ "agentBranch.id",
5439
+ "agentBranch.name",
5440
+ "agentBranch.parentId",
5441
+ "agentBranch.parentName",
5442
+ // Nested agentUserCreatedBy fields
5443
+ "agentUserCreatedBy.id",
5444
+ "agentUserCreatedBy.name",
5445
+ "agentUserCreatedBy.email",
5446
+ "agentUserCreatedBy.userType"
5447
+ ];
5448
+
4303
5449
  // src/clients/proposal.ts
4304
5450
  var InsurUpProposalClient = class {
4305
- constructor(http) {
5451
+ constructor(http, graphql) {
4306
5452
  this.http = http;
5453
+ this.graphql = graphql;
4307
5454
  }
4308
5455
  /**
4309
5456
  * Creates a new insurance proposal with customer information, coverage selections, and product options for quotation.
@@ -4630,6 +5777,95 @@ var InsurUpProposalClient = class {
4630
5777
  options
4631
5778
  );
4632
5779
  }
5780
+ // ============================================================================
5781
+ // GRAPHQL QUERIES
5782
+ // ============================================================================
5783
+ /**
5784
+ * Queries proposals using GraphQL with advanced filtering, searching, sorting, and field selection.
5785
+ * Supports cursor-based pagination and type-safe field selection.
5786
+ *
5787
+ * Gelişmiş filtreleme, arama, sıralama ve alan seçimi ile GraphQL kullanarak teklifleri sorgular.
5788
+ * İmleç tabanlı sayfalama ve tip-güvenli alan seçimini destekler.
5789
+ *
5790
+ * @example
5791
+ * // Basic query with all fields
5792
+ * const result = await client.proposals.getProposals({ first: 10 });
5793
+ *
5794
+ * @example
5795
+ * // Type-safe field selection
5796
+ * const result = await client.proposals.getProposals({
5797
+ * select: ['id', 'productBranch', 'state', 'insuredCustomerName'] as const,
5798
+ * first: 10,
5799
+ * filter: { state: { eq: ProposalState.Active } }
5800
+ * });
5801
+ *
5802
+ * @param requestOptions Query options including pagination, filters, search, and field selection
5803
+ * @returns Paginated connection of proposals with type-narrowed fields
5804
+ */
5805
+ async getProposals(requestOptions) {
5806
+ if (!this.graphql) {
5807
+ throw new Error(
5808
+ "GraphQL transport is not available. Ensure the client is properly initialized."
5809
+ );
5810
+ }
5811
+ const fields = requestOptions?.select ?? ALL_PROPOSAL_FIELDS;
5812
+ const fieldSelection = buildFieldSelection(fields);
5813
+ const query = `
5814
+ query GetProposals(
5815
+ $first: Int
5816
+ $after: String
5817
+ $last: Int
5818
+ $before: String
5819
+ $search: searching_QueryProposalsResultFilterInput
5820
+ $filter: filtering_QueryProposalsResultFilterInput
5821
+ $order: [sorting_QueryProposalsResultSortInput!]
5822
+ ) {
5823
+ proposalsNew(
5824
+ first: $first
5825
+ after: $after
5826
+ last: $last
5827
+ before: $before
5828
+ search: $search
5829
+ filter: $filter
5830
+ order: $order
5831
+ ) {
5832
+ pageInfo {
5833
+ hasNextPage
5834
+ hasPreviousPage
5835
+ startCursor
5836
+ endCursor
5837
+ }
5838
+ totalCount
5839
+ edges {
5840
+ cursor
5841
+ node {
5842
+ ${fieldSelection}
5843
+ }
5844
+ }
5845
+ nodes {
5846
+ ${fieldSelection}
5847
+ }
5848
+ }
5849
+ }
5850
+ `;
5851
+ const variables = {
5852
+ first: requestOptions?.first,
5853
+ after: requestOptions?.after,
5854
+ last: requestOptions?.last,
5855
+ before: requestOptions?.before,
5856
+ search: requestOptions?.search,
5857
+ filter: requestOptions?.filter,
5858
+ order: requestOptions?.order
5859
+ };
5860
+ const result = await this.graphql.query(query, variables);
5861
+ if (!result.isSuccess) {
5862
+ return result;
5863
+ }
5864
+ return {
5865
+ ...result,
5866
+ data: result.data.proposalsNew
5867
+ };
5868
+ }
4633
5869
  };
4634
5870
 
4635
5871
  // src/clients/file.ts
@@ -4764,6 +6000,7 @@ var InsurUpTemplateClient = class {
4764
6000
  // src/client/client.ts
4765
6001
  var DefaultInsurUpClient = class {
4766
6002
  http;
6003
+ graphql;
4767
6004
  /**
4768
6005
  * Agent Management Client
4769
6006
  *
@@ -4886,21 +6123,22 @@ var DefaultInsurUpClient = class {
4886
6123
  options;
4887
6124
  constructor(options) {
4888
6125
  this.http = new HttpTransport(options);
6126
+ this.graphql = new GraphQLTransport(this.http);
4889
6127
  this.options = options || {};
4890
6128
  this.agents = new InsurUpAgentClient(this.http);
4891
6129
  this.agentBranches = new InsurUpAgentBranchClient(this.http);
4892
6130
  this.agentRoles = new InsurUpAgentRoleClient(this.http);
4893
6131
  this.agentSetup = new InsurUpAgentSetupClient(this.http);
4894
- this.agentUsers = new InsurUpAgentUserClient(this.http);
4895
- this.customers = new InsurUpCustomerClient(this.http);
6132
+ this.agentUsers = new InsurUpAgentUserClient(this.http, this.graphql);
6133
+ this.customers = new InsurUpCustomerClient(this.http, this.graphql);
4896
6134
  this.vehicles = new InsurUpVehicleClient(this.http);
4897
6135
  this.properties = new InsurUpPropertyClient(this.http);
4898
- this.policies = new InsurUpPolicyClient(this.http);
4899
- this.cases = new InsurUpCaseClient(this.http);
4900
- this.webhooks = new InsurUpWebhookClient(this.http);
6136
+ this.policies = new InsurUpPolicyClient(this.http, this.graphql);
6137
+ this.cases = new InsurUpCaseClient(this.http, this.graphql);
6138
+ this.webhooks = new InsurUpWebhookClient(this.http, this.graphql);
4901
6139
  this.coverage = new InsurUpCoverageClient(this.http);
4902
6140
  this.insurance = new InsurUpInsuranceClient(this.http);
4903
- this.proposals = new InsurUpProposalClient(this.http);
6141
+ this.proposals = new InsurUpProposalClient(this.http, this.graphql);
4904
6142
  this.files = new InsurUpFileClient(this.http);
4905
6143
  this.languages = new InsurUpLanguageClient(this.http);
4906
6144
  this.templates = new InsurUpTemplateClient(this.http);
@@ -5347,6 +6585,11 @@ var Disease = /* @__PURE__ */ ((Disease2) => {
5347
6585
  Disease2["ImmuneSystemDisorders"] = "IMMUNE_SYSTEM_DISORDERS";
5348
6586
  return Disease2;
5349
6587
  })(Disease || {});
6588
+ var ConsentType = /* @__PURE__ */ ((ConsentType2) => {
6589
+ ConsentType2["KVKK"] = "KVKK";
6590
+ ConsentType2["ETK"] = "ETK";
6591
+ return ConsentType2;
6592
+ })(ConsentType || {});
5350
6593
 
5351
6594
  // src/contracts/cases.ts
5352
6595
  var CaseType = /* @__PURE__ */ ((CaseType2) => {
@@ -5505,6 +6748,12 @@ var CallCenterImplementation = /* @__PURE__ */ ((CallCenterImplementation2) => {
5505
6748
  CallCenterImplementation2["AloTech"] = "AloTech";
5506
6749
  return CallCenterImplementation2;
5507
6750
  })(CallCenterImplementation || {});
6751
+ var AgentUserState = /* @__PURE__ */ ((AgentUserState2) => {
6752
+ AgentUserState2["Pending"] = "PENDING";
6753
+ AgentUserState2["Active"] = "ACTIVE";
6754
+ AgentUserState2["Inactive"] = "INACTIVE";
6755
+ return AgentUserState2;
6756
+ })(AgentUserState || {});
5508
6757
  var B2CConfigFieldType = /* @__PURE__ */ ((B2CConfigFieldType2) => {
5509
6758
  B2CConfigFieldType2[B2CConfigFieldType2["Object"] = 1] = "Object";
5510
6759
  B2CConfigFieldType2[B2CConfigFieldType2["Array"] = 2] = "Array";
@@ -5551,7 +6800,16 @@ var ProposalProductState = /* @__PURE__ */ ((ProposalProductState2) => {
5551
6800
  })(ProposalProductState || {});
5552
6801
  // Annotate the CommonJS export names for ESM import in node:
5553
6802
  0 && (module.exports = {
6803
+ ALL_AGENT_USER_FIELDS,
6804
+ ALL_CASE_FIELDS,
6805
+ ALL_CUSTOMER_FIELDS,
6806
+ ALL_FILE_POLICY_TRANSFER_FIELDS,
6807
+ ALL_POLICY_FIELDS,
6808
+ ALL_POLICY_TRANSFER_FIELDS,
6809
+ ALL_PROPOSAL_FIELDS,
6810
+ ALL_WEBHOOK_DELIVERY_FIELDS,
5554
6811
  AgentInsuranceCompanyType,
6812
+ AgentUserState,
5555
6813
  AracSegment,
5556
6814
  AssetType,
5557
6815
  B2CConfigFieldType,
@@ -5565,17 +6823,21 @@ var ProposalProductState = /* @__PURE__ */ ((ProposalProductState2) => {
5565
6823
  CaseType,
5566
6824
  Channel,
5567
6825
  ComplaintCaseSubType,
6826
+ ConsentType,
5568
6827
  ContactFlowState,
5569
6828
  ContactState,
5570
6829
  ContactType,
5571
6830
  Currency,
5572
6831
  CustomerType,
6832
+ DateOnly,
6833
+ DateTime,
5573
6834
  DefaultInsurUpClient,
5574
6835
  Disease,
5575
6836
  EducationStatus,
5576
6837
  EndorsementCaseSubType,
5577
6838
  Endpoints,
5578
6839
  Gender,
6840
+ GraphQLTransport,
5579
6841
  HastaneAgi,
5580
6842
  InsurUpAgentBranchClient,
5581
6843
  InsurUpAgentClient,
@@ -5619,17 +6881,21 @@ var ProposalProductState = /* @__PURE__ */ ((ProposalProductState2) => {
5619
6881
  SaglikPaketiTedaviSekli,
5620
6882
  SaleOpportunityCaseSubType,
5621
6883
  SmsImplementation,
6884
+ SortEnumType,
5622
6885
  Surgery,
5623
6886
  TasinanYuk,
5624
6887
  TransferredPolicyFailureReason,
5625
6888
  TransferredPolicySkipReason,
5626
6889
  TransferredPolicyStatus,
6890
+ UserType,
5627
6891
  VERSION,
5628
6892
  VehicleAccessoryType,
5629
6893
  VehicleFuelType,
5630
6894
  VehicleUtilizationStyle,
6895
+ WebhookDeliveryState,
5631
6896
  WebhookEvent,
5632
6897
  YedekParcaTuru,
6898
+ buildFieldSelection,
5633
6899
  extractError,
5634
6900
  getDataOrThrow,
5635
6901
  mergeCoverage,