Skip to content

Commit

Permalink
👷 Refactor bun command in check-and-report-chats-usage.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Sep 25, 2024
1 parent 230b026 commit 3498df6
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-and-report-chats-usage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
- uses: actions/checkout@v2
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bunx turbo run checkAndReportChatsUsage
- run: bunx turbo checkAndReportChatsUsage
Binary file modified bun.lockb
Binary file not shown.
1 change: 0 additions & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"@typebot.io/tsconfig": "workspace:*",
"@types/bun": "^1.1.9",
"@types/cli-progress": "^3.11.5",
"@types/node": "20.4.2",
"@types/papaparse": "5.3.7",
"@types/prompts": "2.4.4",
"tsx": "4.19.1"
Expand Down
9 changes: 6 additions & 3 deletions packages/scripts/src/checkAndReportChatsUsage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createId } from "@paralleldrive/cuid2";
import { getChatsLimit } from "@typebot.io/billing/src/helpers/getChatsLimit";
import { getChatsLimit } from "@typebot.io/billing/helpers/getChatsLimit";
import { sendAlmostReachedChatsLimitEmail } from "@typebot.io/emails/emails/AlmostReachedChatsLimitEmail";
import { isDefined, isEmpty } from "@typebot.io/lib/utils";
import prisma from "@typebot.io/prisma";
import { Plan, WorkspaceRole } from "@typebot.io/prisma/enum";
import type { TelemetryEvent } from "@typebot.io/schemas/features/telemetry";
import type { TelemetryEvent } from "@typebot.io/telemetry/schemas";
import { trackEvents } from "@typebot.io/telemetry/trackEvents";
import type { Workspace } from "@typebot.io/workspaces/schemas";
import Stripe from "stripe";
Expand Down Expand Up @@ -364,7 +364,10 @@ const autoUpgradeToPro = async (
},
});

await prisma.workspace.update({ id: workspaceId, plan: "PRO" });
await prisma.workspace.update({
where: { id: workspaceId },
data: { plan: "PRO" },
});

return newSubscription;
};
Expand Down
5 changes: 1 addition & 4 deletions packages/scripts/src/createChatsPrices.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
proChatTiers,
starterChatTiers,
} from "@typebot.io/billing/src/constants";
import { proChatTiers, starterChatTiers } from "@typebot.io/billing/constants";
import Stripe from "stripe";
import { promptAndSetEnvironment } from "./utils";

Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"extends": "./packages/tsconfig/base.json",
"files": []
"extends": "./packages/tsconfig/base.json"
}
5 changes: 2 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5940,7 +5940,7 @@
devDependencies:
"@typebot.io/tsconfig" "packages/tsconfig"
dotenv-cli "7.4.1"
tsx ""
tsx "4.19.1"
dependencies:
"@prisma/client" "5.12.1"
prisma "5.12.1"
Expand Down Expand Up @@ -6027,7 +6027,6 @@
"@typebot.io/tsconfig" "packages/tsconfig"
"@types/bun" "^1.1.9"
"@types/cli-progress" "^3.11.5"
"@types/node" "20.4.2"
"@types/papaparse" "5.3.7"
"@types/prompts" "2.4.4"
tsx "4.19.1"
Expand Down Expand Up @@ -18609,7 +18608,7 @@ [email protected]:
tinyglobby "^0.2.1"
tree-kill "^1.2.2"

[email protected], tsx@^4.19.1:
[email protected]:
version "4.19.1"
resolved "https://registry.npmjs.org/tsx/-/tsx-4.19.1.tgz"
integrity sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA==
Expand Down

0 comments on commit 3498df6

Please sign in to comment.