From d1b3a281f17aa9174435e6e2ff36c311426aa367 Mon Sep 17 00:00:00 2001 From: Charlie Lamb Date: Wed, 28 Jan 2026 10:09:24 +0000 Subject: [PATCH] chore: initial knip changes --- knip.json | 4 +- package.json | 14 ++----- scripts/package.json | 7 +--- server/package.json | 40 +------------------ server/src/_luaScripts/luaScripts.ts | 6 +-- server/src/cron/cronInit.ts | 2 +- .../db/cteUtils/strategies/relationGraph.ts | 4 +- .../cteUtils/strategies/strategySelector.ts | 6 +-- server/src/db/initClickHouse.ts | 2 +- server/src/external/autumn/autumnCliV2.ts | 2 +- server/src/external/autumn/autumnUtils.ts | 1 - server/src/external/redis/initRedis.ts | 6 +-- server/src/external/resend/loopsUtils.ts | 2 +- server/src/external/resend/resendUtils.ts | 2 +- .../revenueCat/misc/initRevenuecatCli.ts | 2 +- .../revenueCat/misc/revenueCatMiddleware.ts | 2 +- .../external/revenueCat/revenuecatTypes.ts | 24 +++++------ .../createStripeArrearProrated.ts | 4 +- .../createStripePrice/createStripeInArrear.ts | 4 +- .../createStripePrice/createStripePrepaid.ts | 2 +- .../createStripePrice/createStripePrice.ts | 2 +- .../invoices/utils/convertStripeInvoice.ts | 2 +- server/src/external/stripe/stripeCardUtils.ts | 2 +- server/src/external/stripe/stripeCusUtils.ts | 4 +- .../src/external/stripe/stripeEnsureUtils.ts | 2 +- .../src/external/stripe/stripeInvoiceUtils.ts | 2 +- .../src/external/stripe/stripePriceUtils.ts | 6 +-- server/src/external/stripe/stripeSubUtils.ts | 14 +++---- .../stripeSubUtils/stripeSubItemUtils.ts | 6 +-- .../updateStripeSub/createProrationinvoice.ts | 2 +- .../utils/logStripeSchedulePhaseUtils.ts | 10 ++--- .../utils/classifyStripeSubscriptionUtils.ts | 2 +- .../utils/lockStripeSubscriptionUtils.ts | 2 +- server/src/external/stripe/utils.ts | 4 +- .../stripe/webhookHandlers/common/index.ts | 7 +--- .../common/trackCustomerProductUpdate.ts | 2 +- .../handleInvoiceCreated.ts | 4 +- .../handleStripeInvoiceMetadata.ts | 6 +-- .../tasks/handleCancelOnPastDue.ts | 2 +- .../isStripeSubscriptionCanceledEvent.ts | 2 +- .../isStripeSubscriptionRenewedEvent.ts | 2 +- .../stripeToAutumnCustomerMiddleware.ts | 2 +- server/src/external/supabase/storageUtils.ts | 4 +- server/src/external/upstash/rateLimitUtils.ts | 2 +- .../vercel/handlers/handleListBillingPlans.ts | 2 +- .../src/external/vercel/misc/vercelTypes.ts | 6 +-- .../honoMiddlewares/errorSkipMiddleware.ts | 2 +- server/src/initHono.ts | 2 +- server/src/internal/analytics/actionUtils.ts | 2 +- .../src/internal/analytics/analyticsUtils.ts | 12 +++--- .../api/check/checkUtils/getCheckData.ts | 2 +- .../check/handlers/getProductCheckPreview.ts | 2 +- .../createBalance/validateCreateBalance.ts | 2 +- .../track/deductUtils/calculateDeduction.ts | 4 +- .../deductUtils/deductFromMainBalance.ts | 4 +- .../deduction/deductionToTrackResponse.ts | 2 +- .../deduction/prepareDeductionOptions.ts | 2 +- .../balances/utils/handleThresholdReached.ts | 2 +- .../createUpgradeProrationInvoice.ts | 2 +- .../handleProratedDowngrade.ts | 2 +- .../utils/sync/SyncBatchingManagerV2.ts | 2 +- .../balances/utils/sync/syncItemV3.ts | 2 +- .../balances/utils/types/deductionTypes.ts | 6 +-- .../src/internal/billing/v2/billingContext.ts | 2 +- .../buildStripeSubscriptionScheduleAction.ts | 2 +- .../stripe/utils/invoices/payStripeInvoice.ts | 2 +- .../stripe/utils/invoices/stripeInvoiceOps.ts | 8 ++-- .../logBuildPhaseHelpers.ts | 2 +- .../internal/billing/v2/types/billingPlan.ts | 12 +++--- .../internal/billing/v2/types/cancelTypes.ts | 2 +- .../v2/utils/billingContextPriceLookup.ts | 2 +- .../initCustomerEntitlementBalance.ts | 2 +- .../lineItems/customerProductToLineItems.ts | 2 +- .../setup/setupDefaultProductsContext.ts | 2 +- .../add-product/createFullCusProduct.ts | 10 ++--- .../customers/add-product/initCusEnt.ts | 2 +- .../createUsageInvoiceItems.ts | 2 +- .../internal/customers/attach/attachRouter.ts | 6 +-- .../attachParams/convertToParams.ts | 2 +- .../attachParams/processAttachBody.ts | 2 +- .../attach/attachUtils/attachUtils.ts | 4 +- .../createContUseInvoiceItems.ts | 2 +- .../getContUseItems/getContUseInvoiceItems.ts | 2 +- .../customers/attach/mergeUtils/mergeUtils.ts | 2 +- .../mergeUtils/paramsToScheduleItems.ts | 2 +- .../mergeUtils/phaseUtils/upsertNewPhase.ts | 2 +- .../customers/attach/models/AttachFlags.ts | 4 +- .../cusProducts/CusProductService.ts | 4 +- .../customers/cusProducts/actions/index.ts | 6 +-- .../cusProducts/cusEnts/cusEntUtils.ts | 10 ++--- .../cusEnts/cusEntUtils/findCusEntUtils.ts | 4 +- .../cusEnts/cusEntUtils/getExistingUsage.ts | 4 +- .../cusEnts/cusRollovers/rolloverUtils.ts | 2 +- .../customers/cusProducts/cusProductUtils.ts | 4 +- .../cusProductUtils/convertCusProduct.ts | 2 +- .../getApiBalance/apiBalanceUtils.ts | 6 +-- .../customers/cusUtils/createNewCustomer.ts | 2 +- .../internal/customers/cusUtils/cusUtils.ts | 6 +-- .../fullCustomerCacheConfig.ts | 2 +- .../customers/cusUtils/initCustomer.ts | 2 +- .../handlers/handleCreateCustomer.ts | 4 +- .../apiEntityUtils/getApiEntityExpand.ts | 2 +- .../createEntityForCusProduct.ts | 2 +- .../handleCreateEntity/handleCreateEntity2.ts | 2 +- .../internal/features/creditSystemUtils.ts | 2 +- .../features/featureActions/createFeature.ts | 2 +- server/src/internal/features/featureUtils.ts | 4 +- .../features/utils/constructFeatureUtils.ts | 2 +- .../internal/features/utils/displayUtils.ts | 2 +- .../workflows/generateFeatureDisplay.ts | 2 +- .../internal/invoices/invoiceFormatUtils.ts | 6 +-- .../src/internal/migrations/migrationUtils.ts | 2 +- .../internal/migrations/runMigrationTask.ts | 2 +- .../misc/pricingAgent/pricingAgentRouter.ts | 2 +- .../handlers/crudHandlers/handleDeleteOrg.ts | 2 +- .../orgs/handlers/handleRevenueCatConfig.ts | 2 +- .../stripeHandlers/handleDeleteStripe.ts | 4 +- server/src/internal/orgs/orgUtils.ts | 8 ++-- .../platformBeta/utils/oauthStateUtils.ts | 2 +- .../products/entitlements/entitlementUtils.ts | 8 ++-- .../products/free-trials/freeTrialUtils.ts | 2 +- .../handleCopyProduct/handleCopyProductV2.ts | 2 +- .../handlers/productActions/updateProduct.ts | 2 +- .../productActions/validateDefaultFlag.ts | 2 +- .../products/internalProductRouter.ts | 2 +- .../internal/products/pricecn/pricecnUtils.ts | 12 +++--- .../products/prices/billingIntervalUtils.ts | 8 ++-- .../products/prices/billingIntervalUtils2.ts | 2 +- .../products/prices/priceInitUtils.ts | 2 +- .../internal/products/prices/priceUtils.ts | 14 +++---- .../getContUsageDowngradeItem.ts | 2 +- .../prices/priceUtils/convertPrice.ts | 2 +- .../prices/priceUtils/findPriceUtils.ts | 4 +- .../usagePriceUtils/classifyUsagePrice.ts | 4 +- .../product-items/productItemUtils.ts | 2 +- .../productItemUtils/convertItem.ts | 2 +- .../productItemUtils/itemToPriceAndEnt.ts | 6 +-- server/src/internal/products/productUtils.ts | 10 ++--- .../products/productUtils/classifyProduct.ts | 4 +- .../getProductResponse.ts | 4 +- .../productV2Utils/convertProductV2ToV1.ts | 2 +- server/src/internal/rewards/rewardUtils.ts | 12 +++--- server/src/middleware/apiAuthMiddleware.ts | 2 +- server/src/middleware/authMiddleware.ts | 2 +- server/src/middleware/publicAuthMiddleware.ts | 2 +- server/src/queue/bullmq/initBullMq.ts | 2 +- server/src/queue/initSqs.ts | 2 +- server/src/queue/queueUtils.ts | 2 +- server/src/queue/workflows.ts | 4 +- server/src/utils/authUtils/afterOrgCreated.ts | 2 +- server/src/utils/cacheUtils/CacheType.ts | 3 +- server/src/utils/constants.ts | 4 +- server/src/utils/errorUtils.ts | 4 +- server/src/utils/genUtils.ts | 10 ++--- server/src/utils/models/Request.ts | 2 +- server/src/utils/posthog.ts | 2 +- server/src/utils/timeUtils.ts | 2 +- shared/api/balances/track/trackLegacyData.ts | 2 +- .../api/billing/common/featureQuantities.ts | 2 +- shared/api/billing/common/planOverride.ts | 2 +- shared/api/common/customerId.ts | 2 +- .../prevVersions/apiTrialsUsedV0.ts | 2 +- .../changes/V1.2_CusFeatureChange.ts | 2 +- .../cusPlans/changes/V0.2_CusProductChange.ts | 4 +- .../cusPlans/changes/V1.2_CusPlanChange.ts | 2 +- .../previousVersions/apiCusProductV0.ts | 4 +- .../previousVersions/apiCusProductV1.ts | 2 +- .../previousVersions/apiCusProductV2.ts | 2 +- .../previousVersions/apiCustomerV0.ts | 6 +-- .../previousVersions/apiCustomerV1.ts | 4 +- .../apiInvoice/prevVersions/apiInvoiceV0.ts | 2 +- shared/db/auth-relations.ts | 12 +++--- shared/enums/AttachErrCode.ts | 3 +- shared/enums/SuccessCode.ts | 9 ----- .../billingModels/ongoingCusProductAction.ts | 2 +- shared/models/cusModels/cusExpand.ts | 7 ---- .../cusModels/entityModels/entityExpand.ts | 3 +- shared/models/featureModels/featureEnums.ts | 1 - shared/models/genModels/genEnums.ts | 9 +---- shared/models/genModels/processorSchemas.ts | 3 +- shared/package.json | 3 -- .../cycleUtils/getCycleIntervalFunctions.ts | 2 +- vite/package.json | 35 +--------------- vite/src/App.tsx | 2 +- vite/src/app/AppContext.tsx | 2 +- vite/src/components/compareDbFeature.ts | 2 +- .../constants/trialConstants.ts | 2 +- .../updateSubscriptionFormSchema.ts | 2 +- .../use-update-subscription-form.ts | 2 +- vite/src/components/ui/badge.tsx | 2 +- vite/src/components/ui/breadcrumb.tsx | 4 +- vite/src/components/ui/button-group.tsx | 4 +- vite/src/components/ui/card.tsx | 8 ++-- vite/src/components/ui/chart.tsx | 6 +-- vite/src/components/ui/command.tsx | 2 +- vite/src/components/ui/dialog.tsx | 8 ++-- vite/src/components/ui/dropdown-menu.tsx | 8 ++-- vite/src/components/ui/input-group.tsx | 4 +- vite/src/components/ui/pagination.tsx | 8 ++-- vite/src/components/ui/popover.tsx | 2 +- vite/src/components/ui/scroll-area.tsx | 2 +- vite/src/components/ui/select.tsx | 10 ++--- vite/src/components/ui/table.tsx | 4 +- vite/src/components/v2/badges/Badge.tsx | 2 +- vite/src/components/v2/badges/IconBadge.tsx | 4 +- .../components/v2/badges/PlanTypeBadge.tsx | 2 +- vite/src/components/v2/buttons/CopyButton.tsx | 4 +- vite/src/components/v2/cards/Card.tsx | 2 +- .../components/v2/checkboxes/IconCheckbox.tsx | 2 +- vite/src/components/v2/dialogs/Dialog.tsx | 6 +-- .../components/v2/dropdowns/DropdownMenu.tsx | 10 ++--- vite/src/components/v2/icons/AutumnIcons.tsx | 6 +-- .../PlanEditorContext.tsx | 2 +- vite/src/components/v2/inputs/Input.tsx | 2 +- vite/src/components/v2/inputs/InputGroup.tsx | 4 +- vite/src/components/v2/selects/Select.tsx | 6 +-- vite/src/components/v2/sheets/InlineSheet.tsx | 2 +- .../v2/sheets/SharedSheetComponents.tsx | 2 +- vite/src/components/v2/sheets/Sheet.tsx | 6 +-- vite/src/contexts/PortalContainerContext.tsx | 2 +- vite/src/hooks/common/useLocalStorage.ts | 1 - vite/src/hooks/form/form.ts | 2 +- vite/src/hooks/stores/useCommandBarStore.ts | 2 +- .../stores/useCustomerBalanceSheetStore.ts | 8 ++-- vite/src/hooks/stores/useFeatureStore.ts | 2 +- vite/src/hooks/stores/useProductStore.ts | 8 ++-- vite/src/hooks/stores/useSDKStore.ts | 4 +- vite/src/hooks/stores/useSecretKeyStore.ts | 4 +- vite/src/hooks/stores/useSheetStore.ts | 12 +++--- vite/src/hooks/useColumnVisibility.ts | 4 +- vite/src/hooks/useDropdownShortcut.ts | 2 +- vite/src/lib/auth-client.ts | 6 +-- vite/src/lib/snippets/curlSnippets.ts | 2 +- vite/src/lib/snippets/nodeSnippets.ts | 2 +- vite/src/lib/snippets/productUtils.ts | 2 +- vite/src/lib/snippets/pythonSnippets.ts | 2 +- vite/src/lib/snippets/reactSnippets.ts | 2 +- vite/src/lib/snippets/stackOptionsConfig.tsx | 16 ++++---- vite/src/services/useAxiosSwr.tsx | 4 +- vite/src/utils/formatUtils/formatDateUtils.ts | 4 +- vite/src/utils/formatUtils/formatTextUtils.ts | 2 +- vite/src/utils/genUtils.ts | 10 ++--- vite/src/utils/linkUtils.ts | 2 +- vite/src/utils/posthogTracking.ts | 14 +++---- vite/src/utils/product/getItemType.ts | 2 +- vite/src/utils/product/priceUtils.ts | 4 +- .../product/product-item/formatProductItem.ts | 4 +- vite/src/utils/product/productItemUtils.ts | 8 ++-- vite/src/utils/productUtils.ts | 2 +- vite/src/views/auth/SignIn.tsx | 2 +- vite/src/views/command-bar/command-row.tsx | 2 +- vite/src/views/command-bar/commandUtils.ts | 2 +- vite/src/views/customers/CustomersContext.tsx | 2 +- .../analytics/components/QueryTopbar.tsx | 6 +-- .../customerFeatureUsageUtils.ts | 2 +- .../customerProductsTableFilters.ts | 6 +-- .../customerUsageAnalyticsUtils.ts | 4 +- .../customer-plan/CustomerPlanEditor.tsx | 2 +- .../customers2/customer/CustomerContext.tsx | 2 +- .../hooks/useCustomerListColumns.ts | 2 +- .../views/customers2/utils/ColumnHelpers.tsx | 2 +- .../api-keys/components/APIKeyToolbar.tsx | 2 +- vite/src/views/developer/publishable-key.tsx | 2 +- vite/src/views/main-sidebar/MainSidebar.tsx | 2 +- .../env-dropdown/ExpandedEnvTrigger.tsx | 4 +- .../manage-org/OrgLogoUploader.tsx | 2 +- .../onboarding3/utils/onboardingUtils.ts | 32 +++++++-------- .../views/onboarding4/pricingAgentUtils.ts | 2 +- .../onboarding4/pricingTemplateConfigs.ts | 2 +- vite/src/views/onboarding4/templateConfigs.ts | 4 +- .../features/utils/getFeatureIcon.tsx | 4 +- .../views/products/plan/utils/tierUtils.ts | 2 +- .../product-item/ProductItemContext.tsx | 2 +- .../rewards/utils/defaultRewardModels.ts | 4 +- 274 files changed, 509 insertions(+), 633 deletions(-) diff --git a/knip.json b/knip.json index 8eb665749..def7d3b24 100644 --- a/knip.json +++ b/knip.json @@ -8,7 +8,6 @@ "entry": ["tests/**/*.ts"], "project": ["src/**/*.ts", "tests/**/*.ts"], "ignore": [ - "src/_luaScripts/**", "src/_luaScriptsV2/**", "src/utils/importUtils/**", "src/utils/scriptUtils/**", @@ -18,7 +17,8 @@ "shared": { "entry": ["index.ts"], "project": ["**/*.ts"], - "includeEntryExports": false + "includeEntryExports": false, + "ignore": ["api/balances/track/changes/V0.2_TrackChange.ts"] }, "vite": { "entry": ["src/main.tsx"], diff --git a/package.json b/package.json index fbc045488..47b19e3f7 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts" ], "catalog": { + "better-auth": "catalog:", "stripe": "19.3.0-beta.1", "drizzle-orm": "0.43.1", "drizzle-kit": "^0.31.1", @@ -37,6 +38,7 @@ "t": "infisical run --env=dev -- bun scripts/test.ts", "knip": "knip", "knip:fix": "knip --fix", + "knip:fix-all": "knip --fix --allow-remove-files", "migrate-functions": "infisical run --env=dev -- bun scripts/migrations/migrate-functions.ts", "migrate-functions:prod": "infisical run --env=prod -- bun scripts/migrations/migrate-functions.ts", "validate-schema": "infisical run --env=prod -- bun scripts/migrations/validate-schema.ts", @@ -52,21 +54,11 @@ "dependencies": { "@better-auth/core": "1.4.12", "@better-auth/oauth-provider": "1.4.12", - "@wooorm/starry-night": "^3.8.0", "ag-charts-react": "^12.3.0", - "better-auth": "1.4.12", - "chalk": "^5.6.2", - "drizzle-orm": "catalog:", - "posthog-node": "^5.24.1", - "tailwind-scrollbar-hide": "^4.0.0" + "better-auth": "1.4.12" }, "devDependencies": { - "@better-auth/cli": "^1.4.12", - "@biomejs/biome": "^2.2.7", "@types/node": "^24.9.1", - "concurrently": "^9.2.1", - "dotenv": "^16.6.1", - "inquirer": "^12.10.0", "knip": "^5.82.1" } } diff --git a/scripts/package.json b/scripts/package.json index 08b83345f..40c57529c 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -11,19 +11,14 @@ }, "dependencies": { "@autumn/shared": "workspace:*", - "@aws-sdk/client-iam": "^3.958.0", "@clickhouse/client": "catalog:", "chalk": "^5.3.0", "dotenv": "^16.5.0", "drizzle-orm": "catalog:", - "ink": "^6.6.0", "inquirer": "^12.6.3", - "ora": "^9.0.0", - "p-limit": "^7.2.0", - "react": "^19.2.3" + "p-limit": "^7.2.0" }, "devDependencies": { - "@types/inquirer": "^9.0.7", "tsx": "^4.19.2", "typescript": "^5.7.3" } diff --git a/server/package.json b/server/package.json index 0d2e13e2c..cef0dd0c3 100644 --- a/server/package.json +++ b/server/package.json @@ -37,117 +37,79 @@ "license": "Apache-2.0", "dependencies": { "@ai-sdk/anthropic": "^3.0.9", - "@anthropic-ai/sdk": "^0.32.1", "@autumn/shared": "workspace:*", - "@aws-sdk/client-scheduler": "^3.958.0", "@aws-sdk/client-sqs": "^3.926.0", - "@axiomhq/pino": "^1.3.1", "@better-auth/dash": "catalog:", "@better-auth/oauth-provider": "^1.4.12", "@clickhouse/client": "^1.11.2", - "@date-fns/tz": "^1.2.0", "@date-fns/utc": "^2.1.0", "@hatchet-dev/typescript-sdk": "^1.10.5", - "@hono-rate-limiter/redis": "^0.1.4", "@hono/node-server": "^1.19.5", "@hono/zod-validator": "^0.7.3", - "@hyperbrowser/sdk": "^0.54.0", "@infisical/sdk": "^4.0.6", "@opentelemetry/api": "^1.9.0", "@opentelemetry/auto-instrumentations-node": "^0.60.1", "@opentelemetry/exporter-trace-otlp-proto": "^0.202.0", - "@opentelemetry/instrumentation-ioredis": "^0.56.0", "@opentelemetry/resources": "^2.0.1", - "@opentelemetry/sdk-metrics": "^2.0.1", "@opentelemetry/sdk-node": "^0.202.0", "@opentelemetry/sdk-trace-base": "^2.0.1", - "@opentelemetry/sdk-trace-node": "^2.0.1", "@opentelemetry/semantic-conventions": "^1.34.0", "@posthog/ai": "^7.4.2", "@puzzmo/revenue-cat-webhook-types": "^1.1.0", - "@react-email/components": "^0.0.42", "@sentry/bun": "catalog:", "@supabase/supabase-js": "^2.46.2", "@types/qs": "^6.14.0", - "@types/semver": "^7.7.1", "@typescript/native-preview": "^7.0.0-dev.20251114.1", - "@upstash/ratelimit": "^2.0.7", - "@upstash/redis": "^1.35.6", "@vercel/sdk": "^1.17.0", "ai": "^6.0.24", - "arctic": "^3.7.0", "autumn-js": "^0.1.8", "axios": "^1.8.3", - "better-auth": "^1.4.12", - "body-parser": "^1.20.3", + "better-auth": "catalog:", "bullmq": "^5.56.2", "chai": "^5.1.2", - "chai-http": "^5.1.1", "chalk": "^5.3.0", "cors": "^2.8.5", "cron": "^3.5.0", - "csv-parse": "^5.6.0", - "csv-parser": "^3.2.0", - "currency-symbol-map": "^5.1.0", "date-fns": "^4.1.0", "decimal.js": "^10.5.0", - "detect-content-type": "^1.2.0", "dotenv": "^16.5.0", "drizzle-orm": "catalog:", "express": "^4.21.1", - "express-rate-limit": "^7.5.1", - "fetch-retry": "^6.0.0", "hono": "4.9.9", "hono-rate-limiter": "^0.4.2", "http-status-codes": "^2.3.0", - "ink": "^6.3.1", - "ink-spinner": "^5.0.0", "ioredis": "^5.5.0", "jose": "^6.1.0", "ksuid": "^3.0.0", - "lodash-es": "^4.17.21", "loops": "^5.0.1", - "mime-detect": "^1.3.0", "nanoid": "^5.1.6", - "openai": "^4.85.2", - "p-limit": "^7.2.0", "pg": "^8.13.1", "pino": "^9.6.0", - "pino-pretty": "^13.0.0", "postgres": "^3.4.7", "posthog-node": "^5.20.0", "puppeteer-core": "^24.14.0", "qs": "^6.14.0", "react": "^18.2.0", "resend": "^4.1.1", - "semver": "^7.7.2", "stripe": "catalog:", "svix": "^1.45.1", - "tsc-alias": "^1.8.16", - "ws": "^8.18.0", "zod": "^3.25.23" }, "devDependencies": { "@types/bun": "^1.3.1", "@types/chai": "^5.0.1", - "@types/chai-http": "^3.0.5", "@types/cors": "^2.8.19", "@types/express": "^5.0.3", - "@types/lodash-es": "^4.17.12", "@types/mocha": "^10.0.10", "@types/node": "^25.0.7", "@types/pg": "^8.11.10", "@types/react": "^18.3.18", "@types/react-dom": "^18.3.5", - "@types/ws": "^8.18.1", "cross-env": "^7.0.3", "drizzle-kit": "catalog:", "mocha": "^11.1.0", "nodemon": "^3.1.10", "react-email": "4.0.16", - "ts-node": "^10.9.2", - "tsconfig-paths": "^4.2.0", - "tsx": "^4.21.0", "typescript": "^5.7.3" } } diff --git a/server/src/_luaScripts/luaScripts.ts b/server/src/_luaScripts/luaScripts.ts index aa821bdc9..50feb9317 100644 --- a/server/src/_luaScripts/luaScripts.ts +++ b/server/src/_luaScripts/luaScripts.ts @@ -96,7 +96,7 @@ const setSubscriptionsScript = readFileSync( export const SET_SUBSCRIPTIONS_SCRIPT = `${CACHE_KEY_UTILS}\n${setSubscriptionsScript}`; // Legacy export for backwards compatibility -export const SET_CUSTOMER_PRODUCTS_SCRIPT = SET_SUBSCRIPTIONS_SCRIPT; +const SET_CUSTOMER_PRODUCTS_SCRIPT = SET_SUBSCRIPTIONS_SCRIPT; // Prepend cache key utils to SET_CUSTOMER_DETAILS_SCRIPT const setCustomerDetailsScript = readFileSync( @@ -155,7 +155,7 @@ const setEntityScript = readFileSync( join(__dirname, "entityLuaScripts/setEntity.lua"), "utf-8", ); -export const SET_ENTITY_SCRIPT = `${CACHE_KEY_UTILS}\n${CACHE_BALANCE_UTILS}\n${CHECK_ENTITY_CACHE_EXISTS}\n${setEntityScript}`; +const SET_ENTITY_SCRIPT = `${CACHE_KEY_UTILS}\n${CACHE_BALANCE_UTILS}\n${CHECK_ENTITY_CACHE_EXISTS}\n${setEntityScript}`; // Prepend cache key utils and balance utils to SET_ENTITIES_BATCH_SCRIPT const setEntitiesBatchScript = readFileSync( @@ -185,4 +185,4 @@ export function getBatchDeductionScript(): string { return `${CACHE_KEY_UTILS}\n${LOAD_BALANCES}\n${FILTER_BALANCE_UTILS}\n${ACCUMULATOR_UTILS}\n${SUBSCRIPTION_UTILS}\n${GET_CUSTOMER_ENTITY_UTILS}\n${batchDeduction}`; } -export const BATCH_DEDUCTION_SCRIPT = getBatchDeductionScript(); +const BATCH_DEDUCTION_SCRIPT = getBatchDeductionScript(); diff --git a/server/src/cron/cronInit.ts b/server/src/cron/cronInit.ts index 86a6c3847..761eb1703 100644 --- a/server/src/cron/cronInit.ts +++ b/server/src/cron/cronInit.ts @@ -17,7 +17,7 @@ import type { CronContext } from "./utils/CronContext.js"; const { db, client } = initDrizzle(); -export const cronTask = async () => { +const cronTask = async () => { try { // const [productCusEnts, looseCusEnts] = await Promise.all([ // CusEntService.getActiveResetPassed({ db, batchSize: 500 }), diff --git a/server/src/db/cteUtils/strategies/relationGraph.ts b/server/src/db/cteUtils/strategies/relationGraph.ts index 30a90954a..668d6f134 100644 --- a/server/src/db/cteUtils/strategies/relationGraph.ts +++ b/server/src/db/cteUtils/strategies/relationGraph.ts @@ -7,7 +7,7 @@ import { type CTEMode, inferMode } from "../typeDetection.js"; /** * Get table name from Drizzle table object */ -export function getTableName(table: PgTable): string { +function getTableName(table: PgTable): string { return (table as any)[Symbol.for("drizzle:Name")] || String(table); } @@ -27,7 +27,7 @@ export interface RelationNode { /** * Parse join condition SQL to extract column names */ -export function parseJoinCondition({ +function parseJoinCondition({ joinCondition, parentTableName, targetTableName, diff --git a/server/src/db/cteUtils/strategies/strategySelector.ts b/server/src/db/cteUtils/strategies/strategySelector.ts index bed688f2d..f1b45aec0 100644 --- a/server/src/db/cteUtils/strategies/strategySelector.ts +++ b/server/src/db/cteUtils/strategies/strategySelector.ts @@ -2,12 +2,12 @@ import type { CTEConfig } from "../buildCte.js"; import { CTEBuilder } from "../buildCte.js"; import { inferMode } from "../typeDetection.js"; -export type QueryStrategy = "correlated" | "join_group_by"; +type QueryStrategy = "correlated" | "join_group_by"; /** * Calculate the maximum nesting depth of a CTE configuration */ -export function calculateNestingDepth({ +function calculateNestingDepth({ config, current = 0, }: { @@ -31,7 +31,7 @@ export function calculateNestingDepth({ /** * Detect if any nested relations will return arrays (one-to-many) */ -export function detectArrayRelations({ +function detectArrayRelations({ config, }: { config: CTEConfig; diff --git a/server/src/db/initClickHouse.ts b/server/src/db/initClickHouse.ts index 3c17e12af..af9415ff8 100644 --- a/server/src/db/initClickHouse.ts +++ b/server/src/db/initClickHouse.ts @@ -7,4 +7,4 @@ export const clickhouseClient: ClickHouseClient = createClient({ max_open_connections: 10, }); -export const clickhouse = clickhouseClient; +const clickhouse = clickhouseClient; diff --git a/server/src/external/autumn/autumnCliV2.ts b/server/src/external/autumn/autumnCliV2.ts index 0970b50e9..703a28572 100644 --- a/server/src/external/autumn/autumnCliV2.ts +++ b/server/src/external/autumn/autumnCliV2.ts @@ -24,7 +24,7 @@ import type { UsageParams, } from "autumn-js"; -export default class AutumnError extends Error { +class AutumnError extends Error { message: string; code: string; diff --git a/server/src/external/autumn/autumnUtils.ts b/server/src/external/autumn/autumnUtils.ts index afc1d74f9..eeabc85e0 100644 --- a/server/src/external/autumn/autumnUtils.ts +++ b/server/src/external/autumn/autumnUtils.ts @@ -5,7 +5,6 @@ import RecaseError from "@/utils/errorUtils.js"; export enum FeatureId { Products = "products", - Features = "features", Revenue = "revenue", } diff --git a/server/src/external/redis/initRedis.ts b/server/src/external/redis/initRedis.ts index cd8e931e1..164be4cf7 100644 --- a/server/src/external/redis/initRedis.ts +++ b/server/src/external/redis/initRedis.ts @@ -25,11 +25,11 @@ import { // } // Region constants -export const REGION_US_EAST_2 = "us-east-2"; -export const REGION_US_WEST_2 = "us-west-2"; +const REGION_US_EAST_2 = "us-east-2"; +const REGION_US_WEST_2 = "us-west-2"; // All configured regions -export const ALL_REGIONS = [REGION_US_EAST_2, REGION_US_WEST_2] as const; +const ALL_REGIONS = [REGION_US_EAST_2, REGION_US_WEST_2] as const; // Current region this instance is running in export const currentRegion = process.env.AWS_REGION || REGION_US_WEST_2; diff --git a/server/src/external/resend/loopsUtils.ts b/server/src/external/resend/loopsUtils.ts index 7ca658acc..594a64669 100644 --- a/server/src/external/resend/loopsUtils.ts +++ b/server/src/external/resend/loopsUtils.ts @@ -26,4 +26,4 @@ export const createLoopsContact = async (user: User) => { } }; -export { createLoopsCli }; +; diff --git a/server/src/external/resend/resendUtils.ts b/server/src/external/resend/resendUtils.ts index c2b2a4146..76c894ba3 100644 --- a/server/src/external/resend/resendUtils.ts +++ b/server/src/external/resend/resendUtils.ts @@ -1,7 +1,7 @@ import { Resend } from "resend"; import { logger } from "../logtail/logtailUtils.js"; -export interface ResendEmailProps { +interface ResendEmailProps { to: string; subject: string; body: string; diff --git a/server/src/external/revenueCat/misc/initRevenuecatCli.ts b/server/src/external/revenueCat/misc/initRevenuecatCli.ts index 0e1d3cc89..6067d3314 100644 --- a/server/src/external/revenueCat/misc/initRevenuecatCli.ts +++ b/server/src/external/revenueCat/misc/initRevenuecatCli.ts @@ -1,7 +1,7 @@ import { decryptData } from "@server/utils/encryptUtils.js"; import type { RevenueCatProductsResponse } from "../revenuecatTypes"; -export type ListRevenuecatProductsResponse = { +type ListRevenuecatProductsResponse = { products: { id: string; name: string }[]; }; diff --git a/server/src/external/revenueCat/misc/revenueCatMiddleware.ts b/server/src/external/revenueCat/misc/revenueCatMiddleware.ts index 68679cf68..137db0b86 100644 --- a/server/src/external/revenueCat/misc/revenueCatMiddleware.ts +++ b/server/src/external/revenueCat/misc/revenueCatMiddleware.ts @@ -51,7 +51,7 @@ export const revenuecatSeederMiddleware = async ( await next(); }; -export const logRevCatWebhook = ({ +const logRevCatWebhook = ({ logger, org, event, diff --git a/server/src/external/revenueCat/revenuecatTypes.ts b/server/src/external/revenueCat/revenuecatTypes.ts index 49dc0095d..0277b8657 100644 --- a/server/src/external/revenueCat/revenuecatTypes.ts +++ b/server/src/external/revenueCat/revenuecatTypes.ts @@ -1,17 +1,17 @@ // RevenueCat Webhook Event Types -export type RevCatExperiment = { +type RevCatExperiment = { experiment_id: string; experiment_variant: string; enrolled_at_ms: number; }; -export type RevCatSubscriberAttribute = { +type RevCatSubscriberAttribute = { updated_at_ms: number; value: string; }; -export type RevCatEvent = { +type RevCatEvent = { event_timestamp_ms: number; product_id: string; period_type: "NORMAL" | "INTRO" | "TRIAL"; @@ -69,19 +69,19 @@ export type RevCatEvent = { experiments: RevCatExperiment[]; }; -export type RevCatWebhookPayload = { +type RevCatWebhookPayload = { event: RevCatEvent; api_version: string; }; -export type RevenueCatOfferings = { +type RevenueCatOfferings = { object: "list"; items: RevenueCatOffering[]; next_page: string | null; url: string; }; -export type RevenueCatOffering = { +type RevenueCatOffering = { object: "offering"; id: string; lookup_key: string | null; @@ -95,14 +95,14 @@ export type RevenueCatOffering = { packages: RevenueCatOfferingPackageList; }; -export type RevenueCatOfferingPackageList = { +type RevenueCatOfferingPackageList = { object: "list"; items: RevenueCatOfferingPackage[]; next_page: string | null; url: string; }; -export type RevenueCatOfferingPackage = { +type RevenueCatOfferingPackage = { object: "package"; id: string; lookup_key: string | null; @@ -112,27 +112,27 @@ export type RevenueCatOfferingPackage = { products: RevenueCatOfferingProductList; }; -export type RevenueCatOfferingProductList = { +type RevenueCatOfferingProductList = { object: "list"; items: RevenueCatOfferingProductItem[]; next_page: string | null; url: string; }; -export type RevenueCatOfferingProductItem = { +type RevenueCatOfferingProductItem = { product: Record; eligibility_criteria: string; }; // RevenueCat Products API Types -export type RevenueCatProductSubscription = { +type RevenueCatProductSubscription = { duration: string; grace_period_duration?: string; trial_duration?: string; }; -export type RevenueCatProductOneTime = { +type RevenueCatProductOneTime = { is_consumable: boolean; }; diff --git a/server/src/external/stripe/createStripePrice/createStripeArrearProrated.ts b/server/src/external/stripe/createStripePrice/createStripeArrearProrated.ts index 2d17a6ed6..ebd118148 100644 --- a/server/src/external/stripe/createStripePrice/createStripeArrearProrated.ts +++ b/server/src/external/stripe/createStripePrice/createStripeArrearProrated.ts @@ -19,7 +19,7 @@ import type Stripe from "stripe"; import { billingIntervalToStripe } from "../stripePriceUtils"; import { priceToInArrearTiers } from "./createStripeInArrear"; -export interface StripeMeteredPriceParams { +interface StripeMeteredPriceParams { stripeCli: Stripe; price: Price; entitlements: EntitlementWithFeature[]; @@ -108,7 +108,7 @@ export const createStripeMeteredPrice = async ({ return stripePrice; }; -export const arrearProratedToStripeTiers = ( +const arrearProratedToStripeTiers = ( price: Price, entitlement: EntitlementWithFeature, ) => { diff --git a/server/src/external/stripe/createStripePrice/createStripeInArrear.ts b/server/src/external/stripe/createStripePrice/createStripeInArrear.ts index 01ff36959..ef3f612b1 100644 --- a/server/src/external/stripe/createStripePrice/createStripeInArrear.ts +++ b/server/src/external/stripe/createStripePrice/createStripeInArrear.ts @@ -19,7 +19,7 @@ import { StatusCodes } from "http-status-codes"; import type Stripe from "stripe"; import { billingIntervalToStripe } from "../stripePriceUtils"; -export const searchStripeMeter = async ({ +const searchStripeMeter = async ({ stripeCli, eventName, meterId, @@ -60,7 +60,7 @@ export const searchStripeMeter = async ({ return stripeMeter; }; -export const getStripeMeter = async ({ +const getStripeMeter = async ({ product, feature, stripeCli, diff --git a/server/src/external/stripe/createStripePrice/createStripePrepaid.ts b/server/src/external/stripe/createStripePrice/createStripePrepaid.ts index 62c316d57..32eb702c8 100644 --- a/server/src/external/stripe/createStripePrice/createStripePrepaid.ts +++ b/server/src/external/stripe/createStripePrice/createStripePrepaid.ts @@ -15,7 +15,7 @@ import { getPriceEntitlement } from "@server/internal/products/prices/priceUtils import type Stripe from "stripe"; import { billingIntervalToStripe } from "../stripePriceUtils"; -export const prepaidToStripeTiers = ({ +const prepaidToStripeTiers = ({ price, org, }: { diff --git a/server/src/external/stripe/createStripePrice/createStripePrice.ts b/server/src/external/stripe/createStripePrice/createStripePrice.ts index 915ca2a56..655d628a1 100644 --- a/server/src/external/stripe/createStripePrice/createStripePrice.ts +++ b/server/src/external/stripe/createStripePrice/createStripePrice.ts @@ -24,7 +24,7 @@ import { createStripeInArrearPrice } from "./createStripeInArrear"; import { createStripeOneOffTieredProduct } from "./createStripeOneOffTiered"; import { createStripePrepaid } from "./createStripePrepaid"; -export const checkCurStripePrice = async ({ +const checkCurStripePrice = async ({ price, stripeCli, currency, diff --git a/server/src/external/stripe/invoices/utils/convertStripeInvoice.ts b/server/src/external/stripe/invoices/utils/convertStripeInvoice.ts index e46c4c443..af6e8ebd5 100644 --- a/server/src/external/stripe/invoices/utils/convertStripeInvoice.ts +++ b/server/src/external/stripe/invoices/utils/convertStripeInvoice.ts @@ -11,7 +11,7 @@ export const stripeInvoiceToStripeSubscriptionId = ( /** * Finds the payment intent from a specific invoice. */ -export const stripeInvoiceIdToPaymentIntent = async ({ +const stripeInvoiceIdToPaymentIntent = async ({ stripeClient, invoiceId, }: { diff --git a/server/src/external/stripe/stripeCardUtils.ts b/server/src/external/stripe/stripeCardUtils.ts index 92ac41d87..aa526ecd1 100644 --- a/server/src/external/stripe/stripeCardUtils.ts +++ b/server/src/external/stripe/stripeCardUtils.ts @@ -7,7 +7,7 @@ import type { import { createStripeCli } from "../connect/createStripeCli.js"; -export const isStripeCardDeclined = (error: any) => { +const isStripeCardDeclined = (error: any) => { return ( error.code === "card_declined" || error.code === "expired_card" || diff --git a/server/src/external/stripe/stripeCusUtils.ts b/server/src/external/stripe/stripeCusUtils.ts index b3348034d..e94fa8217 100644 --- a/server/src/external/stripe/stripeCusUtils.ts +++ b/server/src/external/stripe/stripeCusUtils.ts @@ -14,7 +14,7 @@ import { CusService } from "@/internal/customers/CusService.js"; import RecaseError from "@/utils/errorUtils.js"; import type { TestContext } from "../../../tests/utils/testInitUtils/createTestContext"; -export const getStripeCus = async ({ +const getStripeCus = async ({ stripeCli, stripeId, }: { @@ -245,7 +245,7 @@ export const attachAuthenticatePaymentMethod = async ({ }); }; -export const deleteAllStripeCustomers = async ({ +const deleteAllStripeCustomers = async ({ org, env, }: { diff --git a/server/src/external/stripe/stripeEnsureUtils.ts b/server/src/external/stripe/stripeEnsureUtils.ts index 101d0e9b9..dba5712d0 100644 --- a/server/src/external/stripe/stripeEnsureUtils.ts +++ b/server/src/external/stripe/stripeEnsureUtils.ts @@ -4,7 +4,7 @@ import { OrgService } from "@/internal/orgs/OrgService.js"; import { ProductService } from "@/internal/products/ProductService.js"; import { initProductInStripe } from "@/internal/products/productUtils.js"; -export async function ensureStripeProducts({ ctx }: { ctx: AutumnContext }) { +async function ensureStripeProducts({ ctx }: { ctx: AutumnContext }) { await ensureStripeProductsWithEnv({ ctx, }); diff --git a/server/src/external/stripe/stripeInvoiceUtils.ts b/server/src/external/stripe/stripeInvoiceUtils.ts index 43fc12c0c..7bfa01383 100644 --- a/server/src/external/stripe/stripeInvoiceUtils.ts +++ b/server/src/external/stripe/stripeInvoiceUtils.ts @@ -226,7 +226,7 @@ export const getInvoiceDiscounts = ({ return autumnDiscounts; }; -export const getInvoiceExpansion = () => { +const getInvoiceExpansion = () => { return { expand: ["discounts", "discounts.coupon"], }; diff --git a/server/src/external/stripe/stripePriceUtils.ts b/server/src/external/stripe/stripePriceUtils.ts index 94f492573..f63e4fb8c 100644 --- a/server/src/external/stripe/stripePriceUtils.ts +++ b/server/src/external/stripe/stripePriceUtils.ts @@ -11,7 +11,7 @@ import { import { getCusPriceUsage } from "@server/internal/customers/cusProducts/cusPrices/cusPriceUtils"; import type Stripe from "stripe"; -export const createSubMeta = ({ features }: { features: Feature[] }) => { +const createSubMeta = ({ features }: { features: Feature[] }) => { const usageFeatures = features.map((f) => ({ internal_id: f.internal_id, id: f.id, @@ -109,7 +109,7 @@ export const getInvoiceItemForUsage = ({ return invoiceItem; }; -export const getPlaceholderItem = ({ +const getPlaceholderItem = ({ product, org, interval, @@ -136,7 +136,7 @@ export const getPlaceholderItem = ({ }; }; -export const createEmptySubItem = ({ +const createEmptySubItem = ({ recurring, stripeProductId, }: { diff --git a/server/src/external/stripe/stripeSubUtils.ts b/server/src/external/stripe/stripeSubUtils.ts index 6e79bf8ec..4b1d7b56a 100644 --- a/server/src/external/stripe/stripeSubUtils.ts +++ b/server/src/external/stripe/stripeSubUtils.ts @@ -75,7 +75,7 @@ export const getStripeSubs = async ({ return subs as Stripe.Subscription[]; }; -export const stripeToAutumnSubStatus = (stripeSubStatus: string) => { +const stripeToAutumnSubStatus = (stripeSubStatus: string) => { switch (stripeSubStatus) { case "trialing": return CusProductStatus.Active; @@ -91,7 +91,7 @@ export const stripeToAutumnSubStatus = (stripeSubStatus: string) => { } }; -export const deleteScheduledIds = async ({ +const deleteScheduledIds = async ({ stripeCli, scheduledIds, }: { @@ -108,7 +108,7 @@ export const deleteScheduledIds = async ({ }; // Get in advance sub -export const getUsageBasedSub = async ({ +const getUsageBasedSub = async ({ db, stripeCli, subIds, @@ -173,7 +173,7 @@ export const getUsageBasedSub = async ({ return null; }; -export const getSubItemsForCusProduct = async ({ +const getSubItemsForCusProduct = async ({ stripeSub, cusProduct, }: { @@ -265,7 +265,7 @@ export const getStripeSchedules = async ({ }; // OTHERS -export const subIsPrematurelyCanceled = (sub: Stripe.Subscription) => { +const subIsPrematurelyCanceled = (sub: Stripe.Subscription) => { if (sub.cancel_at_period_end) { return false; } @@ -275,7 +275,7 @@ export const subIsPrematurelyCanceled = (sub: Stripe.Subscription) => { return differenceInSeconds(periodEnd * 1000, sub.cancel_at! * 1000) > 20; }; -export const autumnToStripeProrationBehavior = ({ +const autumnToStripeProrationBehavior = ({ prorationBehavior, }: { prorationBehavior: ProrationBehavior; @@ -290,7 +290,7 @@ export const autumnToStripeProrationBehavior = ({ } }; -export const getStripeProrationBehavior = ({ +const getStripeProrationBehavior = ({ org, prorationBehavior, }: { diff --git a/server/src/external/stripe/stripeSubUtils/stripeSubItemUtils.ts b/server/src/external/stripe/stripeSubUtils/stripeSubItemUtils.ts index fe5eb0851..8189ecc0f 100644 --- a/server/src/external/stripe/stripeSubUtils/stripeSubItemUtils.ts +++ b/server/src/external/stripe/stripeSubUtils/stripeSubItemUtils.ts @@ -167,7 +167,7 @@ export const findStripePriceFromPrices = ({ ); }; -export const lineItemInCusProduct = ({ +const lineItemInCusProduct = ({ cusProduct, lineItem, }: { @@ -199,7 +199,7 @@ export const subItemInCusProduct = ({ return stripeProdId === subItem.price.product || notNullish(price); }; -export const scheduleItemToPrice = ({ +const scheduleItemToPrice = ({ scheduleItem, cusProducts, }: { @@ -255,7 +255,7 @@ export const isLicenseItem = ({ return stripeItem.price?.recurring?.usage_type === "licensed"; }; -export const isMeteredItem = ({ +const isMeteredItem = ({ stripeItem, }: { stripeItem: Stripe.SubscriptionItem | Stripe.LineItem; diff --git a/server/src/external/stripe/stripeSubUtils/updateStripeSub/createProrationinvoice.ts b/server/src/external/stripe/stripeSubUtils/updateStripeSub/createProrationinvoice.ts index c02fd5ae5..1b39ea52e 100644 --- a/server/src/external/stripe/stripeSubUtils/updateStripeSub/createProrationinvoice.ts +++ b/server/src/external/stripe/stripeSubUtils/updateStripeSub/createProrationinvoice.ts @@ -7,7 +7,7 @@ import { attachParamsToMetadata } from "../../../../internal/billing/attach/util import type { Logger } from "../../../logtail/logtailUtils.js"; import { payForInvoice } from "../../stripeInvoiceUtils.js"; -export const undoSubUpdate = async ({ +const undoSubUpdate = async ({ stripeCli, curSub, updatedSub, diff --git a/server/src/external/stripe/subscriptionSchedules/utils/logStripeSchedulePhaseUtils.ts b/server/src/external/stripe/subscriptionSchedules/utils/logStripeSchedulePhaseUtils.ts index 63d69be4f..6148a25e8 100644 --- a/server/src/external/stripe/subscriptionSchedules/utils/logStripeSchedulePhaseUtils.ts +++ b/server/src/external/stripe/subscriptionSchedules/utils/logStripeSchedulePhaseUtils.ts @@ -9,13 +9,13 @@ import type Stripe from "stripe"; import type { AutumnContext } from "@/honoUtils/HonoEnv"; /** Price with associated product name for logging. */ -export type PriceWithProduct = { +type PriceWithProduct = { price: Price; productName: string; }; /** Generic phase item type that works for both response and update params. */ -export type PhaseItem = { +type PhaseItem = { price?: string | Stripe.Price | Stripe.DeletedPrice; quantity?: number; }; @@ -46,7 +46,7 @@ export const customerProductsToPricesWithProduct = ({ /** * Matches a Stripe price ID to an Autumn price with product info. */ -export const matchStripePriceIdToAutumnPrice = ({ +const matchStripePriceIdToAutumnPrice = ({ stripePriceId, pricesWithProduct, }: { @@ -68,7 +68,7 @@ export const matchStripePriceIdToAutumnPrice = ({ /** * Formats a phase item for logging by matching Stripe price ID to Autumn price. */ -export const formatPhaseItemWithAutumnPrice = ({ +const formatPhaseItemWithAutumnPrice = ({ item, pricesWithProduct, }: { @@ -203,7 +203,7 @@ export const logPhase = ({ * Iterates through phases and logs each one with timing and items. * Optionally shows customer products with their statuses. */ -export const logPhases = ({ +const logPhases = ({ ctx, phases, customerProducts, diff --git a/server/src/external/stripe/subscriptions/utils/classifyStripeSubscriptionUtils.ts b/server/src/external/stripe/subscriptions/utils/classifyStripeSubscriptionUtils.ts index ad592405f..a3a86162e 100644 --- a/server/src/external/stripe/subscriptions/utils/classifyStripeSubscriptionUtils.ts +++ b/server/src/external/stripe/subscriptions/utils/classifyStripeSubscriptionUtils.ts @@ -3,7 +3,7 @@ import type Stripe from "stripe"; import { getLatestPeriodEnd } from "@/external/stripe/stripeSubUtils/convertSubUtils"; /** Stripe subscription that is trialing with guaranteed trial_end */ -export type TrialingStripeSubscription = Stripe.Subscription & { +type TrialingStripeSubscription = Stripe.Subscription & { status: "trialing"; trial_end: number; }; diff --git a/server/src/external/stripe/subscriptions/utils/lockStripeSubscriptionUtils.ts b/server/src/external/stripe/subscriptions/utils/lockStripeSubscriptionUtils.ts index 809b371ba..9ed66e31f 100644 --- a/server/src/external/stripe/subscriptions/utils/lockStripeSubscriptionUtils.ts +++ b/server/src/external/stripe/subscriptions/utils/lockStripeSubscriptionUtils.ts @@ -21,7 +21,7 @@ export const setStripeSubscriptionLock = async ({ ); }; -export type StripeSubscriptionLock = { +type StripeSubscriptionLock = { lockedAtMs: number; }; diff --git a/server/src/external/stripe/utils.ts b/server/src/external/stripe/utils.ts index a5a4ff0f9..6e1c7964e 100644 --- a/server/src/external/stripe/utils.ts +++ b/server/src/external/stripe/utils.ts @@ -6,7 +6,7 @@ import { } from "@autumn/shared"; import type Stripe from "stripe"; -export const calculateMetered1Price = ({ +const calculateMetered1Price = ({ product, numEvents, metered1Feature, @@ -91,7 +91,7 @@ export const subToAutumnInterval = (sub: Stripe.Subscription) => { // return BillingInterval.Year; // } // }; -export const subItemToAutumnInterval = (item: Stripe.SubscriptionItem) => { +const subItemToAutumnInterval = (item: Stripe.SubscriptionItem) => { return { interval: item.price.recurring?.interval as BillingInterval, intervalCount: item.price.recurring?.interval_count || 1, diff --git a/server/src/external/stripe/webhookHandlers/common/index.ts b/server/src/external/stripe/webhookHandlers/common/index.ts index 88982be27..fc584923e 100644 --- a/server/src/external/stripe/webhookHandlers/common/index.ts +++ b/server/src/external/stripe/webhookHandlers/common/index.ts @@ -1,11 +1,8 @@ -export { - type BaseWebhookEventContext, - buildBillingContextForArrearInvoice, -} from "./buildBillingContextFromWebhook"; +; export { eventContextToArrearLineItems } from "./eventContextToArrearLineItems"; export { logCustomerProductUpdates } from "./logCustomerProductUpdates"; export { - type SubscriptionEventContext, + trackCustomerProductDeletion, trackCustomerProductUpdate, } from "./trackCustomerProductUpdate"; diff --git a/server/src/external/stripe/webhookHandlers/common/trackCustomerProductUpdate.ts b/server/src/external/stripe/webhookHandlers/common/trackCustomerProductUpdate.ts index f1c6a96c9..1b45edde8 100644 --- a/server/src/external/stripe/webhookHandlers/common/trackCustomerProductUpdate.ts +++ b/server/src/external/stripe/webhookHandlers/common/trackCustomerProductUpdate.ts @@ -2,7 +2,7 @@ import type { FullCusProduct, InsertCustomerProduct } from "@autumn/shared"; import type { StripeSubscriptionDeletedContext } from "../handleStripeSubscriptionDeleted/setupStripeSubscriptionDeletedContext"; import type { StripeSubscriptionUpdatedContext } from "../handleStripeSubscriptionUpdated/stripeSubscriptionUpdatedContext"; -export type SubscriptionEventContext = +type SubscriptionEventContext = | StripeSubscriptionUpdatedContext | StripeSubscriptionDeletedContext; diff --git a/server/src/external/stripe/webhookHandlers/handleInvoiceCreated/handleInvoiceCreated.ts b/server/src/external/stripe/webhookHandlers/handleInvoiceCreated/handleInvoiceCreated.ts index 4cb58ae33..4450ca428 100644 --- a/server/src/external/stripe/webhookHandlers/handleInvoiceCreated/handleInvoiceCreated.ts +++ b/server/src/external/stripe/webhookHandlers/handleInvoiceCreated/handleInvoiceCreated.ts @@ -132,7 +132,7 @@ export const sendUsageAndReset = async ({ } }; -export const handleInvoiceCreated = async ({ +const handleInvoiceCreated = async ({ db, org, data, @@ -205,7 +205,7 @@ export const handleInvoiceCreated = async ({ } }; -export const validateProductShouldReset = ({ +const validateProductShouldReset = ({ subscription, _invoice, }: { diff --git a/server/src/external/stripe/webhookHandlers/handleStripeInvoicePaid/tasks/handleStripeInvoiceMetadata/handleStripeInvoiceMetadata.ts b/server/src/external/stripe/webhookHandlers/handleStripeInvoicePaid/tasks/handleStripeInvoiceMetadata/handleStripeInvoiceMetadata.ts index 9ee3a5e13..819ff91ca 100644 --- a/server/src/external/stripe/webhookHandlers/handleStripeInvoicePaid/tasks/handleStripeInvoiceMetadata/handleStripeInvoiceMetadata.ts +++ b/server/src/external/stripe/webhookHandlers/handleStripeInvoicePaid/tasks/handleStripeInvoiceMetadata/handleStripeInvoiceMetadata.ts @@ -1,6 +1,6 @@ import { MetadataType } from "@autumn/shared"; -import { handleInvoiceActionRequiredCompleted } from "@/external/stripe/webhookHandlers/legacy/handleInvoicePaid/handleInvoiceActionRequiredCompleted.js"; -import { handleInvoiceCheckoutPaid } from "@/external/stripe/webhookHandlers/legacy/handleInvoicePaid/handleInvoiceCheckoutPaid.js"; +import { handleInvoiceActionRequiredCompleted } from "@/external/stripe/webhookHandlers/handleStripeInvoicePaid/tasks/handleStripeInvoiceMetadata/handleInvoiceActionRequiredCompleted.js"; +import { handleInvoiceCheckoutPaid } from "@/external/stripe/webhookHandlers/handleStripeInvoicePaid/tasks/handleStripeInvoiceMetadata/handleInvoiceCheckoutPaid.js"; import type { StripeWebhookContext } from "@/external/stripe/webhookMiddlewares/stripeWebhookContext.js"; import { executeDeferredBillingPlan } from "@/internal/billing/v2/execute/executeDeferredBillingPlan.js"; import type { AttachParams } from "@/internal/customers/cusProducts/AttachParams.js"; @@ -42,7 +42,7 @@ export const handleStripeInvoiceMetadata = async ({ if (metadata.type === MetadataType.InvoiceActionRequired) { await handleInvoiceActionRequiredCompleted({ ctx, - invoice: stripeInvoice, + stripeInvoice, metadata, }); return; diff --git a/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleCancelOnPastDue.ts b/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleCancelOnPastDue.ts index 02105ad0e..599fad67d 100644 --- a/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleCancelOnPastDue.ts +++ b/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleCancelOnPastDue.ts @@ -10,7 +10,7 @@ import type { /** * Detects if a subscription.updated event represents a transition to past_due. */ -export const isStripeSubscriptionPastDueEvent = ({ +const isStripeSubscriptionPastDueEvent = ({ stripeSubscription, previousAttributes, }: { diff --git a/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleStripeSubscriptionCanceled/isStripeSubscriptionCanceledEvent.ts b/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleStripeSubscriptionCanceled/isStripeSubscriptionCanceledEvent.ts index a9aa3632e..27800df92 100644 --- a/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleStripeSubscriptionCanceled/isStripeSubscriptionCanceledEvent.ts +++ b/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleStripeSubscriptionCanceled/isStripeSubscriptionCanceledEvent.ts @@ -2,7 +2,7 @@ import type { ExpandedStripeSubscription } from "@/external/stripe/subscriptions import { nullish } from "@/utils/genUtils"; import type { SubscriptionPreviousAttributes } from "../../stripeSubscriptionUpdatedContext"; -export interface CancellationInfo { +interface CancellationInfo { canceled: boolean; canceledAtMs: number | null; cancelsAtMs: number | null; diff --git a/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleStripeSubscriptionRenewed/isStripeSubscriptionRenewedEvent.ts b/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleStripeSubscriptionRenewed/isStripeSubscriptionRenewedEvent.ts index 40ff10387..8b9dfbd13 100644 --- a/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleStripeSubscriptionRenewed/isStripeSubscriptionRenewedEvent.ts +++ b/server/src/external/stripe/webhookHandlers/handleStripeSubscriptionUpdated/tasks/handleStripeSubscriptionRenewed/isStripeSubscriptionRenewedEvent.ts @@ -2,7 +2,7 @@ import type { ExpandedStripeSubscription } from "@/external/stripe/subscriptions import { notNullish, nullish } from "@/utils/genUtils"; import type { SubscriptionPreviousAttributes } from "../../stripeSubscriptionUpdatedContext"; -export interface RenewalInfo { +interface RenewalInfo { renewed: boolean; renewedAtMs: number; } diff --git a/server/src/external/stripe/webhookMiddlewares/stripeToAutumnCustomerMiddleware.ts b/server/src/external/stripe/webhookMiddlewares/stripeToAutumnCustomerMiddleware.ts index 9a3958798..571ef4538 100644 --- a/server/src/external/stripe/webhookMiddlewares/stripeToAutumnCustomerMiddleware.ts +++ b/server/src/external/stripe/webhookMiddlewares/stripeToAutumnCustomerMiddleware.ts @@ -6,7 +6,7 @@ import type { StripeWebhookHonoEnv, } from "./stripeWebhookContext"; -export const getAutumnCustomerId = async ({ +const getAutumnCustomerId = async ({ ctx, }: { ctx: StripeWebhookContext; diff --git a/server/src/external/supabase/storageUtils.ts b/server/src/external/supabase/storageUtils.ts index b55949474..0288ecb1c 100644 --- a/server/src/external/supabase/storageUtils.ts +++ b/server/src/external/supabase/storageUtils.ts @@ -1,6 +1,6 @@ import { createSupabaseClient } from "@/external/supabase/createSupabaseClient"; -export const readFile = async ({ +const readFile = async ({ bucket = "autumn", path, }: { @@ -16,7 +16,7 @@ export const readFile = async ({ return data; }; -export const uploadFile = async ({ +const uploadFile = async ({ path, file, contentType, diff --git a/server/src/external/upstash/rateLimitUtils.ts b/server/src/external/upstash/rateLimitUtils.ts index 4bfbd62fa..f2fa52107 100644 --- a/server/src/external/upstash/rateLimitUtils.ts +++ b/server/src/external/upstash/rateLimitUtils.ts @@ -154,7 +154,7 @@ export const getRateLimitKey = async ({ } }; -export const getRateLimitConfig = ({ +const getRateLimitConfig = ({ rateLimitType, }: { rateLimitType: RateLimitType; diff --git a/server/src/external/vercel/handlers/handleListBillingPlans.ts b/server/src/external/vercel/handlers/handleListBillingPlans.ts index 07e59e3da..fe4ce81d6 100644 --- a/server/src/external/vercel/handlers/handleListBillingPlans.ts +++ b/server/src/external/vercel/handlers/handleListBillingPlans.ts @@ -134,7 +134,7 @@ export function productToBillingPlan({ return bp; } -export const listVercelPlansForOrg = async ({ +const listVercelPlansForOrg = async ({ db, org, env, diff --git a/server/src/external/vercel/misc/vercelTypes.ts b/server/src/external/vercel/misc/vercelTypes.ts index f747b1107..f25f33aba 100644 --- a/server/src/external/vercel/misc/vercelTypes.ts +++ b/server/src/external/vercel/misc/vercelTypes.ts @@ -33,7 +33,7 @@ export type VercelBillingPlan = { /** * Vercel Installation type for Vercel Billing endpoints. */ -export type VercelInstallation = { +type VercelInstallation = { billingPlan: { id: string; // Partner-provided billing plan. Example: "pro200" type: "prepayment" | "subscription"; @@ -103,7 +103,7 @@ export type VercelUpsertInstallation = { * Type for a Vercel Provisioned Resource. * Represents all configuration and status for a user's provisioned integration resource. */ -export type VercelResource = { +type VercelResource = { id: string; // The partner-specific ID of the resource productId: string; // The partner-specific ID/slug of the product, eg. "redis" protocolSettings?: { @@ -171,7 +171,7 @@ export type VercelResource = { }>; // Secret values for this resource }; -export type VercelMarketplaceInvoice = { +type VercelMarketplaceInvoice = { configuration: { id: string; }; diff --git a/server/src/honoMiddlewares/errorSkipMiddleware.ts b/server/src/honoMiddlewares/errorSkipMiddleware.ts index 6c20d82ab..d81516b98 100644 --- a/server/src/honoMiddlewares/errorSkipMiddleware.ts +++ b/server/src/honoMiddlewares/errorSkipMiddleware.ts @@ -289,6 +289,6 @@ export const handleErrorSkip = (err: Error, c: Context) => { * Note: This doesn't actually prevent errors from reaching onError handler * It's used within the main error handler to check for skip cases */ -export const errorSkipMiddleware = (err: Error, c: Context) => { +const errorSkipMiddleware = (err: Error, c: Context) => { return handleErrorSkip(err, c); }; diff --git a/server/src/initHono.ts b/server/src/initHono.ts index 11e0620d3..7d928efe4 100644 --- a/server/src/initHono.ts +++ b/server/src/initHono.ts @@ -57,7 +57,7 @@ const ALLOWED_HEADERS = [ "User-Agent", // Required for better-auth v1.4.0+ compatibility with Safari/Zen browser ]; -export const createHonoApp = () => { +const createHonoApp = () => { const app = new Hono(); // CORS configuration (must be before routes) diff --git a/server/src/internal/analytics/actionUtils.ts b/server/src/internal/analytics/actionUtils.ts index b75c0383e..292655155 100644 --- a/server/src/internal/analytics/actionUtils.ts +++ b/server/src/internal/analytics/actionUtils.ts @@ -26,7 +26,7 @@ export const parseCtxForAction = ({ } as Partial; }; -export const constructAction = ({ +const constructAction = ({ org, env, customer, diff --git a/server/src/internal/analytics/analyticsUtils.ts b/server/src/internal/analytics/analyticsUtils.ts index cced54d94..117c91d26 100644 --- a/server/src/internal/analytics/analyticsUtils.ts +++ b/server/src/internal/analytics/analyticsUtils.ts @@ -48,7 +48,7 @@ export async function getBillingCycleStartDate( ); } -export function checkIfAllProductsAreFree( +function checkIfAllProductsAreFree( fullProducts: FullProduct[], ): boolean { return fullProducts.every((product: FullProduct) => { @@ -58,11 +58,11 @@ export function checkIfAllProductsAreFree( }); } -export function formatDateToString(date: Date): string { +function formatDateToString(date: Date): string { return date.toISOString().replace("T", " ").split(".")[0]; } -export function getDateRangesFromSubscriptions( +function getDateRangesFromSubscriptions( customerProductsFiltered: FullCusProduct[], subscriptions: Subscription[], ): { startDates: string[]; endDates: string[]; createdDates: string[] } { @@ -98,7 +98,7 @@ export function getDateRangesFromSubscriptions( return { startDates, endDates, createdDates }; } -export function getDateRangesFromEntitlements( +function getDateRangesFromEntitlements( customerProducts?: FullCusProduct[], ): { startDates: string[]; endDates: string[]; createdDates: string[] } { const startDates: string[] = []; @@ -143,7 +143,7 @@ export function getDateRangesFromEntitlements( return { startDates, endDates, createdDates }; } -export function calculateBillingCycleResult( +function calculateBillingCycleResult( startDates: string[], endDates: string[], createdDates: string[], @@ -190,7 +190,7 @@ export function calculateBillingCycleResult( }; } -export function calculateStartDateFromInterval( +function calculateStartDateFromInterval( interval: EntInterval | null | undefined, nextResetAt: number | null | undefined, createdAt: number, diff --git a/server/src/internal/api/check/checkUtils/getCheckData.ts b/server/src/internal/api/check/checkUtils/getCheckData.ts index 041db6128..bd5c622bf 100644 --- a/server/src/internal/api/check/checkUtils/getCheckData.ts +++ b/server/src/internal/api/check/checkUtils/getCheckData.ts @@ -35,7 +35,7 @@ const getFeatureAndCreditSystems = ({ return { feature, creditSystems, allFeatures: features }; }; -export const getFeatureToUse = ({ +const getFeatureToUse = ({ creditSystems, feature, apiEntity, diff --git a/server/src/internal/api/check/handlers/getProductCheckPreview.ts b/server/src/internal/api/check/handlers/getProductCheckPreview.ts index dcc094367..4f076d736 100644 --- a/server/src/internal/api/check/handlers/getProductCheckPreview.ts +++ b/server/src/internal/api/check/handlers/getProductCheckPreview.ts @@ -20,7 +20,7 @@ import { notNullish } from "@/utils/genUtils.js"; import type { AutumnContext } from "../../../../honoUtils/HonoEnv.js"; import { getAttachScenario } from "./attachToCheckPreview/getAttachScenario.js"; -export const attachToCheckPreview = async ({ +const attachToCheckPreview = async ({ preview, params, product, diff --git a/server/src/internal/balances/createBalance/validateCreateBalance.ts b/server/src/internal/balances/createBalance/validateCreateBalance.ts index f3bcc7670..b8301d473 100644 --- a/server/src/internal/balances/createBalance/validateCreateBalance.ts +++ b/server/src/internal/balances/createBalance/validateCreateBalance.ts @@ -43,7 +43,7 @@ export const validateCreateBalanceParams = async ({ } }; -export const validateBooleanEntitlementConflict = async ({ +const validateBooleanEntitlementConflict = async ({ ctx, feature, fullCustomer, diff --git a/server/src/internal/balances/track/deductUtils/calculateDeduction.ts b/server/src/internal/balances/track/deductUtils/calculateDeduction.ts index a43bb7274..7a12ad1f4 100644 --- a/server/src/internal/balances/track/deductUtils/calculateDeduction.ts +++ b/server/src/internal/balances/track/deductUtils/calculateDeduction.ts @@ -1,6 +1,6 @@ import { Decimal } from "decimal.js"; -export type CalculateDeductionParams = { +type CalculateDeductionParams = { currentBalance: number; currentAdjustment: number; amountToDeduct: number; @@ -9,7 +9,7 @@ export type CalculateDeductionParams = { alterGrantedBalance?: boolean; }; -export type CalculateDeductionResult = { +type CalculateDeductionResult = { deducted: number; newBalance: number; newAdjustment: number; diff --git a/server/src/internal/balances/track/deductUtils/deductFromMainBalance.ts b/server/src/internal/balances/track/deductUtils/deductFromMainBalance.ts index bed258f19..4b9e1be30 100644 --- a/server/src/internal/balances/track/deductUtils/deductFromMainBalance.ts +++ b/server/src/internal/balances/track/deductUtils/deductFromMainBalance.ts @@ -9,7 +9,7 @@ import { Decimal } from "decimal.js"; import { cusEntToStartingBalance } from "../../../../../../shared/utils/cusEntUtils/balanceUtils/cusEntToStartingBalance"; import { calculateDeduction } from "./calculateDeduction"; -export type DeductFromMainBalanceParams = { +type DeductFromMainBalanceParams = { cusEnt: FullCusEntWithFullCusProduct; amountToDeduct: number; targetEntityId?: string; @@ -18,7 +18,7 @@ export type DeductFromMainBalanceParams = { maxBalance?: number; }; -export type DeductFromMainBalanceResult = { +type DeductFromMainBalanceResult = { deducted: number; newBalance: number; newEntities: Record | null; diff --git a/server/src/internal/balances/utils/deduction/deductionToTrackResponse.ts b/server/src/internal/balances/utils/deduction/deductionToTrackResponse.ts index 9505c9400..bd4f89f56 100644 --- a/server/src/internal/balances/utils/deduction/deductionToTrackResponse.ts +++ b/server/src/internal/balances/utils/deduction/deductionToTrackResponse.ts @@ -19,7 +19,7 @@ type TrackBalanceResponse = { * Convert updates keyed by cusEntId to actualDeductions keyed by featureId. * Looks up each cusEntId in fullCus to determine its feature. */ -export const computeActualDeductions = ({ +const computeActualDeductions = ({ fullCus, updates, }: { diff --git a/server/src/internal/balances/utils/deduction/prepareDeductionOptions.ts b/server/src/internal/balances/utils/deduction/prepareDeductionOptions.ts index bb7b27529..a749be02d 100644 --- a/server/src/internal/balances/utils/deduction/prepareDeductionOptions.ts +++ b/server/src/internal/balances/utils/deduction/prepareDeductionOptions.ts @@ -4,7 +4,7 @@ import type { DeductionOptions } from "../types/deductionTypes.js"; import type { FeatureDeduction } from "../types/featureDeduction.js"; /** Deduction options with all defaults resolved (no optional fields) */ -export type ResolvedDeductionOptions = Required< +type ResolvedDeductionOptions = Required< Omit > & { customerEntitlementFilters: DeductionOptions["customerEntitlementFilters"]; diff --git a/server/src/internal/balances/utils/handleThresholdReached.ts b/server/src/internal/balances/utils/handleThresholdReached.ts index 4726232e8..397a39d54 100644 --- a/server/src/internal/balances/utils/handleThresholdReached.ts +++ b/server/src/internal/balances/utils/handleThresholdReached.ts @@ -36,7 +36,7 @@ const cleanApiCustomer = ({ }); }; -export const handleAllowanceUsed = async ({ +const handleAllowanceUsed = async ({ ctx, feature, oldFullCus, diff --git a/server/src/internal/balances/utils/paidAllocatedFeature/createPaidAllocatedInvoice/createUpgradeProrationInvoice.ts b/server/src/internal/balances/utils/paidAllocatedFeature/createPaidAllocatedInvoice/createUpgradeProrationInvoice.ts index b42e881aa..8b55623cd 100644 --- a/server/src/internal/balances/utils/paidAllocatedFeature/createPaidAllocatedInvoice/createUpgradeProrationInvoice.ts +++ b/server/src/internal/balances/utils/paidAllocatedFeature/createPaidAllocatedInvoice/createUpgradeProrationInvoice.ts @@ -20,7 +20,7 @@ import { createAndFinalizeInvoice } from "@/internal/invoices/invoiceUtils/creat import { calculateProrationAmount } from "@/internal/invoices/prorationUtils.js"; import { formatUnixToDate } from "@/utils/genUtils.js"; -export const getUpgradeProrationInvoiceItem = ({ +const getUpgradeProrationInvoiceItem = ({ prevPrice, newPrice, now, diff --git a/server/src/internal/balances/utils/paidAllocatedFeature/createPaidAllocatedInvoice/handleProratedDowngrade.ts b/server/src/internal/balances/utils/paidAllocatedFeature/createPaidAllocatedInvoice/handleProratedDowngrade.ts index 55abd6c4f..529d39178 100644 --- a/server/src/internal/balances/utils/paidAllocatedFeature/createPaidAllocatedInvoice/handleProratedDowngrade.ts +++ b/server/src/internal/balances/utils/paidAllocatedFeature/createPaidAllocatedInvoice/handleProratedDowngrade.ts @@ -28,7 +28,7 @@ import { roundUsage } from "@/internal/products/prices/priceUtils/usagePriceUtil import { formatUnixToDate } from "@/utils/genUtils.js"; import { getUsageFromBalance } from "../adjustAllowance.js"; -export const createDowngradeProrationInvoice = async ({ +const createDowngradeProrationInvoice = async ({ org, cusPrice, stripeCli, diff --git a/server/src/internal/balances/utils/sync/SyncBatchingManagerV2.ts b/server/src/internal/balances/utils/sync/SyncBatchingManagerV2.ts index 8b9e6a270..607d9d079 100644 --- a/server/src/internal/balances/utils/sync/SyncBatchingManagerV2.ts +++ b/server/src/internal/balances/utils/sync/SyncBatchingManagerV2.ts @@ -23,7 +23,7 @@ interface CustomerBatch { * Batching manager for syncing FullCustomer cache to PostgreSQL. * Batches by customer, collects modified cusEntIds within a time window. */ -export class SyncBatchingManagerV2 { +class SyncBatchingManagerV2 { private customerBatches: Map = new Map(); private readonly BATCH_WINDOW_MS = diff --git a/server/src/internal/balances/utils/sync/syncItemV3.ts b/server/src/internal/balances/utils/sync/syncItemV3.ts index c4831b157..4eb3bce39 100644 --- a/server/src/internal/balances/utils/sync/syncItemV3.ts +++ b/server/src/internal/balances/utils/sync/syncItemV3.ts @@ -64,7 +64,7 @@ const handleSyncPostgresError = async ({ return true; }; -export interface SyncItemV3 { +interface SyncItemV3 { customerId: string; orgId: string; env: string; diff --git a/server/src/internal/balances/utils/types/deductionTypes.ts b/server/src/internal/balances/utils/types/deductionTypes.ts index b12a26c15..3e4f0b4d5 100644 --- a/server/src/internal/balances/utils/types/deductionTypes.ts +++ b/server/src/internal/balances/utils/types/deductionTypes.ts @@ -21,7 +21,7 @@ export type DeductionOptions = { }; /** Core params for deduction (shared by Redis & Postgres) */ -export type DeductionParams = { +type DeductionParams = { ctx: AutumnContext; fullCus: FullCustomer; entityId?: string; @@ -30,7 +30,7 @@ export type DeductionParams = { }; /** Result from deduction (same for Redis & Postgres) */ -export type DeductionResult = { +type DeductionResult = { oldFullCus: FullCustomer; fullCus: FullCustomer | undefined; isPaidAllocated: boolean; @@ -58,7 +58,7 @@ export type PreparedFeatureDeduction = { }; /** Result from Postgres deduction */ -export type PostgresDeductionResult = { +type PostgresDeductionResult = { updates: Record; remaining: number; }; diff --git a/server/src/internal/billing/v2/billingContext.ts b/server/src/internal/billing/v2/billingContext.ts index 89735ed38..4029a9b90 100644 --- a/server/src/internal/billing/v2/billingContext.ts +++ b/server/src/internal/billing/v2/billingContext.ts @@ -13,7 +13,7 @@ import type { FullCustomer } from "@shared/models/cusModels/fullCusModel"; import type Stripe from "stripe"; import { z } from "zod/v4"; -export const InvoiceModeSchema = z.object({ +const InvoiceModeSchema = z.object({ finalizeInvoice: z.boolean().default(false), enableProductImmediately: z.boolean().default(true), }); diff --git a/server/src/internal/billing/v2/providers/stripe/actionBuilders/buildStripeSubscriptionScheduleAction.ts b/server/src/internal/billing/v2/providers/stripe/actionBuilders/buildStripeSubscriptionScheduleAction.ts index 9c33f0427..48ae87bc5 100644 --- a/server/src/internal/billing/v2/providers/stripe/actionBuilders/buildStripeSubscriptionScheduleAction.ts +++ b/server/src/internal/billing/v2/providers/stripe/actionBuilders/buildStripeSubscriptionScheduleAction.ts @@ -14,7 +14,7 @@ import type { StripeSubscriptionScheduleAction } from "@/internal/billing/v2/typ // TYPES // ═══════════════════════════════════════════════════════════════════════════════ -export type StripeSubscriptionScheduleResult = { +type StripeSubscriptionScheduleResult = { scheduleAction?: StripeSubscriptionScheduleAction; subscriptionCancelAt?: number; }; diff --git a/server/src/internal/billing/v2/providers/stripe/utils/invoices/payStripeInvoice.ts b/server/src/internal/billing/v2/providers/stripe/utils/invoices/payStripeInvoice.ts index 16c2f3a17..2a192697e 100644 --- a/server/src/internal/billing/v2/providers/stripe/utils/invoices/payStripeInvoice.ts +++ b/server/src/internal/billing/v2/providers/stripe/utils/invoices/payStripeInvoice.ts @@ -16,7 +16,7 @@ export type PayInvoiceResult = { stripeError?: Stripe.errors.StripeError; }; -export type PayStripeInvoiceParams = { +type PayStripeInvoiceParams = { stripeCli: Stripe; invoiceId: string; paymentMethod?: Stripe.PaymentMethod | null; diff --git a/server/src/internal/billing/v2/providers/stripe/utils/invoices/stripeInvoiceOps.ts b/server/src/internal/billing/v2/providers/stripe/utils/invoices/stripeInvoiceOps.ts index 35bf1d1ee..c8909570a 100644 --- a/server/src/internal/billing/v2/providers/stripe/utils/invoices/stripeInvoiceOps.ts +++ b/server/src/internal/billing/v2/providers/stripe/utils/invoices/stripeInvoiceOps.ts @@ -6,7 +6,7 @@ import type { AutumnContext } from "@/honoUtils/HonoEnv"; // Create Invoice // ============================================ -export type CreateInvoiceParams = { +type CreateInvoiceParams = { stripeCli: Stripe; stripeCusId: string; stripeSubId?: string; @@ -47,7 +47,7 @@ export const createStripeInvoice = async ({ // Add Invoice Lines // ============================================ -export type AddInvoiceLinesParams = { +type AddInvoiceLinesParams = { stripeCli: Stripe; invoiceId: string; lines: Stripe.InvoiceAddLinesParams.Line[]; @@ -69,7 +69,7 @@ export const addStripeInvoiceLines = async ({ // Finalize Invoice // ============================================ -export type FinalizeInvoiceParams = { +type FinalizeInvoiceParams = { stripeCli: Stripe; invoiceId: string; autoAdvance?: boolean; @@ -91,7 +91,7 @@ export const finalizeStripeInvoice = async ({ // Create Invoice Items // ============================================ -export type CreateStripeInvoiceItemsParams = { +type CreateStripeInvoiceItemsParams = { ctx: AutumnContext; invoiceItems: Stripe.InvoiceItemCreateParams[]; }; diff --git a/server/src/internal/billing/v2/providers/stripe/utils/subscriptionSchedules/logBuildPhaseHelpers.ts b/server/src/internal/billing/v2/providers/stripe/utils/subscriptionSchedules/logBuildPhaseHelpers.ts index d233787c9..7d293e688 100644 --- a/server/src/internal/billing/v2/providers/stripe/utils/subscriptionSchedules/logBuildPhaseHelpers.ts +++ b/server/src/internal/billing/v2/providers/stripe/utils/subscriptionSchedules/logBuildPhaseHelpers.ts @@ -49,7 +49,7 @@ export const logTransitionPoints = ({ * Logs a single phase during the build process. * This is a flexible helper that accepts a custom format function for items. */ -export const logPhase = ({ +const logPhase = ({ ctx, logPrefix, phaseIndex, diff --git a/server/src/internal/billing/v2/types/billingPlan.ts b/server/src/internal/billing/v2/types/billingPlan.ts index 4c0a8a7f6..18a6d6ca7 100644 --- a/server/src/internal/billing/v2/types/billingPlan.ts +++ b/server/src/internal/billing/v2/types/billingPlan.ts @@ -19,12 +19,12 @@ import { } from "./stripeBillingPlan/stripeBillingPlan"; export { - AutumnBillingPlanSchema, - StripeBillingPlanSchema, - StripeInvoiceActionSchema, - StripeInvoiceItemsActionSchema, - StripeSubscriptionActionSchema, - StripeSubscriptionScheduleActionSchema, + + + + + + type AutumnBillingPlan, type DeferredAutumnBillingPlanData, type StripeBillingPlan, diff --git a/server/src/internal/billing/v2/types/cancelTypes.ts b/server/src/internal/billing/v2/types/cancelTypes.ts index d7a34a688..cdfee7155 100644 --- a/server/src/internal/billing/v2/types/cancelTypes.ts +++ b/server/src/internal/billing/v2/types/cancelTypes.ts @@ -6,7 +6,7 @@ export type { CancelAction } from "@shared/api/common/cancelMode"; /** * Updates to apply to a customer product when canceling or uncanceling. */ -export interface CancelUpdates { +interface CancelUpdates { canceled: boolean; canceled_at: number | null; ended_at: number | null; diff --git a/server/src/internal/billing/v2/utils/billingContextPriceLookup.ts b/server/src/internal/billing/v2/utils/billingContextPriceLookup.ts index 6796dd108..7f9cae139 100644 --- a/server/src/internal/billing/v2/utils/billingContextPriceLookup.ts +++ b/server/src/internal/billing/v2/utils/billingContextPriceLookup.ts @@ -18,7 +18,7 @@ import { getBillingType } from "@server/internal/products/prices/priceUtils"; * Searches both `fullProducts` and `fullCustomer.customer_products` for full coverage, * since prices may exist in either location depending on context. */ -export const billingContextLookupPriceByStripePriceId = ({ +const billingContextLookupPriceByStripePriceId = ({ stripePriceId, billingContext, }: { diff --git a/server/src/internal/billing/v2/utils/initFullCustomerProduct/initCustomerEntitlement/initCustomerEntitlementBalance.ts b/server/src/internal/billing/v2/utils/initFullCustomerProduct/initCustomerEntitlement/initCustomerEntitlementBalance.ts index 7a610ff75..6faed5623 100644 --- a/server/src/internal/billing/v2/utils/initFullCustomerProduct/initCustomerEntitlement/initCustomerEntitlementBalance.ts +++ b/server/src/internal/billing/v2/utils/initFullCustomerProduct/initCustomerEntitlement/initCustomerEntitlementBalance.ts @@ -10,7 +10,7 @@ import { } from "@autumn/shared"; import { initCustomerEntitlementEntities } from "./initCustomerEntitlementEntities"; -export interface InitCustomerEntitlementBalanceResult { +interface InitCustomerEntitlementBalanceResult { balance: number; entities: Record | null; } diff --git a/server/src/internal/billing/v2/utils/lineItems/customerProductToLineItems.ts b/server/src/internal/billing/v2/utils/lineItems/customerProductToLineItems.ts index c76bdb2a9..4deb9dba1 100644 --- a/server/src/internal/billing/v2/utils/lineItems/customerProductToLineItems.ts +++ b/server/src/internal/billing/v2/utils/lineItems/customerProductToLineItems.ts @@ -20,7 +20,7 @@ import { getBillingCycleAnchorForDirection } from "@/internal/billing/v2/utils/b import type { BillingContext } from "../../billingContext"; import { getLineItemBillingPeriod } from "./getLineItemBillingPeriod"; -export type LineItemDirection = "charge" | "refund"; +type LineItemDirection = "charge" | "refund"; /** * Generates line items for a customer product. diff --git a/server/src/internal/customers/actions/createWithDefaults/setup/setupDefaultProductsContext.ts b/server/src/internal/customers/actions/createWithDefaults/setup/setupDefaultProductsContext.ts index 59309e790..e71d72f35 100644 --- a/server/src/internal/customers/actions/createWithDefaults/setup/setupDefaultProductsContext.ts +++ b/server/src/internal/customers/actions/createWithDefaults/setup/setupDefaultProductsContext.ts @@ -9,7 +9,7 @@ import type { AutumnContext } from "@/honoUtils/HonoEnv.js"; import { ProductService } from "@/internal/products/ProductService.js"; import { isDefaultTrialFullProduct } from "@/internal/products/productUtils/classifyProduct.js"; -export interface DefaultProductsContext { +interface DefaultProductsContext { fullProducts: FullProduct[]; paidProducts: FullProduct[]; hasPaidProducts: boolean; diff --git a/server/src/internal/customers/add-product/createFullCusProduct.ts b/server/src/internal/customers/add-product/createFullCusProduct.ts index 03756f529..c7e1236da 100644 --- a/server/src/internal/customers/add-product/createFullCusProduct.ts +++ b/server/src/internal/customers/add-product/createFullCusProduct.ts @@ -39,7 +39,7 @@ import { getExistingCusProducts } from "../cusProducts/cusProductUtils/getExisti import { updateOneTimeCusProduct } from "./createOneTimeCusProduct.js"; import { initCusEntitlement } from "./initCusEnt.js"; -export const initCusPrice = ({ +const initCusPrice = ({ price, customer, cusProductId, @@ -60,7 +60,7 @@ export const initCusPrice = ({ return cusPrice; }; -export const initCusProduct = ({ +const initCusProduct = ({ customer, product, // subscriptionId, @@ -154,7 +154,7 @@ export const initCusProduct = ({ }; }; -export const insertFullCusProduct = async ({ +const insertFullCusProduct = async ({ db, cusProd, cusEnts, @@ -188,7 +188,7 @@ export const insertFullCusProduct = async ({ }); }; -export const expireOrDeleteCusProduct = async ({ +const expireOrDeleteCusProduct = async ({ db, startsAt, product, @@ -237,7 +237,7 @@ export const expireOrDeleteCusProduct = async ({ } }; -export const getExistingCusProduct = async ({ +const getExistingCusProduct = async ({ db, cusProducts, product, diff --git a/server/src/internal/customers/add-product/initCusEnt.ts b/server/src/internal/customers/add-product/initCusEnt.ts index 1fed95a06..332e35505 100644 --- a/server/src/internal/customers/add-product/initCusEnt.ts +++ b/server/src/internal/customers/add-product/initCusEnt.ts @@ -22,7 +22,7 @@ import { getBillingType } from "@/internal/products/prices/priceUtils.js"; import { generateId, notNullish } from "@/utils/genUtils.js"; import { initNextResetAt } from "../cusProducts/insertCusProduct/initCusEnt/initNextResetAt.js"; -export const initCusEntEntities = ({ +const initCusEntEntities = ({ entitlement, entities, existingCusEnt, diff --git a/server/src/internal/customers/attach/attachFunctions/upgradeDiffIntFlow/createUsageInvoiceItems.ts b/server/src/internal/customers/attach/attachFunctions/upgradeDiffIntFlow/createUsageInvoiceItems.ts index b597dd654..99ad78cff 100644 --- a/server/src/internal/customers/attach/attachFunctions/upgradeDiffIntFlow/createUsageInvoiceItems.ts +++ b/server/src/internal/customers/attach/attachFunctions/upgradeDiffIntFlow/createUsageInvoiceItems.ts @@ -20,7 +20,7 @@ import { getBillingType, } from "@/internal/products/prices/priceUtils.js"; -export const getUsageInvoiceItems = async ({ +const getUsageInvoiceItems = async ({ db, logger, attachParams, diff --git a/server/src/internal/customers/attach/attachRouter.ts b/server/src/internal/customers/attach/attachRouter.ts index 545837929..f7a2ff303 100644 --- a/server/src/internal/customers/attach/attachRouter.ts +++ b/server/src/internal/customers/attach/attachRouter.ts @@ -88,7 +88,7 @@ export const handlePrepaidErrors = async ({ } }; -export const handlePublicAttachErrors = async ({ +const handlePublicAttachErrors = async ({ curCusProduct, isPublic, }: { @@ -184,7 +184,7 @@ export const checkStripeConnections = async ({ }); }; -export const createStripePrices = async ({ +const createStripePrices = async ({ ctx, attachParams, useCheckout, @@ -220,7 +220,7 @@ export const createStripePrices = async ({ await Promise.all(batchPriceUpdates); }; -export const customerHasPm = async ({ +const customerHasPm = async ({ attachParams, }: { attachParams: AttachParams; diff --git a/server/src/internal/customers/attach/attachUtils/attachParams/convertToParams.ts b/server/src/internal/customers/attach/attachUtils/attachParams/convertToParams.ts index 3f4164925..c2845ce38 100644 --- a/server/src/internal/customers/attach/attachUtils/attachParams/convertToParams.ts +++ b/server/src/internal/customers/attach/attachUtils/attachParams/convertToParams.ts @@ -21,7 +21,7 @@ import { newCusToFullCus } from "@/internal/customers/cusUtils/cusUtils.js"; import type { ExtendedRequest } from "@/utils/models/Request.js"; import type { AutumnContext } from "../../../../../honoUtils/HonoEnv"; -export const webhookToAttachParams = ({ +const webhookToAttachParams = ({ req, stripeCli, paymentMethod, diff --git a/server/src/internal/customers/attach/attachUtils/attachParams/processAttachBody.ts b/server/src/internal/customers/attach/attachUtils/attachParams/processAttachBody.ts index 53dc70089..ae55b9fb7 100644 --- a/server/src/internal/customers/attach/attachUtils/attachParams/processAttachBody.ts +++ b/server/src/internal/customers/attach/attachUtils/attachParams/processAttachBody.ts @@ -8,7 +8,7 @@ import { getCustomerAndProducts } from "./attachParamsUtils/getCusAndProducts.js import { getPricesAndEnts } from "./attachParamsUtils/getPricesAndEnts.js"; import { getStripeCusData } from "./attachParamsUtils/getStripeCusData.js"; -export const getRewards = async ({ +const getRewards = async ({ ctx, attachBody, stripeCli, diff --git a/server/src/internal/customers/attach/attachUtils/attachUtils.ts b/server/src/internal/customers/attach/attachUtils/attachUtils.ts index fe1922f39..1a23dd55a 100644 --- a/server/src/internal/customers/attach/attachUtils/attachUtils.ts +++ b/server/src/internal/customers/attach/attachUtils/attachUtils.ts @@ -13,7 +13,7 @@ import { attachParamsToProduct, } from "./convertAttachParams.js"; -export const getCycleWillReset = ({ +const getCycleWillReset = ({ attachParams, stripeSubs, }: { @@ -29,7 +29,7 @@ export const getCycleWillReset = ({ }); }; -export const removeCurCusProductItems = async ({ +const removeCurCusProductItems = async ({ sub, cusProduct, subItems, diff --git a/server/src/internal/customers/attach/attachUtils/getContUseItems/createContUseInvoiceItems.ts b/server/src/internal/customers/attach/attachUtils/getContUseItems/createContUseInvoiceItems.ts index f2a576954..cb69efe6a 100644 --- a/server/src/internal/customers/attach/attachUtils/getContUseItems/createContUseInvoiceItems.ts +++ b/server/src/internal/customers/attach/attachUtils/getContUseItems/createContUseInvoiceItems.ts @@ -16,7 +16,7 @@ import type { Logger } from "../../../../../external/logtail/logtailUtils.js"; import { attachParamsToProduct } from "../convertAttachParams.js"; import { getContUseInvoiceItems } from "./getContUseInvoiceItems.js"; -export const filterContUsageProrations = async ({ +const filterContUsageProrations = async ({ sub, stripeCli, curCusProduct, diff --git a/server/src/internal/customers/attach/attachUtils/getContUseItems/getContUseInvoiceItems.ts b/server/src/internal/customers/attach/attachUtils/getContUseItems/getContUseInvoiceItems.ts index 4b0579f44..cb5068a8f 100644 --- a/server/src/internal/customers/attach/attachUtils/getContUseItems/getContUseInvoiceItems.ts +++ b/server/src/internal/customers/attach/attachUtils/getContUseItems/getContUseInvoiceItems.ts @@ -30,7 +30,7 @@ import { attachParamsToProduct } from "../convertAttachParams.js"; import { intervalsAreSame } from "../getAttachConfig.js"; import { priceToContUseItem } from "./priceToContUseItem.js"; -export const getContUseNewItems = async ({ +const getContUseNewItems = async ({ price, ent, attachParams, diff --git a/server/src/internal/customers/attach/mergeUtils/mergeUtils.ts b/server/src/internal/customers/attach/mergeUtils/mergeUtils.ts index b6e4ed225..02212ff45 100644 --- a/server/src/internal/customers/attach/mergeUtils/mergeUtils.ts +++ b/server/src/internal/customers/attach/mergeUtils/mergeUtils.ts @@ -20,7 +20,7 @@ import { getCustomerSub, } from "../attachUtils/convertAttachParams.js"; -export const isMultiProductSub = ({ +const isMultiProductSub = ({ sub, cusProducts, }: { diff --git a/server/src/internal/customers/attach/mergeUtils/paramsToScheduleItems.ts b/server/src/internal/customers/attach/mergeUtils/paramsToScheduleItems.ts index 3f3c0d802..409cefcf6 100644 --- a/server/src/internal/customers/attach/mergeUtils/paramsToScheduleItems.ts +++ b/server/src/internal/customers/attach/mergeUtils/paramsToScheduleItems.ts @@ -22,7 +22,7 @@ import { getCusProductsToRemove } from "./paramsToSubItems.js"; import { mergeAdjacentPhasesWithSameItems } from "./phaseUtils/mergeSimilarPhases.js"; import { preparePhasesForBillingPeriod } from "./phaseUtils/upsertNewPhase.js"; -export const removeCusProductFromScheduleItems = async ({ +const removeCusProductFromScheduleItems = async ({ curScheduleItems, updateScheduleItems, allCusProducts, diff --git a/server/src/internal/customers/attach/mergeUtils/phaseUtils/upsertNewPhase.ts b/server/src/internal/customers/attach/mergeUtils/phaseUtils/upsertNewPhase.ts index 12c79cf9c..fb946ed10 100644 --- a/server/src/internal/customers/attach/mergeUtils/phaseUtils/upsertNewPhase.ts +++ b/server/src/internal/customers/attach/mergeUtils/phaseUtils/upsertNewPhase.ts @@ -1,7 +1,7 @@ import { differenceInDays } from "date-fns"; import type Stripe from "stripe"; -export const phaseAndUnixMatch = ({ +const phaseAndUnixMatch = ({ phase, unix, }: { diff --git a/server/src/internal/customers/attach/models/AttachFlags.ts b/server/src/internal/customers/attach/models/AttachFlags.ts index 64aa83604..b96eb514e 100644 --- a/server/src/internal/customers/attach/models/AttachFlags.ts +++ b/server/src/internal/customers/attach/models/AttachFlags.ts @@ -1,6 +1,6 @@ import type { AttachBranch } from "@autumn/shared"; -export enum ProrationBehavior { +enum ProrationBehavior { Immediately = "immediately", NextBilling = "next_billing", None = "none", @@ -14,7 +14,7 @@ export interface AttachFlags { isFree: boolean; } -export interface AttachConfig { +interface AttachConfig { onlyCheckout: boolean; carryUsage: boolean; // Whether to carry over existing usages branch: AttachBranch; diff --git a/server/src/internal/customers/cusProducts/CusProductService.ts b/server/src/internal/customers/cusProducts/CusProductService.ts index 05bf8144c..f6065ca65 100644 --- a/server/src/internal/customers/cusProducts/CusProductService.ts +++ b/server/src/internal/customers/cusProducts/CusProductService.ts @@ -33,7 +33,7 @@ export const RELEVANT_STATUSES = [ CusProductStatus.Scheduled, ]; -export const orgOwnsCusProduct = async ({ +const orgOwnsCusProduct = async ({ cusProduct, orgId, env, @@ -52,7 +52,7 @@ export const orgOwnsCusProduct = async ({ return true; }; -export const filterByOrgAndEnv = ({ +const filterByOrgAndEnv = ({ cusProducts, orgId, env, diff --git a/server/src/internal/customers/cusProducts/actions/index.ts b/server/src/internal/customers/cusProducts/actions/index.ts index c80ccc621..44fc430fa 100644 --- a/server/src/internal/customers/cusProducts/actions/index.ts +++ b/server/src/internal/customers/cusProducts/actions/index.ts @@ -25,8 +25,4 @@ export const customerProductActions = { }, }; -export { - expireCustomerProductAndActivateDefault, - activateScheduledCustomerProduct, - deleteScheduledCustomerProduct, -}; +; diff --git a/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils.ts b/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils.ts index 8fc42be3a..6cf54650d 100644 --- a/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils.ts +++ b/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils.ts @@ -23,7 +23,7 @@ import { getSummedEntityBalances, } from "./entBalanceUtils.js"; -export const getCusEntMasterBalance = ({ +const getCusEntMasterBalance = ({ cusEnt, entities, }: { @@ -65,7 +65,7 @@ export const getCusEntMasterBalance = ({ }; }; -export const getCusEntBalance = ({ +const getCusEntBalance = ({ cusEnt, entityId, }: { @@ -117,7 +117,7 @@ export const getRelatedCusPrice = ( }; // 3. Perform deductions and update customer balance -export const updateCusEntInStripe = async ({ +const updateCusEntInStripe = async ({ cusEnt, cusPrices, org, @@ -243,7 +243,7 @@ export const getFeatureBalance = ({ return balance; }; -export const getPaidFeatureBalance = ({ +const getPaidFeatureBalance = ({ cusEnts, internalFeatureId, }: { @@ -269,7 +269,7 @@ export const getPaidFeatureBalance = ({ return paidAllowance; }; -export const cusEntsContainFeature = ({ +const cusEntsContainFeature = ({ cusEnts, feature, }: { diff --git a/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils/findCusEntUtils.ts b/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils/findCusEntUtils.ts index c46170533..e29873753 100644 --- a/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils/findCusEntUtils.ts +++ b/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils/findCusEntUtils.ts @@ -6,7 +6,7 @@ import type { } from "@autumn/shared"; import { notNullish } from "@/utils/genUtils.js"; -export const cusEntMatchesEntity = ({ +const cusEntMatchesEntity = ({ cusEnt, entity, }: { @@ -69,7 +69,7 @@ export const findCusEnt = ({ }); }; -export const filterCusEnts = ({ +const filterCusEnts = ({ feature, cusEnts, entity, diff --git a/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils/getExistingUsage.ts b/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils/getExistingUsage.ts index 121139b09..1f7c2c221 100644 --- a/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils/getExistingUsage.ts +++ b/server/src/internal/customers/cusProducts/cusEnts/cusEntUtils/getExistingUsage.ts @@ -21,7 +21,7 @@ import { getUnlimitedAndUsageAllowed, } from "../cusEntUtils.js"; -export const getExistingCusEntAndUsage = async ({ +const getExistingCusEntAndUsage = async ({ curCusProduct, entitlement, relatedPrice, @@ -55,7 +55,7 @@ export const getExistingCusEntAndUsage = async ({ } }; -export const getExistingUsages = ({ +const getExistingUsages = ({ curCusProduct, entities, features, diff --git a/server/src/internal/customers/cusProducts/cusEnts/cusRollovers/rolloverUtils.ts b/server/src/internal/customers/cusProducts/cusEnts/cusRollovers/rolloverUtils.ts index 95a7a796a..ebdba8468 100644 --- a/server/src/internal/customers/cusProducts/cusEnts/cusRollovers/rolloverUtils.ts +++ b/server/src/internal/customers/cusProducts/cusEnts/cusRollovers/rolloverUtils.ts @@ -67,7 +67,7 @@ export const getRolloverUpdates = ({ return update; }; -export const calculateNextExpiry = ( +const calculateNextExpiry = ( nextResetAt: number, config: RolloverConfig, ) => { diff --git a/server/src/internal/customers/cusProducts/cusProductUtils.ts b/server/src/internal/customers/cusProducts/cusProductUtils.ts index 2ad97b6d1..51c64cc65 100644 --- a/server/src/internal/customers/cusProducts/cusProductUtils.ts +++ b/server/src/internal/customers/cusProducts/cusProductUtils.ts @@ -112,7 +112,7 @@ export const activateDefaultProduct = async ({ return true; }; -export const activateFutureProduct = async ({ +const activateFutureProduct = async ({ ctx, cusProduct, }: { @@ -213,7 +213,7 @@ export const getMainCusProduct = async ({ return mainCusProduct as FullCusProduct; }; -export const getCusProductsWithStripeSubId = ({ +const getCusProductsWithStripeSubId = ({ cusProducts, stripeSubId, curCusProductId, diff --git a/server/src/internal/customers/cusProducts/cusProductUtils/convertCusProduct.ts b/server/src/internal/customers/cusProducts/cusProductUtils/convertCusProduct.ts index 6cfced407..730f848ef 100644 --- a/server/src/internal/customers/cusProducts/cusProductUtils/convertCusProduct.ts +++ b/server/src/internal/customers/cusProducts/cusProductUtils/convertCusProduct.ts @@ -50,7 +50,7 @@ export const cusProductToSub = async ({ return sub; }; -export const cusProductsToStripeSubs = ({ +const cusProductsToStripeSubs = ({ cusProducts, stripeCli, }: { diff --git a/server/src/internal/customers/cusUtils/apiCusUtils/getApiBalance/apiBalanceUtils.ts b/server/src/internal/customers/cusUtils/apiCusUtils/getApiBalance/apiBalanceUtils.ts index eb520db4a..b614f6ceb 100644 --- a/server/src/internal/customers/cusUtils/apiCusUtils/getApiBalance/apiBalanceUtils.ts +++ b/server/src/internal/customers/cusUtils/apiCusUtils/getApiBalance/apiBalanceUtils.ts @@ -13,7 +13,7 @@ import { toIntervalCountResponse, } from "@autumn/shared"; -export const cusEntsToNextResetAt = ({ +const cusEntsToNextResetAt = ({ cusEnts, }: { cusEnts: FullCusEntWithFullCusProduct[]; @@ -30,7 +30,7 @@ export const cusEntsToNextResetAt = ({ return result; }; -export const cusEntsToReset = ({ +const cusEntsToReset = ({ cusEnts, feature, }: { @@ -63,7 +63,7 @@ export const cusEntsToReset = ({ }; }; -export const cusEntsToRollovers = ({ +const cusEntsToRollovers = ({ cusEnts, entityId, }: { diff --git a/server/src/internal/customers/cusUtils/createNewCustomer.ts b/server/src/internal/customers/cusUtils/createNewCustomer.ts index 18c27b07d..c2a00d485 100644 --- a/server/src/internal/customers/cusUtils/createNewCustomer.ts +++ b/server/src/internal/customers/cusUtils/createNewCustomer.ts @@ -29,7 +29,7 @@ import { getDefaultAttachConfig } from "../attach/attachUtils/getAttachConfig.js import { CusService } from "../CusService.js"; import { initStripeCusAndProducts } from "../handlers/handleCreateCustomer.js"; -export const getGroupToDefaultProd = async ({ +const getGroupToDefaultProd = async ({ defaultProds, }: { defaultProds: FullProduct[]; diff --git a/server/src/internal/customers/cusUtils/cusUtils.ts b/server/src/internal/customers/cusUtils/cusUtils.ts index df649c07c..35a132d65 100644 --- a/server/src/internal/customers/cusUtils/cusUtils.ts +++ b/server/src/internal/customers/cusUtils/cusUtils.ts @@ -74,7 +74,7 @@ export const updateCustomerDetails = async ({ } }; -export const getCusInvoices = async ({ +const getCusInvoices = async ({ db, internalCustomerId, invoices, @@ -109,7 +109,7 @@ export const getCusInvoices = async ({ }; // IMPORTANT FUNCTION -export const getCusEntsInFeatures = async ({ +const getCusEntsInFeatures = async ({ customer, internalFeatureIds, logger, @@ -154,7 +154,7 @@ export const getCusEntsInFeatures = async ({ return { cusEnts, cusPrices }; }; -export const parseCusExpand = (expand?: string): CusExpand[] => { +const parseCusExpand = (expand?: string): CusExpand[] => { if (expand) { const options = expand.split(","); const result: CusExpand[] = []; diff --git a/server/src/internal/customers/cusUtils/fullCustomerCacheUtils/fullCustomerCacheConfig.ts b/server/src/internal/customers/cusUtils/fullCustomerCacheUtils/fullCustomerCacheConfig.ts index 138b0d98c..69ec637e7 100644 --- a/server/src/internal/customers/cusUtils/fullCustomerCacheUtils/fullCustomerCacheConfig.ts +++ b/server/src/internal/customers/cusUtils/fullCustomerCacheUtils/fullCustomerCacheConfig.ts @@ -3,7 +3,7 @@ * Separate from ApiCustomer cache to allow independent versioning */ -export const FULL_CUSTOMER_CACHE_VERSION = "1.0.0"; +const FULL_CUSTOMER_CACHE_VERSION = "1.0.0"; /** * Cache time-to-live in seconds (3 days) diff --git a/server/src/internal/customers/cusUtils/initCustomer.ts b/server/src/internal/customers/cusUtils/initCustomer.ts index da8e1aa04..b14b92bdf 100644 --- a/server/src/internal/customers/cusUtils/initCustomer.ts +++ b/server/src/internal/customers/cusUtils/initCustomer.ts @@ -5,7 +5,7 @@ import { generateId } from "@/utils/genUtils.js"; /** * Build a Customer object ready for insertion. */ -export const initCustomer = ({ +const initCustomer = ({ ctx, customerId, customerData, diff --git a/server/src/internal/customers/handlers/handleCreateCustomer.ts b/server/src/internal/customers/handlers/handleCreateCustomer.ts index 5cd62aa01..7738ebc6b 100644 --- a/server/src/internal/customers/handlers/handleCreateCustomer.ts +++ b/server/src/internal/customers/handlers/handleCreateCustomer.ts @@ -106,7 +106,7 @@ const handleIdIsNull = async ({ }; // CAN ALSO USE DURING MIGRATION... -export const handleCreateCustomerWithId = async ({ +const handleCreateCustomerWithId = async ({ ctx, newCus, createDefaultProducts = true, @@ -175,7 +175,7 @@ export const handleCreateCustomerWithId = async ({ }); }; -export const handleCreateCustomer = async ({ +const handleCreateCustomer = async ({ ctx, cusData, createDefaultProducts = true, diff --git a/server/src/internal/entities/entityUtils/apiEntityUtils/getApiEntityExpand.ts b/server/src/internal/entities/entityUtils/apiEntityUtils/getApiEntityExpand.ts index 99d4aaa93..c9bf6678f 100644 --- a/server/src/internal/entities/entityUtils/apiEntityUtils/getApiEntityExpand.ts +++ b/server/src/internal/entities/entityUtils/apiEntityUtils/getApiEntityExpand.ts @@ -4,7 +4,7 @@ import { CusService } from "@/internal/customers/CusService.js"; import { InvoiceService } from "../../../invoices/InvoiceService"; import { invoicesToResponse } from "../../../invoices/invoiceUtils"; -export type ApiEntityExpand = { +type ApiEntityExpand = { invoices?: any[]; }; diff --git a/server/src/internal/entities/handlers/handleCreateEntity/createEntityForCusProduct.ts b/server/src/internal/entities/handlers/handleCreateEntity/createEntityForCusProduct.ts index 5cf580074..96f52b27b 100644 --- a/server/src/internal/entities/handlers/handleCreateEntity/createEntityForCusProduct.ts +++ b/server/src/internal/entities/handlers/handleCreateEntity/createEntityForCusProduct.ts @@ -21,7 +21,7 @@ import { findLinkedCusEnts } from "@/internal/customers/cusProducts/cusEnts/cusE import RecaseError from "@/utils/errorUtils.js"; import { notNullish } from "@/utils/genUtils.js"; -export const updateLinkedCusEnt = async ({ +const updateLinkedCusEnt = async ({ db, linkedCusEnt, inputEntities, diff --git a/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity2.ts b/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity2.ts index d9246dfed..c4313436e 100644 --- a/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity2.ts +++ b/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity2.ts @@ -17,7 +17,7 @@ import { constructEntity } from "../../entityUtils/entityUtils.js"; import { createEntityForCusProduct } from "./createEntityForCusProduct.js"; import { validateAndGetInputEntities } from "./getInputEntities.js"; -export const createEntities = async ({ +const createEntities = async ({ ctx, logger, customerId, diff --git a/server/src/internal/features/creditSystemUtils.ts b/server/src/internal/features/creditSystemUtils.ts index cd1c72433..12a0363ad 100644 --- a/server/src/internal/features/creditSystemUtils.ts +++ b/server/src/internal/features/creditSystemUtils.ts @@ -5,7 +5,7 @@ import { } from "@autumn/shared"; import { Decimal } from "decimal.js"; -export const creditSystemContainsFeature = ({ +const creditSystemContainsFeature = ({ creditSystem, meteredFeatureId, }: { diff --git a/server/src/internal/features/featureActions/createFeature.ts b/server/src/internal/features/featureActions/createFeature.ts index 56084d4f4..d2622976f 100644 --- a/server/src/internal/features/featureActions/createFeature.ts +++ b/server/src/internal/features/featureActions/createFeature.ts @@ -8,7 +8,7 @@ import { validateMeteredConfig, } from "../featureUtils.js"; -export const validateFeature = (data: any) => { +const validateFeature = (data: any) => { const featureType = data.type; // validateFeatureId(data.id); diff --git a/server/src/internal/features/featureUtils.ts b/server/src/internal/features/featureUtils.ts index 3e856b0ca..fef58d917 100644 --- a/server/src/internal/features/featureUtils.ts +++ b/server/src/internal/features/featureUtils.ts @@ -84,7 +84,7 @@ export const validateCreditSystem = (config: CreditSystemConfig) => { return newConfig; }; -export const getCusFeatureType = ({ feature }: { feature: Feature }) => { +const getCusFeatureType = ({ feature }: { feature: Feature }) => { if (feature.type === FeatureType.Boolean) { return ApiFeatureType.Static; } else if (feature.type === FeatureType.Metered) { @@ -98,7 +98,7 @@ export const getCusFeatureType = ({ feature }: { feature: Feature }) => { } }; -export const isCreditSystem = ({ feature }: { feature: Feature }) => { +const isCreditSystem = ({ feature }: { feature: Feature }) => { return feature.type === FeatureType.CreditSystem; }; diff --git a/server/src/internal/features/utils/constructFeatureUtils.ts b/server/src/internal/features/utils/constructFeatureUtils.ts index cea7f7a8a..7ffab0b81 100644 --- a/server/src/internal/features/utils/constructFeatureUtils.ts +++ b/server/src/internal/features/utils/constructFeatureUtils.ts @@ -7,7 +7,7 @@ import { } from "@autumn/shared"; import { generateId, keyToTitle } from "@server/utils/genUtils"; -export const constructFeature = ({ +const constructFeature = ({ id, name, orgId, diff --git a/server/src/internal/features/utils/displayUtils.ts b/server/src/internal/features/utils/displayUtils.ts index e15c4b2b9..39530e214 100644 --- a/server/src/internal/features/utils/displayUtils.ts +++ b/server/src/internal/features/utils/displayUtils.ts @@ -26,7 +26,7 @@ export const getFeatureName = ({ return featureName; }; -export const getFeatureNameWithCapital = ({ +const getFeatureNameWithCapital = ({ feature, }: { feature: Feature; diff --git a/server/src/internal/features/workflows/generateFeatureDisplay.ts b/server/src/internal/features/workflows/generateFeatureDisplay.ts index 68e83381d..7380c8181 100644 --- a/server/src/internal/features/workflows/generateFeatureDisplay.ts +++ b/server/src/internal/features/workflows/generateFeatureDisplay.ts @@ -12,7 +12,7 @@ export interface GenerateFeatureDisplayPayload { env: AppEnv; } -export const llmGenerateFeatureDisplay = async ({ +const llmGenerateFeatureDisplay = async ({ feature, }: { feature: Feature; diff --git a/server/src/internal/invoices/invoiceFormatUtils.ts b/server/src/internal/invoices/invoiceFormatUtils.ts index 6bb1bfa8b..680104474 100644 --- a/server/src/internal/invoices/invoiceFormatUtils.ts +++ b/server/src/internal/invoices/invoiceFormatUtils.ts @@ -33,7 +33,7 @@ const getSingularAndPlural = (feature: Feature) => { return { singular, plural }; }; -export const formatPrepaidPrice = ({ +const formatPrepaidPrice = ({ quantity, ents, price, @@ -58,7 +58,7 @@ export const formatPrepaidPrice = ({ } }; -export const formatFixedPrice = ({ +const formatFixedPrice = ({ org, price, quantity, @@ -83,7 +83,7 @@ export const formatFixedPrice = ({ } }; -export const formatInArrearProrated = ({ +const formatInArrearProrated = ({ price, ents, quantity, diff --git a/server/src/internal/migrations/migrationUtils.ts b/server/src/internal/migrations/migrationUtils.ts index 64a8f6c5d..811d76027 100644 --- a/server/src/internal/migrations/migrationUtils.ts +++ b/server/src/internal/migrations/migrationUtils.ts @@ -7,7 +7,7 @@ import { } from "@autumn/shared"; import { generateId } from "@/utils/genUtils.js"; -export const constructMigrationError = ({ +const constructMigrationError = ({ migrationJobId, internalCustomerId, data, diff --git a/server/src/internal/migrations/runMigrationTask.ts b/server/src/internal/migrations/runMigrationTask.ts index 80a40e2e3..760cbd9f2 100644 --- a/server/src/internal/migrations/runMigrationTask.ts +++ b/server/src/internal/migrations/runMigrationTask.ts @@ -5,7 +5,7 @@ import { MigrationService } from "./MigrationService.js"; import { getMigrationCustomers } from "./migrationSteps/getMigrationCustomers.js"; import { migrateCustomers } from "./migrationSteps/migrateCustomers.js"; -export interface MigrationTaskPayload { +interface MigrationTaskPayload { migrationJobId: string; orgId: string; env: AppEnv; diff --git a/server/src/internal/misc/pricingAgent/pricingAgentRouter.ts b/server/src/internal/misc/pricingAgent/pricingAgentRouter.ts index 410fe1063..233b6ab19 100644 --- a/server/src/internal/misc/pricingAgent/pricingAgentRouter.ts +++ b/server/src/internal/misc/pricingAgent/pricingAgentRouter.ts @@ -241,7 +241,7 @@ const OrganisationConfigurationSchema = z.object({ products: z.array(ProductSchema), }); -export type PricingConfig = z.infer; +type PricingConfig = z.infer; // ============ SYSTEM PROMPT ============ const SYSTEM_PROMPT = `You are a helpful pricing configuration assistant for Autumn, a billing and entitlements platform. diff --git a/server/src/internal/orgs/handlers/crudHandlers/handleDeleteOrg.ts b/server/src/internal/orgs/handlers/crudHandlers/handleDeleteOrg.ts index 431c6ab86..4ad11fe4a 100644 --- a/server/src/internal/orgs/handlers/crudHandlers/handleDeleteOrg.ts +++ b/server/src/internal/orgs/handlers/crudHandlers/handleDeleteOrg.ts @@ -64,7 +64,7 @@ const deleteStripeWebhooks = async ({ } }; -export const deleteStripeAccounts = async ({ +const deleteStripeAccounts = async ({ org, logger, }: { diff --git a/server/src/internal/orgs/handlers/handleRevenueCatConfig.ts b/server/src/internal/orgs/handlers/handleRevenueCatConfig.ts index c11a02bb1..e0d225105 100644 --- a/server/src/internal/orgs/handlers/handleRevenueCatConfig.ts +++ b/server/src/internal/orgs/handlers/handleRevenueCatConfig.ts @@ -160,7 +160,7 @@ export const handleUpsertRevenueCatConfig = createRoute({ }, }); -export const handleGetVercelSink = createRoute({ +const handleGetVercelSink = createRoute({ handler: async (c) => { const { db, org, env } = c.get("ctx"); const vercelConfig = org.processor_configs?.vercel; diff --git a/server/src/internal/orgs/handlers/stripeHandlers/handleDeleteStripe.ts b/server/src/internal/orgs/handlers/stripeHandlers/handleDeleteStripe.ts index a1de40d14..7f101fd78 100644 --- a/server/src/internal/orgs/handlers/stripeHandlers/handleDeleteStripe.ts +++ b/server/src/internal/orgs/handlers/stripeHandlers/handleDeleteStripe.ts @@ -13,7 +13,7 @@ import { OrgService } from "../../OrgService.js"; import { clearOrgCache } from "../../orgUtils/clearOrgCache.js"; import { isStripeConnected } from "../../orgUtils.js"; -export const disconnectStripe = async ({ +const disconnectStripe = async ({ org, env, logger, @@ -58,7 +58,7 @@ export const disconnectStripe = async ({ } }; -export const clearStripeConfig = async ({ +const clearStripeConfig = async ({ db, org, env, diff --git a/server/src/internal/orgs/orgUtils.ts b/server/src/internal/orgs/orgUtils.ts index 49b51dc13..95c9192c0 100644 --- a/server/src/internal/orgs/orgUtils.ts +++ b/server/src/internal/orgs/orgUtils.ts @@ -112,7 +112,7 @@ export const isStripeConnected = ({ } }; -export const constructOrg = ({ id, slug }: { id: string; slug: string }) => { +const constructOrg = ({ id, slug }: { id: string; slug: string }) => { return { id, slug, @@ -174,7 +174,7 @@ export const getStripeWebhookSecret = (org: Organization, env: AppEnv) => { return decryptData(webhookSecret); }; -export const initDefaultConfig = () => { +const initDefaultConfig = () => { return { free_trial_paid_to_paid: false, @@ -265,7 +265,7 @@ export const createOrgResponse = ({ }; }; -export const getOrgAndFeatures = async ({ req }: { req: any }) => { +const getOrgAndFeatures = async ({ req }: { req: any }) => { const [org, features] = await Promise.all([ OrgService.getFromReq(req), FeatureService.getFromReq(req), @@ -274,7 +274,7 @@ export const getOrgAndFeatures = async ({ req }: { req: any }) => { return { org, features }; }; -export const updateOrgConfig = async ({ +const updateOrgConfig = async ({ db, org, config, diff --git a/server/src/internal/platform/platformBeta/utils/oauthStateUtils.ts b/server/src/internal/platform/platformBeta/utils/oauthStateUtils.ts index 8e337eff0..7ad10d9bd 100644 --- a/server/src/internal/platform/platformBeta/utils/oauthStateUtils.ts +++ b/server/src/internal/platform/platformBeta/utils/oauthStateUtils.ts @@ -5,7 +5,7 @@ import { CacheManager } from "../../../../utils/cacheUtils/CacheManager"; const STATE_KEY_PREFIX = "oauth_state:"; const STATE_EXPIRY_SECONDS = 10 * 60; // 10 minutes -export type OAuthState = { +type OAuthState = { organization_slug: string; env: "test" | "live"; redirect_uri: string; diff --git a/server/src/internal/products/entitlements/entitlementUtils.ts b/server/src/internal/products/entitlements/entitlementUtils.ts index cd26d7e3f..db5a6323e 100644 --- a/server/src/internal/products/entitlements/entitlementUtils.ts +++ b/server/src/internal/products/entitlements/entitlementUtils.ts @@ -20,7 +20,7 @@ import { import RecaseError from "@server/utils/errorUtils"; import { addDays } from "date-fns"; -export const entIntervalToTrialDuration = ({ +const entIntervalToTrialDuration = ({ interval, intervalCount, }: { @@ -45,7 +45,7 @@ export const entIntervalToTrialDuration = ({ } }; -export const trialToDays = (freeTrial: FreeTrial) => { +const trialToDays = (freeTrial: FreeTrial) => { let days: number; switch (freeTrial.duration) { case FreeTrialDuration.Day: @@ -85,7 +85,7 @@ export const applyTrialToEntitlement = ( return false; }; -export const addTrialToNextResetAt = ( +const addTrialToNextResetAt = ( nextResetAt: number, freeTrial: FreeTrial | null, ) => { @@ -94,7 +94,7 @@ export const addTrialToNextResetAt = ( return addDays(new Date(nextResetAt), freeTrial.length).getTime(); }; -export const rolloversAreSame = ({ +const rolloversAreSame = ({ rollover1, rollover2, }: { diff --git a/server/src/internal/products/free-trials/freeTrialUtils.ts b/server/src/internal/products/free-trials/freeTrialUtils.ts index 1e351d212..dee3cb567 100644 --- a/server/src/internal/products/free-trials/freeTrialUtils.ts +++ b/server/src/internal/products/free-trials/freeTrialUtils.ts @@ -30,7 +30,7 @@ export const validateOneOffTrial = async ({ } }; -export const freeTrialsAreSame = ({ +const freeTrialsAreSame = ({ ft1, ft2, }: { diff --git a/server/src/internal/products/handlers/handleCopyProduct/handleCopyProductV2.ts b/server/src/internal/products/handlers/handleCopyProduct/handleCopyProductV2.ts index 9866fdab9..4f866ebb0 100644 --- a/server/src/internal/products/handlers/handleCopyProduct/handleCopyProductV2.ts +++ b/server/src/internal/products/handlers/handleCopyProduct/handleCopyProductV2.ts @@ -12,7 +12,7 @@ import { copyProduct } from "@/internal/products/productUtils.js"; import RecaseError from "@/utils/errorUtils.js"; import { generateId } from "../../../../utils/genUtils"; -export const initNewFeature = ({ +const initNewFeature = ({ data, orgId, env, diff --git a/server/src/internal/products/handlers/productActions/updateProduct.ts b/server/src/internal/products/handlers/productActions/updateProduct.ts index d610e42b5..36839f60f 100644 --- a/server/src/internal/products/handlers/productActions/updateProduct.ts +++ b/server/src/internal/products/handlers/productActions/updateProduct.ts @@ -26,7 +26,7 @@ import { handleUpdateProductDetails } from "../handleUpdateProduct/updateProduct import { handleVersionProductV2 } from "../handleVersionProduct.js"; import { validateDefaultFlag } from "./validateDefaultFlag.js"; -export interface UpdateProductParams { +interface UpdateProductParams { ctx: AutumnContext; productId: string; query: { diff --git a/server/src/internal/products/handlers/productActions/validateDefaultFlag.ts b/server/src/internal/products/handlers/productActions/validateDefaultFlag.ts index 1880491b8..b1ac2aa2d 100644 --- a/server/src/internal/products/handlers/productActions/validateDefaultFlag.ts +++ b/server/src/internal/products/handlers/productActions/validateDefaultFlag.ts @@ -16,7 +16,7 @@ import { isOneOff, } from "../../productUtils"; -export const disableCurrentDefault = async ({ +const disableCurrentDefault = async ({ ctx, body, curProduct, diff --git a/server/src/internal/products/internalProductRouter.ts b/server/src/internal/products/internalProductRouter.ts index 06795440f..f2275bb3b 100644 --- a/server/src/internal/products/internalProductRouter.ts +++ b/server/src/internal/products/internalProductRouter.ts @@ -2,7 +2,7 @@ import { Router } from "express"; import { EntitlementService } from "./entitlements/EntitlementService.js"; import { handleGetProductDeleteInfo } from "./handlers/handleGetProductDeleteInfo.js"; -export const expressProductRouter: Router = Router({ mergeParams: true }); +const expressProductRouter: Router = Router({ mergeParams: true }); import { Hono } from "hono"; import { createRoute } from "@/honoMiddlewares/routeHandler.js"; diff --git a/server/src/internal/products/pricecn/pricecnUtils.ts b/server/src/internal/products/pricecn/pricecnUtils.ts index fcebda279..f81e84b51 100644 --- a/server/src/internal/products/pricecn/pricecnUtils.ts +++ b/server/src/internal/products/pricecn/pricecnUtils.ts @@ -26,7 +26,7 @@ import { } from "../product-items/productItemUtils/getItemType.js"; import { isProductUpgrade } from "../productUtils.js"; -export const sortProductItems = (items: ProductItem[], features: Feature[]) => { +const sortProductItems = (items: ProductItem[], features: Feature[]) => { items.sort((a, b) => { const aIsPriceItem = isPriceItem(a); const bIsPriceItem = isPriceItem(b); @@ -70,7 +70,7 @@ export const sortProductItems = (items: ProductItem[], features: Feature[]) => { return items; }; -export const getIncludedFeatureName = ({ +const getIncludedFeatureName = ({ item, feature, }: { @@ -83,7 +83,7 @@ export const getIncludedFeatureName = ({ }); }; -export const getPriceText = ({ +const getPriceText = ({ item, org, }: { @@ -154,7 +154,7 @@ export const getPricecnPrice = ({ } }; -export const featureToPricecnItem = ({ +const featureToPricecnItem = ({ feature, item, }: { @@ -192,7 +192,7 @@ export const featureToPricecnItem = ({ }; }; -export const featurePricetoPricecnItem = ({ +const featurePricetoPricecnItem = ({ feature, item, org, @@ -258,7 +258,7 @@ export const featurePricetoPricecnItem = ({ }; }; -export const getAttachScenario = ({ +const getAttachScenario = ({ curMainProduct, curScheduledProduct, fullProduct, diff --git a/server/src/internal/products/prices/billingIntervalUtils.ts b/server/src/internal/products/prices/billingIntervalUtils.ts index 3659d34ad..5e394cbef 100644 --- a/server/src/internal/products/prices/billingIntervalUtils.ts +++ b/server/src/internal/products/prices/billingIntervalUtils.ts @@ -21,7 +21,7 @@ import { } from "date-fns"; import { formatUnixToDateTime } from "@/utils/genUtils.js"; -export const subtractBillingIntervalUnix = ({ +const subtractBillingIntervalUnix = ({ unixTimestamp, interval, intervalCount = 1, @@ -54,7 +54,7 @@ export const subtractBillingIntervalUnix = ({ return subtractedDate.getTime(); }; -export const addBillingIntervalUnix = ({ +const addBillingIntervalUnix = ({ unixTimestamp, interval, intervalCount = 1, @@ -114,7 +114,7 @@ export const getNextStartOfMonthUnix = ({ return twelveOClock.getTime(); }; -export const getAlignedIntervalUnix = ({ +const getAlignedIntervalUnix = ({ alignWithUnix, interval, intervalCount, @@ -211,7 +211,7 @@ export const getAlignedIntervalUnix = ({ return billingCycleAnchorUnix; }; -export const subtractFromUnixTillAligned = ({ +const subtractFromUnixTillAligned = ({ targetUnix, originalUnix, }: { diff --git a/server/src/internal/products/prices/billingIntervalUtils2.ts b/server/src/internal/products/prices/billingIntervalUtils2.ts index 49dc9d0ea..ce6d889ec 100644 --- a/server/src/internal/products/prices/billingIntervalUtils2.ts +++ b/server/src/internal/products/prices/billingIntervalUtils2.ts @@ -42,7 +42,7 @@ const isLessThanEquals = ({ a, b }: { a: UTCDate; b: UTCDate }) => { return false; }; -export const subtractIntervalFromAnchor = ({ +const subtractIntervalFromAnchor = ({ anchor, intervalConfig, now, diff --git a/server/src/internal/products/prices/priceInitUtils.ts b/server/src/internal/products/prices/priceInitUtils.ts index c2dd7a0c7..a5e0843c3 100644 --- a/server/src/internal/products/prices/priceInitUtils.ts +++ b/server/src/internal/products/prices/priceInitUtils.ts @@ -15,7 +15,7 @@ import { getBillingType } from "@server/internal/products/prices/priceUtils"; import RecaseError from "@server/utils/errorUtils"; import { generateId } from "@server/utils/genUtils"; -export const constructPrice = ({ +const constructPrice = ({ name, config, orgId, diff --git a/server/src/internal/products/prices/priceUtils.ts b/server/src/internal/products/prices/priceUtils.ts index 2635c236f..95220d897 100644 --- a/server/src/internal/products/prices/priceUtils.ts +++ b/server/src/internal/products/prices/priceUtils.ts @@ -26,7 +26,7 @@ import { Decimal } from "decimal.js"; import { StatusCodes } from "http-status-codes"; import { compareBillingIntervals } from "./priceUtils/priceIntervalUtils.js"; -export const constructPrice = ({ +const constructPrice = ({ internalProductId, entitlementId, orgId, @@ -232,7 +232,7 @@ export const getPriceOptions = ( return options; }; -export const pricesAreSame = (price1: Price, price2: Price) => { +const pricesAreSame = (price1: Price, price2: Price) => { for (const key in price1.config) { const originalValue = (price1.config as any)[key]; const newValue = (price2.config as any)[key]; @@ -253,7 +253,7 @@ export const pricesAreSame = (price1: Price, price2: Price) => { return true; }; -export const getUsageTier = (price: Price, quantity: number) => { +const getUsageTier = (price: Price, quantity: number) => { const usageConfig = price.config as UsagePriceConfig; for (let i = 0; i < usageConfig.usage_tiers.length; i++) { if (i === usageConfig.usage_tiers.length - 1) { @@ -316,11 +316,11 @@ export const getPriceForOverage = (price: Price, overage?: number) => { return Number(amount.toFixed(10)); }; -export const priceToEventName = (productName: string, featureName: string) => { +const priceToEventName = (productName: string, featureName: string) => { return `${productName} - ${featureName}`; }; -export const roundPriceAmounts = (price: Price) => { +const roundPriceAmounts = (price: Price) => { if (price.config!.type === PriceType.Fixed) { const config = price.config as FixedPriceConfig; config.amount = Number(config.amount.toFixed(10)); @@ -358,7 +358,7 @@ export const getProductForPrice = (price: Price, products: FullProduct[]) => { }; // Price to price / tiers -export const priceToAmountOrTiers = (price: Price) => { +const priceToAmountOrTiers = (price: Price) => { if (price.config!.type === PriceType.Fixed) { const config = price.config as FixedPriceConfig; return { @@ -378,7 +378,7 @@ export const priceToAmountOrTiers = (price: Price) => { } }; -export const roundUsage = ({ +const roundUsage = ({ usage, billingUnits, }: { diff --git a/server/src/internal/products/prices/priceUtils/arrearProratedUtils/getContUsageDowngradeItem.ts b/server/src/internal/products/prices/priceUtils/arrearProratedUtils/getContUsageDowngradeItem.ts index ffc825929..64cd44704 100644 --- a/server/src/internal/products/prices/priceUtils/arrearProratedUtils/getContUsageDowngradeItem.ts +++ b/server/src/internal/products/prices/priceUtils/arrearProratedUtils/getContUsageDowngradeItem.ts @@ -32,7 +32,7 @@ export const getReplaceables = ({ return newReplaceables; }; -export const getContUsageDowngradeItem = ({ +const getContUsageDowngradeItem = ({ price, cusEnt, prevOverage, diff --git a/server/src/internal/products/prices/priceUtils/convertPrice.ts b/server/src/internal/products/prices/priceUtils/convertPrice.ts index a20dddf8d..466e090fb 100644 --- a/server/src/internal/products/prices/priceUtils/convertPrice.ts +++ b/server/src/internal/products/prices/priceUtils/convertPrice.ts @@ -16,7 +16,7 @@ export const priceToIntervalKey = (price: Price) => { }); }; -export const toIntervalKey = ({ +const toIntervalKey = ({ interval, intervalCount, }: { diff --git a/server/src/internal/products/prices/priceUtils/findPriceUtils.ts b/server/src/internal/products/prices/priceUtils/findPriceUtils.ts index 203854da7..9017f3d4e 100644 --- a/server/src/internal/products/prices/priceUtils/findPriceUtils.ts +++ b/server/src/internal/products/prices/priceUtils/findPriceUtils.ts @@ -40,7 +40,7 @@ export const findContUsePrice = ({ prices }: { prices: Price[] }) => { }); }; -export const findPriceForFeature = ({ +const findPriceForFeature = ({ prices, feature, internalFeatureId, @@ -116,7 +116,7 @@ export const priceToProduct = ({ ); }; -export const filterByBillingType = ({ +const filterByBillingType = ({ prices, billingType, }: { diff --git a/server/src/internal/products/prices/priceUtils/usagePriceUtils/classifyUsagePrice.ts b/server/src/internal/products/prices/priceUtils/usagePriceUtils/classifyUsagePrice.ts index e03e2a5d5..e717fc44b 100644 --- a/server/src/internal/products/prices/priceUtils/usagePriceUtils/classifyUsagePrice.ts +++ b/server/src/internal/products/prices/priceUtils/usagePriceUtils/classifyUsagePrice.ts @@ -56,7 +56,7 @@ export const isV4Usage = ({ }; // export const -export const onIncreaseToStripeProration = ({ +const onIncreaseToStripeProration = ({ onIncrease, }: { onIncrease: OnIncrease; @@ -71,7 +71,7 @@ export const onIncreaseToStripeProration = ({ return behavior as Stripe.SubscriptionItemUpdateParams.ProrationBehavior; }; -export const onDecreaseToStripeProration = ({ +const onDecreaseToStripeProration = ({ onDecrease, }: { onDecrease: OnDecrease; diff --git a/server/src/internal/products/product-items/productItemUtils.ts b/server/src/internal/products/product-items/productItemUtils.ts index 66fd8f402..0137def16 100644 --- a/server/src/internal/products/product-items/productItemUtils.ts +++ b/server/src/internal/products/product-items/productItemUtils.ts @@ -109,7 +109,7 @@ export const constructPriceItem = ({ return item; }; -export const constructFeaturePriceItem = ({ +const constructFeaturePriceItem = ({ feature_id, feature_type, diff --git a/server/src/internal/products/product-items/productItemUtils/convertItem.ts b/server/src/internal/products/product-items/productItemUtils/convertItem.ts index 8a1701aff..43f4913dc 100644 --- a/server/src/internal/products/product-items/productItemUtils/convertItem.ts +++ b/server/src/internal/products/product-items/productItemUtils/convertItem.ts @@ -6,7 +6,7 @@ import { UsageModel, } from "@autumn/shared"; -export const itemToFeature = ({ +const itemToFeature = ({ item, features, }: { diff --git a/server/src/internal/products/product-items/productItemUtils/itemToPriceAndEnt.ts b/server/src/internal/products/product-items/productItemUtils/itemToPriceAndEnt.ts index 893878151..dc85ec240 100644 --- a/server/src/internal/products/product-items/productItemUtils/itemToPriceAndEnt.ts +++ b/server/src/internal/products/product-items/productItemUtils/itemToPriceAndEnt.ts @@ -35,7 +35,7 @@ import { isPriceItem, } from "./getItemType.js"; -export const getResetUsage = ({ +const getResetUsage = ({ item, feature, }: { @@ -55,7 +55,7 @@ export const getResetUsage = ({ return item.reset_usage_when_enabled; }; // ITEM TO PRICE AND ENTITLEMENT -export const toPrice = ({ +const toPrice = ({ item, orgId, internalProductId, @@ -161,7 +161,7 @@ export const toFeature = ({ return { price: null, ent }; }; -export const toFeatureAndPrice = ({ +const toFeatureAndPrice = ({ item, orgId, internalFeatureId, diff --git a/server/src/internal/products/productUtils.ts b/server/src/internal/products/productUtils.ts index 8812c796e..db00febd5 100644 --- a/server/src/internal/products/productUtils.ts +++ b/server/src/internal/products/productUtils.ts @@ -59,7 +59,7 @@ export const getLatestProducts = (products: FullProduct[]) => { return Object.values(latestProducts) as FullProduct[]; }; -export const getProductVersionCounts = (products: FullProduct[]) => { +const getProductVersionCounts = (products: FullProduct[]) => { const versionCounts = products.reduce((acc: any, product: any) => { if (!acc[product.id]) { acc[product.id] = 1; @@ -194,7 +194,7 @@ export const isFreeProduct = (prices: Price[]) => { return totalPrice === 0; }; -export const getOptionsFromPrices = (prices: Price[], features: Feature[]) => { +const getOptionsFromPrices = (prices: Price[], features: Feature[]) => { const featureToOptions: { [key: string]: any } = {}; for (const price of prices) { if (price.config!.type === PriceType.Fixed) { @@ -293,7 +293,7 @@ export const checkStripeProductExists = async ({ } }; -export const getPricesForProduct = (product: FullProduct, prices: Price[]) => { +const getPricesForProduct = (product: FullProduct, prices: Price[]) => { return prices.filter((p) => p.internal_product_id === product.internal_id); }; @@ -515,7 +515,7 @@ export const isOneOff = (prices: Price[]) => { ); }; -export const itemsAreOneOff = (items: Entitlement[]) => { +const itemsAreOneOff = (items: Entitlement[]) => { return items.every( (item) => item.interval === null || @@ -569,7 +569,7 @@ export const initProductInStripe = async ({ await Promise.all(batchPriceUpdate); }; -export const searchProductsByStripeId = async ({ +const searchProductsByStripeId = async ({ products, stripeId, }: { diff --git a/server/src/internal/products/productUtils/classifyProduct.ts b/server/src/internal/products/productUtils/classifyProduct.ts index 9124b61bf..933998c8f 100644 --- a/server/src/internal/products/productUtils/classifyProduct.ts +++ b/server/src/internal/products/productUtils/classifyProduct.ts @@ -10,7 +10,7 @@ import { pricesOnlyOneOff } from "../prices/priceUtils.js"; import { isFeatureItem } from "../product-items/productItemUtils/getItemType.js"; import { isFreeProduct } from "../productUtils.js"; -export const prodIsAddOn = ({ product }: { product: FullProduct }) => { +const prodIsAddOn = ({ product }: { product: FullProduct }) => { return product.is_add_on; }; @@ -48,7 +48,7 @@ export const isFreeProductV2 = ({ ); }; -export const isDefaultTrial = ({ +const isDefaultTrial = ({ product, skipDefault = false, }: { diff --git a/server/src/internal/products/productUtils/productResponseUtils/getProductResponse.ts b/server/src/internal/products/productUtils/productResponseUtils/getProductResponse.ts index d4276bed9..c64a05e34 100644 --- a/server/src/internal/products/productUtils/productResponseUtils/getProductResponse.ts +++ b/server/src/internal/products/productUtils/productResponseUtils/getProductResponse.ts @@ -82,7 +82,7 @@ export const getProductItemResponse = ({ }); }; -export const getFreeTrialResponse = async ({ +const getFreeTrialResponse = async ({ db, product, fullCus, @@ -127,7 +127,7 @@ export const getFreeTrialResponse = async ({ return null; }; -export const getProductProperties = ({ +const getProductProperties = ({ product, freeTrial, }: { diff --git a/server/src/internal/products/productUtils/productV2Utils/convertProductV2ToV1.ts b/server/src/internal/products/productUtils/productV2Utils/convertProductV2ToV1.ts index 016a2fbb1..556b2abaa 100644 --- a/server/src/internal/products/productUtils/productV2Utils/convertProductV2ToV1.ts +++ b/server/src/internal/products/productUtils/productV2Utils/convertProductV2ToV1.ts @@ -11,7 +11,7 @@ import { itemToPriceAndEnt } from "@/internal/products/product-items/productItem * V1 product format with entitlements as a record (used in tests) * Different from FullProduct which has entitlements as an array */ -export type ProductV1 = { +type ProductV1 = { id: string; name: string; is_default: boolean; diff --git a/server/src/internal/rewards/rewardUtils.ts b/server/src/internal/rewards/rewardUtils.ts index 4dd18bf8c..355764796 100644 --- a/server/src/internal/rewards/rewardUtils.ts +++ b/server/src/internal/rewards/rewardUtils.ts @@ -86,13 +86,13 @@ export const getRewardCat = (reward: Reward) => { return RewardCategory.Discount; }; -export enum CouponType { +enum CouponType { AddInvoiceBalance = "add_invoice_balance", AddBillingCredits = "add_billing_credits", Standard = "standard", } -export const getCouponType = (reward: Reward) => { +const getCouponType = (reward: Reward) => { if (!reward) return null; const config = reward.discount_config; @@ -170,7 +170,7 @@ export const initRewardStripePrices = async ({ return; }; -export const formatReward = ({ reward }: { reward: Reward }) => { +const formatReward = ({ reward }: { reward: Reward }) => { if (!reward) return ""; const discountString = reward.type === RewardType.PercentageDiscount @@ -186,7 +186,7 @@ export const formatReward = ({ reward }: { reward: Reward }) => { return discountString; }; -export const getAmountAfterReward = ({ +const getAmountAfterReward = ({ amount, reward, subDiscounts, @@ -230,7 +230,7 @@ export const getAmountAfterReward = ({ return amount; }; -export const discountAppliesToPrice = ({ +const discountAppliesToPrice = ({ discount, product, price, @@ -282,7 +282,7 @@ export const getUnusedAmountAfterDiscount = ({ return amountAfterDiscount; }; -export const getAmountAfterStripeDiscounts = ({ +const getAmountAfterStripeDiscounts = ({ price, amount, product, diff --git a/server/src/middleware/apiAuthMiddleware.ts b/server/src/middleware/apiAuthMiddleware.ts index 1bf498e45..9fdd6ebc1 100644 --- a/server/src/middleware/apiAuthMiddleware.ts +++ b/server/src/middleware/apiAuthMiddleware.ts @@ -10,7 +10,7 @@ const maskApiKey = (apiKey: string) => { return apiKey.slice(0, 15) + apiKey.slice(15).replace(/./g, "*"); }; -export const verifySecretKey = async (req: any, res: any, next: any) => { +const verifySecretKey = async (req: any, res: any, next: any) => { const authHeader = req.headers.authorization || req.headers.Authorization; if (!authHeader || !authHeader.startsWith("Bearer ")) { diff --git a/server/src/middleware/authMiddleware.ts b/server/src/middleware/authMiddleware.ts index 6c6e6af37..365a7d07e 100644 --- a/server/src/middleware/authMiddleware.ts +++ b/server/src/middleware/authMiddleware.ts @@ -69,7 +69,7 @@ export const withOrgAuth = async (req: any, res: any, next: NextFunction) => { } }; -export const withAuth = async (req: any, res: any, next: NextFunction) => { +const withAuth = async (req: any, res: any, next: NextFunction) => { const session = await auth.api.getSession({ headers: fromNodeHeaders(req.headers), }); diff --git a/server/src/middleware/publicAuthMiddleware.ts b/server/src/middleware/publicAuthMiddleware.ts index 64ac670e7..ba460cb41 100644 --- a/server/src/middleware/publicAuthMiddleware.ts +++ b/server/src/middleware/publicAuthMiddleware.ts @@ -25,7 +25,7 @@ const allowedEndpoints = [ }, ]; -export interface IsAllowedEndpointProps { +interface IsAllowedEndpointProps { pattern: string; path: string; method: string; diff --git a/server/src/queue/bullmq/initBullMq.ts b/server/src/queue/bullmq/initBullMq.ts index be12b2463..dc7ff0918 100644 --- a/server/src/queue/bullmq/initBullMq.ts +++ b/server/src/queue/bullmq/initBullMq.ts @@ -23,7 +23,7 @@ export const queue = new Queue("autumn", { }, }); -export const queueRedis = new Redis(process.env.QUEUE_URL, { +const queueRedis = new Redis(process.env.QUEUE_URL, { tls: caText ? { ca: caText } : undefined, }); diff --git a/server/src/queue/initSqs.ts b/server/src/queue/initSqs.ts index de81de1e7..bd9e2091a 100644 --- a/server/src/queue/initSqs.ts +++ b/server/src/queue/initSqs.ts @@ -6,7 +6,7 @@ const DEFAULT_AWS_REGION = "us-west-2"; * Extracts the AWS region from a given SQS queue URL. * Returns undefined if the URL is empty or invalid. */ -export function extractRegionFromQueueUrl({ +function extractRegionFromQueueUrl({ queueUrl, }: { queueUrl: string | undefined; diff --git a/server/src/queue/queueUtils.ts b/server/src/queue/queueUtils.ts index 82d34bb2c..6cfbbe21f 100644 --- a/server/src/queue/queueUtils.ts +++ b/server/src/queue/queueUtils.ts @@ -133,7 +133,7 @@ export const addTaskToQueue = async ({ }; // Hatchet workflow payloads -export interface HatchetPayloads { +interface HatchetPayloads { [JobName.VerifyCacheConsistency]: VerifyCacheInput; } diff --git a/server/src/queue/workflows.ts b/server/src/queue/workflows.ts index 88827abac..a9b1df3b4 100644 --- a/server/src/queue/workflows.ts +++ b/server/src/queue/workflows.ts @@ -12,13 +12,13 @@ export type SendProductsUpdatedPayload = { scenario: string; }; -export type GenerateFeatureDisplayPayload = { +type GenerateFeatureDisplayPayload = { featureId: string; orgId: string; env: AppEnv; }; -export type VerifyCacheConsistencyPayload = { +type VerifyCacheConsistencyPayload = { customerId: string; orgId: string; env: AppEnv; diff --git a/server/src/utils/authUtils/afterOrgCreated.ts b/server/src/utils/authUtils/afterOrgCreated.ts index 21d4631ca..fb4b2ddb9 100644 --- a/server/src/utils/authUtils/afterOrgCreated.ts +++ b/server/src/utils/authUtils/afterOrgCreated.ts @@ -11,7 +11,7 @@ import { createConnectAccount } from "@/internal/orgs/orgUtils/createConnectAcco import { generatePublishableKey } from "../encryptUtils.js"; import { captureOrgEvent } from "../posthog.js"; -export const initOrgSvixApps = async ({ +const initOrgSvixApps = async ({ id, slug, }: { diff --git a/server/src/utils/cacheUtils/CacheType.ts b/server/src/utils/cacheUtils/CacheType.ts index c0fbe6841..0698925db 100644 --- a/server/src/utils/cacheUtils/CacheType.ts +++ b/server/src/utils/cacheUtils/CacheType.ts @@ -1,5 +1,4 @@ export enum CacheType { SecretKey = "secret_key", PublicKey = "public_key", - TopEvents = "top_events", -} + } diff --git a/server/src/utils/constants.ts b/server/src/utils/constants.ts index 424883431..edc7f8292 100644 --- a/server/src/utils/constants.ts +++ b/server/src/utils/constants.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { CusProductStatus } from "@autumn/shared"; -export const BREAK_API_VERSION = 0.2; +const BREAK_API_VERSION = 0.2; -export const getActiveCusProductStatuses = () => [ +const getActiveCusProductStatuses = () => [ CusProductStatus.Active, CusProductStatus.PastDue, ]; diff --git a/server/src/utils/errorUtils.ts b/server/src/utils/errorUtils.ts index f994dcf41..04aeb55b2 100644 --- a/server/src/utils/errorUtils.ts +++ b/server/src/utils/errorUtils.ts @@ -7,7 +7,7 @@ import { ZodError } from "zod/v4"; import { formatZodError } from "../errors/formatZodError.js"; import { getSentryTags } from "../external/sentry/sentryUtils.js"; -export const isPaymentDeclined = (error: any) => { +const isPaymentDeclined = (error: any) => { return ( error instanceof RecaseError && error.code === ErrCode.StripeCardDeclined ); @@ -142,7 +142,7 @@ export const handleRequestError = ({ } }; -export const handleFrontendReqError = ({ +const handleFrontendReqError = ({ error, req, res, diff --git a/server/src/utils/genUtils.ts b/server/src/utils/genUtils.ts index b7cfff77b..b3df83f29 100644 --- a/server/src/utils/genUtils.ts +++ b/server/src/utils/genUtils.ts @@ -38,7 +38,7 @@ export const keyToTitle = (key: string) => { .replace(/\b\w/g, (char) => char.toUpperCase()); }; -export const notNullOrUndefined = ( +const notNullOrUndefined = ( value: T | null | undefined, ): value is T => { return value !== null && value !== undefined; @@ -79,7 +79,7 @@ export const formatUnixToDateTime = ( ); }; -export const formatUnixSecondsToDateTime = (unixSeconds?: number | null) => { +const formatUnixSecondsToDateTime = (unixSeconds?: number | null) => { if (!unixSeconds) { return "undefined"; } @@ -87,7 +87,7 @@ export const formatUnixSecondsToDateTime = (unixSeconds?: number | null) => { return formatUnixToDateTime(unixSeconds * 1000); }; -export const formatUnixToUTCDateTime = ( +const formatUnixToUTCDateTime = ( unixDate?: number | null, withTimezone?: boolean, ) => { @@ -111,7 +111,7 @@ export const timeout = (ms: number) => { return new Promise((resolve) => setTimeout(resolve, ms)); }; -export const validateId = (type: string, id: string) => { +const validateId = (type: string, id: string) => { if (!id.match(/^[a-zA-Z0-9_-]+$/)) { throw new RecaseError({ message: `${type} ID can only contain alphanumeric characters, underscores, and hyphens`, @@ -156,7 +156,7 @@ export const getUnique = (vals: string[]) => { return Array.from(new Set(vals)); }; -export const sumValues = (vals: number[]) => { +const sumValues = (vals: number[]) => { const { Decimal } = require("decimal.js"); return vals .reduce( diff --git a/server/src/utils/models/Request.ts b/server/src/utils/models/Request.ts index ba5c35681..af23ecd7b 100644 --- a/server/src/utils/models/Request.ts +++ b/server/src/utils/models/Request.ts @@ -35,7 +35,7 @@ export interface ExtendedRequest extends ExpressRequest { skipCache: boolean; } -export interface ActionRequest { +interface ActionRequest { id: string; authType: AuthType; method: string; diff --git a/server/src/utils/posthog.ts b/server/src/utils/posthog.ts index 635525246..232a6cd15 100644 --- a/server/src/utils/posthog.ts +++ b/server/src/utils/posthog.ts @@ -1,6 +1,6 @@ import { PostHog } from "posthog-node"; -export const posthogClient = process.env.POSTHOG_API_KEY +const posthogClient = process.env.POSTHOG_API_KEY ? new PostHog(process.env.POSTHOG_API_KEY, { host: process.env.POSTHOG_HOST || "https://us.i.posthog.com", }) diff --git a/server/src/utils/timeUtils.ts b/server/src/utils/timeUtils.ts index a758146b9..acb175465 100644 --- a/server/src/utils/timeUtils.ts +++ b/server/src/utils/timeUtils.ts @@ -4,7 +4,7 @@ import { add } from "date-fns"; import { formatUnixToDate } from "./genUtils.js"; // Time conversion constants -export const TIME_MS = { +const TIME_MS = { SECOND: 1000, MINUTE: 1000 * 60, HOUR: 1000 * 60 * 60, diff --git a/shared/api/balances/track/trackLegacyData.ts b/shared/api/balances/track/trackLegacyData.ts index df318c40a..2444f57a0 100644 --- a/shared/api/balances/track/trackLegacyData.ts +++ b/shared/api/balances/track/trackLegacyData.ts @@ -4,4 +4,4 @@ export const TrackLegacyDataSchema = z.object({ feature_id: z.string(), }); -export type TrackLegacyData = z.infer; +type TrackLegacyData = z.infer; diff --git a/shared/api/billing/common/featureQuantities.ts b/shared/api/billing/common/featureQuantities.ts index b80020341..dea249292 100644 --- a/shared/api/billing/common/featureQuantities.ts +++ b/shared/api/billing/common/featureQuantities.ts @@ -5,4 +5,4 @@ export const FeatureQuantitySchema = z.object({ quantity: z.number(), }); -export type FeatureQuantity = z.infer; +type FeatureQuantity = z.infer; diff --git a/shared/api/billing/common/planOverride.ts b/shared/api/billing/common/planOverride.ts index 6caeb4aae..7efd6e97c 100644 --- a/shared/api/billing/common/planOverride.ts +++ b/shared/api/billing/common/planOverride.ts @@ -23,4 +23,4 @@ export const PlanOverrideSchema = z }, ); -export type PlanOverride = z.infer; +type PlanOverride = z.infer; diff --git a/shared/api/common/customerId.ts b/shared/api/common/customerId.ts index ffe30a094..ac7f2b37a 100644 --- a/shared/api/common/customerId.ts +++ b/shared/api/common/customerId.ts @@ -35,4 +35,4 @@ export const CustomerIdSchema = z.string().refine( }, ); -export type CustomerId = z.infer; +type CustomerId = z.infer; diff --git a/shared/api/customers/components/apiTrialsUsed/prevVersions/apiTrialsUsedV0.ts b/shared/api/customers/components/apiTrialsUsed/prevVersions/apiTrialsUsedV0.ts index 0f487b995..528c377cf 100644 --- a/shared/api/customers/components/apiTrialsUsed/prevVersions/apiTrialsUsedV0.ts +++ b/shared/api/customers/components/apiTrialsUsed/prevVersions/apiTrialsUsedV0.ts @@ -6,4 +6,4 @@ export const ApiTrialsUsedV0Schema = z.object({ fingerprint: z.string().nullish(), }); -export type ApiTrialsUsedV0 = z.infer; +type ApiTrialsUsedV0 = z.infer; diff --git a/shared/api/customers/cusFeatures/changes/V1.2_CusFeatureChange.ts b/shared/api/customers/cusFeatures/changes/V1.2_CusFeatureChange.ts index 2d80040c0..b01e2175c 100644 --- a/shared/api/customers/cusFeatures/changes/V1.2_CusFeatureChange.ts +++ b/shared/api/customers/cusFeatures/changes/V1.2_CusFeatureChange.ts @@ -273,7 +273,7 @@ export function transformBalanceToCusFeatureV3({ * Input: ApiCusFeature (V2.0+ format) * Output: ApiCusFeatureV3 (V1.2 format) */ -export const V1_2_CusFeatureChange = defineVersionChange({ +const V1_2_CusFeatureChange = defineVersionChange({ newVersion: ApiVersion.V2_0, oldVersion: ApiVersion.V1_2, description: [ diff --git a/shared/api/customers/cusPlans/changes/V0.2_CusProductChange.ts b/shared/api/customers/cusPlans/changes/V0.2_CusProductChange.ts index 1133d0f2e..4483d8ba4 100644 --- a/shared/api/customers/cusPlans/changes/V0.2_CusProductChange.ts +++ b/shared/api/customers/cusPlans/changes/V0.2_CusProductChange.ts @@ -22,7 +22,7 @@ import { ApiCusProductV2Schema } from "../previousVersions/apiCusProductV2.js"; * Transform product from V2 format to V1 format * Exported so it can be reused in other transformations (e.g., V0_2_CustomerChange) */ -export const transformItemToPrice = ({ +const transformItemToPrice = ({ item, }: { item: z.infer; @@ -135,7 +135,7 @@ export function transformCusProductV2ToV1({ return v1CusProduct; } -export const V0_2_CusProductChange = defineVersionChange({ +const V0_2_CusProductChange = defineVersionChange({ newVersion: ApiVersion.V1_1, // Breaking change introduced in V1_1 oldVersion: ApiVersion.V0_2, // Applied when targetVersion <= V0_2 description: ["Customer product response revamped to fit ProductV2 schema"], diff --git a/shared/api/customers/cusPlans/changes/V1.2_CusPlanChange.ts b/shared/api/customers/cusPlans/changes/V1.2_CusPlanChange.ts index 7ed3a89db..474c68c63 100644 --- a/shared/api/customers/cusPlans/changes/V1.2_CusPlanChange.ts +++ b/shared/api/customers/cusPlans/changes/V1.2_CusPlanChange.ts @@ -105,7 +105,7 @@ export function transformSubscriptionToCusProductV3({ * Input: ApiCusPlan (V2.0+ format with "product" field) * Output: ApiCusProductV3 (V1.2 format with verbose fields) */ -export const V1_2_CusPlanChange = defineVersionChange({ +const V1_2_CusPlanChange = defineVersionChange({ newVersion: ApiVersion.V2_0, oldVersion: ApiVersion.V1_2, description: [ diff --git a/shared/api/customers/cusPlans/previousVersions/apiCusProductV0.ts b/shared/api/customers/cusPlans/previousVersions/apiCusProductV0.ts index 0906ad59b..062e257c8 100644 --- a/shared/api/customers/cusPlans/previousVersions/apiCusProductV0.ts +++ b/shared/api/customers/cusPlans/previousVersions/apiCusProductV0.ts @@ -1,6 +1,6 @@ import { z } from "zod/v4"; -export const ApiCusProductV0PriceSchema = z.object({ +const ApiCusProductV0PriceSchema = z.object({ amount: z.number(), interval: z.string(), }); @@ -26,4 +26,4 @@ export const ApiCusProductV0Schema = z.object({ starts_at: z.number(), }); -export type ApiCusProductV0 = z.infer; +type ApiCusProductV0 = z.infer; diff --git a/shared/api/customers/cusPlans/previousVersions/apiCusProductV1.ts b/shared/api/customers/cusPlans/previousVersions/apiCusProductV1.ts index 6eaa8418e..17242e969 100644 --- a/shared/api/customers/cusPlans/previousVersions/apiCusProductV1.ts +++ b/shared/api/customers/cusPlans/previousVersions/apiCusProductV1.ts @@ -14,4 +14,4 @@ export const ApiCusProductV1Schema = ApiCusProductV0Schema.extend({ current_period_start: z.number().nullish(), }); -export type ApiCusProductV1 = z.infer; +type ApiCusProductV1 = z.infer; diff --git a/shared/api/customers/cusPlans/previousVersions/apiCusProductV2.ts b/shared/api/customers/cusPlans/previousVersions/apiCusProductV2.ts index da6c34e6b..246795576 100644 --- a/shared/api/customers/cusPlans/previousVersions/apiCusProductV2.ts +++ b/shared/api/customers/cusPlans/previousVersions/apiCusProductV2.ts @@ -31,4 +31,4 @@ export const ApiCusProductV2Schema = z.object({ quantity: z.number().optional(), }); -export type ApiCusProductV2 = z.infer; +type ApiCusProductV2 = z.infer; diff --git a/shared/api/customers/previousVersions/apiCustomerV0.ts b/shared/api/customers/previousVersions/apiCustomerV0.ts index 4d5200e6d..0e275bb66 100644 --- a/shared/api/customers/previousVersions/apiCustomerV0.ts +++ b/shared/api/customers/previousVersions/apiCustomerV0.ts @@ -22,7 +22,7 @@ import { ApiTrialsUsedV0Schema } from "../components/apiTrialsUsed/prevVersions/ */ // Core customer object (without products/features/invoices) -export const ApiCustomerV0CoreSchema = z.object({ +const ApiCustomerV0CoreSchema = z.object({ // Internal fields id: z.string().nullable(), name: z.string().default(""), @@ -51,5 +51,5 @@ export const ApiCustomerV0Schema = z.object({ trials_used: z.array(ApiTrialsUsedV0Schema).optional(), }); -export type ApiCustomerV0 = z.infer; -export type ApiCustomerV0Core = z.infer; +type ApiCustomerV0 = z.infer; +type ApiCustomerV0Core = z.infer; diff --git a/shared/api/customers/previousVersions/apiCustomerV1.ts b/shared/api/customers/previousVersions/apiCustomerV1.ts index 5ab46f62d..ab35393f9 100644 --- a/shared/api/customers/previousVersions/apiCustomerV1.ts +++ b/shared/api/customers/previousVersions/apiCustomerV1.ts @@ -24,7 +24,7 @@ import { ApiCusProductV1Schema } from "../cusPlans/previousVersions/apiCusProduc */ // Core customer object (without products/features/invoices) -export const ApiCustomerV1CoreSchema = z.object({ +const ApiCustomerV1CoreSchema = z.object({ // Internal fields id: z.string().nullable(), name: z.string().nullable(), @@ -55,4 +55,4 @@ export const ApiCustomerV1Schema = z.object({ }); export type ApiCustomerV1 = z.infer; -export type ApiCustomerV1Core = z.infer; +type ApiCustomerV1Core = z.infer; diff --git a/shared/api/others/apiInvoice/prevVersions/apiInvoiceV0.ts b/shared/api/others/apiInvoice/prevVersions/apiInvoiceV0.ts index e98282c37..bf31d0bef 100644 --- a/shared/api/others/apiInvoice/prevVersions/apiInvoiceV0.ts +++ b/shared/api/others/apiInvoice/prevVersions/apiInvoiceV0.ts @@ -31,4 +31,4 @@ export const ApiInvoiceV0Schema = z.object({ }), }); -export type ApiInvoiceV0 = z.infer; +type ApiInvoiceV0 = z.infer; diff --git a/shared/db/auth-relations.ts b/shared/db/auth-relations.ts index 41d96b1df..861f5c928 100644 --- a/shared/db/auth-relations.ts +++ b/shared/db/auth-relations.ts @@ -23,7 +23,7 @@ export const userRelations = relations(user, ({ many }) => ({ oauthConsents: many(oauthConsent), })); -export const sessionRelations = relations(session, ({ one, many }) => ({ +const sessionRelations = relations(session, ({ one, many }) => ({ user: one(user, { fields: [session.userId], references: [user.id], @@ -32,7 +32,7 @@ export const sessionRelations = relations(session, ({ one, many }) => ({ oauthAccessTokens: many(oauthAccessToken), })); -export const accountRelations = relations(account, ({ one }) => ({ +const accountRelations = relations(account, ({ one }) => ({ user: one(user, { fields: [account.userId], references: [user.id], @@ -62,7 +62,7 @@ export const inviteRelations = relations(invitation, ({ one }) => ({ })); // OAuth Provider relations -export const oauthClientRelations = relations(oauthClient, ({ one, many }) => ({ +const oauthClientRelations = relations(oauthClient, ({ one, many }) => ({ user: one(user, { fields: [oauthClient.userId], references: [user.id], @@ -72,7 +72,7 @@ export const oauthClientRelations = relations(oauthClient, ({ one, many }) => ({ oauthConsents: many(oauthConsent), })); -export const oauthRefreshTokenRelations = relations( +const oauthRefreshTokenRelations = relations( oauthRefreshToken, ({ one, many }) => ({ oauthClient: one(oauthClient, { @@ -91,7 +91,7 @@ export const oauthRefreshTokenRelations = relations( }), ); -export const oauthAccessTokenRelations = relations( +const oauthAccessTokenRelations = relations( oauthAccessToken, ({ one }) => ({ oauthClient: one(oauthClient, { @@ -113,7 +113,7 @@ export const oauthAccessTokenRelations = relations( }), ); -export const oauthConsentRelations = relations(oauthConsent, ({ one }) => ({ +const oauthConsentRelations = relations(oauthConsent, ({ one }) => ({ oauthClient: one(oauthClient, { fields: [oauthConsent.clientId], references: [oauthClient.clientId], diff --git a/shared/enums/AttachErrCode.ts b/shared/enums/AttachErrCode.ts index 462ec03b8..75252bec0 100644 --- a/shared/enums/AttachErrCode.ts +++ b/shared/enums/AttachErrCode.ts @@ -2,5 +2,4 @@ export enum AttachErrCode { // InvalidOptions = "invalid_options", ProductAlreadyAttached = "product_already_attached", - InvalidOptions = "invalid_options", -} + } diff --git a/shared/enums/SuccessCode.ts b/shared/enums/SuccessCode.ts index b96b6278c..ddcbaf503 100644 --- a/shared/enums/SuccessCode.ts +++ b/shared/enums/SuccessCode.ts @@ -1,20 +1,11 @@ export enum SuccessCode { InvoiceActionRequired = "invoice_action_required", // Track - SuccessfullyDeducted = "successfully_deducted", - EventReceived = "event_received", - EventReceivedCustomerCreated = "event_received_customer_created", - // Entitlements FeatureFound = "feature_found", - FeatureFoundCustomerCreated = "feature_found_customer_created", - // Attach FeaturesUpdated = "features_updated", UpgradedToNewProduct = "upgraded_to_new_product", - UpgradedToNewVersion = "upgraded_to_new_version", - UpdatedSameProduct = "updated_same_product", - PrepaidQuantityUpdated = "prepaid_quantity_updated", DowngradeScheduled = "downgrade_scheduled", FreeProductAttached = "free_product_attached", diff --git a/shared/models/billingModels/ongoingCusProductAction.ts b/shared/models/billingModels/ongoingCusProductAction.ts index 740b4d922..2b7ebfe6f 100644 --- a/shared/models/billingModels/ongoingCusProductAction.ts +++ b/shared/models/billingModels/ongoingCusProductAction.ts @@ -1,7 +1,7 @@ import z from "zod/v4"; import { FullCusProductSchema } from "../cusProductModels/cusProductModels"; -export enum OngoingCusProductActionEnum { +enum OngoingCusProductActionEnum { Expire = "expire", Cancel = "cancel", Uncancel = "uncancel", diff --git a/shared/models/cusModels/cusExpand.ts b/shared/models/cusModels/cusExpand.ts index 50b887f22..20f7cad2c 100644 --- a/shared/models/cusModels/cusExpand.ts +++ b/shared/models/cusModels/cusExpand.ts @@ -1,11 +1,5 @@ // Previous customer expand options for v1.2 of the API export enum CusExpandV0 { - Invoices = "invoices", - TrialsUsed = "trials_used", - Rewards = "rewards", - Entities = "entities", - Referrals = "referrals", - PaymentMethod = "payment_method", // UpcomingInvoice = "upcoming_invoice", } @@ -17,7 +11,6 @@ export enum CusExpand { Entities = "entities", Referrals = "referrals", PaymentMethod = "payment_method", - UpcomingInvoice = "upcoming_invoice", // PlansPlan = "plans.plan", SubscriptionsPlan = "subscriptions.plan", diff --git a/shared/models/cusModels/entityModels/entityExpand.ts b/shared/models/cusModels/entityModels/entityExpand.ts index 7fd64addc..6b27d06ad 100644 --- a/shared/models/cusModels/entityModels/entityExpand.ts +++ b/shared/models/cusModels/entityModels/entityExpand.ts @@ -1,6 +1,5 @@ export enum EntityExpandV0 { - Invoices = "invoices", -} + } export enum EntityExpand { Invoices = "invoices", diff --git a/shared/models/featureModels/featureEnums.ts b/shared/models/featureModels/featureEnums.ts index 3e6cba479..430d87a62 100644 --- a/shared/models/featureModels/featureEnums.ts +++ b/shared/models/featureModels/featureEnums.ts @@ -5,7 +5,6 @@ export enum FeatureType { } export enum AggregateType { - Count = "count", Sum = "sum", } diff --git a/shared/models/genModels/genEnums.ts b/shared/models/genModels/genEnums.ts index d9088d016..ea01e1a3b 100644 --- a/shared/models/genModels/genEnums.ts +++ b/shared/models/genModels/genEnums.ts @@ -4,14 +4,7 @@ export enum AppEnv { } export enum Duration { - Minute = "minute", - Hour = "hour", - Day = "day", - Week = "week", - Month = "month", - Year = "year", - Lifetime = "lifetime", -} + } export enum ProcessorType { Stripe = "stripe", diff --git a/shared/models/genModels/processorSchemas.ts b/shared/models/genModels/processorSchemas.ts index 4af3a6cd6..0ea0dd025 100644 --- a/shared/models/genModels/processorSchemas.ts +++ b/shared/models/genModels/processorSchemas.ts @@ -40,8 +40,7 @@ export type ExternalCusProductProcessors = z.infer< export enum VercelMarketplaceMode { Installation = "installation", - Resource = "resource", -} + } /** * Organization-level Vercel processor configuration diff --git a/shared/package.json b/shared/package.json index baef66ec8..7ddb95f35 100644 --- a/shared/package.json +++ b/shared/package.json @@ -28,7 +28,6 @@ "dotenv": "^16.5.0", "drizzle-kit": "catalog:", "drizzle-orm": "catalog:", - "drizzle-zod": "^0.8.2", "stripe": "catalog:", "yaml": "^2.8.1", "zod-openapi": "^5.4.1" @@ -40,8 +39,6 @@ "@types/bun": "latest", "@types/node": "^24.0.3", "cross-env": "^7.0.3", - "nodemon": "^3.1.7", - "tsx": "^4.19.4", "typescript": "^5.7.2" }, "private": true diff --git a/shared/utils/billingUtils/cycleUtils/getCycleIntervalFunctions.ts b/shared/utils/billingUtils/cycleUtils/getCycleIntervalFunctions.ts index a5bbb2605..db4a203e2 100644 --- a/shared/utils/billingUtils/cycleUtils/getCycleIntervalFunctions.ts +++ b/shared/utils/billingUtils/cycleUtils/getCycleIntervalFunctions.ts @@ -15,7 +15,7 @@ import { differenceInYears, } from "date-fns"; -export type IntervalFns = { +type IntervalFns = { add: (date: Date, amount: number) => Date; difference: (later: Date, earlier: Date) => number; }; diff --git a/vite/package.json b/vite/package.json index 1ee201bee..55597e9a0 100644 --- a/vite/package.json +++ b/vite/package.json @@ -17,28 +17,20 @@ "author": "Recase Inc.", "license": "Apache-2.0", "dependencies": { - "better-auth": "1.4.12", + "better-auth": "catalog:", "@ai-sdk/react": "^3.0.25", - "@amplitude/unified": "^1.0.0-beta.9", "@autumn/shared": "workspace:*", "@better-auth/dash": "catalog:", - "@better-auth/stripe": "^1.2.12", - "@date-fns/utc": "^2.1.1", "@fortawesome/free-brands-svg-icons": "^6.7.2", "@fortawesome/react-fontawesome": "^0.2.2", - "@heroicons/react": "^2.2.0", - "@jsx-tool/jsx-tool": "^0.0.21", "@phosphor-icons/react": "^2.1.10", "@radix-ui/react-accordion": "^1.2.11", "@radix-ui/react-checkbox": "^1.1.4", - "@radix-ui/react-collapsible": "^1.1.12", - "@radix-ui/react-context-menu": "^2.2.16", "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-hover-card": "^1.1.15", "@radix-ui/react-label": "^2.1.8", "@radix-ui/react-popover": "^1.1.14", - "@radix-ui/react-progress": "^1.1.8", "@radix-ui/react-radio-group": "^1.3.8", "@radix-ui/react-scroll-area": "^1.2.10", "@radix-ui/react-select": "^2.2.6", @@ -47,52 +39,35 @@ "@radix-ui/react-switch": "^1.2.5", "@radix-ui/react-tabs": "^1.1.3", "@radix-ui/react-tooltip": "^1.2.8", - "@radix-ui/react-use-controllable-state": "^1.2.2", "@sentry/react": "^10.25.0", "@sentry/vite-plugin": "^4.6.0", "@squircle/core": "^1.0.6", "@squircle/paint-polyfill": "^1.0.6", - "@squircle/tailwindcss": "^1.0.6", - "@supabase/ssr": "^0.5.2", "@tailwindcss/vite": "^4.0.13", "@tanstack/react-form": "^1.23.8", "@tanstack/react-query": "^5.85.6", - "@tanstack/react-query-devtools": "^5.85.6", "@tanstack/react-table": "^8.21.3", - "@types/recharts": "^2.0.1", - "@wooorm/starry-night": "^3.6.0", - "@xyflow/react": "^12.10.0", "ag-charts-community": "^12.0.2", "ag-grid-community": "^34.0.2", "ag-grid-react": "^34.0.2", "ai": "^6.0.5", "autumn-js": "^0.1.8", "axios": "^1.8.3", - "buffer": "^6.0.3", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "date-fns": "^3.6.0", "decimal.js": "^10.5.0", - "embla-carousel-react": "^8.6.0", - "hast-util-to-html": "^9.0.5", "input-otp": "^1.4.2", "lodash": "^4.17.21", "lucide-react": "^0.562.0", "motion": "^12.26.1", "nanoid": "^5.1.6", - "next-themes": "^0.4.6", "nuqs": "^2.4.3", "posthog-js": "^1.230.4", - "prism-themes": "^1.9.0", - "prismjs": "^1.29.0", "react": "^18.2.0", - "react-cmdk": "^1.3.9", - "react-confetti-explosion": "^2.1.2", "react-day-picker": "^8.10.1", "react-dom": "^18.2.0", - "react-dropzone": "^14.3.8", - "react-hot-toast": "^2.5.2", "react-hotkeys-hook": "^4.6.1", "react-router": "^7.3.0", "react-router-dom": "^7.6.2", @@ -104,11 +79,7 @@ "svix-react": "^1.13.3", "swr": "^2.3.3", "tailwind-merge": "^3.0.2", - "tailwindcss": "^4.0.13", - "tailwindcss-animate": "^1.0.7", - "tokenlens": "^1.3.1", "use-stick-to-bottom": "^1.1.1", - "vaul": "^1.1.2", "zod": "^3.25.23", "zustand": "^5.0.8" }, @@ -116,11 +87,8 @@ "@eslint/js": "^9.21.0", "@types/lodash": "^4.17.16", "@types/node": "^22.13.10", - "@types/prismjs": "^1.26.5", "@types/react": "^18.3.18", "@types/react-dom": "^18.3.5", - "@types/react-router-dom": "^5.3.3", - "@typescript/native-preview": "^7.0.0-dev.20251111.1", "@vitejs/plugin-react": "^4.3.4", "eslint": "^9.21.0", "eslint-plugin-react-hooks": "^5.1.0", @@ -129,7 +97,6 @@ "typescript": "~5.7.2", "typescript-eslint": "^8.24.1", "vite": "^6.2.0", - "vite-plugin-node-polyfills": "^0.24.0", "vite-tsconfig-paths": "^5.1.4" } } diff --git a/vite/src/App.tsx b/vite/src/App.tsx index 12e85f827..f1b19efb7 100644 --- a/vite/src/App.tsx +++ b/vite/src/App.tsx @@ -29,7 +29,7 @@ import PlanEditorView from "./views/products/plan/PlanEditorView"; import { OrgSettingsView } from "./views/settings/OrgSettingsView"; import { TerminalView } from "./views/TerminalView"; -export function SquircleProvider({ children }: { children: React.ReactNode }) { +function SquircleProvider({ children }: { children: React.ReactNode }) { React.useEffect(() => void init(), []); return children; } diff --git a/vite/src/app/AppContext.tsx b/vite/src/app/AppContext.tsx index 3345edb29..6f744ad36 100644 --- a/vite/src/app/AppContext.tsx +++ b/vite/src/app/AppContext.tsx @@ -2,7 +2,7 @@ import { createContext, useContext } from "react"; export const AppContext = createContext(null); -export const useAppContext = () => { +const useAppContext = () => { const context = useContext(AppContext); if (context === undefined) { diff --git a/vite/src/components/compareDbFeature.ts b/vite/src/components/compareDbFeature.ts index 416637e8f..af577b7ff 100644 --- a/vite/src/components/compareDbFeature.ts +++ b/vite/src/components/compareDbFeature.ts @@ -5,7 +5,7 @@ import { FeatureType, } from "@autumn/shared"; -export const creditSchemasSame = ({ +const creditSchemasSame = ({ schema1, schema2, }: { diff --git a/vite/src/components/forms/update-subscription-v2/constants/trialConstants.ts b/vite/src/components/forms/update-subscription-v2/constants/trialConstants.ts index ec37d920b..54c923b3c 100644 --- a/vite/src/components/forms/update-subscription-v2/constants/trialConstants.ts +++ b/vite/src/components/forms/update-subscription-v2/constants/trialConstants.ts @@ -6,7 +6,7 @@ export const TRIAL_DURATION_OPTIONS = [ { label: "Years", value: FreeTrialDuration.Year }, ] as const; -export const DURATION_LABELS: Record< +const DURATION_LABELS: Record< FreeTrialDuration, { singular: string; plural: string } > = { diff --git a/vite/src/components/forms/update-subscription-v2/updateSubscriptionFormSchema.ts b/vite/src/components/forms/update-subscription-v2/updateSubscriptionFormSchema.ts index 904014e39..d175c74c5 100644 --- a/vite/src/components/forms/update-subscription-v2/updateSubscriptionFormSchema.ts +++ b/vite/src/components/forms/update-subscription-v2/updateSubscriptionFormSchema.ts @@ -11,7 +11,7 @@ import { type RefundBehaviorValue, } from "@/components/forms/update-subscription-v2/types/refundBehaviourSchema"; -export type BillingBehaviorValue = BillingBehavior; +type BillingBehaviorValue = BillingBehavior; export type { RefundBehaviorValue }; export type CancelActionValue = z.infer; diff --git a/vite/src/components/forms/update-subscription/use-update-subscription-form.ts b/vite/src/components/forms/update-subscription/use-update-subscription-form.ts index fb7eeee58..9f8c86088 100644 --- a/vite/src/components/forms/update-subscription/use-update-subscription-form.ts +++ b/vite/src/components/forms/update-subscription/use-update-subscription-form.ts @@ -26,7 +26,7 @@ export function useUpdateSubscriptionForm({ // Subscribe to form changes and clear prepaid options when productId changes // Prevents stale prepaid options from causing "no prepaid price found" in the `checkout` call -export function useResetPrepaidOnProductChange({ +function useResetPrepaidOnProductChange({ form, }: { form: UseUpdateSubscriptionForm; diff --git a/vite/src/components/ui/badge.tsx b/vite/src/components/ui/badge.tsx index 927247601..49be1241d 100644 --- a/vite/src/components/ui/badge.tsx +++ b/vite/src/components/ui/badge.tsx @@ -50,4 +50,4 @@ function Badge({ ); } -export { Badge, badgeVariants }; +export { Badge, }; diff --git a/vite/src/components/ui/breadcrumb.tsx b/vite/src/components/ui/breadcrumb.tsx index acf0a228d..056adb279 100644 --- a/vite/src/components/ui/breadcrumb.tsx +++ b/vite/src/components/ui/breadcrumb.tsx @@ -103,7 +103,7 @@ export { BreadcrumbList, BreadcrumbItem, BreadcrumbLink, - BreadcrumbPage, + BreadcrumbSeparator, - BreadcrumbEllipsis, + }; diff --git a/vite/src/components/ui/button-group.tsx b/vite/src/components/ui/button-group.tsx index 5360458ca..fc1d3bdbd 100644 --- a/vite/src/components/ui/button-group.tsx +++ b/vite/src/components/ui/button-group.tsx @@ -76,7 +76,7 @@ function ButtonGroupSeparator({ export { ButtonGroup, - ButtonGroupSeparator, + ButtonGroupText, - buttonGroupVariants, + }; diff --git a/vite/src/components/ui/card.tsx b/vite/src/components/ui/card.tsx index 5034728a6..5543badc7 100644 --- a/vite/src/components/ui/card.tsx +++ b/vite/src/components/ui/card.tsx @@ -67,9 +67,9 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) { export { Card, - CardHeader, - CardFooter, - CardTitle, - CardDescription, + + + + CardContent, }; diff --git a/vite/src/components/ui/chart.tsx b/vite/src/components/ui/chart.tsx index a0a5f2923..73a991e8a 100644 --- a/vite/src/components/ui/chart.tsx +++ b/vite/src/components/ui/chart.tsx @@ -349,7 +349,7 @@ export { ChartContainer, ChartTooltip, ChartTooltipContent, - ChartLegend, - ChartLegendContent, - ChartStyle, + + + }; diff --git a/vite/src/components/ui/command.tsx b/vite/src/components/ui/command.tsx index 2dbb539b8..6825dae91 100644 --- a/vite/src/components/ui/command.tsx +++ b/vite/src/components/ui/command.tsx @@ -179,6 +179,6 @@ export { CommandEmpty, CommandGroup, CommandItem, - CommandShortcut, + CommandSeparator, }; diff --git a/vite/src/components/ui/dialog.tsx b/vite/src/components/ui/dialog.tsx index ba7e17cb1..39eb58b2b 100644 --- a/vite/src/components/ui/dialog.tsx +++ b/vite/src/components/ui/dialog.tsx @@ -138,13 +138,13 @@ function DialogDescription({ export { Dialog, - DialogClose, + DialogContent, - DialogDescription, + DialogFooter, DialogHeader, - DialogOverlay, - DialogPortal, + + DialogTitle, DialogTrigger, }; diff --git a/vite/src/components/ui/dropdown-menu.tsx b/vite/src/components/ui/dropdown-menu.tsx index 84a1cec7b..1e3599a26 100644 --- a/vite/src/components/ui/dropdown-menu.tsx +++ b/vite/src/components/ui/dropdown-menu.tsx @@ -203,15 +203,15 @@ export { DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, - DropdownMenuCheckboxItem, - DropdownMenuRadioItem, + + DropdownMenuLabel, DropdownMenuSeparator, - DropdownMenuShortcut, + DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, - DropdownMenuRadioGroup, + }; diff --git a/vite/src/components/ui/input-group.tsx b/vite/src/components/ui/input-group.tsx index 7ba78b870..c7584520a 100644 --- a/vite/src/components/ui/input-group.tsx +++ b/vite/src/components/ui/input-group.tsx @@ -163,7 +163,7 @@ export { InputGroup, InputGroupAddon, InputGroupButton, - InputGroupText, - InputGroupInput, + + InputGroupTextarea, }; diff --git a/vite/src/components/ui/pagination.tsx b/vite/src/components/ui/pagination.tsx index 1d1aae5fb..1e00d1a0b 100644 --- a/vite/src/components/ui/pagination.tsx +++ b/vite/src/components/ui/pagination.tsx @@ -108,9 +108,9 @@ PaginationEllipsis.displayName = "PaginationEllipsis"; export { Pagination, PaginationContent, - PaginationLink, + PaginationItem, - PaginationPrevious, - PaginationNext, - PaginationEllipsis, + + + }; diff --git a/vite/src/components/ui/popover.tsx b/vite/src/components/ui/popover.tsx index b3c537a54..abf9cb9bf 100644 --- a/vite/src/components/ui/popover.tsx +++ b/vite/src/components/ui/popover.tsx @@ -43,4 +43,4 @@ function PopoverAnchor({ return ; } -export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }; +export { Popover, PopoverTrigger, PopoverContent, }; diff --git a/vite/src/components/ui/scroll-area.tsx b/vite/src/components/ui/scroll-area.tsx index 01ed9ed6b..f72129edd 100644 --- a/vite/src/components/ui/scroll-area.tsx +++ b/vite/src/components/ui/scroll-area.tsx @@ -53,4 +53,4 @@ function ScrollBar({ ); } -export { ScrollArea, ScrollBar }; +export { ScrollArea, }; diff --git a/vite/src/components/ui/select.tsx b/vite/src/components/ui/select.tsx index 68da4c882..326d7b6c2 100644 --- a/vite/src/components/ui/select.tsx +++ b/vite/src/components/ui/select.tsx @@ -238,12 +238,12 @@ function SelectScrollDownButton({ export { Select, SelectContent, - SelectGroup, + SelectItem, - SelectLabel, - SelectScrollDownButton, - SelectScrollUpButton, - SelectSeparator, + + + + SelectTrigger, SelectValue, }; diff --git a/vite/src/components/ui/table.tsx b/vite/src/components/ui/table.tsx index b32ad0a30..92c1074a8 100644 --- a/vite/src/components/ui/table.tsx +++ b/vite/src/components/ui/table.tsx @@ -115,9 +115,9 @@ export { Table, TableHeader, TableBody, - TableFooter, + TableHead, TableRow, TableCell, - TableCaption, + }; diff --git a/vite/src/components/v2/badges/Badge.tsx b/vite/src/components/v2/badges/Badge.tsx index 203feb429..8bb1fcf5e 100644 --- a/vite/src/components/v2/badges/Badge.tsx +++ b/vite/src/components/v2/badges/Badge.tsx @@ -57,4 +57,4 @@ function Badge({ ); } -export { Badge, badgeVariants }; +export { Badge, }; diff --git a/vite/src/components/v2/badges/IconBadge.tsx b/vite/src/components/v2/badges/IconBadge.tsx index 9a07541b3..92bee372d 100644 --- a/vite/src/components/v2/badges/IconBadge.tsx +++ b/vite/src/components/v2/badges/IconBadge.tsx @@ -20,7 +20,7 @@ const iconBadgeVariants = cva( }, ); -export interface IconBadgeProps +interface IconBadgeProps extends Omit< React.ComponentProps<"span">, keyof VariantProps @@ -115,4 +115,4 @@ const IconBadge = React.forwardRef( IconBadge.displayName = "IconBadge"; -export { IconBadge, iconBadgeVariants }; +export { IconBadge, }; diff --git a/vite/src/components/v2/badges/PlanTypeBadge.tsx b/vite/src/components/v2/badges/PlanTypeBadge.tsx index 7588d5583..50ffa4ab1 100644 --- a/vite/src/components/v2/badges/PlanTypeBadge.tsx +++ b/vite/src/components/v2/badges/PlanTypeBadge.tsx @@ -29,7 +29,7 @@ const badgeVariants = cva( }, ); -export interface PlanTypeBadgeProps extends VariantProps { +interface PlanTypeBadgeProps extends VariantProps { className?: string; iconOnly?: boolean; noIcon?: boolean; diff --git a/vite/src/components/v2/buttons/CopyButton.tsx b/vite/src/components/v2/buttons/CopyButton.tsx index 9e21e7b60..e8f3aa08f 100644 --- a/vite/src/components/v2/buttons/CopyButton.tsx +++ b/vite/src/components/v2/buttons/CopyButton.tsx @@ -11,7 +11,7 @@ import type { IconButtonProps } from "./IconButton"; import { IconButton } from "./IconButton"; /** Hook for copy-to-clipboard with auto-reset state */ -export const useCopyAnimation = ({ +const useCopyAnimation = ({ text, timeout = 1500, }: { @@ -41,7 +41,7 @@ export const useCopyAnimation = ({ }; /** Animated icon that transitions between copy and check */ -export const AnimatedCopyIcon = ({ +const AnimatedCopyIcon = ({ copied, size = "size-3.5", }: { diff --git a/vite/src/components/v2/cards/Card.tsx b/vite/src/components/v2/cards/Card.tsx index 3e7de3070..a671f200b 100644 --- a/vite/src/components/v2/cards/Card.tsx +++ b/vite/src/components/v2/cards/Card.tsx @@ -86,7 +86,7 @@ export { CardHeader, CardFooter, CardTitle, - CardAction, + CardDescription, CardContent, }; diff --git a/vite/src/components/v2/checkboxes/IconCheckbox.tsx b/vite/src/components/v2/checkboxes/IconCheckbox.tsx index 67d957d4a..cd736da4a 100644 --- a/vite/src/components/v2/checkboxes/IconCheckbox.tsx +++ b/vite/src/components/v2/checkboxes/IconCheckbox.tsx @@ -6,7 +6,7 @@ import { cn } from "@/lib/utils"; import { Button, type ButtonProps } from "../buttons/Button"; import { iconButtonVariants } from "../buttons/IconButton"; -export interface IconCheckboxProps +interface IconCheckboxProps extends ButtonProps, VariantProps { checked?: boolean; diff --git a/vite/src/components/v2/dialogs/Dialog.tsx b/vite/src/components/v2/dialogs/Dialog.tsx index f2c79ec47..720db7570 100644 --- a/vite/src/components/v2/dialogs/Dialog.tsx +++ b/vite/src/components/v2/dialogs/Dialog.tsx @@ -132,13 +132,13 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, - DialogClose, + DialogContent, DialogDescription, DialogFooter, DialogHeader, - DialogOverlay, - DialogPortal, + + DialogTitle, DialogTrigger, }; diff --git a/vite/src/components/v2/dropdowns/DropdownMenu.tsx b/vite/src/components/v2/dropdowns/DropdownMenu.tsx index 39e8c7ee4..25626aa7c 100644 --- a/vite/src/components/v2/dropdowns/DropdownMenu.tsx +++ b/vite/src/components/v2/dropdowns/DropdownMenu.tsx @@ -368,14 +368,14 @@ export { DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, - DropdownMenuPortal, - DropdownMenuRadioGroup, - DropdownMenuRadioItem, + + + DropdownMenuSeparator, - DropdownMenuShortcut, + DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, - dropdownMenuItemVariants, + }; diff --git a/vite/src/components/v2/icons/AutumnIcons.tsx b/vite/src/components/v2/icons/AutumnIcons.tsx index 8449d7bcb..41484efb1 100644 --- a/vite/src/components/v2/icons/AutumnIcons.tsx +++ b/vite/src/components/v2/icons/AutumnIcons.tsx @@ -1,7 +1,7 @@ /** biome-ignore-all lint/a11y/noSvgWithoutTitle: needed */ import { useId } from "react"; -export const FeatureArrowIcon = () => { +const FeatureArrowIcon = () => { return ( { +const PrepaidUsageIcon = () => { return ( , VariantProps {} diff --git a/vite/src/components/v2/inputs/InputGroup.tsx b/vite/src/components/v2/inputs/InputGroup.tsx index 27a4ce55c..27f4a5177 100644 --- a/vite/src/components/v2/inputs/InputGroup.tsx +++ b/vite/src/components/v2/inputs/InputGroup.tsx @@ -179,8 +179,8 @@ function InputGroupTextarea({ export { InputGroup, InputGroupAddon, - InputGroupButton, + InputGroupText, InputGroupInput, - InputGroupTextarea, + }; diff --git a/vite/src/components/v2/selects/Select.tsx b/vite/src/components/v2/selects/Select.tsx index a957b878e..193f83e14 100644 --- a/vite/src/components/v2/selects/Select.tsx +++ b/vite/src/components/v2/selects/Select.tsx @@ -223,9 +223,9 @@ export { SelectGroup, SelectItem, SelectLabel, - SelectScrollDownButton, - SelectScrollUpButton, - SelectSeparator, + + + SelectTrigger, SelectValue, }; diff --git a/vite/src/components/v2/sheets/InlineSheet.tsx b/vite/src/components/v2/sheets/InlineSheet.tsx index bd3aff89b..355846f85 100644 --- a/vite/src/components/v2/sheets/InlineSheet.tsx +++ b/vite/src/components/v2/sheets/InlineSheet.tsx @@ -15,7 +15,7 @@ export function SheetContainer({ children, className }: SheetContainerProps) { // Re-export shared components for backwards compatibility export { - SheetFooter, + SheetHeader, SheetSection, } from "./SharedSheetComponents"; diff --git a/vite/src/components/v2/sheets/SharedSheetComponents.tsx b/vite/src/components/v2/sheets/SharedSheetComponents.tsx index 13d849952..783c6f53d 100644 --- a/vite/src/components/v2/sheets/SharedSheetComponents.tsx +++ b/vite/src/components/v2/sheets/SharedSheetComponents.tsx @@ -157,7 +157,7 @@ export function SheetFooter({ children, className }: SheetFooterProps) { ); } -export function SheetBreadcrumbs({ +function SheetBreadcrumbs({ breadcrumbs, title, itemId, diff --git a/vite/src/components/v2/sheets/Sheet.tsx b/vite/src/components/v2/sheets/Sheet.tsx index 6453c32f7..5f725ad22 100644 --- a/vite/src/components/v2/sheets/Sheet.tsx +++ b/vite/src/components/v2/sheets/Sheet.tsx @@ -141,10 +141,10 @@ function SheetDescription({ export { Sheet, SheetTrigger, - SheetClose, + SheetContent, SheetHeader, - SheetFooter, + SheetTitle, - SheetDescription, + }; diff --git a/vite/src/contexts/PortalContainerContext.tsx b/vite/src/contexts/PortalContainerContext.tsx index 2589e63b7..9eec68299 100644 --- a/vite/src/contexts/PortalContainerContext.tsx +++ b/vite/src/contexts/PortalContainerContext.tsx @@ -3,4 +3,4 @@ import { createContext, type RefObject, useContext } from "react"; export const PortalContainerContext = createContext | null>(null); -export const usePortalContainer = () => useContext(PortalContainerContext); +const usePortalContainer = () => useContext(PortalContainerContext); diff --git a/vite/src/hooks/common/useLocalStorage.ts b/vite/src/hooks/common/useLocalStorage.ts index de7669d4a..0ad4d2cc0 100644 --- a/vite/src/hooks/common/useLocalStorage.ts +++ b/vite/src/hooks/common/useLocalStorage.ts @@ -62,4 +62,3 @@ export function useLocalStorage( return [storedValue, setValue]; } -export default useLocalStorage; diff --git a/vite/src/hooks/form/form.ts b/vite/src/hooks/form/form.ts index b0a30febc..3993830b3 100644 --- a/vite/src/hooks/form/form.ts +++ b/vite/src/hooks/form/form.ts @@ -7,7 +7,7 @@ import { SelectField } from "@/components/general/form/fields/select-field"; import { TextField } from "@/components/general/form/fields/text-field"; import { fieldContext, formContext } from "./form-context"; -export const { useAppForm, withForm } = createFormHook({ +export const { useAppForm, } = createFormHook({ fieldContext, formContext, fieldComponents: { diff --git a/vite/src/hooks/stores/useCommandBarStore.ts b/vite/src/hooks/stores/useCommandBarStore.ts index 0c98e4a70..b852ad292 100644 --- a/vite/src/hooks/stores/useCommandBarStore.ts +++ b/vite/src/hooks/stores/useCommandBarStore.ts @@ -37,4 +37,4 @@ export const useCommandBarStore = create((set) => ({ })); // Convenience selector for checking if command bar is open -export const useIsCommandBarOpen = () => useCommandBarStore((s) => s.open); +const useIsCommandBarOpen = () => useCommandBarStore((s) => s.open); diff --git a/vite/src/hooks/stores/useCustomerBalanceSheetStore.ts b/vite/src/hooks/stores/useCustomerBalanceSheetStore.ts index a41a4ac7a..33bd0b9f8 100644 --- a/vite/src/hooks/stores/useCustomerBalanceSheetStore.ts +++ b/vite/src/hooks/stores/useCustomerBalanceSheetStore.ts @@ -3,7 +3,7 @@ import { useEffect } from "react"; import { create } from "zustand"; // Sheet types that can be displayed -export type CustomerBalanceSheetType = "edit-balance" | null; +type CustomerBalanceSheetType = "edit-balance" | null; // Store state interface interface CustomerBalanceSheetState { @@ -75,14 +75,14 @@ export const useCustomerBalanceSheetStore = create( ); // Convenience selectors -export const useIsCustomerBalanceSheetOpen = () => +const useIsCustomerBalanceSheetOpen = () => useCustomerBalanceSheetStore((s) => s.type !== null); /** * Hook to handle Escape key to close sheet and unfocus active elements * Only closes sheet if no dialog is currently open */ -export const useCustomerBalanceSheetEscapeHandler = () => { +const useCustomerBalanceSheetEscapeHandler = () => { const sheetType = useCustomerBalanceSheetStore((s) => s.type); const closeSheet = useCustomerBalanceSheetStore((s) => s.closeSheet); @@ -114,7 +114,7 @@ export const useCustomerBalanceSheetEscapeHandler = () => { /** * Hook to close sheet when component unmounts (e.g., navigating away) */ -export const useCustomerBalanceSheetCleanup = () => { +const useCustomerBalanceSheetCleanup = () => { const closeSheet = useCustomerBalanceSheetStore((s) => s.closeSheet); useEffect(() => { diff --git a/vite/src/hooks/stores/useFeatureStore.ts b/vite/src/hooks/stores/useFeatureStore.ts index 31deecb08..35fed522c 100644 --- a/vite/src/hooks/stores/useFeatureStore.ts +++ b/vite/src/hooks/stores/useFeatureStore.ts @@ -34,7 +34,7 @@ export const useFeatureStore = create((set) => ({ reset: () => set(initialState), })); -export const useHasFeatureChanges = () => { +const useHasFeatureChanges = () => { const feature = useFeatureStore((s) => s.feature); const baseFeature = useFeatureStore((s) => s.baseFeature); diff --git a/vite/src/hooks/stores/useProductStore.ts b/vite/src/hooks/stores/useProductStore.ts index dbe846d12..6f32e8864 100644 --- a/vite/src/hooks/stores/useProductStore.ts +++ b/vite/src/hooks/stores/useProductStore.ts @@ -133,7 +133,7 @@ export const useWillVersion = () => { }, [product, baseProduct, features]); }; -export const useHasDetailsChanged = () => { +const useHasDetailsChanged = () => { const product = useProductStore((s) => s.product); const baseProduct = useProductStore((s) => s.baseProduct); const { features = [] } = useFeaturesQuery(); @@ -163,7 +163,7 @@ export const useHasDetailsChanged = () => { }, [product, baseProduct, features]); }; -export const useCurrentItem = () => { +const useCurrentItem = () => { const product = useProductStore((s) => s.product); const itemId = useSheetStore((s) => s.itemId); @@ -194,7 +194,7 @@ export const useCurrentItem = () => { /** * Hook to check if the current item has unsaved changes compared to its initial state */ -export const useHasItemChanges = () => { +const useHasItemChanges = () => { const item = useCurrentItem(); const initialItem = useSheetStore((s) => s.initialItem); const { features = [] } = useFeaturesQuery(); @@ -228,7 +228,7 @@ export const useDiscardItemAndClose = () => { }; }; -export const useSetCurrentItem = () => { +const useSetCurrentItem = () => { const product = useProductStore((s) => s.product); const setProduct = useProductStore((s) => s.setProduct); const itemId = useSheetStore((s) => s.itemId); diff --git a/vite/src/hooks/stores/useSDKStore.ts b/vite/src/hooks/stores/useSDKStore.ts index 5af6661a8..b39b227fb 100644 --- a/vite/src/hooks/stores/useSDKStore.ts +++ b/vite/src/hooks/stores/useSDKStore.ts @@ -20,5 +20,5 @@ export const useSDKStore = create()( ), ); -export const useSelectedSDK = () => useSDKStore((s) => s.selectedSDK); -export const useSetSelectedSDK = () => useSDKStore((s) => s.setSelectedSDK); +const useSelectedSDK = () => useSDKStore((s) => s.selectedSDK); +const useSetSelectedSDK = () => useSDKStore((s) => s.setSelectedSDK); diff --git a/vite/src/hooks/stores/useSecretKeyStore.ts b/vite/src/hooks/stores/useSecretKeyStore.ts index 2dd31e418..300d6997c 100644 --- a/vite/src/hooks/stores/useSecretKeyStore.ts +++ b/vite/src/hooks/stores/useSecretKeyStore.ts @@ -12,5 +12,5 @@ export const useSecretKeyStore = create()((set) => ({ clearSecretKey: () => set({ secretKey: "" }), })); -export const useSecretKey = () => useSecretKeyStore((s) => s.secretKey); -export const useSetSecretKey = () => useSecretKeyStore((s) => s.setSecretKey); +const useSecretKey = () => useSecretKeyStore((s) => s.secretKey); +const useSetSecretKey = () => useSecretKeyStore((s) => s.setSecretKey); diff --git a/vite/src/hooks/stores/useSheetStore.ts b/vite/src/hooks/stores/useSheetStore.ts index 7e8b9a20a..597bef939 100644 --- a/vite/src/hooks/stores/useSheetStore.ts +++ b/vite/src/hooks/stores/useSheetStore.ts @@ -87,19 +87,19 @@ export const useSheetStore = create((set) => ({ // Convenience selectors for common patterns export const useIsSheetOpen = () => useSheetStore((s) => s.type !== null); -export const useIsEditingPlan = () => +const useIsEditingPlan = () => useSheetStore((s) => s.type === "edit-plan"); -export const useIsEditingFeature = () => +const useIsEditingFeature = () => useSheetStore((s) => s.type === "edit-feature"); -export const useIsCreatingFeature = () => +const useIsCreatingFeature = () => useSheetStore((s) => s.type === "new-feature" || s.itemId === "new"); export const useIsAttachingProduct = () => useSheetStore((s) => s.type === "attach-product"); -export const useIsEditingPlanPrice = () => +const useIsEditingPlanPrice = () => useSheetStore((s) => s.type === "edit-plan-price"); -export const useIsViewingSubscriptionDetail = () => +const useIsViewingSubscriptionDetail = () => useSheetStore((s) => s.type === "subscription-detail"); -export const useIsUpdatingSubscription = () => +const useIsUpdatingSubscription = () => useSheetStore((s) => s.type === "subscription-update"); /** diff --git a/vite/src/hooks/useColumnVisibility.ts b/vite/src/hooks/useColumnVisibility.ts index 2a4a7ef39..d43a5f35a 100644 --- a/vite/src/hooks/useColumnVisibility.ts +++ b/vite/src/hooks/useColumnVisibility.ts @@ -6,7 +6,7 @@ const STORAGE_PREFIX = "autumn:table-columns:"; type StoredColumnValue = boolean | { visible: boolean; name: string }; type StoredVisibility = Record; -export interface ColumnMeta { +interface ColumnMeta { visible: boolean; name?: string; } @@ -29,7 +29,7 @@ function getVisibility(value: StoredColumnValue): boolean { } /** Parse stored value to get column meta (visibility + optional name) */ -export function getColumnMeta( +function getColumnMeta( stored: StoredVisibility, columnId: string, ): ColumnMeta | null { diff --git a/vite/src/hooks/useDropdownShortcut.ts b/vite/src/hooks/useDropdownShortcut.ts index dd6b57c27..1f7075d3e 100644 --- a/vite/src/hooks/useDropdownShortcut.ts +++ b/vite/src/hooks/useDropdownShortcut.ts @@ -30,7 +30,7 @@ export function useDropdownShortcut({ /** * Hook to trigger an action when a dropdown is open and a key is pressed */ -export function useMenuItemShortcut({ +function useMenuItemShortcut({ shortcut, onTrigger, isMenuOpen, diff --git a/vite/src/lib/auth-client.ts b/vite/src/lib/auth-client.ts index ad0bfb80e..36edf2942 100644 --- a/vite/src/lib/auth-client.ts +++ b/vite/src/lib/auth-client.ts @@ -21,8 +21,8 @@ export const authClient = createAuthClient({ export const { useSession, signIn, - signUp, - signOut, - deleteUser, + + + useListOrganizations, } = authClient; diff --git a/vite/src/lib/snippets/curlSnippets.ts b/vite/src/lib/snippets/curlSnippets.ts index 4fc9fbd6a..e93a7805f 100644 --- a/vite/src/lib/snippets/curlSnippets.ts +++ b/vite/src/lib/snippets/curlSnippets.ts @@ -1,6 +1,6 @@ import type { Snippet } from "./types"; -export const CURL_SNIPPETS: Record = { +const CURL_SNIPPETS: Record = { "env-setup": { id: "env-setup", title: "Get your API key", diff --git a/vite/src/lib/snippets/nodeSnippets.ts b/vite/src/lib/snippets/nodeSnippets.ts index 241ce9e1d..9f3ee04cf 100644 --- a/vite/src/lib/snippets/nodeSnippets.ts +++ b/vite/src/lib/snippets/nodeSnippets.ts @@ -1,6 +1,6 @@ import type { Snippet } from "./types"; -export const NODE_SNIPPETS: Record = { +const NODE_SNIPPETS: Record = { install: { id: "install", title: "Install the SDK", diff --git a/vite/src/lib/snippets/productUtils.ts b/vite/src/lib/snippets/productUtils.ts index 7686b8884..525d5f0fd 100644 --- a/vite/src/lib/snippets/productUtils.ts +++ b/vite/src/lib/snippets/productUtils.ts @@ -3,7 +3,7 @@ import type { ProductV2 } from "@autumn/shared"; /** * Gets the first paid product (product with a price) */ -export function getFirstPaidProduct({ +function getFirstPaidProduct({ products, }: { products: ProductV2[]; diff --git a/vite/src/lib/snippets/pythonSnippets.ts b/vite/src/lib/snippets/pythonSnippets.ts index 61074a5c4..5ba6d085e 100644 --- a/vite/src/lib/snippets/pythonSnippets.ts +++ b/vite/src/lib/snippets/pythonSnippets.ts @@ -1,6 +1,6 @@ import type { Snippet } from "./types"; -export const PYTHON_SNIPPETS: Record = { +const PYTHON_SNIPPETS: Record = { install: { id: "install", title: "Install the SDK", diff --git a/vite/src/lib/snippets/reactSnippets.ts b/vite/src/lib/snippets/reactSnippets.ts index d8e78d1e6..9db94e4cd 100644 --- a/vite/src/lib/snippets/reactSnippets.ts +++ b/vite/src/lib/snippets/reactSnippets.ts @@ -6,7 +6,7 @@ import type { StackConfig, } from "./types"; -export const REACT_SNIPPETS: Record = { +const REACT_SNIPPETS: Record = { install: { id: "install", title: "Install the SDK", diff --git a/vite/src/lib/snippets/stackOptionsConfig.tsx b/vite/src/lib/snippets/stackOptionsConfig.tsx index c64f68281..04b7f1d09 100644 --- a/vite/src/lib/snippets/stackOptionsConfig.tsx +++ b/vite/src/lib/snippets/stackOptionsConfig.tsx @@ -3,27 +3,27 @@ import type { ReactNode } from "react"; import type { SDKType } from "@/hooks/stores/useSDKStore"; import type { AuthProvider, BackendStack, CustomerType } from "./types"; -export interface StackOption { +interface StackOption { value: string; label: string; asset?: string; icon?: ReactNode; } -export interface SDKOption { +interface SDKOption { value: SDKType; label: string; icon: string; } -export const FRONTEND_OPTIONS: StackOption[] = [ +const FRONTEND_OPTIONS: StackOption[] = [ { value: "nextjs", label: "Next.js", asset: "/frameworks/nextjs.png" }, { value: "rr7", label: "RR7", asset: "/frameworks/react-router.svg" }, { value: "vite", label: "Vite SPA", asset: "/frameworks/vite.svg" }, { value: "general", label: "Other", asset: "/frameworks/react.png" }, ]; -export const BACKEND_OPTIONS: StackOption[] = [ +const BACKEND_OPTIONS: StackOption[] = [ { value: "nextjs", label: "Next.js", asset: "/frameworks/nextjs.png" }, { value: "rr7", label: "RR7", asset: "/frameworks/react-router.svg" }, { value: "hono", label: "Hono", asset: "/frameworks/hono.png" }, @@ -32,7 +32,7 @@ export const BACKEND_OPTIONS: StackOption[] = [ { value: "general", label: "Other", asset: "/frameworks/nodejs.svg" }, ]; -export const AUTH_OPTIONS: StackOption[] = [ +const AUTH_OPTIONS: StackOption[] = [ { value: "betterauth", label: "Better Auth", @@ -43,7 +43,7 @@ export const AUTH_OPTIONS: StackOption[] = [ { value: "other", label: "Other", asset: "/auth-key.png" }, ]; -export const CUSTOMER_TYPE_OPTIONS: StackOption[] = [ +const CUSTOMER_TYPE_OPTIONS: StackOption[] = [ { value: "user", label: "Users", @@ -63,7 +63,7 @@ export const SDK_OPTIONS: SDKOption[] = [ { value: "curl", label: "cURL", icon: "/frameworks/curl.png" }, ]; -export interface StackSection { +interface StackSection { label: string; configKey: "backend" | "auth" | "customerType"; options: StackOption[]; @@ -79,4 +79,4 @@ export const STACK_SECTIONS: StackSection[] = [ }, ]; -export type { AuthProvider, BackendStack, CustomerType }; +; diff --git a/vite/src/services/useAxiosSwr.tsx b/vite/src/services/useAxiosSwr.tsx index 55a080022..6a2db04ce 100644 --- a/vite/src/services/useAxiosSwr.tsx +++ b/vite/src/services/useAxiosSwr.tsx @@ -32,7 +32,7 @@ export function useAxiosSWR({ }); } -export function useAxiosPostSWR({ +function useAxiosPostSWR({ url, env, data, @@ -97,7 +97,7 @@ export function usePostSWR({ }); } -export function useDemoSWR({ +function useDemoSWR({ url, publishableKey, options = {}, diff --git a/vite/src/utils/formatUtils/formatDateUtils.ts b/vite/src/utils/formatUtils/formatDateUtils.ts index d98a9245c..e4e5f8389 100644 --- a/vite/src/utils/formatUtils/formatDateUtils.ts +++ b/vite/src/utils/formatUtils/formatDateUtils.ts @@ -5,7 +5,7 @@ export const formatDateStr = (date: Date | string) => { return format(new Date(date), "dd MMM yyyy"); }; -export const formatTimestamp = (timestamp: number | null | undefined) => { +const formatTimestamp = (timestamp: number | null | undefined) => { if (!timestamp) return ""; return format(new Date(timestamp), "MM/dd/yyyy"); }; @@ -39,7 +39,7 @@ export const formatUnixToDateTime = ( return { date, time }; }; -export const formatUnixToDateTimeWithMs = (unix: number | null | undefined) => { +const formatUnixToDateTimeWithMs = (unix: number | null | undefined) => { if (!unix) return ""; const date = format(new Date(unix), "d MMM"); const time = format(new Date(unix), "HH:mm:ss.SSS"); diff --git a/vite/src/utils/formatUtils/formatTextUtils.ts b/vite/src/utils/formatUtils/formatTextUtils.ts index 90689ed8e..0c7db2d9c 100644 --- a/vite/src/utils/formatUtils/formatTextUtils.ts +++ b/vite/src/utils/formatUtils/formatTextUtils.ts @@ -12,7 +12,7 @@ export const keyToTitle = ( .replace(/\b\w/g, (char) => char.toUpperCase()); }; -export const keyToTitleFirstCaps = (key: string) => { +const keyToTitleFirstCaps = (key: string) => { // Capitalize first char const res = key.replace(/^\w/, (char) => char.toUpperCase()); // Replace underscores with spaces diff --git a/vite/src/utils/genUtils.ts b/vite/src/utils/genUtils.ts index 08ee01145..546c3333f 100644 --- a/vite/src/utils/genUtils.ts +++ b/vite/src/utils/genUtils.ts @@ -3,12 +3,12 @@ import { AxiosError } from "axios"; import type { NavigateFunction } from "react-router-dom"; import { ZodError } from "zod/v3"; -export const compareStatus = (statusA: string, statusB: string) => { +const compareStatus = (statusA: string, statusB: string) => { const statusOrder = ["scheduled", "active", "past_due", "expired"]; return statusOrder.indexOf(statusA) - statusOrder.indexOf(statusB); }; -export const invalidNumber = (value: unknown) => { +const invalidNumber = (value: unknown) => { return Number.isNaN(parseFloat(value as string)); }; @@ -31,7 +31,7 @@ export const getBackendErr = ( } }; -export const getBackendErrObj = (error: AxiosError) => { +const getBackendErrObj = (error: AxiosError) => { if (error.response?.data) { const data = error.response.data as { code: string; message: string }; if (data.code) { @@ -162,7 +162,7 @@ export const nullish = (value: unknown) => { return value === null || value === undefined; }; -export const parseNumberInput = ({ +const parseNumberInput = ({ value, fallback = 0, }: { @@ -175,7 +175,7 @@ export const parseNumberInput = ({ return Number.isNaN(numValue) ? fallback : numValue; }; -export const getMetaKey = () => { +const getMetaKey = () => { if (navigator.userAgent.includes("Mac")) { return "⌘"; } diff --git a/vite/src/utils/linkUtils.ts b/vite/src/utils/linkUtils.ts index 0ff60905d..dd14f5c5d 100644 --- a/vite/src/utils/linkUtils.ts +++ b/vite/src/utils/linkUtils.ts @@ -42,7 +42,7 @@ export const getStripeSubLink = ({ return `${baseUrl}${accountPath}${withTest}/subscriptions/${subscriptionId}`; }; -export const getStripeSubScheduleLink = ({ +const getStripeSubScheduleLink = ({ scheduledId, env, accountId, diff --git a/vite/src/utils/posthogTracking.ts b/vite/src/utils/posthogTracking.ts index c26b535f6..1f8e74bb8 100644 --- a/vite/src/utils/posthogTracking.ts +++ b/vite/src/utils/posthogTracking.ts @@ -1,7 +1,7 @@ import posthog from "posthog-js"; // Toggle this to enable/disable tracking in development -export const TRACK_IN_DEVELOPMENT = false; +const TRACK_IN_DEVELOPMENT = false; /** * Wrapper function to conditionally track events based on environment @@ -55,14 +55,14 @@ export function identifyUser({ /** * Track user sign-up */ -export function trackSignUp() { +function trackSignUp() { trackEvent("user_signed_up"); } /** * Track onboarding product creation */ -export function trackOnboardingProductCreation({ +function trackOnboardingProductCreation({ productType, }: { productType: "free" | "paid"; @@ -75,7 +75,7 @@ export function trackOnboardingProductCreation({ /** * Track onboarding feature creation */ -export function trackOnboardingFeatureCreation({ +function trackOnboardingFeatureCreation({ featureType, }: { featureType: string; @@ -88,20 +88,20 @@ export function trackOnboardingFeatureCreation({ /** * Track onboarding feature configuration */ -export function trackOnboardingFeatureConfigured() { +function trackOnboardingFeatureConfigured() { trackEvent("onboarding_feature_configured"); } /** * Track onboarding playground completion */ -export function trackOnboardingPlaygroundCompleted() { +function trackOnboardingPlaygroundCompleted() { trackEvent("onboarding_playground_completed"); } /** * Track onboarding integration completion */ -export function trackOnboardingIntegrationCompleted() { +function trackOnboardingIntegrationCompleted() { trackEvent("onboarding_integration_completed"); } diff --git a/vite/src/utils/product/getItemType.ts b/vite/src/utils/product/getItemType.ts index db3cd7930..d75cb18d9 100644 --- a/vite/src/utils/product/getItemType.ts +++ b/vite/src/utils/product/getItemType.ts @@ -1,7 +1,7 @@ import type { ProductItem } from "@autumn/shared"; import { notNullish, nullish } from "../genUtils"; -export const isEmptyItem = (item: ProductItem) => { +const isEmptyItem = (item: ProductItem) => { return nullish(item.price) && nullish(item.feature_id) && nullish(item.tiers); }; diff --git a/vite/src/utils/product/priceUtils.ts b/vite/src/utils/product/priceUtils.ts index ce4023156..fda3a64b2 100644 --- a/vite/src/utils/product/priceUtils.ts +++ b/vite/src/utils/product/priceUtils.ts @@ -13,7 +13,7 @@ import { import { isFeatureItem } from "./getItemType"; import { intervalIsNone } from "./productItemUtils"; -export const getBillingUnits = ( +const getBillingUnits = ( config: UsagePriceConfig, entitlements: EntitlementWithFeature[], ) => { @@ -38,7 +38,7 @@ export const getBillingUnits = ( return `${entitlement.allowance} `; }; -export const getDefaultPriceConfig = (type: PriceType) => { +const getDefaultPriceConfig = (type: PriceType) => { if (type === PriceType.Fixed) { return { type: PriceType.Fixed, diff --git a/vite/src/utils/product/product-item/formatProductItem.ts b/vite/src/utils/product/product-item/formatProductItem.ts index bd0fe035e..8881a94dd 100644 --- a/vite/src/utils/product/product-item/formatProductItem.ts +++ b/vite/src/utils/product/product-item/formatProductItem.ts @@ -13,7 +13,7 @@ import { getFeature } from "../entitlementUtils"; import { getItemType, intervalIsNone } from "../productItemUtils"; // Can probably delete this... -export const getPaidFeatureString = ({ +const getPaidFeatureString = ({ item, currency = "USD", features, @@ -88,7 +88,7 @@ const getFixedPriceString = ({ return `${formattedAmount}`; }; -export const getFeatureString = ({ +const getFeatureString = ({ item, features, }: { diff --git a/vite/src/utils/product/productItemUtils.ts b/vite/src/utils/product/productItemUtils.ts index 0d8bf6631..77e7da163 100644 --- a/vite/src/utils/product/productItemUtils.ts +++ b/vite/src/utils/product/productItemUtils.ts @@ -13,7 +13,7 @@ import { notNullish, nullish } from "../genUtils"; import { isFeatureItem, isFeaturePriceItem, isPriceItem } from "./getItemType"; import { itemToUsageType } from "./productItemUtils/convertItem"; -export const itemIsUnlimited = (item: ProductItem) => { +const itemIsUnlimited = (item: ProductItem) => { return item.included_usage === Infinite; }; @@ -37,7 +37,7 @@ export const intervalIsNone = ( ); }; -export const getShowParams = (item: ProductItem | null) => { +const getShowParams = (item: ProductItem | null) => { if (!item) { return { price: false, @@ -57,7 +57,7 @@ export const getShowParams = (item: ProductItem | null) => { }; }; -export const shouldShowProrationConfig = ({ +const shouldShowProrationConfig = ({ item, features, }: { @@ -87,7 +87,7 @@ export const shouldShowProrationConfig = ({ return false; }; -export const itemsHaveSameInterval = ({ +const itemsHaveSameInterval = ({ item1, item2, }: { diff --git a/vite/src/utils/productUtils.ts b/vite/src/utils/productUtils.ts index 877162627..b472d78c3 100644 --- a/vite/src/utils/productUtils.ts +++ b/vite/src/utils/productUtils.ts @@ -5,7 +5,7 @@ import { } from "@autumn/shared"; import { getItemType } from "./product/productItemUtils"; -export const sortProductItems = (items: ProductItem[]) => { +const sortProductItems = (items: ProductItem[]) => { const sortedItems = [...items].sort((a, b) => { const typeA = getItemType(a); const typeB = getItemType(b); diff --git a/vite/src/views/auth/SignIn.tsx b/vite/src/views/auth/SignIn.tsx index 6c3e87892..8dafa021c 100644 --- a/vite/src/views/auth/SignIn.tsx +++ b/vite/src/views/auth/SignIn.tsx @@ -13,7 +13,7 @@ import { authClient, signIn } from "@/lib/auth-client"; import { getBackendErr } from "@/utils/genUtils"; import { OTPSignIn } from "./components/OTPSignIn"; -export const emailSchema = z.string().email(); +const emailSchema = z.string().email(); /** * Check if URL has OAuth parameters (from OAuth provider redirect) diff --git a/vite/src/views/command-bar/command-row.tsx b/vite/src/views/command-bar/command-row.tsx index aaf4d9f72..43abddf3e 100644 --- a/vite/src/views/command-bar/command-row.tsx +++ b/vite/src/views/command-bar/command-row.tsx @@ -23,7 +23,7 @@ const KeystrokeContainer = ({ keyStroke }: { keyStroke: string }) => { ); }; -export interface CommandRowProps { +interface CommandRowProps { /** Icon to display (React node) */ icon?: React.ReactNode; /** Main title text */ diff --git a/vite/src/views/command-bar/commandUtils.ts b/vite/src/views/command-bar/commandUtils.ts index 9152604ef..54b7fadcf 100644 --- a/vite/src/views/command-bar/commandUtils.ts +++ b/vite/src/views/command-bar/commandUtils.ts @@ -1,7 +1,7 @@ /** * Calculate Levenshtein distance between two strings */ -export function levenshteinDistance(a: string, b: string): number { +function levenshteinDistance(a: string, b: string): number { const matrix: number[][] = []; for (let i = 0; i <= b.length; i++) { diff --git a/vite/src/views/customers/CustomersContext.tsx b/vite/src/views/customers/CustomersContext.tsx index 519b2ffde..d00f9e511 100644 --- a/vite/src/views/customers/CustomersContext.tsx +++ b/vite/src/views/customers/CustomersContext.tsx @@ -2,7 +2,7 @@ import { createContext, useContext } from "react"; export const CustomersContext = createContext(null); -export const useCustomersContext = () => { +const useCustomersContext = () => { const context = useContext(CustomersContext); if (context === undefined) { diff --git a/vite/src/views/customers/customer/analytics/components/QueryTopbar.tsx b/vite/src/views/customers/customer/analytics/components/QueryTopbar.tsx index 1e72f64ab..9902aa011 100644 --- a/vite/src/views/customers/customer/analytics/components/QueryTopbar.tsx +++ b/vite/src/views/customers/customer/analytics/components/QueryTopbar.tsx @@ -18,7 +18,7 @@ import { SelectFeatureDropdown } from "./SelectFeatureDropdown"; import { SelectGroupByDropdown } from "./SelectGroupByDropdown"; // Simple intervals without bin size options -export const SIMPLE_INTERVALS: Record = { +const SIMPLE_INTERVALS: Record = { "24h": "Last 24 hours", "7d": "Last 7 days", "30d": "Last 30 days", @@ -26,12 +26,12 @@ export const SIMPLE_INTERVALS: Record = { }; // Intervals that support bin size selection (day/month) -export const BIN_SIZE_INTERVALS: Record = { +const BIN_SIZE_INTERVALS: Record = { "90d": "Last 90 days", "3bc": "Latest 3 billing cycles", }; -export const ALL_INTERVALS: Record = { +const ALL_INTERVALS: Record = { ...SIMPLE_INTERVALS, ...BIN_SIZE_INTERVALS, }; diff --git a/vite/src/views/customers2/components/table/customer-feature-usage/customerFeatureUsageUtils.ts b/vite/src/views/customers2/components/table/customer-feature-usage/customerFeatureUsageUtils.ts index 39db25f0f..b444a8f9b 100644 --- a/vite/src/views/customers2/components/table/customer-feature-usage/customerFeatureUsageUtils.ts +++ b/vite/src/views/customers2/components/table/customer-feature-usage/customerFeatureUsageUtils.ts @@ -194,7 +194,7 @@ export function processNonBooleanEntitlements({ /** * Filters entitlements to only boolean features */ -export function filterBooleanEntitlements({ +function filterBooleanEntitlements({ entitlements, }: { entitlements: FullCusEntWithFullCusProduct[]; diff --git a/vite/src/views/customers2/components/table/customer-products/customerProductsTableFilters.ts b/vite/src/views/customers2/components/table/customer-products/customerProductsTableFilters.ts index b7b43e7f6..ae1bbc3a6 100644 --- a/vite/src/views/customers2/components/table/customer-products/customerProductsTableFilters.ts +++ b/vite/src/views/customers2/components/table/customer-products/customerProductsTableFilters.ts @@ -10,13 +10,13 @@ import { filterByExpiredStatus } from "@/views/customers2/utils/tableFilterUtils /** * Determines if a customer product is a one-off purchase using existing utilities */ -export function isOneOffCusProduct(cusProduct: FullCusProduct): boolean { +function isOneOffCusProduct(cusProduct: FullCusProduct): boolean { const fullProduct = cusProductToProduct({ cusProduct }); const productV2 = mapToProductV2({ product: fullProduct }); return isOneOffProductV2({ items: productV2.items }); } -export function filterCustomerProducts({ +function filterCustomerProducts({ customer, showExpired, }: { @@ -29,7 +29,7 @@ export function filterCustomerProducts({ }); } -export function filterCustomerProductsByEntity({ +function filterCustomerProductsByEntity({ customer, showExpired, }: { diff --git a/vite/src/views/customers2/components/table/customer-usage-analytics/customerUsageAnalyticsUtils.ts b/vite/src/views/customers2/components/table/customer-usage-analytics/customerUsageAnalyticsUtils.ts index 023898ba1..380315246 100644 --- a/vite/src/views/customers2/components/table/customer-usage-analytics/customerUsageAnalyticsUtils.ts +++ b/vite/src/views/customers2/components/table/customer-usage-analytics/customerUsageAnalyticsUtils.ts @@ -81,7 +81,7 @@ export function prepareTimeseriesChartData({ /** * Extracts unique event names from events */ -export function getAvailableFeatures({ +function getAvailableFeatures({ events, }: { events: Event[]; @@ -93,7 +93,7 @@ export function getAvailableFeatures({ /** * Filters events by time range and selected features */ -export function filterEventsByTimeAndFeatures({ +function filterEventsByTimeAndFeatures({ events, selectedDays, selectedFeatures, diff --git a/vite/src/views/customers2/customer-plan/CustomerPlanEditor.tsx b/vite/src/views/customers2/customer-plan/CustomerPlanEditor.tsx index 852c4272b..e32b9a7b2 100644 --- a/vite/src/views/customers2/customer-plan/CustomerPlanEditor.tsx +++ b/vite/src/views/customers2/customer-plan/CustomerPlanEditor.tsx @@ -81,7 +81,7 @@ export default function CustomerProductView() { ); } -export const CopyUrl = ({ +const CopyUrl = ({ url, isInvoice = false, }: { diff --git a/vite/src/views/customers2/customer/CustomerContext.tsx b/vite/src/views/customers2/customer/CustomerContext.tsx index 3a3ec29e1..d852fadaf 100644 --- a/vite/src/views/customers2/customer/CustomerContext.tsx +++ b/vite/src/views/customers2/customer/CustomerContext.tsx @@ -1,7 +1,7 @@ import type { CustomerWithProducts } from "@autumn/shared"; import { createContext, useContext } from "react"; -export type CustomerContextType = { +type CustomerContextType = { customer: CustomerWithProducts; entityId: string | null; setEntityId: (entityId: string | null) => void; diff --git a/vite/src/views/customers2/hooks/useCustomerListColumns.ts b/vite/src/views/customers2/hooks/useCustomerListColumns.ts index 8dae6d788..7fe2ee16c 100644 --- a/vite/src/views/customers2/hooks/useCustomerListColumns.ts +++ b/vite/src/views/customers2/hooks/useCustomerListColumns.ts @@ -83,4 +83,4 @@ export function useCustomerListColumns({ }, [features]); } -export type { CustomerWithProducts }; +; diff --git a/vite/src/views/customers2/utils/ColumnHelpers.tsx b/vite/src/views/customers2/utils/ColumnHelpers.tsx index 9c63021e7..a8fc4a3e1 100644 --- a/vite/src/views/customers2/utils/ColumnHelpers.tsx +++ b/vite/src/views/customers2/utils/ColumnHelpers.tsx @@ -32,7 +32,7 @@ export function createDateTimeColumn({ /** * Creates a reusable ID column with copy button. */ -export function createIdCopyColumn({ +function createIdCopyColumn({ header = "ID", accessorKey, displayKey, diff --git a/vite/src/views/developer/api-keys/components/APIKeyToolbar.tsx b/vite/src/views/developer/api-keys/components/APIKeyToolbar.tsx index 9ea1e5f45..4727a3f48 100644 --- a/vite/src/views/developer/api-keys/components/APIKeyToolbar.tsx +++ b/vite/src/views/developer/api-keys/components/APIKeyToolbar.tsx @@ -10,7 +10,7 @@ import { } from "@/components/ui/dropdown-menu"; import { DeleteApiKeyDialog } from "./DeleteApiKeyDialog"; -export const APIKeyToolbarItems = ({ +const APIKeyToolbarItems = ({ setDeleteOpen, }: { setDeleteOpen: (open: boolean) => void; diff --git a/vite/src/views/developer/publishable-key.tsx b/vite/src/views/developer/publishable-key.tsx index 53d351e01..d897f8f64 100644 --- a/vite/src/views/developer/publishable-key.tsx +++ b/vite/src/views/developer/publishable-key.tsx @@ -29,7 +29,7 @@ export const PublishableKeySection = () => { ); }; -export const CopyPublishableKey = ({ +const CopyPublishableKey = ({ type, value, }: { diff --git a/vite/src/views/main-sidebar/MainSidebar.tsx b/vite/src/views/main-sidebar/MainSidebar.tsx index 90e406282..a5b838674 100644 --- a/vite/src/views/main-sidebar/MainSidebar.tsx +++ b/vite/src/views/main-sidebar/MainSidebar.tsx @@ -28,7 +28,7 @@ import SidebarBottom from "./SidebarBottom"; import { SidebarContext } from "./SidebarContext"; import { SidebarRail } from "./SidebarRail"; -export const buildDevSubTabs = ({ +const buildDevSubTabs = ({ flags, }: { flags: { diff --git a/vite/src/views/main-sidebar/env-dropdown/ExpandedEnvTrigger.tsx b/vite/src/views/main-sidebar/env-dropdown/ExpandedEnvTrigger.tsx index 379947479..9b188ff90 100644 --- a/vite/src/views/main-sidebar/env-dropdown/ExpandedEnvTrigger.tsx +++ b/vite/src/views/main-sidebar/env-dropdown/ExpandedEnvTrigger.tsx @@ -5,8 +5,8 @@ import { cn } from "@/lib/utils"; import { useEnv } from "@/utils/envUtils"; import { useSidebarContext } from "../SidebarContext"; -export const sandboxStyles = "text-t8 bg-t8/10 border-t8 "; -export const liveStyles = "text-primary bg-primary/10 border-primary"; +const sandboxStyles = "text-t8 bg-t8/10 border-t8 "; +const liveStyles = "text-primary bg-primary/10 border-primary"; export const ExpandedEnvTrigger = ({ isHovered }: { isHovered: boolean }) => { const env = useEnv(); diff --git a/vite/src/views/main-sidebar/org-dropdown/manage-org/OrgLogoUploader.tsx b/vite/src/views/main-sidebar/org-dropdown/manage-org/OrgLogoUploader.tsx index 36fb0487b..5db3a5a47 100644 --- a/vite/src/views/main-sidebar/org-dropdown/manage-org/OrgLogoUploader.tsx +++ b/vite/src/views/main-sidebar/org-dropdown/manage-org/OrgLogoUploader.tsx @@ -13,7 +13,7 @@ import { getOrgLogoUrl } from "@/utils/orgUtils"; const MAX_SIZE_MB = 10; const MAX_SIZE_BYTES = MAX_SIZE_MB * 1024 * 1024; -export interface OrgLogoUploaderProps { +interface OrgLogoUploaderProps { initialLogoUrl?: string; } diff --git a/vite/src/views/onboarding3/utils/onboardingUtils.ts b/vite/src/views/onboarding3/utils/onboardingUtils.ts index 59248f45c..7ebf9d2a6 100644 --- a/vite/src/views/onboarding3/utils/onboardingUtils.ts +++ b/vite/src/views/onboarding3/utils/onboardingUtils.ts @@ -27,7 +27,7 @@ export enum OnboardingStep { } // Helper to convert step enum to number for display -export const getStepNumber = (step: OnboardingStep): number => { +const getStepNumber = (step: OnboardingStep): number => { const stepOrder = [ OnboardingStep.PlanDetails, OnboardingStep.FeatureCreation, @@ -39,7 +39,7 @@ export const getStepNumber = (step: OnboardingStep): number => { }; // Helper to get next step -export const getNextStep = ( +const getNextStep = ( currentStep: OnboardingStep, ): OnboardingStep | null => { switch (currentStep) { @@ -59,7 +59,7 @@ export const getNextStep = ( }; // Step configuration for headers and descriptions -export const stepConfig = { +const stepConfig = { [OnboardingStep.PlanDetails]: { title: "Create your first Plan", description: @@ -88,7 +88,7 @@ export const stepConfig = { }; // Check if user needs state reset to prevent conflicts -export const checkForStateConflicts = ( +const checkForStateConflicts = ( step: OnboardingStep, productCreatedRef: MutableRefObject<{ created: boolean; @@ -113,7 +113,7 @@ export const checkForStateConflicts = ( }; // Create initial empty product state -export const createInitialProductState = (env?: string) => ({ +const createInitialProductState = (env?: string) => ({ id: "", name: "", items: [], @@ -128,7 +128,7 @@ export const createInitialProductState = (env?: string) => ({ }); // Reset creation tracking refs -export const resetCreationTracking = ( +const resetCreationTracking = ( productCreatedRef: MutableRefObject<{ created: boolean; latestId: string | null; @@ -143,7 +143,7 @@ export const resetCreationTracking = ( }; // Handle back navigation logic -export const handleBackNavigation = async ( +const handleBackNavigation = async ( step: OnboardingStep, productCreatedRef: MutableRefObject<{ created: boolean; @@ -194,7 +194,7 @@ export const handleBackNavigation = async ( }; // Handle plan selection logic -export const handlePlanSelection = async ( +const handlePlanSelection = async ( planId: string, selectedProductId: string, _baseProduct: any, @@ -222,7 +222,7 @@ export const handlePlanSelection = async ( }; // Handle create plan dialog success -export const handleCreatePlanSuccess = async ( +const handleCreatePlanSuccess = async ( newProduct: any, axiosInstance: AxiosInstance, setBaseProduct: (product: any) => void, @@ -248,7 +248,7 @@ export const handleCreatePlanSuccess = async ( }; // Product creation helper -export const createProduct = async ( +const createProduct = async ( product: any, axiosInstance: AxiosInstance, ) => { @@ -316,7 +316,7 @@ export const createProduct = async ( }; // Feature creation helper -export const createFeature = async ( +const createFeature = async ( feature: CreateFeature, axiosInstance: AxiosInstance, ) => { @@ -351,7 +351,7 @@ export const createFeature = async ( }; // Product item creation helper -export const createProductItem = (createdFeature: CreateFeature) => { +const createProductItem = (createdFeature: CreateFeature) => { // Map feature type to product item feature type let featureType: ProductItemFeatureType; @@ -415,7 +415,7 @@ export const createProductItem = (createdFeature: CreateFeature) => { }; // Find next closest non-deleted product when a product is deleted -export const findNextClosestProduct = ( +const findNextClosestProduct = ( deletedProductId: string, products: any[], currentSelectedId?: string, @@ -450,7 +450,7 @@ export const findNextClosestProduct = ( }; // Sync product items with updated features to prevent feature type mismatches -export const syncProductItemsWithFeature = ( +const syncProductItemsWithFeature = ( product: ProductV2, updatedFeature: CreateFeature | Feature, ): ProductV2 => { @@ -477,7 +477,7 @@ export const syncProductItemsWithFeature = ( }; // Helper to get baseProduct from products array by ID -export const getBaseProduct = ( +const getBaseProduct = ( products: ProductV2[] | undefined, baseProductId: string | null, ): ProductV2 | null => { @@ -486,7 +486,7 @@ export const getBaseProduct = ( }; // Helper to get baseFeature from features array by ID -export const getBaseFeature = ( +const getBaseFeature = ( features: (Feature | CreateFeature)[] | undefined, baseFeatureId: string | null, ): Feature | CreateFeature | null => { diff --git a/vite/src/views/onboarding4/pricingAgentUtils.ts b/vite/src/views/onboarding4/pricingAgentUtils.ts index d778d43e2..f677ae754 100644 --- a/vite/src/views/onboarding4/pricingAgentUtils.ts +++ b/vite/src/views/onboarding4/pricingAgentUtils.ts @@ -56,7 +56,7 @@ export interface AgentPricingConfig { /** * Transform an AgentPricingConfig (from the AI) into PricingTier[] (for the UI) */ -export function transformConfigToTiers({ +function transformConfigToTiers({ config, features, }: { diff --git a/vite/src/views/onboarding4/pricingTemplateConfigs.ts b/vite/src/views/onboarding4/pricingTemplateConfigs.ts index 91eed8a49..c2642de7e 100644 --- a/vite/src/views/onboarding4/pricingTemplateConfigs.ts +++ b/vite/src/views/onboarding4/pricingTemplateConfigs.ts @@ -1,4 +1,4 @@ -export interface PricingTemplatePrompt { +interface PricingTemplatePrompt { id: string; label: string; icon: string; diff --git a/vite/src/views/onboarding4/templateConfigs.ts b/vite/src/views/onboarding4/templateConfigs.ts index 4db6a8552..010e7f9fb 100644 --- a/vite/src/views/onboarding4/templateConfigs.ts +++ b/vite/src/views/onboarding4/templateConfigs.ts @@ -7,7 +7,7 @@ export interface PricingTier { highlighted?: boolean; } -export interface TemplateConfig { +interface TemplateConfig { id: string; name: string; company: string; @@ -17,7 +17,7 @@ export interface TemplateConfig { websiteUrl: string; } -export const TEMPLATE_CONFIGS: TemplateConfig[] = [ +const TEMPLATE_CONFIGS: TemplateConfig[] = [ { id: "cursor", name: "Cursor", diff --git a/vite/src/views/products/features/utils/getFeatureIcon.tsx b/vite/src/views/products/features/utils/getFeatureIcon.tsx index 486c7820a..264e4c86c 100644 --- a/vite/src/views/products/features/utils/getFeatureIcon.tsx +++ b/vite/src/views/products/features/utils/getFeatureIcon.tsx @@ -15,7 +15,7 @@ import type React from "react"; /** * Icon configuration with icon component, color class, and optional label */ -export interface FeatureIconConfig { +interface FeatureIconConfig { icon: React.ReactNode; color: string; label: string; @@ -112,7 +112,7 @@ export const getFeatureIcon = ({ feature }: { feature: Feature }) => { * Returns the appropriate icon component for a product item. * Uses getFeatureIconConfig as the single source of truth. */ -export const getProductItemFeatureIcon = ({ item }: { item: ProductItem }) => { +const getProductItemFeatureIcon = ({ item }: { item: ProductItem }) => { const config = getFeatureIconConfig(item.feature_type); return {config.icon}; }; diff --git a/vite/src/views/products/plan/utils/tierUtils.ts b/vite/src/views/products/plan/utils/tierUtils.ts index f2d743e99..a7821ca91 100644 --- a/vite/src/views/products/plan/utils/tierUtils.ts +++ b/vite/src/views/products/plan/utils/tierUtils.ts @@ -39,7 +39,7 @@ export const addTier = ({ } }; -export const removeTiers = ({ +const removeTiers = ({ item, setItem, }: { diff --git a/vite/src/views/products/product/product-item/ProductItemContext.tsx b/vite/src/views/products/product/product-item/ProductItemContext.tsx index 9db260aea..b1aed6ecb 100644 --- a/vite/src/views/products/product/product-item/ProductItemContext.tsx +++ b/vite/src/views/products/product/product-item/ProductItemContext.tsx @@ -1,7 +1,7 @@ import type { ProductItem } from "@autumn/shared"; import { createContext, useContext } from "react"; -export interface ProductItemContextType { +interface ProductItemContextType { item: ProductItem | null; initialItem?: ProductItem | null; setItem: (item: ProductItem) => void; diff --git a/vite/src/views/products/rewards/utils/defaultRewardModels.ts b/vite/src/views/products/rewards/utils/defaultRewardModels.ts index 3db4d6be8..7c1f9a06d 100644 --- a/vite/src/views/products/rewards/utils/defaultRewardModels.ts +++ b/vite/src/views/products/rewards/utils/defaultRewardModels.ts @@ -15,12 +15,12 @@ export const defaultDiscountConfig: DiscountConfig = { price_ids: [], }; -export const defaultFreeProductConfig: FreeProductConfig = { +const defaultFreeProductConfig: FreeProductConfig = { duration_type: CouponDurationType.Months, duration_value: 0, }; -export const defaultReward: CreateReward = { +const defaultReward: CreateReward = { name: "", id: "", promo_codes: [{ code: "" }],