@windrun-huaiin/backend-core 28.0.0 → 29.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/stripe/checkout/route.js +0 -1
- package/dist/app/api/stripe/checkout/route.mjs +0 -1
- package/dist/app/api/stripe/customer-portal/route.js +0 -1
- package/dist/app/api/stripe/customer-portal/route.mjs +0 -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 +0 -1
- package/dist/app/api/webhook/clerk/user/route.mjs +0 -1
- package/dist/auth/auth-utils.js +0 -1
- package/dist/auth/auth-utils.mjs +0 -1
- 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 +0 -3
- package/dist/index.mjs +0 -3
- 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 +116 -0
- package/dist/lib/credit-overview.mjs +114 -0
- package/dist/lib/stripe-config.js +0 -1
- package/dist/lib/stripe-config.mjs +0 -1
- package/dist/prisma/index.d.ts +2 -2
- package/dist/prisma/index.d.ts.map +1 -1
- package/dist/prisma/index.js +0 -3
- package/dist/prisma/index.mjs +0 -3
- 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.d.ts +6 -6
- package/dist/prisma/prisma.d.ts.map +1 -1
- package/dist/prisma/prisma.js +4 -37
- package/dist/prisma/prisma.mjs +4 -37
- package/dist/services/aggregate/anonymous.aggregate.service.d.ts +2 -3
- package/dist/services/aggregate/anonymous.aggregate.service.d.ts.map +1 -1
- package/dist/services/aggregate/anonymous.aggregate.service.js +2 -8
- package/dist/services/aggregate/anonymous.aggregate.service.mjs +2 -8
- package/dist/services/aggregate/billing.aggregate.service.js +0 -1
- package/dist/services/aggregate/billing.aggregate.service.mjs +0 -1
- package/dist/services/aggregate/user.aggregate.service.d.ts +3 -3
- package/dist/services/aggregate/user.aggregate.service.d.ts.map +1 -1
- package/dist/services/aggregate/user.aggregate.service.js +0 -1
- package/dist/services/aggregate/user.aggregate.service.mjs +0 -1
- package/dist/services/context/user-context-service.js +0 -1
- package/dist/services/context/user-context-service.mjs +0 -1
- package/dist/services/database/apilog.service.js +0 -1
- package/dist/services/database/apilog.service.mjs +0 -1
- package/dist/services/database/core-entities.d.ts +123 -0
- package/dist/services/database/core-entities.d.ts.map +1 -0
- package/dist/services/database/credit.service.d.ts +1 -1
- package/dist/services/database/credit.service.d.ts.map +1 -1
- package/dist/services/database/credit.service.js +3 -8
- package/dist/services/database/credit.service.mjs +3 -8
- package/dist/services/database/creditAuditLog.service.d.ts +1 -1
- package/dist/services/database/creditAuditLog.service.d.ts.map +1 -1
- package/dist/services/database/creditAuditLog.service.js +6 -6
- package/dist/services/database/creditAuditLog.service.mjs +6 -6
- package/dist/services/database/prisma-model-type.d.ts +28 -2
- package/dist/services/database/prisma-model-type.d.ts.map +1 -1
- package/dist/services/database/subscription.service.js +1 -2
- package/dist/services/database/subscription.service.mjs +1 -2
- package/dist/services/database/transaction.service.d.ts +1 -1
- package/dist/services/database/transaction.service.d.ts.map +1 -1
- package/dist/services/database/transaction.service.js +14 -19
- package/dist/services/database/transaction.service.mjs +14 -19
- package/dist/services/database/user.service.d.ts +13 -4
- package/dist/services/database/user.service.d.ts.map +1 -1
- package/dist/services/database/user.service.js +5 -3
- package/dist/services/database/user.service.mjs +5 -3
- package/dist/services/database/userBackup.service.js +0 -1
- package/dist/services/database/userBackup.service.mjs +0 -1
- package/dist/services/stripe/webhook-handler.js +0 -1
- package/dist/services/stripe/webhook-handler.mjs +0 -1
- package/package.json +18 -15
- package/src/app/api/user/anonymous/init/route.ts +2 -2
- package/src/app/api/user/credit-overview/route.ts +43 -0
- package/src/app/api/user/pricing-context/route.ts +14 -0
- package/src/credit/server.ts +1 -0
- package/src/lib/credit-overview.ts +153 -0
- package/src/prisma/index.ts +6 -2
- package/src/prisma/prisma-transaction-util.ts +1 -1
- package/src/prisma/prisma.ts +14 -47
- package/src/services/aggregate/anonymous.aggregate.service.ts +7 -9
- package/src/services/aggregate/user.aggregate.service.ts +3 -3
- package/src/services/database/core-entities.ts +128 -0
- package/src/services/database/credit.service.ts +7 -8
- package/src/services/database/creditAuditLog.service.ts +11 -9
- package/src/services/database/prisma-model-type.ts +33 -4
- package/src/services/database/subscription.service.ts +2 -2
- package/src/services/database/transaction.service.ts +22 -23
- package/src/services/database/user.service.ts +23 -6
- package/dist/core-prisma/browser.d.ts +0 -40
- package/dist/core-prisma/browser.d.ts.map +0 -1
- package/dist/core-prisma/client.d.ts +0 -57
- package/dist/core-prisma/client.d.ts.map +0 -1
- package/dist/core-prisma/client.js +0 -55
- package/dist/core-prisma/client.mjs +0 -33
- package/dist/core-prisma/commonInputTypes.d.ts +0 -495
- package/dist/core-prisma/commonInputTypes.d.ts.map +0 -1
- package/dist/core-prisma/enums.d.ts +0 -2
- package/dist/core-prisma/enums.d.ts.map +0 -1
- package/dist/core-prisma/internal/class.d.ts +0 -193
- package/dist/core-prisma/internal/class.d.ts.map +0 -1
- package/dist/core-prisma/internal/class.js +0 -108
- package/dist/core-prisma/internal/class.mjs +0 -87
- package/dist/core-prisma/internal/prismaNamespace.d.ts +0 -1180
- package/dist/core-prisma/internal/prismaNamespace.d.ts.map +0 -1
- package/dist/core-prisma/internal/prismaNamespace.js +0 -278
- package/dist/core-prisma/internal/prismaNamespace.mjs +0 -226
- package/dist/core-prisma/internal/prismaNamespaceBrowser.d.ts +0 -233
- package/dist/core-prisma/internal/prismaNamespaceBrowser.d.ts.map +0 -1
- package/dist/core-prisma/models/Apilog.d.ts +0 -1088
- package/dist/core-prisma/models/Apilog.d.ts.map +0 -1
- package/dist/core-prisma/models/Credit.d.ts +0 -1554
- package/dist/core-prisma/models/Credit.d.ts.map +0 -1
- package/dist/core-prisma/models/CreditAuditLog.d.ts +0 -1362
- package/dist/core-prisma/models/CreditAuditLog.d.ts.map +0 -1
- package/dist/core-prisma/models/Subscription.d.ts +0 -1441
- package/dist/core-prisma/models/Subscription.d.ts.map +0 -1
- package/dist/core-prisma/models/Transaction.d.ts +0 -2222
- package/dist/core-prisma/models/Transaction.d.ts.map +0 -1
- package/dist/core-prisma/models/User.d.ts +0 -1775
- package/dist/core-prisma/models/User.d.ts.map +0 -1
- package/dist/core-prisma/models/UserBackup.d.ts +0 -1228
- package/dist/core-prisma/models/UserBackup.d.ts.map +0 -1
- package/dist/core-prisma/models.d.ts +0 -9
- package/dist/core-prisma/models.d.ts.map +0 -1
- package/migrations/create.sql +0 -176
- package/migrations/init-schema.sql +0 -20
- package/prisma/schema.prisma +0 -193
- package/src/core-prisma/browser.ts +0 -54
- package/src/core-prisma/client.ts +0 -78
- package/src/core-prisma/commonInputTypes.ts +0 -565
- package/src/core-prisma/enums.ts +0 -15
- package/src/core-prisma/internal/class.ts +0 -293
- package/src/core-prisma/internal/prismaNamespace.ts +0 -1419
- package/src/core-prisma/internal/prismaNamespaceBrowser.ts +0 -259
- package/src/core-prisma/models/Apilog.ts +0 -1244
- package/src/core-prisma/models/Credit.ts +0 -1722
- package/src/core-prisma/models/CreditAuditLog.ts +0 -1536
- package/src/core-prisma/models/Subscription.ts +0 -1610
- package/src/core-prisma/models/Transaction.ts +0 -2398
- package/src/core-prisma/models/User.ts +0 -1982
- package/src/core-prisma/models/UserBackup.ts +0 -1384
- package/src/core-prisma/models.ts +0 -18
|
@@ -6,7 +6,6 @@ var zod = require('zod');
|
|
|
6
6
|
var stripeConfig = require('../../../../lib/stripe-config.js');
|
|
7
7
|
var constants = require('../../../../services/database/constants.js');
|
|
8
8
|
require('../../../../prisma/prisma.js');
|
|
9
|
-
require('../../../../core-prisma/client.js');
|
|
10
9
|
require('../../../../services/database/credit.service.js');
|
|
11
10
|
var transaction_service = require('../../../../services/database/transaction.service.js');
|
|
12
11
|
var authUtils = require('../../../../auth/auth-utils.js');
|
|
@@ -4,7 +4,6 @@ import { z } from 'zod';
|
|
|
4
4
|
import { createOrGetCustomer, createCheckoutSession, ActiveSubscriptionExistsError } from '../../../../lib/stripe-config.mjs';
|
|
5
5
|
import { TransactionType, PaySupplier, PaymentStatus, OrderStatus } from '../../../../services/database/constants.mjs';
|
|
6
6
|
import '../../../../prisma/prisma.mjs';
|
|
7
|
-
import '../../../../core-prisma/client.mjs';
|
|
8
7
|
import '../../../../services/database/credit.service.mjs';
|
|
9
8
|
import { transactionService } from '../../../../services/database/transaction.service.mjs';
|
|
10
9
|
import { ApiAuthUtils } from '../../../../auth/auth-utils.mjs';
|
|
@@ -6,7 +6,6 @@ var zod = require('zod');
|
|
|
6
6
|
var stripeConfig = require('../../../../lib/stripe-config.js');
|
|
7
7
|
var authUtils = require('../../../../auth/auth-utils.js');
|
|
8
8
|
require('../../../../prisma/prisma.js');
|
|
9
|
-
require('../../../../core-prisma/client.js');
|
|
10
9
|
var subscription_service = require('../../../../services/database/subscription.service.js');
|
|
11
10
|
require('../../../../services/database/credit.service.js');
|
|
12
11
|
|
|
@@ -4,7 +4,6 @@ import { z } from 'zod';
|
|
|
4
4
|
import { createOrGetCustomer, createCustomerPortalSession } from '../../../../lib/stripe-config.mjs';
|
|
5
5
|
import { ApiAuthUtils } from '../../../../auth/auth-utils.mjs';
|
|
6
6
|
import '../../../../prisma/prisma.mjs';
|
|
7
|
-
import '../../../../core-prisma/client.mjs';
|
|
8
7
|
import { subscriptionService } from '../../../../services/database/subscription.service.mjs';
|
|
9
8
|
import '../../../../services/database/credit.service.mjs';
|
|
10
9
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CreditOverviewTranslations } from '@windrun-huaiin/third-ui/main/credit';
|
|
2
|
+
import { NextResponse } from 'next/server';
|
|
3
|
+
export type CreditOverviewTranslationsResolver = (locale: string) => CreditOverviewTranslations | Promise<CreditOverviewTranslations>;
|
|
4
|
+
export interface CreateGETOptions {
|
|
5
|
+
defaultLocale?: string;
|
|
6
|
+
localePrefixAsNeeded?: boolean;
|
|
7
|
+
resolveTranslations: CreditOverviewTranslationsResolver;
|
|
8
|
+
pricingPath?: string;
|
|
9
|
+
checkoutApiEndpoint?: string;
|
|
10
|
+
customerPortalApiEndpoint?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function createGET(options: CreateGETOptions): (request: Request) => Promise<NextResponse<import("@core/lib/credit-overview").CreditOverviewPayload | null>>;
|
|
13
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/user/credit-overview/route.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,MAAM,kCAAkC,GAAG,CAC/C,MAAM,EAAE,MAAM,KACX,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,EAAE,kCAAkC,CAAC;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,IACvB,SAAS,OAAO,6FAiB3C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var server = require('next/server');
|
|
5
|
+
var creditOverview = require('../../../../lib/credit-overview.js');
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
// Fix BigInt serialization issue
|
|
9
|
+
BigInt.prototype.toJSON = function () {
|
|
10
|
+
return this.toString();
|
|
11
|
+
};
|
|
12
|
+
function createGET(options) {
|
|
13
|
+
return function GET(request) {
|
|
14
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const { searchParams } = new URL(request.url);
|
|
16
|
+
const locale = searchParams.get('locale') || options.defaultLocale || 'en';
|
|
17
|
+
const translations = yield options.resolveTranslations(locale);
|
|
18
|
+
const payload = yield creditOverview.buildCreditOverviewPayload({
|
|
19
|
+
locale,
|
|
20
|
+
defaultLocale: options.defaultLocale,
|
|
21
|
+
localePrefixAsNeeded: options.localePrefixAsNeeded,
|
|
22
|
+
translations,
|
|
23
|
+
pricingPath: options.pricingPath,
|
|
24
|
+
checkoutApiEndpoint: options.checkoutApiEndpoint,
|
|
25
|
+
customerPortalApiEndpoint: options.customerPortalApiEndpoint,
|
|
26
|
+
});
|
|
27
|
+
return server.NextResponse.json(payload);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.createGET = createGET;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import { NextResponse } from 'next/server';
|
|
3
|
+
import { buildCreditOverviewPayload } from '../../../../lib/credit-overview.mjs';
|
|
4
|
+
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
// Fix BigInt serialization issue
|
|
7
|
+
BigInt.prototype.toJSON = function () {
|
|
8
|
+
return this.toString();
|
|
9
|
+
};
|
|
10
|
+
function createGET(options) {
|
|
11
|
+
return function GET(request) {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const { searchParams } = new URL(request.url);
|
|
14
|
+
const locale = searchParams.get('locale') || options.defaultLocale || 'en';
|
|
15
|
+
const translations = yield options.resolveTranslations(locale);
|
|
16
|
+
const payload = yield buildCreditOverviewPayload({
|
|
17
|
+
locale,
|
|
18
|
+
defaultLocale: options.defaultLocale,
|
|
19
|
+
localePrefixAsNeeded: options.localePrefixAsNeeded,
|
|
20
|
+
translations,
|
|
21
|
+
pricingPath: options.pricingPath,
|
|
22
|
+
checkoutApiEndpoint: options.checkoutApiEndpoint,
|
|
23
|
+
customerPortalApiEndpoint: options.customerPortalApiEndpoint,
|
|
24
|
+
});
|
|
25
|
+
return NextResponse.json(payload);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { createGET };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/user/pricing-context/route.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,wBAAsB,GAAG,0FAGxB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var moneyPriceHelper = require('../../../../lib/money-price-helper.js');
|
|
5
|
+
var server = require('next/server');
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
// Fix BigInt serialization issue
|
|
9
|
+
BigInt.prototype.toJSON = function () {
|
|
10
|
+
return this.toString();
|
|
11
|
+
};
|
|
12
|
+
function GET() {
|
|
13
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const initUserContext = yield moneyPriceHelper.getMoneyPriceInitUserContext();
|
|
15
|
+
return server.NextResponse.json(initUserContext);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.GET = GET;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import { getMoneyPriceInitUserContext } from '../../../../lib/money-price-helper.mjs';
|
|
3
|
+
import { NextResponse } from 'next/server';
|
|
4
|
+
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
// Fix BigInt serialization issue
|
|
7
|
+
BigInt.prototype.toJSON = function () {
|
|
8
|
+
return this.toString();
|
|
9
|
+
};
|
|
10
|
+
function GET() {
|
|
11
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
const initUserContext = yield getMoneyPriceInitUserContext();
|
|
13
|
+
return NextResponse.json(initUserContext);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { GET };
|
|
@@ -5,7 +5,6 @@ var user_aggregate_service = require('../../../../../services/aggregate/user.agg
|
|
|
5
5
|
var constants = require('../../../../../services/database/constants.js');
|
|
6
6
|
var user_service = require('../../../../../services/database/user.service.js');
|
|
7
7
|
require('../../../../../prisma/prisma.js');
|
|
8
|
-
require('../../../../../core-prisma/client.js');
|
|
9
8
|
require('../../../../../services/database/credit.service.js');
|
|
10
9
|
var apilog_service = require('../../../../../services/database/apilog.service.js');
|
|
11
10
|
var headers = require('next/headers');
|
|
@@ -3,7 +3,6 @@ import { userAggregateService } from '../../../../../services/aggregate/user.agg
|
|
|
3
3
|
import { UserStatus } from '../../../../../services/database/constants.mjs';
|
|
4
4
|
import { userService } from '../../../../../services/database/user.service.mjs';
|
|
5
5
|
import '../../../../../prisma/prisma.mjs';
|
|
6
|
-
import '../../../../../core-prisma/client.mjs';
|
|
7
6
|
import '../../../../../services/database/credit.service.mjs';
|
|
8
7
|
import { Apilogger } from '../../../../../services/database/apilog.service.mjs';
|
|
9
8
|
import { headers } from 'next/headers';
|
package/dist/auth/auth-utils.js
CHANGED
|
@@ -4,7 +4,6 @@ var tslib = require('tslib');
|
|
|
4
4
|
var server = require('@clerk/nextjs/server');
|
|
5
5
|
var user_service = require('../services/database/user.service.js');
|
|
6
6
|
require('../prisma/prisma.js');
|
|
7
|
-
require('../core-prisma/client.js');
|
|
8
7
|
require('../services/database/credit.service.js');
|
|
9
8
|
var authShared = require('./auth-shared.js');
|
|
10
9
|
|
package/dist/auth/auth-utils.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { __awaiter } from 'tslib';
|
|
|
2
2
|
import { auth } from '@clerk/nextjs/server';
|
|
3
3
|
import { userService } from '../services/database/user.service.mjs';
|
|
4
4
|
import '../prisma/prisma.mjs';
|
|
5
|
-
import '../core-prisma/client.mjs';
|
|
6
5
|
import '../services/database/credit.service.mjs';
|
|
7
6
|
import { AUTH_HEADERS, AUTH_ERRORS } from './auth-shared.mjs';
|
|
8
7
|
|
package/dist/credit/server.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/credit/server.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/credit/server.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
package/dist/credit/server.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var creditInit = require('../lib/credit-init.js');
|
|
4
|
+
var creditOverview = require('../lib/credit-overview.js');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
@@ -9,3 +10,4 @@ exports.freeAmount = creditInit.freeAmount;
|
|
|
9
10
|
exports.freeExpiredDays = creditInit.freeExpiredDays;
|
|
10
11
|
exports.freeRegisterAmount = creditInit.freeRegisterAmount;
|
|
11
12
|
exports.oneTimeExpiredDays = creditInit.oneTimeExpiredDays;
|
|
13
|
+
exports.buildCreditOverviewPayload = creditOverview.buildCreditOverviewPayload;
|
package/dist/credit/server.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var prisma = require('./prisma/prisma.js');
|
|
4
4
|
var prismaTransactionUtil = require('./prisma/prisma-transaction-util.js');
|
|
5
|
-
require('./core-prisma/client.js');
|
|
6
5
|
var user_service = require('./services/database/user.service.js');
|
|
7
6
|
var subscription_service = require('./services/database/subscription.service.js');
|
|
8
7
|
var credit_service = require('./services/database/credit.service.js');
|
|
@@ -24,7 +23,6 @@ var messageBuilder = require('./services/ai/message-builder.js');
|
|
|
24
23
|
var mock = require('./services/ai/mock.js');
|
|
25
24
|
var openrouterClient = require('./services/ai/openrouter-client.js');
|
|
26
25
|
var route = require('./services/ai/route.js');
|
|
27
|
-
var prismaNamespace = require('./core-prisma/internal/prismaNamespace.js');
|
|
28
26
|
|
|
29
27
|
|
|
30
28
|
|
|
@@ -89,4 +87,3 @@ exports.createOpenRouterRoute = route.createOpenRouterRoute;
|
|
|
89
87
|
exports.dynamic = route.dynamic;
|
|
90
88
|
exports.revalidate = route.revalidate;
|
|
91
89
|
exports.runtime = route.runtime;
|
|
92
|
-
exports.Prisma = prismaNamespace;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { checkAndFallbackWithNonTCClient, configureBackendCorePrisma, createPrismaClient, getBackendCorePrisma, prisma } from './prisma/prisma.mjs';
|
|
2
2
|
export { runInTransaction } from './prisma/prisma-transaction-util.mjs';
|
|
3
|
-
import './core-prisma/client.mjs';
|
|
4
3
|
export { userService } from './services/database/user.service.mjs';
|
|
5
4
|
export { subscriptionService } from './services/database/subscription.service.mjs';
|
|
6
5
|
export { creditService } from './services/database/credit.service.mjs';
|
|
@@ -22,5 +21,3 @@ export { buildModelMessages } from './services/ai/message-builder.mjs';
|
|
|
22
21
|
export { createConfigurableMockHandler, createErrorMockResponse, createScenarioMockHandler, createSimpleMockHandler, getMockScenario } from './services/ai/mock.mjs';
|
|
23
22
|
export { callOpenRouterStream, guardedOpenRouterStreamStart } from './services/ai/openrouter-client.mjs';
|
|
24
23
|
export { createOpenRouterRoute, dynamic, revalidate, runtime } from './services/ai/route.mjs';
|
|
25
|
-
import * as prismaNamespace from './core-prisma/internal/prismaNamespace.mjs';
|
|
26
|
-
export { prismaNamespace as Prisma };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CreditOverviewData, CreditOverviewTranslations } from '@windrun-huaiin/third-ui/main/credit';
|
|
2
|
+
export interface BuildCreditOverviewPayloadOptions {
|
|
3
|
+
locale: string;
|
|
4
|
+
defaultLocale?: string;
|
|
5
|
+
localePrefixAsNeeded?: boolean;
|
|
6
|
+
translations: CreditOverviewTranslations;
|
|
7
|
+
pricingPath?: string;
|
|
8
|
+
checkoutApiEndpoint?: string;
|
|
9
|
+
customerPortalApiEndpoint?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CreditOverviewPayload {
|
|
12
|
+
data: CreditOverviewData;
|
|
13
|
+
totalLabel: string;
|
|
14
|
+
translations: CreditOverviewTranslations;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildCreditOverviewPayload(options: BuildCreditOverviewPayloadOptions): Promise<CreditOverviewPayload | null>;
|
|
17
|
+
//# sourceMappingURL=credit-overview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-overview.d.ts","sourceRoot":"","sources":["../../src/lib/credit-overview.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAE3G,MAAM,WAAW,iCAAiC;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,EAAE,0BAA0B,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,0BAA0B,CAAC;CAC1C;AAED,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAuHvC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var authUtils = require('../auth/auth-utils.js');
|
|
5
|
+
var moneyPriceConfig = require('./money-price-config.js');
|
|
6
|
+
require('../prisma/prisma.js');
|
|
7
|
+
var subscription_service = require('../services/database/subscription.service.js');
|
|
8
|
+
var credit_service = require('../services/database/credit.service.js');
|
|
9
|
+
var userContextService = require('../services/context/user-context-service.js');
|
|
10
|
+
var utils = require('@windrun-huaiin/lib/utils');
|
|
11
|
+
var server = require('@windrun-huaiin/third-ui/main/money-price/server');
|
|
12
|
+
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
|
+
// Fix BigInt serialization issue
|
|
15
|
+
BigInt.prototype.toJSON = function () {
|
|
16
|
+
return this.toString();
|
|
17
|
+
};
|
|
18
|
+
function buildCreditOverviewPayload(options) {
|
|
19
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
var _a, _b, _c, _d;
|
|
21
|
+
const authUser = yield authUtils.getOptionalServerAuthUser();
|
|
22
|
+
if (!authUser) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const { locale, defaultLocale = 'en', localePrefixAsNeeded = true, translations, pricingPath = '/pricing', checkoutApiEndpoint = '/api/stripe/checkout', customerPortalApiEndpoint = '/api/stripe/customer-portal', } = options;
|
|
26
|
+
const { user } = authUser;
|
|
27
|
+
const enableSubscriptionUpgrade = process.env.ENABLE_STRIPE_SUBSCRIPTION_UPGRADE !== 'false';
|
|
28
|
+
const [credit, subscription, moneyPriceData] = yield Promise.all([
|
|
29
|
+
credit_service.creditService.getCredit(user.userId),
|
|
30
|
+
subscription_service.subscriptionService.getActiveSubscription(user.userId),
|
|
31
|
+
server.buildMoneyPriceData({
|
|
32
|
+
locale,
|
|
33
|
+
currency: moneyPriceConfig.moneyPriceConfig.display.currency,
|
|
34
|
+
enabledBillingTypes: ['monthly', 'yearly', 'onetime'],
|
|
35
|
+
}),
|
|
36
|
+
]);
|
|
37
|
+
if (!credit) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const initUserContext = userContextService.buildInitUserContextFromEntities({
|
|
41
|
+
user,
|
|
42
|
+
credit,
|
|
43
|
+
subscription,
|
|
44
|
+
});
|
|
45
|
+
const totalBalance = ((_a = credit.balanceFree) !== null && _a !== void 0 ? _a : 0) +
|
|
46
|
+
((_b = credit.balancePaid) !== null && _b !== void 0 ? _b : 0) +
|
|
47
|
+
((_c = credit.balanceOneTimePaid) !== null && _c !== void 0 ? _c : 0);
|
|
48
|
+
const buckets = [
|
|
49
|
+
...(credit.balancePaid > 0
|
|
50
|
+
? [{
|
|
51
|
+
kind: 'subscription',
|
|
52
|
+
balance: credit.balancePaid,
|
|
53
|
+
limit: credit.totalPaidLimit,
|
|
54
|
+
expiresAt: utils.viewLocalTime(credit.paidEnd),
|
|
55
|
+
}]
|
|
56
|
+
: []),
|
|
57
|
+
...(credit.balanceOneTimePaid > 0
|
|
58
|
+
? [{
|
|
59
|
+
kind: 'onetime',
|
|
60
|
+
balance: credit.balanceOneTimePaid,
|
|
61
|
+
limit: credit.totalOneTimePaidLimit,
|
|
62
|
+
expiresAt: utils.viewLocalTime(credit.oneTimePaidEnd),
|
|
63
|
+
}]
|
|
64
|
+
: []),
|
|
65
|
+
...(credit.balanceFree > 0
|
|
66
|
+
? [{
|
|
67
|
+
kind: 'free',
|
|
68
|
+
balance: credit.balanceFree,
|
|
69
|
+
limit: credit.totalFreeLimit,
|
|
70
|
+
expiresAt: utils.viewLocalTime(credit.freeEnd),
|
|
71
|
+
}]
|
|
72
|
+
: []),
|
|
73
|
+
];
|
|
74
|
+
const pricingPageBaseUrl = utils.getAsNeededLocalizedUrl(locale, pricingPath, localePrefixAsNeeded, defaultLocale);
|
|
75
|
+
const data = {
|
|
76
|
+
totalBalance,
|
|
77
|
+
buckets,
|
|
78
|
+
pricingContext: {
|
|
79
|
+
moneyPriceData,
|
|
80
|
+
moneyPriceConfig: moneyPriceConfig.moneyPriceConfig,
|
|
81
|
+
checkoutApiEndpoint,
|
|
82
|
+
customerPortalApiEndpoint,
|
|
83
|
+
enableSubscriptionUpgrade,
|
|
84
|
+
initUserContext,
|
|
85
|
+
},
|
|
86
|
+
ctaBehaviors: {
|
|
87
|
+
subscribe: {
|
|
88
|
+
desktop: { kind: 'modal', mode: 'subscription' },
|
|
89
|
+
mobile: { kind: 'redirect', url: `${pricingPageBaseUrl}?initialBillingType=subscription` },
|
|
90
|
+
},
|
|
91
|
+
manage: {
|
|
92
|
+
desktop: { kind: 'auth' },
|
|
93
|
+
mobile: { kind: 'auth' },
|
|
94
|
+
},
|
|
95
|
+
onetime: {
|
|
96
|
+
desktop: { kind: 'modal', mode: 'onetime' },
|
|
97
|
+
mobile: { kind: 'redirect', url: `${pricingPageBaseUrl}?initialBillingType=onetime` },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
if (subscription) {
|
|
102
|
+
data.subscription = {
|
|
103
|
+
planName: (_d = subscription.priceName) !== null && _d !== void 0 ? _d : '',
|
|
104
|
+
periodStart: utils.viewLocalTime(subscription.subPeriodStart),
|
|
105
|
+
periodEnd: utils.viewLocalTime(subscription.subPeriodEnd),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
data,
|
|
110
|
+
totalLabel: translations.totalLabel,
|
|
111
|
+
translations,
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
exports.buildCreditOverviewPayload = buildCreditOverviewPayload;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import { getOptionalServerAuthUser } from '../auth/auth-utils.mjs';
|
|
3
|
+
import { moneyPriceConfig } from './money-price-config.mjs';
|
|
4
|
+
import '../prisma/prisma.mjs';
|
|
5
|
+
import { subscriptionService } from '../services/database/subscription.service.mjs';
|
|
6
|
+
import { creditService } from '../services/database/credit.service.mjs';
|
|
7
|
+
import { buildInitUserContextFromEntities } from '../services/context/user-context-service.mjs';
|
|
8
|
+
import { viewLocalTime, getAsNeededLocalizedUrl } from '@windrun-huaiin/lib/utils';
|
|
9
|
+
import { buildMoneyPriceData } from '@windrun-huaiin/third-ui/main/money-price/server';
|
|
10
|
+
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12
|
+
// Fix BigInt serialization issue
|
|
13
|
+
BigInt.prototype.toJSON = function () {
|
|
14
|
+
return this.toString();
|
|
15
|
+
};
|
|
16
|
+
function buildCreditOverviewPayload(options) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
const authUser = yield getOptionalServerAuthUser();
|
|
20
|
+
if (!authUser) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const { locale, defaultLocale = 'en', localePrefixAsNeeded = true, translations, pricingPath = '/pricing', checkoutApiEndpoint = '/api/stripe/checkout', customerPortalApiEndpoint = '/api/stripe/customer-portal', } = options;
|
|
24
|
+
const { user } = authUser;
|
|
25
|
+
const enableSubscriptionUpgrade = process.env.ENABLE_STRIPE_SUBSCRIPTION_UPGRADE !== 'false';
|
|
26
|
+
const [credit, subscription, moneyPriceData] = yield Promise.all([
|
|
27
|
+
creditService.getCredit(user.userId),
|
|
28
|
+
subscriptionService.getActiveSubscription(user.userId),
|
|
29
|
+
buildMoneyPriceData({
|
|
30
|
+
locale,
|
|
31
|
+
currency: moneyPriceConfig.display.currency,
|
|
32
|
+
enabledBillingTypes: ['monthly', 'yearly', 'onetime'],
|
|
33
|
+
}),
|
|
34
|
+
]);
|
|
35
|
+
if (!credit) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const initUserContext = buildInitUserContextFromEntities({
|
|
39
|
+
user,
|
|
40
|
+
credit,
|
|
41
|
+
subscription,
|
|
42
|
+
});
|
|
43
|
+
const totalBalance = ((_a = credit.balanceFree) !== null && _a !== void 0 ? _a : 0) +
|
|
44
|
+
((_b = credit.balancePaid) !== null && _b !== void 0 ? _b : 0) +
|
|
45
|
+
((_c = credit.balanceOneTimePaid) !== null && _c !== void 0 ? _c : 0);
|
|
46
|
+
const buckets = [
|
|
47
|
+
...(credit.balancePaid > 0
|
|
48
|
+
? [{
|
|
49
|
+
kind: 'subscription',
|
|
50
|
+
balance: credit.balancePaid,
|
|
51
|
+
limit: credit.totalPaidLimit,
|
|
52
|
+
expiresAt: viewLocalTime(credit.paidEnd),
|
|
53
|
+
}]
|
|
54
|
+
: []),
|
|
55
|
+
...(credit.balanceOneTimePaid > 0
|
|
56
|
+
? [{
|
|
57
|
+
kind: 'onetime',
|
|
58
|
+
balance: credit.balanceOneTimePaid,
|
|
59
|
+
limit: credit.totalOneTimePaidLimit,
|
|
60
|
+
expiresAt: viewLocalTime(credit.oneTimePaidEnd),
|
|
61
|
+
}]
|
|
62
|
+
: []),
|
|
63
|
+
...(credit.balanceFree > 0
|
|
64
|
+
? [{
|
|
65
|
+
kind: 'free',
|
|
66
|
+
balance: credit.balanceFree,
|
|
67
|
+
limit: credit.totalFreeLimit,
|
|
68
|
+
expiresAt: viewLocalTime(credit.freeEnd),
|
|
69
|
+
}]
|
|
70
|
+
: []),
|
|
71
|
+
];
|
|
72
|
+
const pricingPageBaseUrl = getAsNeededLocalizedUrl(locale, pricingPath, localePrefixAsNeeded, defaultLocale);
|
|
73
|
+
const data = {
|
|
74
|
+
totalBalance,
|
|
75
|
+
buckets,
|
|
76
|
+
pricingContext: {
|
|
77
|
+
moneyPriceData,
|
|
78
|
+
moneyPriceConfig,
|
|
79
|
+
checkoutApiEndpoint,
|
|
80
|
+
customerPortalApiEndpoint,
|
|
81
|
+
enableSubscriptionUpgrade,
|
|
82
|
+
initUserContext,
|
|
83
|
+
},
|
|
84
|
+
ctaBehaviors: {
|
|
85
|
+
subscribe: {
|
|
86
|
+
desktop: { kind: 'modal', mode: 'subscription' },
|
|
87
|
+
mobile: { kind: 'redirect', url: `${pricingPageBaseUrl}?initialBillingType=subscription` },
|
|
88
|
+
},
|
|
89
|
+
manage: {
|
|
90
|
+
desktop: { kind: 'auth' },
|
|
91
|
+
mobile: { kind: 'auth' },
|
|
92
|
+
},
|
|
93
|
+
onetime: {
|
|
94
|
+
desktop: { kind: 'modal', mode: 'onetime' },
|
|
95
|
+
mobile: { kind: 'redirect', url: `${pricingPageBaseUrl}?initialBillingType=onetime` },
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
if (subscription) {
|
|
100
|
+
data.subscription = {
|
|
101
|
+
planName: (_d = subscription.priceName) !== null && _d !== void 0 ? _d : '',
|
|
102
|
+
periodStart: viewLocalTime(subscription.subPeriodStart),
|
|
103
|
+
periodEnd: viewLocalTime(subscription.subPeriodEnd),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
data,
|
|
108
|
+
totalLabel: translations.totalLabel,
|
|
109
|
+
translations,
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { buildCreditOverviewPayload };
|
|
@@ -5,7 +5,6 @@ var Stripe = require('stripe');
|
|
|
5
5
|
var user_service = require('../services/database/user.service.js');
|
|
6
6
|
var subscription_service = require('../services/database/subscription.service.js');
|
|
7
7
|
require('../services/database/credit.service.js');
|
|
8
|
-
require('../core-prisma/client.js');
|
|
9
8
|
require('../prisma/prisma.js');
|
|
10
9
|
var apilog_service = require('../services/database/apilog.service.js');
|
|
11
10
|
|
|
@@ -3,7 +3,6 @@ import Stripe from 'stripe';
|
|
|
3
3
|
import { userService } from '../services/database/user.service.mjs';
|
|
4
4
|
import { subscriptionService } from '../services/database/subscription.service.mjs';
|
|
5
5
|
import '../services/database/credit.service.mjs';
|
|
6
|
-
import '../core-prisma/client.mjs';
|
|
7
6
|
import '../prisma/prisma.mjs';
|
|
8
7
|
import { Apilogger } from '../services/database/apilog.service.mjs';
|
|
9
8
|
|
package/dist/prisma/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { prisma, createPrismaClient, configureBackendCorePrisma, getBackendCorePrisma, checkAndFallbackWithNonTCClient, } from './prisma';
|
|
2
2
|
export type { BackendCorePrismaClient, BackendCoreHostPrismaClient } from './prisma';
|
|
3
3
|
export { runInTransaction } from './prisma-transaction-util';
|
|
4
|
-
export type { User, Subscription, Credit, CreditAuditLog, Transaction, Apilog, UserBackup, } from '../core-
|
|
5
|
-
export { Prisma } from '../
|
|
4
|
+
export type { User, Subscription, Credit, CreditAuditLog, Transaction, Apilog, UserBackup, CoreJsonArray, CoreJsonObject, CoreJsonPrimitive, CoreJsonValue, } from '../services/database/core-entities';
|
|
5
|
+
export type { Prisma } from '../services/database/prisma-model-type';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prisma/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,oBAAoB,EACpB,+BAA+B,GAChC,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,WAAW,EACX,MAAM,EACN,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prisma/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,oBAAoB,EACpB,+BAA+B,GAChC,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,WAAW,EACX,MAAM,EACN,UAAU,EACV,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC"}
|
package/dist/prisma/index.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var prisma = require('./prisma.js');
|
|
4
4
|
var prismaTransactionUtil = require('./prisma-transaction-util.js');
|
|
5
|
-
require('../core-prisma/client.js');
|
|
6
|
-
var prismaNamespace = require('../core-prisma/internal/prismaNamespace.js');
|
|
7
5
|
|
|
8
6
|
|
|
9
7
|
|
|
@@ -13,4 +11,3 @@ exports.createPrismaClient = prisma.createPrismaClient;
|
|
|
13
11
|
exports.getBackendCorePrisma = prisma.getBackendCorePrisma;
|
|
14
12
|
exports.prisma = prisma.prisma;
|
|
15
13
|
exports.runInTransaction = prismaTransactionUtil.runInTransaction;
|
|
16
|
-
exports.Prisma = prismaNamespace;
|
package/dist/prisma/index.mjs
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
export { checkAndFallbackWithNonTCClient, configureBackendCorePrisma, createPrismaClient, getBackendCorePrisma, prisma } from './prisma.mjs';
|
|
2
2
|
export { runInTransaction } from './prisma-transaction-util.mjs';
|
|
3
|
-
import '../core-prisma/client.mjs';
|
|
4
|
-
import * as prismaNamespace from '../core-prisma/internal/prismaNamespace.mjs';
|
|
5
|
-
export { prismaNamespace as Prisma };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Prisma } from '
|
|
1
|
+
import type { Prisma } from '@core/db/prisma-model-type';
|
|
2
2
|
export declare function runInTransaction<T>(fn: (tx: Prisma.TransactionClient) => Promise<T>, operationName?: string): Promise<T>;
|
|
3
3
|
//# sourceMappingURL=prisma-transaction-util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-transaction-util.d.ts","sourceRoot":"","sources":["../../src/prisma/prisma-transaction-util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"prisma-transaction-util.d.ts","sourceRoot":"","sources":["../../src/prisma/prisma-transaction-util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGzD,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,EAChD,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,CAAC,CAAC,CAgBZ"}
|
package/dist/prisma/prisma.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
3
|
-
export type BackendCorePrismaClient = AppPrismaClient;
|
|
1
|
+
import type { Prisma } from '@core/db/prisma-model-type';
|
|
2
|
+
export type BackendCorePrismaClient = BackendCoreHostPrismaClient;
|
|
4
3
|
export type BackendCoreHostPrismaClient = {
|
|
5
4
|
$transaction: any;
|
|
6
5
|
$on?: any;
|
|
7
6
|
$executeRaw: any;
|
|
7
|
+
$executeRawUnsafe?: any;
|
|
8
8
|
$queryRaw: any;
|
|
9
|
+
$queryRawUnsafe?: any;
|
|
9
10
|
user: any;
|
|
10
11
|
subscription: any;
|
|
11
12
|
credit: any;
|
|
@@ -14,10 +15,9 @@ export type BackendCoreHostPrismaClient = {
|
|
|
14
15
|
userBackup: any;
|
|
15
16
|
apilog: any;
|
|
16
17
|
};
|
|
17
|
-
export declare function createPrismaClient(
|
|
18
|
+
export declare function createPrismaClient(): never;
|
|
18
19
|
export declare function configureBackendCorePrisma(prismaClient: BackendCoreHostPrismaClient, instanceId?: string): BackendCoreHostPrismaClient;
|
|
19
20
|
export declare function getBackendCorePrisma(): BackendCorePrismaClient;
|
|
20
|
-
export declare const prisma:
|
|
21
|
+
export declare const prisma: BackendCoreHostPrismaClient;
|
|
21
22
|
export declare function checkAndFallbackWithNonTCClient(tx?: Prisma.TransactionClient): Prisma.TransactionClient | BackendCorePrismaClient;
|
|
22
|
-
export {};
|
|
23
23
|
//# sourceMappingURL=prisma.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/prisma/prisma.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/prisma/prisma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAClE,MAAM,MAAM,2BAA2B,GAAG;IAKxC,YAAY,EAAE,GAAG,CAAC;IAElB,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV,WAAW,EAAE,GAAG,CAAC;IAEjB,iBAAiB,CAAC,EAAE,GAAG,CAAC;IAExB,SAAS,EAAE,GAAG,CAAC;IAEf,eAAe,CAAC,EAAE,GAAG,CAAC;IAEtB,IAAI,EAAE,GAAG,CAAC;IAEV,YAAY,EAAE,GAAG,CAAC;IAElB,MAAM,EAAE,GAAG,CAAC;IAEZ,WAAW,EAAE,GAAG,CAAC;IAEjB,cAAc,EAAE,GAAG,CAAC;IAEpB,UAAU,EAAE,GAAG,CAAC;IAEhB,MAAM,EAAE,GAAG,CAAC;CACb,CAAC;AA2CF,wBAAgB,kBAAkB,IAAI,KAAK,CAI1C;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,2BAA2B,EACzC,UAAU,SAAmE,GAC5E,2BAA2B,CAK7B;AAED,wBAAgB,oBAAoB,IAAI,uBAAuB,CAQ9D;AAID,eAAO,MAAM,MAAM,6BAIjB,CAAC;AAuFH,wBAAgB,+BAA+B,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,GAAG,uBAAuB,CAEjI"}
|