@djust-b2b/djust-front-sdk 3.0.1 → 3.2.0

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 (89) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/.tsbuildinfo-esm +1 -1
  3. package/dist/client/create-client.d.ts +1 -0
  4. package/dist/client/create-client.d.ts.map +1 -1
  5. package/dist/index.cjs +12 -1
  6. package/dist/index.d.ts +8 -15
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.mjs +289 -432
  9. package/dist/monitoring/index.d.ts +7 -0
  10. package/dist/monitoring/index.d.ts.map +1 -0
  11. package/dist/monitoring/observability.d.ts +60 -0
  12. package/dist/monitoring/observability.d.ts.map +1 -0
  13. package/dist/monitoring/sentry.d.ts +72 -0
  14. package/dist/monitoring/sentry.d.ts.map +1 -0
  15. package/dist/monitoring/utils.d.ts +3 -0
  16. package/dist/monitoring/utils.d.ts.map +1 -0
  17. package/dist/monitoring/w3c-trace.d.ts +13 -0
  18. package/dist/monitoring/w3c-trace.d.ts.map +1 -0
  19. package/dist/services/module.d.ts +1 -1
  20. package/dist/services/module.d.ts.map +1 -1
  21. package/dist/services/operation/definitions.d.ts +4 -175
  22. package/dist/services/operation/definitions.d.ts.map +1 -1
  23. package/dist/services/operation/endpoints.d.ts +1 -5
  24. package/dist/services/operation/endpoints.d.ts.map +1 -1
  25. package/dist/services/operation/index.d.ts +12 -510
  26. package/dist/services/operation/index.d.ts.map +1 -1
  27. package/dist/services/operation/module.d.ts +1 -1
  28. package/dist/services/operation/module.d.ts.map +1 -1
  29. package/dist/services/operation/operation.service.d.ts +34 -16
  30. package/dist/services/operation/operation.service.d.ts.map +1 -1
  31. package/dist/services/operation/types.d.ts +1 -106
  32. package/dist/services/operation/types.d.ts.map +1 -1
  33. package/dist/settings/sdk-version.d.ts +1 -1
  34. package/lib/.tsbuildinfo +1 -1
  35. package/lib/client/create-client.d.ts +1 -0
  36. package/lib/client/create-client.d.ts.map +1 -1
  37. package/lib/client/create-client.js +1 -0
  38. package/lib/client/create-client.js.map +1 -1
  39. package/lib/index.d.ts +8 -15
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js +12 -1
  42. package/lib/index.js.map +1 -1
  43. package/lib/monitoring/index.d.ts +7 -0
  44. package/lib/monitoring/index.d.ts.map +1 -0
  45. package/lib/monitoring/index.js +14 -0
  46. package/lib/monitoring/index.js.map +1 -0
  47. package/lib/monitoring/observability.d.ts +60 -0
  48. package/lib/monitoring/observability.d.ts.map +1 -0
  49. package/lib/monitoring/observability.js +115 -0
  50. package/lib/monitoring/observability.js.map +1 -0
  51. package/lib/monitoring/sentry.d.ts +72 -0
  52. package/lib/monitoring/sentry.d.ts.map +1 -0
  53. package/lib/monitoring/sentry.js +142 -0
  54. package/lib/monitoring/sentry.js.map +1 -0
  55. package/lib/monitoring/utils.d.ts +3 -0
  56. package/lib/monitoring/utils.d.ts.map +1 -0
  57. package/lib/monitoring/utils.js +13 -0
  58. package/lib/monitoring/utils.js.map +1 -0
  59. package/lib/monitoring/w3c-trace.d.ts +13 -0
  60. package/lib/monitoring/w3c-trace.d.ts.map +1 -0
  61. package/lib/monitoring/w3c-trace.js +23 -0
  62. package/lib/monitoring/w3c-trace.js.map +1 -0
  63. package/lib/services/module.d.ts +1 -1
  64. package/lib/services/module.d.ts.map +1 -1
  65. package/lib/services/module.js.map +1 -1
  66. package/lib/services/operation/definitions.d.ts +4 -175
  67. package/lib/services/operation/definitions.d.ts.map +1 -1
  68. package/lib/services/operation/definitions.js.map +1 -1
  69. package/lib/services/operation/endpoints.d.ts +1 -5
  70. package/lib/services/operation/endpoints.d.ts.map +1 -1
  71. package/lib/services/operation/endpoints.js +1 -7
  72. package/lib/services/operation/endpoints.js.map +1 -1
  73. package/lib/services/operation/index.d.ts +12 -510
  74. package/lib/services/operation/index.d.ts.map +1 -1
  75. package/lib/services/operation/index.js +14 -650
  76. package/lib/services/operation/index.js.map +1 -1
  77. package/lib/services/operation/module.d.ts +1 -1
  78. package/lib/services/operation/module.d.ts.map +1 -1
  79. package/lib/services/operation/module.js.map +1 -1
  80. package/lib/services/operation/operation.service.d.ts +34 -16
  81. package/lib/services/operation/operation.service.d.ts.map +1 -1
  82. package/lib/services/operation/operation.service.js +36 -155
  83. package/lib/services/operation/operation.service.js.map +1 -1
  84. package/lib/services/operation/types.d.ts +1 -106
  85. package/lib/services/operation/types.d.ts.map +1 -1
  86. package/lib/services/operation/types.js +1 -1
  87. package/lib/settings/sdk-version.d.ts +1 -1
  88. package/lib/settings/sdk-version.js +1 -1
  89. package/package.json +6 -1
