@symbo.ls/sdk 2.34.4 → 2.34.7

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 (49) hide show
  1. package/dist/cjs/index.js +24 -0
  2. package/dist/cjs/services/BranchService.js +4 -4
  3. package/dist/cjs/services/IntegrationService.js +538 -0
  4. package/dist/cjs/services/MetricsService.js +62 -0
  5. package/dist/cjs/services/PaymentService.js +1 -1
  6. package/dist/cjs/services/PullRequestService.js +8 -6
  7. package/dist/cjs/services/WaitlistService.js +148 -0
  8. package/dist/cjs/services/index.js +13 -1
  9. package/dist/cjs/utils/services.js +26 -1
  10. package/dist/esm/index.js +751 -12
  11. package/dist/esm/services/BranchService.js +4 -4
  12. package/dist/esm/services/IntegrationService.js +1319 -0
  13. package/dist/esm/services/MetricsService.js +843 -0
  14. package/dist/esm/services/PaymentService.js +1 -1
  15. package/dist/esm/services/PullRequestService.js +8 -6
  16. package/dist/esm/services/WaitlistService.js +929 -0
  17. package/dist/esm/services/index.js +708 -12
  18. package/dist/esm/utils/services.js +26 -1
  19. package/dist/node/index.js +32 -2
  20. package/dist/node/services/BranchService.js +4 -4
  21. package/dist/node/services/IntegrationService.js +519 -0
  22. package/dist/node/services/MetricsService.js +43 -0
  23. package/dist/node/services/PaymentService.js +1 -1
  24. package/dist/node/services/PullRequestService.js +8 -6
  25. package/dist/node/services/WaitlistService.js +129 -0
  26. package/dist/node/services/index.js +13 -1
  27. package/dist/node/utils/services.js +26 -1
  28. package/package.json +8 -7
  29. package/src/index.js +40 -13
  30. package/src/services/BranchService.js +5 -5
  31. package/src/services/IntegrationService.js +548 -0
  32. package/src/services/MetricsService.js +40 -0
  33. package/src/services/PaymentService.js +1 -1
  34. package/src/services/PullRequestService.js +6 -6
  35. package/src/services/WaitlistService.js +130 -0
  36. package/src/services/index.js +16 -2
  37. package/src/services/tests/FileService/createFileFormData.test.js +74 -0
  38. package/src/services/tests/FileService/getFileUrl.test.js +69 -0
  39. package/src/services/tests/FileService/updateProjectIcon.test.js +109 -0
  40. package/src/services/tests/FileService/uploadDocument.test.js +36 -0
  41. package/src/services/tests/FileService/uploadFile.test.js +78 -0
  42. package/src/services/tests/FileService/uploadFileWithValidation.test.js +114 -0
  43. package/src/services/tests/FileService/uploadImage.test.js +36 -0
  44. package/src/services/tests/FileService/uploadMultipleFiles.test.js +111 -0
  45. package/src/services/tests/FileService/validateFile.test.js +63 -0
  46. package/src/services/tests/PlanService/getActivePlans.test.js +0 -2
  47. package/src/services/tests/PlanService/getPlanByKey.test.js +109 -0
  48. package/src/services/tests/PlanService/getPlansByPriceRange.test.js +109 -0
  49. package/src/utils/services.js +29 -1
package/dist/esm/index.js CHANGED
@@ -47021,7 +47021,7 @@ var PaymentService = class extends BaseService {
47021
47021
  status: status.status
47022
47022
  };
47023
47023
  } catch (error) {
47024
- throw new Error(`Failed to get subscription details: ${error.message}`);
47024
+ throw new Error(`Failed to get subscription details: ${error.message}`, { cause: error });
47025
47025
  }
47026
47026
  }
