codecane 1.0.144 → 1.0.146
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/cli.js +15 -9
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +5 -5
- package/dist/code-map/tsconfig.tsbuildinfo +1 -1
- package/dist/common/actions.d.ts +69 -69
- package/dist/common/billing/payment-guards.d.ts +11 -0
- package/dist/common/billing/payment-guards.js +136 -0
- package/dist/common/billing/payment-guards.js.map +1 -0
- package/dist/common/billing/subscription-state.d.ts +13 -0
- package/dist/common/billing/subscription-state.js +117 -0
- package/dist/common/billing/subscription-state.js.map +1 -0
- package/dist/common/billing/webhook-processor.d.ts +21 -0
- package/dist/common/billing/webhook-processor.js +315 -0
- package/dist/common/billing/webhook-processor.js.map +1 -0
- package/dist/common/constants.d.ts +9 -8
- package/dist/common/constants.js +11 -12
- package/dist/common/constants.js.map +1 -1
- package/dist/common/scripts/update-subscriptions.d.ts +1 -0
- package/dist/common/scripts/update-subscriptions.js +92 -0
- package/dist/common/scripts/update-subscriptions.js.map +1 -0
- package/dist/common/types/usage.d.ts +2 -2
- package/dist/common/util/credentials.d.ts +2 -2
- package/dist/common/util/string.d.ts +1 -0
- package/dist/common/util/string.js +13 -2
- package/dist/common/util/string.js.map +1 -1
- package/dist/common/websockets/logger-interface.d.ts +6 -0
- package/dist/common/websockets/logger-interface.js +9 -0
- package/dist/common/websockets/logger-interface.js.map +1 -0
- package/dist/common/websockets/websocket-schema.d.ts +166 -166
- package/dist/index.js +1 -1
- package/dist/project-files.d.ts +3 -0
- package/dist/project-files.js +43 -13
- package/dist/project-files.js.map +1 -1
- package/dist/tool-handlers.js +204 -102
- package/dist/tool-handlers.js.map +1 -1
- package/dist/utils/detect-shell.d.ts +1 -0
- package/dist/utils/detect-shell.js +60 -0
- package/dist/utils/detect-shell.js.map +1 -0
- package/dist/utils/system-info.d.ts +8 -0
- package/dist/utils/system-info.js +22 -0
- package/dist/utils/system-info.js.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type Stripe from 'stripe';
|
|
2
|
+
export declare class WebhookProcessor {
|
|
3
|
+
private stripeSignature;
|
|
4
|
+
private rawBody;
|
|
5
|
+
constructor(stripeSignature: string, rawBody: string);
|
|
6
|
+
validateWebhook(): Promise<{
|
|
7
|
+
valid: boolean;
|
|
8
|
+
event?: Stripe.Event;
|
|
9
|
+
error?: string;
|
|
10
|
+
}>;
|
|
11
|
+
private checkDuplicateEvent;
|
|
12
|
+
processEvent(event: Stripe.Event): Promise<void>;
|
|
13
|
+
private handleEvent;
|
|
14
|
+
private handleSubscriptionChange;
|
|
15
|
+
private handleSubscriptionDeletion;
|
|
16
|
+
private handleInvoiceCreation;
|
|
17
|
+
private handleInvoicePayment;
|
|
18
|
+
private handlePaymentFailure;
|
|
19
|
+
private getTotalReferralCredits;
|
|
20
|
+
private mapStripeStatus;
|
|
21
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.WebhookProcessor = void 0;
|
|
30
|
+
const stripe_1 = require("../util/stripe");
|
|
31
|
+
const db_1 = __importDefault(require("../db"));
|
|
32
|
+
const schema = __importStar(require("../db/schema"));
|
|
33
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
34
|
+
const zod_1 = require("zod");
|
|
35
|
+
const subscription_state_1 = require("./subscription-state");
|
|
36
|
+
const quota_manager_1 = require("./quota-manager");
|
|
37
|
+
const payment_guards_1 = require("./payment-guards");
|
|
38
|
+
const webhookEventSchema = zod_1.z.object({
|
|
39
|
+
id: zod_1.z.string(),
|
|
40
|
+
type: zod_1.z.string(),
|
|
41
|
+
created: zod_1.z.number(),
|
|
42
|
+
data: zod_1.z.object({
|
|
43
|
+
object: zod_1.z.record(zod_1.z.any()),
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
class WebhookProcessor {
|
|
47
|
+
stripeSignature;
|
|
48
|
+
rawBody;
|
|
49
|
+
constructor(stripeSignature, rawBody) {
|
|
50
|
+
this.stripeSignature = stripeSignature;
|
|
51
|
+
this.rawBody = rawBody;
|
|
52
|
+
}
|
|
53
|
+
async validateWebhook() {
|
|
54
|
+
try {
|
|
55
|
+
const event = stripe_1.stripeServer.webhooks.constructEvent(this.rawBody, this.stripeSignature, process.env.STRIPE_WEBHOOK_SECRET_KEY);
|
|
56
|
+
// Validate event structure
|
|
57
|
+
const result = webhookEventSchema.safeParse(event);
|
|
58
|
+
if (!result.success) {
|
|
59
|
+
return {
|
|
60
|
+
valid: false,
|
|
61
|
+
error: 'Invalid event structure',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// Check for duplicate events
|
|
65
|
+
const isDuplicate = await this.checkDuplicateEvent(event.id);
|
|
66
|
+
if (isDuplicate) {
|
|
67
|
+
return {
|
|
68
|
+
valid: false,
|
|
69
|
+
error: 'Duplicate event',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
valid: true,
|
|
74
|
+
event,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return {
|
|
79
|
+
valid: false,
|
|
80
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async checkDuplicateEvent(eventId) {
|
|
85
|
+
// First try to insert the event
|
|
86
|
+
try {
|
|
87
|
+
await db_1.default.insert(schema.webhook_events).values({
|
|
88
|
+
id: eventId,
|
|
89
|
+
processed_at: new Date(),
|
|
90
|
+
});
|
|
91
|
+
return false; // Not a duplicate
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
// If insert fails due to unique constraint, it's a duplicate
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async processEvent(event) {
|
|
99
|
+
// Start transaction to ensure atomic processing
|
|
100
|
+
await db_1.default.transaction(async (tx) => {
|
|
101
|
+
// Lock the subscription record if this is a subscription-related event
|
|
102
|
+
if (event.type.startsWith('customer.subscription.')) {
|
|
103
|
+
const subscription = event.data.object;
|
|
104
|
+
await tx
|
|
105
|
+
.select()
|
|
106
|
+
.from(schema.user)
|
|
107
|
+
.where((0, drizzle_orm_1.eq)(schema.user.stripe_price_id, subscription.id))
|
|
108
|
+
.for('update');
|
|
109
|
+
}
|
|
110
|
+
// Record event processing start
|
|
111
|
+
await tx.insert(schema.webhook_processing).values({
|
|
112
|
+
id: crypto.randomUUID(),
|
|
113
|
+
event_id: event.id,
|
|
114
|
+
started_at: new Date(),
|
|
115
|
+
status: 'processing',
|
|
116
|
+
});
|
|
117
|
+
try {
|
|
118
|
+
// Process the event based on type
|
|
119
|
+
await this.handleEvent(event);
|
|
120
|
+
// Record successful processing
|
|
121
|
+
await tx
|
|
122
|
+
.update(schema.webhook_processing)
|
|
123
|
+
.set({
|
|
124
|
+
status: 'completed',
|
|
125
|
+
completed_at: new Date(),
|
|
126
|
+
})
|
|
127
|
+
.where((0, drizzle_orm_1.eq)(schema.webhook_processing.event_id, event.id));
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
// Record failed processing
|
|
131
|
+
await tx
|
|
132
|
+
.update(schema.webhook_processing)
|
|
133
|
+
.set({
|
|
134
|
+
status: 'failed',
|
|
135
|
+
error_message: error instanceof Error ? error.message : 'Unknown error',
|
|
136
|
+
completed_at: new Date(),
|
|
137
|
+
})
|
|
138
|
+
.where((0, drizzle_orm_1.eq)(schema.webhook_processing.event_id, event.id));
|
|
139
|
+
throw error; // Re-throw to rollback transaction
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
async handleEvent(event) {
|
|
144
|
+
// Check for older unprocessed events
|
|
145
|
+
const pendingEvents = await db_1.default
|
|
146
|
+
.select({
|
|
147
|
+
id: schema.webhook_events.id,
|
|
148
|
+
created: schema.webhook_events.created_at,
|
|
149
|
+
})
|
|
150
|
+
.from(schema.webhook_events)
|
|
151
|
+
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.sql) `created_at < ${new Date(event.created * 1000)}`, (0, drizzle_orm_1.eq)(schema.webhook_events.processed, false)))
|
|
152
|
+
.orderBy(schema.webhook_events.created_at);
|
|
153
|
+
// If there are older unprocessed events, delay processing this one
|
|
154
|
+
if (pendingEvents.length > 0) {
|
|
155
|
+
throw new Error(`Unprocessed events exist before ${event.id}. Process those first.`);
|
|
156
|
+
}
|
|
157
|
+
// Process based on event type
|
|
158
|
+
switch (event.type) {
|
|
159
|
+
case 'customer.subscription.created':
|
|
160
|
+
case 'customer.subscription.updated':
|
|
161
|
+
await this.handleSubscriptionChange(event);
|
|
162
|
+
break;
|
|
163
|
+
case 'customer.subscription.deleted':
|
|
164
|
+
await this.handleSubscriptionDeletion(event);
|
|
165
|
+
break;
|
|
166
|
+
case 'invoice.created':
|
|
167
|
+
await this.handleInvoiceCreation(event);
|
|
168
|
+
break;
|
|
169
|
+
case 'invoice.paid':
|
|
170
|
+
await this.handleInvoicePayment(event);
|
|
171
|
+
break;
|
|
172
|
+
case 'invoice.payment_failed':
|
|
173
|
+
await this.handlePaymentFailure(event);
|
|
174
|
+
break;
|
|
175
|
+
default:
|
|
176
|
+
console.log(`Unhandled event type ${event.type}`);
|
|
177
|
+
}
|
|
178
|
+
// Mark event as processed
|
|
179
|
+
await db_1.default
|
|
180
|
+
.update(schema.webhook_events)
|
|
181
|
+
.set({
|
|
182
|
+
processed: true,
|
|
183
|
+
processed_at: new Date(),
|
|
184
|
+
})
|
|
185
|
+
.where((0, drizzle_orm_1.eq)(schema.webhook_events.id, event.id));
|
|
186
|
+
}
|
|
187
|
+
async handleSubscriptionChange(event) {
|
|
188
|
+
const subscription = event.data.object;
|
|
189
|
+
const stateManager = new subscription_state_1.SubscriptionStateManager(subscription.id);
|
|
190
|
+
const quotaManager = new quota_manager_1.QuotaManager(subscription.id);
|
|
191
|
+
// Get the current state and update it
|
|
192
|
+
const currentState = await stateManager.getCurrentState();
|
|
193
|
+
const newState = this.mapStripeStatus(subscription.status);
|
|
194
|
+
if (currentState !== newState) {
|
|
195
|
+
// Acquire lock for state transition
|
|
196
|
+
const lockAcquired = await stateManager.beginStateTransition();
|
|
197
|
+
if (!lockAcquired) {
|
|
198
|
+
throw new Error('Failed to acquire transition lock');
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
// Record state change
|
|
202
|
+
await stateManager.addStateHistoryEntry(currentState, newState, `Webhook event: ${event.type}`);
|
|
203
|
+
// Handle quota updates if needed
|
|
204
|
+
if (newState === 'active' && currentState !== 'active') {
|
|
205
|
+
await quotaManager.resetQuota();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
await stateManager.endStateTransition();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
async handleSubscriptionDeletion(event) {
|
|
214
|
+
const subscription = event.data.object;
|
|
215
|
+
const stateManager = new subscription_state_1.SubscriptionStateManager(subscription.id);
|
|
216
|
+
const lockAcquired = await stateManager.beginStateTransition();
|
|
217
|
+
if (!lockAcquired) {
|
|
218
|
+
throw new Error('Failed to acquire transition lock');
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
await stateManager.addStateHistoryEntry('active', 'canceled', 'Subscription deleted');
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
await stateManager.endStateTransition();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async handleInvoiceCreation(event) {
|
|
228
|
+
const invoice = event.data.object;
|
|
229
|
+
if (!invoice.subscription)
|
|
230
|
+
return;
|
|
231
|
+
// Handle referral credits if applicable
|
|
232
|
+
if (invoice.customer) {
|
|
233
|
+
const referralCredits = await this.getTotalReferralCredits(invoice.customer.toString());
|
|
234
|
+
if (referralCredits > 0) {
|
|
235
|
+
// Apply referral credits as credit on the invoice
|
|
236
|
+
await stripe_1.stripeServer.invoices.update(invoice.id, {
|
|
237
|
+
description: `Including referral credits: ${referralCredits}`,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async handleInvoicePayment(event) {
|
|
243
|
+
const invoice = event.data.object;
|
|
244
|
+
if (!invoice.subscription)
|
|
245
|
+
return;
|
|
246
|
+
const stateManager = new subscription_state_1.SubscriptionStateManager(invoice.subscription.toString());
|
|
247
|
+
const quotaManager = new quota_manager_1.QuotaManager(invoice.subscription.toString());
|
|
248
|
+
// Reset quota for new billing period
|
|
249
|
+
await quotaManager.resetQuota();
|
|
250
|
+
// Update subscription state if needed
|
|
251
|
+
const currentState = await stateManager.getCurrentState();
|
|
252
|
+
if (currentState !== 'active') {
|
|
253
|
+
const lockAcquired = await stateManager.beginStateTransition();
|
|
254
|
+
if (!lockAcquired) {
|
|
255
|
+
throw new Error('Failed to acquire transition lock');
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
await stateManager.addStateHistoryEntry(currentState, 'active', 'Invoice payment successful');
|
|
259
|
+
}
|
|
260
|
+
finally {
|
|
261
|
+
await stateManager.endStateTransition();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
async handlePaymentFailure(event) {
|
|
266
|
+
const invoice = event.data.object;
|
|
267
|
+
if (!invoice.subscription)
|
|
268
|
+
return;
|
|
269
|
+
const paymentGuards = new payment_guards_1.PaymentGuards(invoice.subscription.toString());
|
|
270
|
+
await paymentGuards.handleFailedPayment();
|
|
271
|
+
// Update subscription state
|
|
272
|
+
const stateManager = new subscription_state_1.SubscriptionStateManager(invoice.subscription.toString());
|
|
273
|
+
const lockAcquired = await stateManager.beginStateTransition();
|
|
274
|
+
if (!lockAcquired) {
|
|
275
|
+
throw new Error('Failed to acquire transition lock');
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
await stateManager.addStateHistoryEntry('active', 'past_due', 'Payment failed');
|
|
279
|
+
}
|
|
280
|
+
finally {
|
|
281
|
+
await stateManager.endStateTransition();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
async getTotalReferralCredits(customerId) {
|
|
285
|
+
const result = await db_1.default
|
|
286
|
+
.select({
|
|
287
|
+
total: (0, drizzle_orm_1.sql) `COALESCE(SUM(${schema.referral.credits}), 0)::int`,
|
|
288
|
+
})
|
|
289
|
+
.from(schema.user)
|
|
290
|
+
.leftJoin(schema.referral, (0, drizzle_orm_1.or)((0, drizzle_orm_1.eq)(schema.referral.referrer_id, schema.user.id), (0, drizzle_orm_1.eq)(schema.referral.referred_id, schema.user.id)))
|
|
291
|
+
.where((0, drizzle_orm_1.eq)(schema.user.stripe_customer_id, customerId))
|
|
292
|
+
.groupBy(schema.user.id);
|
|
293
|
+
return result[0]?.total || 0;
|
|
294
|
+
}
|
|
295
|
+
mapStripeStatus(status) {
|
|
296
|
+
switch (status) {
|
|
297
|
+
case 'active':
|
|
298
|
+
return 'active';
|
|
299
|
+
case 'past_due':
|
|
300
|
+
return 'past_due';
|
|
301
|
+
case 'incomplete':
|
|
302
|
+
return 'incomplete';
|
|
303
|
+
case 'canceled':
|
|
304
|
+
return 'canceled';
|
|
305
|
+
case 'trialing':
|
|
306
|
+
return 'trialing';
|
|
307
|
+
case 'paused':
|
|
308
|
+
return 'paused';
|
|
309
|
+
default:
|
|
310
|
+
throw new Error(`Unknown Stripe status: ${status}`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
exports.WebhookProcessor = WebhookProcessor;
|
|
315
|
+
//# sourceMappingURL=webhook-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-processor.js","sourceRoot":"","sources":["../../src/billing/webhook-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6C;AAC7C,+CAAsB;AACtB,qDAAsC;AACtC,6CAA8C;AAC9C,6BAAuB;AAEvB,6DAAkF;AAClF,mDAA8C;AAC9C,qDAAgD;AAEhD,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC;QACb,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC;K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,IAAI,CAAC;aACjB,QAAQ,CACP,MAAM,CAAC,QAAQ,EACf,IAAA,gBAAE,EACA,IAAA,gBAAE,EAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAC/C,IAAA,gBAAE,EAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAChD,CACF;aACA,KAAK,CAAC,IAAA,gBAAE,EAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;aACrD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAE1B,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAA;IAC9B,CAAC;IAEO,eAAe,CAAC,MAAc;QACpC,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAA;YACjB,KAAK,UAAU;gBACb,OAAO,UAAU,CAAA;YACnB,KAAK,YAAY;gBACf,OAAO,YAAY,CAAA;YACrB,KAAK,UAAU;gBACb,OAAO,UAAU,CAAA;YACnB,KAAK,UAAU;gBACb,OAAO,UAAU,CAAA;YACnB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAA;YACjB;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,EAAE,CAAC,CAAA;QACvD,CAAC;IACH,CAAC;CACF;AAhVD,4CAgVC"}
|
|
@@ -19,12 +19,13 @@ export type PlanConfig = {
|
|
|
19
19
|
monthlyPrice: number;
|
|
20
20
|
overageRate: number | null;
|
|
21
21
|
};
|
|
22
|
-
export declare
|
|
23
|
-
ANON
|
|
24
|
-
FREE
|
|
25
|
-
PRO
|
|
26
|
-
MOAR_PRO
|
|
27
|
-
}
|
|
22
|
+
export declare const UsageLimits: {
|
|
23
|
+
readonly ANON: "ANON";
|
|
24
|
+
readonly FREE: "FREE";
|
|
25
|
+
readonly PRO: "PRO";
|
|
26
|
+
readonly MOAR_PRO: "MOAR_PRO";
|
|
27
|
+
};
|
|
28
|
+
export type UsageLimits = (typeof UsageLimits)[keyof typeof UsageLimits];
|
|
28
29
|
export declare const PLAN_CONFIGS: Record<UsageLimits, PlanConfig>;
|
|
29
30
|
export declare const CREDITS_USAGE_LIMITS: Record<UsageLimits, number>;
|
|
30
31
|
export declare const costModes: readonly ["lite", "normal", "pro"];
|
|
@@ -37,7 +38,7 @@ export declare const claudeModels: {
|
|
|
37
38
|
export declare const openaiModels: {
|
|
38
39
|
readonly gpt4o: "gpt-4o-2024-08-06";
|
|
39
40
|
readonly gpt4omini: "gpt-4o-mini-2024-07-18";
|
|
40
|
-
readonly o1: "o1
|
|
41
|
+
readonly o1: "o1";
|
|
41
42
|
};
|
|
42
43
|
export declare const geminiModels: {
|
|
43
44
|
readonly gemini2flash: "gemini-2.0-flash-exp";
|
|
@@ -50,7 +51,7 @@ export declare const models: {
|
|
|
50
51
|
readonly gemini2flash: "gemini-2.0-flash-exp";
|
|
51
52
|
readonly gpt4o: "gpt-4o-2024-08-06";
|
|
52
53
|
readonly gpt4omini: "gpt-4o-mini-2024-07-18";
|
|
53
|
-
readonly o1: "o1
|
|
54
|
+
readonly o1: "o1";
|
|
54
55
|
readonly sonnet: "claude-3-5-sonnet-20241022";
|
|
55
56
|
readonly haiku: "claude-3-5-haiku-20241022";
|
|
56
57
|
};
|
package/dist/common/constants.js
CHANGED
|
@@ -87,39 +87,38 @@ const getUsageLimitFromPlanName = (planName) => {
|
|
|
87
87
|
return entry[0];
|
|
88
88
|
};
|
|
89
89
|
exports.getUsageLimitFromPlanName = getUsageLimitFromPlanName;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
})(UsageLimits || (exports.UsageLimits = UsageLimits = {}));
|
|
90
|
+
exports.UsageLimits = {
|
|
91
|
+
ANON: 'ANON',
|
|
92
|
+
FREE: 'FREE',
|
|
93
|
+
PRO: 'PRO',
|
|
94
|
+
MOAR_PRO: 'MOAR_PRO',
|
|
95
|
+
};
|
|
97
96
|
// Define base configs with production values
|
|
98
97
|
exports.PLAN_CONFIGS = {
|
|
99
98
|
ANON: {
|
|
100
99
|
limit: 500,
|
|
101
|
-
planName: UsageLimits.ANON,
|
|
100
|
+
planName: exports.UsageLimits.ANON,
|
|
102
101
|
displayName: 'Anonymous',
|
|
103
102
|
monthlyPrice: 0,
|
|
104
103
|
overageRate: null,
|
|
105
104
|
},
|
|
106
105
|
FREE: {
|
|
107
106
|
limit: 1_000,
|
|
108
|
-
planName: UsageLimits.FREE,
|
|
107
|
+
planName: exports.UsageLimits.FREE,
|
|
109
108
|
displayName: 'Free',
|
|
110
109
|
monthlyPrice: 0,
|
|
111
110
|
overageRate: null,
|
|
112
111
|
},
|
|
113
112
|
PRO: {
|
|
114
113
|
limit: 5_000,
|
|
115
|
-
planName: UsageLimits.PRO,
|
|
114
|
+
planName: exports.UsageLimits.PRO,
|
|
116
115
|
displayName: 'Pro',
|
|
117
116
|
monthlyPrice: 49,
|
|
118
117
|
overageRate: exports.OVERAGE_RATE_PRO,
|
|
119
118
|
},
|
|
120
119
|
MOAR_PRO: {
|
|
121
120
|
limit: 27_500,
|
|
122
|
-
planName: UsageLimits.MOAR_PRO,
|
|
121
|
+
planName: exports.UsageLimits.MOAR_PRO,
|
|
123
122
|
displayName: 'Moar Pro',
|
|
124
123
|
monthlyPrice: 249,
|
|
125
124
|
overageRate: exports.OVERAGE_RATE_MOAR_PRO,
|
|
@@ -154,7 +153,7 @@ exports.claudeModels = {
|
|
|
154
153
|
exports.openaiModels = {
|
|
155
154
|
gpt4o: 'gpt-4o-2024-08-06',
|
|
156
155
|
gpt4omini: 'gpt-4o-mini-2024-07-18',
|
|
157
|
-
o1: 'o1
|
|
156
|
+
o1: 'o1',
|
|
158
157
|
// o1: 'o1-2024-12-17',
|
|
159
158
|
};
|
|
160
159
|
exports.geminiModels = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,GAAG,GAAG,MAAM,CAAA;AAC1B,QAAA,iBAAiB,GAAG,GAAG,GAAG,oBAAoB,CAAA;AAC9C,QAAA,kBAAkB,GAAG,GAAG,GAAG,cAAc,CAAA;AACzC,QAAA,oBAAoB,GAAG,oCAAoC,CAAA;AAE3D,QAAA,qBAAqB,GAAG;IACnC,MAAM;IACN,MAAM;IACN,QAAQ;IACR,KAAK;IACL,KAAK;IACL,SAAS;IACT,cAAc;IACd,MAAM;IACN,YAAY;IACZ,OAAO;IACP,aAAa;IACb,aAAa;IACb,aAAa;IACb,OAAO;IACP,WAAW;IACX,eAAe;IACf,aAAa;IACb,aAAa;IACb,OAAO;CACR,CAAA;AAEY,QAAA,yBAAyB,GAAG;IACvC,UAAU;IACV,MAAM;IACN,MAAM;IACN,SAAS;IACT,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,KAAK;IACL,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,QAAQ;IACR,OAAO;IACP,MAAM;IACN,IAAI;IACJ,OAAO;IACP,SAAS;CACV,CAAA;AAEY,QAAA,6BAA6B,GAAG,CAAC,CAAA;AACjC,QAAA,QAAQ,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,CAAA;AACnC,QAAA,mBAAmB,GAAG,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QA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AC7D,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAA;AACpD,CAAC,CAAA;AAdY,QAAA,eAAe,mBAc3B;AAEY,QAAA,YAAY,GAAG;IAC1B,MAAM,EAAE,4BAA4B;IACpC,KAAK,EAAE,2BAA2B;CAC1B,CAAA;AAEG,QAAA,YAAY,GAAG;IAC1B,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,wBAAwB;IACnC,EAAE,EAAE,IAAI;IACR,uBAAuB;CACf,CAAA;AAEG,QAAA,YAAY,GAAG;IAC1B,YAAY,EAAE,sBAAsB;CAC5B,CAAA;AAEG,QAAA,cAAc,GAAG;IAC5B,YAAY,EAAE,eAAe;CACrB,CAAA;AAEG,QAAA,MAAM,GAAG;IACpB,GAAG,oBAAY;IACf,GAAG,oBAAY;IACf,GAAG,oBAAY;IACf,GAAG,sBAAc;CACT,CAAA;AAEG,QAAA,YAAY,GAAG,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
30
|
+
const stripe_1 = require("../util/stripe");
|
|
31
|
+
const db_1 = __importDefault(require("../db"));
|
|
32
|
+
const schema = __importStar(require("../db/schema"));
|
|
33
|
+
async function main() {
|
|
34
|
+
const email = process.argv[2];
|
|
35
|
+
if (!email) {
|
|
36
|
+
console.error('Please provide an email address');
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
console.log(`Processing user ${email}...`);
|
|
40
|
+
// Find user and verify subscription
|
|
41
|
+
const user = await db_1.default.query.user.findFirst({
|
|
42
|
+
where: (0, drizzle_orm_1.eq)(schema.user.email, email),
|
|
43
|
+
});
|
|
44
|
+
if (!user?.stripe_customer_id) {
|
|
45
|
+
console.error('User not found or has no Stripe customer ID');
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
console.log('Found user:', user.id);
|
|
49
|
+
// Get subscriptions for customer
|
|
50
|
+
const subscriptions = await stripe_1.stripeServer.subscriptions.list({
|
|
51
|
+
customer: user.stripe_customer_id,
|
|
52
|
+
status: 'active',
|
|
53
|
+
});
|
|
54
|
+
if (subscriptions.data.length === 0) {
|
|
55
|
+
console.error('No active subscription found');
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
const subscription = subscriptions.data[0];
|
|
59
|
+
console.log('Found subscription:', subscription.id);
|
|
60
|
+
// Update subscription items
|
|
61
|
+
console.log('Updating subscription items...');
|
|
62
|
+
await stripe_1.stripeServer.subscriptions.update(subscription.id, {
|
|
63
|
+
items: [
|
|
64
|
+
{ price: 'price_1QLxwxKrNS6SjmqWeKhJIlAD', quantity: 1 },
|
|
65
|
+
{ price: 'price_1QMlqaKrNS6SjmqWQEeaTcqk' },
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
// Calculate usage since Oct 30, 2024
|
|
69
|
+
const startDate = new Date('2024-10-30');
|
|
70
|
+
const creditsUsed = await db_1.default
|
|
71
|
+
.select({
|
|
72
|
+
total: (0, drizzle_orm_1.sql) `SUM(${schema.message.credits})`,
|
|
73
|
+
})
|
|
74
|
+
.from(schema.message)
|
|
75
|
+
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(schema.message.user_id, user.id), (0, drizzle_orm_1.gte)(schema.message.finished_at, startDate)))
|
|
76
|
+
.then((result) => parseInt(result[0]?.total ?? '0'));
|
|
77
|
+
console.log('Credits used since Oct 30, 2024:', creditsUsed);
|
|
78
|
+
// Report usage
|
|
79
|
+
const timestamp = Math.floor(startDate.getTime() / 1000);
|
|
80
|
+
await stripe_1.stripeServer.subscriptionItems.createUsageRecord(subscription.items.data[1].id, // Get the metered price item
|
|
81
|
+
{
|
|
82
|
+
quantity: creditsUsed,
|
|
83
|
+
timestamp,
|
|
84
|
+
action: 'set',
|
|
85
|
+
});
|
|
86
|
+
console.log('Successfully updated subscription and usage');
|
|
87
|
+
}
|
|
88
|
+
main().catch((error) => {
|
|
89
|
+
console.error('Error:', error);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=update-subscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-subscriptions.js","sourceRoot":"","sources":["../../src/scripts/update-subscriptions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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;IAC5D;QACE,QAAQ,EAAE,WAAW;QACrB,SAAS;QACT,MAAM,EAAE,KAAK;KACd,CACF,CAAA;IAED,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAA;AAC5D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -8,17 +8,17 @@ export declare const usageDataSchema: z.ZodObject<{
|
|
|
8
8
|
overageRate: z.ZodNullable<z.ZodNumber>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
creditsUsed: number;
|
|
11
|
+
overageRate: number | null;
|
|
11
12
|
totalQuota: number;
|
|
12
13
|
remainingCredits: number;
|
|
13
14
|
subscriptionActive: boolean;
|
|
14
15
|
nextQuotaReset: Date;
|
|
15
|
-
overageRate: number | null;
|
|
16
16
|
}, {
|
|
17
17
|
creditsUsed: number;
|
|
18
|
+
overageRate: number | null;
|
|
18
19
|
totalQuota: number;
|
|
19
20
|
remainingCredits: number;
|
|
20
21
|
subscriptionActive: boolean;
|
|
21
22
|
nextQuotaReset: Date;
|
|
22
|
-
overageRate: number | null;
|
|
23
23
|
}>;
|
|
24
24
|
export type UsageData = z.infer<typeof usageDataSchema>;
|
|
@@ -10,15 +10,15 @@ export declare const userSchema: z.ZodObject<{
|
|
|
10
10
|
email: string;
|
|
11
11
|
name: string | null;
|
|
12
12
|
id: string;
|
|
13
|
-
authToken: string;
|
|
14
13
|
fingerprintId: string;
|
|
14
|
+
authToken: string;
|
|
15
15
|
fingerprintHash: string;
|
|
16
16
|
}, {
|
|
17
17
|
email: string;
|
|
18
18
|
name: string | null;
|
|
19
19
|
id: string;
|
|
20
|
-
authToken: string;
|
|
21
20
|
fingerprintId: string;
|
|
21
|
+
authToken: string;
|
|
22
22
|
fingerprintHash: string;
|
|
23
23
|
}>;
|
|
24
24
|
export type User = z.infer<typeof userSchema>;
|
|
@@ -8,3 +8,4 @@ export declare const pluralize: (count: number, word: string) => string;
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const capitalize: (str: string) => string;
|
|
10
10
|
export declare const safeReplace: (content: string, searchStr: string, replaceStr: string) => string;
|
|
11
|
+
export declare const hasLazyEdit: (content: string) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.safeReplace = exports.capitalize = exports.pluralize = exports.randBoolFromStr = exports.replaceNonStandardPlaceholderComments = exports.truncateString = void 0;
|
|
3
|
+
exports.hasLazyEdit = exports.safeReplace = exports.capitalize = exports.pluralize = exports.randBoolFromStr = exports.replaceNonStandardPlaceholderComments = exports.truncateString = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const truncateString = (str, maxLength) => {
|
|
6
6
|
if (str.length <= maxLength) {
|
|
@@ -85,7 +85,7 @@ exports.pluralize = pluralize;
|
|
|
85
85
|
const capitalize = (str) => {
|
|
86
86
|
if (!str)
|
|
87
87
|
return str;
|
|
88
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
88
|
+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
89
89
|
};
|
|
90
90
|
exports.capitalize = capitalize;
|
|
91
91
|
const safeReplace = (content, searchStr, replaceStr) => {
|
|
@@ -93,4 +93,15 @@ const safeReplace = (content, searchStr, replaceStr) => {
|
|
|
93
93
|
return content.replace(searchStr, escapedReplaceStr);
|
|
94
94
|
};
|
|
95
95
|
exports.safeReplace = safeReplace;
|
|
96
|
+
const hasLazyEdit = (content) => content.includes('// rest of the') ||
|
|
97
|
+
content.includes('# rest of the') ||
|
|
98
|
+
// Match various comment styles with ellipsis and specific words
|
|
99
|
+
/\/\/\s*\.{3}.*(?:rest|unchanged|keep|file|existing|some).*(?:\.{3})?/.test(content) || // C-style single line
|
|
100
|
+
/\/\*\s*\.{3}.*(?:rest|unchanged|keep|file|existing|some).*(?:\.{3})?\s*\*\//.test(content) || // C-style multi-line
|
|
101
|
+
/#\s*\.{3}.*(?:rest|unchanged|keep|file|existing|some).*(?:\.{3})?/.test(content) || // Python/Ruby style
|
|
102
|
+
/<!--\s*\.{3}.*(?:rest|unchanged|keep|file|existing|some).*(?:\.{3})?\s*-->/.test(content) || // HTML style
|
|
103
|
+
/--\s*\.{3}.*(?:rest|unchanged|keep|file|existing|some).*(?:\.{3})?/.test(content) || // SQL/Haskell style
|
|
104
|
+
/%\s*\.{3}.*(?:rest|unchanged|keep|file|existing|some).*(?:\.{3})?/.test(content) || // MATLAB style
|
|
105
|
+
/{\s*\/\*\s*\.{3}.*(?:rest|unchanged|keep|file|existing|some).*(?:\.{3})?\s*\*\/\s*}/.test(content); // JSX style
|
|
106
|
+
exports.hasLazyEdit = hasLazyEdit;
|
|
96
107
|
//# sourceMappingURL=string.js.map
|