package/dist/index.mjs CHANGED
@@ -1326,7 +1326,7 @@ import * as Sentry from "@sentry/browser";
1326
1326
  import "isomorphic-fetch";
1327
1327
 
1328
1328
  // src/settings/sdk-version.ts
1329
- var SDK_VERSION = "3.0.1";
1329
+ var SDK_VERSION = "3.2.0";
1330
1330
 
1331
1331
  // src/settings/fetch-instance.ts
1332
1332
  var clientConfig = {
@@ -4408,219 +4408,65 @@ async function precheckPurchaseCardL3({
4408
4408
  // src/services/operation/index.ts
4409
4409
  var operation_exports = {};
4410
4410
  __export(operation_exports, {
4411
- addOperationAccounts: () => addOperationAccounts,
4412
- addOperationLines: () => addOperationLines,
4413
- createOperation: () => createOperation,
4414
- deleteOperation: () => deleteOperation,
4411
+ OperationStatus: () => OperationStatus,
4412
+ OperationType: () => OperationType,
4415
4413
  getOperation: () => getOperation,
4416
- getOperationAccounts: () => getOperationAccounts,
4417
4414
  getOperationLines: () => getOperationLines,
4418
- getOperations: () => getOperations,
4419
- getShopOperation: () => getShopOperation,
4420
- getShopOperationLines: () => getShopOperationLines,
4421
- getShopOperations: () => getShopOperations,
4422
- removeOperationAccounts: () => removeOperationAccounts,
4423
- removeOperationLines: () => removeOperationLines,
4424
- updateOperation: () => updateOperation,
4425
- updateOperationDetails: () => updateOperationDetails
4415
+ getOperations: () => getOperations
4426
4416
  });
4427
- async function getShopOperations({
4428
- page,
4429
- size,
4430
- sort,
4431
- ids,
4432
- name: name2,
4433
- startDateFrom,
4434
- startDateTo,
4435
- endDateFrom,
4436
- endDateTo,
4437
- locale
4438
- }) {
4439
- const { data } = await enhancedFetch({
4440
- method: "GET",
4441
- path: `/v1/shop/operations`,
4442
- params: {
4443
- page,
4444
- size,
4445
- sort,
4446
- ids,
4447
- name: name2,
4448
- startDateFrom,
4449
- startDateTo,
4450
- endDateFrom,
4451
- endDateTo,
4452
- locale
4453
- }
4454
- });
4455
- return data;
4456
- }
4417
+
4418
+ // src/services/operation/definitions.ts
4419
+ var OperationType = /* @__PURE__ */ ((OperationType2) => {
4420
+ OperationType2["PUBLIC"] = "PUBLIC";
4421
+ OperationType2["PRIVATE"] = "PRIVATE";
4422
+ return OperationType2;
4423
+ })(OperationType || {});
4424
+ var OperationStatus = /* @__PURE__ */ ((OperationStatus2) => {
4425
+ OperationStatus2["DRAFT"] = "DRAFT";
4426
+ OperationStatus2["ACTIVE"] = "ACTIVE";
4427
+ OperationStatus2["INACTIVE"] = "INACTIVE";
4428
+ return OperationStatus2;
4429
+ })(OperationStatus || {});
4430
+
4431
+ // src/services/operation/index.ts
4457
4432
  async function getOperations({
4458
4433
  page,
4459
4434
  size,
4460
4435
  sort,
4461
- type,
4462
- status,
4463
4436
  ids,
4464
4437
  name: name2,
4465
4438
  startDateFrom,
4466
4439
  startDateTo,
4467
4440
  endDateFrom,
4468
4441
  endDateTo,
4469
- ownerIds,
4470
- idType,
4471
4442
  locale
4472
4443
  }) {
4473
4444
  const { data } = await enhancedFetch({
4474
4445
  method: "GET",
4475
- path: `/v1/operations`,
4446
+ path: `/v1/shop/operations`,
4476
4447
  params: {
4477
4448
  page,
4478
4449
  size,
4479
4450
  sort,
4480
- type,
4481
- status,
4482
4451
  ids,
4483
4452
  name: name2,
4484
4453
  startDateFrom,
4485
4454
  startDateTo,
4486
4455
  endDateFrom,
4487
4456
  endDateTo,
4488
- ownerIds,
4489
- idType,
4490
4457
  locale
4491
4458
  }
4492
4459
  });
4493
4460
  return data;
4494
4461
  }
4495
- async function getShopOperation({
4496
- operationId,
4497
- locale
4498
- }) {
4499
- const { data } = await enhancedFetch({
4500
- method: "GET",
4501
- path: `/v1/shop/operations/${operationId}`
4502
- });
4503
- return data;
4504
- }
4505
4462
  async function getOperation({
4506
- operationId
4507
- }) {
4508
- const { data } = await enhancedFetch({
4509
- method: "GET",
4510
- path: `/v1/operations/${operationId}`
4511
- });
4512
- return data;
4513
- }
4514
- async function updateOperation({
4515
- operationId,
4516
- status
4517
- }) {
4518
- await enhancedFetch({
4519
- method: "PATCH",
4520
- path: `/v1/operations/${operationId}`,
4521
- body: JSON.stringify({
4522
- status
4523
- })
4524
- });
4525
- }
4526
- async function updateOperationDetails({
4527
4463
  operationId,
4528
- customFieldValues,
4529
- descriptions,
4530
- endDate,
4531
- names,
4532
- startDate
4533
- }) {
4534
- const { data } = await enhancedFetch({
4535
- method: "PUT",
4536
- path: `/v1/operations/${operationId}`,
4537
- body: JSON.stringify({
4538
- customFieldValues,
4539
- descriptions,
4540
- endDate,
4541
- names,
4542
- startDate
4543
- })
4544
- });
4545
- return data;
4546
- }
4547
- async function removeOperationAccounts({
4548
- operationId,
4549
- accountIds
4550
- }) {
4551
- await enhancedFetch({
4552
- method: "DELETE",
4553
- path: `/v1/operations/${operationId}/accounts`,
4554
- body: JSON.stringify({
4555
- accountIds
4556
- })
4557
- });
4558
- }
4559
- async function getOperationAccounts({
4560
- operationId,
4561
- page,
4562
- size,
4563
- sort,
4564
- accountIds,
4565
- accountName
4566
- }) {
4567
- const { data } = await enhancedFetch({
4568
- method: "GET",
4569
- path: `/v1/operations/${operationId}/accounts`,
4570
- params: {
4571
- page,
4572
- size,
4573
- sort,
4574
- accountIds,
4575
- accountName
4576
- }
4577
- });
4578
- return data;
4579
- }
4580
- async function addOperationAccounts({
4581
- operationId,
4582
- accountIds
4583
- }) {
4584
- await enhancedFetch({
4585
- method: "PUT",
4586
- path: `/v1/operations/${operationId}/accounts`,
4587
- body: JSON.stringify({
4588
- accountIds
4589
- })
4590
- });
4591
- }
4592
- async function removeOperationLines({
4593
- operationId,
4594
- variantIds
4595
- }) {
4596
- await enhancedFetch({
4597
- method: "DELETE",
4598
- path: `/v1/operations/${operationId}/lines`,
4599
- body: JSON.stringify({
4600
- variantIds
4601
- })
4602
- });
4603
- }
4604
- async function getShopOperationLines({
4605
- operationId,
4606
- page,
4607
- size,
4608
- sort,
4609
- variantIds,
4610
- variantName,
4611
4464
  locale
4612
4465
  }) {
4613
4466
  const { data } = await enhancedFetch({
4614
4467
  method: "GET",
4615
- path: `/v1/shop/operations/${operationId}/lines`,
4616
- params: {
4617
- page,
4618
- size,
4619
- sort,
4620
- variantIds,
4621
- variantName,
4622
- locale
4623
- }
4468
+ path: `/v1/shop/operations/${operationId}`,
4469
+ params: { locale }
4624
4470
  });
4625
4471
  return data;
4626
4472
  }
@@ -4631,70 +4477,22 @@ async function getOperationLines({
4631
4477
  sort,
4632
4478
  variantIds,
4633
4479
  variantName,
4634
- minQuantity,
4635
- maxQuantity,
4636
- recommendedQuantity,
4637
4480
  locale
4638
4481
  }) {
4639
4482
  const { data } = await enhancedFetch({
4640
4483
  method: "GET",
4641
- path: `/v1/operations/${operationId}/lines`,
4484
+ path: `/v1/shop/operations/${operationId}/lines`,
4642
4485
  params: {
4643
4486
  page,
4644
4487
  size,
4645
4488
  sort,
4646
4489
  variantIds,
4647
4490
  variantName,
4648
- minQuantity,
4649
- maxQuantity,
4650
- recommendedQuantity,
4651
4491
  locale
4652
4492
  }
4653
4493
  });
4654
4494
  return data;
4655
4495
  }
4656
- async function addOperationLines({
4657
- operationId,
4658
- lines
4659
- }) {
4660
- await enhancedFetch({
4661
- method: "PUT",
4662
- path: `/v1/operations/${operationId}/lines`,
4663
- body: JSON.stringify(lines)
4664
- });
4665
- }
4666
- async function createOperation({
4667
- customFieldValues,
4668
- descriptions,
4669
- endDate,
4670
- externalId,
4671
- names,
4672
- startDate,
4673
- type
4674
- }) {
4675
- const { data } = await enhancedFetch({
4676
- method: "POST",
4677
- path: `/v1/operations`,
4678
- body: JSON.stringify({
4679
- customFieldValues,
4680
- descriptions,
4681
- endDate,
4682
- externalId,
4683
- names,
4684
- startDate,
4685
- type
4686
- })
4687
- });
4688
- return data;
4689
- }
4690
- async function deleteOperation({
4691
- operationId
4692
- }) {
4693
- await enhancedFetch({
4694
- method: "DELETE",
4695
- path: `/v1/operations/${operationId}`
4696
- });
4697
- }
4698
4496
 
4699
4497
  // src/client/transport.ts
4700
4498
  init_base();
@@ -10691,15 +10489,9 @@ var NavigationCategoryService = class extends BaseService {
10691
10489
 
10692
10490
  // src/services/operation/endpoints.ts
10693
10491
  var OperationEndpoints = {
10694
- // Shop operations
10695
10492
  SHOP_OPERATIONS: "/v1/shop/operations",
10696
10493
  SHOP_OPERATION: "/v1/shop/operations/{operationId}",
10697
- SHOP_OPERATION_LINES: "/v1/shop/operations/{operationId}/lines",
10698
- // Operations (admin)
10699
- OPERATIONS: "/v1/operations",
10700
- OPERATION: "/v1/operations/{operationId}",
10701
- OPERATION_ACCOUNTS: "/v1/operations/{operationId}/accounts",
10702
- OPERATION_LINES: "/v1/operations/{operationId}/lines"
10494
+ SHOP_OPERATION_LINES: "/v1/shop/operations/{operationId}/lines"
10703
10495
  };
10704
10496
 
10705
10497
  // src/services/operation/operation.service.ts
@@ -10708,27 +10500,27 @@ var OperationService = class extends BaseService {
10708
10500
  super(...arguments);
10709
10501
  this.serviceName = "operation";
10710
10502
  }
10711
- async getShopOperations(params = {}, context) {
10712
- return this.request(
10713
- {
10714
- method: "GET",
10715
- path: OperationEndpoints.SHOP_OPERATIONS,
10716
- params: this.buildParams(params)
10717
- },
10718
- context
10719
- );
10720
- }
10503
+ /**
10504
+ * List ACTIVE operations visible to the caller on the effective store.
10505
+ *
10506
+ * **Endpoint**: `GET /v1/shop/operations [OPERATION-550]`
10507
+ */
10721
10508
  async getOperations(params = {}, context) {
10722
10509
  return this.request(
10723
10510
  {
10724
10511
  method: "GET",
10725
- path: OperationEndpoints.OPERATIONS,
10512
+ path: OperationEndpoints.SHOP_OPERATIONS,
10726
10513
  params: this.buildParams(params)
10727
10514
  },
10728
10515
  context
10729
10516
  );
10730
10517
  }
10731
- async getShopOperation(params, context) {
10518
+ /**
10519
+ * Get a single operation visible to the caller (metadata only).
10520
+ *
10521
+ * **Endpoint**: `GET /v1/shop/operations/{operationId} [OPERATION-500]`
10522
+ */
10523
+ async getOperation(params, context) {
10732
10524
  this.required(params, ["operationId"]);
10733
10525
  return this.request(
10734
10526
  {
@@ -10741,158 +10533,17 @@ var OperationService = class extends BaseService {
10741
10533
  context
10742
10534
  );
10743
10535
  }
10744
- async getOperation(params, context) {
10745
- this.required(params, ["operationId"]);
10746
- return this.request(
10747
- {
10748
- method: "GET",
10749
- path: this.buildPath(OperationEndpoints.OPERATION, {
10750
- operationId: params.operationId
10751
- })
10752
- },
10753
- context
10754
- );
10755
- }
10756
- async createOperation(params, context) {
10757
- this.required(params, [
10758
- "externalId",
10759
- "names",
10760
- "startDate",
10761
- "endDate",
10762
- "type"
10763
- ]);
10764
- return this.request(
10765
- {
10766
- method: "POST",
10767
- path: OperationEndpoints.OPERATIONS,
10768
- body: {
10769
- customFieldValues: params.customFieldValues,
10770
- descriptions: params.descriptions,
10771
- endDate: params.endDate,
10772
- externalId: params.externalId,
10773
- names: params.names,
10774
- startDate: params.startDate,
10775
- type: params.type
10776
- }
10777
- },
10778
- context
10779
- );
10780
- }
10781
- async updateOperation(params, context) {
10782
- this.required(params, ["operationId", "status"]);
10783
- await this.request(
10784
- {
10785
- method: "PATCH",
10786
- path: this.buildPath(OperationEndpoints.OPERATION, {
10787
- operationId: params.operationId
10788
- }),
10789
- body: { status: params.status }
10790
- },
10791
- context
10792
- );
10793
- }
10794
- async updateOperationDetails(params, context) {
10795
- this.required(params, ["operationId"]);
10796
- return this.request(
10797
- {
10798
- method: "PUT",
10799
- path: this.buildPath(OperationEndpoints.OPERATION, {
10800
- operationId: params.operationId
10801
- }),
10802
- body: {
10803
- customFieldValues: params.customFieldValues,
10804
- descriptions: params.descriptions,
10805
- endDate: params.endDate,
10806
- names: params.names,
10807
- startDate: params.startDate
10808
- }
10809
- },
10810
- context
10811
- );
10812
- }
10813
- async deleteOperation(params, context) {
10814
- this.required(params, ["operationId"]);
10815
- await this.request(
10816
- {
10817
- method: "DELETE",
10818
- path: this.buildPath(OperationEndpoints.OPERATION, {
10819
- operationId: params.operationId
10820
- })
10821
- },
10822
- context
10823
- );
10824
- }
10825
- async getOperationAccounts(params, context) {
10826
- this.required(params, ["operationId"]);
10827
- return this.request(
10828
- {
10829
- method: "GET",
10830
- path: this.buildPath(OperationEndpoints.OPERATION_ACCOUNTS, {
10831
- operationId: params.operationId
10832
- }),
10833
- params: this.buildParams({
10834
- page: params.page,
10835
- size: params.size,
10836
- sort: params.sort,
10837
- accountIds: params.accountIds,
10838
- accountName: params.accountName
10839
- })
10840
- },
10841
- context
10842
- );
10843
- }
10844
- async addOperationAccounts(params, context) {
10845
- this.required(params, ["operationId", "accountIds"]);
10846
- await this.request(
10847
- {
10848
- method: "PUT",
10849
- path: this.buildPath(OperationEndpoints.OPERATION_ACCOUNTS, {
10850
- operationId: params.operationId
10851
- }),
10852
- body: { accountIds: params.accountIds }
10853
- },
10854
- context
10855
- );
10856
- }
10857
- async removeOperationAccounts(params, context) {
10858
- this.required(params, ["operationId", "accountIds"]);
10859
- await this.request(
10860
- {
10861
- method: "DELETE",
10862
- path: this.buildPath(OperationEndpoints.OPERATION_ACCOUNTS, {
10863
- operationId: params.operationId
10864
- }),
10865
- body: { accountIds: params.accountIds }
10866
- },
10867
- context
10868
- );
10869
- }
10870
- async getShopOperationLines(params, context) {
10871
- this.required(params, ["operationId"]);
10872
- return this.request(
10873
- {
10874
- method: "GET",
10875
- path: this.buildPath(OperationEndpoints.SHOP_OPERATION_LINES, {
10876
- operationId: params.operationId
10877
- }),
10878
- params: this.buildParams({
10879
- page: params.page,
10880
- size: params.size,
10881
- sort: params.sort,
10882
- variantIds: params.variantIds,
10883
- variantName: params.variantName,
10884
- locale: params.locale
10885
- })
10886
- },
10887
- context
10888
- );
10889
- }
10536
+ /**
10537
+ * List product variant lines for a shop operation.
10538
+ *
10539
+ * **Endpoint**: `GET /v1/shop/operations/{operationId}/lines [OPERATION-551]`
10540
+ */
10890
10541
  async getOperationLines(params, context) {
10891
10542
  this.required(params, ["operationId"]);
10892
10543
  return this.request(
10893
10544
  {
10894
10545
  method: "GET",
10895
- path: this.buildPath(OperationEndpoints.OPERATION_LINES, {
10546
+ path: this.buildPath(OperationEndpoints.SHOP_OPERATION_LINES, {
10896
10547
  operationId: params.operationId
10897
10548
  }),
10898
10549
  params: this.buildParams({
@@ -10901,41 +10552,12 @@ var OperationService = class extends BaseService {
10901
10552
  sort: params.sort,
10902
10553
  variantIds: params.variantIds,
10903
10554
  variantName: params.variantName,
10904
- minQuantity: params.minQuantity,
10905
- maxQuantity: params.maxQuantity,
10906
- recommendedQuantity: params.recommendedQuantity,
10907
10555
  locale: params.locale
10908
10556
  })
10909
10557
  },
10910
10558
  context
10911
10559
  );
10912
10560
  }
10913
- async addOperationLines(params, context) {
10914
- this.required(params, ["operationId", "lines"]);
10915
- await this.request(
10916
- {
10917
- method: "PUT",
10918
- path: this.buildPath(OperationEndpoints.OPERATION_LINES, {
10919
- operationId: params.operationId
10920
- }),
10921
- body: params.lines
10922
- },
10923
- context
10924
- );
10925
- }
10926
- async removeOperationLines(params, context) {
10927
- this.required(params, ["operationId", "variantIds"]);
10928
- await this.request(
10929
- {
10930
- method: "DELETE",
10931
- path: this.buildPath(OperationEndpoints.OPERATION_LINES, {
10932
- operationId: params.operationId
10933
- }),
10934
- body: { variantIds: params.variantIds }
10935
- },
10936
- context
10937
- );
10938
- }
10939
10561
  };
10940
10562
 
10941
10563
  // src/services/attributes/endpoints.ts
@@ -11585,6 +11207,7 @@ function createDjustClient(config) {
11585
11207
  // ==================== OPERATIONS ====================
11586
11208
  getOperations: (p) => services.operation.getOperations(p, ctx),
11587
11209
  getOperation: (p) => services.operation.getOperation(p, ctx),
11210
+ getOperationLines: (p) => services.operation.getOperationLines(p, ctx),
11588
11211
  // ==================== INCIDENTS ====================
11589
11212
  getIncidents: (p) => services.incident.getIncidents(p, ctx),
11590
11213
  getIncident: (p) => services.incident.getIncident(p, ctx),
@@ -11628,18 +11251,245 @@ init_unexpected_error();
11628
11251
  // src/errors/index.ts
11629
11252
  init_factory();
11630
11253
 
11631
- // src/services/operation/definitions.ts
11632
- var OperationType = /* @__PURE__ */ ((OperationType2) => {
11633
- OperationType2["PUBLIC"] = "PUBLIC";
11634
- OperationType2["PRIVATE"] = "PRIVATE";
11635
- return OperationType2;
11636
- })(OperationType || {});
11637
- var OperationStatus = /* @__PURE__ */ ((OperationStatus2) => {
11638
- OperationStatus2["DRAFT"] = "DRAFT";
11639
- OperationStatus2["ACTIVE"] = "ACTIVE";
11640
- OperationStatus2["INACTIVE"] = "INACTIVE";
11641
- return OperationStatus2;
11642
- })(OperationStatus || {});
11254
+ // src/monitoring/w3c-trace.ts
11255
+ function getW3CTraceFromHeaders(headers) {
11256
+ const traceparent = headers.traceparent ?? headers.Traceparent;
11257
+ if (!traceparent) {
11258
+ return {};
11259
+ }
11260
+ const parts = traceparent.trim().split("-");
11261
+ if (parts.length !== 4 || parts[0] !== "00") {
11262
+ return { traceparent };
11263
+ }
11264
+ const [, traceId, spanId] = parts;
11265
+ const isHex = (value, length) => value.length === length && /^[0-9a-f]+$/i.test(value);
11266
+ if (!isHex(traceId, 32) || !isHex(spanId, 16)) {
11267
+ return { traceparent };
11268
+ }
11269
+ return { traceparent, traceId, spanId };
11270
+ }
11271
+
11272
+ // src/monitoring/utils.ts
11273
+ function getEndpoint(url) {
11274
+ try {
11275
+ return new URL(url).pathname;
11276
+ } catch {
11277
+ return url;
11278
+ }
11279
+ }
11280
+
11281
+ // src/monitoring/sentry.ts
11282
+ function resolveErrorCode(error) {
11283
+ if (isSDKError(error)) {
11284
+ return String(error.code);
11285
+ }
11286
+ const legacy = fromLegacyError(error);
11287
+ return legacy ? String(legacy.code) : SDKErrorCode.UNEXPECTED_ERROR;
11288
+ }
11289
+ function resolveHttpStatus(error) {
11290
+ if (isSDKError(error)) {
11291
+ return error.httpStatus;
11292
+ }
11293
+ const legacy = fromLegacyError(error);
11294
+ return legacy?.httpStatus ?? 500;
11295
+ }
11296
+ function buildDjustSentryTags(error, context) {
11297
+ const tags = {
11298
+ "djust.source": context.source,
11299
+ "djust.error_code": resolveErrorCode(error),
11300
+ "djust.http_status": String(resolveHttpStatus(error)),
11301
+ "djust.retriable": String(isSDKError(error) ? error.retriable : false)
11302
+ };
11303
+ if (context.clientId)
11304
+ tags["djust.client_id"] = context.clientId;
11305
+ if (context.clientName)
11306
+ tags["djust.client_name"] = context.clientName;
11307
+ if (context.environment)
11308
+ tags["djust.env"] = context.environment;
11309
+ if (context.requestId)
11310
+ tags["djust.request_id"] = context.requestId;
11311
+ if (context.traceId)
11312
+ tags["djust.trace_id"] = context.traceId;
11313
+ if (context.traceparent)
11314
+ tags["djust.traceparent"] = context.traceparent;
11315
+ if (context.spanId)
11316
+ tags["djust.span_id"] = context.spanId;
11317
+ if (context.method)
11318
+ tags["djust.method"] = context.method;
11319
+ if (context.endpoint)
11320
+ tags["djust.endpoint"] = context.endpoint;
11321
+ if (context.bffRoute)
11322
+ tags["djust.bff_route"] = context.bffRoute;
11323
+ if (context.monitoringTier) {
11324
+ tags["djust.monitoring_tier"] = context.monitoringTier;
11325
+ }
11326
+ if (context.willRetry !== void 0) {
11327
+ tags["djust.will_retry"] = String(context.willRetry);
11328
+ }
11329
+ return tags;
11330
+ }
11331
+ function captureDjustError(sentry, error, context, options) {
11332
+ if (options?.skipIfRetrying && context.willRetry) {
11333
+ return;
11334
+ }
11335
+ const httpStatus = resolveHttpStatus(error);
11336
+ const ignored = options?.ignoredHttpStatuses ?? [];
11337
+ if (ignored.includes(httpStatus)) {
11338
+ return;
11339
+ }
11340
+ const endpoint = context.endpoint ?? (isSDKError(error) ? error.metadata.endpoint : void 0);
11341
+ const tags = buildDjustSentryTags(error, { ...context, endpoint });
11342
+ sentry.withScope((scope) => {
11343
+ for (const [key, value] of Object.entries(tags)) {
11344
+ scope.setTag(key, value);
11345
+ }
11346
+ if (isSDKError(error)) {
11347
+ scope.setContext(
11348
+ "djust_error",
11349
+ error.toJSON()
11350
+ );
11351
+ }
11352
+ if (context.traceparent || context.traceId || context.spanId) {
11353
+ scope.setContext("w3c_trace", {
11354
+ traceId: context.traceId ?? context.requestId,
11355
+ spanId: context.spanId,
11356
+ traceparent: context.traceparent
11357
+ });
11358
+ }
11359
+ scope.captureException(error);
11360
+ });
11361
+ }
11362
+ function createDjustSentryHooks(sentry, options = {}) {
11363
+ const skipRetrying = options.skipRetryingErrors ?? true;
11364
+ const ignoredHttpStatuses = options.ignoredHttpStatuses ?? [];
11365
+ return {
11366
+ onError(ctx) {
11367
+ const w3c = getW3CTraceFromHeaders(ctx.headers);
11368
+ captureDjustError(
11369
+ sentry,
11370
+ ctx.error,
11371
+ {
11372
+ source: "sdk",
11373
+ monitoringTier: options.monitoringTier ?? "djust",
11374
+ clientId: options.clientId,
11375
+ clientName: options.clientName,
11376
+ environment: options.environment,
11377
+ requestId: ctx.requestId,
11378
+ traceId: w3c.traceId ?? ctx.requestId,
11379
+ traceparent: w3c.traceparent,
11380
+ spanId: w3c.spanId,
11381
+ method: ctx.method,
11382
+ endpoint: getEndpoint(ctx.url),
11383
+ willRetry: ctx.willRetry
11384
+ },
11385
+ { skipIfRetrying: skipRetrying, ignoredHttpStatuses }
11386
+ );
11387
+ },
11388
+ onRetry(ctx) {
11389
+ sentry.addBreadcrumb({
11390
+ category: "djust.retry",
11391
+ message: `Retry ${ctx.attempt}/${ctx.maxAttempts} for ${ctx.requestId}`,
11392
+ level: "warning",
11393
+ data: {
11394
+ requestId: ctx.requestId,
11395
+ attempt: ctx.attempt,
11396
+ delayMs: ctx.delayMs,
11397
+ reason: ctx.reason,
11398
+ errorCode: resolveErrorCode(ctx.error)
11399
+ }
11400
+ });
11401
+ }
11402
+ };
11403
+ }
11404
+
11405
+ // src/monitoring/observability.ts
11406
+ function resolveMessage(error) {
11407
+ if (error instanceof Error) {
11408
+ return error.message;
11409
+ }
11410
+ return String(error);
11411
+ }
11412
+ function buildDjustErrorEvent(error, context) {
11413
+ const sdkError = isSDKError(error) ? error : fromLegacyError(error);
11414
+ const endpoint = context.endpoint ?? (isSDKError(error) ? error.metadata.endpoint : void 0);
11415
+ return {
11416
+ code: sdkError ? String(sdkError.code) : SDKErrorCode.UNEXPECTED_ERROR,
11417
+ httpStatus: sdkError?.httpStatus ?? 500,
11418
+ retriable: sdkError?.retriable ?? false,
11419
+ message: resolveMessage(error),
11420
+ source: context.source,
11421
+ monitoringTier: context.monitoringTier,
11422
+ clientId: context.clientId,
11423
+ clientName: context.clientName,
11424
+ environment: context.environment,
11425
+ traceId: context.traceId ?? context.requestId,
11426
+ traceparent: context.traceparent,
11427
+ spanId: context.spanId,
11428
+ requestId: context.requestId,
11429
+ method: context.method,
11430
+ endpoint,
11431
+ bffRoute: context.bffRoute,
11432
+ willRetry: context.willRetry,
11433
+ serialized: isSDKError(error) ? error.toJSON() : void 0,
11434
+ error
11435
+ };
11436
+ }
11437
+ function createDjustErrorHooks(onError, options = {}) {
11438
+ const skipRetrying = options.skipRetryingErrors ?? true;
11439
+ const ignoredHttpStatuses = options.ignoredHttpStatuses ?? [];
11440
+ return {
11441
+ onError(ctx) {
11442
+ if (skipRetrying && ctx.willRetry) {
11443
+ return;
11444
+ }
11445
+ const httpStatus = isSDKError(ctx.error) ? ctx.error.httpStatus : fromLegacyError(ctx.error)?.httpStatus ?? 500;
11446
+ if (ignoredHttpStatuses.includes(httpStatus)) {
11447
+ return;
11448
+ }
11449
+ const w3c = getW3CTraceFromHeaders(ctx.headers);
11450
+ const event = buildDjustErrorEvent(ctx.error, {
11451
+ source: "sdk",
11452
+ monitoringTier: options.monitoringTier,
11453
+ clientId: options.clientId,
11454
+ clientName: options.clientName,
11455
+ environment: options.environment,
11456
+ requestId: ctx.requestId,
11457
+ traceId: w3c.traceId ?? ctx.requestId,
11458
+ traceparent: w3c.traceparent,
11459
+ spanId: w3c.spanId,
11460
+ method: ctx.method,
11461
+ endpoint: getEndpoint(ctx.url),
11462
+ willRetry: ctx.willRetry
11463
+ });
11464
+ return onError(event);
11465
+ }
11466
+ };
11467
+ }
11468
+ var TRANSPORT_HOOK_NAMES = [
11469
+ "onRequestStart",
11470
+ "onRequestEnd",
11471
+ "onError",
11472
+ "onRetry",
11473
+ "onCacheHit"
11474
+ ];
11475
+ function mergeTransportHooks(...hookSets) {
11476
+ const merged = {};
11477
+ for (const hookName of TRANSPORT_HOOK_NAMES) {
11478
+ const handlers = hookSets.map((set) => set[hookName]).filter(
11479
+ (handler) => Boolean(handler)
11480
+ );
11481
+ if (handlers.length === 0) {
11482
+ continue;
11483
+ }
11484
+ const runHandlers = async (ctx) => {
11485
+ await Promise.allSettled(
11486
+ handlers.map(async (handler) => handler(ctx))
11487
+ );
11488
+ };
11489
+ Object.assign(merged, { [hookName]: runHandlers });
11490
+ }
11491
+ return merged;
11492
+ }
11643
11493
 
11644
11494
  // src/services/product/definitions.ts
11645
11495
  var AggregationType = /* @__PURE__ */ ((AggregationType2) => {
@@ -11693,7 +11543,12 @@ export {
11693
11543
  TimeoutError,
11694
11544
  UnexpectedError,
11695
11545
  ValidationError,
11546
+ buildDjustErrorEvent,
11547
+ buildDjustSentryTags,
11548
+ captureDjustError,
11696
11549
  createDjustClient,
11550
+ createDjustErrorHooks,
11551
+ createDjustSentryHooks,
11697
11552
  createErrorFromException,
11698
11553
  createErrorFromResponse,
11699
11554
  extractErrorCode,
@@ -11702,6 +11557,7 @@ export {
11702
11557
  getHttpStatus,
11703
11558
  getRetryDelay,
11704
11559
  getUserFriendlyMessage,
11560
+ getW3CTraceFromHeaders,
11705
11561
  isApiError,
11706
11562
  isAuthError,
11707
11563
  isClientError,
@@ -11717,6 +11573,7 @@ export {
11717
11573
  isTransientError,
11718
11574
  isUnexpectedError,
11719
11575
  isValidationError,
11576
+ mergeTransportHooks,
11720
11577
  parseLegacyError,
11721
11578
  shouldReauthenticate,
11722
11579
  toLegacyError,