47027
47027
  /**
@@ -47657,7 +47657,7 @@ var BranchService = class extends BaseService {
47657
47657
  throw new Error(response.message);
47658
47658
  } catch (error) {
47659
47659
  if (error.message.includes("conflicts") || error.message.includes("409")) {
47660
- throw new Error(`Merge conflicts detected: ${error.message}`);
47660
+ throw new Error(`Merge conflicts detected: ${error.message}`, { cause: error });
47661
47661
  }
47662
47662
  throw new Error(`Failed to merge branch: ${error.message}`, { cause: error });
47663
47663
  }
@@ -47870,7 +47870,7 @@ var BranchService = class extends BaseService {
47870
47870
  );
47871
47871
  return branchStatuses;
47872
47872
  } catch (error) {
47873
- throw new Error(`Failed to get branches with status: ${error.message}`);
47873
+ throw new Error(`Failed to get branches with status: ${error.message}`, { cause: error });
47874
47874
  }
47875
47875
  }
47876
47876
  /**
@@ -47901,7 +47901,7 @@ var BranchService = class extends BaseService {
47901
47901
  error: 'Cannot use "main" as a branch name'
47902
47902
  };
47903
47903
  }
47904
- if (!/^[a-zA-Z0-9-_]+$/.test(branchName)) {
47904
+ if (!/^[a-zA-Z0-9-_]+$/u.test(branchName)) {
47905
47905
  return {
47906
47906
  isValid: false,
47907
47907
  error: "Branch name can only contain letters, numbers, hyphens, and underscores"
@@ -47919,7 +47919,7 @@ var BranchService = class extends BaseService {
47919
47919
  if (!branchName) {
47920
47920
  return "";
47921
47921
  }
47922
- return branchName.trim().toLowerCase().replace(/[^a-z0-9-_]/gu, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
47922
+ return branchName.trim().toLowerCase().replace(/[^a-z0-9-_]/gu, "-").replace(/-+/gu, "-").replace(/^-|-$/gu, "");
47923
47923
  }
47924
47924
  };
47925
47925
 
@@ -48107,7 +48107,7 @@ var PullRequestService = class extends BaseService {
48107
48107
  throw new Error(response.message);
48108
48108
  } catch (error) {
48109
48109
  if (error.message.includes("conflicts") || error.message.includes("409")) {
48110
- throw new Error(`Pull request has merge conflicts: ${error.message}`);
48110
+ throw new Error(`Pull request has merge conflicts: ${error.message}`, { cause: error });
48111
48111
  }
48112
48112
  throw new Error(`Failed to merge pull request: ${error.message}`, { cause: error });
48113
48113
  }
@@ -48224,7 +48224,8 @@ var PullRequestService = class extends BaseService {
48224
48224
  return ((_a2 = prData == null ? void 0 : prData.data) == null ? void 0 : _a2.canMerge) || false;
48225
48225
  } catch (error) {
48226
48226
  throw new Error(
48227
- `Failed to check pull request mergeability: ${error.message}`
48227
+ `Failed to check pull request mergeability: ${error.message}`,
48228
+ { cause: error }
48228
48229
  );
48229
48230
  }
48230
48231
  }
@@ -48250,7 +48251,8 @@ var PullRequestService = class extends BaseService {
48250
48251
  };
48251
48252
  } catch (error) {
48252
48253
  throw new Error(
48253
- `Failed to get pull request status summary: ${error.message}`
48254
+ `Failed to get pull request status summary: ${error.message}`,
48255
+ { cause: error }
48254
48256
  );
48255
48257
  }
48256
48258
  }
@@ -48344,7 +48346,7 @@ var PullRequestService = class extends BaseService {
48344
48346
  });
48345
48347
  return stats;
48346
48348
  } catch (error) {
48347
- throw new Error(`Failed to get pull request stats: ${error.message}`);
48349
+ throw new Error(`Failed to get pull request stats: ${error.message}`, { cause: error });
48348
48350
  }
48349
48351
  }
48350
48352
  /**
@@ -48371,7 +48373,7 @@ var PullRequestService = class extends BaseService {
48371
48373
  }
48372
48374
  throw new Error(response.message);
48373
48375
  } catch (error) {
48374
- throw new Error(`Failed to close pull request: ${error.message}`);
48376
+ throw new Error(`Failed to close pull request: ${error.message}`, { cause: error });
48375
48377
  }
48376
48378
  }
48377
48379
  /**
@@ -48398,7 +48400,7 @@ var PullRequestService = class extends BaseService {
48398
48400
  }
48399
48401
  throw new Error(response.message);
48400
48402
  } catch (error) {
48401
- throw new Error(`Failed to reopen pull request: ${error.message}`);
48403
+ throw new Error(`Failed to reopen pull request: ${error.message}`, { cause: error });
48402
48404
  }
48403
48405
  }
48404
48406
  };
@@ -49644,6 +49646,691 @@ var TrackingService = class extends BaseService {
49644
49646
  }
49645
49647
  };
49646
49648
 
49649
+ // src/services/WaitlistService.js
49650
+ var WaitlistService = class extends BaseService {
49651
+ // ==================== WAITLIST METHODS ====================
49652
+ /**
49653
+ * Join a waitlist campaign (public).
49654
+ *
49655
+ * Mirrors: POST /waitlist (WaitlistController.join)
49656
+ */
49657
+ async joinWaitlist(data2 = {}) {
49658
+ this._requireReady("joinWaitlist");
49659
+ if (!data2 || typeof data2 !== "object") {
49660
+ throw new Error("Waitlist join payload is required");
49661
+ }
49662
+ if (!data2.email) {
49663
+ throw new Error("Email is required");
49664
+ }
49665
+ try {
49666
+ const response = await this._request("/waitlist", {
49667
+ method: "POST",
49668
+ body: JSON.stringify(data2),
49669
+ methodName: "joinWaitlist"
49670
+ });
49671
+ if (response.success) {
49672
+ return response.data;
49673
+ }
49674
+ throw new Error(response.message);
49675
+ } catch (error) {
49676
+ throw new Error(`Failed to join waitlist: ${error.message}`, { cause: error });
49677
+ }
49678
+ }
49679
+ /**
49680
+ * List waitlist entries (admin).
49681
+ *
49682
+ * Mirrors: GET /waitlist (WaitlistController.list)
49683
+ */
49684
+ async listWaitlistEntries(options = {}) {
49685
+ this._requireReady("listWaitlistEntries");
49686
+ const {
49687
+ campaignKey,
49688
+ status,
49689
+ search,
49690
+ page,
49691
+ limit
49692
+ } = options || {};
49693
+ const queryParams = new URLSearchParams();
49694
+ if (campaignKey != null) {
49695
+ queryParams.append("campaignKey", String(campaignKey));
49696
+ }
49697
+ if (status != null) {
49698
+ queryParams.append("status", String(status));
49699
+ }
49700
+ if (search != null) {
49701
+ queryParams.append("search", String(search));
49702
+ }
49703
+ if (page != null) {
49704
+ queryParams.append("page", String(page));
49705
+ }
49706
+ if (limit != null) {
49707
+ queryParams.append("limit", String(limit));
49708
+ }
49709
+ const queryString = queryParams.toString();
49710
+ const url2 = `/waitlist${queryString ? `?${queryString}` : ""}`;
49711
+ try {
49712
+ const response = await this._request(url2, {
49713
+ method: "GET",
49714
+ methodName: "listWaitlistEntries"
49715
+ });
49716
+ if (response.success) {
49717
+ return response.data;
49718
+ }
49719
+ throw new Error(response.message);
49720
+ } catch (error) {
49721
+ throw new Error(`Failed to list waitlist entries: ${error.message}`, { cause: error });
49722
+ }
49723
+ }
49724
+ /**
49725
+ * Update a waitlist entry (admin).
49726
+ *
49727
+ * Mirrors: PATCH /waitlist/:id (WaitlistController.update)
49728
+ */
49729
+ async updateWaitlistEntry(id2, update = {}) {
49730
+ this._requireReady("updateWaitlistEntry");
49731
+ if (!id2) {
49732
+ throw new Error("Waitlist entry ID is required");
49733
+ }
49734
+ if (!update || typeof update !== "object") {
49735
+ throw new Error("Update payload is required");
49736
+ }
49737
+ try {
49738
+ const response = await this._request(`/waitlist/${id2}`, {
49739
+ method: "PATCH",
49740
+ body: JSON.stringify(update),
49741
+ methodName: "updateWaitlistEntry"
49742
+ });
49743
+ if (response.success) {
49744
+ return response.data;
49745
+ }
49746
+ throw new Error(response.message);
49747
+ } catch (error) {
49748
+ throw new Error(`Failed to update waitlist entry: ${error.message}`, { cause: error });
49749
+ }
49750
+ }
49751
+ /**
49752
+ * Send an invitation email for a waitlist entry (admin).
49753
+ *
49754
+ * Mirrors: POST /waitlist/:id/invite (WaitlistController.invite)
49755
+ */
49756
+ async inviteWaitlistEntry(id2) {
49757
+ this._requireReady("inviteWaitlistEntry");
49758
+ if (!id2) {
49759
+ throw new Error("Waitlist entry ID is required");
49760
+ }
49761
+ try {
49762
+ const response = await this._request(`/waitlist/${id2}/invite`, {
49763
+ method: "POST",
49764
+ methodName: "inviteWaitlistEntry"
49765
+ });
49766
+ if (response.success) {
49767
+ return response.data;
49768
+ }
49769
+ throw new Error(response.message);
49770
+ } catch (error) {
49771
+ throw new Error(`Failed to invite waitlist entry: ${error.message}`, { cause: error });
49772
+ }
49773
+ }
49774
+ };
49775
+
49776
+ // src/services/MetricsService.js
49777
+ var MetricsService = class extends BaseService {
49778
+ // ==================== METRICS METHODS ====================
49779
+ /**
49780
+ * Contribution heat-map stats.
49781
+ *
49782
+ * Mirrors: GET /metrics/contributions (MetricsController.getContributions)
49783
+ */
49784
+ async getContributions(options = {}) {
49785
+ this._requireReady("getContributions");
49786
+ const { projectId, userId, from: from2, to } = options || {};
49787
+ const queryParams = new URLSearchParams();
49788
+ if (projectId != null) {
49789
+ queryParams.append("projectId", String(projectId));
49790
+ }
49791
+ if (userId != null) {
49792
+ queryParams.append("userId", String(userId));
49793
+ }
49794
+ if (from2 != null) {
49795
+ queryParams.append("from", String(from2));
49796
+ }
49797
+ if (to != null) {
49798
+ queryParams.append("to", String(to));
49799
+ }
49800
+ const queryString = queryParams.toString();
49801
+ const url2 = `/metrics/contributions${queryString ? `?${queryString}` : ""}`;
49802
+ try {
49803
+ const response = await this._request(url2, {
49804
+ method: "GET",
49805
+ methodName: "getContributions"
49806
+ });
49807
+ if (response.success) {
49808
+ return response.data;
49809
+ }
49810
+ throw new Error(response.message);
49811
+ } catch (error) {
49812
+ throw new Error(`Failed to get contribution stats: ${error.message}`, { cause: error });
49813
+ }
49814
+ }
49815
+ };
49816
+
49817
+ // src/services/IntegrationService.js
49818
+ var IntegrationService = class extends BaseService {
49819
+ // ==================== INTEGRATION METHODS ====================
49820
+ /**
49821
+ * Programmatic auth sanity check (API key based).
49822
+ *
49823
+ * Mirrors: GET /integrations/whoami (requireApiKey)
49824
+ *
49825
+ * Assumption: backend reads API key from `x-api-key` header.
49826
+ * You can override via `options.headers`.
49827
+ */
49828
+ async integrationWhoami(apiKey, options = {}) {
49829
+ this._requireReady("integrationWhoami");
49830
+ if (!apiKey) {
49831
+ throw new Error("API key is required");
49832
+ }
49833
+ const headers = {
49834
+ "x-api-key": apiKey,
49835
+ ...options.headers || {}
49836
+ };
49837
+ try {
49838
+ const response = await this._request("/integrations/whoami", {
49839
+ method: "GET",
49840
+ headers,
49841
+ methodName: "integrationWhoami"
49842
+ });
49843
+ if (response.success) {
49844
+ return response.data;
49845
+ }
49846
+ throw new Error(response.message);
49847
+ } catch (error) {
49848
+ throw new Error(`Failed to validate integration API key: ${error.message}`, { cause: error });
49849
+ }
49850
+ }
49851
+ /**
49852
+ * List integrations visible to the user.
49853
+ *
49854
+ * Mirrors: GET /integrations?orgId=&projectId=
49855
+ */
49856
+ async listIntegrations(options = {}) {
49857
+ this._requireReady("listIntegrations");
49858
+ const { orgId, projectId } = options || {};
49859
+ const queryParams = new URLSearchParams();
49860
+ if (orgId != null) {
49861
+ queryParams.append("orgId", String(orgId));
49862
+ }
49863
+ if (projectId != null) {
49864
+ queryParams.append("projectId", String(projectId));
49865
+ }
49866
+ const queryString = queryParams.toString();
49867
+ const url2 = `/integrations${queryString ? `?${queryString}` : ""}`;
49868
+ try {
49869
+ const response = await this._request(url2, {
49870
+ method: "GET",
49871
+ methodName: "listIntegrations"
49872
+ });
49873
+ if (response.success) {
49874
+ return response.data;
49875
+ }
49876
+ throw new Error(response.message);
49877
+ } catch (error) {
49878
+ throw new Error(`Failed to list integrations: ${error.message}`, { cause: error });
49879
+ }
49880
+ }
49881
+ /**
49882
+ * Create an integration.
49883
+ *
49884
+ * Mirrors: POST /integrations
49885
+ */
49886
+ async createIntegration(data2 = {}) {
49887
+ this._requireReady("createIntegration");
49888
+ if (!data2 || typeof data2 !== "object") {
49889
+ throw new Error("Integration payload is required");
49890
+ }
49891
+ if (!data2.name) {
49892
+ throw new Error("Integration name is required");
49893
+ }
49894
+ if (!data2.ownerType) {
49895
+ throw new Error("ownerType is required");
49896
+ }
49897
+ try {
49898
+ const response = await this._request("/integrations", {
49899
+ method: "POST",
49900
+ body: JSON.stringify(data2),
49901
+ methodName: "createIntegration"
49902
+ });
49903
+ if (response.success) {
49904
+ return response.data;
49905
+ }
49906
+ throw new Error(response.message);
49907
+ } catch (error) {
49908
+ throw new Error(`Failed to create integration: ${error.message}`, { cause: error });
49909
+ }
49910
+ }
49911
+ /**
49912
+ * Update an integration.
49913
+ *
49914
+ * Mirrors: PATCH /integrations/:integrationId
49915
+ */
49916
+ async updateIntegration(integrationId, update = {}) {
49917
+ this._requireReady("updateIntegration");
49918
+ if (!integrationId) {
49919
+ throw new Error("Integration ID is required");
49920
+ }
49921
+ if (!update || typeof update !== "object") {
49922
+ throw new Error("Update payload is required");
49923
+ }
49924
+ try {
49925
+ const response = await this._request(`/integrations/${integrationId}`, {
49926
+ method: "PATCH",
49927
+ body: JSON.stringify(update),
49928
+ methodName: "updateIntegration"
49929
+ });
49930
+ if (response.success) {
49931
+ return response.data;
49932
+ }
49933
+ throw new Error(response.message);
49934
+ } catch (error) {
49935
+ throw new Error(`Failed to update integration: ${error.message}`, { cause: error });
49936
+ }
49937
+ }
49938
+ // ==================== INTEGRATION API KEY METHODS ====================
49939
+ /**
49940
+ * Create a new API key for an integration.
49941
+ *
49942
+ * Mirrors: POST /integrations/:integrationId/api-keys
49943
+ */
49944
+ async createIntegrationApiKey(integrationId, data2 = {}) {
49945
+ this._requireReady("createIntegrationApiKey");
49946
+ if (!integrationId) {
49947
+ throw new Error("Integration ID is required");
49948
+ }
49949
+ if (!data2 || typeof data2 !== "object") {
49950
+ throw new Error("API key payload is required");
49951
+ }
49952
+ try {
49953
+ const response = await this._request(`/integrations/${integrationId}/api-keys`, {
49954
+ method: "POST",
49955
+ body: JSON.stringify(data2),
49956
+ methodName: "createIntegrationApiKey"
49957
+ });
49958
+ if (response.success) {
49959
+ return response.data;
49960
+ }
49961
+ throw new Error(response.message);
49962
+ } catch (error) {
49963
+ throw new Error(`Failed to create integration API key: ${error.message}`, { cause: error });
49964
+ }
49965
+ }
49966
+ /**
49967
+ * List API keys for an integration.
49968
+ *
49969
+ * Mirrors: GET /integrations/:integrationId/api-keys
49970
+ */
49971
+ async listIntegrationApiKeys(integrationId) {
49972
+ this._requireReady("listIntegrationApiKeys");
49973
+ if (!integrationId) {
49974
+ throw new Error("Integration ID is required");
49975
+ }
49976
+ try {
49977
+ const response = await this._request(`/integrations/${integrationId}/api-keys`, {
49978
+ method: "GET",
49979
+ methodName: "listIntegrationApiKeys"
49980
+ });
49981
+ if (response.success) {
49982
+ return response.data;
49983
+ }
49984
+ throw new Error(response.message);
49985
+ } catch (error) {
49986
+ throw new Error(`Failed to list integration API keys: ${error.message}`, { cause: error });
49987
+ }
49988
+ }
49989
+ /**
49990
+ * Revoke an API key for an integration.
49991
+ *
49992
+ * Mirrors: POST /integrations/:integrationId/api-keys/:keyId/revoke
49993
+ */
49994
+ async revokeIntegrationApiKey(integrationId, keyId) {
49995
+ this._requireReady("revokeIntegrationApiKey");
49996
+ if (!integrationId) {
49997
+ throw new Error("Integration ID is required");
49998
+ }
49999
+ if (!keyId) {
50000
+ throw new Error("API key ID is required");
50001
+ }
50002
+ try {
50003
+ const response = await this._request(
50004
+ `/integrations/${integrationId}/api-keys/${keyId}/revoke`,
50005
+ {
50006
+ method: "POST",
50007
+ methodName: "revokeIntegrationApiKey"
50008
+ }
50009
+ );
50010
+ if (response.success) {
50011
+ return response.data;
50012
+ }
50013
+ throw new Error(response.message);
50014
+ } catch (error) {
50015
+ throw new Error(`Failed to revoke integration API key: ${error.message}`, { cause: error });
50016
+ }
50017
+ }
50018
+ // ==================== WEBHOOK METHODS ====================
50019
+ /**
50020
+ * Create a webhook endpoint for an integration.
50021
+ *
50022
+ * Mirrors: POST /integrations/:integrationId/webhooks
50023
+ */
50024
+ async createIntegrationWebhook(integrationId, data2 = {}) {
50025
+ this._requireReady("createIntegrationWebhook");
50026
+ if (!integrationId) {
50027
+ throw new Error("Integration ID is required");
50028
+ }
50029
+ if (!data2 || typeof data2 !== "object") {
50030
+ throw new Error("Webhook payload is required");
50031
+ }
50032
+ try {
50033
+ const response = await this._request(`/integrations/${integrationId}/webhooks`, {
50034
+ method: "POST",
50035
+ body: JSON.stringify(data2),
50036
+ methodName: "createIntegrationWebhook"
50037
+ });
50038
+ if (response.success) {
50039
+ return response.data;
50040
+ }
50041
+ throw new Error(response.message);
50042
+ } catch (error) {
50043
+ throw new Error(`Failed to create integration webhook: ${error.message}`, { cause: error });
50044
+ }
50045
+ }
50046
+ /**
50047
+ * List webhook endpoints for an integration.
50048
+ *
50049
+ * Mirrors: GET /integrations/:integrationId/webhooks
50050
+ */
50051
+ async listIntegrationWebhooks(integrationId) {
50052
+ this._requireReady("listIntegrationWebhooks");
50053
+ if (!integrationId) {
50054
+ throw new Error("Integration ID is required");
50055
+ }
50056
+ try {
50057
+ const response = await this._request(`/integrations/${integrationId}/webhooks`, {
50058
+ method: "GET",
50059
+ methodName: "listIntegrationWebhooks"
50060
+ });
50061
+ if (response.success) {
50062
+ return response.data;
50063
+ }
50064
+ throw new Error(response.message);
50065
+ } catch (error) {
50066
+ throw new Error(`Failed to list integration webhooks: ${error.message}`, { cause: error });
50067
+ }
50068
+ }
50069
+ /**
50070
+ * Update a webhook endpoint for an integration.
50071
+ *
50072
+ * Mirrors: PATCH /integrations/:integrationId/webhooks/:webhookId
50073
+ */
50074
+ async updateIntegrationWebhook(integrationId, webhookId, update = {}) {
50075
+ this._requireReady("updateIntegrationWebhook");
50076
+ if (!integrationId) {
50077
+ throw new Error("Integration ID is required");
50078
+ }
50079
+ if (!webhookId) {
50080
+ throw new Error("Webhook ID is required");
50081
+ }
50082
+ if (!update || typeof update !== "object") {
50083
+ throw new Error("Update payload is required");
50084
+ }
50085
+ try {
50086
+ const response = await this._request(
50087
+ `/integrations/${integrationId}/webhooks/${webhookId}`,
50088
+ {
50089
+ method: "PATCH",
50090
+ body: JSON.stringify(update),
50091
+ methodName: "updateIntegrationWebhook"
50092
+ }
50093
+ );
50094
+ if (response.success) {
50095
+ return response.data;
50096
+ }
50097
+ throw new Error(response.message);
50098
+ } catch (error) {
50099
+ throw new Error(`Failed to update integration webhook: ${error.message}`, { cause: error });
50100
+ }
50101
+ }
50102
+ /**
50103
+ * Delete a webhook endpoint for an integration.
50104
+ *
50105
+ * Mirrors: DELETE /integrations/:integrationId/webhooks/:webhookId
50106
+ */
50107
+ async deleteIntegrationWebhook(integrationId, webhookId) {
50108
+ this._requireReady("deleteIntegrationWebhook");
50109
+ if (!integrationId) {
50110
+ throw new Error("Integration ID is required");
50111
+ }
50112
+ if (!webhookId) {
50113
+ throw new Error("Webhook ID is required");
50114
+ }
50115
+ try {
50116
+ const response = await this._request(
50117
+ `/integrations/${integrationId}/webhooks/${webhookId}`,
50118
+ {
50119
+ method: "DELETE",
50120
+ methodName: "deleteIntegrationWebhook"
50121
+ }
50122
+ );
50123
+ if (response && response.success) {
50124
+ return response.data;
50125
+ }
50126
+ if (response == null) {
50127
+ return null;
50128
+ }
50129
+ throw new Error(response.message);
50130
+ } catch (error) {
50131
+ throw new Error(`Failed to delete integration webhook: ${error.message}`, { cause: error });
50132
+ }
50133
+ }
50134
+ /**
50135
+ * List webhook deliveries for an integration webhook.
50136
+ *
50137
+ * Mirrors: GET /integrations/:integrationId/webhooks/:webhookId/deliveries
50138
+ */
50139
+ async listIntegrationWebhookDeliveries(integrationId, webhookId, options = {}) {
50140
+ this._requireReady("listIntegrationWebhookDeliveries");
50141
+ if (!integrationId) {
50142
+ throw new Error("Integration ID is required");
50143
+ }
50144
+ if (!webhookId) {
50145
+ throw new Error("Webhook ID is required");
50146
+ }
50147
+ const { page, limit, status, includePayload } = options || {};
50148
+ const queryParams = new URLSearchParams();
50149
+ if (page != null) {
50150
+ queryParams.append("page", String(page));
50151
+ }
50152
+ if (limit != null) {
50153
+ queryParams.append("limit", String(limit));
50154
+ }
50155
+ if (status != null) {
50156
+ queryParams.append("status", String(status));
50157
+ }
50158
+ if (includePayload != null) {
50159
+ queryParams.append("includePayload", String(includePayload));
50160
+ }
50161
+ const queryString = queryParams.toString();
50162
+ const url2 = `/integrations/${integrationId}/webhooks/${webhookId}/deliveries${queryString ? `?${queryString}` : ""}`;
50163
+ try {
50164
+ const response = await this._request(url2, {
50165
+ method: "GET",
50166
+ methodName: "listIntegrationWebhookDeliveries"
50167
+ });
50168
+ if (response.success) {
50169
+ return response.data;
50170
+ }
50171
+ throw new Error(response.message);
50172
+ } catch (error) {
50173
+ throw new Error(`Failed to list webhook deliveries: ${error.message}`, { cause: error });
50174
+ }
50175
+ }
50176
+ /**
50177
+ * Replay a webhook delivery.
50178
+ *
50179
+ * Mirrors: POST /integrations/:integrationId/webhooks/:webhookId/replay
50180
+ * Body: { deliveryId }
50181
+ */
50182
+ async replayIntegrationWebhookDelivery(integrationId, webhookId, deliveryId) {
50183
+ this._requireReady("replayIntegrationWebhookDelivery");
50184
+ if (!integrationId) {
50185
+ throw new Error("Integration ID is required");
50186
+ }
50187
+ if (!webhookId) {
50188
+ throw new Error("Webhook ID is required");
50189
+ }
50190
+ if (!deliveryId) {
50191
+ throw new Error("deliveryId is required");
50192
+ }
50193
+ try {
50194
+ const response = await this._request(
50195
+ `/integrations/${integrationId}/webhooks/${webhookId}/replay`,
50196
+ {
50197
+ method: "POST",
50198
+ body: JSON.stringify({ deliveryId }),
50199
+ methodName: "replayIntegrationWebhookDelivery"
50200
+ }
50201
+ );
50202
+ if (response.success) {
50203
+ return response.data;
50204
+ }
50205
+ throw new Error(response.message);
50206
+ } catch (error) {
50207
+ throw new Error(`Failed to replay webhook delivery: ${error.message}`, { cause: error });
50208
+ }
50209
+ }
50210
+ // ==================== CONNECTOR METHODS (GITHUB) ====================
50211
+ /**
50212
+ * List GitHub connectors for an integration.
50213
+ *
50214
+ * Mirrors: GET /integrations/:integrationId/connectors/github
50215
+ */
50216
+ async listGitHubConnectors(integrationId) {
50217
+ this._requireReady("listGitHubConnectors");
50218
+ if (!integrationId) {
50219
+ throw new Error("Integration ID is required");
50220
+ }
50221
+ try {
50222
+ const response = await this._request(`/integrations/${integrationId}/connectors/github`, {
50223
+ method: "GET",
50224
+ methodName: "listGitHubConnectors"
50225
+ });
50226
+ if (response.success) {
50227
+ return response.data;
50228
+ }
50229
+ throw new Error(response.message);
50230
+ } catch (error) {
50231
+ throw new Error(`Failed to list GitHub connectors: ${error.message}`, { cause: error });
50232
+ }
50233
+ }
50234
+ /**
50235
+ * Create a GitHub connector for an integration.
50236
+ *
50237
+ * Mirrors: POST /integrations/:integrationId/connectors/github
50238
+ */
50239
+ async createGitHubConnector(integrationId, data2 = {}) {
50240
+ this._requireReady("createGitHubConnector");
50241
+ if (!integrationId) {
50242
+ throw new Error("Integration ID is required");
50243
+ }
50244
+ if (!data2 || typeof data2 !== "object") {
50245
+ throw new Error("Connector payload is required");
50246
+ }
50247
+ if (!data2.projectId) {
50248
+ throw new Error("projectId is required");
50249
+ }
50250
+ if (!data2.repository) {
50251
+ throw new Error("repository is required");
50252
+ }
50253
+ try {
50254
+ const response = await this._request(`/integrations/${integrationId}/connectors/github`, {
50255
+ method: "POST",
50256
+ body: JSON.stringify(data2),
50257
+ methodName: "createGitHubConnector"
50258
+ });
50259
+ if (response.success) {
50260
+ return response.data;
50261
+ }
50262
+ throw new Error(response.message);
50263
+ } catch (error) {
50264
+ throw new Error(`Failed to create GitHub connector: ${error.message}`, { cause: error });
50265
+ }
50266
+ }
50267
+ /**
50268
+ * Update a GitHub connector.
50269
+ *
50270
+ * Mirrors: PATCH /integrations/:integrationId/connectors/github/:connectorId
50271
+ */
50272
+ async updateGitHubConnector(integrationId, connectorId, update = {}) {
50273
+ this._requireReady("updateGitHubConnector");
50274
+ if (!integrationId) {
50275
+ throw new Error("Integration ID is required");
50276
+ }
50277
+ if (!connectorId) {
50278
+ throw new Error("Connector ID is required");
50279
+ }
50280
+ if (!update || typeof update !== "object") {
50281
+ throw new Error("Update payload is required");
50282
+ }
50283
+ try {
50284
+ const response = await this._request(
50285
+ `/integrations/${integrationId}/connectors/github/${connectorId}`,
50286
+ {
50287
+ method: "PATCH",
50288
+ body: JSON.stringify(update),
50289
+ methodName: "updateGitHubConnector"
50290
+ }
50291
+ );
50292
+ if (response.success) {
50293
+ return response.data;
50294
+ }
50295
+ throw new Error(response.message);
50296
+ } catch (error) {
50297
+ throw new Error(`Failed to update GitHub connector: ${error.message}`, { cause: error });
50298
+ }
50299
+ }
50300
+ /**
50301
+ * Delete a GitHub connector.
50302
+ *
50303
+ * Mirrors: DELETE /integrations/:integrationId/connectors/github/:connectorId
50304
+ */
50305
+ async deleteGitHubConnector(integrationId, connectorId) {
50306
+ this._requireReady("deleteGitHubConnector");
50307
+ if (!integrationId) {
50308
+ throw new Error("Integration ID is required");
50309
+ }
50310
+ if (!connectorId) {
50311
+ throw new Error("Connector ID is required");
50312
+ }
50313
+ try {
50314
+ const response = await this._request(
50315
+ `/integrations/${integrationId}/connectors/github/${connectorId}`,
50316
+ {
50317
+ method: "DELETE",
50318
+ methodName: "deleteGitHubConnector"
50319
+ }
50320
+ );
50321
+ if (response && response.success) {
50322
+ return response.data;
50323
+ }
50324
+ if (response == null) {
50325
+ return null;
50326
+ }
50327
+ throw new Error(response.message);
50328
+ } catch (error) {
50329
+ throw new Error(`Failed to delete GitHub connector: ${error.message}`, { cause: error });
50330
+ }
50331
+ }
50332
+ };
50333
+
49647
50334
  // src/services/index.js
