@commet/node 5.1.0 → 5.3.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.mjs CHANGED
@@ -380,6 +380,57 @@ var PromoCodesResource = class {
380
380
  }
381
381
  };
382
382
 
383
+ // src/resources/quota.ts
384
+ var QuotaResource = class {
385
+ constructor(httpClient) {
386
+ this.httpClient = httpClient;
387
+ }
388
+ async add(params, options) {
389
+ return this.httpClient.post(
390
+ "/usage/quota",
391
+ {
392
+ customerId: params.customerId,
393
+ featureCode: params.featureCode,
394
+ count: params.count ?? 1
395
+ },
396
+ options
397
+ );
398
+ }
399
+ async set(params, options) {
400
+ return this.httpClient.put(
401
+ "/usage/quota",
402
+ {
403
+ customerId: params.customerId,
404
+ featureCode: params.featureCode,
405
+ count: params.count
406
+ },
407
+ options
408
+ );
409
+ }
410
+ async remove(params, options) {
411
+ return this.httpClient.delete(
412
+ "/usage/quota",
413
+ {
414
+ customerId: params.customerId,
415
+ featureCode: params.featureCode,
416
+ count: params.count ?? 1
417
+ },
418
+ options
419
+ );
420
+ }
421
+ async get(params) {
422
+ return this.httpClient.get("/usage/quota", {
423
+ customerId: params.customerId,
424
+ featureCode: params.featureCode
425
+ });
426
+ }
427
+ async getAll(params) {
428
+ return this.httpClient.get("/usage/quota/all", {
429
+ customerId: params.customerId
430
+ });
431
+ }
432
+ };
433
+
383
434
  // src/resources/seats.ts
384
435
  var SeatsResource = class {
385
436
  constructor(httpClient) {
@@ -682,7 +733,7 @@ var CommetValidationError = class extends CommetError {
682
733
 
683
734
  // src/version.ts
684
735
  var API_VERSION = "2026-05-25";
685
- var SDK_VERSION = "5.1.0";
736
+ var SDK_VERSION = "5.3.0";
686
737
 
687
738
  // src/utils/telemetry.ts
688
739
  var registeredIntegrations = /* @__PURE__ */ new Set();
@@ -698,21 +749,41 @@ function detectRuntime() {
698
749
  if (deno) return { name: "deno", version: deno.version.deno };
699
750
  return { name: "node", version: process.versions.node };
700
751
  }
752
+ function detectExecutionContext() {
753
+ const g = globalThis;
754
+ if (g.__vitest_worker__ !== void 0 || g.jest !== void 0) {
755
+ return "test";
756
+ }
757
+ if (typeof process === "undefined" || !process.env) return void 0;
758
+ const env = process.env;
759
+ if (env.VITEST || env.JEST_WORKER_ID || env.BUN_TEST || env.NODE_ENV === "test" || env.npm_lifecycle_event === "test") {
760
+ return "test";
761
+ }
762
+ if (env.CI || env.GITHUB_ACTIONS || env.GITLAB_CI || env.CIRCLECI) {
763
+ return "ci";
764
+ }
765
+ return void 0;
766
+ }
701
767
  var cachedClientInfo = null;
702
768
  var cachedUserAgent = null;
703
769
  function collectClientInfo() {
704
770
  const runtime = detectRuntime();
705
- return {
771
+ const executionContext = detectExecutionContext();
772
+ const info = {
706
773
  sdk: "commet-node",
707
- sdkVersion: SDK_VERSION,
774
+ sdk_version: SDK_VERSION,
708
775
  lang: "node",
709
- langVersion: process.versions.node,
776
+ lang_version: process.versions.node,
710
777
  platform: process.platform,
711
778
  arch: process.arch,
712
779
  runtime: runtime.name,
713
- runtimeVersion: runtime.version,
780
+ runtime_version: runtime.version,
714
781
  integrations: [...registeredIntegrations]
715
782
  };
783
+ if (executionContext) {
784
+ info.execution_context = executionContext;
785
+ }
786
+ return info;
716
787
  }
717
788
  function getClientInfoHeader() {
718
789
  if (!cachedClientInfo) {
@@ -991,6 +1062,7 @@ var Commet = class {
991
1062
  this.plans = new PlansResource(this.httpClient);
992
1063
  this.portal = new PortalResource(this.httpClient);
993
1064
  this.promoCodes = new PromoCodesResource(this.httpClient);
1065
+ this.quota = new QuotaResource(this.httpClient);
994
1066
  this.seats = new SeatsResource(this.httpClient);
995
1067
  this.subscriptions = new SubscriptionsResource(this.httpClient);
996
1068
  this.transactions = new TransactionsResource(this.httpClient);