@friggframework/core 2.0.0--canary.545.c40eca4.0 → 2.0.0--canary.545.ae2019f.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/database/prisma.js +5 -2
  2. package/generated/prisma-mongodb/edge.js +7 -3
  3. package/generated/prisma-mongodb/index.d.ts +2 -2
  4. package/generated/prisma-mongodb/index.js +13 -9
  5. package/generated/prisma-mongodb/{query-engine-debian-openssl-3.0.x → libquery_engine-debian-openssl-3.0.x.so.node} +0 -0
  6. package/generated/prisma-mongodb/{query-engine-rhel-openssl-3.0.x → libquery_engine-rhel-openssl-3.0.x.so.node} +0 -0
  7. package/generated/prisma-mongodb/package.json +1 -1
  8. package/generated/prisma-mongodb/runtime/library.js +146 -0
  9. package/generated/prisma-mongodb/schema.prisma +2 -2
  10. package/generated/prisma-mongodb/wasm.js +7 -3
  11. package/generated/prisma-postgresql/edge.js +7 -3
  12. package/generated/prisma-postgresql/index.d.ts +6 -2
  13. package/generated/prisma-postgresql/index.js +13 -9
  14. package/generated/prisma-postgresql/{query-engine-debian-openssl-3.0.x → libquery_engine-debian-openssl-3.0.x.so.node} +0 -0
  15. package/generated/prisma-postgresql/{query-engine-rhel-openssl-3.0.x → libquery_engine-rhel-openssl-3.0.x.so.node} +0 -0
  16. package/generated/prisma-postgresql/package.json +1 -1
  17. package/generated/prisma-postgresql/runtime/library.js +146 -0
  18. package/generated/prisma-postgresql/schema.prisma +2 -2
  19. package/generated/prisma-postgresql/wasm.js +7 -3
  20. package/package.json +5 -5
  21. package/prisma-mongodb/schema.prisma +2 -2
  22. package/prisma-postgresql/schema.prisma +2 -2
  23. package/generated/prisma-mongodb/runtime/binary.d.ts +0 -1
  24. package/generated/prisma-mongodb/runtime/binary.js +0 -289
  25. package/generated/prisma-postgresql/runtime/binary.d.ts +0 -1
  26. package/generated/prisma-postgresql/runtime/binary.js +0 -289
@@ -6,6 +6,7 @@ const {
6
6
  } = require('./encryption/encryption-schema-registry');
7
7
  const { logger } = require('./encryption/logger');
8
8
  const { Cryptor } = require('../encrypt/Cryptor');
9
+ const path = require('path');
9
10
  const config = require('./config');
10
11
 