49648
50335
  var createService = (ServiceClass, config) => new ServiceClass(config);
49649
50336
  var createAuthService = (config) => createService(AuthService, config);
@@ -49659,6 +50346,9 @@ var createPullRequestService = (config) => createService(PullRequestService, con
49659
50346
  var createAdminService = (config) => createService(AdminService, config);
49660
50347
  var createScreenshotService = (config) => createService(ScreenshotService, config);
49661
50348
  var createTrackingService = (config) => createService(TrackingService, config);
50349
+ var createWaitlistService = (config) => createService(WaitlistService, config);
50350
+ var createMetricsService = (config) => createService(MetricsService, config);
50351
+ var createIntegrationService = (config) => createService(IntegrationService, config);
49662
50352
 
49663
50353
  // src/utils/services.js
49664
50354
  var SERVICE_METHODS = {
@@ -49935,7 +50625,32 @@ var SERVICE_METHODS = {
49935
50625
  flushQueue: "tracking",
49936
50626
  getClient: "tracking",
49937
50627
  isEnabled: "tracking",
49938
- isInitialized: "tracking"
50628
+ isInitialized: "tracking",
50629
+ // Waitlist methods
50630
+ joinWaitlist: "waitlist",
50631
+ listWaitlistEntries: "waitlist",
50632
+ updateWaitlistEntry: "waitlist",
50633
+ inviteWaitlistEntry: "waitlist",
50634
+ // Metrics methods
50635
+ getContributions: "metrics",
50636
+ // Integration methods
50637
+ integrationWhoami: "integration",
50638
+ listIntegrations: "integration",
50639
+ createIntegration: "integration",
50640
+ updateIntegration: "integration",
50641
+ createIntegrationApiKey: "integration",
50642
+ listIntegrationApiKeys: "integration",
50643
+ revokeIntegrationApiKey: "integration",
50644
+ createIntegrationWebhook: "integration",
50645
+ listIntegrationWebhooks: "integration",
50646
+ updateIntegrationWebhook: "integration",
50647
+ deleteIntegrationWebhook: "integration",
50648
+ listIntegrationWebhookDeliveries: "integration",
50649
+ replayIntegrationWebhookDelivery: "integration",
50650
+ listGitHubConnectors: "integration",
50651
+ createGitHubConnector: "integration",
50652
+ updateGitHubConnector: "integration",
50653
+ deleteGitHubConnector: "integration"
49939
50654
  };
49940
50655
 
49941
50656
  // src/index.js
@@ -50054,6 +50769,27 @@ var SDK = class {
50054
50769
  context: this._context,
50055
50770
  options: this._options
50056
50771
  })
50772
+ ),
50773
+ this._initService(
50774
+ "waitlist",
50775
+ createWaitlistService({
50776
+ context: this._context,
50777
+ options: this._options
50778
+ })
50779
+ ),
50780
+ this._initService(
50781
+ "metrics",
50782
+ createMetricsService({
50783
+ context: this._context,
50784
+ options: this._options
50785
+ })
50786
+ ),
50787
+ this._initService(
50788
+ "integration",
50789
+ createIntegrationService({
50790
+ context: this._context,
50791
+ options: this._options
50792
+ })
50057
50793
  )
50058
50794
  ]);
50059
50795
  return this;
@@ -50178,12 +50914,15 @@ export {
50178
50914
  createCollabService,
50179
50915
  createDnsService,
50180
50916
  createFileService,
50917
+ createIntegrationService,
50918
+ createMetricsService,
50181
50919
  createPaymentService,
50182
50920
  createPlanService,
50183
50921
  createProjectService,
50184
50922
  createPullRequestService,
50185
50923
  createSubscriptionService,
50186
50924
  createTrackingService,
50925
+ createWaitlistService,
50187
50926
  index_default as default,
50188
50927
  environment_default as environment,
50189
50928
  isLocalhost