commet 2.2.9 → 3.0.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.
Files changed (3) hide show
  1. package/README.md +9 -7
  2. package/dist/index.js +443 -115
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -46,12 +46,12 @@ const commet = new Commet({ apiKey: '...' });
46
46
 
47
47
  await commet.usage.track({
48
48
  feature: 'api_calls', // Autocomplete works!
49
- externalId: 'user_123'
49
+ customerId: 'cus_123'
50
50
  });
51
51
 
52
52
  await commet.subscriptions.create({
53
53
  planCode: 'pro', // Autocomplete with your plans!
54
- externalId: 'user_123'
54
+ customerId: 'cus_123'
55
55
  });
56
56
  ```
57
57
 
@@ -61,11 +61,13 @@ await commet.subscriptions.create({
61
61
  commet login # Authenticate with Commet
62
62
  commet logout # Remove credentials
63
63
  commet link # Link project to organization
64
- commet pull # Generate TypeScript types
65
- commet info # Show project status
66
- commet list features # List features
67
- commet list seats # List seat types
68
- commet list plans # List plans
64
+ commet orgs # List your organizations
65
+ commet pull # Fetch billing config and generate commet.config.ts
66
+ commet push # Push commet.config.ts to Commet
67
+ commet listen <url> # Forward webhook events to your local server
68
+ commet features list # List the feature catalog
69
+ commet plans list # List plans
70
+ commet customers list # List customers
69
71
  ```
70
72
 
71
73
  ## Documentation
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ var import_commander11 = require("commander");
30
30
  // package.json
