@automagik/omni 2.260502.2 → 2.260503.2
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/db/drizzle/0036_timestamptz_migration.sql +150 -0
- package/db/drizzle/meta/_journal.json +7 -0
- package/dist/index.js +100 -100
- package/dist/server/index.js +770 -134
- package/package.json +10 -10
package/dist/server/index.js
CHANGED
|
@@ -224686,7 +224686,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
224686
224686
|
var require_package8 = __commonJS((exports, module) => {
|
|
224687
224687
|
module.exports = {
|
|
224688
224688
|
name: "@omni/api",
|
|
224689
|
-
version: "2.
|
|
224689
|
+
version: "2.260503.2",
|
|
224690
224690
|
type: "module",
|
|
224691
224691
|
exports: {
|
|
224692
224692
|
".": {
|
|
@@ -230257,11 +230257,11 @@ var init_schema2 = __esm(() => {
|
|
|
230257
230257
|
description: text("description"),
|
|
230258
230258
|
tags: text("tags").array(),
|
|
230259
230259
|
isActive: boolean("is_active").notNull().default(true),
|
|
230260
|
-
lastHealthCheck: timestamp("last_health_check"),
|
|
230260
|
+
lastHealthCheck: timestamp("last_health_check", { withTimezone: true }),
|
|
230261
230261
|
lastHealthStatus: varchar("last_health_status", { length: 20 }),
|
|
230262
230262
|
lastHealthError: text("last_health_error"),
|
|
230263
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230264
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230263
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230264
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230265
230265
|
}, (table3) => ({
|
|
230266
230266
|
nameIdx: index("agent_providers_name_idx").on(table3.name),
|
|
230267
230267
|
schemaIdx: index("agent_providers_schema_idx").on(table3.schema),
|
|
@@ -230282,8 +230282,8 @@ var init_schema2 = __esm(() => {
|
|
|
230282
230282
|
metadata: jsonb("metadata").$type(),
|
|
230283
230283
|
agentCard: jsonb("agent_card").$type(),
|
|
230284
230284
|
followUpConfig: jsonb("follow_up_config").$type(),
|
|
230285
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230286
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230285
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230286
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230287
230287
|
}, (table3) => ({
|
|
230288
230288
|
nameIdx: index("agents_name_idx").on(table3.name),
|
|
230289
230289
|
ownerIdx: index("agents_owner_idx").on(table3.ownerId),
|
|
@@ -230325,8 +230325,8 @@ var init_schema2 = __esm(() => {
|
|
|
230325
230325
|
label: varchar("label", { length: 255 }),
|
|
230326
230326
|
priority: integer("priority").notNull().default(0),
|
|
230327
230327
|
isActive: boolean("is_active").notNull().default(true),
|
|
230328
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230329
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230328
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230329
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230330
230330
|
}, (table3) => ({
|
|
230331
230331
|
scopeCheck: check("scope_check", sql`(scope = 'chat' AND chat_id IS NOT NULL AND person_id IS NULL) OR (scope = 'user' AND person_id IS NOT NULL AND chat_id IS NULL)`),
|
|
230332
230332
|
uniqueChatRoute: uniqueIndex("agent_routes_unique_chat_route").on(table3.instanceId, table3.chatId),
|
|
@@ -230342,10 +230342,10 @@ var init_schema2 = __esm(() => {
|
|
|
230342
230342
|
instanceId: uuid("instance_id").notNull().references(() => instances.id, { onDelete: "cascade" }),
|
|
230343
230343
|
sessionKey: varchar("session_key", { length: 512 }).notNull(),
|
|
230344
230344
|
providerSessionData: jsonb("provider_session_data").notNull().$type(),
|
|
230345
|
-
lastUsedAt: timestamp("last_used_at").notNull().defaultNow(),
|
|
230346
|
-
expiresAt: timestamp("expires_at"),
|
|
230347
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230348
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230345
|
+
lastUsedAt: timestamp("last_used_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230346
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
230347
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230348
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230349
230349
|
}, (table3) => ({
|
|
230350
230350
|
uniqueSession: uniqueIndex("agent_sessions_instance_key_idx").on(table3.instanceId, table3.sessionKey),
|
|
230351
230351
|
expiresIdx: index("agent_sessions_expires_idx").on(table3.expiresAt),
|
|
@@ -230366,21 +230366,21 @@ var init_schema2 = __esm(() => {
|
|
|
230366
230366
|
instanceIds: uuid("instance_ids").array(),
|
|
230367
230367
|
status: varchar("status", { length: 20 }).notNull().default("active").$type(),
|
|
230368
230368
|
rateLimit: integer("rate_limit"),
|
|
230369
|
-
expiresAt: timestamp("expires_at"),
|
|
230370
|
-
lastUsedAt: timestamp("last_used_at"),
|
|
230369
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
230370
|
+
lastUsedAt: timestamp("last_used_at", { withTimezone: true }),
|
|
230371
230371
|
lastUsedIp: varchar("last_used_ip", { length: 45 }),
|
|
230372
230372
|
usageCount: integer("usage_count").notNull().default(0),
|
|
230373
|
-
revokedAt: timestamp("revoked_at"),
|
|
230373
|
+
revokedAt: timestamp("revoked_at", { withTimezone: true }),
|
|
230374
230374
|
revokedBy: varchar("revoked_by", { length: 255 }),
|
|
230375
230375
|
revokeReason: text("revoke_reason"),
|
|
230376
230376
|
activeInstanceId: uuid("active_instance_id"),
|
|
230377
230377
|
contextInstanceId: uuid("context_instance_id"),
|
|
230378
230378
|
contextChatId: uuid("context_chat_id"),
|
|
230379
230379
|
contextMessageId: uuid("context_message_id"),
|
|
230380
|
-
contextUpdatedAt: timestamp("context_updated_at"),
|
|
230381
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230380
|
+
contextUpdatedAt: timestamp("context_updated_at", { withTimezone: true }),
|
|
230381
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230382
230382
|
createdBy: varchar("created_by", { length: 255 }),
|
|
230383
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230383
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230384
230384
|
}, (table3) => ({
|
|
230385
230385
|
keyPrefixIdx: index("api_keys_key_prefix_idx").on(table3.keyPrefix),
|
|
230386
230386
|
keyHashIdx: uniqueIndex("api_keys_key_hash_idx").on(table3.keyHash),
|
|
@@ -230396,7 +230396,7 @@ var init_schema2 = __esm(() => {
|
|
|
230396
230396
|
ipAddress: varchar("ip_address", { length: 45 }),
|
|
230397
230397
|
userAgent: text("user_agent"),
|
|
230398
230398
|
responseTimeMs: integer("response_time_ms"),
|
|
230399
|
-
timestamp: timestamp("timestamp").notNull().defaultNow()
|
|
230399
|
+
timestamp: timestamp("timestamp", { withTimezone: true }).notNull().defaultNow()
|
|
230400
230400
|
}, (table3) => ({
|
|
230401
230401
|
apiKeyIdx: index("api_key_audit_logs_api_key_idx").on(table3.apiKeyId),
|
|
230402
230402
|
timestampIdx: index("api_key_audit_logs_timestamp_idx").on(table3.timestamp),
|
|
@@ -230451,7 +230451,7 @@ var init_schema2 = __esm(() => {
|
|
|
230451
230451
|
profilePicUrl: text("profile_pic_url"),
|
|
230452
230452
|
profileBio: text("profile_bio"),
|
|
230453
230453
|
profileMetadata: jsonb("profile_metadata").$type(),
|
|
230454
|
-
profileSyncedAt: timestamp("profile_synced_at"),
|
|
230454
|
+
profileSyncedAt: timestamp("profile_synced_at", { withTimezone: true }),
|
|
230455
230455
|
ownerIdentifier: varchar("owner_identifier", { length: 255 }),
|
|
230456
230456
|
downloadMediaOnSync: boolean("download_media_on_sync").notNull().default(false),
|
|
230457
230457
|
isDefault: boolean("is_default").notNull().default(false),
|
|
@@ -230490,9 +230490,9 @@ var init_schema2 = __esm(() => {
|
|
|
230490
230490
|
readReceipts: varchar("read_receipts", { length: 20 }).notNull().default("on").$type(),
|
|
230491
230491
|
markOnlineOnConnect: boolean("mark_online_on_connect").notNull().default(true),
|
|
230492
230492
|
groupHistorySize: integer("group_history_size").notNull().default(50),
|
|
230493
|
-
lastMessageAt: timestamp("last_message_at"),
|
|
230493
|
+
lastMessageAt: timestamp("last_message_at", { withTimezone: true }),
|
|
230494
230494
|
replayEnabled: boolean("replay_enabled").notNull().default(true),
|
|
230495
|
-
lastSeenAt: timestamp("last_seen_at"),
|
|
230495
|
+
lastSeenAt: timestamp("last_seen_at", { withTimezone: true }),
|
|
230496
230496
|
agentStalledTimeoutMs: integer("agent_stalled_timeout_ms").notNull().default(600000),
|
|
230497
230497
|
agentChainToInstanceId: uuid("agent_chain_to_instance_id").references(() => instances.id, {
|
|
230498
230498
|
onDelete: "set null"
|
|
@@ -230501,8 +230501,8 @@ var init_schema2 = __esm(() => {
|
|
|
230501
230501
|
followUpConfig: jsonb("follow_up_config").$type(),
|
|
230502
230502
|
bridgeTmuxSession: text("bridge_tmux_session"),
|
|
230503
230503
|
requireGenieSignature: boolean("require_genie_signature").notNull().default(false),
|
|
230504
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230505
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230504
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230505
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230506
230506
|
}, (table3) => ({
|
|
230507
230507
|
nameIdx: uniqueIndex("instances_name_idx").on(table3.name),
|
|
230508
230508
|
channelIdx: index("instances_channel_idx").on(table3.channel),
|
|
@@ -230518,8 +230518,8 @@ var init_schema2 = __esm(() => {
|
|
|
230518
230518
|
primaryEmail: varchar("primary_email", { length: 255 }),
|
|
230519
230519
|
avatarUrl: text("avatar_url"),
|
|
230520
230520
|
metadata: jsonb("metadata").$type(),
|
|
230521
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230522
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230521
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230522
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230523
230523
|
}, (table3) => ({
|
|
230524
230524
|
phoneIdx: uniqueIndex("persons_phone_idx").on(table3.primaryPhone),
|
|
230525
230525
|
emailIdx: index("persons_email_idx").on(table3.primaryEmail),
|
|
@@ -230536,13 +230536,13 @@ var init_schema2 = __esm(() => {
|
|
|
230536
230536
|
profilePicUrl: text("profile_pic_url"),
|
|
230537
230537
|
profileData: jsonb("profile_data").$type(),
|
|
230538
230538
|
messageCount: integer("message_count").notNull().default(0),
|
|
230539
|
-
lastSeenAt: timestamp("last_seen_at"),
|
|
230540
|
-
firstSeenAt: timestamp("first_seen_at").notNull().defaultNow(),
|
|
230539
|
+
lastSeenAt: timestamp("last_seen_at", { withTimezone: true }),
|
|
230540
|
+
firstSeenAt: timestamp("first_seen_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230541
230541
|
linkedBy: varchar("linked_by", { length: 50 }),
|
|
230542
230542
|
confidence: integer("confidence").notNull().default(100),
|
|
230543
230543
|
linkReason: text("link_reason"),
|
|
230544
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230545
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230544
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230545
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230546
230546
|
}, (table3) => ({
|
|
230547
230547
|
personIdx: index("platform_identities_person_idx").on(table3.personId),
|
|
230548
230548
|
agentIdx: index("platform_identities_agent_idx").on(table3.agentId),
|
|
@@ -230557,8 +230557,8 @@ var init_schema2 = __esm(() => {
|
|
|
230557
230557
|
title: varchar("title", { length: 500 }),
|
|
230558
230558
|
summary: text("summary"),
|
|
230559
230559
|
state: jsonb("state").$type(),
|
|
230560
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230561
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230560
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230561
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230562
230562
|
}, (table3) => ({
|
|
230563
230563
|
createdAtIdx: index("conversations_created_at_idx").on(table3.createdAt),
|
|
230564
230564
|
updatedAtIdx: index("conversations_updated_at_idx").on(table3.updatedAt)
|
|
@@ -230577,7 +230577,7 @@ var init_schema2 = __esm(() => {
|
|
|
230577
230577
|
participantCount: integer("participant_count").notNull().default(0),
|
|
230578
230578
|
messageCount: integer("message_count").notNull().default(0),
|
|
230579
230579
|
unreadCount: integer("unread_count").notNull().default(0),
|
|
230580
|
-
lastMessageAt: timestamp("last_message_at"),
|
|
230580
|
+
lastMessageAt: timestamp("last_message_at", { withTimezone: true }),
|
|
230581
230581
|
lastMessagePreview: text("last_message_preview"),
|
|
230582
230582
|
lastMessageFromMe: boolean("last_message_from_me"),
|
|
230583
230583
|
visibility: varchar("visibility", { length: 20 }).notNull().default("visible"),
|
|
@@ -230585,10 +230585,10 @@ var init_schema2 = __esm(() => {
|
|
|
230585
230585
|
settings: jsonb("settings").$type(),
|
|
230586
230586
|
platformMetadata: jsonb("platform_metadata").$type(),
|
|
230587
230587
|
conversationId: uuid("conversation_id").references(() => conversations.id, { onDelete: "set null" }),
|
|
230588
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230589
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
|
230590
|
-
archivedAt: timestamp("archived_at"),
|
|
230591
|
-
deletedAt: timestamp("deleted_at")
|
|
230588
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230589
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230590
|
+
archivedAt: timestamp("archived_at", { withTimezone: true }),
|
|
230591
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
230592
230592
|
}, (table3) => ({
|
|
230593
230593
|
instanceExternalIdx: uniqueIndex("chats_instance_external_idx").on(table3.instanceId, table3.externalId),
|
|
230594
230594
|
canonicalIdIdx: index("chats_canonical_id_idx").on(table3.canonicalId),
|
|
@@ -230609,13 +230609,13 @@ var init_schema2 = __esm(() => {
|
|
|
230609
230609
|
avatarUrl: text("avatar_url"),
|
|
230610
230610
|
role: varchar("role", { length: 50 }),
|
|
230611
230611
|
isActive: boolean("is_active").notNull().default(true),
|
|
230612
|
-
joinedAt: timestamp("joined_at").notNull().defaultNow(),
|
|
230613
|
-
leftAt: timestamp("left_at"),
|
|
230614
|
-
lastSeenAt: timestamp("last_seen_at"),
|
|
230612
|
+
joinedAt: timestamp("joined_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230613
|
+
leftAt: timestamp("left_at", { withTimezone: true }),
|
|
230614
|
+
lastSeenAt: timestamp("last_seen_at", { withTimezone: true }),
|
|
230615
230615
|
messageCount: integer("message_count").notNull().default(0),
|
|
230616
230616
|
platformMetadata: jsonb("platform_metadata").$type(),
|
|
230617
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230618
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230617
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230618
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230619
230619
|
}, (table3) => ({
|
|
230620
230620
|
chatUserIdx: uniqueIndex("chat_participants_chat_user_idx").on(table3.chatId, table3.platformUserId),
|
|
230621
230621
|
chatIdx: index("chat_participants_chat_idx").on(table3.chatId),
|
|
@@ -230637,9 +230637,9 @@ var init_schema2 = __esm(() => {
|
|
|
230637
230637
|
isReadOnly: boolean("is_read_only").notNull().default(false),
|
|
230638
230638
|
isCommunity: boolean("is_community").notNull().default(false),
|
|
230639
230639
|
platformMetadata: jsonb("platform_metadata").$type(),
|
|
230640
|
-
syncedAt: timestamp("synced_at").notNull().defaultNow(),
|
|
230641
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230642
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230640
|
+
syncedAt: timestamp("synced_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230641
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230642
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230643
230643
|
}, (table3) => ({
|
|
230644
230644
|
instanceExternalIdx: uniqueIndex("omni_groups_instance_external_idx").on(table3.instanceId, table3.externalId),
|
|
230645
230645
|
instanceIdx: index("omni_groups_instance_idx").on(table3.instanceId),
|
|
@@ -230684,17 +230684,17 @@ var init_schema2 = __esm(() => {
|
|
|
230684
230684
|
editCount: integer("edit_count").notNull().default(0),
|
|
230685
230685
|
originalText: text("original_text"),
|
|
230686
230686
|
editHistory: jsonb("edit_history").$type(),
|
|
230687
|
-
editedAt: timestamp("edited_at"),
|
|
230688
|
-
deletedAt: timestamp("deleted_at"),
|
|
230687
|
+
editedAt: timestamp("edited_at", { withTimezone: true }),
|
|
230688
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true }),
|
|
230689
230689
|
reactions: jsonb("reactions").$type(),
|
|
230690
230690
|
reactionCounts: jsonb("reaction_counts").$type(),
|
|
230691
230691
|
rawPayload: jsonb("raw_payload").$type(),
|
|
230692
230692
|
originalEventId: uuid("original_event_id"),
|
|
230693
230693
|
latestEventId: uuid("latest_event_id"),
|
|
230694
|
-
platformTimestamp: timestamp("platform_timestamp").notNull(),
|
|
230695
|
-
receivedAt: timestamp("received_at").notNull().defaultNow(),
|
|
230696
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230697
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230694
|
+
platformTimestamp: timestamp("platform_timestamp", { withTimezone: true }).notNull(),
|
|
230695
|
+
receivedAt: timestamp("received_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230696
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230697
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230698
230698
|
}, (table3) => ({
|
|
230699
230699
|
chatExternalIdx: uniqueIndex("messages_chat_external_idx").on(table3.chatId, table3.externalId),
|
|
230700
230700
|
chatIdx: index("messages_chat_idx").on(table3.chatId),
|
|
@@ -230739,10 +230739,10 @@ var init_schema2 = __esm(() => {
|
|
|
230739
230739
|
status: varchar("status", { length: 20 }).notNull().default("received"),
|
|
230740
230740
|
errorMessage: text("error_message"),
|
|
230741
230741
|
errorStage: varchar("error_stage", { length: 50 }),
|
|
230742
|
-
receivedAt: timestamp("received_at").notNull().defaultNow(),
|
|
230743
|
-
processedAt: timestamp("processed_at"),
|
|
230744
|
-
deliveredAt: timestamp("delivered_at"),
|
|
230745
|
-
readAt: timestamp("read_at"),
|
|
230742
|
+
receivedAt: timestamp("received_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230743
|
+
processedAt: timestamp("processed_at", { withTimezone: true }),
|
|
230744
|
+
deliveredAt: timestamp("delivered_at", { withTimezone: true }),
|
|
230745
|
+
readAt: timestamp("read_at", { withTimezone: true }),
|
|
230746
230746
|
processingTimeMs: integer("processing_time_ms"),
|
|
230747
230747
|
agentLatencyMs: integer("agent_latency_ms"),
|
|
230748
230748
|
totalLatencyMs: integer("total_latency_ms"),
|
|
@@ -230750,7 +230750,7 @@ var init_schema2 = __esm(() => {
|
|
|
230750
230750
|
agentRequest: jsonb("agent_request").$type(),
|
|
230751
230751
|
agentResponse: jsonb("agent_response").$type(),
|
|
230752
230752
|
metadata: jsonb("metadata").$type(),
|
|
230753
|
-
createdAt: timestamp("created_at").notNull().defaultNow()
|
|
230753
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
230754
230754
|
}, (table3) => ({
|
|
230755
230755
|
externalIdIdx: index("omni_events_external_id_idx").on(table3.externalId),
|
|
230756
230756
|
channelIdx: index("omni_events_channel_idx").on(table3.channel),
|
|
@@ -230776,7 +230776,7 @@ var init_schema2 = __esm(() => {
|
|
|
230776
230776
|
agentId: uuid("agent_id").references(() => agents.id, { onDelete: "set null" }),
|
|
230777
230777
|
externalMessageId: varchar("external_message_id", { length: 255 }),
|
|
230778
230778
|
handoffFields: jsonb("handoff_fields").$type(),
|
|
230779
|
-
sentAt: timestamp("sent_at").notNull().defaultNow(),
|
|
230779
|
+
sentAt: timestamp("sent_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230780
230780
|
metadata: jsonb("metadata").$type()
|
|
230781
230781
|
}, (table3) => ({
|
|
230782
230782
|
instanceIdx: index("handoff_logs_instance_idx").on(table3.instanceId),
|
|
@@ -230817,12 +230817,12 @@ var init_schema2 = __esm(() => {
|
|
|
230817
230817
|
priority: integer("priority").notNull().default(0),
|
|
230818
230818
|
enabled: boolean("enabled").notNull().default(true),
|
|
230819
230819
|
reason: text("reason"),
|
|
230820
|
-
expiresAt: timestamp("expires_at"),
|
|
230820
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
230821
230821
|
action: varchar("action", { length: 20 }).notNull().default("block"),
|
|
230822
230822
|
blockMessage: text("block_message"),
|
|
230823
230823
|
metadata: jsonb("metadata").$type(),
|
|
230824
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230825
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230824
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230825
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230826
230826
|
}, (table3) => ({
|
|
230827
230827
|
instanceIdx: index("access_rules_instance_idx").on(table3.instanceId),
|
|
230828
230828
|
phoneIdx: index("access_rules_phone_idx").on(table3.phonePattern),
|
|
@@ -230841,8 +230841,8 @@ var init_schema2 = __esm(() => {
|
|
|
230841
230841
|
isRequired: boolean("is_required").notNull().default(false),
|
|
230842
230842
|
defaultValue: text("default_value"),
|
|
230843
230843
|
validationRules: jsonb("validation_rules").$type(),
|
|
230844
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230845
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
|
230844
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230845
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230846
230846
|
createdBy: varchar("created_by", { length: 255 }),
|
|
230847
230847
|
updatedBy: varchar("updated_by", { length: 255 })
|
|
230848
230848
|
}, (table3) => ({
|
|
@@ -230855,7 +230855,7 @@ var init_schema2 = __esm(() => {
|
|
|
230855
230855
|
oldValue: text("old_value"),
|
|
230856
230856
|
newValue: text("new_value"),
|
|
230857
230857
|
changedBy: varchar("changed_by", { length: 255 }),
|
|
230858
|
-
changedAt: timestamp("changed_at").notNull().defaultNow(),
|
|
230858
|
+
changedAt: timestamp("changed_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230859
230859
|
changeReason: text("change_reason")
|
|
230860
230860
|
}, (table3) => ({
|
|
230861
230861
|
settingIdx: index("setting_change_history_setting_idx").on(table3.settingId),
|
|
@@ -230876,9 +230876,9 @@ var init_schema2 = __esm(() => {
|
|
|
230876
230876
|
totalTokens: integer("total_tokens"),
|
|
230877
230877
|
errorMessage: text("error_message"),
|
|
230878
230878
|
errors: jsonb("errors").$type(),
|
|
230879
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230880
|
-
startedAt: timestamp("started_at"),
|
|
230881
|
-
completedAt: timestamp("completed_at")
|
|
230879
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230880
|
+
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
230881
|
+
completedAt: timestamp("completed_at", { withTimezone: true })
|
|
230882
230882
|
}, (table3) => ({
|
|
230883
230883
|
statusIdx: index("batch_jobs_status_idx").on(table3.status),
|
|
230884
230884
|
instanceIdx: index("batch_jobs_instance_idx").on(table3.instanceId),
|
|
@@ -230894,9 +230894,9 @@ var init_schema2 = __esm(() => {
|
|
|
230894
230894
|
config: jsonb("config").notNull().default("{}").$type(),
|
|
230895
230895
|
progress: jsonb("progress").notNull().default("{}").$type(),
|
|
230896
230896
|
errorMessage: text("error_message"),
|
|
230897
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230898
|
-
startedAt: timestamp("started_at"),
|
|
230899
|
-
completedAt: timestamp("completed_at")
|
|
230897
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230898
|
+
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
230899
|
+
completedAt: timestamp("completed_at", { withTimezone: true })
|
|
230900
230900
|
}, (table3) => ({
|
|
230901
230901
|
instanceIdx: index("sync_jobs_instance_idx").on(table3.instanceId),
|
|
230902
230902
|
statusIdx: index("sync_jobs_status_idx").on(table3.status),
|
|
@@ -230917,7 +230917,7 @@ var init_schema2 = __esm(() => {
|
|
|
230917
230917
|
costUsd: numeric("cost_usd", { precision: 15, scale: 6 }),
|
|
230918
230918
|
batchJobId: uuid("batch_job_id").references(() => batchJobs.id, { onDelete: "set null" }),
|
|
230919
230919
|
processingTimeMs: integer("processing_time_ms"),
|
|
230920
|
-
createdAt: timestamp("created_at").notNull().defaultNow()
|
|
230920
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
230921
230921
|
}, (table3) => ({
|
|
230922
230922
|
eventIdx: index("media_content_event_idx").on(table3.eventId),
|
|
230923
230923
|
mediaIdx: index("media_content_media_idx").on(table3.mediaId),
|
|
@@ -230928,7 +230928,7 @@ var init_schema2 = __esm(() => {
|
|
|
230928
230928
|
instanceId: uuid("instance_id").notNull().references(() => instances.id, { onDelete: "cascade" }),
|
|
230929
230929
|
lidId: varchar("lid_id", { length: 255 }).notNull(),
|
|
230930
230930
|
phoneId: varchar("phone_id", { length: 255 }).notNull(),
|
|
230931
|
-
discoveredAt: timestamp("discovered_at").notNull().defaultNow(),
|
|
230931
|
+
discoveredAt: timestamp("discovered_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230932
230932
|
discoveredFrom: varchar("discovered_from", { length: 50 })
|
|
230933
230933
|
}, (table3) => ({
|
|
230934
230934
|
instanceLidIdx: uniqueIndex("chat_id_mappings_instance_lid_idx").on(table3.instanceId, table3.lidId),
|
|
@@ -230939,9 +230939,9 @@ var init_schema2 = __esm(() => {
|
|
|
230939
230939
|
pluginId: varchar("plugin_id", { length: 100 }).notNull(),
|
|
230940
230940
|
key: varchar("key", { length: 500 }).notNull(),
|
|
230941
230941
|
value: text("value").notNull(),
|
|
230942
|
-
expiresAt: timestamp("expires_at"),
|
|
230943
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
230944
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
230942
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
230943
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
230944
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
230945
230945
|
}, (table3) => ({
|
|
230946
230946
|
pluginKeyIdx: uniqueIndex("plugin_storage_plugin_key_idx").on(table3.pluginId, table3.key),
|
|
230947
230947
|
pluginIdx: index("plugin_storage_plugin_idx").on(table3.pluginId),
|
|
@@ -231156,11 +231156,11 @@ var init_schema2 = __esm(() => {
|
|
|
231156
231156
|
stack: text("stack"),
|
|
231157
231157
|
autoRetryCount: integer("auto_retry_count").notNull().default(0),
|
|
231158
231158
|
manualRetryCount: integer("manual_retry_count").notNull().default(0),
|
|
231159
|
-
nextAutoRetryAt: timestamp("next_auto_retry_at"),
|
|
231159
|
+
nextAutoRetryAt: timestamp("next_auto_retry_at", { withTimezone: true }),
|
|
231160
231160
|
status: varchar("status", { length: 20 }).notNull().default("pending").$type(),
|
|
231161
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
231162
|
-
lastRetryAt: timestamp("last_retry_at"),
|
|
231163
|
-
resolvedAt: timestamp("resolved_at"),
|
|
231161
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
231162
|
+
lastRetryAt: timestamp("last_retry_at", { withTimezone: true }),
|
|
231163
|
+
resolvedAt: timestamp("resolved_at", { withTimezone: true }),
|
|
231164
231164
|
resolvedBy: varchar("resolved_by", { length: 100 })
|
|
231165
231165
|
}, (table3) => ({
|
|
231166
231166
|
eventIdIdx: index("dead_letter_events_event_id_idx").on(table3.eventId),
|
|
@@ -231178,8 +231178,8 @@ var init_schema2 = __esm(() => {
|
|
|
231178
231178
|
storeChannelSend: boolean("store_channel_send").notNull().default(true),
|
|
231179
231179
|
storeError: boolean("store_error").notNull().default(true),
|
|
231180
231180
|
retentionDays: integer("retention_days").notNull().default(14),
|
|
231181
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
231182
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
231181
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
231182
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
231183
231183
|
}, (table3) => ({
|
|
231184
231184
|
eventTypeIdx: uniqueIndex("payload_storage_config_event_type_idx").on(table3.eventType)
|
|
231185
231185
|
}));
|
|
@@ -231192,10 +231192,10 @@ var init_schema2 = __esm(() => {
|
|
|
231192
231192
|
payloadCompressed: text("payload_compressed").notNull(),
|
|
231193
231193
|
payloadSizeOriginal: integer("payload_size_original"),
|
|
231194
231194
|
payloadSizeCompressed: integer("payload_size_compressed"),
|
|
231195
|
-
timestamp: timestamp("timestamp").notNull().defaultNow(),
|
|
231195
|
+
timestamp: timestamp("timestamp", { withTimezone: true }).notNull().defaultNow(),
|
|
231196
231196
|
containsMedia: boolean("contains_media").notNull().default(false),
|
|
231197
231197
|
containsBase64: boolean("contains_base64").notNull().default(false),
|
|
231198
|
-
deletedAt: timestamp("deleted_at"),
|
|
231198
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true }),
|
|
231199
231199
|
deletedBy: varchar("deleted_by", { length: 100 }),
|
|
231200
231200
|
deleteReason: varchar("delete_reason", { length: 255 })
|
|
231201
231201
|
}, (table3) => ({
|
|
@@ -231212,10 +231212,10 @@ var init_schema2 = __esm(() => {
|
|
|
231212
231212
|
description: text("description"),
|
|
231213
231213
|
expectedHeaders: jsonb("expected_headers").$type(),
|
|
231214
231214
|
enabled: boolean("enabled").notNull().default(true),
|
|
231215
|
-
lastReceivedAt: timestamp("last_received_at"),
|
|
231215
|
+
lastReceivedAt: timestamp("last_received_at", { withTimezone: true }),
|
|
231216
231216
|
totalReceived: integer("total_received").notNull().default(0),
|
|
231217
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
231218
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
231217
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
231218
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
231219
231219
|
}, (table3) => ({
|
|
231220
231220
|
nameIdx: uniqueIndex("webhook_sources_name_idx").on(table3.name),
|
|
231221
231221
|
enabledIdx: index("webhook_sources_enabled_idx").on(table3.enabled)
|
|
@@ -231246,8 +231246,8 @@ var init_schema2 = __esm(() => {
|
|
|
231246
231246
|
debounce: jsonb("debounce").$type(),
|
|
231247
231247
|
enabled: boolean("enabled").notNull().default(true),
|
|
231248
231248
|
priority: integer("priority").notNull().default(0),
|
|
231249
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
231250
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
231249
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
231250
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
231251
231251
|
}, (table3) => ({
|
|
231252
231252
|
nameIdx: index("automations_name_idx").on(table3.name),
|
|
231253
231253
|
triggerIdx: index("automations_trigger_idx").on(table3.triggerEventType),
|
|
@@ -231264,7 +231264,7 @@ var init_schema2 = __esm(() => {
|
|
|
231264
231264
|
actionsExecuted: jsonb("actions_executed").$type(),
|
|
231265
231265
|
error: text("error"),
|
|
231266
231266
|
executionTimeMs: integer("execution_time_ms"),
|
|
231267
|
-
createdAt: timestamp("created_at").notNull().defaultNow()
|
|
231267
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
231268
231268
|
}, (table3) => ({
|
|
231269
231269
|
automationIdx: index("automation_logs_automation_idx").on(table3.automationId),
|
|
231270
231270
|
eventIdIdx: index("automation_logs_event_id_idx").on(table3.eventId),
|
|
@@ -231276,7 +231276,7 @@ var init_schema2 = __esm(() => {
|
|
|
231276
231276
|
streamName: varchar("stream_name", { length: 50 }).notNull(),
|
|
231277
231277
|
lastSequence: integer("last_sequence").notNull().default(0),
|
|
231278
231278
|
lastEventId: uuid("last_event_id"),
|
|
231279
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
231279
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
231280
231280
|
});
|
|
231281
231281
|
automationsRelations = relations(automations2, ({ many }) => ({
|
|
231282
231282
|
logs: many(automationLogs)
|
|
@@ -231355,9 +231355,9 @@ var init_schema2 = __esm(() => {
|
|
|
231355
231355
|
parentTaskId: uuid("parent_task_id").references(() => agentTasks.id, { onDelete: "set null" }),
|
|
231356
231356
|
subtaskCount: integer("subtask_count").notNull().default(0),
|
|
231357
231357
|
completedSubtaskCount: integer("completed_subtask_count").notNull().default(0),
|
|
231358
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
231359
|
-
startedAt: timestamp("started_at"),
|
|
231360
|
-
completedAt: timestamp("completed_at")
|
|
231358
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
231359
|
+
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
231360
|
+
completedAt: timestamp("completed_at", { withTimezone: true })
|
|
231361
231361
|
}, (table3) => ({
|
|
231362
231362
|
agentIdIdx: index("agent_tasks_agent_id_idx").on(table3.agentId),
|
|
231363
231363
|
chatIdIdx: index("agent_tasks_chat_id_idx").on(table3.chatId),
|
|
@@ -231406,9 +231406,9 @@ var init_schema2 = __esm(() => {
|
|
|
231406
231406
|
action: varchar("action", { length: 20 }).$type(),
|
|
231407
231407
|
nudgeCount: integer("nudge_count").notNull().default(0),
|
|
231408
231408
|
messagesSent: integer("messages_sent").notNull().default(0),
|
|
231409
|
-
startedAt: timestamp("started_at").notNull().defaultNow(),
|
|
231410
|
-
lastActivityAt: timestamp("last_activity_at").notNull().defaultNow(),
|
|
231411
|
-
closedAt: timestamp("closed_at"),
|
|
231409
|
+
startedAt: timestamp("started_at", { withTimezone: true }).notNull().defaultNow(),
|
|
231410
|
+
lastActivityAt: timestamp("last_activity_at", { withTimezone: true }).notNull().defaultNow(),
|
|
231411
|
+
closedAt: timestamp("closed_at", { withTimezone: true }),
|
|
231412
231412
|
closedReason: text("closed_reason"),
|
|
231413
231413
|
metadata: jsonb("metadata").$type()
|
|
231414
231414
|
}, (table3) => ({
|
|
@@ -231481,7 +231481,7 @@ var init_schema2 = __esm(() => {
|
|
|
231481
231481
|
processedEvents = pgTable("processed_events", {
|
|
231482
231482
|
eventId: varchar("event_id", { length: 255 }).notNull(),
|
|
231483
231483
|
handler: varchar("handler", { length: 100 }).notNull(),
|
|
231484
|
-
processedAt: timestamp("processed_at").notNull().defaultNow()
|
|
231484
|
+
processedAt: timestamp("processed_at", { withTimezone: true }).notNull().defaultNow()
|
|
231485
231485
|
}, (table3) => ({
|
|
231486
231486
|
pk: primaryKey({ columns: [table3.eventId, table3.handler], name: "processed_events_pk" }),
|
|
231487
231487
|
processedAtIdx: index("processed_events_processed_at_idx").on(table3.processedAt)
|
|
@@ -231492,10 +231492,10 @@ var init_schema2 = __esm(() => {
|
|
|
231492
231492
|
hostname: varchar("hostname", { length: 255 }).notNull(),
|
|
231493
231493
|
capabilities: jsonb("capabilities").notNull().default(sql`'{}'::jsonb`),
|
|
231494
231494
|
scopes: text("scopes").array().notNull().default(sql`ARRAY['*']::text[]`),
|
|
231495
|
-
lastSeenAt: timestamp("last_seen_at"),
|
|
231496
|
-
revokedAt: timestamp("revoked_at"),
|
|
231497
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
231498
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow()
|
|
231495
|
+
lastSeenAt: timestamp("last_seen_at", { withTimezone: true }),
|
|
231496
|
+
revokedAt: timestamp("revoked_at", { withTimezone: true }),
|
|
231497
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
231498
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
231499
231499
|
}, (table3) => ({
|
|
231500
231500
|
pubkeyUq: index("genie_hosts_pubkey_idx").on(table3.pubkey),
|
|
231501
231501
|
activeIdx: index("genie_hosts_active_idx").on(table3.revokedAt)
|
|
@@ -233856,7 +233856,591 @@ var init_src5 = __esm(() => {
|
|
|
233856
233856
|
init_schema2();
|
|
233857
233857
|
});
|
|
233858
233858
|
|
|
233859
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
233859
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/settings-schema.cjs
|
|
233860
|
+
var require_settings_schema = __commonJS((exports, module) => {
|
|
233861
|
+
var SCHEMA_VERSION = 1;
|
|
233862
|
+
var GUC_NAME_REGEX = /^[a-z][a-z0-9_]*$/;
|
|
233863
|
+
var FORBIDDEN_VALUE_CHARS = /[\n\r\0]/;
|
|
233864
|
+
var SCHEMA = {
|
|
233865
|
+
server: {
|
|
233866
|
+
port: {
|
|
233867
|
+
type: "int",
|
|
233868
|
+
default: 8432,
|
|
233869
|
+
env: ["AUTOPG_PORT", "PGSERVE_PORT"],
|
|
233870
|
+
range: [1, 65535],
|
|
233871
|
+
description: "Router TCP port (clients connect here)"
|
|
233872
|
+
},
|
|
233873
|
+
host: {
|
|
233874
|
+
type: "string",
|
|
233875
|
+
default: "127.0.0.1",
|
|
233876
|
+
env: ["AUTOPG_HOST", "PGSERVE_HOST"],
|
|
233877
|
+
description: "Bind address for the router"
|
|
233878
|
+
},
|
|
233879
|
+
pgPort: {
|
|
233880
|
+
type: "int",
|
|
233881
|
+
default: 6432,
|
|
233882
|
+
env: ["AUTOPG_PG_PORT", "PGSERVE_PG_PORT"],
|
|
233883
|
+
range: [1, 65535],
|
|
233884
|
+
description: "Internal PostgreSQL backend port"
|
|
233885
|
+
},
|
|
233886
|
+
pgSocketPath: {
|
|
233887
|
+
type: "string",
|
|
233888
|
+
default: "",
|
|
233889
|
+
env: ["AUTOPG_PG_SOCKET", "PGSERVE_PG_SOCKET"],
|
|
233890
|
+
description: "Unix socket path for backend (empty = TCP only)",
|
|
233891
|
+
nullable: true
|
|
233892
|
+
},
|
|
233893
|
+
pgUser: {
|
|
233894
|
+
type: "string",
|
|
233895
|
+
default: "postgres",
|
|
233896
|
+
env: ["AUTOPG_PG_USER", "PGSERVE_PG_USER"],
|
|
233897
|
+
description: "Backend superuser"
|
|
233898
|
+
},
|
|
233899
|
+
pgPassword: {
|
|
233900
|
+
type: "string",
|
|
233901
|
+
default: "postgres",
|
|
233902
|
+
env: ["AUTOPG_PG_PASSWORD", "PGSERVE_PG_PASSWORD"],
|
|
233903
|
+
secret: true,
|
|
233904
|
+
description: "Backend superuser password (file is chmod 0600)"
|
|
233905
|
+
}
|
|
233906
|
+
},
|
|
233907
|
+
runtime: {
|
|
233908
|
+
logLevel: {
|
|
233909
|
+
type: "enum",
|
|
233910
|
+
default: "info",
|
|
233911
|
+
enum: ["debug", "info", "warn", "error"],
|
|
233912
|
+
env: ["AUTOPG_LOG_LEVEL", "PGSERVE_LOG_LEVEL", "LOG_LEVEL"],
|
|
233913
|
+
description: "Log verbosity"
|
|
233914
|
+
},
|
|
233915
|
+
autoProvision: {
|
|
233916
|
+
type: "bool",
|
|
233917
|
+
default: true,
|
|
233918
|
+
env: ["AUTOPG_AUTO_PROVISION", "PGSERVE_AUTO_PROVISION"],
|
|
233919
|
+
description: "Auto-create missing databases on first connect"
|
|
233920
|
+
},
|
|
233921
|
+
enablePgvector: {
|
|
233922
|
+
type: "bool",
|
|
233923
|
+
default: false,
|
|
233924
|
+
env: ["AUTOPG_ENABLE_PGVECTOR", "PGSERVE_ENABLE_PGVECTOR"],
|
|
233925
|
+
description: "Load pgvector extension on database create"
|
|
233926
|
+
},
|
|
233927
|
+
dataDir: {
|
|
233928
|
+
type: "string",
|
|
233929
|
+
default: "",
|
|
233930
|
+
env: ["AUTOPG_DATA_DIR", "PGSERVE_DATA_DIR"],
|
|
233931
|
+
description: "PG cluster data directory (empty = <configDir>/data)",
|
|
233932
|
+
nullable: true
|
|
233933
|
+
},
|
|
233934
|
+
cluster: {
|
|
233935
|
+
type: "enum",
|
|
233936
|
+
default: "auto",
|
|
233937
|
+
enum: ["auto", "on", "off"],
|
|
233938
|
+
env: ["AUTOPG_CLUSTER", "PGSERVE_CLUSTER"],
|
|
233939
|
+
description: "Cluster mode (auto = on for multi-core hosts)"
|
|
233940
|
+
},
|
|
233941
|
+
workers: {
|
|
233942
|
+
type: "int",
|
|
233943
|
+
default: 0,
|
|
233944
|
+
range: [0, 256],
|
|
233945
|
+
env: ["AUTOPG_WORKERS", "PGSERVE_WORKERS"],
|
|
233946
|
+
description: "Worker processes (0 = CPU cores)"
|
|
233947
|
+
},
|
|
233948
|
+
ramMode: {
|
|
233949
|
+
type: "bool",
|
|
233950
|
+
default: false,
|
|
233951
|
+
env: ["AUTOPG_RAM", "PGSERVE_RAM"],
|
|
233952
|
+
description: "Use /dev/shm storage (Linux only, ~2x faster)"
|
|
233953
|
+
},
|
|
233954
|
+
statsDashboard: {
|
|
233955
|
+
type: "bool",
|
|
233956
|
+
default: true,
|
|
233957
|
+
env: ["AUTOPG_STATS", "PGSERVE_STATS"],
|
|
233958
|
+
description: "Show TTY stats dashboard when running in foreground"
|
|
233959
|
+
}
|
|
233960
|
+
},
|
|
233961
|
+
sync: {
|
|
233962
|
+
enabled: {
|
|
233963
|
+
type: "bool",
|
|
233964
|
+
default: false,
|
|
233965
|
+
env: ["AUTOPG_SYNC_ENABLED", "PGSERVE_SYNC_ENABLED"],
|
|
233966
|
+
description: "Enable WAL-based logical replication"
|
|
233967
|
+
},
|
|
233968
|
+
url: {
|
|
233969
|
+
type: "string",
|
|
233970
|
+
default: "",
|
|
233971
|
+
env: ["AUTOPG_SYNC_TO", "PGSERVE_SYNC_TO"],
|
|
233972
|
+
description: "Upstream PostgreSQL URL for replication (--sync-to)",
|
|
233973
|
+
secret: true,
|
|
233974
|
+
nullable: true
|
|
233975
|
+
},
|
|
233976
|
+
databases: {
|
|
233977
|
+
type: "string",
|
|
233978
|
+
default: "*",
|
|
233979
|
+
env: ["AUTOPG_SYNC_DATABASES", "PGSERVE_SYNC_DATABASES"],
|
|
233980
|
+
description: "Database glob patterns to sync, comma-separated (--sync-databases)"
|
|
233981
|
+
}
|
|
233982
|
+
},
|
|
233983
|
+
supervision: {
|
|
233984
|
+
maxMemory: {
|
|
233985
|
+
type: "string",
|
|
233986
|
+
default: "4G",
|
|
233987
|
+
env: ["AUTOPG_MAX_MEMORY", "PGSERVE_MAX_MEMORY"],
|
|
233988
|
+
description: "pm2 memory ceiling (e.g. 4G, 8G)"
|
|
233989
|
+
},
|
|
233990
|
+
maxRestarts: {
|
|
233991
|
+
type: "int",
|
|
233992
|
+
default: 50,
|
|
233993
|
+
env: ["AUTOPG_MAX_RESTARTS", "PGSERVE_MAX_RESTARTS"],
|
|
233994
|
+
range: [1, 1000],
|
|
233995
|
+
description: "pm2 max rapid restarts before giving up"
|
|
233996
|
+
},
|
|
233997
|
+
minUptimeMs: {
|
|
233998
|
+
type: "int",
|
|
233999
|
+
default: 1e4,
|
|
234000
|
+
env: ["AUTOPG_MIN_UPTIME_MS", "PGSERVE_MIN_UPTIME_MS"],
|
|
234001
|
+
range: [0, 600000],
|
|
234002
|
+
description: "pm2 min uptime to count as a healthy start"
|
|
234003
|
+
},
|
|
234004
|
+
restartDelayMs: {
|
|
234005
|
+
type: "int",
|
|
234006
|
+
default: 4000,
|
|
234007
|
+
range: [0, 600000],
|
|
234008
|
+
env: ["AUTOPG_RESTART_DELAY_MS", "PGSERVE_RESTART_DELAY_MS"],
|
|
234009
|
+
description: "pm2 fixed delay before each restart"
|
|
234010
|
+
},
|
|
234011
|
+
expBackoffRestartDelayMs: {
|
|
234012
|
+
type: "int",
|
|
234013
|
+
default: 100,
|
|
234014
|
+
range: [0, 600000],
|
|
234015
|
+
env: ["AUTOPG_EXP_BACKOFF_DELAY_MS", "PGSERVE_EXP_BACKOFF_DELAY_MS"],
|
|
234016
|
+
description: "pm2 initial exponential-backoff delay"
|
|
234017
|
+
},
|
|
234018
|
+
expBackoffMaxMs: {
|
|
234019
|
+
type: "int",
|
|
234020
|
+
default: 60000,
|
|
234021
|
+
range: [1000, 600000],
|
|
234022
|
+
env: ["AUTOPG_EXP_BACKOFF_MAX_MS", "PGSERVE_EXP_BACKOFF_MAX_MS"],
|
|
234023
|
+
description: "pm2 exponential-backoff ceiling (ramp cap ~60s)"
|
|
234024
|
+
},
|
|
234025
|
+
killTimeoutMs: {
|
|
234026
|
+
type: "int",
|
|
234027
|
+
default: 60000,
|
|
234028
|
+
env: ["AUTOPG_KILL_TIMEOUT_MS", "PGSERVE_KILL_TIMEOUT_MS"],
|
|
234029
|
+
range: [1000, 600000],
|
|
234030
|
+
description: "Graceful shutdown window before SIGKILL"
|
|
234031
|
+
},
|
|
234032
|
+
logDateFormat: {
|
|
234033
|
+
type: "string",
|
|
234034
|
+
default: "YYYY-MM-DD HH:mm:ss.SSS",
|
|
234035
|
+
env: ["AUTOPG_LOG_DATE_FORMAT", "PGSERVE_LOG_DATE_FORMAT"],
|
|
234036
|
+
description: "pm2 log timestamp format string"
|
|
234037
|
+
}
|
|
234038
|
+
},
|
|
234039
|
+
security: {
|
|
234040
|
+
handshakeDeadlineMs: {
|
|
234041
|
+
type: "int",
|
|
234042
|
+
default: 5000,
|
|
234043
|
+
range: [100, 60000],
|
|
234044
|
+
env: ["AUTOPG_HANDSHAKE_DEADLINE_MS", "PGSERVE_HANDSHAKE_DEADLINE_MS"],
|
|
234045
|
+
description: "Control-socket peer handshake deadline before forced close"
|
|
234046
|
+
}
|
|
234047
|
+
},
|
|
234048
|
+
audit: {
|
|
234049
|
+
target: {
|
|
234050
|
+
type: "string",
|
|
234051
|
+
default: "",
|
|
234052
|
+
env: ["AUTOPG_AUDIT_TARGET", "PGSERVE_AUDIT_TARGET"],
|
|
234053
|
+
description: "Audit event destination (JSONL file path or HTTP endpoint)",
|
|
234054
|
+
nullable: true
|
|
234055
|
+
}
|
|
234056
|
+
},
|
|
234057
|
+
postgres: {
|
|
234058
|
+
max_connections: {
|
|
234059
|
+
type: "int",
|
|
234060
|
+
default: 1000,
|
|
234061
|
+
range: [1, 262143],
|
|
234062
|
+
guc: true,
|
|
234063
|
+
description: "Maximum concurrent connections"
|
|
234064
|
+
},
|
|
234065
|
+
shared_buffers: {
|
|
234066
|
+
type: "string",
|
|
234067
|
+
default: "128MB",
|
|
234068
|
+
guc: true,
|
|
234069
|
+
description: "Shared memory buffer pool"
|
|
234070
|
+
},
|
|
234071
|
+
work_mem: {
|
|
234072
|
+
type: "string",
|
|
234073
|
+
default: "4MB",
|
|
234074
|
+
guc: true,
|
|
234075
|
+
description: "Per-operation work memory"
|
|
234076
|
+
},
|
|
234077
|
+
maintenance_work_mem: {
|
|
234078
|
+
type: "string",
|
|
234079
|
+
default: "64MB",
|
|
234080
|
+
guc: true,
|
|
234081
|
+
description: "Memory for VACUUM / CREATE INDEX"
|
|
234082
|
+
},
|
|
234083
|
+
effective_cache_size: {
|
|
234084
|
+
type: "string",
|
|
234085
|
+
default: "4GB",
|
|
234086
|
+
guc: true,
|
|
234087
|
+
description: "Planner estimate of OS cache"
|
|
234088
|
+
},
|
|
234089
|
+
wal_level: {
|
|
234090
|
+
type: "enum",
|
|
234091
|
+
default: "logical",
|
|
234092
|
+
enum: ["minimal", "replica", "logical"],
|
|
234093
|
+
guc: true,
|
|
234094
|
+
description: "WAL detail level (logical = replication-ready)"
|
|
234095
|
+
},
|
|
234096
|
+
max_replication_slots: {
|
|
234097
|
+
type: "int",
|
|
234098
|
+
default: 10,
|
|
234099
|
+
range: [0, 1000],
|
|
234100
|
+
guc: true,
|
|
234101
|
+
description: "Max replication slots"
|
|
234102
|
+
},
|
|
234103
|
+
max_wal_senders: {
|
|
234104
|
+
type: "int",
|
|
234105
|
+
default: 10,
|
|
234106
|
+
range: [0, 1000],
|
|
234107
|
+
guc: true,
|
|
234108
|
+
description: "Max WAL sender processes"
|
|
234109
|
+
},
|
|
234110
|
+
wal_keep_size: {
|
|
234111
|
+
type: "string",
|
|
234112
|
+
default: "512MB",
|
|
234113
|
+
guc: true,
|
|
234114
|
+
description: "WAL retention for replicas to catch up"
|
|
234115
|
+
},
|
|
234116
|
+
log_statement: {
|
|
234117
|
+
type: "enum",
|
|
234118
|
+
default: "none",
|
|
234119
|
+
enum: ["none", "ddl", "mod", "all"],
|
|
234120
|
+
guc: true,
|
|
234121
|
+
description: "SQL statement logging level"
|
|
234122
|
+
},
|
|
234123
|
+
log_min_duration_statement: {
|
|
234124
|
+
type: "int",
|
|
234125
|
+
default: -1,
|
|
234126
|
+
range: [-1, 2147483647],
|
|
234127
|
+
guc: true,
|
|
234128
|
+
description: "Slow query threshold (ms, -1 = off)"
|
|
234129
|
+
},
|
|
234130
|
+
statement_timeout: {
|
|
234131
|
+
type: "int",
|
|
234132
|
+
default: 0,
|
|
234133
|
+
range: [0, 2147483647],
|
|
234134
|
+
guc: true,
|
|
234135
|
+
description: "Statement timeout (ms, 0 = none)"
|
|
234136
|
+
},
|
|
234137
|
+
idle_in_transaction_session_timeout: {
|
|
234138
|
+
type: "int",
|
|
234139
|
+
default: 0,
|
|
234140
|
+
range: [0, 2147483647],
|
|
234141
|
+
guc: true,
|
|
234142
|
+
description: "Idle-in-transaction timeout (ms, 0 = none)"
|
|
234143
|
+
},
|
|
234144
|
+
autovacuum: {
|
|
234145
|
+
type: "bool",
|
|
234146
|
+
default: true,
|
|
234147
|
+
guc: true,
|
|
234148
|
+
description: "Enable autovacuum daemon"
|
|
234149
|
+
},
|
|
234150
|
+
_extra: {
|
|
234151
|
+
type: "guc_map",
|
|
234152
|
+
default: {},
|
|
234153
|
+
description: "Raw passthrough GUC map (key=value applied as -c flags)"
|
|
234154
|
+
}
|
|
234155
|
+
},
|
|
234156
|
+
ui: {
|
|
234157
|
+
theme: {
|
|
234158
|
+
type: "enum",
|
|
234159
|
+
default: "mdr",
|
|
234160
|
+
enum: ["mdr", "lumon"],
|
|
234161
|
+
description: "Console theme"
|
|
234162
|
+
},
|
|
234163
|
+
phosphor: {
|
|
234164
|
+
type: "enum",
|
|
234165
|
+
default: "amber",
|
|
234166
|
+
enum: ["amber", "green", "white"],
|
|
234167
|
+
description: "CRT phosphor color"
|
|
234168
|
+
},
|
|
234169
|
+
density: {
|
|
234170
|
+
type: "enum",
|
|
234171
|
+
default: "comfortable",
|
|
234172
|
+
enum: ["compact", "comfortable", "spacious"],
|
|
234173
|
+
description: "Layout density"
|
|
234174
|
+
},
|
|
234175
|
+
crt: {
|
|
234176
|
+
type: "bool",
|
|
234177
|
+
default: true,
|
|
234178
|
+
description: "CRT scanline effect"
|
|
234179
|
+
}
|
|
234180
|
+
}
|
|
234181
|
+
};
|
|
234182
|
+
function flattenSchema(schema3 = SCHEMA) {
|
|
234183
|
+
const out = {};
|
|
234184
|
+
for (const [section, fields] of Object.entries(schema3)) {
|
|
234185
|
+
for (const [key, descriptor] of Object.entries(fields)) {
|
|
234186
|
+
out[`${section}.${key}`] = descriptor;
|
|
234187
|
+
}
|
|
234188
|
+
}
|
|
234189
|
+
return out;
|
|
234190
|
+
}
|
|
234191
|
+
function buildDefaults(schema3 = SCHEMA) {
|
|
234192
|
+
const out = {};
|
|
234193
|
+
for (const [section, fields] of Object.entries(schema3)) {
|
|
234194
|
+
out[section] = {};
|
|
234195
|
+
for (const [key, descriptor] of Object.entries(fields)) {
|
|
234196
|
+
const def = descriptor.default;
|
|
234197
|
+
if (def && typeof def === "object") {
|
|
234198
|
+
out[section][key] = Array.isArray(def) ? [...def] : { ...def };
|
|
234199
|
+
} else {
|
|
234200
|
+
out[section][key] = def;
|
|
234201
|
+
}
|
|
234202
|
+
}
|
|
234203
|
+
}
|
|
234204
|
+
return out;
|
|
234205
|
+
}
|
|
234206
|
+
module.exports = {
|
|
234207
|
+
SCHEMA,
|
|
234208
|
+
SCHEMA_VERSION,
|
|
234209
|
+
GUC_NAME_REGEX,
|
|
234210
|
+
FORBIDDEN_VALUE_CHARS,
|
|
234211
|
+
flattenSchema,
|
|
234212
|
+
buildDefaults
|
|
234213
|
+
};
|
|
234214
|
+
});
|
|
234215
|
+
|
|
234216
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/settings-loader.cjs
|
|
234217
|
+
var require_settings_loader = __commonJS((exports, module) => {
|
|
234218
|
+
var crypto5 = __require("crypto");
|
|
234219
|
+
var fs9 = __require("fs");
|
|
234220
|
+
var os6 = __require("os");
|
|
234221
|
+
var path2 = __require("path");
|
|
234222
|
+
var { SCHEMA, buildDefaults } = require_settings_schema();
|
|
234223
|
+
var SETTINGS_FILENAME = "settings.json";
|
|
234224
|
+
var EMPTY_FILE_ETAG = "sha256:empty";
|
|
234225
|
+
var _legacyEnvWarningEmitted = false;
|
|
234226
|
+
function getConfigDir() {
|
|
234227
|
+
if (process.env.AUTOPG_CONFIG_DIR)
|
|
234228
|
+
return process.env.AUTOPG_CONFIG_DIR;
|
|
234229
|
+
if (process.env.PGSERVE_CONFIG_DIR)
|
|
234230
|
+
return process.env.PGSERVE_CONFIG_DIR;
|
|
234231
|
+
return path2.join(os6.homedir(), ".autopg");
|
|
234232
|
+
}
|
|
234233
|
+
function getSettingsPath() {
|
|
234234
|
+
return path2.join(getConfigDir(), SETTINGS_FILENAME);
|
|
234235
|
+
}
|
|
234236
|
+
function readSettingsFile(settingsPath = getSettingsPath()) {
|
|
234237
|
+
if (!fs9.existsSync(settingsPath))
|
|
234238
|
+
return { raw: null, parsed: null };
|
|
234239
|
+
const raw = fs9.readFileSync(settingsPath);
|
|
234240
|
+
try {
|
|
234241
|
+
const parsed = JSON.parse(raw.toString("utf8"));
|
|
234242
|
+
return { raw, parsed };
|
|
234243
|
+
} catch (err) {
|
|
234244
|
+
const wrapped = new SyntaxError(`Failed to parse ${settingsPath}: ${err.message}`);
|
|
234245
|
+
wrapped.cause = err;
|
|
234246
|
+
wrapped.path = settingsPath;
|
|
234247
|
+
throw wrapped;
|
|
234248
|
+
}
|
|
234249
|
+
}
|
|
234250
|
+
function computeEtag(rawBytes) {
|
|
234251
|
+
if (!rawBytes || rawBytes.length === 0)
|
|
234252
|
+
return EMPTY_FILE_ETAG;
|
|
234253
|
+
const hash2 = crypto5.createHash("sha256").update(rawBytes).digest("hex");
|
|
234254
|
+
return `sha256:${hash2}`;
|
|
234255
|
+
}
|
|
234256
|
+
function castEnv(descriptor, raw) {
|
|
234257
|
+
switch (descriptor.type) {
|
|
234258
|
+
case "int": {
|
|
234259
|
+
const n2 = Number.parseInt(raw, 10);
|
|
234260
|
+
return Number.isFinite(n2) ? n2 : descriptor.default;
|
|
234261
|
+
}
|
|
234262
|
+
case "bool": {
|
|
234263
|
+
if (raw === "true" || raw === "1")
|
|
234264
|
+
return true;
|
|
234265
|
+
if (raw === "false" || raw === "0")
|
|
234266
|
+
return false;
|
|
234267
|
+
return descriptor.default;
|
|
234268
|
+
}
|
|
234269
|
+
default:
|
|
234270
|
+
return raw;
|
|
234271
|
+
}
|
|
234272
|
+
}
|
|
234273
|
+
function resolveEnv(descriptor, env2, logger6) {
|
|
234274
|
+
if (!Array.isArray(descriptor.env) || descriptor.env.length === 0)
|
|
234275
|
+
return null;
|
|
234276
|
+
for (const name of descriptor.env) {
|
|
234277
|
+
if (env2[name] !== undefined && env2[name] !== "") {
|
|
234278
|
+
const isLegacy = name.startsWith("PGSERVE_");
|
|
234279
|
+
if (isLegacy && !_legacyEnvWarningEmitted) {
|
|
234280
|
+
_legacyEnvWarningEmitted = true;
|
|
234281
|
+
logger6?.warn?.({ env: name }, `${name} is deprecated; prefer ${descriptor.env[0]}`);
|
|
234282
|
+
}
|
|
234283
|
+
return { envName: name, raw: env2[name] };
|
|
234284
|
+
}
|
|
234285
|
+
}
|
|
234286
|
+
return null;
|
|
234287
|
+
}
|
|
234288
|
+
function mergeWithSources({ defaults, fileSettings, env: env2, logger: logger6, schema: schema3 = SCHEMA }) {
|
|
234289
|
+
const settings = {};
|
|
234290
|
+
const sources = {};
|
|
234291
|
+
for (const [section, fields] of Object.entries(schema3)) {
|
|
234292
|
+
settings[section] = {};
|
|
234293
|
+
for (const [field, descriptor] of Object.entries(fields)) {
|
|
234294
|
+
const dotted = `${section}.${field}`;
|
|
234295
|
+
let value = clone(descriptor.default);
|
|
234296
|
+
let source = "default";
|
|
234297
|
+
const fileSection = fileSettings && fileSettings[section];
|
|
234298
|
+
if (fileSection && Object.prototype.hasOwnProperty.call(fileSection, field)) {
|
|
234299
|
+
value = clone(fileSection[field]);
|
|
234300
|
+
source = "file";
|
|
234301
|
+
}
|
|
234302
|
+
const envHit = resolveEnv(descriptor, env2, logger6);
|
|
234303
|
+
if (envHit) {
|
|
234304
|
+
value = castEnv(descriptor, envHit.raw);
|
|
234305
|
+
source = `env:${envHit.envName}`;
|
|
234306
|
+
}
|
|
234307
|
+
settings[section][field] = value;
|
|
234308
|
+
sources[dotted] = source;
|
|
234309
|
+
}
|
|
234310
|
+
}
|
|
234311
|
+
return { settings, sources };
|
|
234312
|
+
}
|
|
234313
|
+
function clone(value) {
|
|
234314
|
+
if (value === null || value === undefined)
|
|
234315
|
+
return value;
|
|
234316
|
+
if (typeof value !== "object")
|
|
234317
|
+
return value;
|
|
234318
|
+
if (Array.isArray(value))
|
|
234319
|
+
return value.map(clone);
|
|
234320
|
+
const out = {};
|
|
234321
|
+
for (const [k2, v2] of Object.entries(value))
|
|
234322
|
+
out[k2] = clone(v2);
|
|
234323
|
+
return out;
|
|
234324
|
+
}
|
|
234325
|
+
function loadEffectiveConfig({
|
|
234326
|
+
schema: schema3 = SCHEMA,
|
|
234327
|
+
env: env2 = process.env,
|
|
234328
|
+
logger: logger6,
|
|
234329
|
+
settingsPath = getSettingsPath()
|
|
234330
|
+
} = {}) {
|
|
234331
|
+
const fallbackLogger = logger6 || {
|
|
234332
|
+
warn: (data, msg) => console.warn(`[autopg] ${msg ?? ""} ${JSON.stringify(data ?? {})}`)
|
|
234333
|
+
};
|
|
234334
|
+
const { raw, parsed } = readSettingsFile(settingsPath);
|
|
234335
|
+
const defaults = buildDefaults(schema3);
|
|
234336
|
+
const { settings, sources } = mergeWithSources({
|
|
234337
|
+
defaults,
|
|
234338
|
+
fileSettings: parsed,
|
|
234339
|
+
env: env2,
|
|
234340
|
+
logger: fallbackLogger,
|
|
234341
|
+
schema: schema3
|
|
234342
|
+
});
|
|
234343
|
+
const etag = computeEtag(raw);
|
|
234344
|
+
return { settings, sources, etag, path: settingsPath };
|
|
234345
|
+
}
|
|
234346
|
+
function resetLegacyEnvWarning() {
|
|
234347
|
+
_legacyEnvWarningEmitted = false;
|
|
234348
|
+
}
|
|
234349
|
+
module.exports = {
|
|
234350
|
+
loadEffectiveConfig,
|
|
234351
|
+
computeEtag,
|
|
234352
|
+
readSettingsFile,
|
|
234353
|
+
getConfigDir,
|
|
234354
|
+
getSettingsPath,
|
|
234355
|
+
EMPTY_FILE_ETAG,
|
|
234356
|
+
SETTINGS_FILENAME,
|
|
234357
|
+
_internals: {
|
|
234358
|
+
castEnv,
|
|
234359
|
+
resolveEnv,
|
|
234360
|
+
mergeWithSources,
|
|
234361
|
+
resetLegacyEnvWarning
|
|
234362
|
+
}
|
|
234363
|
+
};
|
|
234364
|
+
});
|
|
234365
|
+
|
|
234366
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/settings-pg-args.cjs
|
|
234367
|
+
var require_settings_pg_args = __commonJS((exports, module) => {
|
|
234368
|
+
var {
|
|
234369
|
+
GUC_NAME_REGEX,
|
|
234370
|
+
FORBIDDEN_VALUE_CHARS
|
|
234371
|
+
} = require_settings_schema();
|
|
234372
|
+
function validateLeafEntry(name, value, logger6) {
|
|
234373
|
+
if (typeof name !== "string" || !GUC_NAME_REGEX.test(name)) {
|
|
234374
|
+
logger6?.warn?.({ guc: name, value }, `dropping invalid postgres GUC name (must match ${GUC_NAME_REGEX})`);
|
|
234375
|
+
return false;
|
|
234376
|
+
}
|
|
234377
|
+
return assertScalarSafe(name, value, logger6);
|
|
234378
|
+
}
|
|
234379
|
+
function validateExtraGuc(name, value, logger6) {
|
|
234380
|
+
if (typeof name !== "string" || !GUC_NAME_REGEX.test(name)) {
|
|
234381
|
+
logger6?.warn?.({ guc: name, value, source: "_extra" }, `dropping invalid postgres._extra GUC name (must match ${GUC_NAME_REGEX})`);
|
|
234382
|
+
return false;
|
|
234383
|
+
}
|
|
234384
|
+
return assertScalarSafe(`_extra.${name}`, value, logger6);
|
|
234385
|
+
}
|
|
234386
|
+
function assertScalarSafe(label, value, logger6) {
|
|
234387
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
234388
|
+
logger6?.warn?.({ guc: label, value }, "dropping postgres GUC: value must be a scalar primitive (string|number|boolean)");
|
|
234389
|
+
return false;
|
|
234390
|
+
}
|
|
234391
|
+
if (typeof value === "string") {
|
|
234392
|
+
if (FORBIDDEN_VALUE_CHARS.test(value)) {
|
|
234393
|
+
logger6?.warn?.({ guc: label, value }, "dropping postgres GUC: value contains forbidden control character (\\n, \\r, or \\0)");
|
|
234394
|
+
return false;
|
|
234395
|
+
}
|
|
234396
|
+
if (value.startsWith("-")) {
|
|
234397
|
+
logger6?.warn?.({ guc: label, value }, 'dropping postgres GUC: value must not start with "-" (looks like a CLI flag)');
|
|
234398
|
+
return false;
|
|
234399
|
+
}
|
|
234400
|
+
}
|
|
234401
|
+
return true;
|
|
234402
|
+
}
|
|
234403
|
+
function formatGucValue(value) {
|
|
234404
|
+
if (typeof value === "boolean")
|
|
234405
|
+
return value ? "on" : "off";
|
|
234406
|
+
return String(value);
|
|
234407
|
+
}
|
|
234408
|
+
function buildPostgresArgs(postgresSettings, { logger: logger6 } = {}) {
|
|
234409
|
+
const merged = new Map;
|
|
234410
|
+
const extras = postgresSettings && postgresSettings._extra;
|
|
234411
|
+
if (extras && typeof extras === "object" && !Array.isArray(extras)) {
|
|
234412
|
+
for (const [k2, v2] of Object.entries(extras)) {
|
|
234413
|
+
if (validateExtraGuc(k2, v2, logger6)) {
|
|
234414
|
+
merged.set(k2, formatGucValue(v2));
|
|
234415
|
+
}
|
|
234416
|
+
}
|
|
234417
|
+
}
|
|
234418
|
+
if (postgresSettings && typeof postgresSettings === "object") {
|
|
234419
|
+
for (const [k2, v2] of Object.entries(postgresSettings)) {
|
|
234420
|
+
if (k2 === "_extra")
|
|
234421
|
+
continue;
|
|
234422
|
+
if (validateLeafEntry(k2, v2, logger6)) {
|
|
234423
|
+
merged.set(k2, formatGucValue(v2));
|
|
234424
|
+
}
|
|
234425
|
+
}
|
|
234426
|
+
}
|
|
234427
|
+
const args = [];
|
|
234428
|
+
const applied = {};
|
|
234429
|
+
for (const [k2, v2] of merged) {
|
|
234430
|
+
args.push("-c", `${k2}=${v2}`);
|
|
234431
|
+
applied[k2] = v2;
|
|
234432
|
+
}
|
|
234433
|
+
return { args, applied };
|
|
234434
|
+
}
|
|
234435
|
+
module.exports = {
|
|
234436
|
+
buildPostgresArgs,
|
|
234437
|
+
validateLeafEntry,
|
|
234438
|
+
validateExtraGuc,
|
|
234439
|
+
formatGucValue
|
|
234440
|
+
};
|
|
234441
|
+
});
|
|
234442
|
+
|
|
234443
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/postgres.js
|
|
233860
234444
|
import { EventEmitter as EventEmitter4 } from "events";
|
|
233861
234445
|
import os6 from "os";
|
|
233862
234446
|
import path2 from "path";
|
|
@@ -233877,22 +234461,71 @@ function getPlatformKey() {
|
|
|
233877
234461
|
return "linux-arm64";
|
|
233878
234462
|
throw new Error(`Unsupported platform: ${platform3}-${arch2}`);
|
|
233879
234463
|
}
|
|
234464
|
+
function getAutopgRoot() {
|
|
234465
|
+
return process.env.AUTOPG_CONFIG_DIR || process.env.PGSERVE_CONFIG_DIR || path2.join(os6.homedir(), ".autopg");
|
|
234466
|
+
}
|
|
233880
234467
|
function getBinaryCacheDir() {
|
|
233881
234468
|
const platformKey = getPlatformKey();
|
|
233882
|
-
return path2.join(
|
|
234469
|
+
return path2.join(getAutopgRoot(), "bin", platformKey);
|
|
234470
|
+
}
|
|
234471
|
+
function readCachedVersion(cacheDir) {
|
|
234472
|
+
try {
|
|
234473
|
+
return fs9.readFileSync(path2.join(cacheDir, VERSION_MARKER_FILENAME), "utf8").trim();
|
|
234474
|
+
} catch {
|
|
234475
|
+
return null;
|
|
234476
|
+
}
|
|
234477
|
+
}
|
|
234478
|
+
function writeCachedVersion(cacheDir, version3) {
|
|
234479
|
+
try {
|
|
234480
|
+
fs9.writeFileSync(path2.join(cacheDir, VERSION_MARKER_FILENAME), `${version3}
|
|
234481
|
+
`, { mode: 420 });
|
|
234482
|
+
} catch {}
|
|
234483
|
+
}
|
|
234484
|
+
function isCachedValid(cacheBinDir, expectedVersion) {
|
|
234485
|
+
const platform3 = os6.platform();
|
|
234486
|
+
const initdbName = platform3 === "win32" ? "initdb.exe" : "initdb";
|
|
234487
|
+
const postgresName = platform3 === "win32" ? "postgres.exe" : "postgres";
|
|
234488
|
+
if (!fs9.existsSync(path2.join(cacheBinDir, initdbName)))
|
|
234489
|
+
return false;
|
|
234490
|
+
if (!fs9.existsSync(path2.join(cacheBinDir, postgresName)))
|
|
234491
|
+
return false;
|
|
234492
|
+
const cached = readCachedVersion(path2.dirname(cacheBinDir));
|
|
234493
|
+
return cached === expectedVersion;
|
|
234494
|
+
}
|
|
234495
|
+
function migrateLegacyBinaryCache() {
|
|
234496
|
+
const platformKey = getPlatformKey();
|
|
234497
|
+
const newDir = getBinaryCacheDir();
|
|
234498
|
+
if (fs9.existsSync(newDir))
|
|
234499
|
+
return;
|
|
234500
|
+
const oldDir = path2.join(os6.homedir(), ".pgserve", "bin", platformKey);
|
|
234501
|
+
if (!fs9.existsSync(oldDir))
|
|
234502
|
+
return;
|
|
234503
|
+
try {
|
|
234504
|
+
fs9.mkdirSync(path2.dirname(newDir), { recursive: true });
|
|
234505
|
+
fs9.renameSync(oldDir, newDir);
|
|
234506
|
+
console.log(`[pgserve] Migrated binary cache: ${oldDir} \u2192 ${newDir}`);
|
|
234507
|
+
} catch (err) {
|
|
234508
|
+
console.log(`[pgserve] Could not migrate legacy binary cache (${err.code || err.message}); will re-download`);
|
|
234509
|
+
}
|
|
233883
234510
|
}
|
|
233884
234511
|
async function downloadPostgresBinaries() {
|
|
233885
234512
|
const platform3 = os6.platform();
|
|
234513
|
+
migrateLegacyBinaryCache();
|
|
233886
234514
|
const cacheDir = getBinaryCacheDir();
|
|
233887
234515
|
const cacheBinDir = path2.join(cacheDir, "bin");
|
|
233888
|
-
|
|
233889
|
-
const postgresName = platform3 === "win32" ? "postgres.exe" : "postgres";
|
|
233890
|
-
if (fs9.existsSync(path2.join(cacheBinDir, initdbName)) && fs9.existsSync(path2.join(cacheBinDir, postgresName))) {
|
|
234516
|
+
if (isCachedValid(cacheBinDir, PINNED_PG_VERSION)) {
|
|
233891
234517
|
return cacheDir;
|
|
233892
234518
|
}
|
|
234519
|
+
const cachedVersion = readCachedVersion(cacheDir);
|
|
234520
|
+
if (cachedVersion && cachedVersion !== PINNED_PG_VERSION) {
|
|
234521
|
+
console.log(`[pgserve] Cached binaries are version ${cachedVersion}; pinned is ${PINNED_PG_VERSION} \u2014 re-downloading`);
|
|
234522
|
+
try {
|
|
234523
|
+
fs9.rmSync(cacheDir, { recursive: true, force: true });
|
|
234524
|
+
} catch {}
|
|
234525
|
+
}
|
|
233893
234526
|
const platformKey = getPlatformKey();
|
|
233894
234527
|
const pkgName = `@embedded-postgres/${platformKey}`;
|
|
233895
|
-
const pkgVersion =
|
|
234528
|
+
const pkgVersion = PINNED_PG_VERSION;
|
|
233896
234529
|
console.log(`[pgserve] PostgreSQL binaries not found.`);
|
|
233897
234530
|
console.log(`[pgserve] Downloading ${pkgName}@${pkgVersion}...`);
|
|
233898
234531
|
const registryUrl = `https://registry.npmjs.org/${pkgName}`;
|
|
@@ -233944,6 +234577,7 @@ async function downloadPostgresBinaries() {
|
|
|
233944
234577
|
try {
|
|
233945
234578
|
fs9.rmSync(tempDir, { recursive: true, force: true });
|
|
233946
234579
|
} catch {}
|
|
234580
|
+
writeCachedVersion(cacheDir, pkgVersion);
|
|
233947
234581
|
console.log(`[pgserve] PostgreSQL binaries installed to ${cacheDir}`);
|
|
233948
234582
|
return cacheDir;
|
|
233949
234583
|
}
|
|
@@ -234104,8 +234738,10 @@ function findAvailableTcpPort() {
|
|
|
234104
234738
|
server.stop(true);
|
|
234105
234739
|
return port;
|
|
234106
234740
|
}
|
|
234107
|
-
var PostgresManager;
|
|
234741
|
+
var import_settings_loader, import_settings_pg_args, PINNED_PG_VERSION = "18.3.0-beta.17", VERSION_MARKER_FILENAME = ".version", PostgresManager;
|
|
234108
234742
|
var init_postgres2 = __esm(() => {
|
|
234743
|
+
import_settings_loader = __toESM(require_settings_loader(), 1);
|
|
234744
|
+
import_settings_pg_args = __toESM(require_settings_pg_args(), 1);
|
|
234109
234745
|
PostgresManager = class PostgresManager extends EventEmitter4 {
|
|
234110
234746
|
constructor(options = {}) {
|
|
234111
234747
|
super();
|
|
@@ -234335,23 +234971,23 @@ var init_postgres2 = __esm(() => {
|
|
|
234335
234971
|
async _startPostgres() {
|
|
234336
234972
|
await this._ensureNoStalePostmasterLock();
|
|
234337
234973
|
return new Promise((resolve2, reject) => {
|
|
234974
|
+
const { settings } = import_settings_loader.loadEffectiveConfig({ logger: this.logger });
|
|
234975
|
+
const { args: gucArgs, applied: appliedGucs } = import_settings_pg_args.buildPostgresArgs(settings.postgres, { logger: this.logger });
|
|
234338
234976
|
const pgArgs = [
|
|
234339
234977
|
this.binaries.postgres,
|
|
234340
234978
|
"-D",
|
|
234341
234979
|
this.databaseDir,
|
|
234342
234980
|
"-p",
|
|
234343
234981
|
this.port.toString(),
|
|
234344
|
-
|
|
234345
|
-
"max_connections=1000"
|
|
234982
|
+
...gucArgs
|
|
234346
234983
|
];
|
|
234347
234984
|
if (this.socketDir) {
|
|
234348
234985
|
pgArgs.push("-k", this.socketDir);
|
|
234349
234986
|
} else {
|
|
234350
234987
|
pgArgs.push("-k", "");
|
|
234351
234988
|
}
|
|
234352
|
-
if (this.syncEnabled) {
|
|
234353
|
-
|
|
234354
|
-
this.logger.info("Logical replication enabled for sync");
|
|
234989
|
+
if (this.syncEnabled || settings.sync?.enabled) {
|
|
234990
|
+
this.logger.info({ walLevel: appliedGucs.wal_level }, "Logical replication enabled for sync");
|
|
234355
234991
|
}
|
|
234356
234992
|
this.process = Bun.spawn(buildCommand(pgArgs, this.binaries.libDir), {
|
|
234357
234993
|
env: buildSpawnEnv(this.binaries.libDir),
|
|
@@ -234829,7 +235465,7 @@ Output: ${startupOutput}`));
|
|
|
234829
235465
|
};
|
|
234830
235466
|
});
|
|
234831
235467
|
|
|
234832
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
235468
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/logger.js
|
|
234833
235469
|
function formatTime2() {
|
|
234834
235470
|
const now = new Date;
|
|
234835
235471
|
return `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(now.getSeconds()).padStart(2, "0")}`;
|
|
@@ -234893,7 +235529,7 @@ var init_logger4 = __esm(() => {
|
|
|
234893
235529
|
LEVELS = { debug: 10, info: 20, warn: 30, error: 40 };
|
|
234894
235530
|
});
|
|
234895
235531
|
|
|
234896
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
235532
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/sync.js
|
|
234897
235533
|
var {SQL: SQL2 } = globalThis.Bun;
|
|
234898
235534
|
function matchesPattern2(dbName, patterns) {
|
|
234899
235535
|
if (!patterns || patterns.length === 0)
|
|
@@ -235110,7 +235746,7 @@ var init_sync = __esm(() => {
|
|
|
235110
235746
|
init_logger4();
|
|
235111
235747
|
});
|
|
235112
235748
|
|
|
235113
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
235749
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/pg-wire.js
|
|
235114
235750
|
import { createHash as createHash7 } from "crypto";
|
|
235115
235751
|
|
|
235116
235752
|
class PgWireClient {
|
|
@@ -235682,7 +236318,7 @@ var init_pg_wire = __esm(() => {
|
|
|
235682
236318
|
};
|
|
235683
236319
|
});
|
|
235684
236320
|
|
|
235685
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
236321
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/restore.js
|
|
235686
236322
|
function matchesPattern3(dbName, patterns) {
|
|
235687
236323
|
if (!patterns || patterns.length === 0)
|
|
235688
236324
|
return true;
|
|
@@ -236035,7 +236671,7 @@ var init_restore = __esm(() => {
|
|
|
236035
236671
|
init_logger4();
|
|
236036
236672
|
});
|
|
236037
236673
|
|
|
236038
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
236674
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/dashboard.js
|
|
236039
236675
|
import { readFileSync as readFileSync3 } from "fs";
|
|
236040
236676
|
import { join as join14, dirname as dirname5 } from "path";
|
|
236041
236677
|
import { fileURLToPath } from "url";
|
|
@@ -236179,7 +236815,7 @@ var init_dashboard = __esm(() => {
|
|
|
236179
236815
|
};
|
|
236180
236816
|
});
|
|
236181
236817
|
|
|
236182
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
236818
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/protocol.js
|
|
236183
236819
|
function parseStartupMessage(data, fastPath = true) {
|
|
236184
236820
|
const length = data.readInt32BE(0);
|
|
236185
236821
|
const version4 = data.readInt32BE(4);
|
|
@@ -236332,7 +236968,7 @@ function buildErrorResponse({ severity = "FATAL", sqlstate, message: message2 })
|
|
|
236332
236968
|
var PROTOCOL_VERSION_3 = 196608;
|
|
236333
236969
|
var init_protocol = () => {};
|
|
236334
236970
|
|
|
236335
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
236971
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/router.js
|
|
236336
236972
|
import fs10 from "fs";
|
|
236337
236973
|
import { EventEmitter as EventEmitter5 } from "events";
|
|
236338
236974
|
function flushPending(target, pending) {
|
|
@@ -236668,7 +237304,7 @@ var init_router = __esm(() => {
|
|
|
236668
237304
|
};
|
|
236669
237305
|
});
|
|
236670
237306
|
|
|
236671
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
237307
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/stats-collector.js
|
|
236672
237308
|
class StatsCollector {
|
|
236673
237309
|
constructor(options = {}) {
|
|
236674
237310
|
this.pgManager = options.pgManager;
|
|
@@ -236987,7 +237623,7 @@ class StatsCollector {
|
|
|
236987
237623
|
}
|
|
236988
237624
|
var CPU_SAMPLE_MIN_INTERVAL_MS = 100, PROC_DISKSTATS_MIN_FIELDS = 14;
|
|
236989
237625
|
|
|
236990
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
237626
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/stats-dashboard.js
|
|
236991
237627
|
class StatsDashboard {
|
|
236992
237628
|
constructor(options = {}) {
|
|
236993
237629
|
this.enabled = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
@@ -237251,7 +237887,7 @@ var init_stats_dashboard = __esm(() => {
|
|
|
237251
237887
|
};
|
|
237252
237888
|
});
|
|
237253
237889
|
|
|
237254
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
237890
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/audit.js
|
|
237255
237891
|
import fs11 from "fs";
|
|
237256
237892
|
import os7 from "os";
|
|
237257
237893
|
import path3 from "path";
|
|
@@ -237347,7 +237983,7 @@ var init_audit = __esm(() => {
|
|
|
237347
237983
|
});
|
|
237348
237984
|
});
|
|
237349
237985
|
|
|
237350
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
237986
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/fingerprint.js
|
|
237351
237987
|
import crypto6 from "crypto";
|
|
237352
237988
|
import { execFileSync } from "child_process";
|
|
237353
237989
|
import fs12 from "fs";
|
|
@@ -237626,7 +238262,7 @@ var init_fingerprint = __esm(() => {
|
|
|
237626
238262
|
init_audit();
|
|
237627
238263
|
});
|
|
237628
238264
|
|
|
237629
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
238265
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/tokens.js
|
|
237630
238266
|
import crypto7 from "crypto";
|
|
237631
238267
|
function mintToken() {
|
|
237632
238268
|
const id = crypto7.randomBytes(TOKEN_ID_BYTES).toString("hex");
|
|
@@ -237680,7 +238316,7 @@ var init_tokens = __esm(() => {
|
|
|
237680
238316
|
FP_RE = /^[0-9a-f]{12}$/;
|
|
237681
238317
|
});
|
|
237682
238318
|
|
|
237683
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
238319
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/control-db.js
|
|
237684
238320
|
function query(client, text3, params = [], opts = {}) {
|
|
237685
238321
|
if (client.supportsQueryOptions && opts && Object.keys(opts).length > 0) {
|
|
237686
238322
|
return client.query(text3, params, opts);
|
|
@@ -237817,7 +238453,7 @@ var init_control_db = __esm(() => {
|
|
|
237817
238453
|
init_tokens();
|
|
237818
238454
|
});
|
|
237819
238455
|
|
|
237820
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
238456
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/admin-client.js
|
|
237821
238457
|
var {SQL: SQL3 } = globalThis.Bun;
|
|
237822
238458
|
import fs13 from "fs";
|
|
237823
238459
|
import path5 from "path";
|
|
@@ -237960,7 +238596,7 @@ function removeAdminDiscovery(controlSocketDir) {
|
|
|
237960
238596
|
}
|
|
237961
238597
|
var init_admin_client = () => {};
|
|
237962
238598
|
|
|
237963
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
238599
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/tenancy.js
|
|
237964
238600
|
function sanitizeName(name) {
|
|
237965
238601
|
const raw = (typeof name === "string" ? name : "").toLowerCase();
|
|
237966
238602
|
const collapsed = raw.replace(/[^a-z0-9]+/g, "_");
|
|
@@ -237984,7 +238620,7 @@ function isFingerprintEnforcementDisabled(env2 = process.env) {
|
|
|
237984
238620
|
}
|
|
237985
238621
|
var KILL_SWITCH_ENV = "PGSERVE_DISABLE_FINGERPRINT_ENFORCEMENT", NAME_TRUNCATE = 30, MAX_DB_IDENT = 63;
|
|
237986
238622
|
|
|
237987
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
238623
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/daemon-shared.js
|
|
237988
238624
|
function flushPending2(target, pending) {
|
|
237989
238625
|
const written = target.write(pending);
|
|
237990
238626
|
if (written === pending.byteLength)
|
|
@@ -237994,7 +238630,7 @@ function flushPending2(target, pending) {
|
|
|
237994
238630
|
return pending.subarray(written);
|
|
237995
238631
|
}
|
|
237996
238632
|
|
|
237997
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
238633
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/daemon-control.js
|
|
237998
238634
|
import fs14 from "fs";
|
|
237999
238635
|
function attachControlHandlers(PgserveDaemon) {
|
|
238000
238636
|
PgserveDaemon.prototype.handleSocketOpen = handleSocketOpen;
|
|
@@ -238329,7 +238965,7 @@ var init_daemon_control = __esm(() => {
|
|
|
238329
238965
|
MAX_STARTUP_BUFFER_SIZE2 = 1024 * 1024;
|
|
238330
238966
|
});
|
|
238331
238967
|
|
|
238332
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
238968
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/daemon-tcp.js
|
|
238333
238969
|
import fs15 from "fs";
|
|
238334
238970
|
function attachTcpHandlers(PgserveDaemon) {
|
|
238335
238971
|
PgserveDaemon.prototype.bindTcpListener = bindTcpListener;
|
|
@@ -238598,7 +239234,7 @@ var init_daemon_tcp = __esm(() => {
|
|
|
238598
239234
|
MAX_STARTUP_BUFFER_SIZE3 = 1024 * 1024;
|
|
238599
239235
|
});
|
|
238600
239236
|
|
|
238601
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
239237
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/gc.js
|
|
238602
239238
|
function defaultIsProcessAlive(pid) {
|
|
238603
239239
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
238604
239240
|
return false;
|
|
@@ -238814,7 +239450,7 @@ var init_gc = __esm(() => {
|
|
|
238814
239450
|
HOURLY_MS = 60 * 60 * 1000;
|
|
238815
239451
|
});
|
|
238816
239452
|
|
|
238817
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
239453
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/daemon.js
|
|
238818
239454
|
import fs16 from "fs";
|
|
238819
239455
|
import path6 from "path";
|
|
238820
239456
|
import { EventEmitter as EventEmitter6 } from "events";
|
|
@@ -239311,7 +239947,7 @@ var init_daemon = __esm(() => {
|
|
|
239311
239947
|
attachTcpHandlers(PgserveDaemon);
|
|
239312
239948
|
});
|
|
239313
239949
|
|
|
239314
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
239950
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/sdk.js
|
|
239315
239951
|
import { spawn as spawn4 } from "child_process";
|
|
239316
239952
|
import fs17 from "fs";
|
|
239317
239953
|
import path7 from "path";
|
|
@@ -239434,7 +240070,7 @@ var init_sdk4 = __esm(() => {
|
|
|
239434
240070
|
__dirname2 = path7.dirname(fileURLToPath2(import.meta.url));
|
|
239435
240071
|
});
|
|
239436
240072
|
|
|
239437
|
-
// ../../node_modules/.bun/pgserve@2.
|
|
240073
|
+
// ../../node_modules/.bun/pgserve@2.2.0/node_modules/pgserve/src/index.js
|
|
239438
240074
|
var exports_src2 = {};
|
|
239439
240075
|
__export(exports_src2, {
|
|
239440
240076
|
stopDaemon: () => stopDaemon,
|