11
12
  /**
@@ -71,13 +72,15 @@ const prismaClientSingleton = () => {
71
72
  const paths = [
72
73
  // Lambda layer location (when using Prisma Lambda layer)
73
74
  `/opt/nodejs/node_modules/generated/prisma-${dbType}`,
75
+ // __dirname-based resolution (works on Netlify + any bundler)
76
+ path.resolve(__dirname, `../generated/prisma-${dbType}`),
74
77
  // Local development location (relative to core package)
75
78
  `../generated/prisma-${dbType}`,
76
79
  ];
77
80
 
78
- for (const path of paths) {
81
+ for (const tryPath of paths) {
79
82
  try {
80
- return require(path).PrismaClient;
83
+ return require(tryPath).PrismaClient;
81
84
  } catch (err) {
82
85
  // Continue to next path
83
86
  }
@@ -326,7 +326,7 @@ const config = {
326
326
  "fromEnvVar": null
327
327
  },
328
328
  "config": {
329
- "engineType": "binary"
329
+ "engineType": "library"
330
330
  },
331
331
  "binaryTargets": [
332
332
  {
@@ -337,6 +337,10 @@ const config = {
337
337
  {
338
338
  "fromEnvVar": null,
339
339
  "value": "rhel-openssl-3.0.x"
340
+ },
341
+ {
342
+ "fromEnvVar": null,
343
+ "value": "debian-openssl-3.0.x"
340
344
  }
341
345
  ],
342
346
  "previewFeatures": [],
@@ -363,8 +367,8 @@ const config = {
363
367
  }
364
368
  }
365
369
  },
366
- "inlineSchema": "// Frigg Framework - Prisma Schema\n// MongoDB database schema for enterprise integration platform\n// Migration from Mongoose ODM to Prisma ORM\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"../generated/prisma-mongodb\"\n binaryTargets = [\"native\", \"rhel-openssl-3.0.x\"] // native for local dev, rhel for Lambda deployment\n engineType = \"binary\" // Use binary engines (smaller size)\n}\n\ndatasource db {\n provider = \"mongodb\"\n url = env(\"DATABASE_URL\")\n}\n\n// ============================================================================\n// USER MODELS\n// ============================================================================\n\n/// User model with discriminator pattern support\n/// Replaces Mongoose discriminators (IndividualUser, OrganizationUser)\nmodel User {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n type UserType\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // IndividualUser fields (nullable for organizations)\n email String?\n username String?\n hashword String? // Bcrypt hashed password (handled in application layer)\n appUserId String?\n organizationId String? @db.ObjectId\n\n // Self-referential relation for organization membership\n organization User? @relation(\"OrgMembers\", fields: [organizationId], references: [id], onDelete: NoAction, onUpdate: NoAction)\n members User[] @relation(\"OrgMembers\")\n\n // OrganizationUser fields (nullable for individuals)\n appOrgId String?\n name String?\n\n // Relations\n tokens Token[]\n credentials Credential[]\n entities Entity[]\n integrations Integration[]\n processes Process[]\n\n @@unique([username, appUserId])\n @@index([type])\n @@index([appUserId])\n @@map(\"User\")\n}\n\nenum UserType {\n INDIVIDUAL\n ORGANIZATION\n}\n\n// ============================================================================\n// AUTHENTICATION MODELS\n// ============================================================================\n\n/// Authentication tokens with expiration\n/// Bcrypt hashed tokens stored (handled in application layer)\nmodel Token {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n token String // Bcrypt hashed\n created DateTime @default(now())\n expires DateTime?\n userId String @db.ObjectId\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([expires])\n @@map(\"Token\")\n}\n\n// ============================================================================\n// CREDENTIAL & ENTITY MODELS\n// ============================================================================\n\n/// OAuth credentials and API tokens\n/// All sensitive data encrypted with KMS at rest\nmodel Credential {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n authIsValid Boolean?\n externalId String?\n\n // Dynamic OAuth fields stored as JSON (encrypted via Prisma middleware)\n // Contains: access_token, refresh_token, domain, expires_in, token_type, etc.\n data Json @default(\"{}\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n entities Entity[]\n\n @@index([userId])\n @@index([externalId])\n @@map(\"Credential\")\n}\n\n/// External service entities (API connections)\nmodel Entity {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n credentialId String? @db.ObjectId\n credential Credential? @relation(fields: [credentialId], references: [id], onDelete: SetNull)\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n name String?\n moduleName String?\n externalId String?\n\n data Json @default(\"{}\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations - many-to-many with scalar lists\n integrations Integration[] @relation(\"IntegrationEntities\", fields: [integrationIds], references: [id])\n integrationIds String[] @db.ObjectId\n\n syncs Sync[] @relation(\"SyncEntities\", fields: [syncIds], references: [id])\n syncIds String[] @db.ObjectId\n\n dataIdentifiers DataIdentifier[]\n associationObjects AssociationObject[]\n\n @@index([userId])\n @@index([externalId])\n @@index([moduleName])\n @@index([credentialId])\n @@map(\"Entity\")\n}\n\n// ============================================================================\n// INTEGRATION MODELS\n// ============================================================================\n\n/// Main integration configuration and state\nmodel Integration {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n status IntegrationStatus @default(ENABLED)\n\n // Configuration and version\n config Json? // Integration configuration object\n version String?\n\n // Entity references (many-to-many via explicit scalar list)\n entities Entity[] @relation(\"IntegrationEntities\", fields: [entityIds], references: [id])\n entityIds String[] @db.ObjectId\n\n // Message arrays (stored as JSON)\n errors Json @default(\"[]\")\n warnings Json @default(\"[]\")\n info Json @default(\"[]\")\n logs Json @default(\"[]\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n associations Association[]\n syncs Sync[]\n mappings IntegrationMapping[]\n processes Process[]\n\n @@index([userId])\n @@index([status])\n @@map(\"Integration\")\n}\n\nenum IntegrationStatus {\n ENABLED\n NEEDS_CONFIG\n PROCESSING\n DISABLED\n ERROR\n}\n\n/// Integration-specific data mappings\n/// All mapping data encrypted with KMS\nmodel IntegrationMapping {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n sourceId String?\n\n // Encrypted mapping data (handled via Prisma middleware)\n mapping Json?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([integrationId, sourceId])\n @@index([integrationId])\n @@index([sourceId])\n @@map(\"IntegrationMapping\")\n}\n\n// ============================================================================\n// PROCESS MODELS\n// ============================================================================\n\n/// Generic Process Model - tracks any long-running operation\n/// Used for: CRM syncs, data migrations, bulk operations, etc.\nmodel Process {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n\n // Core references\n userId String @db.ObjectId\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n\n // Process identification\n name String // e.g., \"zoho-crm-contact-sync\", \"pipedrive-lead-sync\"\n type String // e.g., \"CRM_SYNC\", \"DATA_MIGRATION\", \"BULK_OPERATION\"\n\n // State machine\n state String // Current state (integration-defined states)\n\n // Flexible storage\n context Json @default(\"{}\") // Process-specific data (pagination, metadata, etc.)\n results Json @default(\"{}\") // Process results and metrics\n\n // Hierarchy support\n childProcesses String[] @db.ObjectId\n parentProcessId String? @db.ObjectId\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([userId])\n @@index([integrationId])\n @@index([type])\n @@index([state])\n @@index([name])\n @@map(\"Process\")\n}\n\n// ============================================================================\n// SYNC MODELS\n// ============================================================================\n\n/// Bidirectional data synchronization tracking\nmodel Sync {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String? @db.ObjectId\n integration Integration? @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n\n // Entity references (many-to-many via explicit scalar list)\n entities Entity[] @relation(\"SyncEntities\", fields: [entityIds], references: [id])\n entityIds String[] @db.ObjectId\n\n hash String\n name String\n\n // Data identifiers (extracted to separate model)\n dataIdentifiers DataIdentifier[]\n\n @@index([integrationId])\n @@index([hash])\n @@index([name])\n @@map(\"Sync\")\n}\n\n/// Data identifier for sync operations\n/// Replaces nested array structure in Mongoose\nmodel DataIdentifier {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n syncId String? @db.ObjectId\n sync Sync? @relation(fields: [syncId], references: [id], onDelete: Cascade)\n entityId String @db.ObjectId\n entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)\n\n // Identifier data (can be any structure)\n idData Json\n\n hash String\n\n @@index([syncId])\n @@index([entityId])\n @@index([hash])\n @@map(\"DataIdentifier\")\n}\n\n// ============================================================================\n// ASSOCIATION MODELS\n// ============================================================================\n\n/// Entity associations with cardinality tracking\nmodel Association {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n name String\n type AssociationType\n primaryObject String\n\n // Associated objects (extracted to separate model)\n objects AssociationObject[]\n\n @@index([integrationId])\n @@index([name])\n @@map(\"Association\")\n}\n\n/// Association object entry\n/// Replaces nested array structure in Mongoose\nmodel AssociationObject {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n associationId String @db.ObjectId\n association Association @relation(fields: [associationId], references: [id], onDelete: Cascade)\n entityId String @db.ObjectId\n entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)\n objectType String\n objId String\n metadata Json? // Optional metadata\n\n @@index([associationId])\n @@index([entityId])\n @@map(\"AssociationObject\")\n}\n\nenum AssociationType {\n ONE_TO_MANY\n ONE_TO_ONE\n MANY_TO_ONE\n}\n\n// ============================================================================\n// UTILITY MODELS\n// ============================================================================\n\n/// Generic state storage\nmodel State {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n state Json?\n\n @@map(\"State\")\n}\n\n/// AWS API Gateway WebSocket connection tracking\nmodel WebsocketConnection {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n connectionId String?\n\n @@index([connectionId])\n @@map(\"WebsocketConnection\")\n}\n\n// ============================================================================\n// ADMIN PROCESS MODELS\n// ============================================================================\n\n/// Admin process state machine\nenum AdminProcessState {\n PENDING\n RUNNING\n COMPLETED\n FAILED\n}\n\n/// Admin trigger types\nenum AdminTrigger {\n MANUAL\n SCHEDULED\n QUEUE\n WEBHOOK\n}\n\n/// Admin process tracking (like Process but without user/integration FK)\n/// Used for: admin scripts, db migrations, system maintenance tasks\nmodel AdminProcess {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n name String // e.g., \"oauth-token-refresh\", \"db-migration-xyz\"\n type String // e.g., \"ADMIN_SCRIPT\", \"DB_MIGRATION\"\n\n // State machine\n state AdminProcessState @default(PENDING)\n\n // Flexible storage (mirrors Process model pattern)\n context Json @default(\"{}\") // input, trigger, audit info, script version\n results Json @default(\"{}\") // output, logs, metrics, errors\n\n // Hierarchy support\n childProcesses String[] @db.ObjectId\n parentProcessId String? @db.ObjectId\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([name, createdAt(sort: Desc)])\n @@index([state])\n @@index([type])\n @@map(\"AdminProcess\")\n}\n\n/// Script scheduling configuration for hybrid scheduling (SQS + EventBridge)\nmodel ScriptSchedule {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n scriptName String @unique\n enabled Boolean @default(false)\n cronExpression String?\n timezone String @default(\"UTC\")\n lastTriggeredAt DateTime?\n nextTriggerAt DateTime?\n\n // External Scheduler (e.g., AWS EventBridge Scheduler)\n externalScheduleId String?\n externalScheduleName String?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([enabled])\n @@map(\"ScriptSchedule\")\n}\n\n/// One-time scheduled jobs for poll-and-dispatch scheduling pattern.\n/// Used by providers without native one-time scheduling APIs (e.g., Netlify).\n/// A cron function queries for due jobs and dispatches them to a queue.\nmodel ScheduledJob {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n scheduleName String @unique\n scheduledAt DateTime\n queueResourceId String\n payload Json?\n state String @default(\"PENDING\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([state, scheduledAt])\n @@map(\"ScheduledJob\")\n}\n",
367
- "inlineSchemaHash": "16f53dffdff4907b041c0d5a4560dabad0b7fa33e0212d81d5cfa7d66c136db6",
370
+ "inlineSchema": "// Frigg Framework - Prisma Schema\n// MongoDB database schema for enterprise integration platform\n// Migration from Mongoose ODM to Prisma ORM\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"../generated/prisma-mongodb\"\n binaryTargets = [\"native\", \"rhel-openssl-3.0.x\", \"debian-openssl-3.0.x\"] // native for local dev, rhel for Lambda, debian for Netlify\n engineType = \"library\" // Node-API library (smaller than standalone binary engine)\n}\n\ndatasource db {\n provider = \"mongodb\"\n url = env(\"DATABASE_URL\")\n}\n\n// ============================================================================\n// USER MODELS\n// ============================================================================\n\n/// User model with discriminator pattern support\n/// Replaces Mongoose discriminators (IndividualUser, OrganizationUser)\nmodel User {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n type UserType\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // IndividualUser fields (nullable for organizations)\n email String?\n username String?\n hashword String? // Bcrypt hashed password (handled in application layer)\n appUserId String?\n organizationId String? @db.ObjectId\n\n // Self-referential relation for organization membership\n organization User? @relation(\"OrgMembers\", fields: [organizationId], references: [id], onDelete: NoAction, onUpdate: NoAction)\n members User[] @relation(\"OrgMembers\")\n\n // OrganizationUser fields (nullable for individuals)\n appOrgId String?\n name String?\n\n // Relations\n tokens Token[]\n credentials Credential[]\n entities Entity[]\n integrations Integration[]\n processes Process[]\n\n @@unique([username, appUserId])\n @@index([type])\n @@index([appUserId])\n @@map(\"User\")\n}\n\nenum UserType {\n INDIVIDUAL\n ORGANIZATION\n}\n\n// ============================================================================\n// AUTHENTICATION MODELS\n// ============================================================================\n\n/// Authentication tokens with expiration\n/// Bcrypt hashed tokens stored (handled in application layer)\nmodel Token {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n token String // Bcrypt hashed\n created DateTime @default(now())\n expires DateTime?\n userId String @db.ObjectId\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([expires])\n @@map(\"Token\")\n}\n\n// ============================================================================\n// CREDENTIAL & ENTITY MODELS\n// ============================================================================\n\n/// OAuth credentials and API tokens\n/// All sensitive data encrypted with KMS at rest\nmodel Credential {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n authIsValid Boolean?\n externalId String?\n\n // Dynamic OAuth fields stored as JSON (encrypted via Prisma middleware)\n // Contains: access_token, refresh_token, domain, expires_in, token_type, etc.\n data Json @default(\"{}\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n entities Entity[]\n\n @@index([userId])\n @@index([externalId])\n @@map(\"Credential\")\n}\n\n/// External service entities (API connections)\nmodel Entity {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n credentialId String? @db.ObjectId\n credential Credential? @relation(fields: [credentialId], references: [id], onDelete: SetNull)\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n name String?\n moduleName String?\n externalId String?\n\n data Json @default(\"{}\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations - many-to-many with scalar lists\n integrations Integration[] @relation(\"IntegrationEntities\", fields: [integrationIds], references: [id])\n integrationIds String[] @db.ObjectId\n\n syncs Sync[] @relation(\"SyncEntities\", fields: [syncIds], references: [id])\n syncIds String[] @db.ObjectId\n\n dataIdentifiers DataIdentifier[]\n associationObjects AssociationObject[]\n\n @@index([userId])\n @@index([externalId])\n @@index([moduleName])\n @@index([credentialId])\n @@map(\"Entity\")\n}\n\n// ============================================================================\n// INTEGRATION MODELS\n// ============================================================================\n\n/// Main integration configuration and state\nmodel Integration {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n status IntegrationStatus @default(ENABLED)\n\n // Configuration and version\n config Json? // Integration configuration object\n version String?\n\n // Entity references (many-to-many via explicit scalar list)\n entities Entity[] @relation(\"IntegrationEntities\", fields: [entityIds], references: [id])\n entityIds String[] @db.ObjectId\n\n // Message arrays (stored as JSON)\n errors Json @default(\"[]\")\n warnings Json @default(\"[]\")\n info Json @default(\"[]\")\n logs Json @default(\"[]\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n associations Association[]\n syncs Sync[]\n mappings IntegrationMapping[]\n processes Process[]\n\n @@index([userId])\n @@index([status])\n @@map(\"Integration\")\n}\n\nenum IntegrationStatus {\n ENABLED\n NEEDS_CONFIG\n PROCESSING\n DISABLED\n ERROR\n}\n\n/// Integration-specific data mappings\n/// All mapping data encrypted with KMS\nmodel IntegrationMapping {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n sourceId String?\n\n // Encrypted mapping data (handled via Prisma middleware)\n mapping Json?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([integrationId, sourceId])\n @@index([integrationId])\n @@index([sourceId])\n @@map(\"IntegrationMapping\")\n}\n\n// ============================================================================\n// PROCESS MODELS\n// ============================================================================\n\n/// Generic Process Model - tracks any long-running operation\n/// Used for: CRM syncs, data migrations, bulk operations, etc.\nmodel Process {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n\n // Core references\n userId String @db.ObjectId\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n\n // Process identification\n name String // e.g., \"zoho-crm-contact-sync\", \"pipedrive-lead-sync\"\n type String // e.g., \"CRM_SYNC\", \"DATA_MIGRATION\", \"BULK_OPERATION\"\n\n // State machine\n state String // Current state (integration-defined states)\n\n // Flexible storage\n context Json @default(\"{}\") // Process-specific data (pagination, metadata, etc.)\n results Json @default(\"{}\") // Process results and metrics\n\n // Hierarchy support\n childProcesses String[] @db.ObjectId\n parentProcessId String? @db.ObjectId\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([userId])\n @@index([integrationId])\n @@index([type])\n @@index([state])\n @@index([name])\n @@map(\"Process\")\n}\n\n// ============================================================================\n// SYNC MODELS\n// ============================================================================\n\n/// Bidirectional data synchronization tracking\nmodel Sync {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String? @db.ObjectId\n integration Integration? @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n\n // Entity references (many-to-many via explicit scalar list)\n entities Entity[] @relation(\"SyncEntities\", fields: [entityIds], references: [id])\n entityIds String[] @db.ObjectId\n\n hash String\n name String\n\n // Data identifiers (extracted to separate model)\n dataIdentifiers DataIdentifier[]\n\n @@index([integrationId])\n @@index([hash])\n @@index([name])\n @@map(\"Sync\")\n}\n\n/// Data identifier for sync operations\n/// Replaces nested array structure in Mongoose\nmodel DataIdentifier {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n syncId String? @db.ObjectId\n sync Sync? @relation(fields: [syncId], references: [id], onDelete: Cascade)\n entityId String @db.ObjectId\n entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)\n\n // Identifier data (can be any structure)\n idData Json\n\n hash String\n\n @@index([syncId])\n @@index([entityId])\n @@index([hash])\n @@map(\"DataIdentifier\")\n}\n\n// ============================================================================\n// ASSOCIATION MODELS\n// ============================================================================\n\n/// Entity associations with cardinality tracking\nmodel Association {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n name String\n type AssociationType\n primaryObject String\n\n // Associated objects (extracted to separate model)\n objects AssociationObject[]\n\n @@index([integrationId])\n @@index([name])\n @@map(\"Association\")\n}\n\n/// Association object entry\n/// Replaces nested array structure in Mongoose\nmodel AssociationObject {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n associationId String @db.ObjectId\n association Association @relation(fields: [associationId], references: [id], onDelete: Cascade)\n entityId String @db.ObjectId\n entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)\n objectType String\n objId String\n metadata Json? // Optional metadata\n\n @@index([associationId])\n @@index([entityId])\n @@map(\"AssociationObject\")\n}\n\nenum AssociationType {\n ONE_TO_MANY\n ONE_TO_ONE\n MANY_TO_ONE\n}\n\n// ============================================================================\n// UTILITY MODELS\n// ============================================================================\n\n/// Generic state storage\nmodel State {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n state Json?\n\n @@map(\"State\")\n}\n\n/// AWS API Gateway WebSocket connection tracking\nmodel WebsocketConnection {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n connectionId String?\n\n @@index([connectionId])\n @@map(\"WebsocketConnection\")\n}\n\n// ============================================================================\n// ADMIN PROCESS MODELS\n// ============================================================================\n\n/// Admin process state machine\nenum AdminProcessState {\n PENDING\n RUNNING\n COMPLETED\n FAILED\n}\n\n/// Admin trigger types\nenum AdminTrigger {\n MANUAL\n SCHEDULED\n QUEUE\n WEBHOOK\n}\n\n/// Admin process tracking (like Process but without user/integration FK)\n/// Used for: admin scripts, db migrations, system maintenance tasks\nmodel AdminProcess {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n name String // e.g., \"oauth-token-refresh\", \"db-migration-xyz\"\n type String // e.g., \"ADMIN_SCRIPT\", \"DB_MIGRATION\"\n\n // State machine\n state AdminProcessState @default(PENDING)\n\n // Flexible storage (mirrors Process model pattern)\n context Json @default(\"{}\") // input, trigger, audit info, script version\n results Json @default(\"{}\") // output, logs, metrics, errors\n\n // Hierarchy support\n childProcesses String[] @db.ObjectId\n parentProcessId String? @db.ObjectId\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([name, createdAt(sort: Desc)])\n @@index([state])\n @@index([type])\n @@map(\"AdminProcess\")\n}\n\n/// Script scheduling configuration for hybrid scheduling (SQS + EventBridge)\nmodel ScriptSchedule {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n scriptName String @unique\n enabled Boolean @default(false)\n cronExpression String?\n timezone String @default(\"UTC\")\n lastTriggeredAt DateTime?\n nextTriggerAt DateTime?\n\n // External Scheduler (e.g., AWS EventBridge Scheduler)\n externalScheduleId String?\n externalScheduleName String?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([enabled])\n @@map(\"ScriptSchedule\")\n}\n\n/// One-time scheduled jobs for poll-and-dispatch scheduling pattern.\n/// Used by providers without native one-time scheduling APIs (e.g., Netlify).\n/// A cron function queries for due jobs and dispatches them to a queue.\nmodel ScheduledJob {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n scheduleName String @unique\n scheduledAt DateTime\n queueResourceId String\n payload Json?\n state String @default(\"PENDING\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([state, scheduledAt])\n @@map(\"ScheduledJob\")\n}\n",
371
+ "inlineSchemaHash": "3d80edbabc02073a63aacecb7bc75d59e99123c2b2fe67146ca70e7e1391bc9c",
368
372
  "copyEngine": true
369
373
  }
370
374
  config.dirname = '/'
@@ -3,7 +3,7 @@
3
3
  * Client
4
4
  **/
