@snapback/cli 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{auth-TDIHGKKL.js → auth-UA7I3YE4.js} +10 -10
- package/dist/{auto-provision-organization-CXHL46P3.js → auto-provision-organization-6YF463TK.js} +5 -5
- package/dist/{chunk-Q4VC7GND.js → chunk-BE3HNVSV.js} +1 -1
- package/dist/{chunk-LIBBDBW5.js → chunk-BWWPGNZ5.js} +40 -334
- package/dist/{chunk-FMWCFAY7.js → chunk-GT4ZUCFR.js} +1 -1
- package/dist/{chunk-WS36HDEU.js → chunk-NOWJBG6X.js} +1 -82
- package/dist/{chunk-CPZWXRP2.js → chunk-V7B37PPD.js} +29 -386
- package/dist/{chunk-GQ73B37K.js → chunk-YVZXPBSV.js} +1 -1
- package/dist/{client-62E3L6DW.js → client-RHDS6NOB.js} +2 -2
- package/dist/dist-CUHOKNLS.js +12 -0
- package/dist/{dist-NFU5UJEW.js → dist-RJE4RSZJ.js} +2 -2
- package/dist/index.js +8028 -8484
- package/package.json +3 -3
- package/dist/dist-OO5LJHL6.js +0 -12
package/README.md
CHANGED
|
@@ -679,7 +679,7 @@ $ snap doctor
|
|
|
679
679
|
|
|
680
680
|
Unlock Pro features like checkpoint creation and restoration:
|
|
681
681
|
|
|
682
|
-
👉 **[console.snapback.dev/settings/api-keys](https://console.snapback.dev/settings/api-keys)**
|
|
682
|
+
👉 **[console.snapback.dev/app/settings/api-keys](https://console.snapback.dev/app/settings/api-keys)**
|
|
683
683
|
|
|
684
684
|
---
|
|
685
685
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
|
-
import { config, EntitlementsServiceImpl, getBaseUrl, ENABLE_ENHANCED_2FA, ENABLE_SSO, ENABLE_CAPTCHA, ENABLE_MULTI_SESSION, getOrganizationWithPurchasesAndMembersCount, getPendingInvitationByEmail } from './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import './chunk-
|
|
2
|
+
import { config, EntitlementsServiceImpl, getBaseUrl, ENABLE_ENHANCED_2FA, ENABLE_SSO, ENABLE_CAPTCHA, ENABLE_MULTI_SESSION, getOrganizationWithPurchasesAndMembersCount, getPendingInvitationByEmail } from './chunk-V7B37PPD.js';
|
|
3
|
+
import { combinedSchema, db } from './chunk-BWWPGNZ5.js';
|
|
4
|
+
import { trackEvent } from './chunk-GT4ZUCFR.js';
|
|
5
|
+
import './chunk-YVZXPBSV.js';
|
|
6
|
+
import './chunk-BE3HNVSV.js';
|
|
7
7
|
import { logger } from './chunk-PL4HF4M2.js';
|
|
8
|
-
import { createLogger, LogLevel } from './chunk-
|
|
8
|
+
import { createLogger, LogLevel } from './chunk-NOWJBG6X.js';
|
|
9
9
|
import './chunk-5EOPYJ4Y.js';
|
|
10
10
|
import './chunk-CBGOC6RV.js';
|
|
11
11
|
import { __name } from './chunk-7ADPL4Q3.js';
|
|
@@ -1043,7 +1043,7 @@ var _auth = betterAuth({
|
|
|
1043
1043
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1044
1044
|
});
|
|
1045
1045
|
try {
|
|
1046
|
-
const { db: db2 } = await import('./dist-
|
|
1046
|
+
const { db: db2 } = await import('./dist-CUHOKNLS.js');
|
|
1047
1047
|
const { sql } = await import('drizzle-orm');
|
|
1048
1048
|
if (db2) {
|
|
1049
1049
|
const result = await db2.execute(sql`
|
|
@@ -1073,7 +1073,7 @@ var _auth = betterAuth({
|
|
|
1073
1073
|
}
|
|
1074
1074
|
try {
|
|
1075
1075
|
if (!session.activeOrganizationId) {
|
|
1076
|
-
const { db: db2, combinedSchema: combinedSchema2 } = await import('./dist-
|
|
1076
|
+
const { db: db2, combinedSchema: combinedSchema2 } = await import('./dist-CUHOKNLS.js');
|
|
1077
1077
|
const { sql } = await import('drizzle-orm');
|
|
1078
1078
|
if (db2) {
|
|
1079
1079
|
const { member: member2, session: sessionTable } = combinedSchema2;
|
|
@@ -1130,7 +1130,7 @@ var _auth = betterAuth({
|
|
|
1130
1130
|
});
|
|
1131
1131
|
}
|
|
1132
1132
|
try {
|
|
1133
|
-
const { autoProvisionOrganization } = await import('./auto-provision-organization-
|
|
1133
|
+
const { autoProvisionOrganization } = await import('./auto-provision-organization-6YF463TK.js');
|
|
1134
1134
|
const result = await autoProvisionOrganization(user2);
|
|
1135
1135
|
if (!result.success) {
|
|
1136
1136
|
logger.warn("Auto-org provisioning failed", {
|
|
@@ -1424,7 +1424,7 @@ This invitation expires in ${expiresInDays} days.`,
|
|
|
1424
1424
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1425
1425
|
}).catch(() => {
|
|
1426
1426
|
});
|
|
1427
|
-
import('./dist-
|
|
1427
|
+
import('./dist-RJE4RSZJ.js').then(({ captureError }) => {
|
|
1428
1428
|
if (captureError && error instanceof Error) {
|
|
1429
1429
|
captureError(error, {
|
|
1430
1430
|
tags: {
|
package/dist/{auto-provision-organization-CXHL46P3.js → auto-provision-organization-6YF463TK.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
|
-
import { trackEvent } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
import { trackEvent } from './chunk-GT4ZUCFR.js';
|
|
3
|
+
import './chunk-BE3HNVSV.js';
|
|
4
4
|
import { logger } from './chunk-PL4HF4M2.js';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-NOWJBG6X.js';
|
|
6
6
|
import './chunk-5EOPYJ4Y.js';
|
|
7
7
|
import './chunk-CBGOC6RV.js';
|
|
8
8
|
import { __name } from './chunk-7ADPL4Q3.js';
|
|
@@ -56,7 +56,7 @@ __name(getDisplayName, "getDisplayName");
|
|
|
56
56
|
async function autoProvisionOrganization(user) {
|
|
57
57
|
const startTime = Date.now();
|
|
58
58
|
try {
|
|
59
|
-
const { db, combinedSchema } = await import('./dist-
|
|
59
|
+
const { db, combinedSchema } = await import('./dist-CUHOKNLS.js');
|
|
60
60
|
const { sql } = await import('drizzle-orm');
|
|
61
61
|
if (!db) {
|
|
62
62
|
logger.error("Database not available for auto-provisioning", {
|
|
@@ -138,7 +138,7 @@ async function autoProvisionOrganization(user) {
|
|
|
138
138
|
__name(autoProvisionOrganization, "autoProvisionOrganization");
|
|
139
139
|
async function userHasOrganization(userId) {
|
|
140
140
|
try {
|
|
141
|
-
const { db, combinedSchema } = await import('./dist-
|
|
141
|
+
const { db, combinedSchema } = await import('./dist-CUHOKNLS.js');
|
|
142
142
|
const { sql } = await import('drizzle-orm');
|
|
143
143
|
if (!db) {
|
|
144
144
|
return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
2
|
import { logger } from './chunk-PL4HF4M2.js';
|
|
3
|
-
import { FEATURE_FLAGS, validateTelemetryEvent, FeatureManager } from './chunk-
|
|
3
|
+
import { FEATURE_FLAGS, validateTelemetryEvent, FeatureManager } from './chunk-NOWJBG6X.js';
|
|
4
4
|
import { __commonJS, __name, __export } from './chunk-7ADPL4Q3.js';
|
|
5
5
|
import { neonConfig, neon } from '@neondatabase/serverless';
|
|
6
6
|
import { readFileSync } from 'fs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
|
-
import { createLogger, LogLevel } from './chunk-
|
|
2
|
+
import { createLogger, LogLevel } from './chunk-NOWJBG6X.js';
|
|
3
3
|
import { __export, __name } from './chunk-7ADPL4Q3.js';
|
|
4
4
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
5
5
|
import { Pool } from 'pg';
|
|
6
|
-
import { relations, sql } from 'drizzle-orm';
|
|
6
|
+
import { relations, sql, and, eq } from 'drizzle-orm';
|
|
7
7
|
import { pgTable, pgEnum, timestamp, jsonb, text, integer, uniqueIndex, uuid, boolean, index, json, varchar, bigint, unique, inet, real, check, decimal, customType, numeric } from 'drizzle-orm/pg-core';
|
|
8
8
|
import { nanoid } from 'nanoid';
|
|
9
9
|
|
|
@@ -15,7 +15,6 @@ __export(postgres_exports, {
|
|
|
15
15
|
TOPUP_PACKS: () => TOPUP_PACKS,
|
|
16
16
|
account: () => account,
|
|
17
17
|
accountRelations: () => accountRelations,
|
|
18
|
-
actionTypeEnum: () => actionTypeEnum,
|
|
19
18
|
agentSuggestions: () => agentSuggestions,
|
|
20
19
|
aiChat: () => aiChat,
|
|
21
20
|
aiChatRelations: () => aiChatRelations,
|
|
@@ -42,7 +41,6 @@ __export(postgres_exports, {
|
|
|
42
41
|
invitationRelations: () => invitationRelations,
|
|
43
42
|
isValidPackSize: () => isValidPackSize,
|
|
44
43
|
jwks: () => jwks,
|
|
45
|
-
leaderboardVisibilityEnum: () => leaderboardVisibilityEnum,
|
|
46
44
|
member: () => member,
|
|
47
45
|
newsletterSubscribers: () => newsletterSubscribers,
|
|
48
46
|
newsletterSubscribersRelations: () => newsletterSubscribersRelations,
|
|
@@ -50,12 +48,6 @@ __export(postgres_exports, {
|
|
|
50
48
|
organizationRelations: () => organizationRelations,
|
|
51
49
|
passkey: () => passkey,
|
|
52
50
|
passkeyRelations: () => passkeyRelations,
|
|
53
|
-
pioneerActions: () => pioneerActions,
|
|
54
|
-
pioneerActionsRelations: () => pioneerActionsRelations,
|
|
55
|
-
pioneerTierHistory: () => pioneerTierHistory,
|
|
56
|
-
pioneerTierHistoryRelations: () => pioneerTierHistoryRelations,
|
|
57
|
-
pioneers: () => pioneers,
|
|
58
|
-
pioneersRelations: () => pioneersRelations,
|
|
59
51
|
planTypeEnum: () => planTypeEnum,
|
|
60
52
|
purchase: () => purchase,
|
|
61
53
|
purchaseRelations: () => purchaseRelations,
|
|
@@ -71,7 +63,6 @@ __export(postgres_exports, {
|
|
|
71
63
|
subscriptionStatusEnum: () => subscriptionStatusEnum,
|
|
72
64
|
subscriptions: () => subscriptions,
|
|
73
65
|
subscriptionsRelations: () => subscriptionsRelations,
|
|
74
|
-
tierEnum: () => tierEnum,
|
|
75
66
|
topupStatusEnum: () => topupStatusEnum,
|
|
76
67
|
trialStatusEnum: () => trialStatusEnum,
|
|
77
68
|
trials: () => trials,
|
|
@@ -606,27 +597,6 @@ var planTypeEnum = pgEnum("plan_type", [
|
|
|
606
597
|
"team",
|
|
607
598
|
"enterprise"
|
|
608
599
|
]);
|
|
609
|
-
var tierEnum = pgEnum("pioneer_tier", [
|
|
610
|
-
"pioneer",
|
|
611
|
-
"active_pioneer",
|
|
612
|
-
"contributing_pioneer",
|
|
613
|
-
"founding_pioneer"
|
|
614
|
-
]);
|
|
615
|
-
var leaderboardVisibilityEnum = pgEnum("leaderboard_visibility", [
|
|
616
|
-
"public",
|
|
617
|
-
"anonymous",
|
|
618
|
-
"hidden"
|
|
619
|
-
]);
|
|
620
|
-
var actionTypeEnum = pgEnum("pioneer_action_type", [
|
|
621
|
-
"github_star",
|
|
622
|
-
"discord_join",
|
|
623
|
-
"referral_direct",
|
|
624
|
-
"referral_bonus",
|
|
625
|
-
"feedback",
|
|
626
|
-
"bug_report",
|
|
627
|
-
"tutorial_complete",
|
|
628
|
-
"waitlist_early"
|
|
629
|
-
]);
|
|
630
600
|
var user = pgTable("user", {
|
|
631
601
|
id: varchar("id", {
|
|
632
602
|
length: 255
|
|
@@ -1144,93 +1114,6 @@ var newsletterSubscribers = pgTable("newsletter_subscribers", {
|
|
|
1144
1114
|
uniqueIndex("newsletter_email_idx").on(table.email)
|
|
1145
1115
|
]);
|
|
1146
1116
|
var newsletterSubscribersRelations = relations(newsletterSubscribers, () => ({}));
|
|
1147
|
-
var pioneers = pgTable("pioneers", {
|
|
1148
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid()),
|
|
1149
|
-
userId: text("user_id").notNull().references(() => user.id, {
|
|
1150
|
-
onDelete: "cascade"
|
|
1151
|
-
}),
|
|
1152
|
-
username: text("username").notNull(),
|
|
1153
|
-
githubId: text("github_id").notNull(),
|
|
1154
|
-
// Preferred contact email (may differ from GitHub email)
|
|
1155
|
-
contactEmail: text("contact_email"),
|
|
1156
|
-
tier: tierEnum("tier").notNull().default("pioneer"),
|
|
1157
|
-
totalPoints: integer("total_points").notNull().default(0),
|
|
1158
|
-
joinedAt: timestamp("joined_at").notNull().defaultNow(),
|
|
1159
|
-
referralCode: text("referral_code").notNull().unique(),
|
|
1160
|
-
referredBy: text("referred_by"),
|
|
1161
|
-
referralAppliedAt: timestamp("referral_applied_at"),
|
|
1162
|
-
githubStarred: boolean("github_starred").notNull().default(false),
|
|
1163
|
-
leaderboardVisibility: leaderboardVisibilityEnum("leaderboard_visibility").notNull().default("anonymous"),
|
|
1164
|
-
retroactiveCheckCompleted: boolean("retroactive_check_completed").notNull().default(false),
|
|
1165
|
-
surveyCompletedAt: timestamp("survey_completed_at"),
|
|
1166
|
-
lastSyncedAt: timestamp("last_synced_at"),
|
|
1167
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
1168
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
1169
|
-
}, (table) => [
|
|
1170
|
-
uniqueIndex("pioneers_user_id_idx").on(table.userId),
|
|
1171
|
-
uniqueIndex("pioneers_github_id_idx").on(table.githubId),
|
|
1172
|
-
uniqueIndex("pioneers_referral_code_idx").on(table.referralCode),
|
|
1173
|
-
index("pioneers_leaderboard_idx").on(table.totalPoints)
|
|
1174
|
-
]);
|
|
1175
|
-
var pioneerActions = pgTable("pioneer_actions", {
|
|
1176
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid()),
|
|
1177
|
-
pioneerId: text("pioneer_id").notNull().references(() => pioneers.id, {
|
|
1178
|
-
onDelete: "cascade"
|
|
1179
|
-
}),
|
|
1180
|
-
actionType: actionTypeEnum("action_type").notNull(),
|
|
1181
|
-
points: integer("points").notNull(),
|
|
1182
|
-
verified: boolean("verified").notNull().default(false),
|
|
1183
|
-
metadata: json("metadata").$type(),
|
|
1184
|
-
createdAt: timestamp("created_at").notNull().defaultNow()
|
|
1185
|
-
}, (table) => [
|
|
1186
|
-
index("pioneer_actions_pioneer_id_idx").on(table.pioneerId),
|
|
1187
|
-
index("pioneer_actions_action_type_idx").on(table.actionType),
|
|
1188
|
-
index("pioneer_actions_created_at_idx").on(table.createdAt)
|
|
1189
|
-
]);
|
|
1190
|
-
var pioneerTierHistory = pgTable("pioneer_tier_history", {
|
|
1191
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid()),
|
|
1192
|
-
pioneerId: text("pioneer_id").notNull().references(() => pioneers.id, {
|
|
1193
|
-
onDelete: "cascade"
|
|
1194
|
-
}),
|
|
1195
|
-
previousTier: tierEnum("previous_tier"),
|
|
1196
|
-
newTier: tierEnum("new_tier").notNull(),
|
|
1197
|
-
pointsAtTransition: integer("points_at_transition").notNull(),
|
|
1198
|
-
createdAt: timestamp("created_at").notNull().defaultNow()
|
|
1199
|
-
}, (table) => [
|
|
1200
|
-
index("pioneer_tier_history_pioneer_id_idx").on(table.pioneerId)
|
|
1201
|
-
]);
|
|
1202
|
-
var pioneersRelations = relations(pioneers, ({ one, many }) => ({
|
|
1203
|
-
user: one(user, {
|
|
1204
|
-
fields: [
|
|
1205
|
-
pioneers.userId
|
|
1206
|
-
],
|
|
1207
|
-
references: [
|
|
1208
|
-
user.id
|
|
1209
|
-
]
|
|
1210
|
-
}),
|
|
1211
|
-
actions: many(pioneerActions),
|
|
1212
|
-
tierHistory: many(pioneerTierHistory)
|
|
1213
|
-
}));
|
|
1214
|
-
var pioneerActionsRelations = relations(pioneerActions, ({ one }) => ({
|
|
1215
|
-
pioneer: one(pioneers, {
|
|
1216
|
-
fields: [
|
|
1217
|
-
pioneerActions.pioneerId
|
|
1218
|
-
],
|
|
1219
|
-
references: [
|
|
1220
|
-
pioneers.id
|
|
1221
|
-
]
|
|
1222
|
-
})
|
|
1223
|
-
}));
|
|
1224
|
-
var pioneerTierHistoryRelations = relations(pioneerTierHistory, ({ one }) => ({
|
|
1225
|
-
pioneer: one(pioneers, {
|
|
1226
|
-
fields: [
|
|
1227
|
-
pioneerTierHistory.pioneerId
|
|
1228
|
-
],
|
|
1229
|
-
references: [
|
|
1230
|
-
pioneers.id
|
|
1231
|
-
]
|
|
1232
|
-
})
|
|
1233
|
-
}));
|
|
1234
1117
|
var schema = {
|
|
1235
1118
|
user,
|
|
1236
1119
|
session,
|
|
@@ -1251,9 +1134,6 @@ var schema = {
|
|
|
1251
1134
|
subscriptions,
|
|
1252
1135
|
usageLimits,
|
|
1253
1136
|
newsletterSubscribers,
|
|
1254
|
-
pioneers,
|
|
1255
|
-
pioneerActions,
|
|
1256
|
-
pioneerTierHistory,
|
|
1257
1137
|
waitlist,
|
|
1258
1138
|
waitlistReferrals,
|
|
1259
1139
|
waitlistTasks,
|
|
@@ -1371,8 +1251,6 @@ var emailPreferences = pgTable("email_preferences", {
|
|
|
1371
1251
|
// ../../packages/platform/dist/db/schema/snapback/index.js
|
|
1372
1252
|
var snapback_exports = {};
|
|
1373
1253
|
__export(snapback_exports, {
|
|
1374
|
-
AI_TOOL_OPTIONS: () => AI_TOOL_OPTIONS,
|
|
1375
|
-
IDE_OPTIONS: () => IDE_OPTIONS,
|
|
1376
1254
|
TIER_STALENESS_THRESHOLD_MS: () => TIER_STALENESS_THRESHOLD_MS,
|
|
1377
1255
|
TOPUP_PACKS: () => TOPUP_PACKS,
|
|
1378
1256
|
WORKSPACE_LINK_TTL_MS: () => WORKSPACE_LINK_TTL_MS,
|
|
@@ -1386,7 +1264,6 @@ __export(snapback_exports, {
|
|
|
1386
1264
|
adminAuditLog: () => adminAuditLog,
|
|
1387
1265
|
adminAuditLogRelations: () => adminAuditLogRelations,
|
|
1388
1266
|
adminTargetTypeEnum: () => adminTargetTypeEnum,
|
|
1389
|
-
aiToolEnum: () => aiToolEnum,
|
|
1390
1267
|
analysisEvents: () => analysisEvents,
|
|
1391
1268
|
analysisEventsRelations: () => analysisEventsRelations,
|
|
1392
1269
|
apiKeyMetadata: () => apiKeyMetadata,
|
|
@@ -1398,6 +1275,7 @@ __export(snapback_exports, {
|
|
|
1398
1275
|
apiUsageLogs202511: () => apiUsageLogs202511,
|
|
1399
1276
|
apiUsageLogsRelations: () => apiUsageLogsRelations,
|
|
1400
1277
|
authMethodEnum: () => authMethodEnum,
|
|
1278
|
+
burnInviteCode: () => burnInviteCode,
|
|
1401
1279
|
bypassEvents: () => bypassEvents,
|
|
1402
1280
|
bypassEventsRelations: () => bypassEventsRelations,
|
|
1403
1281
|
capabilityAudit: () => capabilityAudit,
|
|
@@ -1456,6 +1334,7 @@ __export(snapback_exports, {
|
|
|
1456
1334
|
githubPrAnalysesRelations: () => githubPrAnalysesRelations,
|
|
1457
1335
|
intelligencePatterns: () => intelligencePatterns,
|
|
1458
1336
|
intelligencePatternsRelations: () => intelligencePatternsRelations,
|
|
1337
|
+
inviteCodes: () => inviteCodes,
|
|
1459
1338
|
invocationStatusEnum: () => invocationStatusEnum,
|
|
1460
1339
|
invocationTypeEnum: () => invocationTypeEnum,
|
|
1461
1340
|
isValidPackSize: () => isValidPackSize,
|
|
@@ -1484,17 +1363,12 @@ __export(snapback_exports, {
|
|
|
1484
1363
|
orgDailyMetrics: () => orgDailyMetrics,
|
|
1485
1364
|
patterns: () => patterns,
|
|
1486
1365
|
patternsRelations: () => patternsRelations,
|
|
1487
|
-
|
|
1488
|
-
pioneerCodes: () => pioneerCodes,
|
|
1489
|
-
pioneerCodesRelations: () => pioneerCodesRelations,
|
|
1490
|
-
pioneerRedemptions: () => pioneerRedemptions,
|
|
1491
|
-
pioneerRedemptionsRelations: () => pioneerRedemptionsRelations,
|
|
1366
|
+
pendingApiKeys: () => pendingApiKeys,
|
|
1492
1367
|
planTypeEnum: () => planTypeEnum2,
|
|
1493
1368
|
policyEvaluations: () => policyEvaluations,
|
|
1494
1369
|
postAcceptOutcomes: () => postAcceptOutcomes,
|
|
1495
1370
|
predictions: () => predictions,
|
|
1496
1371
|
predictionsRelations: () => predictionsRelations,
|
|
1497
|
-
primaryIdeEnum: () => primaryIdeEnum,
|
|
1498
1372
|
protectionDecisions: () => protectionDecisions,
|
|
1499
1373
|
pulseCountSql: () => pulseCountSql,
|
|
1500
1374
|
quarantineEvents: () => quarantineEvents,
|
|
@@ -3864,218 +3738,50 @@ var patternsRelations = relations(patterns, ({ one }) => ({
|
|
|
3864
3738
|
]
|
|
3865
3739
|
})
|
|
3866
3740
|
}));
|
|
3867
|
-
var
|
|
3868
|
-
"active",
|
|
3869
|
-
"exhausted",
|
|
3870
|
-
"deactivated",
|
|
3871
|
-
"expired"
|
|
3872
|
-
]);
|
|
3873
|
-
var primaryIdeEnum = pgEnum("primary_ide", [
|
|
3874
|
-
"vscode",
|
|
3875
|
-
"cursor",
|
|
3876
|
-
"windsurf",
|
|
3877
|
-
"qoder",
|
|
3878
|
-
"jetbrains",
|
|
3879
|
-
"neovim",
|
|
3880
|
-
"other"
|
|
3881
|
-
]);
|
|
3882
|
-
var aiToolEnum = pgEnum("ai_tool", [
|
|
3883
|
-
"github-copilot",
|
|
3884
|
-
"cursor-ai",
|
|
3885
|
-
"claude-code",
|
|
3886
|
-
"claude-chat",
|
|
3887
|
-
"chatgpt",
|
|
3888
|
-
"codeium",
|
|
3889
|
-
"amazon-q",
|
|
3890
|
-
"gemini",
|
|
3891
|
-
"morph",
|
|
3892
|
-
"other"
|
|
3893
|
-
]);
|
|
3894
|
-
var pioneerCodes = pgTable("pioneer_codes", {
|
|
3741
|
+
var inviteCodes = pgTable("invite_codes", {
|
|
3895
3742
|
id: text("id").primaryKey().$defaultFn(() => nanoid()),
|
|
3896
|
-
// 8-char alphanumeric code (no ambiguous chars: 0/O, 1/I/L)
|
|
3897
3743
|
code: text("code").notNull().unique(),
|
|
3898
|
-
//
|
|
3899
|
-
createdBy: text("created_by")
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
//
|
|
3903
|
-
|
|
3904
|
-
//
|
|
3905
|
-
currentRedemptions: integer("current_redemptions").notNull().default(0),
|
|
3906
|
-
// Code status
|
|
3907
|
-
status: pioneerCodeStatusEnum("status").notNull().default("active"),
|
|
3908
|
-
// Cohort number for segmenting waves
|
|
3909
|
-
cohort: integer("cohort").notNull().default(1),
|
|
3910
|
-
// Optional human-readable label
|
|
3744
|
+
// Creator (null = system-generated)
|
|
3745
|
+
createdBy: text("created_by"),
|
|
3746
|
+
// How many times this code can be redeemed
|
|
3747
|
+
maxUses: integer("max_uses").notNull().default(1),
|
|
3748
|
+
// Running count — incremented atomically on each redemption
|
|
3749
|
+
currentUses: integer("current_uses").notNull().default(0),
|
|
3750
|
+
// Optional human-readable cohort label (e.g. "beta-march-2026")
|
|
3911
3751
|
label: text("label"),
|
|
3912
|
-
// Optional
|
|
3752
|
+
// Optional hard expiry
|
|
3913
3753
|
expiresAt: timestamp("expires_at", {
|
|
3914
3754
|
withTimezone: true
|
|
3915
3755
|
}),
|
|
3916
|
-
// Timestamps
|
|
3917
3756
|
createdAt: timestamp("created_at", {
|
|
3918
3757
|
withTimezone: true
|
|
3919
|
-
}).
|
|
3758
|
+
}).notNull().defaultNow(),
|
|
3920
3759
|
updatedAt: timestamp("updated_at", {
|
|
3921
3760
|
withTimezone: true
|
|
3922
|
-
}).
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
index("pioneer_codes_created_by_idx").on(table.createdBy),
|
|
3926
|
-
index("pioneer_codes_status_idx").on(table.status),
|
|
3927
|
-
index("pioneer_codes_cohort_idx").on(table.cohort),
|
|
3928
|
-
index("pioneer_codes_expires_at_idx").on(table.expiresAt)
|
|
3929
|
-
]);
|
|
3930
|
-
var pioneerRedemptions = pgTable("pioneer_redemptions", {
|
|
3931
|
-
id: text("id").primaryKey().$defaultFn(() => nanoid()),
|
|
3932
|
-
// Reference to the code used
|
|
3933
|
-
codeId: text("code_id").notNull().references(() => pioneerCodes.id, {
|
|
3934
|
-
onDelete: "cascade"
|
|
3935
|
-
}),
|
|
3936
|
-
// User who redeemed the code
|
|
3937
|
-
userId: text("user_id").notNull().references(() => user.id, {
|
|
3938
|
-
onDelete: "cascade"
|
|
3939
|
-
}),
|
|
3940
|
-
// Captured IDE preference
|
|
3941
|
-
primaryIde: primaryIdeEnum("primary_ide").notNull(),
|
|
3942
|
-
// Captured AI tools (stored as JSON array)
|
|
3943
|
-
aiTools: text("ai_tools").array().notNull(),
|
|
3944
|
-
// Timestamps
|
|
3945
|
-
redeemedAt: timestamp("redeemed_at", {
|
|
3946
|
-
withTimezone: true
|
|
3947
|
-
}).defaultNow().notNull(),
|
|
3948
|
-
// HubSpot sync status
|
|
3949
|
-
hubspotSyncedAt: timestamp("hubspot_synced_at", {
|
|
3761
|
+
}).notNull().defaultNow(),
|
|
3762
|
+
// Soft-delete: set to revoke a code without losing audit history
|
|
3763
|
+
revokedAt: timestamp("revoked_at", {
|
|
3950
3764
|
withTimezone: true
|
|
3951
|
-
})
|
|
3952
|
-
|
|
3953
|
-
|
|
3765
|
+
})
|
|
3766
|
+
});
|
|
3767
|
+
var pendingApiKeys = pgTable("pending_api_keys", {
|
|
3768
|
+
userId: text("user_id").primaryKey(),
|
|
3769
|
+
rawKey: text("raw_key").notNull(),
|
|
3770
|
+
expiresAt: timestamp("expires_at", {
|
|
3954
3771
|
withTimezone: true
|
|
3955
|
-
}),
|
|
3956
|
-
|
|
3957
|
-
welcomeEmailSentAt: timestamp("welcome_email_sent_at", {
|
|
3772
|
+
}).notNull(),
|
|
3773
|
+
createdAt: timestamp("created_at", {
|
|
3958
3774
|
withTimezone: true
|
|
3959
|
-
})
|
|
3960
|
-
}
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
pioneerCodes.createdBy
|
|
3970
|
-
],
|
|
3971
|
-
references: [
|
|
3972
|
-
user.id
|
|
3973
|
-
]
|
|
3974
|
-
}),
|
|
3975
|
-
// All redemptions for this code
|
|
3976
|
-
redemptions: many(pioneerRedemptions)
|
|
3977
|
-
}));
|
|
3978
|
-
var pioneerRedemptionsRelations = relations(pioneerRedemptions, ({ one }) => ({
|
|
3979
|
-
// The code that was redeemed
|
|
3980
|
-
code: one(pioneerCodes, {
|
|
3981
|
-
fields: [
|
|
3982
|
-
pioneerRedemptions.codeId
|
|
3983
|
-
],
|
|
3984
|
-
references: [
|
|
3985
|
-
pioneerCodes.id
|
|
3986
|
-
]
|
|
3987
|
-
}),
|
|
3988
|
-
// The user who redeemed
|
|
3989
|
-
user: one(user, {
|
|
3990
|
-
fields: [
|
|
3991
|
-
pioneerRedemptions.userId
|
|
3992
|
-
],
|
|
3993
|
-
references: [
|
|
3994
|
-
user.id
|
|
3995
|
-
]
|
|
3996
|
-
}),
|
|
3997
|
-
// The pioneer profile created from this redemption
|
|
3998
|
-
pioneerProfile: one(pioneers, {
|
|
3999
|
-
fields: [
|
|
4000
|
-
pioneerRedemptions.userId
|
|
4001
|
-
],
|
|
4002
|
-
references: [
|
|
4003
|
-
pioneers.userId
|
|
4004
|
-
]
|
|
4005
|
-
})
|
|
4006
|
-
}));
|
|
4007
|
-
var IDE_OPTIONS = [
|
|
4008
|
-
{
|
|
4009
|
-
value: "vscode",
|
|
4010
|
-
label: "VS Code"
|
|
4011
|
-
},
|
|
4012
|
-
{
|
|
4013
|
-
value: "cursor",
|
|
4014
|
-
label: "Cursor"
|
|
4015
|
-
},
|
|
4016
|
-
{
|
|
4017
|
-
value: "windsurf",
|
|
4018
|
-
label: "Windsurf"
|
|
4019
|
-
},
|
|
4020
|
-
{
|
|
4021
|
-
value: "qoder",
|
|
4022
|
-
label: "Qoder"
|
|
4023
|
-
},
|
|
4024
|
-
{
|
|
4025
|
-
value: "jetbrains",
|
|
4026
|
-
label: "JetBrains (IntelliJ, WebStorm, etc.)"
|
|
4027
|
-
},
|
|
4028
|
-
{
|
|
4029
|
-
value: "neovim",
|
|
4030
|
-
label: "Neovim"
|
|
4031
|
-
},
|
|
4032
|
-
{
|
|
4033
|
-
value: "other",
|
|
4034
|
-
label: "Other"
|
|
4035
|
-
}
|
|
4036
|
-
];
|
|
4037
|
-
var AI_TOOL_OPTIONS = [
|
|
4038
|
-
{
|
|
4039
|
-
value: "github-copilot",
|
|
4040
|
-
label: "GitHub Copilot"
|
|
4041
|
-
},
|
|
4042
|
-
{
|
|
4043
|
-
value: "cursor-ai",
|
|
4044
|
-
label: "Cursor AI"
|
|
4045
|
-
},
|
|
4046
|
-
{
|
|
4047
|
-
value: "claude-code",
|
|
4048
|
-
label: "Claude Code"
|
|
4049
|
-
},
|
|
4050
|
-
{
|
|
4051
|
-
value: "claude-chat",
|
|
4052
|
-
label: "Claude (chat)"
|
|
4053
|
-
},
|
|
4054
|
-
{
|
|
4055
|
-
value: "chatgpt",
|
|
4056
|
-
label: "ChatGPT"
|
|
4057
|
-
},
|
|
4058
|
-
{
|
|
4059
|
-
value: "codeium",
|
|
4060
|
-
label: "Codeium / Windsurf AI"
|
|
4061
|
-
},
|
|
4062
|
-
{
|
|
4063
|
-
value: "amazon-q",
|
|
4064
|
-
label: "Amazon Q"
|
|
4065
|
-
},
|
|
4066
|
-
{
|
|
4067
|
-
value: "gemini",
|
|
4068
|
-
label: "Gemini Code Assist"
|
|
4069
|
-
},
|
|
4070
|
-
{
|
|
4071
|
-
value: "morph",
|
|
4072
|
-
label: "Morph"
|
|
4073
|
-
},
|
|
4074
|
-
{
|
|
4075
|
-
value: "other",
|
|
4076
|
-
label: "Other"
|
|
4077
|
-
}
|
|
4078
|
-
];
|
|
3775
|
+
}).notNull().defaultNow()
|
|
3776
|
+
});
|
|
3777
|
+
async function burnInviteCode(db2, codeId) {
|
|
3778
|
+
const rows = await db2.update(inviteCodes).set({
|
|
3779
|
+
currentUses: sql`${inviteCodes.currentUses} + 1`,
|
|
3780
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
3781
|
+
}).where(and(eq(inviteCodes.id, codeId), sql`${inviteCodes.currentUses} < ${inviteCodes.maxUses}`)).returning();
|
|
3782
|
+
return rows[0] ?? null;
|
|
3783
|
+
}
|
|
3784
|
+
__name(burnInviteCode, "burnInviteCode");
|
|
4079
3785
|
var policyEvaluations = pgTable("policy_evaluations", {
|
|
4080
3786
|
id: uuid("id").primaryKey().defaultRandom().notNull(),
|
|
4081
3787
|
userId: text("user_id").notNull(),
|
|
@@ -5997,9 +5703,9 @@ var snapbackSchema = {
|
|
|
5997
5703
|
webhookEvents,
|
|
5998
5704
|
workspaceLinks,
|
|
5999
5705
|
workspaceSettings,
|
|
6000
|
-
//
|
|
6001
|
-
|
|
6002
|
-
|
|
5706
|
+
// Alpha Invite Code System
|
|
5707
|
+
inviteCodes,
|
|
5708
|
+
pendingApiKeys,
|
|
6003
5709
|
// Intelligence Layer
|
|
6004
5710
|
trustScores,
|
|
6005
5711
|
patterns,
|
|
@@ -6133,4 +5839,4 @@ var closeDatabaseConnection = /* @__PURE__ */ __name(async () => {
|
|
|
6133
5839
|
}
|
|
6134
5840
|
}, "closeDatabaseConnection");
|
|
6135
5841
|
|
|
6136
|
-
export { TIER_STALENESS_THRESHOLD_MS, TOPUP_PACKS, WORKSPACE_LINK_TTL_MS, account, activationCodeRedemptions, activationCodes, adminAuditLog, agentSuggestions, aiChat, analysisEvents, apiKeyMetadata, apiKeyUsage, apiKeys, apiUsage, apiUsageLogs, checkDatabaseConnection, clientTokens, closeDatabaseConnection, combinedSchema, creditJobTypeEnum, creditTopups, creditTransactionStatusEnum, creditTransactionTypeEnum, creditsLedger, db, deviceTrials, emailDeliveries, emailPreferences, extensionSessions, extensionSyncState, featureUsage, feedback, fileSnapshotSessions, fingerprints, getTopupPackDetails, invitation, isValidPackSize, loops, mcpActivityEvents, mcpAggregatedLearnings, mcpObservations, mcpSessions, mcpToolInvocations, member, newsletterSubscribers, orgDailyMetrics, organization, passkey, patterns,
|
|
5842
|
+
export { TIER_STALENESS_THRESHOLD_MS, TOPUP_PACKS, WORKSPACE_LINK_TTL_MS, account, activationCodeRedemptions, activationCodes, adminAuditLog, agentSuggestions, aiChat, analysisEvents, apiKeyMetadata, apiKeyUsage, apiKeys, apiUsage, apiUsageLogs, burnInviteCode, checkDatabaseConnection, clientTokens, closeDatabaseConnection, combinedSchema, creditJobTypeEnum, creditTopups, creditTransactionStatusEnum, creditTransactionTypeEnum, creditsLedger, db, deviceTrials, emailDeliveries, emailPreferences, extensionSessions, extensionSyncState, featureUsage, feedback, fileSnapshotSessions, fingerprints, getTopupPackDetails, invitation, inviteCodes, isValidPackSize, loops, mcpActivityEvents, mcpAggregatedLearnings, mcpObservations, mcpSessions, mcpToolInvocations, member, newsletterSubscribers, orgDailyMetrics, organization, passkey, patterns, pendingApiKeys, policyEvaluations, pool, postAcceptOutcomes, postgres_exports, purchase, quarantineEvents, rateLimitViolations, responseCache, retentionConfig, rollbackEvents, ruleViolations, sagas, securityEvents, session, snapbackSchema, snapshotFiles, snapshots, subscriptions, superAdmins, telemetryDailyStats, telemetryEvents, telemetryIdempotencyKeys, telemetryOutbox, topupStatusEnum, trials, usageLimits, user, userAttributions, userProductMetrics, userSafetyProfiles, verification, waitlist, waitlistAuditLogs, waitlistReferrals, waitlistTasks };
|
|
@@ -50,7 +50,7 @@ async function emitPostHogEvent(eventType, metadata) {
|
|
|
50
50
|
__name(emitPostHogEvent, "emitPostHogEvent");
|
|
51
51
|
async function writeAuditLog(eventType, metadata) {
|
|
52
52
|
try {
|
|
53
|
-
const { db, snapbackSchema } = await import('./dist-
|
|
53
|
+
const { db, snapbackSchema } = await import('./dist-CUHOKNLS.js');
|
|
54
54
|
if (!db) {
|
|
55
55
|
logger.warn("Database not available for audit logging", {
|
|
56
56
|
eventType
|