@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/README.md +16 -3
- package/dist/index.d.mts +414 -345
- package/dist/index.d.ts +414 -345
- package/dist/index.js +85 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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) {
|
|
@@ -629,10 +680,17 @@ var Webhooks = class {
|
|
|
629
680
|
async list(params, options) {
|
|
630
681
|
return this.httpClient.get("/webhooks", params, options);
|
|
631
682
|
}
|
|
632
|
-
/** Response includes `secretKey` which is only returned once. */
|
|
633
683
|
async create(params, options) {
|
|
634
684
|
return this.httpClient.post("/webhooks", params, options);
|
|
635
685
|
}
|
|
686
|
+
async get(params, options) {
|
|
687
|
+
const { id } = params;
|
|
688
|
+
return this.httpClient.get(`/webhooks/${id}`, void 0, options);
|
|
689
|
+
}
|
|
690
|
+
async update(params, options) {
|
|
691
|
+
const { id, ...body } = params;
|
|
692
|
+
return this.httpClient.put(`/webhooks/${id}`, body, options);
|
|
693
|
+
}
|
|
636
694
|
async delete(params, options) {
|
|
637
695
|
const { id } = params;
|
|
638
696
|
return this.httpClient.delete(`/webhooks/${id}`, void 0, options);
|
|
@@ -675,7 +733,7 @@ var CommetValidationError = class extends CommetError {
|
|
|
675
733
|
|
|
676
734
|
// src/version.ts
|
|
677
735
|
var API_VERSION = "2026-05-25";
|
|
678
|
-
var SDK_VERSION = "5.
|
|
736
|
+
var SDK_VERSION = "5.2.0";
|
|
679
737
|
|
|
680
738
|
// src/utils/telemetry.ts
|
|
681
739
|
var registeredIntegrations = /* @__PURE__ */ new Set();
|
|
@@ -691,21 +749,41 @@ function detectRuntime() {
|
|
|
691
749
|
if (deno) return { name: "deno", version: deno.version.deno };
|
|
692
750
|
return { name: "node", version: process.versions.node };
|
|
693
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
|
+
}
|
|
694
767
|
var cachedClientInfo = null;
|
|
695
768
|
var cachedUserAgent = null;
|
|
696
769
|
function collectClientInfo() {
|
|
697
770
|
const runtime = detectRuntime();
|
|
698
|
-
|
|
771
|
+
const executionContext = detectExecutionContext();
|
|
772
|
+
const info = {
|
|
699
773
|
sdk: "commet-node",
|
|
700
|
-
|
|
774
|
+
sdk_version: SDK_VERSION,
|
|
701
775
|
lang: "node",
|
|
702
|
-
|
|
776
|
+
lang_version: process.versions.node,
|
|
703
777
|
platform: process.platform,
|
|
704
778
|
arch: process.arch,
|
|
705
779
|
runtime: runtime.name,
|
|
706
|
-
|
|
780
|
+
runtime_version: runtime.version,
|
|
707
781
|
integrations: [...registeredIntegrations]
|
|
708
782
|
};
|
|
783
|
+
if (executionContext) {
|
|
784
|
+
info.execution_context = executionContext;
|
|
785
|
+
}
|
|
786
|
+
return info;
|
|
709
787
|
}
|
|
710
788
|
function getClientInfoHeader() {
|
|
711
789
|
if (!cachedClientInfo) {
|
|
@@ -984,6 +1062,7 @@ var Commet = class {
|
|
|
984
1062
|
this.plans = new PlansResource(this.httpClient);
|
|
985
1063
|
this.portal = new PortalResource(this.httpClient);
|
|
986
1064
|
this.promoCodes = new PromoCodesResource(this.httpClient);
|
|
1065
|
+
this.quota = new QuotaResource(this.httpClient);
|
|
987
1066
|
this.seats = new SeatsResource(this.httpClient);
|
|
988
1067
|
this.subscriptions = new SubscriptionsResource(this.httpClient);
|
|
989
1068
|
this.transactions = new TransactionsResource(this.httpClient);
|