@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.
Files changed (150) hide show
  1. package/dist/app/api/stripe/checkout/route.js +0 -1
  2. package/dist/app/api/stripe/checkout/route.mjs +0 -1
  3. package/dist/app/api/stripe/customer-portal/route.js +0 -1
  4. package/dist/app/api/stripe/customer-portal/route.mjs +0 -1
  5. package/dist/app/api/user/credit-overview/route.d.ts +13 -0
  6. package/dist/app/api/user/credit-overview/route.d.ts.map +1 -0
  7. package/dist/app/api/user/credit-overview/route.js +32 -0
  8. package/dist/app/api/user/credit-overview/route.mjs +30 -0
  9. package/dist/app/api/user/pricing-context/route.d.ts +3 -0
  10. package/dist/app/api/user/pricing-context/route.d.ts.map +1 -0
  11. package/dist/app/api/user/pricing-context/route.js +19 -0
  12. package/dist/app/api/user/pricing-context/route.mjs +17 -0
  13. package/dist/app/api/webhook/clerk/user/route.js +0 -1
  14. package/dist/app/api/webhook/clerk/user/route.mjs +0 -1
  15. package/dist/auth/auth-utils.js +0 -1
  16. package/dist/auth/auth-utils.mjs +0 -1
  17. package/dist/credit/server.d.ts +1 -0
  18. package/dist/credit/server.d.ts.map +1 -1
  19. package/dist/credit/server.js +2 -0
  20. package/dist/credit/server.mjs +1 -0
  21. package/dist/index.js +0 -3
  22. package/dist/index.mjs +0 -3
  23. package/dist/lib/credit-overview.d.ts +17 -0
  24. package/dist/lib/credit-overview.d.ts.map +1 -0
  25. package/dist/lib/credit-overview.js +116 -0
  26. package/dist/lib/credit-overview.mjs +114 -0
  27. package/dist/lib/stripe-config.js +0 -1
  28. package/dist/lib/stripe-config.mjs +0 -1
  29. package/dist/prisma/index.d.ts +2 -2
  30. package/dist/prisma/index.d.ts.map +1 -1
  31. package/dist/prisma/index.js +0 -3
  32. package/dist/prisma/index.mjs +0 -3
  33. package/dist/prisma/prisma-transaction-util.d.ts +1 -1
  34. package/dist/prisma/prisma-transaction-util.d.ts.map +1 -1
  35. package/dist/prisma/prisma.d.ts +6 -6
  36. package/dist/prisma/prisma.d.ts.map +1 -1
  37. package/dist/prisma/prisma.js +4 -37
  38. package/dist/prisma/prisma.mjs +4 -37
  39. package/dist/services/aggregate/anonymous.aggregate.service.d.ts +2 -3
  40. package/dist/services/aggregate/anonymous.aggregate.service.d.ts.map +1 -1
  41. package/dist/services/aggregate/anonymous.aggregate.service.js +2 -8
  42. package/dist/services/aggregate/anonymous.aggregate.service.mjs +2 -8
  43. package/dist/services/aggregate/billing.aggregate.service.js +0 -1
  44. package/dist/services/aggregate/billing.aggregate.service.mjs +0 -1
  45. package/dist/services/aggregate/user.aggregate.service.d.ts +3 -3
  46. package/dist/services/aggregate/user.aggregate.service.d.ts.map +1 -1
  47. package/dist/services/aggregate/user.aggregate.service.js +0 -1
  48. package/dist/services/aggregate/user.aggregate.service.mjs +0 -1
  49. package/dist/services/context/user-context-service.js +0 -1
  50. package/dist/services/context/user-context-service.mjs +0 -1
  51. package/dist/services/database/apilog.service.js +0 -1
  52. package/dist/services/database/apilog.service.mjs +0 -1
  53. package/dist/services/database/core-entities.d.ts +123 -0
  54. package/dist/services/database/core-entities.d.ts.map +1 -0
  55. package/dist/services/database/credit.service.d.ts +1 -1
  56. package/dist/services/database/credit.service.d.ts.map +1 -1
  57. package/dist/services/database/credit.service.js +3 -8
  58. package/dist/services/database/credit.service.mjs +3 -8
  59. package/dist/services/database/creditAuditLog.service.d.ts +1 -1
  60. package/dist/services/database/creditAuditLog.service.d.ts.map +1 -1
  61. package/dist/services/database/creditAuditLog.service.js +6 -6
  62. package/dist/services/database/creditAuditLog.service.mjs +6 -6
  63. package/dist/services/database/prisma-model-type.d.ts +28 -2
  64. package/dist/services/database/prisma-model-type.d.ts.map +1 -1
  65. package/dist/services/database/subscription.service.js +1 -2
  66. package/dist/services/database/subscription.service.mjs +1 -2
  67. package/dist/services/database/transaction.service.d.ts +1 -1
  68. package/dist/services/database/transaction.service.d.ts.map +1 -1
  69. package/dist/services/database/transaction.service.js +14 -19
  70. package/dist/services/database/transaction.service.mjs +14 -19
  71. package/dist/services/database/user.service.d.ts +13 -4
  72. package/dist/services/database/user.service.d.ts.map +1 -1
  73. package/dist/services/database/user.service.js +5 -3
  74. package/dist/services/database/user.service.mjs +5 -3
  75. package/dist/services/database/userBackup.service.js +0 -1
  76. package/dist/services/database/userBackup.service.mjs +0 -1
  77. package/dist/services/stripe/webhook-handler.js +0 -1
  78. package/dist/services/stripe/webhook-handler.mjs +0 -1
  79. package/package.json +18 -15
  80. package/src/app/api/user/anonymous/init/route.ts +2 -2
  81. package/src/app/api/user/credit-overview/route.ts +43 -0
  82. package/src/app/api/user/pricing-context/route.ts +14 -0
  83. package/src/credit/server.ts +1 -0
  84. package/src/lib/credit-overview.ts +153 -0
  85. package/src/prisma/index.ts +6 -2
  86. package/src/prisma/prisma-transaction-util.ts +1 -1
  87. package/src/prisma/prisma.ts +14 -47
  88. package/src/services/aggregate/anonymous.aggregate.service.ts +7 -9
  89. package/src/services/aggregate/user.aggregate.service.ts +3 -3
  90. package/src/services/database/core-entities.ts +128 -0
  91. package/src/services/database/credit.service.ts +7 -8
  92. package/src/services/database/creditAuditLog.service.ts +11 -9
  93. package/src/services/database/prisma-model-type.ts +33 -4
  94. package/src/services/database/subscription.service.ts +2 -2
  95. package/src/services/database/transaction.service.ts +22 -23
  96. package/src/services/database/user.service.ts +23 -6
  97. package/dist/core-prisma/browser.d.ts +0 -40
  98. package/dist/core-prisma/browser.d.ts.map +0 -1
  99. package/dist/core-prisma/client.d.ts +0 -57
  100. package/dist/core-prisma/client.d.ts.map +0 -1
  101. package/dist/core-prisma/client.js +0 -55
  102. package/dist/core-prisma/client.mjs +0 -33
  103. package/dist/core-prisma/commonInputTypes.d.ts +0 -495
  104. package/dist/core-prisma/commonInputTypes.d.ts.map +0 -1
  105. package/dist/core-prisma/enums.d.ts +0 -2
  106. package/dist/core-prisma/enums.d.ts.map +0 -1
  107. package/dist/core-prisma/internal/class.d.ts +0 -193
  108. package/dist/core-prisma/internal/class.d.ts.map +0 -1
  109. package/dist/core-prisma/internal/class.js +0 -108
  110. package/dist/core-prisma/internal/class.mjs +0 -87
  111. package/dist/core-prisma/internal/prismaNamespace.d.ts +0 -1180
  112. package/dist/core-prisma/internal/prismaNamespace.d.ts.map +0 -1
  113. package/dist/core-prisma/internal/prismaNamespace.js +0 -278
  114. package/dist/core-prisma/internal/prismaNamespace.mjs +0 -226
  115. package/dist/core-prisma/internal/prismaNamespaceBrowser.d.ts +0 -233
  116. package/dist/core-prisma/internal/prismaNamespaceBrowser.d.ts.map +0 -1
  117. package/dist/core-prisma/models/Apilog.d.ts +0 -1088
  118. package/dist/core-prisma/models/Apilog.d.ts.map +0 -1
  119. package/dist/core-prisma/models/Credit.d.ts +0 -1554
  120. package/dist/core-prisma/models/Credit.d.ts.map +0 -1
  121. package/dist/core-prisma/models/CreditAuditLog.d.ts +0 -1362
  122. package/dist/core-prisma/models/CreditAuditLog.d.ts.map +0 -1
  123. package/dist/core-prisma/models/Subscription.d.ts +0 -1441
  124. package/dist/core-prisma/models/Subscription.d.ts.map +0 -1
  125. package/dist/core-prisma/models/Transaction.d.ts +0 -2222
  126. package/dist/core-prisma/models/Transaction.d.ts.map +0 -1
  127. package/dist/core-prisma/models/User.d.ts +0 -1775
  128. package/dist/core-prisma/models/User.d.ts.map +0 -1
  129. package/dist/core-prisma/models/UserBackup.d.ts +0 -1228
  130. package/dist/core-prisma/models/UserBackup.d.ts.map +0 -1
  131. package/dist/core-prisma/models.d.ts +0 -9
  132. package/dist/core-prisma/models.d.ts.map +0 -1
  133. package/migrations/create.sql +0 -176
  134. package/migrations/init-schema.sql +0 -20
  135. package/prisma/schema.prisma +0 -193
  136. package/src/core-prisma/browser.ts +0 -54
  137. package/src/core-prisma/client.ts +0 -78
  138. package/src/core-prisma/commonInputTypes.ts +0 -565
  139. package/src/core-prisma/enums.ts +0 -15
  140. package/src/core-prisma/internal/class.ts +0 -293
  141. package/src/core-prisma/internal/prismaNamespace.ts +0 -1419
  142. package/src/core-prisma/internal/prismaNamespaceBrowser.ts +0 -259
  143. package/src/core-prisma/models/Apilog.ts +0 -1244
  144. package/src/core-prisma/models/Credit.ts +0 -1722
  145. package/src/core-prisma/models/CreditAuditLog.ts +0 -1536
  146. package/src/core-prisma/models/Subscription.ts +0 -1610
  147. package/src/core-prisma/models/Transaction.ts +0 -2398
  148. package/src/core-prisma/models/User.ts +0 -1982
  149. package/src/core-prisma/models/UserBackup.ts +0 -1384
  150. package/src/core-prisma/models.ts +0 -18
