@windrun-huaiin/backend-core 26.0.2 → 28.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/config/fingerprint.d.ts +2 -0
- package/dist/config/fingerprint.d.ts.map +1 -0
- package/dist/config/fingerprint.js +7 -0
- package/dist/config/fingerprint.mjs +1 -0
- package/dist/config/money-price.d.ts +2 -0
- package/dist/config/money-price.d.ts.map +1 -0
- package/dist/config/money-price.js +10 -0
- package/dist/config/money-price.mjs +1 -0
- 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 +2 -0
- package/dist/credit/server.d.ts.map +1 -0
- package/dist/credit/server.js +11 -0
- package/dist/credit/server.mjs +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -98
- package/dist/index.mjs +5 -14
- 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/pricing/server.d.ts +2 -0
- package/dist/pricing/server.d.ts.map +1 -0
- package/dist/pricing/server.js +7 -0
- package/dist/pricing/server.mjs +1 -0
- 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.d.ts +2 -2
- package/dist/services/aggregate/anonymous.aggregate.service.d.ts.map +1 -1
- 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.d.ts +2 -2
- package/dist/services/aggregate/billing.aggregate.service.d.ts.map +1 -1
- 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 +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.d.ts +2 -2
- package/dist/services/database/apilog.service.d.ts.map +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.d.ts +2 -2
- package/dist/services/database/credit.service.d.ts.map +1 -1
- package/dist/services/database/credit.service.js +5 -4
- package/dist/services/database/credit.service.mjs +3 -2
- package/dist/services/database/creditAuditLog.service.d.ts +2 -2
- package/dist/services/database/creditAuditLog.service.d.ts.map +1 -1
- 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.d.ts +1 -1
- package/dist/services/database/subscription.service.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.d.ts +3 -3
- package/dist/services/database/transaction.service.d.ts.map +1 -1
- package/dist/services/database/transaction.service.js +5 -4
- package/dist/services/database/transaction.service.mjs +3 -2
- package/dist/services/database/user.service.d.ts +2 -2
- package/dist/services/database/user.service.d.ts.map +1 -1
- package/dist/services/database/user.service.js +1 -0
- package/dist/services/database/user.service.mjs +1 -0
- package/dist/services/database/userBackup.service.d.ts +2 -2
- package/dist/services/database/userBackup.service.d.ts.map +1 -1
- 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/dist/upstash/server.d.ts +3 -0
- package/dist/upstash/server.d.ts.map +1 -0
- package/dist/{lib/index.js → upstash/server.js} +7 -32
- package/dist/upstash/server.mjs +7 -0
- package/package.json +44 -12
- package/prisma/schema.prisma +3 -1
- package/src/app/api/ai/route.ts +6 -0
- package/src/app/api/stripe/checkout/route.ts +4 -4
- package/src/app/api/stripe/customer-portal/route.ts +3 -3
- package/src/app/api/user/anonymous/init/route.ts +5 -5
- package/src/app/api/webhook/clerk/user/route.ts +3 -3
- package/src/app/api/webhook/stripe/route.ts +3 -3
- package/src/config/fingerprint.ts +1 -0
- package/src/config/money-price.ts +1 -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/index.ts +0 -1
- package/src/lib/money-price-helper.ts +3 -0
- package/src/pricing/server.ts +1 -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/anonymous.aggregate.service.ts +7 -7
- package/src/services/aggregate/billing.aggregate.service.ts +3 -3
- package/src/services/aggregate/user.aggregate.service.ts +7 -6
- package/src/services/context/user-context-finalizer.ts +16 -0
- package/src/services/database/apilog.service.ts +3 -3
- package/src/services/database/credit.service.ts +7 -7
- package/src/services/database/creditAuditLog.service.ts +4 -4
- package/src/services/database/prisma-model-type.ts +2 -2
- package/src/services/database/subscription.service.ts +3 -3
- package/src/services/database/transaction.service.ts +4 -4
- package/src/services/database/user.service.ts +4 -4
- package/src/services/database/userBackup.service.ts +4 -4
- package/src/services/stripe/webhook-handler.ts +6 -6
- package/src/upstash/server.ts +2 -0
- package/dist/lib/index.d.ts +0 -8
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.mjs +0 -12
- package/src/lib/index.ts +0 -7
|
@@ -3,9 +3,9 @@ import { z } from 'zod';
|
|
|
3
3
|
import {
|
|
4
4
|
createCustomerPortalSession,
|
|
5
5
|
createOrGetCustomer,
|
|
6
|
-
} from '
|
|
7
|
-
import { ApiAuthUtils } from '
|
|
8
|
-
import { subscriptionService } from '
|
|
6
|
+
} from '@core/lib/stripe-config';
|
|
7
|
+
import { ApiAuthUtils } from '@core/auth/auth-utils';
|
|
8
|
+
import { subscriptionService } from '@core/db/index';
|
|
9
9
|
|
|
10
10
|
const createCustomerPortalSchema = z
|
|
11
11
|
.object({
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
return this.toString();
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
import { anonymousAggregateService } from '
|
|
9
|
-
import { getOptionalServerAuthIdentity } from '
|
|
8
|
+
import { anonymousAggregateService } from '@core/aggregate/anonymous.aggregate.service';
|
|
9
|
+
import { getOptionalServerAuthIdentity } from '@core/auth/auth-utils';
|
|
10
10
|
import type { XCredit, XSubscription, XUser } from '@windrun-huaiin/third-ui/fingerprint';
|
|
11
11
|
import { extractFingerprintFromNextRequest } from '@windrun-huaiin/third-ui/fingerprint/server';
|
|
12
12
|
import { NextRequest, NextResponse } from 'next/server';
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
mapSubscriptionToXSubscription,
|
|
18
18
|
mapUserToXUser,
|
|
19
19
|
type UserContextEntities,
|
|
20
|
-
} from '
|
|
21
|
-
import { finalizeUserContext } from '
|
|
20
|
+
} from '@core/context/user-context-service';
|
|
21
|
+
import { finalizeUserContext } from '@core/context/user-context-finalizer';
|
|
22
22
|
|
|
23
|
-
import type { Prisma } from '
|
|
23
|
+
import type { Prisma } from '@core/db/prisma-model-type';
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
// ==================== 类型定义 ====================
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
return this.toString();
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
import { userAggregateService } from '
|
|
8
|
-
import { UserStatus } from '
|
|
9
|
-
import { Apilogger, userService } from '
|
|
7
|
+
import { userAggregateService } from '@core/aggregate/user.aggregate.service';
|
|
8
|
+
import { UserStatus } from '@core/db/constants';
|
|
9
|
+
import { Apilogger, userService } from '@core/db/index';
|
|
10
10
|
import { headers } from 'next/headers';
|
|
11
11
|
import { NextRequest, NextResponse } from 'next/server';
|
|
12
12
|
import { Webhook } from 'svix';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
import { headers } from 'next/headers';
|
|
3
|
-
import { validateStripeWebhook } from '
|
|
3
|
+
import { validateStripeWebhook } from '@core/lib/stripe-config';
|
|
4
4
|
import Stripe from 'stripe';
|
|
5
|
-
import { Apilogger } from '
|
|
6
|
-
import { handleStripeEvent } from '
|
|
5
|
+
import { Apilogger } from '@core/db/apilog.service';
|
|
6
|
+
import { handleStripeEvent } from '@core/stripe/webhook-handler';
|
|
7
7
|
|
|
8
8
|
// Disable body parsing, need raw body for signature verification
|
|
9
9
|
export const runtime = 'nodejs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../lib/fingerprint-config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../lib/money-price-config';
|
|
@@ -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
|