@windrun-huaiin/backend-core 27.0.0 → 28.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/api/ai/route.d.ts +2 -0
- package/dist/app/api/ai/route.d.ts.map +1 -0
- package/dist/app/api/ai/route.js +10 -0
- package/dist/app/api/ai/route.mjs +1 -0
- package/dist/app/api/stripe/checkout/route.js +1 -1
- package/dist/app/api/stripe/checkout/route.mjs +1 -1
- package/dist/app/api/stripe/customer-portal/route.js +1 -1
- package/dist/app/api/stripe/customer-portal/route.mjs +1 -1
- package/dist/app/api/user/credit-overview/route.d.ts +13 -0
- package/dist/app/api/user/credit-overview/route.d.ts.map +1 -0
- package/dist/app/api/user/credit-overview/route.js +32 -0
- package/dist/app/api/user/credit-overview/route.mjs +30 -0
- package/dist/app/api/user/pricing-context/route.d.ts +3 -0
- package/dist/app/api/user/pricing-context/route.d.ts.map +1 -0
- package/dist/app/api/user/pricing-context/route.js +19 -0
- package/dist/app/api/user/pricing-context/route.mjs +17 -0
- package/dist/app/api/webhook/clerk/user/route.js +1 -1
- package/dist/app/api/webhook/clerk/user/route.mjs +1 -1
- package/dist/auth/auth-utils.js +1 -1
- package/dist/auth/auth-utils.mjs +1 -1
- package/dist/core-prisma/browser.d.ts +40 -0
- package/dist/core-prisma/browser.d.ts.map +1 -0
- package/dist/core-prisma/client.d.ts +57 -0
- package/dist/core-prisma/client.d.ts.map +1 -0
- package/dist/core-prisma/client.js +55 -0
- package/dist/core-prisma/client.mjs +33 -0
- package/dist/core-prisma/commonInputTypes.d.ts +495 -0
- package/dist/core-prisma/commonInputTypes.d.ts.map +1 -0
- package/dist/core-prisma/enums.d.ts +2 -0
- package/dist/core-prisma/enums.d.ts.map +1 -0
- package/dist/core-prisma/internal/class.d.ts +193 -0
- package/dist/core-prisma/internal/class.d.ts.map +1 -0
- package/dist/core-prisma/internal/class.js +108 -0
- package/dist/core-prisma/internal/class.mjs +87 -0
- package/dist/core-prisma/internal/prismaNamespace.d.ts +1180 -0
- package/dist/core-prisma/internal/prismaNamespace.d.ts.map +1 -0
- package/dist/core-prisma/internal/prismaNamespace.js +278 -0
- package/dist/core-prisma/internal/prismaNamespace.mjs +226 -0
- package/dist/core-prisma/internal/prismaNamespaceBrowser.d.ts +233 -0
- package/dist/core-prisma/internal/prismaNamespaceBrowser.d.ts.map +1 -0
- package/dist/core-prisma/models/Apilog.d.ts +1088 -0
- package/dist/core-prisma/models/Apilog.d.ts.map +1 -0
- package/dist/core-prisma/models/Credit.d.ts +1554 -0
- package/dist/core-prisma/models/Credit.d.ts.map +1 -0
- package/dist/core-prisma/models/CreditAuditLog.d.ts +1362 -0
- package/dist/core-prisma/models/CreditAuditLog.d.ts.map +1 -0
- package/dist/core-prisma/models/Subscription.d.ts +1441 -0
- package/dist/core-prisma/models/Subscription.d.ts.map +1 -0
- package/dist/core-prisma/models/Transaction.d.ts +2222 -0
- package/dist/core-prisma/models/Transaction.d.ts.map +1 -0
- package/dist/core-prisma/models/User.d.ts +1775 -0
- package/dist/core-prisma/models/User.d.ts.map +1 -0
- package/dist/core-prisma/models/UserBackup.d.ts +1228 -0
- package/dist/core-prisma/models/UserBackup.d.ts.map +1 -0
- package/dist/core-prisma/models.d.ts +9 -0
- package/dist/core-prisma/models.d.ts.map +1 -0
- package/dist/credit/server.d.ts +1 -0
- package/dist/credit/server.d.ts.map +1 -1
- package/dist/credit/server.js +2 -0
- package/dist/credit/server.mjs +1 -0
- package/dist/index.js +7 -0
- package/dist/index.mjs +5 -2
- package/dist/lib/credit-overview.d.ts +17 -0
- package/dist/lib/credit-overview.d.ts.map +1 -0
- package/dist/lib/credit-overview.js +117 -0
- package/dist/lib/credit-overview.mjs +115 -0
- package/dist/lib/money-price-helper.d.ts.map +1 -1
- package/dist/lib/money-price-helper.js +1 -0
- package/dist/lib/money-price-helper.mjs +2 -1
- package/dist/lib/stripe-config.js +1 -1
- package/dist/lib/stripe-config.mjs +1 -1
- package/dist/prisma/index.d.ts +4 -1
- package/dist/prisma/index.d.ts.map +1 -1
- package/dist/prisma/index.js +6 -0
- package/dist/prisma/index.mjs +4 -1
- package/dist/prisma/prisma-transaction-util.d.ts +1 -1
- package/dist/prisma/prisma-transaction-util.d.ts.map +1 -1
- package/dist/prisma/prisma-transaction-util.js +1 -1
- package/dist/prisma/prisma-transaction-util.mjs +2 -2
- package/dist/prisma/prisma.d.ts +22 -3
- package/dist/prisma/prisma.d.ts.map +1 -1
- package/dist/prisma/prisma.js +83 -20
- package/dist/prisma/prisma.mjs +81 -21
- package/dist/services/aggregate/anonymous.aggregate.service.js +3 -2
- package/dist/services/aggregate/anonymous.aggregate.service.mjs +3 -2
- package/dist/services/aggregate/billing.aggregate.service.js +1 -1
- package/dist/services/aggregate/billing.aggregate.service.mjs +1 -1
- package/dist/services/aggregate/user.aggregate.service.d.ts.map +1 -1
- package/dist/services/aggregate/user.aggregate.service.js +3 -3
- package/dist/services/aggregate/user.aggregate.service.mjs +3 -3
- package/dist/services/context/index.js +1 -0
- package/dist/services/context/index.mjs +1 -1
- package/dist/services/context/user-context-finalizer.d.ts +1 -0
- package/dist/services/context/user-context-finalizer.d.ts.map +1 -1
- package/dist/services/context/user-context-finalizer.js +17 -0
- package/dist/services/context/user-context-finalizer.mjs +17 -1
- package/dist/services/context/user-context-service.js +1 -1
- package/dist/services/context/user-context-service.mjs +1 -1
- package/dist/services/database/apilog.service.js +1 -0
- package/dist/services/database/apilog.service.mjs +1 -0
- package/dist/services/database/credit.service.js +5 -4
- package/dist/services/database/credit.service.mjs +3 -2
- package/dist/services/database/creditAuditLog.service.js +5 -4
- package/dist/services/database/creditAuditLog.service.mjs +3 -2
- package/dist/services/database/prisma-model-type.d.ts +2 -2
- package/dist/services/database/prisma-model-type.d.ts.map +1 -1
- package/dist/services/database/subscription.service.js +1 -0
- package/dist/services/database/subscription.service.mjs +1 -0
- package/dist/services/database/transaction.service.js +5 -4
- package/dist/services/database/transaction.service.mjs +3 -2
- package/dist/services/database/user.service.js +1 -0
- package/dist/services/database/user.service.mjs +1 -0
- package/dist/services/database/userBackup.service.js +1 -0
- package/dist/services/database/userBackup.service.mjs +1 -0
- package/dist/services/stripe/webhook-handler.js +1 -1
- package/dist/services/stripe/webhook-handler.mjs +1 -1
- package/package.json +25 -8
- package/prisma/schema.prisma +3 -1
- package/src/app/api/ai/route.ts +6 -0
- package/src/app/api/user/credit-overview/route.ts +43 -0
- package/src/app/api/user/pricing-context/route.ts +14 -0
- package/src/core-prisma/browser.ts +54 -0
- package/src/core-prisma/client.ts +78 -0
- package/src/core-prisma/commonInputTypes.ts +565 -0
- package/src/core-prisma/enums.ts +15 -0
- package/src/core-prisma/internal/class.ts +293 -0
- package/src/core-prisma/internal/prismaNamespace.ts +1419 -0
- package/src/core-prisma/internal/prismaNamespaceBrowser.ts +259 -0
- package/src/core-prisma/models/Apilog.ts +1244 -0
- package/src/core-prisma/models/Credit.ts +1722 -0
- package/src/core-prisma/models/CreditAuditLog.ts +1536 -0
- package/src/core-prisma/models/Subscription.ts +1610 -0
- package/src/core-prisma/models/Transaction.ts +2398 -0
- package/src/core-prisma/models/User.ts +1982 -0
- package/src/core-prisma/models/UserBackup.ts +1384 -0
- package/src/core-prisma/models.ts +18 -0
- package/src/credit/server.ts +1 -0
- package/src/lib/credit-overview.ts +153 -0
- package/src/lib/money-price-helper.ts +3 -0
- package/src/prisma/index.ts +18 -1
- package/src/prisma/prisma-transaction-util.ts +3 -3
- package/src/prisma/prisma.ts +130 -21
- package/src/services/aggregate/user.aggregate.service.ts +2 -1
- package/src/services/context/user-context-finalizer.ts +16 -0
- package/src/services/database/credit.service.ts +2 -2
- package/src/services/database/prisma-model-type.ts +2 -2
- package/src/services/database/userBackup.service.ts +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import '../../core-prisma/client.mjs';
|
|
3
3
|
import { OperationType, CreditType } from './constants.mjs';
|
|
4
4
|
import { checkAndFallbackWithNonTCClient } from '../../prisma/prisma.mjs';
|
|
5
|
+
import { sql } from '../../core-prisma/internal/prismaNamespace.mjs';
|
|
5
6
|
|
|
6
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
8
|
class CreditAuditLogService {
|
|
@@ -187,7 +188,7 @@ class CreditAuditLogService {
|
|
|
187
188
|
const startDate = new Date();
|
|
188
189
|
startDate.setDate(startDate.getDate() - days);
|
|
189
190
|
const client = checkAndFallbackWithNonTCClient(tx);
|
|
190
|
-
const userFilter = userId ?
|
|
191
|
+
const userFilter = userId ? sql `AND user_id = ${userId}` : sql ``;
|
|
191
192
|
const result = yield client.$queryRaw `
|
|
192
193
|
SELECT
|
|
193
194
|
DATE(created_at) as date,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { User, Subscription, Credit, CreditAuditLog, Transaction, Apilog, UserBackup, } from '
|
|
2
|
-
export { Prisma } from '
|
|
1
|
+
export type { User, Subscription, Credit, CreditAuditLog, Transaction, Apilog, UserBackup, } from '../../core-prisma/client';
|
|
2
|
+
export { Prisma } from '../../core-prisma/client';
|
|
3
3
|
//# sourceMappingURL=prisma-model-type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-model-type.d.ts","sourceRoot":"","sources":["../../../src/services/database/prisma-model-type.ts"],"names":[],"mappings":"AACA,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,WAAW,EACX,MAAM,EACN,UAAU,GACX,MAAM,
|
|
1
|
+
{"version":3,"file":"prisma-model-type.d.ts","sourceRoot":"","sources":["../../../src/services/database/prisma-model-type.ts"],"names":[],"mappings":"AACA,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,WAAW,EACX,MAAM,EACN,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
|
-
|
|
4
|
+
require('../../core-prisma/client.js');
|
|
5
5
|
var constants = require('./constants.js');
|
|
6
6
|
var prisma = require('../../prisma/prisma.js');
|
|
7
|
+
var prismaNamespace = require('../../core-prisma/internal/prismaNamespace.js');
|
|
7
8
|
|
|
8
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
10
|
class TransactionService {
|
|
@@ -279,8 +280,8 @@ class TransactionService {
|
|
|
279
280
|
return tslib.__awaiter(this, arguments, void 0, function* (days = 30, tx) {
|
|
280
281
|
const startDate = new Date();
|
|
281
282
|
startDate.setDate(startDate.getDate() - days);
|
|
282
|
-
const client
|
|
283
|
-
const query =
|
|
283
|
+
const client = prisma.checkAndFallbackWithNonTCClient(tx);
|
|
284
|
+
const query = prismaNamespace.sql `
|
|
284
285
|
SELECT
|
|
285
286
|
DATE(paid_at) as date,
|
|
286
287
|
COUNT(*) as transactions,
|
|
@@ -294,7 +295,7 @@ class TransactionService {
|
|
|
294
295
|
GROUP BY DATE(paid_at)
|
|
295
296
|
ORDER BY date DESC
|
|
296
297
|
`;
|
|
297
|
-
const result = yield client
|
|
298
|
+
const result = yield client.$queryRaw(query);
|
|
298
299
|
return result;
|
|
299
300
|
});
|
|
300
301
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import '../../core-prisma/client.mjs';
|
|
3
3
|
import { PaymentStatus, OrderStatus, TransactionType } from './constants.mjs';
|
|
4
4
|
import { checkAndFallbackWithNonTCClient } from '../../prisma/prisma.mjs';
|
|
5
|
+
import { sql } from '../../core-prisma/internal/prismaNamespace.mjs';
|
|
5
6
|
|
|
6
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
8
|
class TransactionService {
|
|
@@ -278,7 +279,7 @@ class TransactionService {
|
|
|
278
279
|
const startDate = new Date();
|
|
279
280
|
startDate.setDate(startDate.getDate() - days);
|
|
280
281
|
const client = checkAndFallbackWithNonTCClient(tx);
|
|
281
|
-
const query =
|
|
282
|
+
const query = sql `
|
|
282
283
|
SELECT
|
|
283
284
|
DATE(paid_at) as date,
|
|
284
285
|
COUNT(*) as transactions,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import { UserStatus } from './constants.mjs';
|
|
3
3
|
import { checkAndFallbackWithNonTCClient } from '../../prisma/prisma.mjs';
|
|
4
|
+
import '../../core-prisma/client.mjs';
|
|
4
5
|
|
|
5
6
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
7
|
class UserService {
|
|
@@ -4,10 +4,10 @@ var tslib = require('tslib');
|
|
|
4
4
|
var billing_aggregate_service = require('../aggregate/billing.aggregate.service.js');
|
|
5
5
|
var constants = require('../database/constants.js');
|
|
6
6
|
require('../../prisma/prisma.js');
|
|
7
|
+
require('../../core-prisma/client.js');
|
|
7
8
|
var subscription_service = require('../database/subscription.service.js');
|
|
8
9
|
require('../database/credit.service.js');
|
|
9
10
|
var transaction_service = require('../database/transaction.service.js');
|
|
10
|
-
require('@prisma/client');
|
|
11
11
|
var apilog_service = require('../database/apilog.service.js');
|
|
12
12
|
var creditInit = require('../../lib/credit-init.js');
|
|
13
13
|
var moneyPriceConfig = require('../../lib/money-price-config.js');
|
|
@@ -2,10 +2,10 @@ import { __awaiter } from 'tslib';
|
|
|
2
2
|
import { billingAggregateService } from '../aggregate/billing.aggregate.service.mjs';
|
|
3
3
|
import { OrderStatus, TransactionType, PaymentStatus, BillingReason } from '../database/constants.mjs';
|
|
4
4
|
import '../../prisma/prisma.mjs';
|
|
5
|
+
import '../../core-prisma/client.mjs';
|
|
5
6
|
import { subscriptionService } from '../database/subscription.service.mjs';
|
|
6
7
|
import '../database/credit.service.mjs';
|
|
7
8
|
import { transactionService } from '../database/transaction.service.mjs';
|
|
8
|
-
import '@prisma/client';
|
|
9
9
|
import { Apilogger } from '../database/apilog.service.mjs';
|
|
10
10
|
import { oneTimeExpiredDays } from '../../lib/credit-init.mjs';
|
|
11
11
|
import { getCreditsFromPriceId } from '../../lib/money-price-config.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windrun-huaiin/backend-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "28.0.1",
|
|
4
4
|
"description": "Shared backend primitives: Prisma schema/client, database services, routing helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
"import": "./dist/services/ai/index.mjs",
|
|
43
43
|
"require": "./dist/services/ai/index.js"
|
|
44
44
|
},
|
|
45
|
+
"./app/api/ai/route": {
|
|
46
|
+
"types": "./dist/app/api/ai/route.d.ts",
|
|
47
|
+
"import": "./dist/app/api/ai/route.mjs",
|
|
48
|
+
"require": "./dist/app/api/ai/route.js"
|
|
49
|
+
},
|
|
45
50
|
"./config/fingerprint": {
|
|
46
51
|
"types": "./dist/config/fingerprint.d.ts",
|
|
47
52
|
"import": "./dist/config/fingerprint.mjs",
|
|
@@ -102,6 +107,16 @@
|
|
|
102
107
|
"import": "./dist/app/api/user/anonymous/init/route.mjs",
|
|
103
108
|
"require": "./dist/app/api/user/anonymous/init/route.js"
|
|
104
109
|
},
|
|
110
|
+
"./app/api/user/credit-overview/route": {
|
|
111
|
+
"types": "./dist/app/api/user/credit-overview/route.d.ts",
|
|
112
|
+
"import": "./dist/app/api/user/credit-overview/route.mjs",
|
|
113
|
+
"require": "./dist/app/api/user/credit-overview/route.js"
|
|
114
|
+
},
|
|
115
|
+
"./app/api/user/pricing-context/route": {
|
|
116
|
+
"types": "./dist/app/api/user/pricing-context/route.d.ts",
|
|
117
|
+
"import": "./dist/app/api/user/pricing-context/route.mjs",
|
|
118
|
+
"require": "./dist/app/api/user/pricing-context/route.js"
|
|
119
|
+
},
|
|
105
120
|
"./app/api/stripe/checkout/route": {
|
|
106
121
|
"types": "./dist/app/api/stripe/checkout/route.d.ts",
|
|
107
122
|
"import": "./dist/app/api/stripe/checkout/route.mjs",
|
|
@@ -127,6 +142,7 @@
|
|
|
127
142
|
],
|
|
128
143
|
"dependencies": {
|
|
129
144
|
"@clerk/nextjs": "^7.0.5",
|
|
145
|
+
"@prisma/adapter-pg": "^6.19.0",
|
|
130
146
|
"@prisma/client": "^6.19.0",
|
|
131
147
|
"@upstash/redis": "^1.34.0",
|
|
132
148
|
"@upstash/qstash": "^2.7.0",
|
|
@@ -137,9 +153,9 @@
|
|
|
137
153
|
"svix": "^1.86.0",
|
|
138
154
|
"tslib": "^2.8.1",
|
|
139
155
|
"zod": "^4.3.6",
|
|
140
|
-
"@windrun-huaiin/
|
|
141
|
-
"@windrun-huaiin/third-ui": "^
|
|
142
|
-
"@windrun-huaiin/
|
|
156
|
+
"@windrun-huaiin/contracts": "^28.0.0",
|
|
157
|
+
"@windrun-huaiin/third-ui": "^28.0.0",
|
|
158
|
+
"@windrun-huaiin/lib": "^28.0.0"
|
|
143
159
|
},
|
|
144
160
|
"devDependencies": {
|
|
145
161
|
"@rollup/plugin-alias": "^5.1.1",
|
|
@@ -163,10 +179,11 @@
|
|
|
163
179
|
"access": "public"
|
|
164
180
|
},
|
|
165
181
|
"scripts": {
|
|
166
|
-
"
|
|
167
|
-
"build:
|
|
168
|
-
"
|
|
182
|
+
"prisma:generate": "rm -rf src/core-prisma && prisma generate --schema prisma/schema.prisma",
|
|
183
|
+
"build": "pnpm prisma:generate && rm -rf dist && rollup -c rollup.config.mjs",
|
|
184
|
+
"build:prod": "pnpm prisma:generate && rm -rf dist && rollup -c rollup.config.mjs",
|
|
185
|
+
"dev": "pnpm prisma:generate && rollup -c rollup.config.mjs --watch",
|
|
169
186
|
"clean": "rm -rf dist",
|
|
170
|
-
"type-check": "tsc --noEmit"
|
|
187
|
+
"type-check": "pnpm prisma:generate && tsc --noEmit"
|
|
171
188
|
}
|
|
172
189
|
}
|
package/prisma/schema.prisma
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// - generator/datasource 配置仅为示例,合并到宿主时请以宿主的 schema 为准,必要时删除/覆盖本段。
|
|
3
3
|
// - models 定义可直接复用,数据库连接信息应由宿主自行配置。
|
|
4
4
|
generator client {
|
|
5
|
-
provider = "prisma-client
|
|
5
|
+
provider = "prisma-client"
|
|
6
|
+
output = "../src/core-prisma"
|
|
7
|
+
engineType = "client"
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
datasource db {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
// Fix BigInt serialization issue
|
|
4
|
+
(BigInt.prototype as any).toJSON = function () {
|
|
5
|
+
return this.toString();
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
import type { CreditOverviewTranslations } from '@windrun-huaiin/third-ui/main/credit';
|
|
9
|
+
import { NextResponse } from 'next/server';
|
|
10
|
+
import { buildCreditOverviewPayload } from '@core/lib/credit-overview';
|
|
11
|
+
|
|
12
|
+
export type CreditOverviewTranslationsResolver = (
|
|
13
|
+
locale: string,
|
|
14
|
+
) => CreditOverviewTranslations | Promise<CreditOverviewTranslations>;
|
|
15
|
+
|
|
16
|
+
export interface CreateGETOptions {
|
|
17
|
+
defaultLocale?: string;
|
|
18
|
+
localePrefixAsNeeded?: boolean;
|
|
19
|
+
resolveTranslations: CreditOverviewTranslationsResolver;
|
|
20
|
+
pricingPath?: string;
|
|
21
|
+
checkoutApiEndpoint?: string;
|
|
22
|
+
customerPortalApiEndpoint?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function createGET(options: CreateGETOptions) {
|
|
26
|
+
return async function GET(request: Request) {
|
|
27
|
+
const { searchParams } = new URL(request.url);
|
|
28
|
+
const locale = searchParams.get('locale') || options.defaultLocale || 'en';
|
|
29
|
+
const translations = await options.resolveTranslations(locale);
|
|
30
|
+
|
|
31
|
+
const payload = await buildCreditOverviewPayload({
|
|
32
|
+
locale,
|
|
33
|
+
defaultLocale: options.defaultLocale,
|
|
34
|
+
localePrefixAsNeeded: options.localePrefixAsNeeded,
|
|
35
|
+
translations,
|
|
36
|
+
pricingPath: options.pricingPath,
|
|
37
|
+
checkoutApiEndpoint: options.checkoutApiEndpoint,
|
|
38
|
+
customerPortalApiEndpoint: options.customerPortalApiEndpoint,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return NextResponse.json(payload);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
// Fix BigInt serialization issue
|
|
4
|
+
(BigInt.prototype as any).toJSON = function () {
|
|
5
|
+
return this.toString();
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
import { getMoneyPriceInitUserContext } from '@core/lib/money-price-helper';
|
|
9
|
+
import { NextResponse } from 'next/server';
|
|
10
|
+
|
|
11
|
+
export async function GET() {
|
|
12
|
+
const initUserContext = await getMoneyPriceInitUserContext();
|
|
13
|
+
return NextResponse.json(initUserContext);
|
|
14
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// biome-ignore-all lint: generated file
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/*
|
|
7
|
+
* This file should be your main import to use Prisma-related types and utilities in a browser.
|
|
8
|
+
* Use it to get access to models, enums, and input types.
|
|
9
|
+
*
|
|
10
|
+
* This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
|
|
11
|
+
* See `client.ts` for the standard, server-side entry point.
|
|
12
|
+
*
|
|
13
|
+
* 🟢 You can import this file directly.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import * as Prisma from './internal/prismaNamespaceBrowser'
|
|
17
|
+
export { Prisma }
|
|
18
|
+
export * as $Enums from './enums'
|
|
19
|
+
export * from './enums';
|
|
20
|
+
/**
|
|
21
|
+
* Model User
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export type User = Prisma.UserModel
|
|
25
|
+
/**
|
|
26
|
+
* Model Subscription
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export type Subscription = Prisma.SubscriptionModel
|
|
30
|
+
/**
|
|
31
|
+
* Model Credit
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export type Credit = Prisma.CreditModel
|
|
35
|
+
/**
|
|
36
|
+
* Model Transaction
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export type Transaction = Prisma.TransactionModel
|
|
40
|
+
/**
|
|
41
|
+
* Model CreditAuditLog
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
export type CreditAuditLog = Prisma.CreditAuditLogModel
|
|
45
|
+
/**
|
|
46
|
+
* Model UserBackup
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
export type UserBackup = Prisma.UserBackupModel
|
|
50
|
+
/**
|
|
51
|
+
* Model Apilog
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
export type Apilog = Prisma.ApilogModel
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// biome-ignore-all lint: generated file
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/*
|
|
7
|
+
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
|
|
8
|
+
* If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
|
|
9
|
+
*
|
|
10
|
+
* 🟢 You can import this file directly.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import * as process from 'node:process'
|
|
14
|
+
import * as path from 'node:path'
|
|
15
|
+
import { fileURLToPath } from 'node:url'
|
|
16
|
+
globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))
|
|
17
|
+
|
|
18
|
+
import * as runtime from "@prisma/client/runtime/client"
|
|
19
|
+
import * as $Enums from "./enums"
|
|
20
|
+
import * as $Class from "./internal/class"
|
|
21
|
+
import * as Prisma from "./internal/prismaNamespace"
|
|
22
|
+
|
|
23
|
+
export * as $Enums from './enums'
|
|
24
|
+
export * from "./enums"
|
|
25
|
+
/**
|
|
26
|
+
* ## Prisma Client
|
|
27
|
+
*
|
|
28
|
+
* Type-safe database client for TypeScript
|
|
29
|
+
* @example
|
|
30
|
+
* ```
|
|
31
|
+
* const prisma = new PrismaClient()
|
|
32
|
+
* // Fetch zero or more Users
|
|
33
|
+
* const users = await prisma.user.findMany()
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
|
37
|
+
*/
|
|
38
|
+
export const PrismaClient = $Class.getPrismaClientClass(__dirname)
|
|
39
|
+
export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions["omit"] = Prisma.PrismaClientOptions["omit"], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>
|
|
40
|
+
export { Prisma }
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Model User
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
export type User = Prisma.UserModel
|
|
49
|
+
/**
|
|
50
|
+
* Model Subscription
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
export type Subscription = Prisma.SubscriptionModel
|
|
54
|
+
/**
|
|
55
|
+
* Model Credit
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export type Credit = Prisma.CreditModel
|
|
59
|
+
/**
|
|
60
|
+
* Model Transaction
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
export type Transaction = Prisma.TransactionModel
|
|
64
|
+
/**
|
|
65
|
+
* Model CreditAuditLog
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export type CreditAuditLog = Prisma.CreditAuditLogModel
|
|
69
|
+
/**
|
|
70
|
+
* Model UserBackup
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
export type UserBackup = Prisma.UserBackupModel
|
|
74
|
+
/**
|
|
75
|
+
* Model Apilog
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export type Apilog = Prisma.ApilogModel
|