5
5
 
6
- import * as runtime from './runtime/binary.js';
6
+ import * as runtime from './runtime/library.js';
7
7
  import $Types = runtime.Types // general types
8
8
  import $Public = runtime.Types.Public
9
9
  import $Utils = runtime.Types.Utils
@@ -214,7 +214,7 @@ export class PrismaClient<
214
214
  */
215
215
 
216
216
  constructor(optionsArg ?: Prisma.Subset<ClientOptions, Prisma.PrismaClientOptions>);
217
- $on<V extends (U | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => $Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;
217
+ $on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
218
218
 
219
219
  /**
220
220
  * Connect with the database
@@ -26,7 +26,7 @@ const {
26
26
  Public,
27
27
  getRuntime,
28
28
  createParam,
29
- } = require('./runtime/binary.js')
29
+ } = require('./runtime/library.js')
30
30
 
31
31
 
32
32
  const Prisma = {}
@@ -327,7 +327,7 @@ const config = {
327
327
  "fromEnvVar": null
328
328
  },
329
329
  "config": {
330
- "engineType": "binary"
330
+ "engineType": "library"
331
331
  },
332
332
  "binaryTargets": [
333
333
  {
@@ -338,6 +338,10 @@ const config = {
338
338
  {
339
339
  "fromEnvVar": null,
340
340
  "value": "rhel-openssl-3.0.x"
341
+ },
342
+ {
343
+ "fromEnvVar": null,
344
+ "value": "debian-openssl-3.0.x"
341
345
  }
342
346
  ],
343
347
  "previewFeatures": [],
@@ -364,8 +368,8 @@ const config = {
364
368
  }
365
369
  }
366
370
  },
367
- "inlineSchema": "// Frigg Framework - Prisma Schema\n// MongoDB database schema for enterprise integration platform\n// Migration from Mongoose ODM to Prisma ORM\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"../generated/prisma-mongodb\"\n binaryTargets = [\"native\", \"rhel-openssl-3.0.x\"] // native for local dev, rhel for Lambda deployment\n engineType = \"binary\" // Use binary engines (smaller size)\n}\n\ndatasource db {\n provider = \"mongodb\"\n url = env(\"DATABASE_URL\")\n}\n\n// ============================================================================\n// USER MODELS\n// ============================================================================\n\n/// User model with discriminator pattern support\n/// Replaces Mongoose discriminators (IndividualUser, OrganizationUser)\nmodel User {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n type UserType\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // IndividualUser fields (nullable for organizations)\n email String?\n username String?\n hashword String? // Bcrypt hashed password (handled in application layer)\n appUserId String?\n organizationId String? @db.ObjectId\n\n // Self-referential relation for organization membership\n organization User? @relation(\"OrgMembers\", fields: [organizationId], references: [id], onDelete: NoAction, onUpdate: NoAction)\n members User[] @relation(\"OrgMembers\")\n\n // OrganizationUser fields (nullable for individuals)\n appOrgId String?\n name String?\n\n // Relations\n tokens Token[]\n credentials Credential[]\n entities Entity[]\n integrations Integration[]\n processes Process[]\n\n @@unique([username, appUserId])\n @@index([type])\n @@index([appUserId])\n @@map(\"User\")\n}\n\nenum UserType {\n INDIVIDUAL\n ORGANIZATION\n}\n\n// ============================================================================\n// AUTHENTICATION MODELS\n// ============================================================================\n\n/// Authentication tokens with expiration\n/// Bcrypt hashed tokens stored (handled in application layer)\nmodel Token {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n token String // Bcrypt hashed\n created DateTime @default(now())\n expires DateTime?\n userId String @db.ObjectId\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([expires])\n @@map(\"Token\")\n}\n\n// ============================================================================\n// CREDENTIAL & ENTITY MODELS\n// ============================================================================\n\n/// OAuth credentials and API tokens\n/// All sensitive data encrypted with KMS at rest\nmodel Credential {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n authIsValid Boolean?\n externalId String?\n\n // Dynamic OAuth fields stored as JSON (encrypted via Prisma middleware)\n // Contains: access_token, refresh_token, domain, expires_in, token_type, etc.\n data Json @default(\"{}\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n entities Entity[]\n\n @@index([userId])\n @@index([externalId])\n @@map(\"Credential\")\n}\n\n/// External service entities (API connections)\nmodel Entity {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n credentialId String? @db.ObjectId\n credential Credential? @relation(fields: [credentialId], references: [id], onDelete: SetNull)\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n name String?\n moduleName String?\n externalId String?\n\n data Json @default(\"{}\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations - many-to-many with scalar lists\n integrations Integration[] @relation(\"IntegrationEntities\", fields: [integrationIds], references: [id])\n integrationIds String[] @db.ObjectId\n\n syncs Sync[] @relation(\"SyncEntities\", fields: [syncIds], references: [id])\n syncIds String[] @db.ObjectId\n\n dataIdentifiers DataIdentifier[]\n associationObjects AssociationObject[]\n\n @@index([userId])\n @@index([externalId])\n @@index([moduleName])\n @@index([credentialId])\n @@map(\"Entity\")\n}\n\n// ============================================================================\n// INTEGRATION MODELS\n// ============================================================================\n\n/// Main integration configuration and state\nmodel Integration {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n status IntegrationStatus @default(ENABLED)\n\n // Configuration and version\n config Json? // Integration configuration object\n version String?\n\n // Entity references (many-to-many via explicit scalar list)\n entities Entity[] @relation(\"IntegrationEntities\", fields: [entityIds], references: [id])\n entityIds String[] @db.ObjectId\n\n // Message arrays (stored as JSON)\n errors Json @default(\"[]\")\n warnings Json @default(\"[]\")\n info Json @default(\"[]\")\n logs Json @default(\"[]\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n associations Association[]\n syncs Sync[]\n mappings IntegrationMapping[]\n processes Process[]\n\n @@index([userId])\n @@index([status])\n @@map(\"Integration\")\n}\n\nenum IntegrationStatus {\n ENABLED\n NEEDS_CONFIG\n PROCESSING\n DISABLED\n ERROR\n}\n\n/// Integration-specific data mappings\n/// All mapping data encrypted with KMS\nmodel IntegrationMapping {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n sourceId String?\n\n // Encrypted mapping data (handled via Prisma middleware)\n mapping Json?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([integrationId, sourceId])\n @@index([integrationId])\n @@index([sourceId])\n @@map(\"IntegrationMapping\")\n}\n\n// ============================================================================\n// PROCESS MODELS\n// ============================================================================\n\n/// Generic Process Model - tracks any long-running operation\n/// Used for: CRM syncs, data migrations, bulk operations, etc.\nmodel Process {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n\n // Core references\n userId String @db.ObjectId\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n\n // Process identification\n name String // e.g., \"zoho-crm-contact-sync\", \"pipedrive-lead-sync\"\n type String // e.g., \"CRM_SYNC\", \"DATA_MIGRATION\", \"BULK_OPERATION\"\n\n // State machine\n state String // Current state (integration-defined states)\n\n // Flexible storage\n context Json @default(\"{}\") // Process-specific data (pagination, metadata, etc.)\n results Json @default(\"{}\") // Process results and metrics\n\n // Hierarchy support\n childProcesses String[] @db.ObjectId\n parentProcessId String? @db.ObjectId\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([userId])\n @@index([integrationId])\n @@index([type])\n @@index([state])\n @@index([name])\n @@map(\"Process\")\n}\n\n// ============================================================================\n// SYNC MODELS\n// ============================================================================\n\n/// Bidirectional data synchronization tracking\nmodel Sync {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String? @db.ObjectId\n integration Integration? @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n\n // Entity references (many-to-many via explicit scalar list)\n entities Entity[] @relation(\"SyncEntities\", fields: [entityIds], references: [id])\n entityIds String[] @db.ObjectId\n\n hash String\n name String\n\n // Data identifiers (extracted to separate model)\n dataIdentifiers DataIdentifier[]\n\n @@index([integrationId])\n @@index([hash])\n @@index([name])\n @@map(\"Sync\")\n}\n\n/// Data identifier for sync operations\n/// Replaces nested array structure in Mongoose\nmodel DataIdentifier {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n syncId String? @db.ObjectId\n sync Sync? @relation(fields: [syncId], references: [id], onDelete: Cascade)\n entityId String @db.ObjectId\n entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)\n\n // Identifier data (can be any structure)\n idData Json\n\n hash String\n\n @@index([syncId])\n @@index([entityId])\n @@index([hash])\n @@map(\"DataIdentifier\")\n}\n\n// ============================================================================\n// ASSOCIATION MODELS\n// ============================================================================\n\n/// Entity associations with cardinality tracking\nmodel Association {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n name String\n type AssociationType\n primaryObject String\n\n // Associated objects (extracted to separate model)\n objects AssociationObject[]\n\n @@index([integrationId])\n @@index([name])\n @@map(\"Association\")\n}\n\n/// Association object entry\n/// Replaces nested array structure in Mongoose\nmodel AssociationObject {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n associationId String @db.ObjectId\n association Association @relation(fields: [associationId], references: [id], onDelete: Cascade)\n entityId String @db.ObjectId\n entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)\n objectType String\n objId String\n metadata Json? // Optional metadata\n\n @@index([associationId])\n @@index([entityId])\n @@map(\"AssociationObject\")\n}\n\nenum AssociationType {\n ONE_TO_MANY\n ONE_TO_ONE\n MANY_TO_ONE\n}\n\n// ============================================================================\n// UTILITY MODELS\n// ============================================================================\n\n/// Generic state storage\nmodel State {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n state Json?\n\n @@map(\"State\")\n}\n\n/// AWS API Gateway WebSocket connection tracking\nmodel WebsocketConnection {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n connectionId String?\n\n @@index([connectionId])\n @@map(\"WebsocketConnection\")\n}\n\n// ============================================================================\n// ADMIN PROCESS MODELS\n// ============================================================================\n\n/// Admin process state machine\nenum AdminProcessState {\n PENDING\n RUNNING\n COMPLETED\n FAILED\n}\n\n/// Admin trigger types\nenum AdminTrigger {\n MANUAL\n SCHEDULED\n QUEUE\n WEBHOOK\n}\n\n/// Admin process tracking (like Process but without user/integration FK)\n/// Used for: admin scripts, db migrations, system maintenance tasks\nmodel AdminProcess {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n name String // e.g., \"oauth-token-refresh\", \"db-migration-xyz\"\n type String // e.g., \"ADMIN_SCRIPT\", \"DB_MIGRATION\"\n\n // State machine\n state AdminProcessState @default(PENDING)\n\n // Flexible storage (mirrors Process model pattern)\n context Json @default(\"{}\") // input, trigger, audit info, script version\n results Json @default(\"{}\") // output, logs, metrics, errors\n\n // Hierarchy support\n childProcesses String[] @db.ObjectId\n parentProcessId String? @db.ObjectId\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([name, createdAt(sort: Desc)])\n @@index([state])\n @@index([type])\n @@map(\"AdminProcess\")\n}\n\n/// Script scheduling configuration for hybrid scheduling (SQS + EventBridge)\nmodel ScriptSchedule {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n scriptName String @unique\n enabled Boolean @default(false)\n cronExpression String?\n timezone String @default(\"UTC\")\n lastTriggeredAt DateTime?\n nextTriggerAt DateTime?\n\n // External Scheduler (e.g., AWS EventBridge Scheduler)\n externalScheduleId String?\n externalScheduleName String?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([enabled])\n @@map(\"ScriptSchedule\")\n}\n\n/// One-time scheduled jobs for poll-and-dispatch scheduling pattern.\n/// Used by providers without native one-time scheduling APIs (e.g., Netlify).\n/// A cron function queries for due jobs and dispatches them to a queue.\nmodel ScheduledJob {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n scheduleName String @unique\n scheduledAt DateTime\n queueResourceId String\n payload Json?\n state String @default(\"PENDING\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([state, scheduledAt])\n @@map(\"ScheduledJob\")\n}\n",
368
- "inlineSchemaHash": "16f53dffdff4907b041c0d5a4560dabad0b7fa33e0212d81d5cfa7d66c136db6",
371
+ "inlineSchema": "// Frigg Framework - Prisma Schema\n// MongoDB database schema for enterprise integration platform\n// Migration from Mongoose ODM to Prisma ORM\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"../generated/prisma-mongodb\"\n binaryTargets = [\"native\", \"rhel-openssl-3.0.x\", \"debian-openssl-3.0.x\"] // native for local dev, rhel for Lambda, debian for Netlify\n engineType = \"library\" // Node-API library (smaller than standalone binary engine)\n}\n\ndatasource db {\n provider = \"mongodb\"\n url = env(\"DATABASE_URL\")\n}\n\n// ============================================================================\n// USER MODELS\n// ============================================================================\n\n/// User model with discriminator pattern support\n/// Replaces Mongoose discriminators (IndividualUser, OrganizationUser)\nmodel User {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n type UserType\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // IndividualUser fields (nullable for organizations)\n email String?\n username String?\n hashword String? // Bcrypt hashed password (handled in application layer)\n appUserId String?\n organizationId String? @db.ObjectId\n\n // Self-referential relation for organization membership\n organization User? @relation(\"OrgMembers\", fields: [organizationId], references: [id], onDelete: NoAction, onUpdate: NoAction)\n members User[] @relation(\"OrgMembers\")\n\n // OrganizationUser fields (nullable for individuals)\n appOrgId String?\n name String?\n\n // Relations\n tokens Token[]\n credentials Credential[]\n entities Entity[]\n integrations Integration[]\n processes Process[]\n\n @@unique([username, appUserId])\n @@index([type])\n @@index([appUserId])\n @@map(\"User\")\n}\n\nenum UserType {\n INDIVIDUAL\n ORGANIZATION\n}\n\n// ============================================================================\n// AUTHENTICATION MODELS\n// ============================================================================\n\n/// Authentication tokens with expiration\n/// Bcrypt hashed tokens stored (handled in application layer)\nmodel Token {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n token String // Bcrypt hashed\n created DateTime @default(now())\n expires DateTime?\n userId String @db.ObjectId\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@index([userId])\n @@index([expires])\n @@map(\"Token\")\n}\n\n// ============================================================================\n// CREDENTIAL & ENTITY MODELS\n// ============================================================================\n\n/// OAuth credentials and API tokens\n/// All sensitive data encrypted with KMS at rest\nmodel Credential {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n authIsValid Boolean?\n externalId String?\n\n // Dynamic OAuth fields stored as JSON (encrypted via Prisma middleware)\n // Contains: access_token, refresh_token, domain, expires_in, token_type, etc.\n data Json @default(\"{}\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n entities Entity[]\n\n @@index([userId])\n @@index([externalId])\n @@map(\"Credential\")\n}\n\n/// External service entities (API connections)\nmodel Entity {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n credentialId String? @db.ObjectId\n credential Credential? @relation(fields: [credentialId], references: [id], onDelete: SetNull)\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n name String?\n moduleName String?\n externalId String?\n\n data Json @default(\"{}\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations - many-to-many with scalar lists\n integrations Integration[] @relation(\"IntegrationEntities\", fields: [integrationIds], references: [id])\n integrationIds String[] @db.ObjectId\n\n syncs Sync[] @relation(\"SyncEntities\", fields: [syncIds], references: [id])\n syncIds String[] @db.ObjectId\n\n dataIdentifiers DataIdentifier[]\n associationObjects AssociationObject[]\n\n @@index([userId])\n @@index([externalId])\n @@index([moduleName])\n @@index([credentialId])\n @@map(\"Entity\")\n}\n\n// ============================================================================\n// INTEGRATION MODELS\n// ============================================================================\n\n/// Main integration configuration and state\nmodel Integration {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n userId String? @db.ObjectId\n user User? @relation(fields: [userId], references: [id], onDelete: Cascade)\n status IntegrationStatus @default(ENABLED)\n\n // Configuration and version\n config Json? // Integration configuration object\n version String?\n\n // Entity references (many-to-many via explicit scalar list)\n entities Entity[] @relation(\"IntegrationEntities\", fields: [entityIds], references: [id])\n entityIds String[] @db.ObjectId\n\n // Message arrays (stored as JSON)\n errors Json @default(\"[]\")\n warnings Json @default(\"[]\")\n info Json @default(\"[]\")\n logs Json @default(\"[]\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // Relations\n associations Association[]\n syncs Sync[]\n mappings IntegrationMapping[]\n processes Process[]\n\n @@index([userId])\n @@index([status])\n @@map(\"Integration\")\n}\n\nenum IntegrationStatus {\n ENABLED\n NEEDS_CONFIG\n PROCESSING\n DISABLED\n ERROR\n}\n\n/// Integration-specific data mappings\n/// All mapping data encrypted with KMS\nmodel IntegrationMapping {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n sourceId String?\n\n // Encrypted mapping data (handled via Prisma middleware)\n mapping Json?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([integrationId, sourceId])\n @@index([integrationId])\n @@index([sourceId])\n @@map(\"IntegrationMapping\")\n}\n\n// ============================================================================\n// PROCESS MODELS\n// ============================================================================\n\n/// Generic Process Model - tracks any long-running operation\n/// Used for: CRM syncs, data migrations, bulk operations, etc.\nmodel Process {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n\n // Core references\n userId String @db.ObjectId\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n\n // Process identification\n name String // e.g., \"zoho-crm-contact-sync\", \"pipedrive-lead-sync\"\n type String // e.g., \"CRM_SYNC\", \"DATA_MIGRATION\", \"BULK_OPERATION\"\n\n // State machine\n state String // Current state (integration-defined states)\n\n // Flexible storage\n context Json @default(\"{}\") // Process-specific data (pagination, metadata, etc.)\n results Json @default(\"{}\") // Process results and metrics\n\n // Hierarchy support\n childProcesses String[] @db.ObjectId\n parentProcessId String? @db.ObjectId\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([userId])\n @@index([integrationId])\n @@index([type])\n @@index([state])\n @@index([name])\n @@map(\"Process\")\n}\n\n// ============================================================================\n// SYNC MODELS\n// ============================================================================\n\n/// Bidirectional data synchronization tracking\nmodel Sync {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String? @db.ObjectId\n integration Integration? @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n\n // Entity references (many-to-many via explicit scalar list)\n entities Entity[] @relation(\"SyncEntities\", fields: [entityIds], references: [id])\n entityIds String[] @db.ObjectId\n\n hash String\n name String\n\n // Data identifiers (extracted to separate model)\n dataIdentifiers DataIdentifier[]\n\n @@index([integrationId])\n @@index([hash])\n @@index([name])\n @@map(\"Sync\")\n}\n\n/// Data identifier for sync operations\n/// Replaces nested array structure in Mongoose\nmodel DataIdentifier {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n syncId String? @db.ObjectId\n sync Sync? @relation(fields: [syncId], references: [id], onDelete: Cascade)\n entityId String @db.ObjectId\n entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)\n\n // Identifier data (can be any structure)\n idData Json\n\n hash String\n\n @@index([syncId])\n @@index([entityId])\n @@index([hash])\n @@map(\"DataIdentifier\")\n}\n\n// ============================================================================\n// ASSOCIATION MODELS\n// ============================================================================\n\n/// Entity associations with cardinality tracking\nmodel Association {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n integrationId String @db.ObjectId\n integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade)\n name String\n type AssociationType\n primaryObject String\n\n // Associated objects (extracted to separate model)\n objects AssociationObject[]\n\n @@index([integrationId])\n @@index([name])\n @@map(\"Association\")\n}\n\n/// Association object entry\n/// Replaces nested array structure in Mongoose\nmodel AssociationObject {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n associationId String @db.ObjectId\n association Association @relation(fields: [associationId], references: [id], onDelete: Cascade)\n entityId String @db.ObjectId\n entity Entity @relation(fields: [entityId], references: [id], onDelete: Cascade)\n objectType String\n objId String\n metadata Json? // Optional metadata\n\n @@index([associationId])\n @@index([entityId])\n @@map(\"AssociationObject\")\n}\n\nenum AssociationType {\n ONE_TO_MANY\n ONE_TO_ONE\n MANY_TO_ONE\n}\n\n// ============================================================================\n// UTILITY MODELS\n// ============================================================================\n\n/// Generic state storage\nmodel State {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n state Json?\n\n @@map(\"State\")\n}\n\n/// AWS API Gateway WebSocket connection tracking\nmodel WebsocketConnection {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n connectionId String?\n\n @@index([connectionId])\n @@map(\"WebsocketConnection\")\n}\n\n// ============================================================================\n// ADMIN PROCESS MODELS\n// ============================================================================\n\n/// Admin process state machine\nenum AdminProcessState {\n PENDING\n RUNNING\n COMPLETED\n FAILED\n}\n\n/// Admin trigger types\nenum AdminTrigger {\n MANUAL\n SCHEDULED\n QUEUE\n WEBHOOK\n}\n\n/// Admin process tracking (like Process but without user/integration FK)\n/// Used for: admin scripts, db migrations, system maintenance tasks\nmodel AdminProcess {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n name String // e.g., \"oauth-token-refresh\", \"db-migration-xyz\"\n type String // e.g., \"ADMIN_SCRIPT\", \"DB_MIGRATION\"\n\n // State machine\n state AdminProcessState @default(PENDING)\n\n // Flexible storage (mirrors Process model pattern)\n context Json @default(\"{}\") // input, trigger, audit info, script version\n results Json @default(\"{}\") // output, logs, metrics, errors\n\n // Hierarchy support\n childProcesses String[] @db.ObjectId\n parentProcessId String? @db.ObjectId\n\n // Timestamps\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([name, createdAt(sort: Desc)])\n @@index([state])\n @@index([type])\n @@map(\"AdminProcess\")\n}\n\n/// Script scheduling configuration for hybrid scheduling (SQS + EventBridge)\nmodel ScriptSchedule {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n scriptName String @unique\n enabled Boolean @default(false)\n cronExpression String?\n timezone String @default(\"UTC\")\n lastTriggeredAt DateTime?\n nextTriggerAt DateTime?\n\n // External Scheduler (e.g., AWS EventBridge Scheduler)\n externalScheduleId String?\n externalScheduleName String?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([enabled])\n @@map(\"ScriptSchedule\")\n}\n\n/// One-time scheduled jobs for poll-and-dispatch scheduling pattern.\n/// Used by providers without native one-time scheduling APIs (e.g., Netlify).\n/// A cron function queries for due jobs and dispatches them to a queue.\nmodel ScheduledJob {\n id String @id @default(auto()) @map(\"_id\") @db.ObjectId\n scheduleName String @unique\n scheduledAt DateTime\n queueResourceId String\n payload Json?\n state String @default(\"PENDING\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([state, scheduledAt])\n @@map(\"ScheduledJob\")\n}\n",
372
+ "inlineSchemaHash": "3d80edbabc02073a63aacecb7bc75d59e99123c2b2fe67146ca70e7e1391bc9c",
369
373
  "copyEngine": true
370
374
  }
371
375
 
@@ -392,7 +396,7 @@ config.engineWasm = undefined
392
396
  config.compilerWasm = undefined
393
397
 
394
398
 
395
- const { warnEnvConflicts } = require('./runtime/binary.js')
399
+ const { warnEnvConflicts } = require('./runtime/library.js')
396
400
 
397
401
  warnEnvConflicts({
398
402
  rootEnvPath: config.relativeEnvPaths.rootEnvPath && path.resolve(config.dirname, config.relativeEnvPaths.rootEnvPath),
@@ -404,12 +408,12 @@ exports.PrismaClient = PrismaClient
404
408
  Object.assign(exports, Prisma)
405
409
 
406
410
  // file annotations for bundling tools to include these files
407
- path.join(__dirname, "query-engine-debian-openssl-3.0.x");
408
- path.join(process.cwd(), "generated/prisma-mongodb/query-engine-debian-openssl-3.0.x")
411
+ path.join(__dirname, "libquery_engine-debian-openssl-3.0.x.so.node");
412
+ path.join(process.cwd(), "generated/prisma-mongodb/libquery_engine-debian-openssl-3.0.x.so.node")
409
413
 
410
414
  // file annotations for bundling tools to include these files
411
- path.join(__dirname, "query-engine-rhel-openssl-3.0.x");
412
- path.join(process.cwd(), "generated/prisma-mongodb/query-engine-rhel-openssl-3.0.x")
415
+ path.join(__dirname, "libquery_engine-rhel-openssl-3.0.x.so.node");
416
+ path.join(process.cwd(), "generated/prisma-mongodb/libquery_engine-rhel-openssl-3.0.x.so.node")
413
417
  // file annotations for bundling tools to include these files
414
418
  path.join(__dirname, "schema.prisma");
415
419
  path.join(process.cwd(), "generated/prisma-mongodb/schema.prisma")
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-8784395e48ee50d3cd91a6b1e36f1272927ff4e0314e5febffed72a5a2545703",
2
+ "name": "prisma-client-a72e62ca72f630c278e949642228253eacf769453040dd1dd466d99e8de8df9f",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "default.js",