@commet/node 5.0.0 → 5.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.
package/dist/index.js CHANGED
@@ -426,6 +426,57 @@ var PromoCodesResource = class {
426
426
  }
427
427
  };
428
428
 
429
+ // src/resources/quota.ts
430
+ var QuotaResource = class {
431
+ constructor(httpClient) {
432
+ this.httpClient = httpClient;
433
+ }
434
+ async add(params, options) {
435
+ return this.httpClient.post(
436
+ "/usage/quota",
437
+ {
438
+ customerId: params.customerId,
439
+ featureCode: params.featureCode,
440
+ count: params.count ?? 1
441
+ },
442
+ options
443
+ );
444
+ }
445
+ async set(params, options) {
446
+ return this.httpClient.put(
447
+ "/usage/quota",
448
+ {
449
+ customerId: params.customerId,
450
+ featureCode: params.featureCode,
451
+ count: params.count
452
+ },
453
+ options
454
+ );
455
+ }
456
+ async remove(params, options) {
457
+ return this.httpClient.delete(
458
+ "/usage/quota",
459
+ {
460
+ customerId: params.customerId,
461
+ featureCode: params.featureCode,
462
+ count: params.count ?? 1
463
+ },
464
+ options
465
+ );
466
+ }
467
+ async get(params) {
468
+ return this.httpClient.get("/usage/quota", {
469
+ customerId: params.customerId,
470
+ featureCode: params.featureCode
471
+ });
472
+ }
473
+ async getAll(params) {
474
+ return this.httpClient.get("/usage/quota/all", {
475
+ customerId: params.customerId
476
+ });
477
+ }
478
+ };
479
+
429
480
  // src/resources/seats.ts
430
481
  var SeatsResource = class {
431
482
  constructor(httpClient) {
@@ -675,10 +726,17 @@ var Webhooks = class {
675
726
  async list(params, options) {
676
727
  return this.httpClient.get("/webhooks", params, options);
677
728
  }
678
- /** Response includes `secretKey` which is only returned once. */
679
729
  async create(params, options) {
680
730
  return this.httpClient.post("/webhooks", params, options);
681
731
  }
732
+ async get(params, options) {
733
+ const { id } = params;
734
+ return this.httpClient.get(`/webhooks/${id}`, void 0, options);
735
+ }
736
+ async update(params, options) {
737
+ const { id, ...body } = params;
738
+ return this.httpClient.put(`/webhooks/${id}`, body, options);
739
+ }
682
740
  async delete(params, options) {
683
741
  const { id } = params;
684
742
  return this.httpClient.delete(`/webhooks/${id}`, void 0, options);
@@ -721,7 +779,7 @@ var CommetValidationError = class extends CommetError {
721
779
 
722
780
  // src/version.ts
723
781
  var API_VERSION = "2026-05-25";
724
- var SDK_VERSION = "5.0.0";
782
+ var SDK_VERSION = "5.2.0";
725
783
 
726
784
  // src/utils/telemetry.ts
727
785
  var registeredIntegrations = /* @__PURE__ */ new Set();
@@ -737,21 +795,41 @@ function detectRuntime() {
737
795
  if (deno) return { name: "deno", version: deno.version.deno };
738
796
  return { name: "node", version: process.versions.node };
739
797
  }
798
+ function detectExecutionContext() {
799
+ const g = globalThis;
800
+ if (g.__vitest_worker__ !== void 0 || g.jest !== void 0) {
801
+ return "test";
802
+ }
803
+ if (typeof process === "undefined" || !process.env) return void 0;
804
+ const env = process.env;
805
+ if (env.VITEST || env.JEST_WORKER_ID || env.BUN_TEST || env.NODE_ENV === "test" || env.npm_lifecycle_event === "test") {
806
+ return "test";
807
+ }
808
+ if (env.CI || env.GITHUB_ACTIONS || env.GITLAB_CI || env.CIRCLECI) {
809
+ return "ci";
810
+ }
811
+ return void 0;
812
+ }
740
813
  var cachedClientInfo = null;
741
814
  var cachedUserAgent = null;
742
815
  function collectClientInfo() {
743
816
  const runtime = detectRuntime();
744
- return {
817
+ const executionContext = detectExecutionContext();
818
+ const info = {
745
819
  sdk: "commet-node",
746
- sdkVersion: SDK_VERSION,
820
+ sdk_version: SDK_VERSION,
747
821
  lang: "node",
748
- langVersion: process.versions.node,
822
+ lang_version: process.versions.node,
749
823
  platform: process.platform,
750
824
  arch: process.arch,
751
825
  runtime: runtime.name,
752
- runtimeVersion: runtime.version,
826
+ runtime_version: runtime.version,
753
827
  integrations: [...registeredIntegrations]
754
828
  };
829
+ if (executionContext) {
830
+ info.execution_context = executionContext;
831
+ }
832
+ return info;
755
833
  }
756
834
  function getClientInfoHeader() {
757
835
  if (!cachedClientInfo) {
@@ -1030,6 +1108,7 @@ var Commet = class {
1030
1108
  this.plans = new PlansResource(this.httpClient);
1031
1109
  this.portal = new PortalResource(this.httpClient);
1032
1110
  this.promoCodes = new PromoCodesResource(this.httpClient);
1111
+ this.quota = new QuotaResource(this.httpClient);
1033
1112
  this.seats = new SeatsResource(this.httpClient);
1034
1113
  this.subscriptions = new SubscriptionsResource(this.httpClient);
1035
1114
  this.transactions = new TransactionsResource(this.httpClient);