@@ -1,259 +0,0 @@
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
- * WARNING: This is an internal file that is subject to change!
8
- *
9
- * 🛑 Under no circumstances should you import this file directly! 🛑
10
- *
11
- * All exports from this file are wrapped under a `Prisma` namespace object in the browser.ts file.
12
- * While this enables partial backward compatibility, it is not part of the stable public API.
13
- *
14
- * If you are looking for your Models, Enums, and Input Types, please import them from the respective
15
- * model files in the `model` directory!
16
- */
17
-
18
- import * as runtime from "@prisma/client/runtime/index-browser"
19
-
20
- export type * from '../models'
21
- export type * from './prismaNamespace'
22
-
23
- export const Decimal = runtime.Decimal
24
-
25
-
26
- export const NullTypes = {
27
- DbNull: runtime.objectEnumValues.classes.DbNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.DbNull),
28
- JsonNull: runtime.objectEnumValues.classes.JsonNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.JsonNull),
29
- AnyNull: runtime.objectEnumValues.classes.AnyNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.AnyNull),
30
- }
31
- /**
32
- * Helper for filtering JSON entries that have `null` on the database (empty on the db)
33
- *
34
- * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
35
- */
36
- export const DbNull = runtime.objectEnumValues.instances.DbNull
37
- /**
38
- * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)
39
- *
40
- * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
41
- */
42
- export const JsonNull = runtime.objectEnumValues.instances.JsonNull
43
- /**
44
- * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`
45
- *
46
- * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
47
- */
48
- export const AnyNull = runtime.objectEnumValues.instances.AnyNull
49
-
50
-
51
- export const ModelName = {
52
- User: 'User',
53
- Subscription: 'Subscription',
54
- Credit: 'Credit',
55
- Transaction: 'Transaction',
56
- CreditAuditLog: 'CreditAuditLog',
57
- UserBackup: 'UserBackup',
58
- Apilog: 'Apilog'
59
- } as const
60
-
61
- export type ModelName = (typeof ModelName)[keyof typeof ModelName]
62
-
63
- /*
64
- * Enums
65
- */
66
-
67
- export const TransactionIsolationLevel = runtime.makeStrictEnum({
68
- ReadUncommitted: 'ReadUncommitted',
69
- ReadCommitted: 'ReadCommitted',
70
- RepeatableRead: 'RepeatableRead',
71
- Serializable: 'Serializable'
72
- } as const)
73
-
74
- export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]
75
-
76
-
77
- export const UserScalarFieldEnum = {
78
- id: 'id',
79
- userId: 'userId',
80
- status: 'status',
81
- fingerprintId: 'fingerprintId',
82
- clerkUserId: 'clerkUserId',
83
- stripeCusId: 'stripeCusId',
84
- email: 'email',
85
- userName: 'userName',
86
- createdAt: 'createdAt',
87
- updatedAt: 'updatedAt',
88
- sourceRef: 'sourceRef'
89
- } as const
90
-
91
- export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]
92
-
93
-
94
- export const SubscriptionScalarFieldEnum = {
95
- id: 'id',
96
- userId: 'userId',
97
- status: 'status',
98
- paySubscriptionId: 'paySubscriptionId',
99
- orderId: 'orderId',
100
- priceId: 'priceId',
101
- priceName: 'priceName',
102
- creditsAllocated: 'creditsAllocated',
103
- subPeriodStart: 'subPeriodStart',
104
- subPeriodEnd: 'subPeriodEnd',
105
- createdAt: 'createdAt',
106
- updatedAt: 'updatedAt',
107
- deleted: 'deleted'
108
- } as const
109
-
110
- export type SubscriptionScalarFieldEnum = (typeof SubscriptionScalarFieldEnum)[keyof typeof SubscriptionScalarFieldEnum]
111
-
112
-
113
- export const CreditScalarFieldEnum = {
114
- id: 'id',
115
- userId: 'userId',
116
- balanceFree: 'balanceFree',
117
- totalFreeLimit: 'totalFreeLimit',
118
- freeStart: 'freeStart',
119
- freeEnd: 'freeEnd',
120
- balancePaid: 'balancePaid',
121
- totalPaidLimit: 'totalPaidLimit',
122
- paidStart: 'paidStart',
123
- paidEnd: 'paidEnd',
124
- balanceOneTimePaid: 'balanceOneTimePaid',
125
- totalOneTimePaidLimit: 'totalOneTimePaidLimit',
126
- oneTimePaidStart: 'oneTimePaidStart',
127
- oneTimePaidEnd: 'oneTimePaidEnd',
128
- createdAt: 'createdAt',
129
- updatedAt: 'updatedAt'
130
- } as const
131
-
132
- export type CreditScalarFieldEnum = (typeof CreditScalarFieldEnum)[keyof typeof CreditScalarFieldEnum]
133
-
134
-
135
- export const TransactionScalarFieldEnum = {
136
- id: 'id',
137
- userId: 'userId',
138
- orderId: 'orderId',
139
- orderStatus: 'orderStatus',
140
- orderCreatedAt: 'orderCreatedAt',
141
- orderExpiredAt: 'orderExpiredAt',
142
- orderUpdatedAt: 'orderUpdatedAt',
143
- type: 'type',
144
- paySupplier: 'paySupplier',
145
- paySessionId: 'paySessionId',
146
- payTransactionId: 'payTransactionId',
147
- paySubscriptionId: 'paySubscriptionId',
148
- subPeriodStart: 'subPeriodStart',
149
- subPeriodEnd: 'subPeriodEnd',
150
- subLastTryCancelAt: 'subLastTryCancelAt',
151
- subPeriodCanceledAt: 'subPeriodCanceledAt',
152
- subCancellationDetail: 'subCancellationDetail',
153
- priceId: 'priceId',
154
- priceName: 'priceName',
155
- amount: 'amount',
156
- currency: 'currency',
157
- creditsGranted: 'creditsGranted',
158
- payInvoiceId: 'payInvoiceId',
159
- paymentStatus: 'paymentStatus',
160
- billingReason: 'billingReason',
161
- hostedInvoiceUrl: 'hostedInvoiceUrl',
162
- invoicePdf: 'invoicePdf',
163
- orderDetail: 'orderDetail',
164
- paidEmail: 'paidEmail',
165
- paidAt: 'paidAt',
166
- paidDetail: 'paidDetail',
167
- payUpdatedAt: 'payUpdatedAt',
168
- deleted: 'deleted'
169
- } as const
170
-
171
- export type TransactionScalarFieldEnum = (typeof TransactionScalarFieldEnum)[keyof typeof TransactionScalarFieldEnum]
172
-
173
-
174
- export const CreditAuditLogScalarFieldEnum = {
175
- id: 'id',
176
- userId: 'userId',
177
- creditsChange: 'creditsChange',
178
- feature: 'feature',
179
- creditType: 'creditType',
180
- operationType: 'operationType',
181
- operationReferId: 'operationReferId',
182
- createdAt: 'createdAt',
183
- deleted: 'deleted'
184
- } as const
185
-
186
- export type CreditAuditLogScalarFieldEnum = (typeof CreditAuditLogScalarFieldEnum)[keyof typeof CreditAuditLogScalarFieldEnum]
187
-
188
-
189
- export const UserBackupScalarFieldEnum = {
190
- id: 'id',
191
- originalUserId: 'originalUserId',
192
- status: 'status',
193
- fingerprintId: 'fingerprintId',
194
- clerkUserId: 'clerkUserId',
195
- stripeCusId: 'stripeCusId',
196
- email: 'email',
197
- userName: 'userName',
198
- backupData: 'backupData',
199
- deletedAt: 'deletedAt',
200
- createdAt: 'createdAt',
201
- deleted: 'deleted'
202
- } as const
203
-
204
- export type UserBackupScalarFieldEnum = (typeof UserBackupScalarFieldEnum)[keyof typeof UserBackupScalarFieldEnum]
205
-
206
-
207
- export const ApilogScalarFieldEnum = {
208
- id: 'id',
209
- apiType: 'apiType',
210
- methodName: 'methodName',
211
- summary: 'summary',
212
- request: 'request',
213
- response: 'response',
214
- createdAt: 'createdAt'
215
- } as const
216
-
217
- export type ApilogScalarFieldEnum = (typeof ApilogScalarFieldEnum)[keyof typeof ApilogScalarFieldEnum]
218
-
219
-
220
- export const SortOrder = {
221
- asc: 'asc',
222
- desc: 'desc'
223
- } as const
224
-
225
- export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]
226
-
227
-
228
- export const NullableJsonNullValueInput = {
229
- DbNull: DbNull,
230
- JsonNull: JsonNull
231
- } as const
232
-
233
- export type NullableJsonNullValueInput = (typeof NullableJsonNullValueInput)[keyof typeof NullableJsonNullValueInput]
234
-
235
-
236
- export const QueryMode = {
237
- default: 'default',
238
- insensitive: 'insensitive'
239
- } as const
240
-
241
- export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode]
242
-
243
-
244
- export const JsonNullValueFilter = {
245
- DbNull: DbNull,
246
- JsonNull: JsonNull,
247
- AnyNull: AnyNull
248
- } as const
249
-
250
- export type JsonNullValueFilter = (typeof JsonNullValueFilter)[keyof typeof JsonNullValueFilter]
251
-
252
-
253
- export const NullsOrder = {
254
- first: 'first',
255
- last: 'last'
256
- } as const
257
-
258
- export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder]
259
-