@commet/node 5.1.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 +13 -0
- package/dist/index.d.mts +315 -262
- package/dist/index.d.ts +315 -262
- package/dist/index.js +77 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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) {
|
|
@@ -728,7 +779,7 @@ var CommetValidationError = class extends CommetError {
|
|
|
728
779
|
|
|
729
780
|
// src/version.ts
|
|
730
781
|
var API_VERSION = "2026-05-25";
|
|
731
|
-
var SDK_VERSION = "5.
|
|
782
|
+
var SDK_VERSION = "5.2.0";
|
|
732
783
|
|
|
733
784
|
// src/utils/telemetry.ts
|
|
734
785
|
var registeredIntegrations = /* @__PURE__ */ new Set();
|
|
@@ -744,21 +795,41 @@ function detectRuntime() {
|
|
|
744
795
|
if (deno) return { name: "deno", version: deno.version.deno };
|
|
745
796
|
return { name: "node", version: process.versions.node };
|
|
746
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
|
+
}
|
|
747
813
|
var cachedClientInfo = null;
|
|
748
814
|
var cachedUserAgent = null;
|
|
749
815
|
function collectClientInfo() {
|
|
750
816
|
const runtime = detectRuntime();
|
|
751
|
-
|
|
817
|
+
const executionContext = detectExecutionContext();
|
|
818
|
+
const info = {
|
|
752
819
|
sdk: "commet-node",
|
|
753
|
-
|
|
820
|
+
sdk_version: SDK_VERSION,
|
|
754
821
|
lang: "node",
|
|
755
|
-
|
|
822
|
+
lang_version: process.versions.node,
|
|
756
823
|
platform: process.platform,
|
|
757
824
|
arch: process.arch,
|
|
758
825
|
runtime: runtime.name,
|
|
759
|
-
|
|
826
|
+
runtime_version: runtime.version,
|
|
760
827
|
integrations: [...registeredIntegrations]
|
|
761
828
|
};
|
|
829
|
+
if (executionContext) {
|
|
830
|
+
info.execution_context = executionContext;
|
|
831
|
+
}
|
|
832
|
+
return info;
|
|
762
833
|
}
|
|
763
834
|
function getClientInfoHeader() {
|
|
764
835
|
if (!cachedClientInfo) {
|
|
@@ -1037,6 +1108,7 @@ var Commet = class {
|
|
|
1037
1108
|
this.plans = new PlansResource(this.httpClient);
|
|
1038
1109
|
this.portal = new PortalResource(this.httpClient);
|
|
1039
1110
|
this.promoCodes = new PromoCodesResource(this.httpClient);
|
|
1111
|
+
this.quota = new QuotaResource(this.httpClient);
|
|
1040
1112
|
this.seats = new SeatsResource(this.httpClient);
|
|
1041
1113
|
this.subscriptions = new SubscriptionsResource(this.httpClient);
|
|
1042
1114
|
this.transactions = new TransactionsResource(this.httpClient);
|