@bike4mind/cli 0.2.1-feat-cli-usage-command.16999 → 0.2.1-feat-cli-usage-command.17001

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.
@@ -22,12 +22,20 @@ var SubtractCreditsSchema = z.discriminatedUnion("type", [
22
22
  ImageEditUsageTransaction.omit({ createdAt: true, updatedAt: true }),
23
23
  TransferCreditTransaction.omit({ createdAt: true, updatedAt: true })
24
24
  ]);
25
- async function subtractCredits(parameters, { db, creditHolderMethods }) {
25
+ async function subtractCredits(parameters, { db, creditHolderMethods, skipBalanceUpdate, currentCreditHolder }) {
26
26
  const params = secureParameters(parameters, SubtractCreditsSchema);
27
27
  const { ownerId, ownerType, credits, type, description, metadata } = params;
28
- const updatedEntity = await creditHolderMethods.incrementCredits(ownerId, -credits);
29
- if (!updatedEntity) {
30
- throw new BadRequestError("Failed to update credits");
28
+ let updatedEntity;
29
+ if (skipBalanceUpdate) {
30
+ if (!currentCreditHolder) {
31
+ throw new BadRequestError("currentCreditHolder is required when skipBalanceUpdate is true");
32
+ }
33
+ updatedEntity = currentCreditHolder;
34
+ } else {
35
+ updatedEntity = await creditHolderMethods.incrementCredits(ownerId, -credits);
36
+ if (!updatedEntity) {
37
+ throw new BadRequestError("Failed to update credits");
38
+ }
31
39
  }
32
40
  if (type === "generic_deduct") {
33
41
  await db.creditTransactions.createTransaction("generic_deduct", {
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  getOpenWeatherKey,
6
6
  getSerperKey
7
7
  } from "./chunk-QXGU6KYI.js";
8
- import "./chunk-LZMRYJ3B.js";
8
+ import "./chunk-7R5QIZU3.js";
9
9
  import "./chunk-F3ETXO5N.js";
10
10
  import {
11
11
  BFLImageService,
@@ -8766,7 +8766,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
8766
8766
  // package.json
8767
8767
  var package_default = {
8768
8768
  name: "@bike4mind/cli",
8769
- version: "0.2.1-feat-cli-usage-command.16999+815cdcd08",
8769
+ version: "0.2.1-feat-cli-usage-command.17001+2f4ebd097",
8770
8770
  type: "module",
8771
8771
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
8772
8772
  license: "UNLICENSED",
@@ -8863,10 +8863,10 @@ var package_default = {
8863
8863
  },
8864
8864
  devDependencies: {
8865
8865
  "@bike4mind/agents": "0.1.0",
8866
- "@bike4mind/common": "2.36.1-feat-cli-usage-command.16999+815cdcd08",
8867
- "@bike4mind/mcp": "1.19.4-feat-cli-usage-command.16999+815cdcd08",
8868
- "@bike4mind/services": "2.29.1-feat-cli-usage-command.16999+815cdcd08",
8869
- "@bike4mind/utils": "2.0.3-feat-cli-usage-command.16999+815cdcd08",
8866
+ "@bike4mind/common": "2.36.1-feat-cli-usage-command.17001+2f4ebd097",
8867
+ "@bike4mind/mcp": "1.19.4-feat-cli-usage-command.17001+2f4ebd097",
8868
+ "@bike4mind/services": "2.29.1-feat-cli-usage-command.17001+2f4ebd097",
8869
+ "@bike4mind/utils": "2.0.3-feat-cli-usage-command.17001+2f4ebd097",
8870
8870
  "@types/diff": "^5.0.9",
8871
8871
  "@types/jsonwebtoken": "^9.0.4",
8872
8872
  "@types/node": "^22.9.0",
@@ -8877,7 +8877,7 @@ var package_default = {
8877
8877
  tsx: "^4.21.0",
8878
8878
  typescript: "^5.9.3"
8879
8879
  },
8880
- gitHead: "815cdcd0897c92e3713ce3e04c930b70332cb318"
8880
+ gitHead: "2f4ebd097a871fe1588b568df8b89cf2e4706379"
8881
8881
  };
8882
8882
 
8883
8883
  // src/config/constants.ts
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-LZMRYJ3B.js";
5
+ } from "./chunk-7R5QIZU3.js";
6
6
  import "./chunk-U3GPYBTD.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
8
  import "./chunk-WR6YZRQV.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.1-feat-cli-usage-command.16999+815cdcd08",
3
+ "version": "0.2.1-feat-cli-usage-command.17001+2f4ebd097",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -97,10 +97,10 @@
97
97
  },
98
98
  "devDependencies": {
99
99
  "@bike4mind/agents": "0.1.0",
100
- "@bike4mind/common": "2.36.1-feat-cli-usage-command.16999+815cdcd08",
101
- "@bike4mind/mcp": "1.19.4-feat-cli-usage-command.16999+815cdcd08",
102
- "@bike4mind/services": "2.29.1-feat-cli-usage-command.16999+815cdcd08",
103
- "@bike4mind/utils": "2.0.3-feat-cli-usage-command.16999+815cdcd08",
100
+ "@bike4mind/common": "2.36.1-feat-cli-usage-command.17001+2f4ebd097",
101
+ "@bike4mind/mcp": "1.19.4-feat-cli-usage-command.17001+2f4ebd097",
102
+ "@bike4mind/services": "2.29.1-feat-cli-usage-command.17001+2f4ebd097",
103
+ "@bike4mind/utils": "2.0.3-feat-cli-usage-command.17001+2f4ebd097",
104
104
  "@types/diff": "^5.0.9",
105
105
  "@types/jsonwebtoken": "^9.0.4",
106
106
  "@types/node": "^22.9.0",
@@ -111,5 +111,5 @@
111
111
  "tsx": "^4.21.0",
112
112
  "typescript": "^5.9.3"
113
113
  },
114
- "gitHead": "815cdcd0897c92e3713ce3e04c930b70332cb318"
114
+ "gitHead": "2f4ebd097a871fe1588b568df8b89cf2e4706379"
115
115
  }