31
31
  var package_default = {
32
32
  name: "commet",
33
- version: "2.2.9",
33
+ version: "3.0.0",
34
34
  description: "Commet CLI - Manage your billing platform from the command line",
35
35
  bin: {
36
36
  commet: "./bin/commet"
@@ -163,7 +163,7 @@ function clearProjectConfig() {
163
163
  }
164
164
 
165
165
  // src/utils/telemetry.ts
166
- var CLI_VERSION = true ? "2.2.9" : "0.0.0";
166
+ var CLI_VERSION = true ? "3.0.0" : "0.0.0";
167
167
  var TELEMETRY_URL = "https://commet.co/api/cli/telemetry";
168
168
  function detectRuntime() {
169
169
  if ("Bun" in globalThis) {
@@ -1703,7 +1703,8 @@ function computeDiff(config, remote) {
1703
1703
  if (remotePlan.name !== localPlan.name) {
1704
1704
  changes.push(`name: "${remotePlan.name}" \u2192 "${localPlan.name}"`);
1705
1705
  }
1706
- const remoteDefaultInterval = remotePlan.defaultInterval ?? remotePlan.prices.find((p) => p.isDefault)?.billingInterval ?? null;
1706
+ const remotePrices = remotePlan.prices ?? [];
1707
+ const remoteDefaultInterval = remotePrices.find((p) => p.isDefault)?.billingInterval ?? null;
1707
1708
  if (localPlan.defaultInterval && remoteDefaultInterval !== localPlan.defaultInterval) {
1708
1709
  changes.push(
1709
1710
  `defaultInterval: "${remoteDefaultInterval ?? "none"}" \u2192 "${localPlan.defaultInterval}"`
@@ -1711,7 +1712,7 @@ function computeDiff(config, remote) {
1711
1712
  }
1712
1713
  const localPriceMap = new Map(localPlan.prices.map((p) => [p.interval, p]));
1713
1714
  const remotePriceMap = new Map(
1714
- remotePlan.prices.map((p) => [p.billingInterval, p])
1715
+ remotePrices.map((p) => [p.billingInterval, p])
1715
1716
  );
1716
1717
  for (const [interval, localPrice] of localPriceMap) {
1717
1718
  const remotePrice = remotePriceMap.get(interval);
@@ -1727,7 +1728,7 @@ function computeDiff(config, remote) {
1727
1728
  }
1728
1729
  if (localPlan.features) {
1729
1730
  const remotePlanFeatureMap = new Map(
1730
- remotePlan.features.map((f) => [f.featureCode, f])
1731
+ (remotePlan.features ?? []).map((f) => [f.code, f])
1731
1732
  );
1732
1733
  for (const featureCode of Object.keys(localPlan.features)) {
1733
1734
  if (!remotePlanFeatureMap.has(featureCode)) {
@@ -1818,7 +1819,7 @@ function generateConfigFile(features, plans) {
1818
1819
  if (p.sortOrder != null && p.sortOrder !== 0)
1819
1820
  lines.push(` sortOrder: ${p.sortOrder},`);
1820
1821
  const prices = p.prices ?? [];
1821
- const defaultInterval = p.defaultInterval ?? prices.find((pr) => pr.isDefault)?.billingInterval ?? prices[0]?.billingInterval;
1822
+ const defaultInterval = prices.find((pr) => pr.isDefault)?.billingInterval ?? prices[0]?.billingInterval;
1822
1823
  if (defaultInterval)
1823
1824
  lines.push(` defaultInterval: "${defaultInterval}",`);
1824
1825
  if (prices.length === 0) {
@@ -1839,21 +1840,21 @@ function generateConfigFile(features, plans) {
1839
1840
  if (planFeatures.length > 0) {
1840
1841
  lines.push(" features: {");
1841
1842
  for (const pf of planFeatures) {
1842
- const featureDef = features.find((f) => f.code === pf.featureCode);
1843
- const isBoolean = featureDef?.type === "boolean";
1844
- if (isBoolean) {
1845
- lines.push(` ${pf.featureCode}: ${pf.enabled ?? true},`);
1843
+ const isSimpleBoolean = pf.includedAmount == null && !pf.unlimited && !pf.overage?.enabled;
1844
+ if (isSimpleBoolean) {
1845
+ lines.push(` ${pf.code}: ${pf.enabled},`);
1846
1846
  } else {
1847
1847
  const parts = [];
1848
- if (pf.includedAmount) parts.push(`included: ${pf.includedAmount}`);
1848
+ if (pf.includedAmount != null)
1849
+ parts.push(`included: ${pf.includedAmount}`);
1849
1850
  if (pf.unlimited) parts.push("unlimited: true");
1850
- if (pf.overageEnabled && pf.overageUnitPrice) {
1851
- parts.push(`overage: { unitPrice: ${pf.overageUnitPrice} }`);
1851
+ if (pf.overage?.enabled && pf.overage.unitPrice != null) {
1852
+ parts.push(`overage: { unitPrice: ${pf.overage.unitPrice} }`);
1852
1853
  }
1853
1854
  if (parts.length > 0) {
1854
- lines.push(` ${pf.featureCode}: { ${parts.join(", ")} },`);
1855
+ lines.push(` ${pf.code}: { ${parts.join(", ")} },`);
1855
1856
  } else {
1856
- lines.push(` ${pf.featureCode}: {},`);
1857
+ lines.push(` ${pf.code}: {},`);
1857
1858
  }
1858
1859
  }
1859
1860
  }
@@ -1867,7 +1868,69 @@ function generateConfigFile(features, plans) {
1867
1868
  return lines.join("\n");
1868
1869
  }
1869
1870
 
1871
+ // src/utils/sdk.ts
1872
+ var import_node = require("@commet/node");
1873
+ function createSdkClient() {
1874
+ const envKey = process.env.COMMET_API_KEY;
1875
+ if (envKey) {
1876
+ return new import_node.Commet({ apiKey: envKey });
1877
+ }
1878
+ const config = loadProjectConfig();
1879
+ if (config?.apiKey) {
1880
+ return new import_node.Commet({ apiKey: config.apiKey });
1881
+ }
1882
+ exitWithError({
1883
+ code: "api_key_required",
1884
+ message: "No API key found. Set COMMET_API_KEY env var, or run `commet link` to auto-generate one.",
1885
+ action: "commet link"
1886
+ });
1887
+ }
1888
+ async function fetchRemoteState(commet) {
1889
+ const featuresResponse = await commet.features.list();
1890
+ if (!featuresResponse.success || !featuresResponse.data) {
1891
+ return {
1892
+ error: {
1893
+ code: "fetch_features_failed",
1894
+ message: featuresResponse.error?.message ?? "Failed to fetch features"
1895
+ }
1896
+ };
1897
+ }
1898
+ const plansResponse = await commet.plans.list({ includePrivate: "true" });
1899
+ if (!plansResponse.success || !plansResponse.data) {
1900
+ return {
1901
+ error: {
1902
+ code: "fetch_plans_failed",
1903
+ message: plansResponse.error?.message ?? "Failed to fetch plans"
1904
+ }
1905
+ };
1906
+ }
1907
+ return { features: featuresResponse.data, plans: plansResponse.data };
1908
+ }
1909
+
1870
1910
  // src/commands/pull.ts
1911
+ function toFeatureDef(feature) {
1912
+ if (feature.type === "boolean") {
1913
+ return {
1914
+ name: feature.name,
1915
+ type: "boolean",
1916
+ ...feature.description ? { description: feature.description } : {}
1917
+ };
1918
+ }
1919
+ if (feature.type === "seats") {
1920
+ return {
1921
+ name: feature.name,
1922
+ type: "seats",
1923
+ ...feature.unitName ? { unitName: feature.unitName } : {},
1924
+ ...feature.description ? { description: feature.description } : {}
1925
+ };
1926
+ }
1927
+ return {
1928
+ name: feature.name,
1929
+ type: "usage",
1930
+ ...feature.unitName ? { unitName: feature.unitName } : {},
1931
+ ...feature.description ? { description: feature.description } : {}
1932
+ };
1933
+ }
1871
1934
  var pullCommand = new import_commander8.Command("pull").description(
1872
1935
  "Fetch your billing config from Commet and generate (or update) commet.config.ts with features and plans."
1873
1936
  ).option("-y, --yes", "Skip confirmation prompt").option("--dry-run", "Show what would change without writing any files").option(
@@ -1886,23 +1949,21 @@ Examples:
1886
1949
  `
1887
1950
  ).action(async (options) => {
1888
1951
  const agentMode = isAgentMode(options);
1889
- const { orgId } = requireOrgContext();
1952
+ requireOrgContext();
1890
1953
  const spinner = agentMode ? null : (0, import_ora5.default)("Fetching config from remote...").start();
1891
- const orgQuery = orgId === "__from_api_key__" ? "" : `?orgId=${orgId}`;
1892
- const result = await apiRequest(
1893
- `${BASE_URL}/api/cli/pull${orgQuery}`
1894
- );
1895
- if (result.error || !result.data) {
1954
+ const commet = createSdkClient();
1955
+ const remoteState = await fetchRemoteState(commet);
1956
+ if ("error" in remoteState) {
1896
1957
  if (agentMode) {
1897
- console.log(JSON.stringify({ error: result.error }));
1958
+ console.log(JSON.stringify({ error: remoteState.error }));
1898
1959
  } else {
1899
1960
  spinner?.fail("Failed to fetch config");
1900
- console.error(import_chalk12.default.red("Error:"), result.error?.message);
1961
+ console.error(import_chalk12.default.red("Error:"), remoteState.error.message);
1901
1962
  }
1902
1963
  process.exit(1);
1903
1964
  }
1904
1965
  spinner?.succeed("Remote state fetched");
1905
- const { features, plans } = result.data;
1966
+ const { features, plans } = remoteState;
1906
1967
  const configContent = generateConfigFile(features, plans);
1907
1968
  const outputPath = path5.resolve(process.cwd(), "commet.config.ts");
1908
1969
  const existingConfigPath = findConfigFile(process.cwd());
@@ -1993,15 +2054,7 @@ Would create commet.config.ts (${features.length} features, ${plans.length} plan
1993
2054
  const localConfig = localLoaded.config;
1994
2055
  const remoteAsConfig = {
1995
2056
  features: Object.fromEntries(
1996
- features.map((f) => [
1997
- f.code,
1998
- {
1999
- name: f.name,
2000
- type: f.type,
2001
- ...f.unitName ? { unitName: f.unitName } : {},
2002
- ...f.description ? { description: f.description } : {}
2003
- }
2004
- ])
2057
+ features.map((f) => [f.code, toFeatureDef(f)])
2005
2058
  ),
2006
2059
  plans: Object.fromEntries(
2007
2060
  plans.map((p) => [
@@ -2033,24 +2086,18 @@ Would create commet.config.ts (${features.length} features, ${plans.length} plan
2033
2086
  code,
2034
2087
  name: f.name,
2035
2088
  type: f.type,
2036
- description: f.description ?? null,
2037
- unitName: f.unitName ?? null
2089
+ unitName: "unitName" in f ? f.unitName ?? null : null
2038
2090
  })),
2039
2091
  plans: Object.entries(localConfig.plans).map(([code, p]) => ({
2040
2092
  code,
2041
2093
  name: p.name,
2042
- description: p.description ?? null,
2043
- consumptionModel: p.consumptionModel ?? null,
2044
- defaultInterval: p.defaultInterval ?? null,
2045
- isFree: p.isFree,
2046
- isPublic: p.isPublic,
2047
- sortOrder: p.sortOrder,
2048
2094
  prices: p.prices.map((pr) => ({
2049
2095
  billingInterval: pr.interval,
2050
- price: pr.amount,
2051
- trialDays: pr.trialDays ?? null
2096
+ price: pr.amount
2052
2097
  })),
2053
- features: []
2098
+ features: p.features ? Object.keys(p.features).map((featureCode) => ({
2099
+ code: featureCode
2100
+ })) : []
2054
2101
  }))
2055
2102
  };
2056
2103
  const diff = computeDiff(remoteAsConfig, localAsRemote);
@@ -2142,25 +2189,19 @@ Examples:
2142
2189
  const { config, configPath } = loaded;
2143
2190
  loadSpinner?.succeed(`Loaded ${configPath}`);
2144
2191
  const fetchSpinner = agentMode ? null : (0, import_ora6.default)("Fetching remote state...").start();
2145
- const orgQuery = orgId === "__from_api_key__" ? "" : `?orgId=${orgId}`;
2146
- const remoteResult = await apiRequest(
2147
- `${BASE_URL}/api/cli/pull${orgQuery}`
2148
- );
2149
- if (remoteResult.error || !remoteResult.data) {
2192
+ const commet = createSdkClient();
2193
+ const remoteState = await fetchRemoteState(commet);
2194
+ if ("error" in remoteState) {
2150
2195
  if (agentMode) {
2151
- console.log(JSON.stringify({ error: remoteResult.error }));
2196
+ console.log(JSON.stringify({ error: remoteState.error }));
2152
2197
  } else {
2153
2198
  fetchSpinner?.fail("Failed to fetch remote state");
2154
- console.error(import_chalk13.default.red("Error:"), remoteResult.error?.message);
2199
+ console.error(import_chalk13.default.red("Error:"), remoteState.error.message);
2155
2200
  }
2156
2201
  process.exit(1);
2157
2202
  }
2158
2203
  fetchSpinner?.succeed("Remote state fetched");
2159
- const remote = {
2160
- features: remoteResult.data.features,
2161
- plans: remoteResult.data.plans
2162
- };
2163
- const diff = computeDiff(config, remote);
2204
+ const diff = computeDiff(config, remoteState);
2164
2205
  if (agentMode) {
2165
2206
  if (options.dryRun) {
2166
2207
  console.log(JSON.stringify({ diff, applied: false }));
@@ -2291,26 +2332,6 @@ var import_node2 = require("@commet/node");
2291
2332
  var import_chalk14 = __toESM(require("chalk"));
2292
2333
  var import_commander10 = require("commander");
2293
2334
  var import_ora7 = __toESM(require("ora"));
2294
-
2295
- // src/utils/sdk.ts
2296
- var import_node = require("@commet/node");
2297
- function createSdkClient() {
2298
- const envKey = process.env.COMMET_API_KEY;
2299
- if (envKey) {
2300
- return new import_node.Commet({ apiKey: envKey });
2301
- }
2302
- const config = loadProjectConfig();
2303
- if (config?.apiKey) {
2304
- return new import_node.Commet({ apiKey: config.apiKey });
2305
- }
2306
- exitWithError({
2307
- code: "api_key_required",
2308
- message: "No API key found. Set COMMET_API_KEY env var, or run `commet link` to auto-generate one.",
2309
- action: "commet link"
2310
- });
2311
- }
2312
-
2313
- // src/commands/resources/factory.ts
2314
2335
  function createResourceCommand(def) {
2315
2336
  const command = new import_commander10.Command(def.name).description(def.description);
2316
2337
  for (const [actionName, actionDef] of Object.entries(def.actions)) {
@@ -3464,19 +3485,18 @@ var plansResource = {
3464
3485
  };
3465
3486
  var featuresResource = {
3466
3487
  name: "features",
3467
- description: "Manage features and check feature access",
3488
+ description: "Manage the feature catalog",
3468
3489
  sdkProperty: "features",
3469
3490
  actions: {
3491
+ list: {
3492
+ method: "list",
3493
+ description: "List every feature in the organization catalog",
3494
+ params: []
3495
+ },
3470
3496
  get: {
3471
3497
  method: "get",
3472
- description: "Get feature access for a customer",
3498
+ description: "Get a feature definition from the catalog by code",
3473
3499
  params: [
3474
- {
3475
- flag: "--customer-id <id>",
3476
- description: "Customer ID",
3477
- required: true,
3478
- sdkKey: "customerId"
3479
- },
3480
3500
  {
3481
3501
  flag: "--code <code>",
3482
3502
  description: "Feature code",
@@ -3485,36 +3505,6 @@ var featuresResource = {
3485
3505
  }
3486
3506
  ]
3487
3507
  },
3488
- "can-use": {
3489
- method: "canUse",
3490
- description: "Check if a customer can use a feature",
3491
- params: [
3492
- {
3493
- flag: "--customer-id <id>",
3494
- description: "Customer ID",
3495
- required: true,
3496
- sdkKey: "customerId"
3497
- },
3498
- {
3499
- flag: "--code <code>",
3500
- description: "Feature code",
3501
- required: true,
3502
- sdkKey: "code"
3503
- }
3504
- ]
3505
- },
3506
- list: {
3507
- method: "list",
3508
- description: "List features for a customer",
3509
- params: [
3510
- {
3511
- flag: "--customer-id <id>",
3512
- description: "Customer ID",
3513
- required: true,
3514
- sdkKey: "customerId"
3515
- }
3516
- ]
3517
- },
3518
3508
  create: {
3519
3509
  method: "create",
3520
3510
  description: "Create a feature",
@@ -3590,6 +3580,61 @@ var featuresResource = {
3590
3580
  }
3591
3581
  }
3592
3582
  };
3583
+ var featureAccessResource = {
3584
+ name: "feature-access",
3585
+ description: "Check a customer's feature access and usage",
3586
+ sdkProperty: "featureAccess",
3587
+ actions: {
3588
+ list: {
3589
+ method: "list",
3590
+ description: "List feature access for a customer",
3591
+ params: [
3592
+ {
3593
+ flag: "--customer-id <id>",
3594
+ description: "Customer ID",
3595
+ required: true,
3596
+ sdkKey: "customerId"
3597
+ }
3598
+ ]
3599
+ },
3600
+ get: {
3601
+ method: "get",
3602
+ description: "Get feature access details for a customer",
3603
+ params: [
3604
+ {
3605
+ flag: "--customer-id <id>",
3606
+ description: "Customer ID",
3607
+ required: true,
3608
+ sdkKey: "customerId"
3609
+ },
3610
+ {
3611
+ flag: "--code <code>",
3612
+ description: "Feature code",
3613
+ required: true,
3614
+ sdkKey: "code"
3615
+ }
3616
+ ]
3617
+ },
3618
+ "can-use": {
3619
+ method: "canUse",
3620
+ description: "Check if a customer can use one more unit of a feature",
3621
+ params: [
3622
+ {
3623
+ flag: "--customer-id <id>",
3624
+ description: "Customer ID",
3625
+ required: true,
3626
+ sdkKey: "customerId"
3627
+ },
3628
+ {
3629
+ flag: "--code <code>",
3630
+ description: "Feature code",
3631
+ required: true,
3632
+ sdkKey: "code"
3633
+ }
3634
+ ]
3635
+ }
3636
+ }
3637
+ };
3593
3638
  var seatsResource = {
3594
3639
  name: "seats",
3595
3640
  description: "Manage seat allocations",
@@ -4784,11 +4829,291 @@ var planGroupsResource = {
4784
4829
  }
4785
4830
  }
4786
4831
  };
4832
+ var payoutsResource = {
4833
+ name: "payouts",
4834
+ description: "Manage payouts",
4835
+ sdkProperty: "payouts",
4836
+ actions: {
4837
+ request: {
4838
+ method: "request",
4839
+ description: "Request a payout of available balance",
4840
+ params: [
4841
+ {
4842
+ flag: "--amount <n>",
4843
+ description: "Amount in cents (USD, minimum 1000)",
4844
+ required: true,
4845
+ parse: parseNumber,
4846
+ sdkKey: "amount"
4847
+ },
4848
+ {
4849
+ flag: "--description <desc>",
4850
+ description: "Payout description",
4851
+ sdkKey: "description"
4852
+ }
4853
+ ]
4854
+ },
4855
+ "add-bank-account": {
4856
+ method: "addBankAccount",
4857
+ description: "Add a destination bank account to the payout account",
4858
+ params: [
4859
+ {
4860
+ flag: "--account-number <number>",
4861
+ description: "Bank account number",
4862
+ required: true,
4863
+ sdkKey: "accountNumber"
4864
+ },
4865
+ {
4866
+ flag: "--account-holder-name <name>",
4867
+ description: "Account holder name",
4868
+ required: true,
4869
+ sdkKey: "accountHolderName"
4870
+ },
4871
+ {
4872
+ flag: "--routing-number <number>",
4873
+ description: "Routing number",
4874
+ sdkKey: "routingNumber"
4875
+ },
4876
+ {
4877
+ flag: "--account-type <type>",
4878
+ description: "Account type: checking or savings",
4879
+ sdkKey: "accountType"
4880
+ },
4881
+ {
4882
+ flag: "--set-default <bool>",
4883
+ description: "Set as default bank account",
4884
+ parse: parseBool,
4885
+ sdkKey: "setDefault"
4886
+ }
4887
+ ]
4888
+ },
4889
+ "complete-verification": {
4890
+ method: "completeVerification",
4891
+ description: "Provision the payout account with the full KYC payload",
4892
+ params: [
4893
+ {
4894
+ flag: "--email <email>",
4895
+ description: "Contact email",
4896
+ required: true,
4897
+ sdkKey: "email"
4898
+ },
4899
+ {
4900
+ flag: "--business-type <type>",
4901
+ description: "Business type: individual or company",
4902
+ required: true,
4903
+ sdkKey: "businessType"
4904
+ },
4905
+ {
4906
+ flag: "--business-url <url>",
4907
+ description: "Business website URL",
4908
+ required: true,
4909
+ sdkKey: "businessUrl"
4910
+ },
4911
+ {
4912
+ flag: "--document-url <url>",
4913
+ description: "Identity document URL",
4914
+ required: true,
4915
+ sdkKey: "documentUrl"
4916
+ },
4917
+ {
4918
+ flag: "--bank <json>",
4919
+ description: "Bank account (JSON: {accountNumber, accountHolderName, ...})",
4920
+ required: true,
4921
+ parse: parseJson,
4922
+ sdkKey: "bank"
4923
+ },
4924
+ {
4925
+ flag: "--individual <json>",
4926
+ description: "Individual KYC details (JSON, individual businesses)",
4927
+ parse: parseJson,
4928
+ sdkKey: "individual"
4929
+ },
4930
+ {
4931
+ flag: "--company <json>",
4932
+ description: "Company KYC details (JSON, company businesses)",
4933
+ parse: parseJson,
4934
+ sdkKey: "company"
4935
+ }
4936
+ ]
4937
+ }
4938
+ }
4939
+ };
4940
+ var testClockResource = {
4941
+ name: "test-clock",
4942
+ description: "Control the sandbox test clock",
4943
+ sdkProperty: "testClock",
4944
+ actions: {
4945
+ get: {
4946
+ method: "get",
4947
+ description: "Get the current test clock state (sandbox only)",
4948
+ params: []
4949
+ },
4950
+ advance: {
4951
+ method: "advance",
4952
+ description: "Move the test clock forward (sandbox only)",
4953
+ params: [
4954
+ {
4955
+ flag: "--advance-days <n>",
4956
+ description: "Days to move the clock forward",
4957
+ parse: parseNumber,
4958
+ sdkKey: "advanceDays"
4959
+ },
4960
+ {
4961
+ flag: "--frozen-time <ts>",
4962
+ description: "Absolute instant to move to (ISO 8601)",
4963
+ sdkKey: "frozenTime"
4964
+ }
4965
+ ]
4966
+ },
4967
+ "process-billing": {
4968
+ method: "processBilling",
4969
+ description: "Enqueue billing cycles for customers due at the simulated time (sandbox only)",
4970
+ params: []
4971
+ }
4972
+ }
4973
+ };
4974
+ var quotaResource = {
4975
+ name: "quota",
4976
+ description: "Manage quota allowances",
4977
+ sdkProperty: "quota",
4978
+ actions: {
4979
+ add: {
4980
+ method: "add",
4981
+ description: "Add to a customer's quota allowance for a feature",
4982
+ params: [
4983
+ {
4984
+ flag: "--feature-code <code>",
4985
+ description: "Feature code",
4986
+ required: true,
4987
+ sdkKey: "featureCode"
4988
+ },
4989
+ {
4990
+ flag: "--customer-id <id>",
4991
+ description: "Customer ID (provide this or --external-id)",
4992
+ sdkKey: "customerId"
4993
+ },
4994
+ {
4995
+ flag: "--external-id <id>",
4996
+ description: "Customer external ID (provide this or --customer-id)",
4997
+ sdkKey: "externalId"
4998
+ },
4999
+ {
5000
+ flag: "--count <n>",
5001
+ description: "Amount to add (defaults to 1)",
5002
+ parse: parseNumber,
5003
+ sdkKey: "count"
5004
+ },
5005
+ {
5006
+ flag: "--idempotency-key <key>",
5007
+ description: "Idempotency key for deduplication",
5008
+ sdkKey: "idempotencyKey"
5009
+ }
5010
+ ]
5011
+ },
5012
+ set: {
5013
+ method: "set",
5014
+ description: "Set a customer's quota allowance to an exact value",
5015
+ params: [
5016
+ {
5017
+ flag: "--feature-code <code>",
5018
+ description: "Feature code",
5019
+ required: true,
5020
+ sdkKey: "featureCode"
5021
+ },
5022
+ {
5023
+ flag: "--count <n>",
5024
+ description: "Exact allowance value",
5025
+ required: true,
5026
+ parse: parseNumber,
5027
+ sdkKey: "count"
5028
+ },
5029
+ {
5030
+ flag: "--customer-id <id>",
5031
+ description: "Customer ID (provide this or --external-id)",
5032
+ sdkKey: "customerId"
5033
+ },
5034
+ {
5035
+ flag: "--external-id <id>",
5036
+ description: "Customer external ID (provide this or --customer-id)",
5037
+ sdkKey: "externalId"
5038
+ },
5039
+ {
5040
+ flag: "--idempotency-key <key>",
5041
+ description: "Idempotency key for deduplication",
5042
+ sdkKey: "idempotencyKey"
5043
+ }
5044
+ ]
5045
+ },
5046
+ remove: {
5047
+ method: "remove",
5048
+ description: "Remove from a customer's quota allowance for a feature",
5049
+ params: [
5050
+ {
5051
+ flag: "--feature-code <code>",
5052
+ description: "Feature code",
5053
+ required: true,
5054
+ sdkKey: "featureCode"
5055
+ },
5056
+ {
5057
+ flag: "--customer-id <id>",
5058
+ description: "Customer ID (provide this or --external-id)",
5059
+ sdkKey: "customerId"
5060
+ },
5061
+ {
5062
+ flag: "--external-id <id>",
5063
+ description: "Customer external ID (provide this or --customer-id)",
5064
+ sdkKey: "externalId"
5065
+ },
5066
+ {
5067
+ flag: "--count <n>",
5068
+ description: "Amount to remove (defaults to 1)",
5069
+ parse: parseNumber,
5070
+ sdkKey: "count"
5071
+ },
5072
+ {
5073
+ flag: "--idempotency-key <key>",
5074
+ description: "Idempotency key for deduplication",
5075
+ sdkKey: "idempotencyKey"
5076
+ }
5077
+ ]
5078
+ },
5079
+ get: {
5080
+ method: "get",
5081
+ description: "Get the quota allowance for a specific feature",
5082
+ params: [
5083
+ {
5084
+ flag: "--customer-id <id>",
5085
+ description: "Customer ID",
5086
+ required: true,
5087
+ sdkKey: "customerId"
5088
+ },
5089
+ {
5090
+ flag: "--feature-code <code>",
5091
+ description: "Feature code",
5092
+ required: true,
5093
+ sdkKey: "featureCode"
5094
+ }
5095
+ ]
5096
+ },
5097
+ "get-all": {
5098
+ method: "getAll",
5099
+ description: "Get all quota allowances for a customer",
5100
+ params: [
5101
+ {
5102
+ flag: "--customer-id <id>",
5103
+ description: "Customer ID",
5104
+ required: true,
5105
+ sdkKey: "customerId"
5106
+ }
5107
+ ]
5108
+ }
5109
+ }
5110
+ };
4787
5111
  var resourceDefinitions = [
4788
5112
  customersResource,
4789
5113
  subscriptionsResource,
4790
5114
  plansResource,
4791
5115
  featuresResource,
5116
+ featureAccessResource,
4792
5117
  seatsResource,
4793
5118
  usageResource,
4794
5119
  portalResource,
@@ -4799,7 +5124,10 @@ var resourceDefinitions = [
4799
5124
  invoicesResource,
4800
5125
  transactionsResource,
4801
5126
  promoCodesResource,
4802
- planGroupsResource
5127
+ planGroupsResource,
5128
+ payoutsResource,
5129
+ testClockResource,
5130
+ quotaResource
4803
5131
  ];
4804
5132
 
4805
5133
  // src/utils/update-check.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commet",
3
- "version": "2.2.9",
3
+ "version": "3.0.0",
4
4
  "description": "Commet CLI - Manage your billing platform from the command line",
5
5
  "bin": {
6
6
  "commet": "./bin/commet"
@@ -28,7 +28,7 @@
28
28
  "open": "11.0.0",
29
29
  "ora": "9.4.0",
30
30
  "tar": "^7.5.13",
31
- "@commet/node": "6.0.0"
31
+ "@commet/node": "7.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "24.12.4",