diff --git a/backend/.env b/backend/.env index 09b6fc0b..5b2f8268 100755 --- a/backend/.env +++ b/backend/.env @@ -7,8 +7,8 @@ NODE_ENV=development JWT_SECRET=change-this-in-production-to-random-string # AI Providers -AI_PROVIDER=iieasy -# iieasy | lmstudio +AI_PROVIDER=ollama +# iieasy | lmstudio | ollama # iieasy.ru API IIEASY_API_URL=https://ai.iieasy.ru/v1 @@ -19,6 +19,10 @@ IIEASY_MODEL=google/gemma-3n-e4b LMSTUDIO_API_URL=http://localhost:1234/v1 LMSTUDIO_MODEL=local-model +# Ollama +OLLAMA_API_URL=http://192.168.88.160:11434 +OLLAMA_MODEL=gemma3n:e4b + # Default company settings DEFAULT_EXECUTOR=ООО "ГеоВектор" DEFAULT_VAT_RATE=20 diff --git a/backend/.env.example b/backend/.env.example index 28813655..72ab4255 100755 --- a/backend/.env.example +++ b/backend/.env.example @@ -7,7 +7,7 @@ NODE_ENV=development # AI Providers AI_PROVIDER=iieasy -# iieasy | lmstudio +# iieasy | lmstudio | ollama # iieasy.ru API IIEASY_API_URL=https://ai.iieasy.ru/v1 @@ -18,6 +18,10 @@ IIEASY_MODEL=google/gemma-3n-e4b LMSTUDIO_API_URL=http://localhost:1234/v1 LMSTUDIO_MODEL=local-model +# Ollama +OLLAMA_API_URL=http://192.168.88.160:11434 +OLLAMA_MODEL=gemma3n:e4b + # Default company settings DEFAULT_EXECUTOR=ООО "ГеоВектор" DEFAULT_VAT_RATE=20 diff --git a/backend/fonts/README.md b/backend/fonts/README.md deleted file mode 100755 index 9da5aaee..00000000 --- a/backend/fonts/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Шрифты для PDF - -Для генерации PDF с кириллицей используются шрифты PT Sans из npm-пакета `@fontsource/pt-sans` (файлы в `node_modules/@fontsource/pt-sans/files/`). - -При необходимости можно положить сюда свои TTF/WOFF (например, PTSans-Regular.ttf и PTSans-Bold.ttf) — тогда в `pdf.service.ts` нужно указать путь к этой папке через `path.join(process.cwd(), 'fonts', '...')`. diff --git a/backend/node_modules/.package-lock.json b/backend/node_modules/.package-lock.json index 507c36de..5c2a13ec 100755 --- a/backend/node_modules/.package-lock.json +++ b/backend/node_modules/.package-lock.json @@ -276,6 +276,7 @@ "integrity": "sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -344,6 +345,7 @@ "integrity": "sha512-WJtwWJu7UdlvzEAUm484QNg5eAoq5QR08KDNx7g45Usrs2NtOPiX8ugDqmKdXkyL03rBqU5dYNYVQetEpBHq2g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -2633,6 +2635,7 @@ "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@prisma/engines": "5.22.0" }, @@ -3374,6 +3377,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/backend/node_modules/.prisma/client/default.d.ts b/backend/node_modules/.prisma/client/default.d.ts old mode 100755 new mode 100644 diff --git a/backend/node_modules/.prisma/client/default.js b/backend/node_modules/.prisma/client/default.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/.prisma/client/edge.d.ts b/backend/node_modules/.prisma/client/edge.d.ts old mode 100755 new mode 100644 diff --git a/backend/node_modules/.prisma/client/edge.js b/backend/node_modules/.prisma/client/edge.js old mode 100755 new mode 100644 index bcb94018..59cef38f --- a/backend/node_modules/.prisma/client/edge.js +++ b/backend/node_modules/.prisma/client/edge.js @@ -187,10 +187,13 @@ exports.Prisma.EstimateScalarFieldEnum = { totalLaboratory: 'totalLaboratory', subtotal: 'subtotal', regionalCoef: 'regionalCoef', + regionalCoefDocRef: 'regionalCoefDocRef', inflationIndex: 'inflationIndex', inflationDocRef: 'inflationDocRef', companyCoef: 'companyCoef', + companyCoefDocRef: 'companyCoefDocRef', executorCoef: 'executorCoef', + executorCoefDocRef: 'executorCoefDocRef', withVat: 'withVat', totalWithoutVat: 'totalWithoutVat', vatRate: 'vatRate', @@ -217,6 +220,14 @@ exports.Prisma.EstimateShareScalarFieldEnum = { createdAt: 'createdAt' }; +exports.Prisma.EstimateShareNoteScalarFieldEnum = { + id: 'id', + shareId: 'shareId', + authorId: 'authorId', + content: 'content', + createdAt: 'createdAt' +}; + exports.Prisma.EstimateItemScalarFieldEnum = { id: 'id', estimateId: 'estimateId', @@ -323,6 +334,7 @@ exports.Prisma.ModelName = { Estimate: 'Estimate', EstimateVersion: 'EstimateVersion', EstimateShare: 'EstimateShare', + EstimateShareNote: 'EstimateShareNote', EstimateItem: 'EstimateItem', EstimateTotal: 'EstimateTotal', Setting: 'Setting', @@ -340,7 +352,7 @@ const config = { "value": "prisma-client-js" }, "output": { - "value": "C:\\Users\\Job\\Desktop\\Сметы гео вариант 2\\backend\\node_modules\\@prisma\\client", + "value": "/home/its/suety-sasha/geo/backend/node_modules/@prisma/client", "fromEnvVar": null }, "config": { @@ -349,12 +361,12 @@ const config = { "binaryTargets": [ { "fromEnvVar": null, - "value": "windows", + "value": "debian-openssl-3.0.x", "native": true } ], "previewFeatures": [], - "sourceFilePath": "C:\\Users\\Job\\Desktop\\Сметы гео вариант 2\\backend\\prisma\\schema.prisma" + "sourceFilePath": "/home/its/suety-sasha/geo/backend/prisma/schema.prisma" }, "relativeEnvPaths": { "rootEnvPath": null, @@ -367,7 +379,6 @@ const config = { "db" ], "activeProvider": "postgresql", - "postinstall": false, "inlineDatasources": { "db": { "url": { @@ -376,13 +387,13 @@ const config = { } } }, - "inlineSchema": "// Prisma schema for Estimate Assistant\n\ngenerator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\n// Справочники базовых цен\nmodel PriceBook {\n id String @id @default(uuid())\n code String @unique // SBC-GEODESY-2004, SBC-GEOLOGY-1999\n name String // Полное название справочника\n baseDate DateTime // Дата базовых цен (01.01.2001, 01.01.1991)\n approvedBy String? // Кем утвержден\n effectiveDate DateTime? // Дата введения в действие\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n tables PriceTable[]\n items PriceItem[]\n}\n\n// Таблицы справочников\nmodel PriceTable {\n id String @id @default(uuid())\n priceBookId String\n tableNumber Int // Номер таблицы (8, 9, 13, и т.д.)\n name String // Название таблицы\n unit String // Единица измерения (1 пункт, 1 га, 1 км и т.д.)\n notes Json? // Примечания к таблице\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n priceBook PriceBook @relation(fields: [priceBookId], references: [id], onDelete: Cascade)\n items PriceItem[]\n\n @@unique([priceBookId, tableNumber])\n}\n\n// Позиции справочников (расценки)\nmodel PriceItem {\n id String @id @default(uuid())\n priceBookId String\n priceTableId String\n paragraph String // Номер параграфа (8-1, 9-4-1 и т.д.)\n workType String // Тип работы / наименование\n description String? // Дополнительное описание\n\n // Цены (полевые/камеральные для разных категорий)\n priceField1 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 1\n priceOffice1 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 1\n priceField2 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 2\n priceOffice2 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 2\n priceField3 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 3\n priceOffice3 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 3\n priceSimple Decimal? @db.Decimal(12, 2) // Простая цена (без категорий)\n\n // Дополнительные параметры\n attributes Json? // Доп. атрибуты (масштаб, глубина, диаметр и т.д.)\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n priceBook PriceBook @relation(fields: [priceBookId], references: [id], onDelete: Cascade)\n priceTable PriceTable @relation(fields: [priceTableId], references: [id], onDelete: Cascade)\n estimateItems EstimateItem[]\n\n @@index([paragraph])\n @@index([workType])\n}\n\n// Коэффициенты\nmodel Coefficient {\n id String @id @default(uuid())\n type String // regional, transport_internal, transport_external, seasonal, special\n code String // Уникальный код коэффициента\n name String // Название\n value Decimal @db.Decimal(6, 4) // Значение коэффициента\n description String? // Описание\n conditions Json? // Условия применения\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([type, code])\n}\n\n// Индексы инфляции (перевод в текущие цены)\nmodel InflationIndex {\n id String @id @default(uuid())\n baseDate DateTime // Базовая дата цен\n effectiveFrom DateTime // Дата начала действия индекса\n effectiveTo DateTime? // Дата окончания (null = текущий)\n indexValue Decimal @db.Decimal(10, 4) // Значение индекса\n documentRef String? // Ссылка на документ (Письмо Минстроя и т.д.)\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Пользователи\nmodel User {\n id String @id @default(uuid())\n email String @unique\n passwordHash String\n name String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimates Estimate[]\n chatSessions ChatSession[]\n ownedShares EstimateShare[] @relation(\"ShareOwner\")\n receivedShares EstimateShare[] @relation(\"ShareReceiver\")\n}\n\n// Направления изысканий\nmodel SurveyDirection {\n id String @id @default(uuid())\n code String @unique // geodesy, geology, ecology, hydrology\n name String // Инженерно-геодезические изыскания\n shortName String // Геодезия\n isActive Boolean @default(true)\n\n estimates Estimate[]\n}\n\n// Сметы\nmodel Estimate {\n id String @id @default(uuid())\n number String // Номер сметы\n directionId String\n ownerId String // Владелец сметы\n objectName String // Название объекта\n customer String // Заказчик\n executor String // Исполнитель\n\n // Итоговые значения\n totalFieldWorks Decimal? @db.Decimal(14, 2) // Итого полевые работы\n totalOfficeWorks Decimal? @db.Decimal(14, 2) // Итого камеральные работы\n totalLaboratory Decimal? @db.Decimal(14, 2) // Итого лабораторные\n subtotal Decimal? @db.Decimal(14, 2) // Итого по изысканиям\n\n // Коэффициенты и пересчет\n regionalCoef Decimal? @db.Decimal(6, 4) // Районный коэффициент\n inflationIndex Decimal? @db.Decimal(10, 4) // Индекс перевода в текущие цены\n inflationDocRef String? // Ссылка на документ с индексом\n companyCoef Decimal? @db.Decimal(6, 4) // Коэффициент компании (Газпром и т.д.)\n executorCoef Decimal? @db.Decimal(6, 4) // Коэффициент исполнителя\n\n // Итоги\n withVat Boolean @default(true) // Смета с НДС (true) или без НДС (false)\n totalWithoutVat Decimal? @db.Decimal(14, 2) // Итого без НДС\n vatRate Decimal? @db.Decimal(4, 2) // Ставка НДС (18, 20, 7)\n vatAmount Decimal? @db.Decimal(14, 2) // Сумма НДС\n totalWithVat Decimal? @db.Decimal(14, 2) // Всего с НДС\n\n status String @default(\"draft\") // draft, completed, approved\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)\n direction SurveyDirection @relation(fields: [directionId], references: [id])\n items EstimateItem[]\n totals EstimateTotal[]\n shares EstimateShare[]\n versions EstimateVersion[]\n}\n\n// История версий сметы (снимок при сохранении/пересчёте)\nmodel EstimateVersion {\n id String @id @default(uuid())\n estimateId String\n versionNumber Int // Порядковый номер версии по смете\n snapshot Json // Полный снимок: estimate + items + totals\n createdAt DateTime @default(now())\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n\n @@index([estimateId])\n @@index([estimateId, createdAt])\n}\n\n// Шаринг сметы с другим пользователем\nmodel EstimateShare {\n id String @id @default(uuid())\n estimateId String\n ownerId String // Кто поделился\n sharedWithId String // С кем поделились\n createdAt DateTime @default(now())\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n sharedWith User @relation(\"ShareReceiver\", fields: [sharedWithId], references: [id], onDelete: Cascade)\n owner User @relation(\"ShareOwner\", fields: [ownerId], references: [id], onDelete: Cascade)\n\n @@unique([estimateId, sharedWithId])\n @@index([sharedWithId])\n}\n\n// Позиции сметы\nmodel EstimateItem {\n id String @id @default(uuid())\n estimateId String\n orderNumber Int // Порядковый номер\n sectionType String // field, office, laboratory, transport, other\n priceItemId String? // Ссылка на позицию справочника\n\n workName String // Наименование работы\n justification String? // Обоснование (ссылка на СБЦ)\n basePrice Decimal @db.Decimal(12, 2) // Базовая цена\n quantity Decimal @db.Decimal(12, 4) // Объем\n unit String? // Единица измерения\n\n // Коэффициенты\n coef1 Decimal? @db.Decimal(6, 4) // Коэффициент 1\n coef1Desc String? // Описание коэффициента 1\n coef2 Decimal? @db.Decimal(6, 4) // Коэффициент 2\n coef2Desc String? // Описание коэффициента 2\n coef3 Decimal? @db.Decimal(6, 4) // Коэффициент 3\n coef3Desc String? // Описание коэффициента 3\n\n totalPrice Decimal @db.Decimal(14, 2) // Итоговая стоимость\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n priceItem PriceItem? @relation(fields: [priceItemId], references: [id])\n\n @@index([estimateId, orderNumber])\n}\n\n// Итоговая часть сметы (нижняя часть)\nmodel EstimateTotal {\n id String @id @default(uuid())\n estimateId String\n orderNumber Int // Порядок строки\n label String // Название строки (Перевод в текущие цены, НДС и т.д.)\n description String? // Дополнительное описание\n baseValue Decimal? @db.Decimal(14, 2) // Базовое значение\n coefficient Decimal? @db.Decimal(10, 4) // Коэффициент/процент\n resultValue Decimal @db.Decimal(14, 2) // Результат\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n\n @@index([estimateId, orderNumber])\n}\n\n// Настройки приложения\nmodel Setting {\n id String @id @default(uuid())\n key String @unique\n value String\n type String @default(\"string\") // string, number, boolean, json\n category String // general, company, ai, display\n label String? // Человекочитаемое название\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Сессии чата (у каждого пользователя свои контексты ИИ)\nmodel ChatSession {\n id String @id @default(uuid())\n userId String // Владелец сессии\n estimateId String? // Связанная смета (опционально)\n status String @default(\"active\") // active, completed\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n messages ChatMessage[]\n\n @@index([userId])\n @@index([userId, estimateId])\n}\n\n// Сообщения чата\nmodel ChatMessage {\n id String @id @default(uuid())\n sessionId String\n role String // user, assistant, system\n content String\n metadata Json? // Доп. данные (извлеченные сущности и т.д.)\n createdAt DateTime @default(now())\n\n session ChatSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)\n\n @@index([sessionId, createdAt])\n}\n", - "inlineSchemaHash": "bc80edc361cc68e644a8e28a66cb71ea44953b4cdcc4022b7c0c5dfdc80644fc", + "inlineSchema": "// Prisma schema for Estimate Assistant\n\ngenerator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\n// Справочники базовых цен (СБЦ)\nmodel PriceBook {\n id String @id @default(uuid())\n code String @unique // SBC-GEODESY-2004, SBC-GEOLOGY-1999\n name String // Полное название справочника\n baseDate DateTime // Дата базовых цен (01.01.2001, 01.01.1991)\n approvedBy String? // Кем утвержден\n effectiveDate DateTime? // Дата введения в действие\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n tables PriceTable[]\n items PriceItem[]\n}\n\n// Таблицы справочников\nmodel PriceTable {\n id String @id @default(uuid())\n priceBookId String\n tableNumber Int // Номер таблицы (8, 9, 13, и т.д.)\n name String // Название таблицы\n unit String // Единица измерения (1 пункт, 1 га, 1 км и т.д.)\n notes Json? // Примечания к таблице\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n priceBook PriceBook @relation(fields: [priceBookId], references: [id], onDelete: Cascade)\n items PriceItem[]\n\n @@unique([priceBookId, tableNumber])\n}\n\n// Позиции справочников (расценки)\nmodel PriceItem {\n id String @id @default(uuid())\n priceBookId String\n priceTableId String\n paragraph String // Номер параграфа (8-1, 9-4-1 и т.д.)\n workType String // Тип работы / наименование\n description String? // Дополнительное описание\n\n // Цены (полевые/камеральные для разных категорий)\n priceField1 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 1\n priceOffice1 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 1\n priceField2 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 2\n priceOffice2 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 2\n priceField3 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 3\n priceOffice3 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 3\n priceSimple Decimal? @db.Decimal(12, 2) // Простая цена (без категорий)\n\n // Дополнительные параметры\n attributes Json? // Доп. атрибуты (масштаб, глубина, диаметр и т.д.)\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n priceBook PriceBook @relation(fields: [priceBookId], references: [id], onDelete: Cascade)\n priceTable PriceTable @relation(fields: [priceTableId], references: [id], onDelete: Cascade)\n estimateItems EstimateItem[]\n\n @@index([paragraph])\n @@index([workType])\n}\n\n// Коэффициенты\nmodel Coefficient {\n id String @id @default(uuid())\n type String // regional, transport_internal, transport_external, seasonal, special\n code String // Уникальный код коэффициента\n name String // Название\n value Decimal @db.Decimal(6, 4) // Значение коэффициента\n description String? // Описание\n conditions Json? // Условия применения\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([type, code])\n}\n\n// Индексы инфляции (перевод в текущие цены)\nmodel InflationIndex {\n id String @id @default(uuid())\n baseDate DateTime // Базовая дата цен\n effectiveFrom DateTime // Дата начала действия индекса\n effectiveTo DateTime? // Дата окончания (null = текущий)\n indexValue Decimal @db.Decimal(10, 4) // Значение индекса\n documentRef String? // Ссылка на документ (Письмо Минстроя и т.д.)\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Пользователи\nmodel User {\n id String @id @default(uuid())\n email String @unique\n passwordHash String\n name String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimates Estimate[]\n chatSessions ChatSession[]\n ownedShares EstimateShare[] @relation(\"ShareOwner\")\n receivedShares EstimateShare[] @relation(\"ShareReceiver\")\n shareNotes EstimateShareNote[]\n}\n\n// Направления изысканий\nmodel SurveyDirection {\n id String @id @default(uuid())\n code String @unique // geodesy, geology, ecology, hydrology\n name String // Инженерно-геодезические изыскания\n shortName String // Геодезия\n isActive Boolean @default(true)\n\n estimates Estimate[]\n}\n\n// Сметы\nmodel Estimate {\n id String @id @default(uuid())\n number String // Номер сметы\n directionId String\n ownerId String // Владелец сметы\n objectName String // Название объекта\n customer String // Заказчик\n executor String // Исполнитель\n\n // Итоговые значения\n totalFieldWorks Decimal? @db.Decimal(14, 2) // Итого полевые работы\n totalOfficeWorks Decimal? @db.Decimal(14, 2) // Итого камеральные работы\n totalLaboratory Decimal? @db.Decimal(14, 2) // Итого лабораторные\n subtotal Decimal? @db.Decimal(14, 2) // Итого по изысканиям\n\n // Коэффициенты и пересчет\n regionalCoef Decimal? @db.Decimal(6, 4) // Районный коэффициент\n regionalCoefDocRef String? // Описание (С районным коэффициентом и т.д.)\n inflationIndex Decimal? @db.Decimal(10, 4) // Индекс перевода в текущие цены\n inflationDocRef String? // Ссылка на документ (Письмо Минстроя и т.д.)\n companyCoef Decimal? @db.Decimal(6, 4) // Коэффициент компании (Газпром и т.д.)\n companyCoefDocRef String? // Описание (Коэффициент ОАО «Газпром» №544 и т.д.)\n executorCoef Decimal? @db.Decimal(6, 4) // Коэффициент исполнителя\n executorCoefDocRef String? // Описание (Коэффициент ООО «ГеоВектор» и т.д.)\n\n // Итоги\n withVat Boolean @default(true) // Смета с НДС (true) или без НДС (false)\n totalWithoutVat Decimal? @db.Decimal(14, 2) // Итого без НДС\n vatRate Decimal? @db.Decimal(4, 2) // Ставка НДС (18, 20, 7)\n vatAmount Decimal? @db.Decimal(14, 2) // Сумма НДС\n totalWithVat Decimal? @db.Decimal(14, 2) // Всего с НДС\n\n status String @default(\"draft\") // draft, completed, approved\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)\n direction SurveyDirection @relation(fields: [directionId], references: [id])\n items EstimateItem[]\n totals EstimateTotal[]\n shares EstimateShare[]\n versions EstimateVersion[]\n}\n\n// История версий сметы (снимок при сохранении/пересчёте)\nmodel EstimateVersion {\n id String @id @default(uuid())\n estimateId String\n versionNumber Int // Порядковый номер версии по смете\n snapshot Json // Полный снимок: estimate + items + totals\n createdAt DateTime @default(now())\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n\n @@index([estimateId])\n @@index([estimateId, createdAt])\n}\n\n// Шаринг сметы с другим пользователем\nmodel EstimateShare {\n id String @id @default(uuid())\n estimateId String\n ownerId String // Кто поделился\n sharedWithId String // С кем поделились\n createdAt DateTime @default(now())\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n sharedWith User @relation(\"ShareReceiver\", fields: [sharedWithId], references: [id], onDelete: Cascade)\n owner User @relation(\"ShareOwner\", fields: [ownerId], references: [id], onDelete: Cascade)\n notes EstimateShareNote[]\n\n @@unique([estimateId, sharedWithId])\n @@index([sharedWithId])\n}\n\n// Заметки к шарингу сметы (кто что написал)\nmodel EstimateShareNote {\n id String @id @default(uuid())\n shareId String\n authorId String\n content String @db.Text\n createdAt DateTime @default(now())\n\n share EstimateShare @relation(fields: [shareId], references: [id], onDelete: Cascade)\n author User @relation(fields: [authorId], references: [id], onDelete: Cascade)\n\n @@index([shareId])\n}\n\n// Позиции сметы\nmodel EstimateItem {\n id String @id @default(uuid())\n estimateId String\n orderNumber Int // Порядковый номер\n sectionType String // field, office, laboratory, transport, other\n priceItemId String? // Ссылка на позицию справочника\n\n workName String // Наименование работы\n justification String? // Обоснование (ссылка на СБЦ)\n basePrice Decimal @db.Decimal(12, 2) // Базовая цена\n quantity Decimal @db.Decimal(12, 4) // Объем\n unit String? // Единица измерения\n\n // Коэффициенты\n coef1 Decimal? @db.Decimal(6, 4) // Коэффициент 1\n coef1Desc String? // Описание коэффициента 1\n coef2 Decimal? @db.Decimal(6, 4) // Коэффициент 2\n coef2Desc String? // Описание коэффициента 2\n coef3 Decimal? @db.Decimal(6, 4) // Коэффициент 3\n coef3Desc String? // Описание коэффициента 3\n\n totalPrice Decimal @db.Decimal(14, 2) // Итоговая стоимость\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n priceItem PriceItem? @relation(fields: [priceItemId], references: [id])\n\n @@index([estimateId, orderNumber])\n}\n\n// Итоговая часть сметы (нижняя часть)\nmodel EstimateTotal {\n id String @id @default(uuid())\n estimateId String\n orderNumber Int // Порядок строки\n label String // Название строки (Перевод в текущие цены, НДС и т.д.)\n description String? // Дополнительное описание\n baseValue Decimal? @db.Decimal(14, 2) // Базовое значение\n coefficient Decimal? @db.Decimal(10, 4) // Коэффициент/процент\n resultValue Decimal @db.Decimal(14, 2) // Результат\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n\n @@index([estimateId, orderNumber])\n}\n\n// Настройки приложения\nmodel Setting {\n id String @id @default(uuid())\n key String @unique\n value String\n type String @default(\"string\") // string, number, boolean, json\n category String // general, company, ai, display\n label String? // Человекочитаемое название\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Сессии чата (у каждого пользователя свои контексты ИИ)\nmodel ChatSession {\n id String @id @default(uuid())\n userId String // Владелец сессии\n estimateId String? // Связанная смета (опционально)\n status String @default(\"active\") // active, completed\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n messages ChatMessage[]\n\n @@index([userId])\n @@index([userId, estimateId])\n}\n\n// Сообщения чата\nmodel ChatMessage {\n id String @id @default(uuid())\n sessionId String\n role String // user, assistant, system\n content String\n metadata Json? // Доп. данные (извлеченные сущности и т.д.)\n createdAt DateTime @default(now())\n\n session ChatSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)\n\n @@index([sessionId, createdAt])\n}\n", + "inlineSchemaHash": "de619b5bba6e06459d564f5c699a9b4c82e24de5d6f166361c40bbe179609203", "copyEngine": true } config.dirname = '/' -config.runtimeDataModel = JSON.parse("{\"models\":{\"PriceBook\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"approvedBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"tables\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceTable\",\"relationName\":\"PriceBookToPriceTable\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"PriceBookToPriceItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PriceTable\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceBookId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tableNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"priceBook\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceBook\",\"relationName\":\"PriceBookToPriceTable\",\"relationFromFields\":[\"priceBookId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"PriceItemToPriceTable\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"priceBookId\",\"tableNumber\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"priceBookId\",\"tableNumber\"]}],\"isGenerated\":false},\"PriceItem\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceBookId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceTableId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"paragraph\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"workType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceSimple\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"attributes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"priceBook\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceBook\",\"relationName\":\"PriceBookToPriceItem\",\"relationFromFields\":[\"priceBookId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceTable\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceTable\",\"relationName\":\"PriceItemToPriceTable\",\"relationFromFields\":[\"priceTableId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateItems\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateItem\",\"relationName\":\"EstimateItemToPriceItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Coefficient\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"conditions\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"type\",\"code\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"type\",\"code\"]}],\"isGenerated\":false},\"InflationIndex\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveFrom\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveTo\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"indexValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimates\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"chatSessions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatSession\",\"relationName\":\"ChatSessionToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownedShares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"ShareOwner\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receivedShares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"ShareReceiver\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SurveyDirection\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shortName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimates\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToSurveyDirection\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Estimate\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"number\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"directionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"objectName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executor\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalFieldWorks\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalOfficeWorks\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalLaboratory\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subtotal\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"regionalCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"inflationIndex\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"inflationDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executorCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"withVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalWithoutVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vatRate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vatAmount\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalWithVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"draft\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"owner\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"EstimateToUser\",\"relationFromFields\":[\"ownerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"direction\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SurveyDirection\",\"relationName\":\"EstimateToSurveyDirection\",\"relationFromFields\":[\"directionId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateItem\",\"relationName\":\"EstimateToEstimateItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totals\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateTotal\",\"relationName\":\"EstimateToEstimateTotal\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"EstimateToEstimateShare\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"versions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateVersion\",\"relationName\":\"EstimateToEstimateVersion\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateVersion\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"versionNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"snapshot\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateVersion\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateShare\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sharedWithId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateShare\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sharedWith\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ShareReceiver\",\"relationFromFields\":[\"sharedWithId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"owner\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ShareOwner\",\"relationFromFields\":[\"ownerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"estimateId\",\"sharedWithId\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"estimateId\",\"sharedWithId\"]}],\"isGenerated\":false},\"EstimateItem\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sectionType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceItemId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"workName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"justification\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"quantity\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef1Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef2Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef3Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalPrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateItem\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceItem\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"EstimateItemToPriceItem\",\"relationFromFields\":[\"priceItemId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateTotal\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"label\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coefficient\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resultValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateTotal\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Setting\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"key\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"string\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"category\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"label\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ChatSession\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"active\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ChatSessionToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"messages\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatMessage\",\"relationName\":\"ChatMessageToChatSession\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ChatMessage\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sessionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"content\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"metadata\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"session\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatSession\",\"relationName\":\"ChatMessageToChatSession\",\"relationFromFields\":[\"sessionId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"PriceBook\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"approvedBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"tables\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceTable\",\"relationName\":\"PriceBookToPriceTable\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"PriceBookToPriceItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PriceTable\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceBookId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tableNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"priceBook\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceBook\",\"relationName\":\"PriceBookToPriceTable\",\"relationFromFields\":[\"priceBookId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"PriceItemToPriceTable\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"priceBookId\",\"tableNumber\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"priceBookId\",\"tableNumber\"]}],\"isGenerated\":false},\"PriceItem\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceBookId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceTableId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"paragraph\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"workType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceSimple\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"attributes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"priceBook\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceBook\",\"relationName\":\"PriceBookToPriceItem\",\"relationFromFields\":[\"priceBookId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceTable\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceTable\",\"relationName\":\"PriceItemToPriceTable\",\"relationFromFields\":[\"priceTableId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateItems\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateItem\",\"relationName\":\"EstimateItemToPriceItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Coefficient\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"conditions\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"type\",\"code\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"type\",\"code\"]}],\"isGenerated\":false},\"InflationIndex\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveFrom\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveTo\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"indexValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimates\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"chatSessions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatSession\",\"relationName\":\"ChatSessionToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownedShares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"ShareOwner\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receivedShares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"ShareReceiver\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shareNotes\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShareNote\",\"relationName\":\"EstimateShareNoteToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SurveyDirection\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shortName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimates\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToSurveyDirection\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Estimate\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"number\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"directionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"objectName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executor\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalFieldWorks\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalOfficeWorks\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalLaboratory\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subtotal\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"regionalCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"regionalCoefDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"inflationIndex\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"inflationDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyCoefDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executorCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executorCoefDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"withVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalWithoutVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vatRate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vatAmount\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalWithVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"draft\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"owner\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"EstimateToUser\",\"relationFromFields\":[\"ownerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"direction\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SurveyDirection\",\"relationName\":\"EstimateToSurveyDirection\",\"relationFromFields\":[\"directionId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateItem\",\"relationName\":\"EstimateToEstimateItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totals\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateTotal\",\"relationName\":\"EstimateToEstimateTotal\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"EstimateToEstimateShare\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"versions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateVersion\",\"relationName\":\"EstimateToEstimateVersion\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateVersion\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"versionNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"snapshot\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateVersion\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateShare\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sharedWithId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateShare\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sharedWith\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ShareReceiver\",\"relationFromFields\":[\"sharedWithId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"owner\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ShareOwner\",\"relationFromFields\":[\"ownerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShareNote\",\"relationName\":\"EstimateShareToEstimateShareNote\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"estimateId\",\"sharedWithId\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"estimateId\",\"sharedWithId\"]}],\"isGenerated\":false},\"EstimateShareNote\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shareId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"authorId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"content\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"share\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"EstimateShareToEstimateShareNote\",\"relationFromFields\":[\"shareId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"author\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"EstimateShareNoteToUser\",\"relationFromFields\":[\"authorId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateItem\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sectionType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceItemId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"workName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"justification\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"quantity\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef1Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef2Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef3Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalPrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateItem\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceItem\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"EstimateItemToPriceItem\",\"relationFromFields\":[\"priceItemId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateTotal\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"label\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coefficient\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resultValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateTotal\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Setting\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"key\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"string\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"category\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"label\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ChatSession\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"active\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ChatSessionToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"messages\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatMessage\",\"relationName\":\"ChatMessageToChatSession\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ChatMessage\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sessionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"content\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"metadata\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"session\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatSession\",\"relationName\":\"ChatMessageToChatSession\",\"relationFromFields\":[\"sessionId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{},\"types\":{}}") defineDmmfProperty(exports.Prisma, config.runtimeDataModel) config.engineWasm = undefined diff --git a/backend/node_modules/.prisma/client/index-browser.js b/backend/node_modules/.prisma/client/index-browser.js old mode 100755 new mode 100644 index f1efd3fd..9e26836c --- a/backend/node_modules/.prisma/client/index-browser.js +++ b/backend/node_modules/.prisma/client/index-browser.js @@ -219,10 +219,13 @@ exports.Prisma.EstimateScalarFieldEnum = { totalLaboratory: 'totalLaboratory', subtotal: 'subtotal', regionalCoef: 'regionalCoef', + regionalCoefDocRef: 'regionalCoefDocRef', inflationIndex: 'inflationIndex', inflationDocRef: 'inflationDocRef', companyCoef: 'companyCoef', + companyCoefDocRef: 'companyCoefDocRef', executorCoef: 'executorCoef', + executorCoefDocRef: 'executorCoefDocRef', withVat: 'withVat', totalWithoutVat: 'totalWithoutVat', vatRate: 'vatRate', @@ -249,6 +252,14 @@ exports.Prisma.EstimateShareScalarFieldEnum = { createdAt: 'createdAt' }; +exports.Prisma.EstimateShareNoteScalarFieldEnum = { + id: 'id', + shareId: 'shareId', + authorId: 'authorId', + content: 'content', + createdAt: 'createdAt' +}; + exports.Prisma.EstimateItemScalarFieldEnum = { id: 'id', estimateId: 'estimateId', @@ -355,6 +366,7 @@ exports.Prisma.ModelName = { Estimate: 'Estimate', EstimateVersion: 'EstimateVersion', EstimateShare: 'EstimateShare', + EstimateShareNote: 'EstimateShareNote', EstimateItem: 'EstimateItem', EstimateTotal: 'EstimateTotal', Setting: 'Setting', diff --git a/backend/node_modules/.prisma/client/index.d.ts b/backend/node_modules/.prisma/client/index.d.ts old mode 100755 new mode 100644 index c6b37e20..f5fb7127 --- a/backend/node_modules/.prisma/client/index.d.ts +++ b/backend/node_modules/.prisma/client/index.d.ts @@ -63,6 +63,11 @@ export type EstimateVersion = $Result.DefaultSelection +/** + * Model EstimateShareNote + * + */ +export type EstimateShareNote = $Result.DefaultSelection /** * Model EstimateItem * @@ -312,6 +317,16 @@ export class PrismaClient< */ get estimateShare(): Prisma.EstimateShareDelegate; + /** + * `prisma.estimateShareNote`: Exposes CRUD operations for the **EstimateShareNote** model. + * Example usage: + * ```ts + * // Fetch zero or more EstimateShareNotes + * const estimateShareNotes = await prisma.estimateShareNote.findMany() + * ``` + */ + get estimateShareNote(): Prisma.EstimateShareNoteDelegate; + /** * `prisma.estimateItem`: Exposes CRUD operations for the **EstimateItem** model. * Example usage: @@ -812,6 +827,7 @@ export namespace Prisma { Estimate: 'Estimate', EstimateVersion: 'EstimateVersion', EstimateShare: 'EstimateShare', + EstimateShareNote: 'EstimateShareNote', EstimateItem: 'EstimateItem', EstimateTotal: 'EstimateTotal', Setting: 'Setting', @@ -832,7 +848,7 @@ export namespace Prisma { export type TypeMap = { meta: { - modelProps: "priceBook" | "priceTable" | "priceItem" | "coefficient" | "inflationIndex" | "user" | "surveyDirection" | "estimate" | "estimateVersion" | "estimateShare" | "estimateItem" | "estimateTotal" | "setting" | "chatSession" | "chatMessage" + modelProps: "priceBook" | "priceTable" | "priceItem" | "coefficient" | "inflationIndex" | "user" | "surveyDirection" | "estimate" | "estimateVersion" | "estimateShare" | "estimateShareNote" | "estimateItem" | "estimateTotal" | "setting" | "chatSession" | "chatMessage" txIsolationLevel: Prisma.TransactionIsolationLevel } model: { @@ -1536,6 +1552,76 @@ export namespace Prisma { } } } + EstimateShareNote: { + payload: Prisma.$EstimateShareNotePayload + fields: Prisma.EstimateShareNoteFieldRefs + operations: { + findUnique: { + args: Prisma.EstimateShareNoteFindUniqueArgs + result: $Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.EstimateShareNoteFindUniqueOrThrowArgs + result: $Utils.PayloadToResult + } + findFirst: { + args: Prisma.EstimateShareNoteFindFirstArgs + result: $Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.EstimateShareNoteFindFirstOrThrowArgs + result: $Utils.PayloadToResult + } + findMany: { + args: Prisma.EstimateShareNoteFindManyArgs + result: $Utils.PayloadToResult[] + } + create: { + args: Prisma.EstimateShareNoteCreateArgs + result: $Utils.PayloadToResult + } + createMany: { + args: Prisma.EstimateShareNoteCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.EstimateShareNoteCreateManyAndReturnArgs + result: $Utils.PayloadToResult[] + } + delete: { + args: Prisma.EstimateShareNoteDeleteArgs + result: $Utils.PayloadToResult + } + update: { + args: Prisma.EstimateShareNoteUpdateArgs + result: $Utils.PayloadToResult + } + deleteMany: { + args: Prisma.EstimateShareNoteDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.EstimateShareNoteUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.EstimateShareNoteUpsertArgs + result: $Utils.PayloadToResult + } + aggregate: { + args: Prisma.EstimateShareNoteAggregateArgs + result: $Utils.Optional + } + groupBy: { + args: Prisma.EstimateShareNoteGroupByArgs + result: $Utils.Optional[] + } + count: { + args: Prisma.EstimateShareNoteCountArgs + result: $Utils.Optional | number + } + } + } EstimateItem: { payload: Prisma.$EstimateItemPayload fields: Prisma.EstimateItemFieldRefs @@ -2153,6 +2239,7 @@ export namespace Prisma { chatSessions: number ownedShares: number receivedShares: number + shareNotes: number } export type UserCountOutputTypeSelect = { @@ -2160,6 +2247,7 @@ export namespace Prisma { chatSessions?: boolean | UserCountOutputTypeCountChatSessionsArgs ownedShares?: boolean | UserCountOutputTypeCountOwnedSharesArgs receivedShares?: boolean | UserCountOutputTypeCountReceivedSharesArgs + shareNotes?: boolean | UserCountOutputTypeCountShareNotesArgs } // Custom InputTypes @@ -2201,6 +2289,13 @@ export namespace Prisma { where?: EstimateShareWhereInput } + /** + * UserCountOutputType without action + */ + export type UserCountOutputTypeCountShareNotesArgs = { + where?: EstimateShareNoteWhereInput + } + /** * Count Type SurveyDirectionCountOutputType @@ -2291,6 +2386,37 @@ export namespace Prisma { } + /** + * Count Type EstimateShareCountOutputType + */ + + export type EstimateShareCountOutputType = { + notes: number + } + + export type EstimateShareCountOutputTypeSelect = { + notes?: boolean | EstimateShareCountOutputTypeCountNotesArgs + } + + // Custom InputTypes + /** + * EstimateShareCountOutputType without action + */ + export type EstimateShareCountOutputTypeDefaultArgs = { + /** + * Select specific fields to fetch from the EstimateShareCountOutputType + */ + select?: EstimateShareCountOutputTypeSelect | null + } + + /** + * EstimateShareCountOutputType without action + */ + export type EstimateShareCountOutputTypeCountNotesArgs = { + where?: EstimateShareNoteWhereInput + } + + /** * Count Type ChatSessionCountOutputType */ @@ -7626,6 +7752,7 @@ export namespace Prisma { chatSessions?: boolean | User$chatSessionsArgs ownedShares?: boolean | User$ownedSharesArgs receivedShares?: boolean | User$receivedSharesArgs + shareNotes?: boolean | User$shareNotesArgs _count?: boolean | UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> @@ -7652,6 +7779,7 @@ export namespace Prisma { chatSessions?: boolean | User$chatSessionsArgs ownedShares?: boolean | User$ownedSharesArgs receivedShares?: boolean | User$receivedSharesArgs + shareNotes?: boolean | User$shareNotesArgs _count?: boolean | UserCountOutputTypeDefaultArgs } export type UserIncludeCreateManyAndReturn = {} @@ -7663,6 +7791,7 @@ export namespace Prisma { chatSessions: Prisma.$ChatSessionPayload[] ownedShares: Prisma.$EstimateSharePayload[] receivedShares: Prisma.$EstimateSharePayload[] + shareNotes: Prisma.$EstimateShareNotePayload[] } scalars: $Extensions.GetPayloadResult<{ id: string @@ -8039,6 +8168,7 @@ export namespace Prisma { chatSessions = {}>(args?: Subset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany"> | Null> ownedShares = {}>(args?: Subset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany"> | Null> receivedShares = {}>(args?: Subset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany"> | Null> + shareNotes = {}>(args?: Subset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany"> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -8467,6 +8597,26 @@ export namespace Prisma { distinct?: EstimateShareScalarFieldEnum | EstimateShareScalarFieldEnum[] } + /** + * User.shareNotes + */ + export type User$shareNotesArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + where?: EstimateShareNoteWhereInput + orderBy?: EstimateShareNoteOrderByWithRelationInput | EstimateShareNoteOrderByWithRelationInput[] + cursor?: EstimateShareNoteWhereUniqueInput + take?: number + skip?: number + distinct?: EstimateShareNoteScalarFieldEnum | EstimateShareNoteScalarFieldEnum[] + } + /** * User without action */ @@ -9485,10 +9635,13 @@ export namespace Prisma { totalLaboratory: Decimal | null subtotal: Decimal | null regionalCoef: Decimal | null + regionalCoefDocRef: string | null inflationIndex: Decimal | null inflationDocRef: string | null companyCoef: Decimal | null + companyCoefDocRef: string | null executorCoef: Decimal | null + executorCoefDocRef: string | null withVat: boolean | null totalWithoutVat: Decimal | null vatRate: Decimal | null @@ -9512,10 +9665,13 @@ export namespace Prisma { totalLaboratory: Decimal | null subtotal: Decimal | null regionalCoef: Decimal | null + regionalCoefDocRef: string | null inflationIndex: Decimal | null inflationDocRef: string | null companyCoef: Decimal | null + companyCoefDocRef: string | null executorCoef: Decimal | null + executorCoefDocRef: string | null withVat: boolean | null totalWithoutVat: Decimal | null vatRate: Decimal | null @@ -9539,10 +9695,13 @@ export namespace Prisma { totalLaboratory: number subtotal: number regionalCoef: number + regionalCoefDocRef: number inflationIndex: number inflationDocRef: number companyCoef: number + companyCoefDocRef: number executorCoef: number + executorCoefDocRef: number withVat: number totalWithoutVat: number vatRate: number @@ -9598,10 +9757,13 @@ export namespace Prisma { totalLaboratory?: true subtotal?: true regionalCoef?: true + regionalCoefDocRef?: true inflationIndex?: true inflationDocRef?: true companyCoef?: true + companyCoefDocRef?: true executorCoef?: true + executorCoefDocRef?: true withVat?: true totalWithoutVat?: true vatRate?: true @@ -9625,10 +9787,13 @@ export namespace Prisma { totalLaboratory?: true subtotal?: true regionalCoef?: true + regionalCoefDocRef?: true inflationIndex?: true inflationDocRef?: true companyCoef?: true + companyCoefDocRef?: true executorCoef?: true + executorCoefDocRef?: true withVat?: true totalWithoutVat?: true vatRate?: true @@ -9652,10 +9817,13 @@ export namespace Prisma { totalLaboratory?: true subtotal?: true regionalCoef?: true + regionalCoefDocRef?: true inflationIndex?: true inflationDocRef?: true companyCoef?: true + companyCoefDocRef?: true executorCoef?: true + executorCoefDocRef?: true withVat?: true totalWithoutVat?: true vatRate?: true @@ -9766,10 +9934,13 @@ export namespace Prisma { totalLaboratory: Decimal | null subtotal: Decimal | null regionalCoef: Decimal | null + regionalCoefDocRef: string | null inflationIndex: Decimal | null inflationDocRef: string | null companyCoef: Decimal | null + companyCoefDocRef: string | null executorCoef: Decimal | null + executorCoefDocRef: string | null withVat: boolean totalWithoutVat: Decimal | null vatRate: Decimal | null @@ -9812,10 +9983,13 @@ export namespace Prisma { totalLaboratory?: boolean subtotal?: boolean regionalCoef?: boolean + regionalCoefDocRef?: boolean inflationIndex?: boolean inflationDocRef?: boolean companyCoef?: boolean + companyCoefDocRef?: boolean executorCoef?: boolean + executorCoefDocRef?: boolean withVat?: boolean totalWithoutVat?: boolean vatRate?: boolean @@ -9846,10 +10020,13 @@ export namespace Prisma { totalLaboratory?: boolean subtotal?: boolean regionalCoef?: boolean + regionalCoefDocRef?: boolean inflationIndex?: boolean inflationDocRef?: boolean companyCoef?: boolean + companyCoefDocRef?: boolean executorCoef?: boolean + executorCoefDocRef?: boolean withVat?: boolean totalWithoutVat?: boolean vatRate?: boolean @@ -9875,10 +10052,13 @@ export namespace Prisma { totalLaboratory?: boolean subtotal?: boolean regionalCoef?: boolean + regionalCoefDocRef?: boolean inflationIndex?: boolean inflationDocRef?: boolean companyCoef?: boolean + companyCoefDocRef?: boolean executorCoef?: boolean + executorCoefDocRef?: boolean withVat?: boolean totalWithoutVat?: boolean vatRate?: boolean @@ -9926,10 +10106,13 @@ export namespace Prisma { totalLaboratory: Prisma.Decimal | null subtotal: Prisma.Decimal | null regionalCoef: Prisma.Decimal | null + regionalCoefDocRef: string | null inflationIndex: Prisma.Decimal | null inflationDocRef: string | null companyCoef: Prisma.Decimal | null + companyCoefDocRef: string | null executorCoef: Prisma.Decimal | null + executorCoefDocRef: string | null withVat: boolean totalWithoutVat: Prisma.Decimal | null vatRate: Prisma.Decimal | null @@ -10349,10 +10532,13 @@ export namespace Prisma { readonly totalLaboratory: FieldRef<"Estimate", 'Decimal'> readonly subtotal: FieldRef<"Estimate", 'Decimal'> readonly regionalCoef: FieldRef<"Estimate", 'Decimal'> + readonly regionalCoefDocRef: FieldRef<"Estimate", 'String'> readonly inflationIndex: FieldRef<"Estimate", 'Decimal'> readonly inflationDocRef: FieldRef<"Estimate", 'String'> readonly companyCoef: FieldRef<"Estimate", 'Decimal'> + readonly companyCoefDocRef: FieldRef<"Estimate", 'String'> readonly executorCoef: FieldRef<"Estimate", 'Decimal'> + readonly executorCoefDocRef: FieldRef<"Estimate", 'String'> readonly withVat: FieldRef<"Estimate", 'Boolean'> readonly totalWithoutVat: FieldRef<"Estimate", 'Decimal'> readonly vatRate: FieldRef<"Estimate", 'Decimal'> @@ -11903,6 +12089,8 @@ export namespace Prisma { estimate?: boolean | EstimateDefaultArgs sharedWith?: boolean | UserDefaultArgs owner?: boolean | UserDefaultArgs + notes?: boolean | EstimateShare$notesArgs + _count?: boolean | EstimateShareCountOutputTypeDefaultArgs }, ExtArgs["result"]["estimateShare"]> export type EstimateShareSelectCreateManyAndReturn = $Extensions.GetSelect<{ @@ -11928,6 +12116,8 @@ export namespace Prisma { estimate?: boolean | EstimateDefaultArgs sharedWith?: boolean | UserDefaultArgs owner?: boolean | UserDefaultArgs + notes?: boolean | EstimateShare$notesArgs + _count?: boolean | EstimateShareCountOutputTypeDefaultArgs } export type EstimateShareIncludeCreateManyAndReturn = { estimate?: boolean | EstimateDefaultArgs @@ -11941,6 +12131,7 @@ export namespace Prisma { estimate: Prisma.$EstimatePayload sharedWith: Prisma.$UserPayload owner: Prisma.$UserPayload + notes: Prisma.$EstimateShareNotePayload[] } scalars: $Extensions.GetPayloadResult<{ id: string @@ -12315,6 +12506,7 @@ export namespace Prisma { estimate = {}>(args?: Subset>): Prisma__EstimateClient<$Result.GetResult, T, "findUniqueOrThrow"> | Null, Null, ExtArgs> sharedWith = {}>(args?: Subset>): Prisma__UserClient<$Result.GetResult, T, "findUniqueOrThrow"> | Null, Null, ExtArgs> owner = {}>(args?: Subset>): Prisma__UserClient<$Result.GetResult, T, "findUniqueOrThrow"> | Null, Null, ExtArgs> + notes = {}>(args?: Subset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany"> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -12666,6 +12858,26 @@ export namespace Prisma { where?: EstimateShareWhereInput } + /** + * EstimateShare.notes + */ + export type EstimateShare$notesArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + where?: EstimateShareNoteWhereInput + orderBy?: EstimateShareNoteOrderByWithRelationInput | EstimateShareNoteOrderByWithRelationInput[] + cursor?: EstimateShareNoteWhereUniqueInput + take?: number + skip?: number + distinct?: EstimateShareNoteScalarFieldEnum | EstimateShareNoteScalarFieldEnum[] + } + /** * EstimateShare without action */ @@ -12681,6 +12893,945 @@ export namespace Prisma { } + /** + * Model EstimateShareNote + */ + + export type AggregateEstimateShareNote = { + _count: EstimateShareNoteCountAggregateOutputType | null + _min: EstimateShareNoteMinAggregateOutputType | null + _max: EstimateShareNoteMaxAggregateOutputType | null + } + + export type EstimateShareNoteMinAggregateOutputType = { + id: string | null + shareId: string | null + authorId: string | null + content: string | null + createdAt: Date | null + } + + export type EstimateShareNoteMaxAggregateOutputType = { + id: string | null + shareId: string | null + authorId: string | null + content: string | null + createdAt: Date | null + } + + export type EstimateShareNoteCountAggregateOutputType = { + id: number + shareId: number + authorId: number + content: number + createdAt: number + _all: number + } + + + export type EstimateShareNoteMinAggregateInputType = { + id?: true + shareId?: true + authorId?: true + content?: true + createdAt?: true + } + + export type EstimateShareNoteMaxAggregateInputType = { + id?: true + shareId?: true + authorId?: true + content?: true + createdAt?: true + } + + export type EstimateShareNoteCountAggregateInputType = { + id?: true + shareId?: true + authorId?: true + content?: true + createdAt?: true + _all?: true + } + + export type EstimateShareNoteAggregateArgs = { + /** + * Filter which EstimateShareNote to aggregate. + */ + where?: EstimateShareNoteWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of EstimateShareNotes to fetch. + */ + orderBy?: EstimateShareNoteOrderByWithRelationInput | EstimateShareNoteOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: EstimateShareNoteWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` EstimateShareNotes from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` EstimateShareNotes. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned EstimateShareNotes + **/ + _count?: true | EstimateShareNoteCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: EstimateShareNoteMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: EstimateShareNoteMaxAggregateInputType + } + + export type GetEstimateShareNoteAggregateType = { + [P in keyof T & keyof AggregateEstimateShareNote]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : GetScalarType + : GetScalarType + } + + + + + export type EstimateShareNoteGroupByArgs = { + where?: EstimateShareNoteWhereInput + orderBy?: EstimateShareNoteOrderByWithAggregationInput | EstimateShareNoteOrderByWithAggregationInput[] + by: EstimateShareNoteScalarFieldEnum[] | EstimateShareNoteScalarFieldEnum + having?: EstimateShareNoteScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: EstimateShareNoteCountAggregateInputType | true + _min?: EstimateShareNoteMinAggregateInputType + _max?: EstimateShareNoteMaxAggregateInputType + } + + export type EstimateShareNoteGroupByOutputType = { + id: string + shareId: string + authorId: string + content: string + createdAt: Date + _count: EstimateShareNoteCountAggregateOutputType | null + _min: EstimateShareNoteMinAggregateOutputType | null + _max: EstimateShareNoteMaxAggregateOutputType | null + } + + type GetEstimateShareNoteGroupByPayload = Prisma.PrismaPromise< + Array< + PickEnumerable & + { + [P in ((keyof T) & (keyof EstimateShareNoteGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : GetScalarType + : GetScalarType + } + > + > + + + export type EstimateShareNoteSelect = $Extensions.GetSelect<{ + id?: boolean + shareId?: boolean + authorId?: boolean + content?: boolean + createdAt?: boolean + share?: boolean | EstimateShareDefaultArgs + author?: boolean | UserDefaultArgs + }, ExtArgs["result"]["estimateShareNote"]> + + export type EstimateShareNoteSelectCreateManyAndReturn = $Extensions.GetSelect<{ + id?: boolean + shareId?: boolean + authorId?: boolean + content?: boolean + createdAt?: boolean + share?: boolean | EstimateShareDefaultArgs + author?: boolean | UserDefaultArgs + }, ExtArgs["result"]["estimateShareNote"]> + + export type EstimateShareNoteSelectScalar = { + id?: boolean + shareId?: boolean + authorId?: boolean + content?: boolean + createdAt?: boolean + } + + export type EstimateShareNoteInclude = { + share?: boolean | EstimateShareDefaultArgs + author?: boolean | UserDefaultArgs + } + export type EstimateShareNoteIncludeCreateManyAndReturn = { + share?: boolean | EstimateShareDefaultArgs + author?: boolean | UserDefaultArgs + } + + export type $EstimateShareNotePayload = { + name: "EstimateShareNote" + objects: { + share: Prisma.$EstimateSharePayload + author: Prisma.$UserPayload + } + scalars: $Extensions.GetPayloadResult<{ + id: string + shareId: string + authorId: string + content: string + createdAt: Date + }, ExtArgs["result"]["estimateShareNote"]> + composites: {} + } + + type EstimateShareNoteGetPayload = $Result.GetResult + + type EstimateShareNoteCountArgs = + Omit & { + select?: EstimateShareNoteCountAggregateInputType | true + } + + export interface EstimateShareNoteDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['EstimateShareNote'], meta: { name: 'EstimateShareNote' } } + /** + * Find zero or one EstimateShareNote that matches the filter. + * @param {EstimateShareNoteFindUniqueArgs} args - Arguments to find a EstimateShareNote + * @example + * // Get one EstimateShareNote + * const estimateShareNote = await prisma.estimateShareNote.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: SelectSubset>): Prisma__EstimateShareNoteClient<$Result.GetResult, T, "findUnique"> | null, null, ExtArgs> + + /** + * Find one EstimateShareNote that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {EstimateShareNoteFindUniqueOrThrowArgs} args - Arguments to find a EstimateShareNote + * @example + * // Get one EstimateShareNote + * const estimateShareNote = await prisma.estimateShareNote.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: SelectSubset>): Prisma__EstimateShareNoteClient<$Result.GetResult, T, "findUniqueOrThrow">, never, ExtArgs> + + /** + * Find the first EstimateShareNote that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EstimateShareNoteFindFirstArgs} args - Arguments to find a EstimateShareNote + * @example + * // Get one EstimateShareNote + * const estimateShareNote = await prisma.estimateShareNote.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: SelectSubset>): Prisma__EstimateShareNoteClient<$Result.GetResult, T, "findFirst"> | null, null, ExtArgs> + + /** + * Find the first EstimateShareNote that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EstimateShareNoteFindFirstOrThrowArgs} args - Arguments to find a EstimateShareNote + * @example + * // Get one EstimateShareNote + * const estimateShareNote = await prisma.estimateShareNote.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: SelectSubset>): Prisma__EstimateShareNoteClient<$Result.GetResult, T, "findFirstOrThrow">, never, ExtArgs> + + /** + * Find zero or more EstimateShareNotes that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EstimateShareNoteFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all EstimateShareNotes + * const estimateShareNotes = await prisma.estimateShareNote.findMany() + * + * // Get first 10 EstimateShareNotes + * const estimateShareNotes = await prisma.estimateShareNote.findMany({ take: 10 }) + * + * // Only select the `id` + * const estimateShareNoteWithIdOnly = await prisma.estimateShareNote.findMany({ select: { id: true } }) + * + */ + findMany(args?: SelectSubset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany">> + + /** + * Create a EstimateShareNote. + * @param {EstimateShareNoteCreateArgs} args - Arguments to create a EstimateShareNote. + * @example + * // Create one EstimateShareNote + * const EstimateShareNote = await prisma.estimateShareNote.create({ + * data: { + * // ... data to create a EstimateShareNote + * } + * }) + * + */ + create(args: SelectSubset>): Prisma__EstimateShareNoteClient<$Result.GetResult, T, "create">, never, ExtArgs> + + /** + * Create many EstimateShareNotes. + * @param {EstimateShareNoteCreateManyArgs} args - Arguments to create many EstimateShareNotes. + * @example + * // Create many EstimateShareNotes + * const estimateShareNote = await prisma.estimateShareNote.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: SelectSubset>): Prisma.PrismaPromise + + /** + * Create many EstimateShareNotes and returns the data saved in the database. + * @param {EstimateShareNoteCreateManyAndReturnArgs} args - Arguments to create many EstimateShareNotes. + * @example + * // Create many EstimateShareNotes + * const estimateShareNote = await prisma.estimateShareNote.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many EstimateShareNotes and only return the `id` + * const estimateShareNoteWithIdOnly = await prisma.estimateShareNote.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: SelectSubset>): Prisma.PrismaPromise<$Result.GetResult, T, "createManyAndReturn">> + + /** + * Delete a EstimateShareNote. + * @param {EstimateShareNoteDeleteArgs} args - Arguments to delete one EstimateShareNote. + * @example + * // Delete one EstimateShareNote + * const EstimateShareNote = await prisma.estimateShareNote.delete({ + * where: { + * // ... filter to delete one EstimateShareNote + * } + * }) + * + */ + delete(args: SelectSubset>): Prisma__EstimateShareNoteClient<$Result.GetResult, T, "delete">, never, ExtArgs> + + /** + * Update one EstimateShareNote. + * @param {EstimateShareNoteUpdateArgs} args - Arguments to update one EstimateShareNote. + * @example + * // Update one EstimateShareNote + * const estimateShareNote = await prisma.estimateShareNote.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: SelectSubset>): Prisma__EstimateShareNoteClient<$Result.GetResult, T, "update">, never, ExtArgs> + + /** + * Delete zero or more EstimateShareNotes. + * @param {EstimateShareNoteDeleteManyArgs} args - Arguments to filter EstimateShareNotes to delete. + * @example + * // Delete a few EstimateShareNotes + * const { count } = await prisma.estimateShareNote.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more EstimateShareNotes. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EstimateShareNoteUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many EstimateShareNotes + * const estimateShareNote = await prisma.estimateShareNote.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one EstimateShareNote. + * @param {EstimateShareNoteUpsertArgs} args - Arguments to update or create a EstimateShareNote. + * @example + * // Update or create a EstimateShareNote + * const estimateShareNote = await prisma.estimateShareNote.upsert({ + * create: { + * // ... data to create a EstimateShareNote + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the EstimateShareNote we want to update + * } + * }) + */ + upsert(args: SelectSubset>): Prisma__EstimateShareNoteClient<$Result.GetResult, T, "upsert">, never, ExtArgs> + + + /** + * Count the number of EstimateShareNotes. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EstimateShareNoteCountArgs} args - Arguments to filter EstimateShareNotes to count. + * @example + * // Count the number of EstimateShareNotes + * const count = await prisma.estimateShareNote.count({ + * where: { + * // ... the filter for the EstimateShareNotes we want to count + * } + * }) + **/ + count( + args?: Subset, + ): Prisma.PrismaPromise< + T extends $Utils.Record<'select', any> + ? T['select'] extends true + ? number + : GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a EstimateShareNote. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EstimateShareNoteAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Subset): Prisma.PrismaPromise> + + /** + * Group by EstimateShareNote. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EstimateShareNoteGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends EstimateShareNoteGroupByArgs, + HasSelectOrTake extends Or< + Extends<'skip', Keys>, + Extends<'take', Keys> + >, + OrderByArg extends True extends HasSelectOrTake + ? { orderBy: EstimateShareNoteGroupByArgs['orderBy'] } + : { orderBy?: EstimateShareNoteGroupByArgs['orderBy'] }, + OrderFields extends ExcludeUnderscoreKeys>>, + ByFields extends MaybeTupleToUnion, + ByValid extends Has, + HavingFields extends GetHavingFields, + HavingValid extends Has, + ByEmpty extends T['by'] extends never[] ? True : False, + InputErrors extends ByEmpty extends True + ? `Error: "by" must not be empty.` + : HavingValid extends False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Keys + ? 'orderBy' extends Keys + ? ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Keys + ? 'orderBy' extends Keys + ? ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: SubsetIntersection & InputErrors): {} extends InputErrors ? GetEstimateShareNoteGroupByPayload : Prisma.PrismaPromise + /** + * Fields of the EstimateShareNote model + */ + readonly fields: EstimateShareNoteFieldRefs; + } + + /** + * The delegate class that acts as a "Promise-like" for EstimateShareNote. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ + export interface Prisma__EstimateShareNoteClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + share = {}>(args?: Subset>): Prisma__EstimateShareClient<$Result.GetResult, T, "findUniqueOrThrow"> | Null, Null, ExtArgs> + author = {}>(args?: Subset>): Prisma__UserClient<$Result.GetResult, T, "findUniqueOrThrow"> | Null, Null, ExtArgs> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): $Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): $Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): $Utils.JsPromise + } + + + + + /** + * Fields of the EstimateShareNote model + */ + interface EstimateShareNoteFieldRefs { + readonly id: FieldRef<"EstimateShareNote", 'String'> + readonly shareId: FieldRef<"EstimateShareNote", 'String'> + readonly authorId: FieldRef<"EstimateShareNote", 'String'> + readonly content: FieldRef<"EstimateShareNote", 'String'> + readonly createdAt: FieldRef<"EstimateShareNote", 'DateTime'> + } + + + // Custom InputTypes + /** + * EstimateShareNote findUnique + */ + export type EstimateShareNoteFindUniqueArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * Filter, which EstimateShareNote to fetch. + */ + where: EstimateShareNoteWhereUniqueInput + } + + /** + * EstimateShareNote findUniqueOrThrow + */ + export type EstimateShareNoteFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * Filter, which EstimateShareNote to fetch. + */ + where: EstimateShareNoteWhereUniqueInput + } + + /** + * EstimateShareNote findFirst + */ + export type EstimateShareNoteFindFirstArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * Filter, which EstimateShareNote to fetch. + */ + where?: EstimateShareNoteWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of EstimateShareNotes to fetch. + */ + orderBy?: EstimateShareNoteOrderByWithRelationInput | EstimateShareNoteOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for EstimateShareNotes. + */ + cursor?: EstimateShareNoteWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` EstimateShareNotes from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` EstimateShareNotes. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of EstimateShareNotes. + */ + distinct?: EstimateShareNoteScalarFieldEnum | EstimateShareNoteScalarFieldEnum[] + } + + /** + * EstimateShareNote findFirstOrThrow + */ + export type EstimateShareNoteFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * Filter, which EstimateShareNote to fetch. + */ + where?: EstimateShareNoteWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of EstimateShareNotes to fetch. + */ + orderBy?: EstimateShareNoteOrderByWithRelationInput | EstimateShareNoteOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for EstimateShareNotes. + */ + cursor?: EstimateShareNoteWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` EstimateShareNotes from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` EstimateShareNotes. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of EstimateShareNotes. + */ + distinct?: EstimateShareNoteScalarFieldEnum | EstimateShareNoteScalarFieldEnum[] + } + + /** + * EstimateShareNote findMany + */ + export type EstimateShareNoteFindManyArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * Filter, which EstimateShareNotes to fetch. + */ + where?: EstimateShareNoteWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of EstimateShareNotes to fetch. + */ + orderBy?: EstimateShareNoteOrderByWithRelationInput | EstimateShareNoteOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing EstimateShareNotes. + */ + cursor?: EstimateShareNoteWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` EstimateShareNotes from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` EstimateShareNotes. + */ + skip?: number + distinct?: EstimateShareNoteScalarFieldEnum | EstimateShareNoteScalarFieldEnum[] + } + + /** + * EstimateShareNote create + */ + export type EstimateShareNoteCreateArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * The data needed to create a EstimateShareNote. + */ + data: XOR + } + + /** + * EstimateShareNote createMany + */ + export type EstimateShareNoteCreateManyArgs = { + /** + * The data used to create many EstimateShareNotes. + */ + data: EstimateShareNoteCreateManyInput | EstimateShareNoteCreateManyInput[] + skipDuplicates?: boolean + } + + /** + * EstimateShareNote createManyAndReturn + */ + export type EstimateShareNoteCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelectCreateManyAndReturn | null + /** + * The data used to create many EstimateShareNotes. + */ + data: EstimateShareNoteCreateManyInput | EstimateShareNoteCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteIncludeCreateManyAndReturn | null + } + + /** + * EstimateShareNote update + */ + export type EstimateShareNoteUpdateArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * The data needed to update a EstimateShareNote. + */ + data: XOR + /** + * Choose, which EstimateShareNote to update. + */ + where: EstimateShareNoteWhereUniqueInput + } + + /** + * EstimateShareNote updateMany + */ + export type EstimateShareNoteUpdateManyArgs = { + /** + * The data used to update EstimateShareNotes. + */ + data: XOR + /** + * Filter which EstimateShareNotes to update + */ + where?: EstimateShareNoteWhereInput + } + + /** + * EstimateShareNote upsert + */ + export type EstimateShareNoteUpsertArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * The filter to search for the EstimateShareNote to update in case it exists. + */ + where: EstimateShareNoteWhereUniqueInput + /** + * In case the EstimateShareNote found by the `where` argument doesn't exist, create a new EstimateShareNote with this data. + */ + create: XOR + /** + * In case the EstimateShareNote was found with the provided `where` argument, update it with this data. + */ + update: XOR + } + + /** + * EstimateShareNote delete + */ + export type EstimateShareNoteDeleteArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + /** + * Filter which EstimateShareNote to delete. + */ + where: EstimateShareNoteWhereUniqueInput + } + + /** + * EstimateShareNote deleteMany + */ + export type EstimateShareNoteDeleteManyArgs = { + /** + * Filter which EstimateShareNotes to delete + */ + where?: EstimateShareNoteWhereInput + } + + /** + * EstimateShareNote without action + */ + export type EstimateShareNoteDefaultArgs = { + /** + * Select specific fields to fetch from the EstimateShareNote + */ + select?: EstimateShareNoteSelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: EstimateShareNoteInclude | null + } + + /** * Model EstimateItem */ @@ -17858,10 +19009,13 @@ export namespace Prisma { totalLaboratory: 'totalLaboratory', subtotal: 'subtotal', regionalCoef: 'regionalCoef', + regionalCoefDocRef: 'regionalCoefDocRef', inflationIndex: 'inflationIndex', inflationDocRef: 'inflationDocRef', companyCoef: 'companyCoef', + companyCoefDocRef: 'companyCoefDocRef', executorCoef: 'executorCoef', + executorCoefDocRef: 'executorCoefDocRef', withVat: 'withVat', totalWithoutVat: 'totalWithoutVat', vatRate: 'vatRate', @@ -17897,6 +19051,17 @@ export namespace Prisma { export type EstimateShareScalarFieldEnum = (typeof EstimateShareScalarFieldEnum)[keyof typeof EstimateShareScalarFieldEnum] + export const EstimateShareNoteScalarFieldEnum: { + id: 'id', + shareId: 'shareId', + authorId: 'authorId', + content: 'content', + createdAt: 'createdAt' + }; + + export type EstimateShareNoteScalarFieldEnum = (typeof EstimateShareNoteScalarFieldEnum)[keyof typeof EstimateShareNoteScalarFieldEnum] + + export const EstimateItemScalarFieldEnum: { id: 'id', estimateId: 'estimateId', @@ -18556,6 +19721,7 @@ export namespace Prisma { chatSessions?: ChatSessionListRelationFilter ownedShares?: EstimateShareListRelationFilter receivedShares?: EstimateShareListRelationFilter + shareNotes?: EstimateShareNoteListRelationFilter } export type UserOrderByWithRelationInput = { @@ -18569,6 +19735,7 @@ export namespace Prisma { chatSessions?: ChatSessionOrderByRelationAggregateInput ownedShares?: EstimateShareOrderByRelationAggregateInput receivedShares?: EstimateShareOrderByRelationAggregateInput + shareNotes?: EstimateShareNoteOrderByRelationAggregateInput } export type UserWhereUniqueInput = Prisma.AtLeast<{ @@ -18585,6 +19752,7 @@ export namespace Prisma { chatSessions?: ChatSessionListRelationFilter ownedShares?: EstimateShareListRelationFilter receivedShares?: EstimateShareListRelationFilter + shareNotes?: EstimateShareNoteListRelationFilter }, "id" | "email"> export type UserOrderByWithAggregationInput = { @@ -18682,10 +19850,13 @@ export namespace Prisma { totalLaboratory?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null subtotal?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null regionalCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: StringNullableFilter<"Estimate"> | string | null inflationIndex?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null inflationDocRef?: StringNullableFilter<"Estimate"> | string | null companyCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: StringNullableFilter<"Estimate"> | string | null executorCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: StringNullableFilter<"Estimate"> | string | null withVat?: BoolFilter<"Estimate"> | boolean totalWithoutVat?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null vatRate?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null @@ -18715,10 +19886,13 @@ export namespace Prisma { totalLaboratory?: SortOrderInput | SortOrder subtotal?: SortOrderInput | SortOrder regionalCoef?: SortOrderInput | SortOrder + regionalCoefDocRef?: SortOrderInput | SortOrder inflationIndex?: SortOrderInput | SortOrder inflationDocRef?: SortOrderInput | SortOrder companyCoef?: SortOrderInput | SortOrder + companyCoefDocRef?: SortOrderInput | SortOrder executorCoef?: SortOrderInput | SortOrder + executorCoefDocRef?: SortOrderInput | SortOrder withVat?: SortOrder totalWithoutVat?: SortOrderInput | SortOrder vatRate?: SortOrderInput | SortOrder @@ -18751,10 +19925,13 @@ export namespace Prisma { totalLaboratory?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null subtotal?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null regionalCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: StringNullableFilter<"Estimate"> | string | null inflationIndex?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null inflationDocRef?: StringNullableFilter<"Estimate"> | string | null companyCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: StringNullableFilter<"Estimate"> | string | null executorCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: StringNullableFilter<"Estimate"> | string | null withVat?: BoolFilter<"Estimate"> | boolean totalWithoutVat?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null vatRate?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null @@ -18784,10 +19961,13 @@ export namespace Prisma { totalLaboratory?: SortOrderInput | SortOrder subtotal?: SortOrderInput | SortOrder regionalCoef?: SortOrderInput | SortOrder + regionalCoefDocRef?: SortOrderInput | SortOrder inflationIndex?: SortOrderInput | SortOrder inflationDocRef?: SortOrderInput | SortOrder companyCoef?: SortOrderInput | SortOrder + companyCoefDocRef?: SortOrderInput | SortOrder executorCoef?: SortOrderInput | SortOrder + executorCoefDocRef?: SortOrderInput | SortOrder withVat?: SortOrder totalWithoutVat?: SortOrderInput | SortOrder vatRate?: SortOrderInput | SortOrder @@ -18819,10 +19999,13 @@ export namespace Prisma { totalLaboratory?: DecimalNullableWithAggregatesFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null subtotal?: DecimalNullableWithAggregatesFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null regionalCoef?: DecimalNullableWithAggregatesFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: StringNullableWithAggregatesFilter<"Estimate"> | string | null inflationIndex?: DecimalNullableWithAggregatesFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null inflationDocRef?: StringNullableWithAggregatesFilter<"Estimate"> | string | null companyCoef?: DecimalNullableWithAggregatesFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: StringNullableWithAggregatesFilter<"Estimate"> | string | null executorCoef?: DecimalNullableWithAggregatesFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: StringNullableWithAggregatesFilter<"Estimate"> | string | null withVat?: BoolWithAggregatesFilter<"Estimate"> | boolean totalWithoutVat?: DecimalNullableWithAggregatesFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null vatRate?: DecimalNullableWithAggregatesFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null @@ -18902,6 +20085,7 @@ export namespace Prisma { estimate?: XOR sharedWith?: XOR owner?: XOR + notes?: EstimateShareNoteListRelationFilter } export type EstimateShareOrderByWithRelationInput = { @@ -18913,6 +20097,7 @@ export namespace Prisma { estimate?: EstimateOrderByWithRelationInput sharedWith?: UserOrderByWithRelationInput owner?: UserOrderByWithRelationInput + notes?: EstimateShareNoteOrderByRelationAggregateInput } export type EstimateShareWhereUniqueInput = Prisma.AtLeast<{ @@ -18928,6 +20113,7 @@ export namespace Prisma { estimate?: XOR sharedWith?: XOR owner?: XOR + notes?: EstimateShareNoteListRelationFilter }, "id" | "estimateId_sharedWithId"> export type EstimateShareOrderByWithAggregationInput = { @@ -18952,6 +20138,64 @@ export namespace Prisma { createdAt?: DateTimeWithAggregatesFilter<"EstimateShare"> | Date | string } + export type EstimateShareNoteWhereInput = { + AND?: EstimateShareNoteWhereInput | EstimateShareNoteWhereInput[] + OR?: EstimateShareNoteWhereInput[] + NOT?: EstimateShareNoteWhereInput | EstimateShareNoteWhereInput[] + id?: StringFilter<"EstimateShareNote"> | string + shareId?: StringFilter<"EstimateShareNote"> | string + authorId?: StringFilter<"EstimateShareNote"> | string + content?: StringFilter<"EstimateShareNote"> | string + createdAt?: DateTimeFilter<"EstimateShareNote"> | Date | string + share?: XOR + author?: XOR + } + + export type EstimateShareNoteOrderByWithRelationInput = { + id?: SortOrder + shareId?: SortOrder + authorId?: SortOrder + content?: SortOrder + createdAt?: SortOrder + share?: EstimateShareOrderByWithRelationInput + author?: UserOrderByWithRelationInput + } + + export type EstimateShareNoteWhereUniqueInput = Prisma.AtLeast<{ + id?: string + AND?: EstimateShareNoteWhereInput | EstimateShareNoteWhereInput[] + OR?: EstimateShareNoteWhereInput[] + NOT?: EstimateShareNoteWhereInput | EstimateShareNoteWhereInput[] + shareId?: StringFilter<"EstimateShareNote"> | string + authorId?: StringFilter<"EstimateShareNote"> | string + content?: StringFilter<"EstimateShareNote"> | string + createdAt?: DateTimeFilter<"EstimateShareNote"> | Date | string + share?: XOR + author?: XOR + }, "id"> + + export type EstimateShareNoteOrderByWithAggregationInput = { + id?: SortOrder + shareId?: SortOrder + authorId?: SortOrder + content?: SortOrder + createdAt?: SortOrder + _count?: EstimateShareNoteCountOrderByAggregateInput + _max?: EstimateShareNoteMaxOrderByAggregateInput + _min?: EstimateShareNoteMinOrderByAggregateInput + } + + export type EstimateShareNoteScalarWhereWithAggregatesInput = { + AND?: EstimateShareNoteScalarWhereWithAggregatesInput | EstimateShareNoteScalarWhereWithAggregatesInput[] + OR?: EstimateShareNoteScalarWhereWithAggregatesInput[] + NOT?: EstimateShareNoteScalarWhereWithAggregatesInput | EstimateShareNoteScalarWhereWithAggregatesInput[] + id?: StringWithAggregatesFilter<"EstimateShareNote"> | string + shareId?: StringWithAggregatesFilter<"EstimateShareNote"> | string + authorId?: StringWithAggregatesFilter<"EstimateShareNote"> | string + content?: StringWithAggregatesFilter<"EstimateShareNote"> | string + createdAt?: DateTimeWithAggregatesFilter<"EstimateShareNote"> | Date | string + } + export type EstimateItemWhereInput = { AND?: EstimateItemWhereInput | EstimateItemWhereInput[] OR?: EstimateItemWhereInput[] @@ -19847,6 +21091,7 @@ export namespace Prisma { chatSessions?: ChatSessionCreateNestedManyWithoutUserInput ownedShares?: EstimateShareCreateNestedManyWithoutOwnerInput receivedShares?: EstimateShareCreateNestedManyWithoutSharedWithInput + shareNotes?: EstimateShareNoteCreateNestedManyWithoutAuthorInput } export type UserUncheckedCreateInput = { @@ -19860,6 +21105,7 @@ export namespace Prisma { chatSessions?: ChatSessionUncheckedCreateNestedManyWithoutUserInput ownedShares?: EstimateShareUncheckedCreateNestedManyWithoutOwnerInput receivedShares?: EstimateShareUncheckedCreateNestedManyWithoutSharedWithInput + shareNotes?: EstimateShareNoteUncheckedCreateNestedManyWithoutAuthorInput } export type UserUpdateInput = { @@ -19873,6 +21119,7 @@ export namespace Prisma { chatSessions?: ChatSessionUpdateManyWithoutUserNestedInput ownedShares?: EstimateShareUpdateManyWithoutOwnerNestedInput receivedShares?: EstimateShareUpdateManyWithoutSharedWithNestedInput + shareNotes?: EstimateShareNoteUpdateManyWithoutAuthorNestedInput } export type UserUncheckedUpdateInput = { @@ -19886,6 +21133,7 @@ export namespace Prisma { chatSessions?: ChatSessionUncheckedUpdateManyWithoutUserNestedInput ownedShares?: EstimateShareUncheckedUpdateManyWithoutOwnerNestedInput receivedShares?: EstimateShareUncheckedUpdateManyWithoutSharedWithNestedInput + shareNotes?: EstimateShareNoteUncheckedUpdateManyWithoutAuthorNestedInput } export type UserCreateManyInput = { @@ -19986,10 +21234,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -20019,10 +21270,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -20048,10 +21302,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -20081,10 +21338,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -20112,10 +21372,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -20137,10 +21400,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -20164,10 +21430,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -20239,6 +21508,7 @@ export namespace Prisma { estimate: EstimateCreateNestedOneWithoutSharesInput sharedWith: UserCreateNestedOneWithoutReceivedSharesInput owner: UserCreateNestedOneWithoutOwnedSharesInput + notes?: EstimateShareNoteCreateNestedManyWithoutShareInput } export type EstimateShareUncheckedCreateInput = { @@ -20247,6 +21517,7 @@ export namespace Prisma { ownerId: string sharedWithId: string createdAt?: Date | string + notes?: EstimateShareNoteUncheckedCreateNestedManyWithoutShareInput } export type EstimateShareUpdateInput = { @@ -20255,6 +21526,7 @@ export namespace Prisma { estimate?: EstimateUpdateOneRequiredWithoutSharesNestedInput sharedWith?: UserUpdateOneRequiredWithoutReceivedSharesNestedInput owner?: UserUpdateOneRequiredWithoutOwnedSharesNestedInput + notes?: EstimateShareNoteUpdateManyWithoutShareNestedInput } export type EstimateShareUncheckedUpdateInput = { @@ -20263,6 +21535,7 @@ export namespace Prisma { ownerId?: StringFieldUpdateOperationsInput | string sharedWithId?: StringFieldUpdateOperationsInput | string createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + notes?: EstimateShareNoteUncheckedUpdateManyWithoutShareNestedInput } export type EstimateShareCreateManyInput = { @@ -20286,6 +21559,60 @@ export namespace Prisma { createdAt?: DateTimeFieldUpdateOperationsInput | Date | string } + export type EstimateShareNoteCreateInput = { + id?: string + content: string + createdAt?: Date | string + share: EstimateShareCreateNestedOneWithoutNotesInput + author: UserCreateNestedOneWithoutShareNotesInput + } + + export type EstimateShareNoteUncheckedCreateInput = { + id?: string + shareId: string + authorId: string + content: string + createdAt?: Date | string + } + + export type EstimateShareNoteUpdateInput = { + id?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + share?: EstimateShareUpdateOneRequiredWithoutNotesNestedInput + author?: UserUpdateOneRequiredWithoutShareNotesNestedInput + } + + export type EstimateShareNoteUncheckedUpdateInput = { + id?: StringFieldUpdateOperationsInput | string + shareId?: StringFieldUpdateOperationsInput | string + authorId?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type EstimateShareNoteCreateManyInput = { + id?: string + shareId: string + authorId: string + content: string + createdAt?: Date | string + } + + export type EstimateShareNoteUpdateManyMutationInput = { + id?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type EstimateShareNoteUncheckedUpdateManyInput = { + id?: StringFieldUpdateOperationsInput | string + shareId?: StringFieldUpdateOperationsInput | string + authorId?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + export type EstimateItemCreateInput = { id?: string orderNumber: number @@ -21302,6 +22629,12 @@ export namespace Prisma { none?: EstimateShareWhereInput } + export type EstimateShareNoteListRelationFilter = { + every?: EstimateShareNoteWhereInput + some?: EstimateShareNoteWhereInput + none?: EstimateShareNoteWhereInput + } + export type EstimateOrderByRelationAggregateInput = { _count?: SortOrder } @@ -21314,6 +22647,10 @@ export namespace Prisma { _count?: SortOrder } + export type EstimateShareNoteOrderByRelationAggregateInput = { + _count?: SortOrder + } + export type UserCountOrderByAggregateInput = { id?: SortOrder email?: SortOrder @@ -21408,10 +22745,13 @@ export namespace Prisma { totalLaboratory?: SortOrder subtotal?: SortOrder regionalCoef?: SortOrder + regionalCoefDocRef?: SortOrder inflationIndex?: SortOrder inflationDocRef?: SortOrder companyCoef?: SortOrder + companyCoefDocRef?: SortOrder executorCoef?: SortOrder + executorCoefDocRef?: SortOrder withVat?: SortOrder totalWithoutVat?: SortOrder vatRate?: SortOrder @@ -21450,10 +22790,13 @@ export namespace Prisma { totalLaboratory?: SortOrder subtotal?: SortOrder regionalCoef?: SortOrder + regionalCoefDocRef?: SortOrder inflationIndex?: SortOrder inflationDocRef?: SortOrder companyCoef?: SortOrder + companyCoefDocRef?: SortOrder executorCoef?: SortOrder + executorCoefDocRef?: SortOrder withVat?: SortOrder totalWithoutVat?: SortOrder vatRate?: SortOrder @@ -21477,10 +22820,13 @@ export namespace Prisma { totalLaboratory?: SortOrder subtotal?: SortOrder regionalCoef?: SortOrder + regionalCoefDocRef?: SortOrder inflationIndex?: SortOrder inflationDocRef?: SortOrder companyCoef?: SortOrder + companyCoefDocRef?: SortOrder executorCoef?: SortOrder + executorCoefDocRef?: SortOrder withVat?: SortOrder totalWithoutVat?: SortOrder vatRate?: SortOrder @@ -21617,6 +22963,35 @@ export namespace Prisma { createdAt?: SortOrder } + export type EstimateShareRelationFilter = { + is?: EstimateShareWhereInput + isNot?: EstimateShareWhereInput + } + + export type EstimateShareNoteCountOrderByAggregateInput = { + id?: SortOrder + shareId?: SortOrder + authorId?: SortOrder + content?: SortOrder + createdAt?: SortOrder + } + + export type EstimateShareNoteMaxOrderByAggregateInput = { + id?: SortOrder + shareId?: SortOrder + authorId?: SortOrder + content?: SortOrder + createdAt?: SortOrder + } + + export type EstimateShareNoteMinOrderByAggregateInput = { + id?: SortOrder + shareId?: SortOrder + authorId?: SortOrder + content?: SortOrder + createdAt?: SortOrder + } + export type PriceItemNullableRelationFilter = { is?: PriceItemWhereInput | null isNot?: PriceItemWhereInput | null @@ -22143,6 +23518,13 @@ export namespace Prisma { connect?: EstimateShareWhereUniqueInput | EstimateShareWhereUniqueInput[] } + export type EstimateShareNoteCreateNestedManyWithoutAuthorInput = { + create?: XOR | EstimateShareNoteCreateWithoutAuthorInput[] | EstimateShareNoteUncheckedCreateWithoutAuthorInput[] + connectOrCreate?: EstimateShareNoteCreateOrConnectWithoutAuthorInput | EstimateShareNoteCreateOrConnectWithoutAuthorInput[] + createMany?: EstimateShareNoteCreateManyAuthorInputEnvelope + connect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + } + export type EstimateUncheckedCreateNestedManyWithoutOwnerInput = { create?: XOR | EstimateCreateWithoutOwnerInput[] | EstimateUncheckedCreateWithoutOwnerInput[] connectOrCreate?: EstimateCreateOrConnectWithoutOwnerInput | EstimateCreateOrConnectWithoutOwnerInput[] @@ -22171,6 +23553,13 @@ export namespace Prisma { connect?: EstimateShareWhereUniqueInput | EstimateShareWhereUniqueInput[] } + export type EstimateShareNoteUncheckedCreateNestedManyWithoutAuthorInput = { + create?: XOR | EstimateShareNoteCreateWithoutAuthorInput[] | EstimateShareNoteUncheckedCreateWithoutAuthorInput[] + connectOrCreate?: EstimateShareNoteCreateOrConnectWithoutAuthorInput | EstimateShareNoteCreateOrConnectWithoutAuthorInput[] + createMany?: EstimateShareNoteCreateManyAuthorInputEnvelope + connect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + } + export type EstimateUpdateManyWithoutOwnerNestedInput = { create?: XOR | EstimateCreateWithoutOwnerInput[] | EstimateUncheckedCreateWithoutOwnerInput[] connectOrCreate?: EstimateCreateOrConnectWithoutOwnerInput | EstimateCreateOrConnectWithoutOwnerInput[] @@ -22227,6 +23616,20 @@ export namespace Prisma { deleteMany?: EstimateShareScalarWhereInput | EstimateShareScalarWhereInput[] } + export type EstimateShareNoteUpdateManyWithoutAuthorNestedInput = { + create?: XOR | EstimateShareNoteCreateWithoutAuthorInput[] | EstimateShareNoteUncheckedCreateWithoutAuthorInput[] + connectOrCreate?: EstimateShareNoteCreateOrConnectWithoutAuthorInput | EstimateShareNoteCreateOrConnectWithoutAuthorInput[] + upsert?: EstimateShareNoteUpsertWithWhereUniqueWithoutAuthorInput | EstimateShareNoteUpsertWithWhereUniqueWithoutAuthorInput[] + createMany?: EstimateShareNoteCreateManyAuthorInputEnvelope + set?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + disconnect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + delete?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + connect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + update?: EstimateShareNoteUpdateWithWhereUniqueWithoutAuthorInput | EstimateShareNoteUpdateWithWhereUniqueWithoutAuthorInput[] + updateMany?: EstimateShareNoteUpdateManyWithWhereWithoutAuthorInput | EstimateShareNoteUpdateManyWithWhereWithoutAuthorInput[] + deleteMany?: EstimateShareNoteScalarWhereInput | EstimateShareNoteScalarWhereInput[] + } + export type EstimateUncheckedUpdateManyWithoutOwnerNestedInput = { create?: XOR | EstimateCreateWithoutOwnerInput[] | EstimateUncheckedCreateWithoutOwnerInput[] connectOrCreate?: EstimateCreateOrConnectWithoutOwnerInput | EstimateCreateOrConnectWithoutOwnerInput[] @@ -22283,6 +23686,20 @@ export namespace Prisma { deleteMany?: EstimateShareScalarWhereInput | EstimateShareScalarWhereInput[] } + export type EstimateShareNoteUncheckedUpdateManyWithoutAuthorNestedInput = { + create?: XOR | EstimateShareNoteCreateWithoutAuthorInput[] | EstimateShareNoteUncheckedCreateWithoutAuthorInput[] + connectOrCreate?: EstimateShareNoteCreateOrConnectWithoutAuthorInput | EstimateShareNoteCreateOrConnectWithoutAuthorInput[] + upsert?: EstimateShareNoteUpsertWithWhereUniqueWithoutAuthorInput | EstimateShareNoteUpsertWithWhereUniqueWithoutAuthorInput[] + createMany?: EstimateShareNoteCreateManyAuthorInputEnvelope + set?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + disconnect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + delete?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + connect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + update?: EstimateShareNoteUpdateWithWhereUniqueWithoutAuthorInput | EstimateShareNoteUpdateWithWhereUniqueWithoutAuthorInput[] + updateMany?: EstimateShareNoteUpdateManyWithWhereWithoutAuthorInput | EstimateShareNoteUpdateManyWithWhereWithoutAuthorInput[] + deleteMany?: EstimateShareNoteScalarWhereInput | EstimateShareNoteScalarWhereInput[] + } + export type EstimateCreateNestedManyWithoutDirectionInput = { create?: XOR | EstimateCreateWithoutDirectionInput[] | EstimateUncheckedCreateWithoutDirectionInput[] connectOrCreate?: EstimateCreateOrConnectWithoutDirectionInput | EstimateCreateOrConnectWithoutDirectionInput[] @@ -22553,6 +23970,20 @@ export namespace Prisma { connect?: UserWhereUniqueInput } + export type EstimateShareNoteCreateNestedManyWithoutShareInput = { + create?: XOR | EstimateShareNoteCreateWithoutShareInput[] | EstimateShareNoteUncheckedCreateWithoutShareInput[] + connectOrCreate?: EstimateShareNoteCreateOrConnectWithoutShareInput | EstimateShareNoteCreateOrConnectWithoutShareInput[] + createMany?: EstimateShareNoteCreateManyShareInputEnvelope + connect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + } + + export type EstimateShareNoteUncheckedCreateNestedManyWithoutShareInput = { + create?: XOR | EstimateShareNoteCreateWithoutShareInput[] | EstimateShareNoteUncheckedCreateWithoutShareInput[] + connectOrCreate?: EstimateShareNoteCreateOrConnectWithoutShareInput | EstimateShareNoteCreateOrConnectWithoutShareInput[] + createMany?: EstimateShareNoteCreateManyShareInputEnvelope + connect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + } + export type EstimateUpdateOneRequiredWithoutSharesNestedInput = { create?: XOR connectOrCreate?: EstimateCreateOrConnectWithoutSharesInput @@ -22577,6 +24008,62 @@ export namespace Prisma { update?: XOR, UserUncheckedUpdateWithoutOwnedSharesInput> } + export type EstimateShareNoteUpdateManyWithoutShareNestedInput = { + create?: XOR | EstimateShareNoteCreateWithoutShareInput[] | EstimateShareNoteUncheckedCreateWithoutShareInput[] + connectOrCreate?: EstimateShareNoteCreateOrConnectWithoutShareInput | EstimateShareNoteCreateOrConnectWithoutShareInput[] + upsert?: EstimateShareNoteUpsertWithWhereUniqueWithoutShareInput | EstimateShareNoteUpsertWithWhereUniqueWithoutShareInput[] + createMany?: EstimateShareNoteCreateManyShareInputEnvelope + set?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + disconnect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + delete?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + connect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + update?: EstimateShareNoteUpdateWithWhereUniqueWithoutShareInput | EstimateShareNoteUpdateWithWhereUniqueWithoutShareInput[] + updateMany?: EstimateShareNoteUpdateManyWithWhereWithoutShareInput | EstimateShareNoteUpdateManyWithWhereWithoutShareInput[] + deleteMany?: EstimateShareNoteScalarWhereInput | EstimateShareNoteScalarWhereInput[] + } + + export type EstimateShareNoteUncheckedUpdateManyWithoutShareNestedInput = { + create?: XOR | EstimateShareNoteCreateWithoutShareInput[] | EstimateShareNoteUncheckedCreateWithoutShareInput[] + connectOrCreate?: EstimateShareNoteCreateOrConnectWithoutShareInput | EstimateShareNoteCreateOrConnectWithoutShareInput[] + upsert?: EstimateShareNoteUpsertWithWhereUniqueWithoutShareInput | EstimateShareNoteUpsertWithWhereUniqueWithoutShareInput[] + createMany?: EstimateShareNoteCreateManyShareInputEnvelope + set?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + disconnect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + delete?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + connect?: EstimateShareNoteWhereUniqueInput | EstimateShareNoteWhereUniqueInput[] + update?: EstimateShareNoteUpdateWithWhereUniqueWithoutShareInput | EstimateShareNoteUpdateWithWhereUniqueWithoutShareInput[] + updateMany?: EstimateShareNoteUpdateManyWithWhereWithoutShareInput | EstimateShareNoteUpdateManyWithWhereWithoutShareInput[] + deleteMany?: EstimateShareNoteScalarWhereInput | EstimateShareNoteScalarWhereInput[] + } + + export type EstimateShareCreateNestedOneWithoutNotesInput = { + create?: XOR + connectOrCreate?: EstimateShareCreateOrConnectWithoutNotesInput + connect?: EstimateShareWhereUniqueInput + } + + export type UserCreateNestedOneWithoutShareNotesInput = { + create?: XOR + connectOrCreate?: UserCreateOrConnectWithoutShareNotesInput + connect?: UserWhereUniqueInput + } + + export type EstimateShareUpdateOneRequiredWithoutNotesNestedInput = { + create?: XOR + connectOrCreate?: EstimateShareCreateOrConnectWithoutNotesInput + upsert?: EstimateShareUpsertWithoutNotesInput + connect?: EstimateShareWhereUniqueInput + update?: XOR, EstimateShareUncheckedUpdateWithoutNotesInput> + } + + export type UserUpdateOneRequiredWithoutShareNotesNestedInput = { + create?: XOR + connectOrCreate?: UserCreateOrConnectWithoutShareNotesInput + upsert?: UserUpsertWithoutShareNotesInput + connect?: UserWhereUniqueInput + update?: XOR, UserUncheckedUpdateWithoutShareNotesInput> + } + export type EstimateCreateNestedOneWithoutItemsInput = { create?: XOR connectOrCreate?: EstimateCreateOrConnectWithoutItemsInput @@ -23475,10 +24962,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -23506,10 +24996,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -23567,6 +25060,7 @@ export namespace Prisma { createdAt?: Date | string estimate: EstimateCreateNestedOneWithoutSharesInput sharedWith: UserCreateNestedOneWithoutReceivedSharesInput + notes?: EstimateShareNoteCreateNestedManyWithoutShareInput } export type EstimateShareUncheckedCreateWithoutOwnerInput = { @@ -23574,6 +25068,7 @@ export namespace Prisma { estimateId: string sharedWithId: string createdAt?: Date | string + notes?: EstimateShareNoteUncheckedCreateNestedManyWithoutShareInput } export type EstimateShareCreateOrConnectWithoutOwnerInput = { @@ -23591,6 +25086,7 @@ export namespace Prisma { createdAt?: Date | string estimate: EstimateCreateNestedOneWithoutSharesInput owner: UserCreateNestedOneWithoutOwnedSharesInput + notes?: EstimateShareNoteCreateNestedManyWithoutShareInput } export type EstimateShareUncheckedCreateWithoutSharedWithInput = { @@ -23598,6 +25094,7 @@ export namespace Prisma { estimateId: string ownerId: string createdAt?: Date | string + notes?: EstimateShareNoteUncheckedCreateNestedManyWithoutShareInput } export type EstimateShareCreateOrConnectWithoutSharedWithInput = { @@ -23610,6 +25107,30 @@ export namespace Prisma { skipDuplicates?: boolean } + export type EstimateShareNoteCreateWithoutAuthorInput = { + id?: string + content: string + createdAt?: Date | string + share: EstimateShareCreateNestedOneWithoutNotesInput + } + + export type EstimateShareNoteUncheckedCreateWithoutAuthorInput = { + id?: string + shareId: string + content: string + createdAt?: Date | string + } + + export type EstimateShareNoteCreateOrConnectWithoutAuthorInput = { + where: EstimateShareNoteWhereUniqueInput + create: XOR + } + + export type EstimateShareNoteCreateManyAuthorInputEnvelope = { + data: EstimateShareNoteCreateManyAuthorInput | EstimateShareNoteCreateManyAuthorInput[] + skipDuplicates?: boolean + } + export type EstimateUpsertWithWhereUniqueWithoutOwnerInput = { where: EstimateWhereUniqueInput update: XOR @@ -23642,10 +25163,13 @@ export namespace Prisma { totalLaboratory?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null subtotal?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null regionalCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: StringNullableFilter<"Estimate"> | string | null inflationIndex?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null inflationDocRef?: StringNullableFilter<"Estimate"> | string | null companyCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: StringNullableFilter<"Estimate"> | string | null executorCoef?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: StringNullableFilter<"Estimate"> | string | null withVat?: BoolFilter<"Estimate"> | boolean totalWithoutVat?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null vatRate?: DecimalNullableFilter<"Estimate"> | Decimal | DecimalJsLike | number | string | null @@ -23727,6 +25251,33 @@ export namespace Prisma { data: XOR } + export type EstimateShareNoteUpsertWithWhereUniqueWithoutAuthorInput = { + where: EstimateShareNoteWhereUniqueInput + update: XOR + create: XOR + } + + export type EstimateShareNoteUpdateWithWhereUniqueWithoutAuthorInput = { + where: EstimateShareNoteWhereUniqueInput + data: XOR + } + + export type EstimateShareNoteUpdateManyWithWhereWithoutAuthorInput = { + where: EstimateShareNoteScalarWhereInput + data: XOR + } + + export type EstimateShareNoteScalarWhereInput = { + AND?: EstimateShareNoteScalarWhereInput | EstimateShareNoteScalarWhereInput[] + OR?: EstimateShareNoteScalarWhereInput[] + NOT?: EstimateShareNoteScalarWhereInput | EstimateShareNoteScalarWhereInput[] + id?: StringFilter<"EstimateShareNote"> | string + shareId?: StringFilter<"EstimateShareNote"> | string + authorId?: StringFilter<"EstimateShareNote"> | string + content?: StringFilter<"EstimateShareNote"> | string + createdAt?: DateTimeFilter<"EstimateShareNote"> | Date | string + } + export type EstimateCreateWithoutDirectionInput = { id?: string number: string @@ -23738,10 +25289,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -23769,10 +25323,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -23823,6 +25380,7 @@ export namespace Prisma { chatSessions?: ChatSessionCreateNestedManyWithoutUserInput ownedShares?: EstimateShareCreateNestedManyWithoutOwnerInput receivedShares?: EstimateShareCreateNestedManyWithoutSharedWithInput + shareNotes?: EstimateShareNoteCreateNestedManyWithoutAuthorInput } export type UserUncheckedCreateWithoutEstimatesInput = { @@ -23835,6 +25393,7 @@ export namespace Prisma { chatSessions?: ChatSessionUncheckedCreateNestedManyWithoutUserInput ownedShares?: EstimateShareUncheckedCreateNestedManyWithoutOwnerInput receivedShares?: EstimateShareUncheckedCreateNestedManyWithoutSharedWithInput + shareNotes?: EstimateShareNoteUncheckedCreateNestedManyWithoutAuthorInput } export type UserCreateOrConnectWithoutEstimatesInput = { @@ -23954,6 +25513,7 @@ export namespace Prisma { createdAt?: Date | string sharedWith: UserCreateNestedOneWithoutReceivedSharesInput owner: UserCreateNestedOneWithoutOwnedSharesInput + notes?: EstimateShareNoteCreateNestedManyWithoutShareInput } export type EstimateShareUncheckedCreateWithoutEstimateInput = { @@ -23961,6 +25521,7 @@ export namespace Prisma { ownerId: string sharedWithId: string createdAt?: Date | string + notes?: EstimateShareNoteUncheckedCreateNestedManyWithoutShareInput } export type EstimateShareCreateOrConnectWithoutEstimateInput = { @@ -24018,6 +25579,7 @@ export namespace Prisma { chatSessions?: ChatSessionUpdateManyWithoutUserNestedInput ownedShares?: EstimateShareUpdateManyWithoutOwnerNestedInput receivedShares?: EstimateShareUpdateManyWithoutSharedWithNestedInput + shareNotes?: EstimateShareNoteUpdateManyWithoutAuthorNestedInput } export type UserUncheckedUpdateWithoutEstimatesInput = { @@ -24030,6 +25592,7 @@ export namespace Prisma { chatSessions?: ChatSessionUncheckedUpdateManyWithoutUserNestedInput ownedShares?: EstimateShareUncheckedUpdateManyWithoutOwnerNestedInput receivedShares?: EstimateShareUncheckedUpdateManyWithoutSharedWithNestedInput + shareNotes?: EstimateShareNoteUncheckedUpdateManyWithoutAuthorNestedInput } export type SurveyDirectionUpsertWithoutEstimatesInput = { @@ -24161,10 +25724,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -24193,10 +25759,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -24237,10 +25806,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -24269,10 +25841,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -24297,10 +25872,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -24329,10 +25907,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -24361,6 +25942,7 @@ export namespace Prisma { estimates?: EstimateCreateNestedManyWithoutOwnerInput chatSessions?: ChatSessionCreateNestedManyWithoutUserInput ownedShares?: EstimateShareCreateNestedManyWithoutOwnerInput + shareNotes?: EstimateShareNoteCreateNestedManyWithoutAuthorInput } export type UserUncheckedCreateWithoutReceivedSharesInput = { @@ -24373,6 +25955,7 @@ export namespace Prisma { estimates?: EstimateUncheckedCreateNestedManyWithoutOwnerInput chatSessions?: ChatSessionUncheckedCreateNestedManyWithoutUserInput ownedShares?: EstimateShareUncheckedCreateNestedManyWithoutOwnerInput + shareNotes?: EstimateShareNoteUncheckedCreateNestedManyWithoutAuthorInput } export type UserCreateOrConnectWithoutReceivedSharesInput = { @@ -24390,6 +25973,7 @@ export namespace Prisma { estimates?: EstimateCreateNestedManyWithoutOwnerInput chatSessions?: ChatSessionCreateNestedManyWithoutUserInput receivedShares?: EstimateShareCreateNestedManyWithoutSharedWithInput + shareNotes?: EstimateShareNoteCreateNestedManyWithoutAuthorInput } export type UserUncheckedCreateWithoutOwnedSharesInput = { @@ -24402,6 +25986,7 @@ export namespace Prisma { estimates?: EstimateUncheckedCreateNestedManyWithoutOwnerInput chatSessions?: ChatSessionUncheckedCreateNestedManyWithoutUserInput receivedShares?: EstimateShareUncheckedCreateNestedManyWithoutSharedWithInput + shareNotes?: EstimateShareNoteUncheckedCreateNestedManyWithoutAuthorInput } export type UserCreateOrConnectWithoutOwnedSharesInput = { @@ -24409,6 +25994,30 @@ export namespace Prisma { create: XOR } + export type EstimateShareNoteCreateWithoutShareInput = { + id?: string + content: string + createdAt?: Date | string + author: UserCreateNestedOneWithoutShareNotesInput + } + + export type EstimateShareNoteUncheckedCreateWithoutShareInput = { + id?: string + authorId: string + content: string + createdAt?: Date | string + } + + export type EstimateShareNoteCreateOrConnectWithoutShareInput = { + where: EstimateShareNoteWhereUniqueInput + create: XOR + } + + export type EstimateShareNoteCreateManyShareInputEnvelope = { + data: EstimateShareNoteCreateManyShareInput | EstimateShareNoteCreateManyShareInput[] + skipDuplicates?: boolean + } + export type EstimateUpsertWithoutSharesInput = { update: XOR create: XOR @@ -24431,10 +26040,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -24463,10 +26075,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -24501,6 +26116,7 @@ export namespace Prisma { estimates?: EstimateUpdateManyWithoutOwnerNestedInput chatSessions?: ChatSessionUpdateManyWithoutUserNestedInput ownedShares?: EstimateShareUpdateManyWithoutOwnerNestedInput + shareNotes?: EstimateShareNoteUpdateManyWithoutAuthorNestedInput } export type UserUncheckedUpdateWithoutReceivedSharesInput = { @@ -24513,6 +26129,7 @@ export namespace Prisma { estimates?: EstimateUncheckedUpdateManyWithoutOwnerNestedInput chatSessions?: ChatSessionUncheckedUpdateManyWithoutUserNestedInput ownedShares?: EstimateShareUncheckedUpdateManyWithoutOwnerNestedInput + shareNotes?: EstimateShareNoteUncheckedUpdateManyWithoutAuthorNestedInput } export type UserUpsertWithoutOwnedSharesInput = { @@ -24536,6 +26153,7 @@ export namespace Prisma { estimates?: EstimateUpdateManyWithoutOwnerNestedInput chatSessions?: ChatSessionUpdateManyWithoutUserNestedInput receivedShares?: EstimateShareUpdateManyWithoutSharedWithNestedInput + shareNotes?: EstimateShareNoteUpdateManyWithoutAuthorNestedInput } export type UserUncheckedUpdateWithoutOwnedSharesInput = { @@ -24548,6 +26166,139 @@ export namespace Prisma { estimates?: EstimateUncheckedUpdateManyWithoutOwnerNestedInput chatSessions?: ChatSessionUncheckedUpdateManyWithoutUserNestedInput receivedShares?: EstimateShareUncheckedUpdateManyWithoutSharedWithNestedInput + shareNotes?: EstimateShareNoteUncheckedUpdateManyWithoutAuthorNestedInput + } + + export type EstimateShareNoteUpsertWithWhereUniqueWithoutShareInput = { + where: EstimateShareNoteWhereUniqueInput + update: XOR + create: XOR + } + + export type EstimateShareNoteUpdateWithWhereUniqueWithoutShareInput = { + where: EstimateShareNoteWhereUniqueInput + data: XOR + } + + export type EstimateShareNoteUpdateManyWithWhereWithoutShareInput = { + where: EstimateShareNoteScalarWhereInput + data: XOR + } + + export type EstimateShareCreateWithoutNotesInput = { + id?: string + createdAt?: Date | string + estimate: EstimateCreateNestedOneWithoutSharesInput + sharedWith: UserCreateNestedOneWithoutReceivedSharesInput + owner: UserCreateNestedOneWithoutOwnedSharesInput + } + + export type EstimateShareUncheckedCreateWithoutNotesInput = { + id?: string + estimateId: string + ownerId: string + sharedWithId: string + createdAt?: Date | string + } + + export type EstimateShareCreateOrConnectWithoutNotesInput = { + where: EstimateShareWhereUniqueInput + create: XOR + } + + export type UserCreateWithoutShareNotesInput = { + id?: string + email: string + passwordHash: string + name?: string | null + createdAt?: Date | string + updatedAt?: Date | string + estimates?: EstimateCreateNestedManyWithoutOwnerInput + chatSessions?: ChatSessionCreateNestedManyWithoutUserInput + ownedShares?: EstimateShareCreateNestedManyWithoutOwnerInput + receivedShares?: EstimateShareCreateNestedManyWithoutSharedWithInput + } + + export type UserUncheckedCreateWithoutShareNotesInput = { + id?: string + email: string + passwordHash: string + name?: string | null + createdAt?: Date | string + updatedAt?: Date | string + estimates?: EstimateUncheckedCreateNestedManyWithoutOwnerInput + chatSessions?: ChatSessionUncheckedCreateNestedManyWithoutUserInput + ownedShares?: EstimateShareUncheckedCreateNestedManyWithoutOwnerInput + receivedShares?: EstimateShareUncheckedCreateNestedManyWithoutSharedWithInput + } + + export type UserCreateOrConnectWithoutShareNotesInput = { + where: UserWhereUniqueInput + create: XOR + } + + export type EstimateShareUpsertWithoutNotesInput = { + update: XOR + create: XOR + where?: EstimateShareWhereInput + } + + export type EstimateShareUpdateToOneWithWhereWithoutNotesInput = { + where?: EstimateShareWhereInput + data: XOR + } + + export type EstimateShareUpdateWithoutNotesInput = { + id?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + estimate?: EstimateUpdateOneRequiredWithoutSharesNestedInput + sharedWith?: UserUpdateOneRequiredWithoutReceivedSharesNestedInput + owner?: UserUpdateOneRequiredWithoutOwnedSharesNestedInput + } + + export type EstimateShareUncheckedUpdateWithoutNotesInput = { + id?: StringFieldUpdateOperationsInput | string + estimateId?: StringFieldUpdateOperationsInput | string + ownerId?: StringFieldUpdateOperationsInput | string + sharedWithId?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type UserUpsertWithoutShareNotesInput = { + update: XOR + create: XOR + where?: UserWhereInput + } + + export type UserUpdateToOneWithWhereWithoutShareNotesInput = { + where?: UserWhereInput + data: XOR + } + + export type UserUpdateWithoutShareNotesInput = { + id?: StringFieldUpdateOperationsInput | string + email?: StringFieldUpdateOperationsInput | string + passwordHash?: StringFieldUpdateOperationsInput | string + name?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string + estimates?: EstimateUpdateManyWithoutOwnerNestedInput + chatSessions?: ChatSessionUpdateManyWithoutUserNestedInput + ownedShares?: EstimateShareUpdateManyWithoutOwnerNestedInput + receivedShares?: EstimateShareUpdateManyWithoutSharedWithNestedInput + } + + export type UserUncheckedUpdateWithoutShareNotesInput = { + id?: StringFieldUpdateOperationsInput | string + email?: StringFieldUpdateOperationsInput | string + passwordHash?: StringFieldUpdateOperationsInput | string + name?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string + estimates?: EstimateUncheckedUpdateManyWithoutOwnerNestedInput + chatSessions?: ChatSessionUncheckedUpdateManyWithoutUserNestedInput + ownedShares?: EstimateShareUncheckedUpdateManyWithoutOwnerNestedInput + receivedShares?: EstimateShareUncheckedUpdateManyWithoutSharedWithNestedInput } export type EstimateCreateWithoutItemsInput = { @@ -24561,10 +26312,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -24593,10 +26347,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -24680,10 +26437,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -24712,10 +26472,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -24789,10 +26552,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -24821,10 +26587,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -24865,10 +26634,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -24897,10 +26669,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -24924,6 +26699,7 @@ export namespace Prisma { estimates?: EstimateCreateNestedManyWithoutOwnerInput ownedShares?: EstimateShareCreateNestedManyWithoutOwnerInput receivedShares?: EstimateShareCreateNestedManyWithoutSharedWithInput + shareNotes?: EstimateShareNoteCreateNestedManyWithoutAuthorInput } export type UserUncheckedCreateWithoutChatSessionsInput = { @@ -24936,6 +26712,7 @@ export namespace Prisma { estimates?: EstimateUncheckedCreateNestedManyWithoutOwnerInput ownedShares?: EstimateShareUncheckedCreateNestedManyWithoutOwnerInput receivedShares?: EstimateShareUncheckedCreateNestedManyWithoutSharedWithInput + shareNotes?: EstimateShareNoteUncheckedCreateNestedManyWithoutAuthorInput } export type UserCreateOrConnectWithoutChatSessionsInput = { @@ -24990,6 +26767,7 @@ export namespace Prisma { estimates?: EstimateUpdateManyWithoutOwnerNestedInput ownedShares?: EstimateShareUpdateManyWithoutOwnerNestedInput receivedShares?: EstimateShareUpdateManyWithoutSharedWithNestedInput + shareNotes?: EstimateShareNoteUpdateManyWithoutAuthorNestedInput } export type UserUncheckedUpdateWithoutChatSessionsInput = { @@ -25002,6 +26780,7 @@ export namespace Prisma { estimates?: EstimateUncheckedUpdateManyWithoutOwnerNestedInput ownedShares?: EstimateShareUncheckedUpdateManyWithoutOwnerNestedInput receivedShares?: EstimateShareUncheckedUpdateManyWithoutSharedWithNestedInput + shareNotes?: EstimateShareNoteUncheckedUpdateManyWithoutAuthorNestedInput } export type ChatMessageUpsertWithWhereUniqueWithoutSessionInput = { @@ -25370,10 +27149,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -25406,6 +27188,13 @@ export namespace Prisma { createdAt?: Date | string } + export type EstimateShareNoteCreateManyAuthorInput = { + id?: string + shareId: string + content: string + createdAt?: Date | string + } + export type EstimateUpdateWithoutOwnerInput = { id?: StringFieldUpdateOperationsInput | string number?: StringFieldUpdateOperationsInput | string @@ -25417,10 +27206,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -25448,10 +27240,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -25478,10 +27273,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -25523,6 +27321,7 @@ export namespace Prisma { createdAt?: DateTimeFieldUpdateOperationsInput | Date | string estimate?: EstimateUpdateOneRequiredWithoutSharesNestedInput sharedWith?: UserUpdateOneRequiredWithoutReceivedSharesNestedInput + notes?: EstimateShareNoteUpdateManyWithoutShareNestedInput } export type EstimateShareUncheckedUpdateWithoutOwnerInput = { @@ -25530,6 +27329,7 @@ export namespace Prisma { estimateId?: StringFieldUpdateOperationsInput | string sharedWithId?: StringFieldUpdateOperationsInput | string createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + notes?: EstimateShareNoteUncheckedUpdateManyWithoutShareNestedInput } export type EstimateShareUncheckedUpdateManyWithoutOwnerInput = { @@ -25544,6 +27344,7 @@ export namespace Prisma { createdAt?: DateTimeFieldUpdateOperationsInput | Date | string estimate?: EstimateUpdateOneRequiredWithoutSharesNestedInput owner?: UserUpdateOneRequiredWithoutOwnedSharesNestedInput + notes?: EstimateShareNoteUpdateManyWithoutShareNestedInput } export type EstimateShareUncheckedUpdateWithoutSharedWithInput = { @@ -25551,6 +27352,7 @@ export namespace Prisma { estimateId?: StringFieldUpdateOperationsInput | string ownerId?: StringFieldUpdateOperationsInput | string createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + notes?: EstimateShareNoteUncheckedUpdateManyWithoutShareNestedInput } export type EstimateShareUncheckedUpdateManyWithoutSharedWithInput = { @@ -25560,6 +27362,27 @@ export namespace Prisma { createdAt?: DateTimeFieldUpdateOperationsInput | Date | string } + export type EstimateShareNoteUpdateWithoutAuthorInput = { + id?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + share?: EstimateShareUpdateOneRequiredWithoutNotesNestedInput + } + + export type EstimateShareNoteUncheckedUpdateWithoutAuthorInput = { + id?: StringFieldUpdateOperationsInput | string + shareId?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type EstimateShareNoteUncheckedUpdateManyWithoutAuthorInput = { + id?: StringFieldUpdateOperationsInput | string + shareId?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + export type EstimateCreateManyDirectionInput = { id?: string number: string @@ -25572,10 +27395,13 @@ export namespace Prisma { totalLaboratory?: Decimal | DecimalJsLike | number | string | null subtotal?: Decimal | DecimalJsLike | number | string | null regionalCoef?: Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: string | null inflationIndex?: Decimal | DecimalJsLike | number | string | null inflationDocRef?: string | null companyCoef?: Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: string | null executorCoef?: Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: string | null withVat?: boolean totalWithoutVat?: Decimal | DecimalJsLike | number | string | null vatRate?: Decimal | DecimalJsLike | number | string | null @@ -25597,10 +27423,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -25628,10 +27457,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -25658,10 +27490,13 @@ export namespace Prisma { totalLaboratory?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null subtotal?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null regionalCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + regionalCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null inflationIndex?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null inflationDocRef?: NullableStringFieldUpdateOperationsInput | string | null companyCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + companyCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null executorCoef?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null + executorCoefDocRef?: NullableStringFieldUpdateOperationsInput | string | null withVat?: BoolFieldUpdateOperationsInput | boolean totalWithoutVat?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null vatRate?: NullableDecimalFieldUpdateOperationsInput | Decimal | DecimalJsLike | number | string | null @@ -25823,6 +27658,7 @@ export namespace Prisma { createdAt?: DateTimeFieldUpdateOperationsInput | Date | string sharedWith?: UserUpdateOneRequiredWithoutReceivedSharesNestedInput owner?: UserUpdateOneRequiredWithoutOwnedSharesNestedInput + notes?: EstimateShareNoteUpdateManyWithoutShareNestedInput } export type EstimateShareUncheckedUpdateWithoutEstimateInput = { @@ -25830,6 +27666,7 @@ export namespace Prisma { ownerId?: StringFieldUpdateOperationsInput | string sharedWithId?: StringFieldUpdateOperationsInput | string createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + notes?: EstimateShareNoteUncheckedUpdateManyWithoutShareNestedInput } export type EstimateShareUncheckedUpdateManyWithoutEstimateInput = { @@ -25860,6 +27697,34 @@ export namespace Prisma { createdAt?: DateTimeFieldUpdateOperationsInput | Date | string } + export type EstimateShareNoteCreateManyShareInput = { + id?: string + authorId: string + content: string + createdAt?: Date | string + } + + export type EstimateShareNoteUpdateWithoutShareInput = { + id?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + author?: UserUpdateOneRequiredWithoutShareNotesNestedInput + } + + export type EstimateShareNoteUncheckedUpdateWithoutShareInput = { + id?: StringFieldUpdateOperationsInput | string + authorId?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type EstimateShareNoteUncheckedUpdateManyWithoutShareInput = { + id?: StringFieldUpdateOperationsInput | string + authorId?: StringFieldUpdateOperationsInput | string + content?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + export type ChatMessageCreateManySessionInput = { id?: string role: string @@ -25921,6 +27786,10 @@ export namespace Prisma { * @deprecated Use EstimateCountOutputTypeDefaultArgs instead */ export type EstimateCountOutputTypeArgs = EstimateCountOutputTypeDefaultArgs + /** + * @deprecated Use EstimateShareCountOutputTypeDefaultArgs instead + */ + export type EstimateShareCountOutputTypeArgs = EstimateShareCountOutputTypeDefaultArgs /** * @deprecated Use ChatSessionCountOutputTypeDefaultArgs instead */ @@ -25965,6 +27834,10 @@ export namespace Prisma { * @deprecated Use EstimateShareDefaultArgs instead */ export type EstimateShareArgs = EstimateShareDefaultArgs + /** + * @deprecated Use EstimateShareNoteDefaultArgs instead + */ + export type EstimateShareNoteArgs = EstimateShareNoteDefaultArgs /** * @deprecated Use EstimateItemDefaultArgs instead */ diff --git a/backend/node_modules/.prisma/client/index.js b/backend/node_modules/.prisma/client/index.js old mode 100755 new mode 100644 index ab692bf7..a4021ee5 --- a/backend/node_modules/.prisma/client/index.js +++ b/backend/node_modules/.prisma/client/index.js @@ -188,10 +188,13 @@ exports.Prisma.EstimateScalarFieldEnum = { totalLaboratory: 'totalLaboratory', subtotal: 'subtotal', regionalCoef: 'regionalCoef', + regionalCoefDocRef: 'regionalCoefDocRef', inflationIndex: 'inflationIndex', inflationDocRef: 'inflationDocRef', companyCoef: 'companyCoef', + companyCoefDocRef: 'companyCoefDocRef', executorCoef: 'executorCoef', + executorCoefDocRef: 'executorCoefDocRef', withVat: 'withVat', totalWithoutVat: 'totalWithoutVat', vatRate: 'vatRate', @@ -218,6 +221,14 @@ exports.Prisma.EstimateShareScalarFieldEnum = { createdAt: 'createdAt' }; +exports.Prisma.EstimateShareNoteScalarFieldEnum = { + id: 'id', + shareId: 'shareId', + authorId: 'authorId', + content: 'content', + createdAt: 'createdAt' +}; + exports.Prisma.EstimateItemScalarFieldEnum = { id: 'id', estimateId: 'estimateId', @@ -324,6 +335,7 @@ exports.Prisma.ModelName = { Estimate: 'Estimate', EstimateVersion: 'EstimateVersion', EstimateShare: 'EstimateShare', + EstimateShareNote: 'EstimateShareNote', EstimateItem: 'EstimateItem', EstimateTotal: 'EstimateTotal', Setting: 'Setting', @@ -341,7 +353,7 @@ const config = { "value": "prisma-client-js" }, "output": { - "value": "C:\\Users\\Job\\Desktop\\Сметы гео вариант 2\\backend\\node_modules\\@prisma\\client", + "value": "/home/its/suety-sasha/geo/backend/node_modules/@prisma/client", "fromEnvVar": null }, "config": { @@ -350,12 +362,12 @@ const config = { "binaryTargets": [ { "fromEnvVar": null, - "value": "windows", + "value": "debian-openssl-3.0.x", "native": true } ], "previewFeatures": [], - "sourceFilePath": "C:\\Users\\Job\\Desktop\\Сметы гео вариант 2\\backend\\prisma\\schema.prisma" + "sourceFilePath": "/home/its/suety-sasha/geo/backend/prisma/schema.prisma" }, "relativeEnvPaths": { "rootEnvPath": null, @@ -368,7 +380,6 @@ const config = { "db" ], "activeProvider": "postgresql", - "postinstall": false, "inlineDatasources": { "db": { "url": { @@ -377,8 +388,8 @@ const config = { } } }, - "inlineSchema": "// Prisma schema for Estimate Assistant\n\ngenerator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\n// Справочники базовых цен\nmodel PriceBook {\n id String @id @default(uuid())\n code String @unique // SBC-GEODESY-2004, SBC-GEOLOGY-1999\n name String // Полное название справочника\n baseDate DateTime // Дата базовых цен (01.01.2001, 01.01.1991)\n approvedBy String? // Кем утвержден\n effectiveDate DateTime? // Дата введения в действие\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n tables PriceTable[]\n items PriceItem[]\n}\n\n// Таблицы справочников\nmodel PriceTable {\n id String @id @default(uuid())\n priceBookId String\n tableNumber Int // Номер таблицы (8, 9, 13, и т.д.)\n name String // Название таблицы\n unit String // Единица измерения (1 пункт, 1 га, 1 км и т.д.)\n notes Json? // Примечания к таблице\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n priceBook PriceBook @relation(fields: [priceBookId], references: [id], onDelete: Cascade)\n items PriceItem[]\n\n @@unique([priceBookId, tableNumber])\n}\n\n// Позиции справочников (расценки)\nmodel PriceItem {\n id String @id @default(uuid())\n priceBookId String\n priceTableId String\n paragraph String // Номер параграфа (8-1, 9-4-1 и т.д.)\n workType String // Тип работы / наименование\n description String? // Дополнительное описание\n\n // Цены (полевые/камеральные для разных категорий)\n priceField1 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 1\n priceOffice1 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 1\n priceField2 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 2\n priceOffice2 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 2\n priceField3 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 3\n priceOffice3 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 3\n priceSimple Decimal? @db.Decimal(12, 2) // Простая цена (без категорий)\n\n // Дополнительные параметры\n attributes Json? // Доп. атрибуты (масштаб, глубина, диаметр и т.д.)\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n priceBook PriceBook @relation(fields: [priceBookId], references: [id], onDelete: Cascade)\n priceTable PriceTable @relation(fields: [priceTableId], references: [id], onDelete: Cascade)\n estimateItems EstimateItem[]\n\n @@index([paragraph])\n @@index([workType])\n}\n\n// Коэффициенты\nmodel Coefficient {\n id String @id @default(uuid())\n type String // regional, transport_internal, transport_external, seasonal, special\n code String // Уникальный код коэффициента\n name String // Название\n value Decimal @db.Decimal(6, 4) // Значение коэффициента\n description String? // Описание\n conditions Json? // Условия применения\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([type, code])\n}\n\n// Индексы инфляции (перевод в текущие цены)\nmodel InflationIndex {\n id String @id @default(uuid())\n baseDate DateTime // Базовая дата цен\n effectiveFrom DateTime // Дата начала действия индекса\n effectiveTo DateTime? // Дата окончания (null = текущий)\n indexValue Decimal @db.Decimal(10, 4) // Значение индекса\n documentRef String? // Ссылка на документ (Письмо Минстроя и т.д.)\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Пользователи\nmodel User {\n id String @id @default(uuid())\n email String @unique\n passwordHash String\n name String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimates Estimate[]\n chatSessions ChatSession[]\n ownedShares EstimateShare[] @relation(\"ShareOwner\")\n receivedShares EstimateShare[] @relation(\"ShareReceiver\")\n}\n\n// Направления изысканий\nmodel SurveyDirection {\n id String @id @default(uuid())\n code String @unique // geodesy, geology, ecology, hydrology\n name String // Инженерно-геодезические изыскания\n shortName String // Геодезия\n isActive Boolean @default(true)\n\n estimates Estimate[]\n}\n\n// Сметы\nmodel Estimate {\n id String @id @default(uuid())\n number String // Номер сметы\n directionId String\n ownerId String // Владелец сметы\n objectName String // Название объекта\n customer String // Заказчик\n executor String // Исполнитель\n\n // Итоговые значения\n totalFieldWorks Decimal? @db.Decimal(14, 2) // Итого полевые работы\n totalOfficeWorks Decimal? @db.Decimal(14, 2) // Итого камеральные работы\n totalLaboratory Decimal? @db.Decimal(14, 2) // Итого лабораторные\n subtotal Decimal? @db.Decimal(14, 2) // Итого по изысканиям\n\n // Коэффициенты и пересчет\n regionalCoef Decimal? @db.Decimal(6, 4) // Районный коэффициент\n inflationIndex Decimal? @db.Decimal(10, 4) // Индекс перевода в текущие цены\n inflationDocRef String? // Ссылка на документ с индексом\n companyCoef Decimal? @db.Decimal(6, 4) // Коэффициент компании (Газпром и т.д.)\n executorCoef Decimal? @db.Decimal(6, 4) // Коэффициент исполнителя\n\n // Итоги\n withVat Boolean @default(true) // Смета с НДС (true) или без НДС (false)\n totalWithoutVat Decimal? @db.Decimal(14, 2) // Итого без НДС\n vatRate Decimal? @db.Decimal(4, 2) // Ставка НДС (18, 20, 7)\n vatAmount Decimal? @db.Decimal(14, 2) // Сумма НДС\n totalWithVat Decimal? @db.Decimal(14, 2) // Всего с НДС\n\n status String @default(\"draft\") // draft, completed, approved\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)\n direction SurveyDirection @relation(fields: [directionId], references: [id])\n items EstimateItem[]\n totals EstimateTotal[]\n shares EstimateShare[]\n versions EstimateVersion[]\n}\n\n// История версий сметы (снимок при сохранении/пересчёте)\nmodel EstimateVersion {\n id String @id @default(uuid())\n estimateId String\n versionNumber Int // Порядковый номер версии по смете\n snapshot Json // Полный снимок: estimate + items + totals\n createdAt DateTime @default(now())\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n\n @@index([estimateId])\n @@index([estimateId, createdAt])\n}\n\n// Шаринг сметы с другим пользователем\nmodel EstimateShare {\n id String @id @default(uuid())\n estimateId String\n ownerId String // Кто поделился\n sharedWithId String // С кем поделились\n createdAt DateTime @default(now())\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n sharedWith User @relation(\"ShareReceiver\", fields: [sharedWithId], references: [id], onDelete: Cascade)\n owner User @relation(\"ShareOwner\", fields: [ownerId], references: [id], onDelete: Cascade)\n\n @@unique([estimateId, sharedWithId])\n @@index([sharedWithId])\n}\n\n// Позиции сметы\nmodel EstimateItem {\n id String @id @default(uuid())\n estimateId String\n orderNumber Int // Порядковый номер\n sectionType String // field, office, laboratory, transport, other\n priceItemId String? // Ссылка на позицию справочника\n\n workName String // Наименование работы\n justification String? // Обоснование (ссылка на СБЦ)\n basePrice Decimal @db.Decimal(12, 2) // Базовая цена\n quantity Decimal @db.Decimal(12, 4) // Объем\n unit String? // Единица измерения\n\n // Коэффициенты\n coef1 Decimal? @db.Decimal(6, 4) // Коэффициент 1\n coef1Desc String? // Описание коэффициента 1\n coef2 Decimal? @db.Decimal(6, 4) // Коэффициент 2\n coef2Desc String? // Описание коэффициента 2\n coef3 Decimal? @db.Decimal(6, 4) // Коэффициент 3\n coef3Desc String? // Описание коэффициента 3\n\n totalPrice Decimal @db.Decimal(14, 2) // Итоговая стоимость\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n priceItem PriceItem? @relation(fields: [priceItemId], references: [id])\n\n @@index([estimateId, orderNumber])\n}\n\n// Итоговая часть сметы (нижняя часть)\nmodel EstimateTotal {\n id String @id @default(uuid())\n estimateId String\n orderNumber Int // Порядок строки\n label String // Название строки (Перевод в текущие цены, НДС и т.д.)\n description String? // Дополнительное описание\n baseValue Decimal? @db.Decimal(14, 2) // Базовое значение\n coefficient Decimal? @db.Decimal(10, 4) // Коэффициент/процент\n resultValue Decimal @db.Decimal(14, 2) // Результат\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n\n @@index([estimateId, orderNumber])\n}\n\n// Настройки приложения\nmodel Setting {\n id String @id @default(uuid())\n key String @unique\n value String\n type String @default(\"string\") // string, number, boolean, json\n category String // general, company, ai, display\n label String? // Человекочитаемое название\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Сессии чата (у каждого пользователя свои контексты ИИ)\nmodel ChatSession {\n id String @id @default(uuid())\n userId String // Владелец сессии\n estimateId String? // Связанная смета (опционально)\n status String @default(\"active\") // active, completed\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n messages ChatMessage[]\n\n @@index([userId])\n @@index([userId, estimateId])\n}\n\n// Сообщения чата\nmodel ChatMessage {\n id String @id @default(uuid())\n sessionId String\n role String // user, assistant, system\n content String\n metadata Json? // Доп. данные (извлеченные сущности и т.д.)\n createdAt DateTime @default(now())\n\n session ChatSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)\n\n @@index([sessionId, createdAt])\n}\n", - "inlineSchemaHash": "bc80edc361cc68e644a8e28a66cb71ea44953b4cdcc4022b7c0c5dfdc80644fc", + "inlineSchema": "// Prisma schema for Estimate Assistant\n\ngenerator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\n// Справочники базовых цен (СБЦ)\nmodel PriceBook {\n id String @id @default(uuid())\n code String @unique // SBC-GEODESY-2004, SBC-GEOLOGY-1999\n name String // Полное название справочника\n baseDate DateTime // Дата базовых цен (01.01.2001, 01.01.1991)\n approvedBy String? // Кем утвержден\n effectiveDate DateTime? // Дата введения в действие\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n tables PriceTable[]\n items PriceItem[]\n}\n\n// Таблицы справочников\nmodel PriceTable {\n id String @id @default(uuid())\n priceBookId String\n tableNumber Int // Номер таблицы (8, 9, 13, и т.д.)\n name String // Название таблицы\n unit String // Единица измерения (1 пункт, 1 га, 1 км и т.д.)\n notes Json? // Примечания к таблице\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n priceBook PriceBook @relation(fields: [priceBookId], references: [id], onDelete: Cascade)\n items PriceItem[]\n\n @@unique([priceBookId, tableNumber])\n}\n\n// Позиции справочников (расценки)\nmodel PriceItem {\n id String @id @default(uuid())\n priceBookId String\n priceTableId String\n paragraph String // Номер параграфа (8-1, 9-4-1 и т.д.)\n workType String // Тип работы / наименование\n description String? // Дополнительное описание\n\n // Цены (полевые/камеральные для разных категорий)\n priceField1 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 1\n priceOffice1 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 1\n priceField2 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 2\n priceOffice2 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 2\n priceField3 Decimal? @db.Decimal(12, 2) // Полевые работы, категория 3\n priceOffice3 Decimal? @db.Decimal(12, 2) // Камеральные работы, категория 3\n priceSimple Decimal? @db.Decimal(12, 2) // Простая цена (без категорий)\n\n // Дополнительные параметры\n attributes Json? // Доп. атрибуты (масштаб, глубина, диаметр и т.д.)\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n priceBook PriceBook @relation(fields: [priceBookId], references: [id], onDelete: Cascade)\n priceTable PriceTable @relation(fields: [priceTableId], references: [id], onDelete: Cascade)\n estimateItems EstimateItem[]\n\n @@index([paragraph])\n @@index([workType])\n}\n\n// Коэффициенты\nmodel Coefficient {\n id String @id @default(uuid())\n type String // regional, transport_internal, transport_external, seasonal, special\n code String // Уникальный код коэффициента\n name String // Название\n value Decimal @db.Decimal(6, 4) // Значение коэффициента\n description String? // Описание\n conditions Json? // Условия применения\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([type, code])\n}\n\n// Индексы инфляции (перевод в текущие цены)\nmodel InflationIndex {\n id String @id @default(uuid())\n baseDate DateTime // Базовая дата цен\n effectiveFrom DateTime // Дата начала действия индекса\n effectiveTo DateTime? // Дата окончания (null = текущий)\n indexValue Decimal @db.Decimal(10, 4) // Значение индекса\n documentRef String? // Ссылка на документ (Письмо Минстроя и т.д.)\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Пользователи\nmodel User {\n id String @id @default(uuid())\n email String @unique\n passwordHash String\n name String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimates Estimate[]\n chatSessions ChatSession[]\n ownedShares EstimateShare[] @relation(\"ShareOwner\")\n receivedShares EstimateShare[] @relation(\"ShareReceiver\")\n shareNotes EstimateShareNote[]\n}\n\n// Направления изысканий\nmodel SurveyDirection {\n id String @id @default(uuid())\n code String @unique // geodesy, geology, ecology, hydrology\n name String // Инженерно-геодезические изыскания\n shortName String // Геодезия\n isActive Boolean @default(true)\n\n estimates Estimate[]\n}\n\n// Сметы\nmodel Estimate {\n id String @id @default(uuid())\n number String // Номер сметы\n directionId String\n ownerId String // Владелец сметы\n objectName String // Название объекта\n customer String // Заказчик\n executor String // Исполнитель\n\n // Итоговые значения\n totalFieldWorks Decimal? @db.Decimal(14, 2) // Итого полевые работы\n totalOfficeWorks Decimal? @db.Decimal(14, 2) // Итого камеральные работы\n totalLaboratory Decimal? @db.Decimal(14, 2) // Итого лабораторные\n subtotal Decimal? @db.Decimal(14, 2) // Итого по изысканиям\n\n // Коэффициенты и пересчет\n regionalCoef Decimal? @db.Decimal(6, 4) // Районный коэффициент\n regionalCoefDocRef String? // Описание (С районным коэффициентом и т.д.)\n inflationIndex Decimal? @db.Decimal(10, 4) // Индекс перевода в текущие цены\n inflationDocRef String? // Ссылка на документ (Письмо Минстроя и т.д.)\n companyCoef Decimal? @db.Decimal(6, 4) // Коэффициент компании (Газпром и т.д.)\n companyCoefDocRef String? // Описание (Коэффициент ОАО «Газпром» №544 и т.д.)\n executorCoef Decimal? @db.Decimal(6, 4) // Коэффициент исполнителя\n executorCoefDocRef String? // Описание (Коэффициент ООО «ГеоВектор» и т.д.)\n\n // Итоги\n withVat Boolean @default(true) // Смета с НДС (true) или без НДС (false)\n totalWithoutVat Decimal? @db.Decimal(14, 2) // Итого без НДС\n vatRate Decimal? @db.Decimal(4, 2) // Ставка НДС (18, 20, 7)\n vatAmount Decimal? @db.Decimal(14, 2) // Сумма НДС\n totalWithVat Decimal? @db.Decimal(14, 2) // Всего с НДС\n\n status String @default(\"draft\") // draft, completed, approved\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)\n direction SurveyDirection @relation(fields: [directionId], references: [id])\n items EstimateItem[]\n totals EstimateTotal[]\n shares EstimateShare[]\n versions EstimateVersion[]\n}\n\n// История версий сметы (снимок при сохранении/пересчёте)\nmodel EstimateVersion {\n id String @id @default(uuid())\n estimateId String\n versionNumber Int // Порядковый номер версии по смете\n snapshot Json // Полный снимок: estimate + items + totals\n createdAt DateTime @default(now())\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n\n @@index([estimateId])\n @@index([estimateId, createdAt])\n}\n\n// Шаринг сметы с другим пользователем\nmodel EstimateShare {\n id String @id @default(uuid())\n estimateId String\n ownerId String // Кто поделился\n sharedWithId String // С кем поделились\n createdAt DateTime @default(now())\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n sharedWith User @relation(\"ShareReceiver\", fields: [sharedWithId], references: [id], onDelete: Cascade)\n owner User @relation(\"ShareOwner\", fields: [ownerId], references: [id], onDelete: Cascade)\n notes EstimateShareNote[]\n\n @@unique([estimateId, sharedWithId])\n @@index([sharedWithId])\n}\n\n// Заметки к шарингу сметы (кто что написал)\nmodel EstimateShareNote {\n id String @id @default(uuid())\n shareId String\n authorId String\n content String @db.Text\n createdAt DateTime @default(now())\n\n share EstimateShare @relation(fields: [shareId], references: [id], onDelete: Cascade)\n author User @relation(fields: [authorId], references: [id], onDelete: Cascade)\n\n @@index([shareId])\n}\n\n// Позиции сметы\nmodel EstimateItem {\n id String @id @default(uuid())\n estimateId String\n orderNumber Int // Порядковый номер\n sectionType String // field, office, laboratory, transport, other\n priceItemId String? // Ссылка на позицию справочника\n\n workName String // Наименование работы\n justification String? // Обоснование (ссылка на СБЦ)\n basePrice Decimal @db.Decimal(12, 2) // Базовая цена\n quantity Decimal @db.Decimal(12, 4) // Объем\n unit String? // Единица измерения\n\n // Коэффициенты\n coef1 Decimal? @db.Decimal(6, 4) // Коэффициент 1\n coef1Desc String? // Описание коэффициента 1\n coef2 Decimal? @db.Decimal(6, 4) // Коэффициент 2\n coef2Desc String? // Описание коэффициента 2\n coef3 Decimal? @db.Decimal(6, 4) // Коэффициент 3\n coef3Desc String? // Описание коэффициента 3\n\n totalPrice Decimal @db.Decimal(14, 2) // Итоговая стоимость\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n priceItem PriceItem? @relation(fields: [priceItemId], references: [id])\n\n @@index([estimateId, orderNumber])\n}\n\n// Итоговая часть сметы (нижняя часть)\nmodel EstimateTotal {\n id String @id @default(uuid())\n estimateId String\n orderNumber Int // Порядок строки\n label String // Название строки (Перевод в текущие цены, НДС и т.д.)\n description String? // Дополнительное описание\n baseValue Decimal? @db.Decimal(14, 2) // Базовое значение\n coefficient Decimal? @db.Decimal(10, 4) // Коэффициент/процент\n resultValue Decimal @db.Decimal(14, 2) // Результат\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade)\n\n @@index([estimateId, orderNumber])\n}\n\n// Настройки приложения\nmodel Setting {\n id String @id @default(uuid())\n key String @unique\n value String\n type String @default(\"string\") // string, number, boolean, json\n category String // general, company, ai, display\n label String? // Человекочитаемое название\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Сессии чата (у каждого пользователя свои контексты ИИ)\nmodel ChatSession {\n id String @id @default(uuid())\n userId String // Владелец сессии\n estimateId String? // Связанная смета (опционально)\n status String @default(\"active\") // active, completed\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n messages ChatMessage[]\n\n @@index([userId])\n @@index([userId, estimateId])\n}\n\n// Сообщения чата\nmodel ChatMessage {\n id String @id @default(uuid())\n sessionId String\n role String // user, assistant, system\n content String\n metadata Json? // Доп. данные (извлеченные сущности и т.д.)\n createdAt DateTime @default(now())\n\n session ChatSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)\n\n @@index([sessionId, createdAt])\n}\n", + "inlineSchemaHash": "de619b5bba6e06459d564f5c699a9b4c82e24de5d6f166361c40bbe179609203", "copyEngine": true } @@ -399,7 +410,7 @@ if (!fs.existsSync(path.join(__dirname, 'schema.prisma'))) { config.isBundled = true } -config.runtimeDataModel = JSON.parse("{\"models\":{\"PriceBook\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"approvedBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"tables\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceTable\",\"relationName\":\"PriceBookToPriceTable\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"PriceBookToPriceItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PriceTable\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceBookId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tableNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"priceBook\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceBook\",\"relationName\":\"PriceBookToPriceTable\",\"relationFromFields\":[\"priceBookId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"PriceItemToPriceTable\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"priceBookId\",\"tableNumber\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"priceBookId\",\"tableNumber\"]}],\"isGenerated\":false},\"PriceItem\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceBookId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceTableId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"paragraph\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"workType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceSimple\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"attributes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"priceBook\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceBook\",\"relationName\":\"PriceBookToPriceItem\",\"relationFromFields\":[\"priceBookId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceTable\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceTable\",\"relationName\":\"PriceItemToPriceTable\",\"relationFromFields\":[\"priceTableId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateItems\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateItem\",\"relationName\":\"EstimateItemToPriceItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Coefficient\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"conditions\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"type\",\"code\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"type\",\"code\"]}],\"isGenerated\":false},\"InflationIndex\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveFrom\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveTo\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"indexValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimates\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"chatSessions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatSession\",\"relationName\":\"ChatSessionToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownedShares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"ShareOwner\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receivedShares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"ShareReceiver\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SurveyDirection\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shortName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimates\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToSurveyDirection\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Estimate\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"number\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"directionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"objectName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executor\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalFieldWorks\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalOfficeWorks\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalLaboratory\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subtotal\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"regionalCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"inflationIndex\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"inflationDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executorCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"withVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalWithoutVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vatRate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vatAmount\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalWithVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"draft\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"owner\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"EstimateToUser\",\"relationFromFields\":[\"ownerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"direction\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SurveyDirection\",\"relationName\":\"EstimateToSurveyDirection\",\"relationFromFields\":[\"directionId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateItem\",\"relationName\":\"EstimateToEstimateItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totals\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateTotal\",\"relationName\":\"EstimateToEstimateTotal\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"EstimateToEstimateShare\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"versions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateVersion\",\"relationName\":\"EstimateToEstimateVersion\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateVersion\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"versionNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"snapshot\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateVersion\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateShare\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sharedWithId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateShare\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sharedWith\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ShareReceiver\",\"relationFromFields\":[\"sharedWithId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"owner\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ShareOwner\",\"relationFromFields\":[\"ownerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"estimateId\",\"sharedWithId\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"estimateId\",\"sharedWithId\"]}],\"isGenerated\":false},\"EstimateItem\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sectionType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceItemId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"workName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"justification\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"quantity\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef1Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef2Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef3Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalPrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateItem\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceItem\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"EstimateItemToPriceItem\",\"relationFromFields\":[\"priceItemId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateTotal\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"label\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coefficient\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resultValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateTotal\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Setting\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"key\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"string\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"category\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"label\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ChatSession\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"active\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ChatSessionToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"messages\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatMessage\",\"relationName\":\"ChatMessageToChatSession\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ChatMessage\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sessionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"content\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"metadata\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"session\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatSession\",\"relationName\":\"ChatMessageToChatSession\",\"relationFromFields\":[\"sessionId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"PriceBook\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"approvedBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"tables\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceTable\",\"relationName\":\"PriceBookToPriceTable\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"PriceBookToPriceItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PriceTable\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceBookId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tableNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"priceBook\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceBook\",\"relationName\":\"PriceBookToPriceTable\",\"relationFromFields\":[\"priceBookId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"PriceItemToPriceTable\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"priceBookId\",\"tableNumber\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"priceBookId\",\"tableNumber\"]}],\"isGenerated\":false},\"PriceItem\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceBookId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceTableId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"paragraph\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"workType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceField3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceOffice3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceSimple\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"attributes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"priceBook\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceBook\",\"relationName\":\"PriceBookToPriceItem\",\"relationFromFields\":[\"priceBookId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceTable\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceTable\",\"relationName\":\"PriceItemToPriceTable\",\"relationFromFields\":[\"priceTableId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateItems\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateItem\",\"relationName\":\"EstimateItemToPriceItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Coefficient\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"conditions\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"type\",\"code\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"type\",\"code\"]}],\"isGenerated\":false},\"InflationIndex\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveFrom\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"effectiveTo\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"indexValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimates\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"chatSessions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatSession\",\"relationName\":\"ChatSessionToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownedShares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"ShareOwner\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receivedShares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"ShareReceiver\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shareNotes\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShareNote\",\"relationName\":\"EstimateShareNoteToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SurveyDirection\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shortName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimates\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToSurveyDirection\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Estimate\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"number\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"directionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"objectName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executor\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalFieldWorks\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalOfficeWorks\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalLaboratory\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subtotal\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"regionalCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"regionalCoefDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"inflationIndex\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"inflationDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyCoefDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executorCoef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"executorCoefDocRef\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"withVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalWithoutVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vatRate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vatAmount\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalWithVat\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"draft\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"owner\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"EstimateToUser\",\"relationFromFields\":[\"ownerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"direction\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SurveyDirection\",\"relationName\":\"EstimateToSurveyDirection\",\"relationFromFields\":[\"directionId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"items\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateItem\",\"relationName\":\"EstimateToEstimateItem\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totals\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateTotal\",\"relationName\":\"EstimateToEstimateTotal\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shares\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"EstimateToEstimateShare\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"versions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateVersion\",\"relationName\":\"EstimateToEstimateVersion\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateVersion\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"versionNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"snapshot\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateVersion\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateShare\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ownerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sharedWithId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateShare\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sharedWith\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ShareReceiver\",\"relationFromFields\":[\"sharedWithId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"owner\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ShareOwner\",\"relationFromFields\":[\"ownerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShareNote\",\"relationName\":\"EstimateShareToEstimateShareNote\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"estimateId\",\"sharedWithId\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"estimateId\",\"sharedWithId\"]}],\"isGenerated\":false},\"EstimateShareNote\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"shareId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"authorId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"content\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"share\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EstimateShare\",\"relationName\":\"EstimateShareToEstimateShareNote\",\"relationFromFields\":[\"shareId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"author\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"EstimateShareNoteToUser\",\"relationFromFields\":[\"authorId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateItem\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sectionType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceItemId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"workName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"justification\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"quantity\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef1\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef1Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef2\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef2Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef3\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coef3Desc\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"totalPrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateItem\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceItem\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PriceItem\",\"relationName\":\"EstimateItemToPriceItem\",\"relationFromFields\":[\"priceItemId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EstimateTotal\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"orderNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"label\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"baseValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"coefficient\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resultValue\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Decimal\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"estimate\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Estimate\",\"relationName\":\"EstimateToEstimateTotal\",\"relationFromFields\":[\"estimateId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Setting\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"key\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"string\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"category\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"label\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ChatSession\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"estimateId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"active\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"ChatSessionToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"messages\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatMessage\",\"relationName\":\"ChatMessageToChatSession\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ChatMessage\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":{\"name\":\"uuid(4)\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sessionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"content\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"metadata\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Json\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"session\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ChatSession\",\"relationName\":\"ChatMessageToChatSession\",\"relationFromFields\":[\"sessionId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{},\"types\":{}}") defineDmmfProperty(exports.Prisma, config.runtimeDataModel) config.engineWasm = undefined @@ -416,8 +427,8 @@ exports.PrismaClient = PrismaClient Object.assign(exports, Prisma) // file annotations for bundling tools to include these files -path.join(__dirname, "query_engine-windows.dll.node"); -path.join(process.cwd(), "node_modules/.prisma/client/query_engine-windows.dll.node") +path.join(__dirname, "libquery_engine-debian-openssl-3.0.x.so.node"); +path.join(process.cwd(), "node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node") // file annotations for bundling tools to include these files path.join(__dirname, "schema.prisma"); path.join(process.cwd(), "node_modules/.prisma/client/schema.prisma") diff --git a/backend/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node b/backend/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node new file mode 100755 index 00000000..827ccc83 Binary files /dev/null and b/backend/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node differ diff --git a/backend/node_modules/.prisma/client/package.json b/backend/node_modules/.prisma/client/package.json old mode 100755 new mode 100644 index 3f9312da..2a14f430 --- a/backend/node_modules/.prisma/client/package.json +++ b/backend/node_modules/.prisma/client/package.json @@ -1,5 +1,5 @@ { - "name": "prisma-client-4b58c981519ea022802510544edb111bbd4ef5e4d3b50b2269f96083d9bf4ae3", + "name": "prisma-client-aa42ad392173f3ebbcce688c9d47fd7d65145cf816fa2f07c9d3255147711e22", "main": "index.js", "types": "index.d.ts", "browser": "index-browser.js", diff --git a/backend/node_modules/.prisma/client/schema.prisma b/backend/node_modules/.prisma/client/schema.prisma index 07f0d5aa..be942f47 100755 --- a/backend/node_modules/.prisma/client/schema.prisma +++ b/backend/node_modules/.prisma/client/schema.prisma @@ -9,7 +9,7 @@ datasource db { url = env("DATABASE_URL") } -// Справочники базовых цен +// Справочники базовых цен (СБЦ) model PriceBook { id String @id @default(uuid()) code String @unique // SBC-GEODESY-2004, SBC-GEOLOGY-1999 @@ -114,8 +114,9 @@ model User { estimates Estimate[] chatSessions ChatSession[] - ownedShares EstimateShare[] @relation("ShareOwner") - receivedShares EstimateShare[] @relation("ShareReceiver") + ownedShares EstimateShare[] @relation("ShareOwner") + receivedShares EstimateShare[] @relation("ShareReceiver") + shareNotes EstimateShareNote[] } // Направления изысканий @@ -146,13 +147,17 @@ model Estimate { subtotal Decimal? @db.Decimal(14, 2) // Итого по изысканиям // Коэффициенты и пересчет - regionalCoef Decimal? @db.Decimal(6, 4) // Районный коэффициент - inflationIndex Decimal? @db.Decimal(10, 4) // Индекс перевода в текущие цены - inflationDocRef String? // Ссылка на документ с индексом - companyCoef Decimal? @db.Decimal(6, 4) // Коэффициент компании (Газпром и т.д.) - executorCoef Decimal? @db.Decimal(6, 4) // Коэффициент исполнителя + regionalCoef Decimal? @db.Decimal(6, 4) // Районный коэффициент + regionalCoefDocRef String? // Описание (С районным коэффициентом и т.д.) + inflationIndex Decimal? @db.Decimal(10, 4) // Индекс перевода в текущие цены + inflationDocRef String? // Ссылка на документ (Письмо Минстроя и т.д.) + companyCoef Decimal? @db.Decimal(6, 4) // Коэффициент компании (Газпром и т.д.) + companyCoefDocRef String? // Описание (Коэффициент ОАО «Газпром» №544 и т.д.) + executorCoef Decimal? @db.Decimal(6, 4) // Коэффициент исполнителя + executorCoefDocRef String? // Описание (Коэффициент ООО «ГеоВектор» и т.д.) // Итоги + withVat Boolean @default(true) // Смета с НДС (true) или без НДС (false) totalWithoutVat Decimal? @db.Decimal(14, 2) // Итого без НДС vatRate Decimal? @db.Decimal(4, 2) // Ставка НДС (18, 20, 7) vatAmount Decimal? @db.Decimal(14, 2) // Сумма НДС @@ -162,11 +167,26 @@ model Estimate { createdAt DateTime @default(now()) updatedAt DateTime @updatedAt - owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade) - direction SurveyDirection @relation(fields: [directionId], references: [id]) + owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade) + direction SurveyDirection @relation(fields: [directionId], references: [id]) items EstimateItem[] totals EstimateTotal[] shares EstimateShare[] + versions EstimateVersion[] +} + +// История версий сметы (снимок при сохранении/пересчёте) +model EstimateVersion { + id String @id @default(uuid()) + estimateId String + versionNumber Int // Порядковый номер версии по смете + snapshot Json // Полный снимок: estimate + items + totals + createdAt DateTime @default(now()) + + estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade) + + @@index([estimateId]) + @@index([estimateId, createdAt]) } // Шаринг сметы с другим пользователем @@ -177,14 +197,29 @@ model EstimateShare { sharedWithId String // С кем поделились createdAt DateTime @default(now()) - estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade) - sharedWith User @relation("ShareReceiver", fields: [sharedWithId], references: [id], onDelete: Cascade) - owner User @relation("ShareOwner", fields: [ownerId], references: [id], onDelete: Cascade) + estimate Estimate @relation(fields: [estimateId], references: [id], onDelete: Cascade) + sharedWith User @relation("ShareReceiver", fields: [sharedWithId], references: [id], onDelete: Cascade) + owner User @relation("ShareOwner", fields: [ownerId], references: [id], onDelete: Cascade) + notes EstimateShareNote[] @@unique([estimateId, sharedWithId]) @@index([sharedWithId]) } +// Заметки к шарингу сметы (кто что написал) +model EstimateShareNote { + id String @id @default(uuid()) + shareId String + authorId String + content String @db.Text + createdAt DateTime @default(now()) + + share EstimateShare @relation(fields: [shareId], references: [id], onDelete: Cascade) + author User @relation(fields: [authorId], references: [id], onDelete: Cascade) + + @@index([shareId]) +} + // Позиции сметы model EstimateItem { id String @id @default(uuid()) diff --git a/backend/node_modules/.prisma/client/wasm.d.ts b/backend/node_modules/.prisma/client/wasm.d.ts old mode 100755 new mode 100644 diff --git a/backend/node_modules/.prisma/client/wasm.js b/backend/node_modules/.prisma/client/wasm.js old mode 100755 new mode 100644 index f1efd3fd..9e26836c --- a/backend/node_modules/.prisma/client/wasm.js +++ b/backend/node_modules/.prisma/client/wasm.js @@ -219,10 +219,13 @@ exports.Prisma.EstimateScalarFieldEnum = { totalLaboratory: 'totalLaboratory', subtotal: 'subtotal', regionalCoef: 'regionalCoef', + regionalCoefDocRef: 'regionalCoefDocRef', inflationIndex: 'inflationIndex', inflationDocRef: 'inflationDocRef', companyCoef: 'companyCoef', + companyCoefDocRef: 'companyCoefDocRef', executorCoef: 'executorCoef', + executorCoefDocRef: 'executorCoefDocRef', withVat: 'withVat', totalWithoutVat: 'totalWithoutVat', vatRate: 'vatRate', @@ -249,6 +252,14 @@ exports.Prisma.EstimateShareScalarFieldEnum = { createdAt: 'createdAt' }; +exports.Prisma.EstimateShareNoteScalarFieldEnum = { + id: 'id', + shareId: 'shareId', + authorId: 'authorId', + content: 'content', + createdAt: 'createdAt' +}; + exports.Prisma.EstimateItemScalarFieldEnum = { id: 'id', estimateId: 'estimateId', @@ -355,6 +366,7 @@ exports.Prisma.ModelName = { Estimate: 'Estimate', EstimateVersion: 'EstimateVersion', EstimateShare: 'EstimateShare', + EstimateShareNote: 'EstimateShareNote', EstimateItem: 'EstimateItem', EstimateTotal: 'EstimateTotal', Setting: 'Setting', diff --git a/backend/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node b/backend/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node new file mode 100755 index 00000000..827ccc83 Binary files /dev/null and b/backend/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node differ diff --git a/backend/node_modules/@prisma/engines/schema-engine-debian-openssl-3.0.x b/backend/node_modules/@prisma/engines/schema-engine-debian-openssl-3.0.x new file mode 100755 index 00000000..54db7411 Binary files /dev/null and b/backend/node_modules/@prisma/engines/schema-engine-debian-openssl-3.0.x differ diff --git a/backend/node_modules/bcrypt/.editorconfig b/backend/node_modules/bcrypt/.editorconfig old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/.github/workflows/ci.yaml b/backend/node_modules/bcrypt/.github/workflows/ci.yaml old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/.travis.yml b/backend/node_modules/bcrypt/.travis.yml old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/CHANGELOG.md b/backend/node_modules/bcrypt/CHANGELOG.md old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/ISSUE_TEMPLATE.md b/backend/node_modules/bcrypt/ISSUE_TEMPLATE.md old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/LICENSE b/backend/node_modules/bcrypt/LICENSE old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/Makefile b/backend/node_modules/bcrypt/Makefile old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/README.md b/backend/node_modules/bcrypt/README.md old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/SECURITY.md b/backend/node_modules/bcrypt/SECURITY.md old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/appveyor.yml b/backend/node_modules/bcrypt/appveyor.yml old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/bcrypt.js b/backend/node_modules/bcrypt/bcrypt.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/binding.gyp b/backend/node_modules/bcrypt/binding.gyp old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/examples/async_compare.js b/backend/node_modules/bcrypt/examples/async_compare.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/examples/forever_gen_salt.js b/backend/node_modules/bcrypt/examples/forever_gen_salt.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node b/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node index ba87d282..74302aed 100755 Binary files a/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node and b/backend/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node differ diff --git a/backend/node_modules/bcrypt/package.json b/backend/node_modules/bcrypt/package.json old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/promises.js b/backend/node_modules/bcrypt/promises.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/src/bcrypt.cc b/backend/node_modules/bcrypt/src/bcrypt.cc old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/src/bcrypt_node.cc b/backend/node_modules/bcrypt/src/bcrypt_node.cc old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/src/blowfish.cc b/backend/node_modules/bcrypt/src/blowfish.cc old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/src/node_blf.h b/backend/node_modules/bcrypt/src/node_blf.h old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/test/async.test.js b/backend/node_modules/bcrypt/test/async.test.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/test/implementation.test.js b/backend/node_modules/bcrypt/test/implementation.test.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/test/promise.test.js b/backend/node_modules/bcrypt/test/promise.test.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/test/repetitions.test.js b/backend/node_modules/bcrypt/test/repetitions.test.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/bcrypt/test/sync.test.js b/backend/node_modules/bcrypt/test/sync.test.js old mode 100755 new mode 100644 diff --git a/backend/node_modules/prisma/libquery_engine-debian-openssl-3.0.x.so.node b/backend/node_modules/prisma/libquery_engine-debian-openssl-3.0.x.so.node new file mode 100755 index 00000000..827ccc83 Binary files /dev/null and b/backend/node_modules/prisma/libquery_engine-debian-openssl-3.0.x.so.node differ diff --git a/backend/package-lock.json b/backend/package-lock.json index 10be02fb..13f750da 100755 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -309,6 +309,7 @@ "integrity": "sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -377,6 +378,7 @@ "integrity": "sha512-WJtwWJu7UdlvzEAUm484QNg5eAoq5QR08KDNx7g45Usrs2NtOPiX8ugDqmKdXkyL03rBqU5dYNYVQetEpBHq2g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -2681,6 +2683,7 @@ "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@prisma/engines": "5.22.0" }, @@ -3422,6 +3425,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/backend/package.json b/backend/package.json index 922cc828..5040a989 100755 --- a/backend/package.json +++ b/backend/package.json @@ -25,12 +25,12 @@ "cors": "^2.8.5", "dotenv": "^16.4.1", "express": "^4.18.2", + "jsonwebtoken": "^9.0.2", "multer": "^1.4.5-lts.1", "pdf-lib": "^1.17.1", "pdfkit": "^0.14.0", "uuid": "^9.0.1", - "xlsx": "^0.18.5", - "jsonwebtoken": "^9.0.2" + "xlsx": "^0.18.5" }, "devDependencies": { "@types/bcrypt": "^5.0.2", diff --git a/backend/src/index.ts b/backend/src/index.ts index 02f7cc54..63f300dc 100755 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -19,8 +19,8 @@ const app = express(); const prisma = new PrismaClient(); const PORT = process.env.PORT || 5000; -// Middleware — фронт на :3500, прокси Vite тоже -app.use(cors({ origin: ['http://localhost:3500', 'http://127.0.0.1:3500'], credentials: true })); +// Middleware — CORS: разрешаем запросы с любого origin (для внутренней сети) +app.use(cors({ origin: true, credentials: true })); app.use(cookieParser()); app.use(express.json({ limit: '50mb' })); app.use(express.urlencoded({ extended: true, limit: '50mb' })); diff --git a/backend/src/services/ai.service.ts b/backend/src/services/ai.service.ts index 64861e6a..1fc74ee4 100755 --- a/backend/src/services/ai.service.ts +++ b/backend/src/services/ai.service.ts @@ -22,6 +22,8 @@ export class AIService { private iieasyModel: string; private lmstudioUrl: string; private lmstudioModel: string; + private ollamaUrl: string; + private ollamaModel: string; constructor() { this.provider = process.env.AI_PROVIDER || 'iieasy'; @@ -30,9 +32,11 @@ export class AIService { this.iieasyModel = process.env.IIEASY_MODEL || 'google/gemma-3n-e4b'; this.lmstudioUrl = process.env.LMSTUDIO_API_URL || 'http://localhost:1234/v1'; this.lmstudioModel = process.env.LMSTUDIO_MODEL || 'local-model'; + this.ollamaUrl = (process.env.OLLAMA_API_URL || 'http://localhost:11434').replace(/\/+$/, ''); + this.ollamaModel = process.env.OLLAMA_MODEL || 'gemma3n:e4b'; } - setProvider(provider: 'iieasy' | 'lmstudio') { + setProvider(provider: 'iieasy' | 'lmstudio' | 'ollama') { this.provider = provider; } @@ -45,11 +49,9 @@ export class AIService { allMessages.push(...messages); - if (this.provider === 'lmstudio') { - return this.chatLMStudio(allMessages); - } else { - return this.chatIIEasy(allMessages); - } + if (this.provider === 'ollama') return this.chatOllama(allMessages); + if (this.provider === 'lmstudio') return this.chatLMStudio(allMessages); + return this.chatIIEasy(allMessages); } private async chatIIEasy(messages: ChatMessage[]): Promise { @@ -117,6 +119,44 @@ export class AIService { } } + private async chatOllama(messages: ChatMessage[]): Promise { + // Ollama API docs: POST /api/chat { model, messages, stream:false, options:{} } + const controller = new AbortController(); + const timeout = setTimeout(() => controller.abort(), 120_000); + try { + const response = await fetch(`${this.ollamaUrl}/api/chat`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + signal: controller.signal, + body: JSON.stringify({ + model: this.ollamaModel, + messages, + stream: false, + options: { + temperature: 0.7, + num_predict: 4096, + }, + }), + }); + + if (!response.ok) { + const error = await response.text(); + throw new Error(`Ollama API error: ${response.status} - ${error}`); + } + + const data: any = await response.json(); + return { + content: data?.message?.content || '', + }; + } catch (error: any) { + const msg = error?.name === 'AbortError' ? 'timeout' : error?.message; + console.error('Ollama API error:', error); + throw new Error(`AI service error: ${msg}`); + } finally { + clearTimeout(timeout); + } + } + async extractEstimateData( text: string, previousData?: Partial<{ diff --git a/backend/src/services/pdf-python.service.ts b/backend/src/services/pdf-python.service.ts index add0e531..5ab5d687 100755 --- a/backend/src/services/pdf-python.service.ts +++ b/backend/src/services/pdf-python.service.ts @@ -88,6 +88,15 @@ function getScriptPath(): string { return candidates[0]; } +/** Python для запуска скрипта: предпочитаем venv в каталоге pdf_generator (Ubuntu 24.04). */ +function getPythonCommand(): string { + const scriptPath = getScriptPath(); + const pdfGenDir = path.dirname(scriptPath); + const venvPython = path.join(pdfGenDir, 'venv', 'bin', 'python3'); + if (fs.existsSync(venvPython)) return venvPython; + return process.platform === 'win32' ? 'python' : 'python3'; +} + /** * Сгенерировать PDF сметы через Python (ReportLab, кириллица). * При ошибке возвращает null — тогда используется Node (PDFKit). @@ -113,7 +122,7 @@ export async function generateEstimatePdfWithPython(estimate: any): Promise { diff --git a/frontend/node_modules/.package-lock.json b/frontend/node_modules/.package-lock.json index c5f24d58..43ac3b9b 100755 --- a/frontend/node_modules/.package-lock.json +++ b/frontend/node_modules/.package-lock.json @@ -48,6 +48,7 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -299,10 +300,10 @@ "node": ">=6.9.0" } }, - "node_modules/@esbuild/win32-x64": { + "node_modules/@esbuild/linux-x64": { "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", "cpu": [ "x64" ], @@ -310,7 +311,7 @@ "license": "MIT", "optional": true, "os": [ - "win32" + "linux" ], "engines": { "node": ">=12" @@ -404,6 +405,15 @@ "node": ">= 8" } }, + "node_modules/@remix-run/router": { + "version": "1.23.2", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.2.tgz", + "integrity": "sha512-Ic6m2U/rMjTkhERIa/0ZtXJP17QUi2CbWE7cqx4J58M8aA3QTfW+2UlQ4psvTX9IO1RfNVhK3pcpdjej7L+t2w==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@rolldown/pluginutils": { "version": "1.0.0-beta.27", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", @@ -411,10 +421,10 @@ "dev": true, "license": "MIT" }, - "node_modules/@rollup/rollup-win32-x64-gnu": { + "node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.1.tgz", - "integrity": "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.1.tgz", + "integrity": "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==", "cpu": [ "x64" ], @@ -422,13 +432,13 @@ "license": "MIT", "optional": true, "os": [ - "win32" + "linux" ] }, - "node_modules/@rollup/rollup-win32-x64-msvc": { + "node_modules/@rollup/rollup-linux-x64-musl": { "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.1.tgz", - "integrity": "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.1.tgz", + "integrity": "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==", "cpu": [ "x64" ], @@ -436,7 +446,7 @@ "license": "MIT", "optional": true, "os": [ - "win32" + "linux" ] }, "node_modules/@types/babel__core": { @@ -504,6 +514,7 @@ "integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/prop-types": "*", "csstype": "^3.2.2" @@ -661,6 +672,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -936,6 +948,16 @@ "url": "https://github.com/sponsors/rawify" } }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -959,6 +981,19 @@ "node": ">=10.13.0" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -972,6 +1007,22 @@ "node": ">=8" } }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1011,6 +1062,7 @@ "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "dev": true, "license": "MIT", + "peer": true, "bin": { "jiti": "bin/jiti.js" } @@ -1197,6 +1249,13 @@ "node": ">= 6" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -1257,6 +1316,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -1426,6 +1486,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -1438,6 +1499,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -1456,6 +1518,38 @@ "node": ">=0.10.0" } }, + "node_modules/react-router": { + "version": "6.30.3", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.3.tgz", + "integrity": "sha512-XRnlbKMTmktBkjCLE8/XcZFlnHvr2Ltdr1eJX4idL55/9BbORzyZEaIkBFDhFGCEWBBItsVrDxwx3gnisMitdw==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.23.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.30.3", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.3.tgz", + "integrity": "sha512-pxPcv1AczD4vso7G4Z3TKcvlxK7g7TNt3/FNGMhfqyntocvYKj+GCatfigGDjbLozC4baguJ0ReCigoDJXb0ag==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.23.2", + "react-router": "6.30.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -1743,6 +1837,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -1828,6 +1923,7 @@ "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", diff --git a/frontend/node_modules/.vite/deps/_metadata.json b/frontend/node_modules/.vite/deps/_metadata.json old mode 100755 new mode 100644 index b67b88ed..3dccb867 --- a/frontend/node_modules/.vite/deps/_metadata.json +++ b/frontend/node_modules/.vite/deps/_metadata.json @@ -1,49 +1,49 @@ { - "hash": "c1bbfbdd", - "configHash": "4a35db48", - "lockfileHash": "c802426c", - "browserHash": "d470bdcf", + "hash": "5ea83bb3", + "configHash": "a2aedfee", + "lockfileHash": "d6030971", + "browserHash": "d90fac4b", "optimized": { "react": { "src": "../../react/index.js", "file": "react.js", - "fileHash": "4708aafc", + "fileHash": "9d34d1a6", "needsInterop": true }, "react-dom": { "src": "../../react-dom/index.js", "file": "react-dom.js", - "fileHash": "3f02e152", + "fileHash": "0fc1ade4", "needsInterop": true }, "react/jsx-dev-runtime": { "src": "../../react/jsx-dev-runtime.js", "file": "react_jsx-dev-runtime.js", - "fileHash": "1e3133f9", + "fileHash": "c1765a80", "needsInterop": true }, "react/jsx-runtime": { "src": "../../react/jsx-runtime.js", "file": "react_jsx-runtime.js", - "fileHash": "fb9b101d", + "fileHash": "5ac499cf", "needsInterop": true }, "lucide-react": { "src": "../../lucide-react/dist/esm/lucide-react.js", "file": "lucide-react.js", - "fileHash": "c7552fe5", + "fileHash": "50beb2bb", "needsInterop": false }, "react-dom/client": { "src": "../../react-dom/client.js", "file": "react-dom_client.js", - "fileHash": "b5517757", + "fileHash": "27671ab9", "needsInterop": true }, "react-router-dom": { - "src": "../../../../node_modules/react-router-dom/dist/index.mjs", + "src": "../../react-router-dom/dist/index.js", "file": "react-router-dom.js", - "fileHash": "d740f0c2", + "fileHash": "bc33182c", "needsInterop": false } }, diff --git a/frontend/node_modules/.vite/deps/chunk-2YIMICFJ.js b/frontend/node_modules/.vite/deps/chunk-2YIMICFJ.js old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/chunk-2YIMICFJ.js.map b/frontend/node_modules/.vite/deps/chunk-2YIMICFJ.js.map old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/chunk-BCXODTBQ.js b/frontend/node_modules/.vite/deps/chunk-BCXODTBQ.js old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/chunk-BCXODTBQ.js.map b/frontend/node_modules/.vite/deps/chunk-BCXODTBQ.js.map old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/lucide-react.js b/frontend/node_modules/.vite/deps/lucide-react.js old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/lucide-react.js.map b/frontend/node_modules/.vite/deps/lucide-react.js.map old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/package.json b/frontend/node_modules/.vite/deps/package.json old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/react-dom.js b/frontend/node_modules/.vite/deps/react-dom.js old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/react-dom.js.map b/frontend/node_modules/.vite/deps/react-dom.js.map old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/react-dom_client.js b/frontend/node_modules/.vite/deps/react-dom_client.js old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/react-dom_client.js.map b/frontend/node_modules/.vite/deps/react-dom_client.js.map old mode 100755 new mode 100644 diff --git a/frontend/node_modules/.vite/deps/react-router-dom.js b/frontend/node_modules/.vite/deps/react-router-dom.js old mode 100755 new mode 100644 index 544274ff..03348e57 --- a/frontend/node_modules/.vite/deps/react-router-dom.js +++ b/frontend/node_modules/.vite/deps/react-router-dom.js @@ -2,482 +2,52 @@ import { require_react_dom } from "./chunk-BCXODTBQ.js"; import { - __commonJS, __toESM, require_react } from "./chunk-2YIMICFJ.js"; -// ../node_modules/cookie/dist/index.js -var require_dist = __commonJS({ - "../node_modules/cookie/dist/index.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.parseCookie = parseCookie; - exports.parse = parseCookie; - exports.stringifyCookie = stringifyCookie; - exports.stringifySetCookie = stringifySetCookie; - exports.serialize = stringifySetCookie; - exports.parseSetCookie = parseSetCookie; - exports.stringifySetCookie = stringifySetCookie; - exports.serialize = stringifySetCookie; - var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/; - var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/; - var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i; - var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/; - var maxAgeRegExp = /^-?\d+$/; - var __toString = Object.prototype.toString; - var NullObject = (() => { - const C = function() { - }; - C.prototype = /* @__PURE__ */ Object.create(null); - return C; - })(); - function parseCookie(str, options) { - const obj = new NullObject(); - const len = str.length; - if (len < 2) - return obj; - const dec = (options == null ? void 0 : options.decode) || decode2; - let index = 0; - do { - const eqIdx = eqIndex(str, index, len); - if (eqIdx === -1) - break; - const endIdx = endIndex(str, index, len); - if (eqIdx > endIdx) { - index = str.lastIndexOf(";", eqIdx - 1) + 1; - continue; - } - const key = valueSlice(str, index, eqIdx); - if (obj[key] === void 0) { - obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx)); - } - index = endIdx + 1; - } while (index < len); - return obj; - } - function stringifyCookie(cookie, options) { - const enc = (options == null ? void 0 : options.encode) || encodeURIComponent; - const cookieStrings = []; - for (const name of Object.keys(cookie)) { - const val = cookie[name]; - if (val === void 0) - continue; - if (!cookieNameRegExp.test(name)) { - throw new TypeError(`cookie name is invalid: ${name}`); - } - const value = enc(val); - if (!cookieValueRegExp.test(value)) { - throw new TypeError(`cookie val is invalid: ${val}`); - } - cookieStrings.push(`${name}=${value}`); - } - return cookieStrings.join("; "); - } - function stringifySetCookie(_name, _val, _opts) { - const cookie = typeof _name === "object" ? _name : { ..._opts, name: _name, value: String(_val) }; - const options = typeof _val === "object" ? _val : _opts; - const enc = (options == null ? void 0 : options.encode) || encodeURIComponent; - if (!cookieNameRegExp.test(cookie.name)) { - throw new TypeError(`argument name is invalid: ${cookie.name}`); - } - const value = cookie.value ? enc(cookie.value) : ""; - if (!cookieValueRegExp.test(value)) { - throw new TypeError(`argument val is invalid: ${cookie.value}`); - } - let str = cookie.name + "=" + value; - if (cookie.maxAge !== void 0) { - if (!Number.isInteger(cookie.maxAge)) { - throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`); - } - str += "; Max-Age=" + cookie.maxAge; - } - if (cookie.domain) { - if (!domainValueRegExp.test(cookie.domain)) { - throw new TypeError(`option domain is invalid: ${cookie.domain}`); - } - str += "; Domain=" + cookie.domain; - } - if (cookie.path) { - if (!pathValueRegExp.test(cookie.path)) { - throw new TypeError(`option path is invalid: ${cookie.path}`); - } - str += "; Path=" + cookie.path; - } - if (cookie.expires) { - if (!isDate(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) { - throw new TypeError(`option expires is invalid: ${cookie.expires}`); - } - str += "; Expires=" + cookie.expires.toUTCString(); - } - if (cookie.httpOnly) { - str += "; HttpOnly"; - } - if (cookie.secure) { - str += "; Secure"; - } - if (cookie.partitioned) { - str += "; Partitioned"; - } - if (cookie.priority) { - const priority = typeof cookie.priority === "string" ? cookie.priority.toLowerCase() : void 0; - switch (priority) { - case "low": - str += "; Priority=Low"; - break; - case "medium": - str += "; Priority=Medium"; - break; - case "high": - str += "; Priority=High"; - break; - default: - throw new TypeError(`option priority is invalid: ${cookie.priority}`); - } - } - if (cookie.sameSite) { - const sameSite = typeof cookie.sameSite === "string" ? cookie.sameSite.toLowerCase() : cookie.sameSite; - switch (sameSite) { - case true: - case "strict": - str += "; SameSite=Strict"; - break; - case "lax": - str += "; SameSite=Lax"; - break; - case "none": - str += "; SameSite=None"; - break; - default: - throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`); - } - } - return str; - } - function parseSetCookie(str, options) { - const dec = (options == null ? void 0 : options.decode) || decode2; - const len = str.length; - const endIdx = endIndex(str, 0, len); - const eqIdx = eqIndex(str, 0, endIdx); - const setCookie = eqIdx === -1 ? { name: "", value: dec(valueSlice(str, 0, endIdx)) } : { - name: valueSlice(str, 0, eqIdx), - value: dec(valueSlice(str, eqIdx + 1, endIdx)) - }; - let index = endIdx + 1; - while (index < len) { - const endIdx2 = endIndex(str, index, len); - const eqIdx2 = eqIndex(str, index, endIdx2); - const attr = eqIdx2 === -1 ? valueSlice(str, index, endIdx2) : valueSlice(str, index, eqIdx2); - const val = eqIdx2 === -1 ? void 0 : valueSlice(str, eqIdx2 + 1, endIdx2); - switch (attr.toLowerCase()) { - case "httponly": - setCookie.httpOnly = true; - break; - case "secure": - setCookie.secure = true; - break; - case "partitioned": - setCookie.partitioned = true; - break; - case "domain": - setCookie.domain = val; - break; - case "path": - setCookie.path = val; - break; - case "max-age": - if (val && maxAgeRegExp.test(val)) - setCookie.maxAge = Number(val); - break; - case "expires": - if (!val) - break; - const date = new Date(val); - if (Number.isFinite(date.valueOf())) - setCookie.expires = date; - break; - case "priority": - if (!val) - break; - const priority = val.toLowerCase(); - if (priority === "low" || priority === "medium" || priority === "high") { - setCookie.priority = priority; - } - break; - case "samesite": - if (!val) - break; - const sameSite = val.toLowerCase(); - if (sameSite === "lax" || sameSite === "strict" || sameSite === "none") { - setCookie.sameSite = sameSite; - } - break; - } - index = endIdx2 + 1; - } - return setCookie; - } - function endIndex(str, min, len) { - const index = str.indexOf(";", min); - return index === -1 ? len : index; - } - function eqIndex(str, min, max) { - const index = str.indexOf("=", min); - return index < max ? index : -1; - } - function valueSlice(str, min, max) { - let start = min; - let end = max; - do { - const code = str.charCodeAt(start); - if (code !== 32 && code !== 9) - break; - } while (++start < end); - while (end > start) { - const code = str.charCodeAt(end - 1); - if (code !== 32 && code !== 9) - break; - end--; - } - return str.slice(start, end); - } - function decode2(str) { - if (str.indexOf("%") === -1) - return str; - try { - return decodeURIComponent(str); - } catch (e) { - return str; - } - } - function isDate(val) { - return __toString.call(val) === "[object Date]"; - } - } -}); +// node_modules/react-router-dom/dist/index.js +var React2 = __toESM(require_react()); +var ReactDOM = __toESM(require_react_dom()); -// ../node_modules/set-cookie-parser/lib/set-cookie.js -var require_set_cookie = __commonJS({ - "../node_modules/set-cookie-parser/lib/set-cookie.js"(exports, module) { - "use strict"; - var defaultParseOptions = { - decodeValues: true, - map: false, - silent: false - }; - function isForbiddenKey(key) { - return typeof key !== "string" || key in {}; - } - function createNullObj() { - return /* @__PURE__ */ Object.create(null); - } - function isNonEmptyString(str) { - return typeof str === "string" && !!str.trim(); - } - function parseString(setCookieValue, options) { - var parts = setCookieValue.split(";").filter(isNonEmptyString); - var nameValuePairStr = parts.shift(); - var parsed = parseNameValuePair(nameValuePairStr); - var name = parsed.name; - var value = parsed.value; - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - if (isForbiddenKey(name)) { - return null; - } - try { - value = options.decodeValues ? decodeURIComponent(value) : value; - } catch (e) { - console.error( - "set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.", - e - ); - } - var cookie = createNullObj(); - cookie.name = name; - cookie.value = value; - parts.forEach(function(part) { - var sides = part.split("="); - var key = sides.shift().trimLeft().toLowerCase(); - if (isForbiddenKey(key)) { - return; - } - var value2 = sides.join("="); - if (key === "expires") { - cookie.expires = new Date(value2); - } else if (key === "max-age") { - var n = parseInt(value2, 10); - if (!Number.isNaN(n)) cookie.maxAge = n; - } else if (key === "secure") { - cookie.secure = true; - } else if (key === "httponly") { - cookie.httpOnly = true; - } else if (key === "samesite") { - cookie.sameSite = value2; - } else if (key === "partitioned") { - cookie.partitioned = true; - } else if (key) { - cookie[key] = value2; - } - }); - return cookie; - } - function parseNameValuePair(nameValuePairStr) { - var name = ""; - var value = ""; - var nameValueArr = nameValuePairStr.split("="); - if (nameValueArr.length > 1) { - name = nameValueArr.shift(); - value = nameValueArr.join("="); - } else { - value = nameValuePairStr; - } - return { name, value }; - } - function parse2(input, options) { - options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions; - if (!input) { - if (!options.map) { - return []; - } else { - return createNullObj(); - } - } - if (input.headers) { - if (typeof input.headers.getSetCookie === "function") { - input = input.headers.getSetCookie(); - } else if (input.headers["set-cookie"]) { - input = input.headers["set-cookie"]; - } else { - var sch = input.headers[Object.keys(input.headers).find(function(key) { - return key.toLowerCase() === "set-cookie"; - })]; - if (!sch && input.headers.cookie && !options.silent) { - console.warn( - "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning." - ); - } - input = sch; - } - } - if (!Array.isArray(input)) { - input = [input]; - } - if (!options.map) { - return input.filter(isNonEmptyString).map(function(str) { - return parseString(str, options); - }).filter(Boolean); - } else { - var cookies = createNullObj(); - return input.filter(isNonEmptyString).reduce(function(cookies2, str) { - var cookie = parseString(str, options); - if (cookie && !isForbiddenKey(cookie.name)) { - cookies2[cookie.name] = cookie; - } - return cookies2; - }, cookies); - } - } - function splitCookiesString2(cookiesString) { - if (Array.isArray(cookiesString)) { - return cookiesString; - } - if (typeof cookiesString !== "string") { - return []; - } - var cookiesStrings = []; - var pos = 0; - var start; - var ch; - var lastComma; - var nextStart; - var cookiesSeparatorFound; - function skipWhitespace() { - while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) { - pos += 1; - } - return pos < cookiesString.length; - } - function notSpecialChar() { - ch = cookiesString.charAt(pos); - return ch !== "=" && ch !== ";" && ch !== ","; - } - while (pos < cookiesString.length) { - start = pos; - cookiesSeparatorFound = false; - while (skipWhitespace()) { - ch = cookiesString.charAt(pos); - if (ch === ",") { - lastComma = pos; - pos += 1; - skipWhitespace(); - nextStart = pos; - while (pos < cookiesString.length && notSpecialChar()) { - pos += 1; - } - if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") { - cookiesSeparatorFound = true; - pos = nextStart; - cookiesStrings.push(cookiesString.substring(start, lastComma)); - start = pos; - } else { - pos = lastComma + 1; - } - } else { - pos += 1; - } - } - if (!cookiesSeparatorFound || pos >= cookiesString.length) { - cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); - } - } - return cookiesStrings; - } - module.exports = parse2; - module.exports.parse = parse2; - module.exports.parseString = parseString; - module.exports.splitCookiesString = splitCookiesString2; - } -}); +// node_modules/react-router/dist/index.js +var React = __toESM(require_react()); -// ../node_modules/react-router/dist/development/chunk-JZWAC4HX.mjs -var React = __toESM(require_react(), 1); -var React2 = __toESM(require_react(), 1); -var React3 = __toESM(require_react(), 1); -var React4 = __toESM(require_react(), 1); -var React9 = __toESM(require_react(), 1); -var React8 = __toESM(require_react(), 1); -var React7 = __toESM(require_react(), 1); -var React6 = __toESM(require_react(), 1); -var React5 = __toESM(require_react(), 1); -var React10 = __toESM(require_react(), 1); -var React11 = __toESM(require_react(), 1); -var __typeError = (msg) => { - throw TypeError(msg); -}; -var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); -var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); -var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); -var Action = ((Action2) => { +// node_modules/@remix-run/router/dist/router.js +function _extends() { + _extends = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); +} +var Action; +(function(Action2) { Action2["Pop"] = "POP"; Action2["Push"] = "PUSH"; Action2["Replace"] = "REPLACE"; - return Action2; -})(Action || {}); +})(Action || (Action = {})); var PopStateEventType = "popstate"; -function createMemoryHistory(options = {}) { - let { initialEntries = ["/"], initialIndex, v5Compat = false } = options; +function createMemoryHistory(options) { + if (options === void 0) { + options = {}; + } + let { + initialEntries = ["/"], + initialIndex, + v5Compat = false + } = options; let entries; - entries = initialEntries.map( - (entry, index2) => createMemoryLocation( - entry, - typeof entry === "string" ? null : entry.state, - index2 === 0 ? "default" : void 0 - ) - ); - let index = clampIndex( - initialIndex == null ? entries.length - 1 : initialIndex - ); - let action = "POP"; + entries = initialEntries.map((entry, index2) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index2 === 0 ? "default" : void 0)); + let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex); + let action = Action.Pop; let listener = null; function clampIndex(n) { return Math.min(Math.max(n, 0), entries.length - 1); @@ -485,22 +55,15 @@ function createMemoryHistory(options = {}) { function getCurrentLocation() { return entries[index]; } - function createMemoryLocation(to, state = null, key) { - let location2 = createLocation( - entries ? getCurrentLocation().pathname : "/", - to, - state, - key - ); - warning( - location2.pathname.charAt(0) === "/", - `relative pathnames are not supported in memory history: ${JSON.stringify( - to - )}` - ); - return location2; + function createMemoryLocation(to, state, key) { + if (state === void 0) { + state = null; + } + let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key); + warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(to)); + return location; } - function createHref2(to) { + function createHref(to) { return typeof to === "string" ? to : createPath(to); } let history = { @@ -513,9 +76,9 @@ function createMemoryHistory(options = {}) { get location() { return getCurrentLocation(); }, - createHref: createHref2, + createHref, createURL(to) { - return new URL(createHref2(to), "http://localhost"); + return new URL(createHref(to), "http://localhost"); }, encodeLocation(to) { let path = typeof to === "string" ? parsePath(to) : to; @@ -526,29 +89,41 @@ function createMemoryHistory(options = {}) { }; }, push(to, state) { - action = "PUSH"; + action = Action.Push; let nextLocation = createMemoryLocation(to, state); index += 1; entries.splice(index, entries.length, nextLocation); if (v5Compat && listener) { - listener({ action, location: nextLocation, delta: 1 }); + listener({ + action, + location: nextLocation, + delta: 1 + }); } }, replace(to, state) { - action = "REPLACE"; + action = Action.Replace; let nextLocation = createMemoryLocation(to, state); entries[index] = nextLocation; if (v5Compat && listener) { - listener({ action, location: nextLocation, delta: 0 }); + listener({ + action, + location: nextLocation, + delta: 0 + }); } }, go(delta) { - action = "POP"; + action = Action.Pop; let nextIndex = clampIndex(index + delta); let nextLocation = entries[nextIndex]; index = nextIndex; if (listener) { - listener({ action, location: nextLocation, delta }); + listener({ + action, + location: nextLocation, + delta + }); } }, listen(fn) { @@ -560,12 +135,23 @@ function createMemoryHistory(options = {}) { }; return history; } -function createBrowserHistory(options = {}) { +function createBrowserHistory(options) { + if (options === void 0) { + options = {}; + } function createBrowserLocation(window2, globalHistory) { - let { pathname, search, hash } = window2.location; + let { + pathname, + search, + hash + } = window2.location; return createLocation( "", - { pathname, search, hash }, + { + pathname, + search, + hash + }, // state defaults to `null` because `window.history.state` does globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default" @@ -574,26 +160,28 @@ function createBrowserHistory(options = {}) { function createBrowserHref(window2, to) { return typeof to === "string" ? to : createPath(to); } - return getUrlBasedHistory( - createBrowserLocation, - createBrowserHref, - null, - options - ); + return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options); } -function createHashHistory(options = {}) { +function createHashHistory(options) { + if (options === void 0) { + options = {}; + } function createHashLocation(window2, globalHistory) { let { pathname = "/", search = "", hash = "" - } = parsePath(window2.location.hash.substring(1)); + } = parsePath(window2.location.hash.substr(1)); if (!pathname.startsWith("/") && !pathname.startsWith(".")) { pathname = "/" + pathname; } return createLocation( "", - { pathname, search, hash }, + { + pathname, + search, + hash + }, // state defaults to `null` because `window.history.state` does globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default" @@ -601,28 +189,18 @@ function createHashHistory(options = {}) { } function createHashHref(window2, to) { let base = window2.document.querySelector("base"); - let href2 = ""; + let href = ""; if (base && base.getAttribute("href")) { let url = window2.location.href; let hashIndex = url.indexOf("#"); - href2 = hashIndex === -1 ? url : url.slice(0, hashIndex); + href = hashIndex === -1 ? url : url.slice(0, hashIndex); } - return href2 + "#" + (typeof to === "string" ? to : createPath(to)); + return href + "#" + (typeof to === "string" ? to : createPath(to)); } - function validateHashLocation(location2, to) { - warning( - location2.pathname.charAt(0) === "/", - `relative pathnames are not supported in hash history.push(${JSON.stringify( - to - )})` - ); + function validateHashLocation(location, to) { + warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in hash history.push(" + JSON.stringify(to) + ")"); } - return getUrlBasedHistory( - createHashLocation, - createHashHref, - validateHashLocation, - options - ); + return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options); } function invariant(value, message) { if (value === false || value === null || typeof value === "undefined") { @@ -639,39 +217,41 @@ function warning(cond, message) { } } function createKey() { - return Math.random().toString(36).substring(2, 10); + return Math.random().toString(36).substr(2, 8); } -function getHistoryState(location2, index) { +function getHistoryState(location, index) { return { - usr: location2.state, - key: location2.key, + usr: location.state, + key: location.key, idx: index }; } -function createLocation(current, to, state = null, key) { - let location2 = { +function createLocation(current, to, state, key) { + if (state === void 0) { + state = null; + } + let location = _extends({ pathname: typeof current === "string" ? current : current.pathname, search: "", - hash: "", - ...typeof to === "string" ? parsePath(to) : to, + hash: "" + }, typeof to === "string" ? parsePath(to) : to, { state, // TODO: This could be cleaned up. push/replace should probably just take // full Locations now and avoid the need to run through this flow at all // But that's a pretty big refactor to the current test suite so going to // keep as is for the time being and just let any incoming keys take precedence key: to && to.key || key || createKey() - }; - return location2; + }); + return location; } -function createPath({ - pathname = "/", - search = "", - hash = "" -}) { - if (search && search !== "?") - pathname += search.charAt(0) === "?" ? search : "?" + search; - if (hash && hash !== "#") - pathname += hash.charAt(0) === "#" ? hash : "#" + hash; +function createPath(_ref) { + let { + pathname = "/", + search = "", + hash = "" + } = _ref; + if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search; + if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash; return pathname; } function parsePath(path) { @@ -679,13 +259,13 @@ function parsePath(path) { if (path) { let hashIndex = path.indexOf("#"); if (hashIndex >= 0) { - parsedPath.hash = path.substring(hashIndex); - path = path.substring(0, hashIndex); + parsedPath.hash = path.substr(hashIndex); + path = path.substr(0, hashIndex); } let searchIndex = path.indexOf("?"); if (searchIndex >= 0) { - parsedPath.search = path.substring(searchIndex); - path = path.substring(0, searchIndex); + parsedPath.search = path.substr(searchIndex); + path = path.substr(0, searchIndex); } if (path) { parsedPath.pathname = path; @@ -693,36 +273,50 @@ function parsePath(path) { } return parsedPath; } -function getUrlBasedHistory(getLocation, createHref2, validateLocation, options = {}) { - let { window: window2 = document.defaultView, v5Compat = false } = options; +function getUrlBasedHistory(getLocation, createHref, validateLocation, options) { + if (options === void 0) { + options = {}; + } + let { + window: window2 = document.defaultView, + v5Compat = false + } = options; let globalHistory = window2.history; - let action = "POP"; + let action = Action.Pop; let listener = null; let index = getIndex(); if (index == null) { index = 0; - globalHistory.replaceState({ ...globalHistory.state, idx: index }, ""); + globalHistory.replaceState(_extends({}, globalHistory.state, { + idx: index + }), ""); } function getIndex() { - let state = globalHistory.state || { idx: null }; + let state = globalHistory.state || { + idx: null + }; return state.idx; } function handlePop() { - action = "POP"; + action = Action.Pop; let nextIndex = getIndex(); let delta = nextIndex == null ? null : nextIndex - index; index = nextIndex; if (listener) { - listener({ action, location: history.location, delta }); + listener({ + action, + location: history.location, + delta + }); } } function push(to, state) { - action = "PUSH"; - let location2 = createLocation(history.location, to, state); - if (validateLocation) validateLocation(location2, to); + action = Action.Push; + let location = createLocation(history.location, to, state); + if (validateLocation) validateLocation(location, to); index = getIndex() + 1; - let historyState = getHistoryState(location2, index); - let url = history.createHref(location2); + let historyState = getHistoryState(location, index); + let url = history.createHref(location); try { globalHistory.pushState(historyState, "", url); } catch (error) { @@ -732,23 +326,35 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options window2.location.assign(url); } if (v5Compat && listener) { - listener({ action, location: history.location, delta: 1 }); + listener({ + action, + location: history.location, + delta: 1 + }); } } function replace2(to, state) { - action = "REPLACE"; - let location2 = createLocation(history.location, to, state); - if (validateLocation) validateLocation(location2, to); + action = Action.Replace; + let location = createLocation(history.location, to, state); + if (validateLocation) validateLocation(location, to); index = getIndex(); - let historyState = getHistoryState(location2, index); - let url = history.createHref(location2); + let historyState = getHistoryState(location, index); + let url = history.createHref(location); globalHistory.replaceState(historyState, "", url); if (v5Compat && listener) { - listener({ action, location: history.location, delta: 0 }); + listener({ + action, + location: history.location, + delta: 0 + }); } } function createURL(to) { - return createBrowserURLImpl(to); + let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href; + let href = typeof to === "string" ? to : createPath(to); + href = href.replace(/ $/, "%20"); + invariant(base, "No window.location.(origin|href) available to create URL for href: " + href); + return new URL(href, base); } let history = { get action() { @@ -769,7 +375,7 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options }; }, createHref(to) { - return createHref2(window2, to); + return createHref(window2, to); }, createURL, encodeLocation(to) { @@ -788,158 +394,57 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options }; return history; } -function createBrowserURLImpl(to, isAbsolute = false) { - let base = "http://localhost"; - if (typeof window !== "undefined") { - base = window.location.origin !== "null" ? window.location.origin : window.location.href; - } - invariant(base, "No window.location.(origin|href) available to create URL"); - let href2 = typeof to === "string" ? to : createPath(to); - href2 = href2.replace(/ $/, "%20"); - if (!isAbsolute && href2.startsWith("//")) { - href2 = base + href2; - } - return new URL(href2, base); -} -function createContext4(defaultValue) { - return { defaultValue }; -} -var _map; -var RouterContextProvider = class { - /** - * Create a new `RouterContextProvider` instance - * @param init An optional initial context map to populate the provider with - */ - constructor(init) { - __privateAdd(this, _map, /* @__PURE__ */ new Map()); - if (init) { - for (let [context, value] of init) { - this.set(context, value); - } - } - } - /** - * Access a value from the context. If no value has been set for the context, - * it will return the context's `defaultValue` if provided, or throw an error - * if no `defaultValue` was set. - * @param context The context to get the value for - * @returns The value for the context, or the context's `defaultValue` if no - * value was set - */ - get(context) { - if (__privateGet(this, _map).has(context)) { - return __privateGet(this, _map).get(context); - } - if (context.defaultValue !== void 0) { - return context.defaultValue; - } - throw new Error("No value found for context"); - } - /** - * Set a value for the context. If the context already has a value set, this - * will overwrite it. - * - * @param context The context to set the value for - * @param value The value to set for the context - * @returns {void} - */ - set(context, value) { - __privateGet(this, _map).set(context, value); - } -}; -_map = /* @__PURE__ */ new WeakMap(); -var unsupportedLazyRouteObjectKeys = /* @__PURE__ */ new Set([ - "lazy", - "caseSensitive", - "path", - "id", - "index", - "children" -]); -function isUnsupportedLazyRouteObjectKey(key) { - return unsupportedLazyRouteObjectKeys.has( - key - ); -} -var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([ - "lazy", - "caseSensitive", - "path", - "id", - "index", - "middleware", - "children" -]); -function isUnsupportedLazyRouteFunctionKey(key) { - return unsupportedLazyRouteFunctionKeys.has( - key - ); -} +var ResultType; +(function(ResultType2) { + ResultType2["data"] = "data"; + ResultType2["deferred"] = "deferred"; + ResultType2["redirect"] = "redirect"; + ResultType2["error"] = "error"; +})(ResultType || (ResultType = {})); +var immutableRouteKeys = /* @__PURE__ */ new Set(["lazy", "caseSensitive", "path", "id", "index", "children"]); function isIndexRoute(route) { return route.index === true; } -function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [], manifest = {}, allowInPlaceMutations = false) { +function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath, manifest) { + if (parentPath === void 0) { + parentPath = []; + } + if (manifest === void 0) { + manifest = {}; + } return routes.map((route, index) => { let treePath = [...parentPath, String(index)]; let id = typeof route.id === "string" ? route.id : treePath.join("-"); - invariant( - route.index !== true || !route.children, - `Cannot specify children on an index route` - ); - invariant( - allowInPlaceMutations || !manifest[id], - `Found a route id collision on id "${id}". Route id's must be globally unique within Data Router usages` - ); + invariant(route.index !== true || !route.children, "Cannot specify children on an index route"); + invariant(!manifest[id], 'Found a route id collision on id "' + id + `". Route id's must be globally unique within Data Router usages`); if (isIndexRoute(route)) { - let indexRoute = { - ...route, + let indexRoute = _extends({}, route, mapRouteProperties2(route), { id - }; - manifest[id] = mergeRouteUpdates( - indexRoute, - mapRouteProperties2(indexRoute) - ); + }); + manifest[id] = indexRoute; return indexRoute; } else { - let pathOrLayoutRoute = { - ...route, + let pathOrLayoutRoute = _extends({}, route, mapRouteProperties2(route), { id, children: void 0 - }; - manifest[id] = mergeRouteUpdates( - pathOrLayoutRoute, - mapRouteProperties2(pathOrLayoutRoute) - ); + }); + manifest[id] = pathOrLayoutRoute; if (route.children) { - pathOrLayoutRoute.children = convertRoutesToDataRoutes( - route.children, - mapRouteProperties2, - treePath, - manifest, - allowInPlaceMutations - ); + pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties2, treePath, manifest); } return pathOrLayoutRoute; } }); } -function mergeRouteUpdates(route, updates) { - return Object.assign(route, { - ...updates, - ...typeof updates.lazy === "object" && updates.lazy != null ? { - lazy: { - ...route.lazy, - ...updates.lazy - } - } : {} - }); -} -function matchRoutes(routes, locationArg, basename = "/") { +function matchRoutes(routes, locationArg, basename) { + if (basename === void 0) { + basename = "/"; + } return matchRoutesImpl(routes, locationArg, basename, false); } function matchRoutesImpl(routes, locationArg, basename, allowPartial) { - let location2 = typeof locationArg === "string" ? parsePath(locationArg) : locationArg; - let pathname = stripBasename(location2.pathname || "/", basename); + let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg; + let pathname = stripBasename(location.pathname || "/", basename); if (pathname == null) { return null; } @@ -948,27 +453,35 @@ function matchRoutesImpl(routes, locationArg, basename, allowPartial) { let matches = null; for (let i = 0; matches == null && i < branches.length; ++i) { let decoded = decodePath(pathname); - matches = matchRouteBranch( - branches[i], - decoded, - allowPartial - ); + matches = matchRouteBranch(branches[i], decoded, allowPartial); } return matches; } function convertRouteMatchToUiMatch(match, loaderData) { - let { route, pathname, params } = match; + let { + route, + pathname, + params + } = match; return { id: route.id, pathname, params, data: loaderData[route.id], - loaderData: loaderData[route.id], handle: route.handle }; } -function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) { - let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => { +function flattenRoutes(routes, branches, parentsMeta, parentPath) { + if (branches === void 0) { + branches = []; + } + if (parentsMeta === void 0) { + parentsMeta = []; + } + if (parentPath === void 0) { + parentPath = ""; + } + let flattenRoute = (route, index, relativePath) => { let meta = { relativePath: relativePath === void 0 ? route.path || "" : relativePath, caseSensitive: route.caseSensitive === true, @@ -976,13 +489,7 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", route }; if (meta.relativePath.startsWith("/")) { - if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) { - return; - } - invariant( - meta.relativePath.startsWith(parentPath), - `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.` - ); + invariant(meta.relativePath.startsWith(parentPath), 'Absolute route path "' + meta.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes."); meta.relativePath = meta.relativePath.slice(parentPath.length); } let path = joinPaths([parentPath, meta.relativePath]); @@ -992,15 +499,9 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", // Our types know better, but runtime JS may not! // @ts-expect-error route.index !== true, - `Index routes must not have child routes. Please remove all child routes from route path "${path}".` - ); - flattenRoutes( - route.children, - branches, - routesMeta, - path, - hasParentOptionalSegments + "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path + '".') ); + flattenRoutes(route.children, branches, routesMeta, path); } if (route.path == null && !route.index) { return; @@ -1012,12 +513,12 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", }); }; routes.forEach((route, index) => { - var _a; - if (route.path === "" || !((_a = route.path) == null ? void 0 : _a.includes("?"))) { + var _route$path; + if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) { flattenRoute(route, index); } else { for (let exploded of explodeOptionalSegments(route.path)) { - flattenRoute(route, index, true, exploded); + flattenRoute(route, index, exploded); } } }); @@ -1034,25 +535,14 @@ function explodeOptionalSegments(path) { } let restExploded = explodeOptionalSegments(rest.join("/")); let result = []; - result.push( - ...restExploded.map( - (subpath) => subpath === "" ? required : [required, subpath].join("/") - ) - ); + result.push(...restExploded.map((subpath) => subpath === "" ? required : [required, subpath].join("/"))); if (isOptional) { result.push(...restExploded); } - return result.map( - (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded - ); + return result.map((exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded); } function rankRouteBranches(branches) { - branches.sort( - (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes( - a.routesMeta.map((meta) => meta.childrenIndex), - b.routesMeta.map((meta) => meta.childrenIndex) - ) - ); + branches.sort((a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(a.routesMeta.map((meta) => meta.childrenIndex), b.routesMeta.map((meta) => meta.childrenIndex))); } var paramRe = /^:[\w-]+$/; var dynamicSegmentValue = 3; @@ -1070,10 +560,7 @@ function computeScore(path, index) { if (index) { initialScore += indexRouteValue; } - return segments.filter((s) => !isSplat(s)).reduce( - (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), - initialScore - ); + return segments.filter((s) => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore); } function compareIndexes(a, b) { let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]); @@ -1089,8 +576,13 @@ function compareIndexes(a, b) { 0 ); } -function matchRouteBranch(branch, pathname, allowPartial = false) { - let { routesMeta } = branch; +function matchRouteBranch(branch, pathname, allowPartial) { + if (allowPartial === void 0) { + allowPartial = false; + } + let { + routesMeta + } = branch; let matchedParams = {}; let matchedPathname = "/"; let matches = []; @@ -1098,20 +590,18 @@ function matchRouteBranch(branch, pathname, allowPartial = false) { let meta = routesMeta[i]; let end = i === routesMeta.length - 1; let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/"; - let match = matchPath( - { path: meta.relativePath, caseSensitive: meta.caseSensitive, end }, - remainingPathname - ); + let match = matchPath({ + path: meta.relativePath, + caseSensitive: meta.caseSensitive, + end + }, remainingPathname); let route = meta.route; if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) { - match = matchPath( - { - path: meta.relativePath, - caseSensitive: meta.caseSensitive, - end: false - }, - remainingPathname - ); + match = matchPath({ + path: meta.relativePath, + caseSensitive: meta.caseSensitive, + end: false + }, remainingPathname); } if (!match) { return null; @@ -1121,9 +611,7 @@ function matchRouteBranch(branch, pathname, allowPartial = false) { // TODO: Can this as be avoided? params: matchedParams, pathname: joinPaths([matchedPathname, match.pathname]), - pathnameBase: normalizePathname( - joinPaths([matchedPathname, match.pathnameBase]) - ), + pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])), route }); if (match.pathnameBase !== "/") { @@ -1132,29 +620,29 @@ function matchRouteBranch(branch, pathname, allowPartial = false) { } return matches; } -function generatePath(originalPath, params = {}) { +function generatePath(originalPath, params) { + if (params === void 0) { + params = {}; + } let path = originalPath; if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) { - warning( - false, - `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".` - ); + warning(false, 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".')); path = path.replace(/\*$/, "/*"); } const prefix = path.startsWith("/") ? "/" : ""; - const stringify2 = (p) => p == null ? "" : typeof p === "string" ? p : String(p); + const stringify = (p) => p == null ? "" : typeof p === "string" ? p : String(p); const segments = path.split(/\/+/).map((segment, index, array) => { const isLastSegment = index === array.length - 1; if (isLastSegment && segment === "*") { const star = "*"; - return stringify2(params[star]); + return stringify(params[star]); } - const keyMatch = segment.match(/^:([\w-]+)(\??)(.*)/); + const keyMatch = segment.match(/^:([\w-]+)(\??)$/); if (keyMatch) { - const [, key, optional, suffix] = keyMatch; + const [, key, optional] = keyMatch; let param = params[key]; - invariant(optional === "?" || param != null, `Missing ":${key}" param`); - return encodeURIComponent(stringify2(param)) + suffix; + invariant(optional === "?" || param != null, 'Missing ":' + key + '" param'); + return stringify(param); } return segment.replace(/\?$/g, ""); }).filter((segment) => !!segment); @@ -1162,34 +650,35 @@ function generatePath(originalPath, params = {}) { } function matchPath(pattern, pathname) { if (typeof pattern === "string") { - pattern = { path: pattern, caseSensitive: false, end: true }; + pattern = { + path: pattern, + caseSensitive: false, + end: true + }; } - let [matcher, compiledParams] = compilePath( - pattern.path, - pattern.caseSensitive, - pattern.end - ); + let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end); let match = pathname.match(matcher); if (!match) return null; let matchedPathname = match[0]; let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1"); let captureGroups = match.slice(1); - let params = compiledParams.reduce( - (memo2, { paramName, isOptional }, index) => { - if (paramName === "*") { - let splatValue = captureGroups[index] || ""; - pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1"); - } - const value = captureGroups[index]; - if (isOptional && !value) { - memo2[paramName] = void 0; - } else { - memo2[paramName] = (value || "").replace(/%2F/g, "/"); - } - return memo2; - }, - {} - ); + let params = compiledParams.reduce((memo2, _ref, index) => { + let { + paramName, + isOptional + } = _ref; + if (paramName === "*") { + let splatValue = captureGroups[index] || ""; + pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1"); + } + const value = captureGroups[index]; + if (isOptional && !value) { + memo2[paramName] = void 0; + } else { + memo2[paramName] = (value || "").replace(/%2F/g, "/"); + } + return memo2; + }, {}); return { params, pathname: matchedPathname, @@ -1197,28 +686,32 @@ function matchPath(pattern, pathname) { pattern }; } -function compilePath(path, caseSensitive = false, end = true) { - warning( - path === "*" || !path.endsWith("*") || path.endsWith("/*"), - `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".` - ); +function compilePath(path, caseSensitive, end) { + if (caseSensitive === void 0) { + caseSensitive = false; + } + if (end === void 0) { + end = true; + } + warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".')); let params = []; - let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace( - /\/:([\w-]+)(\?)?/g, - (_, paramName, isOptional) => { - params.push({ paramName, isOptional: isOptional != null }); - return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)"; - } - ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2"); + let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => { + params.push({ + paramName, + isOptional: isOptional != null + }); + return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)"; + }); if (path.endsWith("*")) { - params.push({ paramName: "*" }); + params.push({ + paramName: "*" + }); regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$"; } else if (end) { regexpSource += "\\/*$"; } else if (path !== "" && path !== "/") { regexpSource += "(?:(?=\\/|$))"; - } else { - } + } else ; let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i"); return [matcher, params]; } @@ -1226,10 +719,7 @@ function decodePath(value) { try { return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/"); } catch (error) { - warning( - false, - `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).` - ); + warning(false, 'The URL path "' + value + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error + ").")); return value; } } @@ -1245,15 +735,12 @@ function stripBasename(pathname, basename) { } return pathname.slice(startIndex) || "/"; } -function prependBasename({ - basename, - pathname -}) { - return pathname === "/" ? basename : joinPaths([basename, pathname]); -} -var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; -var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url); -function resolvePath(to, fromPathname = "/") { +var ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; +var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX$1.test(url); +function resolvePath(to, fromPathname) { + if (fromPathname === void 0) { + fromPathname = "/"; + } let { pathname: toPathname, search = "", @@ -1261,11 +748,19 @@ function resolvePath(to, fromPathname = "/") { } = typeof to === "string" ? parsePath(to) : to; let pathname; if (toPathname) { - toPathname = toPathname.replace(/\/\/+/g, "/"); - if (toPathname.startsWith("/")) { - pathname = resolvePathname(toPathname.substring(1), "/"); + if (isAbsoluteUrl(toPathname)) { + pathname = toPathname; } else { - pathname = resolvePathname(toPathname, fromPathname); + if (toPathname.includes("//")) { + let oldPathname = toPathname; + toPathname = toPathname.replace(/\/\/+/g, "/"); + warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname)); + } + if (toPathname.startsWith("/")) { + pathname = resolvePathname(toPathname.substring(1), "/"); + } else { + pathname = resolvePathname(toPathname, fromPathname); + } } } else { pathname = fromPathname; @@ -1289,39 +784,30 @@ function resolvePathname(relativePath, fromPathname) { return segments.length > 1 ? segments.join("/") : "/"; } function getInvalidPathError(char, field, dest, path) { - return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify( - path - )}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`; + return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in and the router will parse it for you.'; } function getPathContributingMatches(matches) { - return matches.filter( - (match, index) => index === 0 || match.route.path && match.route.path.length > 0 - ); + return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0); } -function getResolveToMatches(matches) { +function getResolveToMatches(matches, v7_relativeSplatPath) { let pathMatches = getPathContributingMatches(matches); - return pathMatches.map( - (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase - ); + if (v7_relativeSplatPath) { + return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase); + } + return pathMatches.map((match) => match.pathnameBase); } -function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) { +function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) { + if (isPathRelative === void 0) { + isPathRelative = false; + } let to; if (typeof toArg === "string") { to = parsePath(toArg); } else { - to = { ...toArg }; - invariant( - !to.pathname || !to.pathname.includes("?"), - getInvalidPathError("?", "pathname", "search", to) - ); - invariant( - !to.pathname || !to.pathname.includes("#"), - getInvalidPathError("#", "pathname", "hash", to) - ); - invariant( - !to.search || !to.search.includes("#"), - getInvalidPathError("#", "search", "hash", to) - ); + to = _extends({}, toArg); + invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to)); + invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to)); + invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to)); } let isEmptyPath = toArg === "" || to.pathname === ""; let toPathname = isEmptyPath ? "/" : to.pathname; @@ -1352,29 +838,175 @@ var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/"); var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/"); var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search; var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash; -var DataWithResponseInit = class { - constructor(data2, init) { - this.type = "DataWithResponseInit"; - this.data = data2; - this.init = init || null; +var json = function json2(data, init) { + if (init === void 0) { + init = {}; + } + let responseInit = typeof init === "number" ? { + status: init + } : init; + let headers = new Headers(responseInit.headers); + if (!headers.has("Content-Type")) { + headers.set("Content-Type", "application/json; charset=utf-8"); + } + return new Response(JSON.stringify(data), _extends({}, responseInit, { + headers + })); +}; +var AbortedDeferredError = class extends Error { +}; +var DeferredData = class { + constructor(data, responseInit) { + this.pendingKeysSet = /* @__PURE__ */ new Set(); + this.subscribers = /* @__PURE__ */ new Set(); + this.deferredKeys = []; + invariant(data && typeof data === "object" && !Array.isArray(data), "defer() only accepts plain objects"); + let reject; + this.abortPromise = new Promise((_, r) => reject = r); + this.controller = new AbortController(); + let onAbort = () => reject(new AbortedDeferredError("Deferred data aborted")); + this.unlistenAbortSignal = () => this.controller.signal.removeEventListener("abort", onAbort); + this.controller.signal.addEventListener("abort", onAbort); + this.data = Object.entries(data).reduce((acc, _ref2) => { + let [key, value] = _ref2; + return Object.assign(acc, { + [key]: this.trackPromise(key, value) + }); + }, {}); + if (this.done) { + this.unlistenAbortSignal(); + } + this.init = responseInit; + } + trackPromise(key, value) { + if (!(value instanceof Promise)) { + return value; + } + this.deferredKeys.push(key); + this.pendingKeysSet.add(key); + let promise = Promise.race([value, this.abortPromise]).then((data) => this.onSettle(promise, key, void 0, data), (error) => this.onSettle(promise, key, error)); + promise.catch(() => { + }); + Object.defineProperty(promise, "_tracked", { + get: () => true + }); + return promise; + } + onSettle(promise, key, error, data) { + if (this.controller.signal.aborted && error instanceof AbortedDeferredError) { + this.unlistenAbortSignal(); + Object.defineProperty(promise, "_error", { + get: () => error + }); + return Promise.reject(error); + } + this.pendingKeysSet.delete(key); + if (this.done) { + this.unlistenAbortSignal(); + } + if (error === void 0 && data === void 0) { + let undefinedError = new Error('Deferred data for key "' + key + '" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.'); + Object.defineProperty(promise, "_error", { + get: () => undefinedError + }); + this.emit(false, key); + return Promise.reject(undefinedError); + } + if (data === void 0) { + Object.defineProperty(promise, "_error", { + get: () => error + }); + this.emit(false, key); + return Promise.reject(error); + } + Object.defineProperty(promise, "_data", { + get: () => data + }); + this.emit(false, key); + return data; + } + emit(aborted, settledKey) { + this.subscribers.forEach((subscriber) => subscriber(aborted, settledKey)); + } + subscribe(fn) { + this.subscribers.add(fn); + return () => this.subscribers.delete(fn); + } + cancel() { + this.controller.abort(); + this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k)); + this.emit(true); + } + async resolveData(signal) { + let aborted = false; + if (!this.done) { + let onAbort = () => this.cancel(); + signal.addEventListener("abort", onAbort); + aborted = await new Promise((resolve) => { + this.subscribe((aborted2) => { + signal.removeEventListener("abort", onAbort); + if (aborted2 || this.done) { + resolve(aborted2); + } + }); + }); + } + return aborted; + } + get done() { + return this.pendingKeysSet.size === 0; + } + get unwrappedData() { + invariant(this.data !== null && this.done, "Can only unwrap data on initialized and settled deferreds"); + return Object.entries(this.data).reduce((acc, _ref3) => { + let [key, value] = _ref3; + return Object.assign(acc, { + [key]: unwrapTrackedPromise(value) + }); + }, {}); + } + get pendingKeys() { + return Array.from(this.pendingKeysSet); } }; -function data(data2, init) { - return new DataWithResponseInit( - data2, - typeof init === "number" ? { status: init } : init - ); +function isTrackedPromise(value) { + return value instanceof Promise && value._tracked === true; } -var redirect = (url, init = 302) => { +function unwrapTrackedPromise(value) { + if (!isTrackedPromise(value)) { + return value; + } + if (value._error) { + throw value._error; + } + return value._data; +} +var defer = function defer2(data, init) { + if (init === void 0) { + init = {}; + } + let responseInit = typeof init === "number" ? { + status: init + } : init; + return new DeferredData(data, responseInit); +}; +var redirect = function redirect2(url, init) { + if (init === void 0) { + init = 302; + } let responseInit = init; if (typeof responseInit === "number") { - responseInit = { status: responseInit }; + responseInit = { + status: responseInit + }; } else if (typeof responseInit.status === "undefined") { responseInit.status = 302; } let headers = new Headers(responseInit.headers); headers.set("Location", url); - return new Response(null, { ...responseInit, headers }); + return new Response(null, _extends({}, responseInit, { + headers + })); }; var redirectDocument = (url, init) => { let response = redirect(url, init); @@ -1387,341 +1019,27 @@ var replace = (url, init) => { return response; }; var ErrorResponseImpl = class { - constructor(status, statusText, data2, internal = false) { + constructor(status, statusText, data, internal) { + if (internal === void 0) { + internal = false; + } this.status = status; this.statusText = statusText || ""; this.internal = internal; - if (data2 instanceof Error) { - this.data = data2.toString(); - this.error = data2; + if (data instanceof Error) { + this.data = data.toString(); + this.error = data; } else { - this.data = data2; + this.data = data; } } }; function isRouteErrorResponse(error) { return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error; } -function getRoutePattern(matches) { - return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/"; -} -var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; -function parseToInfo(_to, basename) { - let to = _to; - if (typeof to !== "string" || !ABSOLUTE_URL_REGEX.test(to)) { - return { - absoluteURL: void 0, - isExternal: false, - to - }; - } - let absoluteURL = to; - let isExternal = false; - if (isBrowser) { - try { - let currentUrl = new URL(window.location.href); - let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to); - let path = stripBasename(targetUrl.pathname, basename); - if (targetUrl.origin === currentUrl.origin && path != null) { - to = path + targetUrl.search + targetUrl.hash; - } else { - isExternal = true; - } - } catch (e) { - warning( - false, - ` contains an invalid URL which will probably break when clicked - please update to a valid URL path.` - ); - } - } - return { - absoluteURL, - isExternal, - to - }; -} -var UninstrumentedSymbol = Symbol("Uninstrumented"); -function getRouteInstrumentationUpdates(fns, route) { - let aggregated = { - lazy: [], - "lazy.loader": [], - "lazy.action": [], - "lazy.middleware": [], - middleware: [], - loader: [], - action: [] - }; - fns.forEach( - (fn) => fn({ - id: route.id, - index: route.index, - path: route.path, - instrument(i) { - let keys = Object.keys(aggregated); - for (let key of keys) { - if (i[key]) { - aggregated[key].push(i[key]); - } - } - } - }) - ); - let updates = {}; - if (typeof route.lazy === "function" && aggregated.lazy.length > 0) { - let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0); - if (instrumented) { - updates.lazy = instrumented; - } - } - if (typeof route.lazy === "object") { - let lazyObject = route.lazy; - ["middleware", "loader", "action"].forEach((key) => { - let lazyFn = lazyObject[key]; - let instrumentations = aggregated[`lazy.${key}`]; - if (typeof lazyFn === "function" && instrumentations.length > 0) { - let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0); - if (instrumented) { - updates.lazy = Object.assign(updates.lazy || {}, { - [key]: instrumented - }); - } - } - }); - } - ["loader", "action"].forEach((key) => { - let handler = route[key]; - if (typeof handler === "function" && aggregated[key].length > 0) { - let original = handler[UninstrumentedSymbol] ?? handler; - let instrumented = wrapImpl( - aggregated[key], - original, - (...args) => getHandlerInfo(args[0]) - ); - if (instrumented) { - if (key === "loader" && original.hydrate === true) { - instrumented.hydrate = true; - } - instrumented[UninstrumentedSymbol] = original; - updates[key] = instrumented; - } - } - }); - if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) { - updates.middleware = route.middleware.map((middleware) => { - let original = middleware[UninstrumentedSymbol] ?? middleware; - let instrumented = wrapImpl( - aggregated.middleware, - original, - (...args) => getHandlerInfo(args[0]) - ); - if (instrumented) { - instrumented[UninstrumentedSymbol] = original; - return instrumented; - } - return middleware; - }); - } - return updates; -} -function instrumentClientSideRouter(router2, fns) { - let aggregated = { - navigate: [], - fetch: [] - }; - fns.forEach( - (fn) => fn({ - instrument(i) { - let keys = Object.keys(i); - for (let key of keys) { - if (i[key]) { - aggregated[key].push(i[key]); - } - } - } - }) - ); - if (aggregated.navigate.length > 0) { - let navigate = router2.navigate[UninstrumentedSymbol] ?? router2.navigate; - let instrumentedNavigate = wrapImpl( - aggregated.navigate, - navigate, - (...args) => { - let [to, opts] = args; - return { - to: typeof to === "number" || typeof to === "string" ? to : to ? createPath(to) : ".", - ...getRouterInfo(router2, opts ?? {}) - }; - } - ); - if (instrumentedNavigate) { - instrumentedNavigate[UninstrumentedSymbol] = navigate; - router2.navigate = instrumentedNavigate; - } - } - if (aggregated.fetch.length > 0) { - let fetch2 = router2.fetch[UninstrumentedSymbol] ?? router2.fetch; - let instrumentedFetch = wrapImpl(aggregated.fetch, fetch2, (...args) => { - let [key, , href2, opts] = args; - return { - href: href2 ?? ".", - fetcherKey: key, - ...getRouterInfo(router2, opts ?? {}) - }; - }); - if (instrumentedFetch) { - instrumentedFetch[UninstrumentedSymbol] = fetch2; - router2.fetch = instrumentedFetch; - } - } - return router2; -} -function instrumentHandler(handler, fns) { - let aggregated = { - request: [] - }; - fns.forEach( - (fn) => fn({ - instrument(i) { - let keys = Object.keys(i); - for (let key of keys) { - if (i[key]) { - aggregated[key].push(i[key]); - } - } - } - }) - ); - let instrumentedHandler = handler; - if (aggregated.request.length > 0) { - instrumentedHandler = wrapImpl(aggregated.request, handler, (...args) => { - let [request, context] = args; - return { - request: getReadonlyRequest(request), - context: context != null ? getReadonlyContext(context) : context - }; - }); - } - return instrumentedHandler; -} -function wrapImpl(impls, handler, getInfo) { - if (impls.length === 0) { - return null; - } - return async (...args) => { - let result = await recurseRight( - impls, - getInfo(...args), - () => handler(...args), - impls.length - 1 - ); - if (result.type === "error") { - throw result.value; - } - return result.value; - }; -} -async function recurseRight(impls, info, handler, index) { - let impl = impls[index]; - let result; - if (!impl) { - try { - let value = await handler(); - result = { type: "success", value }; - } catch (e) { - result = { type: "error", value: e }; - } - } else { - let handlerPromise = void 0; - let callHandler = async () => { - if (handlerPromise) { - console.error("You cannot call instrumented handlers more than once"); - } else { - handlerPromise = recurseRight(impls, info, handler, index - 1); - } - result = await handlerPromise; - invariant(result, "Expected a result"); - if (result.type === "error" && result.value instanceof Error) { - return { status: "error", error: result.value }; - } - return { status: "success", error: void 0 }; - }; - try { - await impl(callHandler, info); - } catch (e) { - console.error("An instrumentation function threw an error:", e); - } - if (!handlerPromise) { - await callHandler(); - } - await handlerPromise; - } - if (result) { - return result; - } - return { - type: "error", - value: new Error("No result assigned in instrumentation chain.") - }; -} -function getHandlerInfo(args) { - let { request, context, params, unstable_pattern } = args; - return { - request: getReadonlyRequest(request), - params: { ...params }, - unstable_pattern, - context: getReadonlyContext(context) - }; -} -function getRouterInfo(router2, opts) { - return { - currentUrl: createPath(router2.state.location), - ..."formMethod" in opts ? { formMethod: opts.formMethod } : {}, - ..."formEncType" in opts ? { formEncType: opts.formEncType } : {}, - ..."formData" in opts ? { formData: opts.formData } : {}, - ..."body" in opts ? { body: opts.body } : {} - }; -} -function getReadonlyRequest(request) { - return { - method: request.method, - url: request.url, - headers: { - get: (...args) => request.headers.get(...args) - } - }; -} -function getReadonlyContext(context) { - if (isPlainObject(context)) { - let frozen = { ...context }; - Object.freeze(frozen); - return frozen; - } else { - return { - get: (ctx) => context.get(ctx) - }; - } -} -var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0"); -function isPlainObject(thing) { - if (thing === null || typeof thing !== "object") { - return false; - } - const proto = Object.getPrototypeOf(thing); - return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames; -} -var validMutationMethodsArr = [ - "POST", - "PUT", - "PATCH", - "DELETE" -]; -var validMutationMethods = new Set( - validMutationMethodsArr -); -var validRequestMethodsArr = [ - "GET", - ...validMutationMethodsArr -]; +var validMutationMethodsArr = ["post", "put", "patch", "delete"]; +var validMutationMethods = new Set(validMutationMethodsArr); +var validRequestMethodsArr = ["get", ...validMutationMethodsArr]; var validRequestMethods = new Set(validRequestMethodsArr); var redirectStatusCodes = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]); var redirectPreserveMethodStatusCodes = /* @__PURE__ */ new Set([307, 308]); @@ -1751,112 +1069,97 @@ var IDLE_BLOCKER = { reset: void 0, location: void 0 }; +var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; var defaultMapRouteProperties = (route) => ({ hasErrorBoundary: Boolean(route.hasErrorBoundary) }); var TRANSITIONS_STORAGE_KEY = "remix-router-transitions"; -var ResetLoaderDataSymbol = Symbol("ResetLoaderData"); function createRouter(init) { const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : void 0; - const isBrowser3 = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined"; - invariant( - init.routes.length > 0, - "You must provide a non-empty routes array to createRouter" - ); - let hydrationRouteProperties2 = init.hydrationRouteProperties || []; - let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties; - let mapRouteProperties2 = _mapRouteProperties; - if (init.unstable_instrumentations) { - let instrumentations = init.unstable_instrumentations; - mapRouteProperties2 = (route) => { - return { - ..._mapRouteProperties(route), - ...getRouteInstrumentationUpdates( - instrumentations.map((i) => i.route).filter(Boolean), - route - ) - }; - }; + const isBrowser2 = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined"; + const isServer = !isBrowser2; + invariant(init.routes.length > 0, "You must provide a non-empty routes array to createRouter"); + let mapRouteProperties2; + if (init.mapRouteProperties) { + mapRouteProperties2 = init.mapRouteProperties; + } else if (init.detectErrorBoundary) { + let detectErrorBoundary = init.detectErrorBoundary; + mapRouteProperties2 = (route) => ({ + hasErrorBoundary: detectErrorBoundary(route) + }); + } else { + mapRouteProperties2 = defaultMapRouteProperties; } let manifest = {}; - let dataRoutes = convertRoutesToDataRoutes( - init.routes, - mapRouteProperties2, - void 0, - manifest - ); + let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties2, void 0, manifest); let inFlightDataRoutes; let basename = init.basename || "/"; - if (!basename.startsWith("/")) { - basename = `/${basename}`; - } - let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware; - let future = { - ...init.future - }; + let dataStrategyImpl = init.dataStrategy || defaultDataStrategy; + let patchRoutesOnNavigationImpl = init.patchRoutesOnNavigation; + let future = _extends({ + v7_fetcherPersist: false, + v7_normalizeFormMethod: false, + v7_partialHydration: false, + v7_prependBasename: false, + v7_relativeSplatPath: false, + v7_skipActionErrorRevalidation: false + }, init.future); let unlistenHistory = null; let subscribers = /* @__PURE__ */ new Set(); let savedScrollPositions2 = null; - let getScrollRestorationKey2 = null; + let getScrollRestorationKey = null; let getScrollPosition = null; let initialScrollRestored = init.hydrationData != null; let initialMatches = matchRoutes(dataRoutes, init.history.location, basename); let initialMatchesIsFOW = false; let initialErrors = null; - let initialized; - if (initialMatches == null && !init.patchRoutesOnNavigation) { + if (initialMatches == null && !patchRoutesOnNavigationImpl) { let error = getInternalRouterError(404, { pathname: init.history.location.pathname }); - let { matches, route } = getShortCircuitMatches(dataRoutes); - initialized = true; + let { + matches, + route + } = getShortCircuitMatches(dataRoutes); initialMatches = matches; - initialErrors = { [route.id]: error }; - } else { - if (initialMatches && !init.hydrationData) { - let fogOfWar = checkFogOfWar( - initialMatches, - dataRoutes, - init.history.location.pathname - ); - if (fogOfWar.active) { - initialMatches = null; - } + initialErrors = { + [route.id]: error + }; + } + if (initialMatches && !init.hydrationData) { + let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname); + if (fogOfWar.active) { + initialMatches = null; } - if (!initialMatches) { - initialized = false; - initialMatches = []; - let fogOfWar = checkFogOfWar( - null, - dataRoutes, - init.history.location.pathname - ); + } + let initialized; + if (!initialMatches) { + initialized = false; + initialMatches = []; + if (future.v7_partialHydration) { + let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname); if (fogOfWar.active && fogOfWar.matches) { initialMatchesIsFOW = true; initialMatches = fogOfWar.matches; } - } else if (initialMatches.some((m) => m.route.lazy)) { - initialized = false; - } else if (!initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))) { - initialized = true; - } else { - let loaderData = init.hydrationData ? init.hydrationData.loaderData : null; - let errors = init.hydrationData ? init.hydrationData.errors : null; - if (errors) { - let idx = initialMatches.findIndex( - (m) => errors[m.route.id] !== void 0 - ); - initialized = initialMatches.slice(0, idx + 1).every( - (m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors) - ); - } else { - initialized = initialMatches.every( - (m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors) - ); - } } + } else if (initialMatches.some((m) => m.route.lazy)) { + initialized = false; + } else if (!initialMatches.some((m) => m.route.loader)) { + initialized = true; + } else if (future.v7_partialHydration) { + let loaderData = init.hydrationData ? init.hydrationData.loaderData : null; + let errors = init.hydrationData ? init.hydrationData.errors : null; + if (errors) { + let idx = initialMatches.findIndex((m) => errors[m.route.id] !== void 0); + initialized = initialMatches.slice(0, idx + 1).every((m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)); + } else { + initialized = initialMatches.every((m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)); + } + } else { + initialized = init.hydrationData != null; } - let router2; + let router; let state = { historyAction: init.history.action, location: init.history.location, @@ -1873,8 +1176,7 @@ function createRouter(init) { fetchers: /* @__PURE__ */ new Map(), blockers: /* @__PURE__ */ new Map() }; - let pendingAction = "POP"; - let pendingPopstateNavigationDfd = null; + let pendingAction = Action.Pop; let pendingPreventScrollReset = false; let pendingNavigationController; let pendingViewTransitionEnabled = false; @@ -1882,6 +1184,7 @@ function createRouter(init) { let removePageHideEventListener = null; let isUninterruptedRevalidation = false; let isRevalidationRequired = false; + let cancelledDeferredRoutes = []; let cancelledFetcherLoads = /* @__PURE__ */ new Set(); let fetchControllers = /* @__PURE__ */ new Map(); let incrementingLoadId = 0; @@ -1890,69 +1193,69 @@ function createRouter(init) { let fetchRedirectIds = /* @__PURE__ */ new Set(); let fetchLoadMatches = /* @__PURE__ */ new Map(); let activeFetchers = /* @__PURE__ */ new Map(); - let fetchersQueuedForDeletion = /* @__PURE__ */ new Set(); + let deletedFetchers = /* @__PURE__ */ new Set(); + let activeDeferreds = /* @__PURE__ */ new Map(); let blockerFunctions = /* @__PURE__ */ new Map(); let unblockBlockerHistoryUpdate = void 0; - let pendingRevalidationDfd = null; function initialize() { - unlistenHistory = init.history.listen( - ({ action: historyAction, location: location2, delta }) => { - if (unblockBlockerHistoryUpdate) { - unblockBlockerHistoryUpdate(); - unblockBlockerHistoryUpdate = void 0; - return; - } - warning( - blockerFunctions.size === 0 || delta != null, - "You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL." - ); - let blockerKey = shouldBlockNavigation({ - currentLocation: state.location, - nextLocation: location2, - historyAction - }); - if (blockerKey && delta != null) { - let nextHistoryUpdatePromise = new Promise((resolve) => { - unblockBlockerHistoryUpdate = resolve; - }); - init.history.go(delta * -1); - updateBlocker(blockerKey, { - state: "blocked", - location: location2, - proceed() { - updateBlocker(blockerKey, { - state: "proceeding", - proceed: void 0, - reset: void 0, - location: location2 - }); - nextHistoryUpdatePromise.then(() => init.history.go(delta)); - }, - reset() { - let blockers = new Map(state.blockers); - blockers.set(blockerKey, IDLE_BLOCKER); - updateState({ blockers }); - } - }); - pendingPopstateNavigationDfd == null ? void 0 : pendingPopstateNavigationDfd.resolve(); - pendingPopstateNavigationDfd = null; - return; - } - return startNavigation(historyAction, location2); + unlistenHistory = init.history.listen((_ref) => { + let { + action: historyAction, + location, + delta + } = _ref; + if (unblockBlockerHistoryUpdate) { + unblockBlockerHistoryUpdate(); + unblockBlockerHistoryUpdate = void 0; + return; } - ); - if (isBrowser3) { + warning(blockerFunctions.size === 0 || delta != null, "You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL."); + let blockerKey = shouldBlockNavigation({ + currentLocation: state.location, + nextLocation: location, + historyAction + }); + if (blockerKey && delta != null) { + let nextHistoryUpdatePromise = new Promise((resolve) => { + unblockBlockerHistoryUpdate = resolve; + }); + init.history.go(delta * -1); + updateBlocker(blockerKey, { + state: "blocked", + location, + proceed() { + updateBlocker(blockerKey, { + state: "proceeding", + proceed: void 0, + reset: void 0, + location + }); + nextHistoryUpdatePromise.then(() => init.history.go(delta)); + }, + reset() { + let blockers = new Map(state.blockers); + blockers.set(blockerKey, IDLE_BLOCKER); + updateState({ + blockers + }); + } + }); + return; + } + return startNavigation(historyAction, location); + }); + if (isBrowser2) { restoreAppliedTransitions(routerWindow, appliedViewTransitions); let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions); routerWindow.addEventListener("pagehide", _saveAppliedTransitions); removePageHideEventListener = () => routerWindow.removeEventListener("pagehide", _saveAppliedTransitions); } if (!state.initialized) { - startNavigation("POP", state.location, { + startNavigation(Action.Pop, state.location, { initialHydration: true }); } - return router2; + return router; } function dispose() { if (unlistenHistory) { @@ -1970,54 +1273,47 @@ function createRouter(init) { subscribers.add(fn); return () => subscribers.delete(fn); } - function updateState(newState, opts = {}) { - if (newState.matches) { - newState.matches = newState.matches.map((m) => { - let route = manifest[m.route.id]; - let matchRoute = m.route; - if (matchRoute.element !== route.element || matchRoute.errorElement !== route.errorElement || matchRoute.hydrateFallbackElement !== route.hydrateFallbackElement) { - return { - ...m, - route - }; + function updateState(newState, opts) { + if (opts === void 0) { + opts = {}; + } + state = _extends({}, state, newState); + let completedFetchers = []; + let deletedFetchersKeys = []; + if (future.v7_fetcherPersist) { + state.fetchers.forEach((fetcher, key) => { + if (fetcher.state === "idle") { + if (deletedFetchers.has(key)) { + deletedFetchersKeys.push(key); + } else { + completedFetchers.push(key); + } } - return m; }); } - state = { - ...state, - ...newState - }; - let unmountedFetchers = []; - let mountedFetchers = []; - state.fetchers.forEach((fetcher, key) => { - if (fetcher.state === "idle") { - if (fetchersQueuedForDeletion.has(key)) { - unmountedFetchers.push(key); - } else { - mountedFetchers.push(key); - } - } - }); - fetchersQueuedForDeletion.forEach((key) => { + deletedFetchers.forEach((key) => { if (!state.fetchers.has(key) && !fetchControllers.has(key)) { - unmountedFetchers.push(key); + deletedFetchersKeys.push(key); } }); - [...subscribers].forEach( - (subscriber) => subscriber(state, { - deletedFetchers: unmountedFetchers, - newErrors: newState.errors ?? null, - viewTransitionOpts: opts.viewTransitionOpts, - flushSync: opts.flushSync === true - }) - ); - unmountedFetchers.forEach((key) => deleteFetcher(key)); - mountedFetchers.forEach((key) => state.fetchers.delete(key)); + [...subscribers].forEach((subscriber) => subscriber(state, { + deletedFetchers: deletedFetchersKeys, + viewTransitionOpts: opts.viewTransitionOpts, + flushSync: opts.flushSync === true + })); + if (future.v7_fetcherPersist) { + completedFetchers.forEach((key) => state.fetchers.delete(key)); + deletedFetchersKeys.forEach((key) => deleteFetcher(key)); + } else { + deletedFetchersKeys.forEach((key) => deletedFetchers.delete(key)); + } } - function completeNavigation(location2, newState, { flushSync: flushSync3 } = {}) { - var _a, _b; - let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && ((_a = location2.state) == null ? void 0 : _a._isRedirect) !== true; + function completeNavigation(location, newState, _temp) { + var _location$state, _location$state2; + let { + flushSync + } = _temp === void 0 ? {} : _temp; + let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true; let actionData; if (newState.actionData) { if (Object.keys(newState.actionData).length > 0) { @@ -2030,127 +1326,97 @@ function createRouter(init) { } else { actionData = null; } - let loaderData = newState.loaderData ? mergeLoaderData( - state.loaderData, - newState.loaderData, - newState.matches || [], - newState.errors - ) : state.loaderData; + let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData; let blockers = state.blockers; if (blockers.size > 0) { blockers = new Map(blockers); blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER)); } - let restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location2, newState.matches || state.matches); - let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_b = location2.state) == null ? void 0 : _b._isRedirect) !== true; + let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true; if (inFlightDataRoutes) { dataRoutes = inFlightDataRoutes; inFlightDataRoutes = void 0; } - if (isUninterruptedRevalidation) { - } else if (pendingAction === "POP") { - } else if (pendingAction === "PUSH") { - init.history.push(location2, location2.state); - } else if (pendingAction === "REPLACE") { - init.history.replace(location2, location2.state); + if (isUninterruptedRevalidation) ; + else if (pendingAction === Action.Pop) ; + else if (pendingAction === Action.Push) { + init.history.push(location, location.state); + } else if (pendingAction === Action.Replace) { + init.history.replace(location, location.state); } let viewTransitionOpts; - if (pendingAction === "POP") { + if (pendingAction === Action.Pop) { let priorPaths = appliedViewTransitions.get(state.location.pathname); - if (priorPaths && priorPaths.has(location2.pathname)) { + if (priorPaths && priorPaths.has(location.pathname)) { viewTransitionOpts = { currentLocation: state.location, - nextLocation: location2 + nextLocation: location }; - } else if (appliedViewTransitions.has(location2.pathname)) { + } else if (appliedViewTransitions.has(location.pathname)) { viewTransitionOpts = { - currentLocation: location2, + currentLocation: location, nextLocation: state.location }; } } else if (pendingViewTransitionEnabled) { let toPaths = appliedViewTransitions.get(state.location.pathname); if (toPaths) { - toPaths.add(location2.pathname); + toPaths.add(location.pathname); } else { - toPaths = /* @__PURE__ */ new Set([location2.pathname]); + toPaths = /* @__PURE__ */ new Set([location.pathname]); appliedViewTransitions.set(state.location.pathname, toPaths); } viewTransitionOpts = { currentLocation: state.location, - nextLocation: location2 + nextLocation: location }; } - updateState( - { - ...newState, - // matches, errors, fetchers go through as-is - actionData, - loaderData, - historyAction: pendingAction, - location: location2, - initialized: true, - navigation: IDLE_NAVIGATION, - revalidation: "idle", - restoreScrollPosition, - preventScrollReset, - blockers - }, - { - viewTransitionOpts, - flushSync: flushSync3 === true - } - ); - pendingAction = "POP"; + updateState(_extends({}, newState, { + actionData, + loaderData, + historyAction: pendingAction, + location, + initialized: true, + navigation: IDLE_NAVIGATION, + revalidation: "idle", + restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches), + preventScrollReset, + blockers + }), { + viewTransitionOpts, + flushSync: flushSync === true + }); + pendingAction = Action.Pop; pendingPreventScrollReset = false; pendingViewTransitionEnabled = false; isUninterruptedRevalidation = false; isRevalidationRequired = false; - pendingPopstateNavigationDfd == null ? void 0 : pendingPopstateNavigationDfd.resolve(); - pendingPopstateNavigationDfd = null; - pendingRevalidationDfd == null ? void 0 : pendingRevalidationDfd.resolve(); - pendingRevalidationDfd = null; + cancelledDeferredRoutes = []; } async function navigate(to, opts) { - pendingPopstateNavigationDfd == null ? void 0 : pendingPopstateNavigationDfd.resolve(); - pendingPopstateNavigationDfd = null; if (typeof to === "number") { - if (!pendingPopstateNavigationDfd) { - pendingPopstateNavigationDfd = createDeferred(); - } - let promise = pendingPopstateNavigationDfd.promise; init.history.go(to); - return promise; + return; } - let normalizedPath = normalizeTo( - state.location, - state.matches, - basename, - to, - opts == null ? void 0 : opts.fromRouteId, - opts == null ? void 0 : opts.relative - ); - let { path, submission, error } = normalizeNavigateOptions( - false, - normalizedPath, - opts - ); + let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative); + let { + path, + submission, + error + } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts); let currentLocation = state.location; let nextLocation = createLocation(state.location, path, opts && opts.state); - nextLocation = { - ...nextLocation, - ...init.history.encodeLocation(nextLocation) - }; + nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation)); let userReplace = opts && opts.replace != null ? opts.replace : void 0; - let historyAction = "PUSH"; + let historyAction = Action.Push; if (userReplace === true) { - historyAction = "REPLACE"; - } else if (userReplace === false) { - } else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) { - historyAction = "REPLACE"; + historyAction = Action.Replace; + } else if (userReplace === false) ; + else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) { + historyAction = Action.Replace; } let preventScrollReset = opts && "preventScrollReset" in opts ? opts.preventScrollReset === true : void 0; - let flushSync3 = (opts && opts.flushSync) === true; + let flushSync = (opts && opts.flushSync) === true; let blockerKey = shouldBlockNavigation({ currentLocation, nextLocation, @@ -2172,12 +1438,14 @@ function createRouter(init) { reset() { let blockers = new Map(state.blockers); blockers.set(blockerKey, IDLE_BLOCKER); - updateState({ blockers }); + updateState({ + blockers + }); } }); return; } - await startNavigation(historyAction, nextLocation, { + return await startNavigation(historyAction, nextLocation, { submission, // Send through the formData serialization error if we have one so we can // render at the right error boundary after we match routes @@ -2185,38 +1453,30 @@ function createRouter(init) { preventScrollReset, replace: opts && opts.replace, enableViewTransition: opts && opts.viewTransition, - flushSync: flushSync3, - callSiteDefaultShouldRevalidate: opts && opts.unstable_defaultShouldRevalidate + flushSync }); } function revalidate() { - if (!pendingRevalidationDfd) { - pendingRevalidationDfd = createDeferred(); - } interruptActiveLoads(); - updateState({ revalidation: "loading" }); - let promise = pendingRevalidationDfd.promise; + updateState({ + revalidation: "loading" + }); if (state.navigation.state === "submitting") { - return promise; + return; } if (state.navigation.state === "idle") { startNavigation(state.historyAction, state.location, { startUninterruptedRevalidation: true }); - return promise; + return; } - startNavigation( - pendingAction || state.historyAction, - state.navigation.location, - { - overrideNavigation: state.navigation, - // Proxy through any rending view transition - enableViewTransition: pendingViewTransitionEnabled === true - } - ); - return promise; + startNavigation(pendingAction || state.historyAction, state.navigation.location, { + overrideNavigation: state.navigation, + // Proxy through any rending view transition + enableViewTransition: pendingViewTransitionEnabled === true + }); } - async function startNavigation(historyAction, location2, opts) { + async function startNavigation(historyAction, location, opts) { pendingNavigationController && pendingNavigationController.abort(); pendingNavigationController = null; pendingAction = historyAction; @@ -2226,61 +1486,53 @@ function createRouter(init) { pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true; let routesToUse = inFlightDataRoutes || dataRoutes; let loadingNavigation = opts && opts.overrideNavigation; - let matches = (opts == null ? void 0 : opts.initialHydration) && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? ( + let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? ( // `matchRoutes()` has already been called if we're in here via `router.initialize()` state.matches - ) : matchRoutes(routesToUse, location2, basename); - let flushSync3 = (opts && opts.flushSync) === true; - if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location2) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) { - completeNavigation(location2, { matches }, { flushSync: flushSync3 }); + ) : matchRoutes(routesToUse, location, basename); + let flushSync = (opts && opts.flushSync) === true; + if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) { + completeNavigation(location, { + matches + }, { + flushSync + }); return; } - let fogOfWar = checkFogOfWar(matches, routesToUse, location2.pathname); + let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname); if (fogOfWar.active && fogOfWar.matches) { matches = fogOfWar.matches; } if (!matches) { - let { error, notFoundMatches, route } = handleNavigational404( - location2.pathname - ); - completeNavigation( - location2, - { - matches: notFoundMatches, - loaderData: {}, - errors: { - [route.id]: error - } - }, - { flushSync: flushSync3 } - ); + let { + error, + notFoundMatches, + route + } = handleNavigational404(location.pathname); + completeNavigation(location, { + matches: notFoundMatches, + loaderData: {}, + errors: { + [route.id]: error + } + }, { + flushSync + }); return; } pendingNavigationController = new AbortController(); - let request = createClientSideRequest( - init.history, - location2, - pendingNavigationController.signal, - opts && opts.submission - ); - let scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider(); + let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission); let pendingActionResult; if (opts && opts.pendingError) { - pendingActionResult = [ - findNearestBoundary(matches).route.id, - { type: "error", error: opts.pendingError } - ]; + pendingActionResult = [findNearestBoundary(matches).route.id, { + type: ResultType.error, + error: opts.pendingError + }]; } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) { - let actionResult = await handleAction( - request, - location2, - opts.submission, - matches, - scopedContext, - fogOfWar.active, - opts && opts.initialHydration === true, - { replace: opts.replace, flushSync: flushSync3 } - ); + let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, { + replace: opts.replace, + flushSync + }); if (actionResult.shortCircuited) { return; } @@ -2288,7 +1540,7 @@ function createRouter(init) { let [routeId, result] = actionResult.pendingActionResult; if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) { pendingNavigationController = null; - completeNavigation(location2, { + completeNavigation(location, { matches: actionResult.matches, loaderData: {}, errors: { @@ -2300,139 +1552,89 @@ function createRouter(init) { } matches = actionResult.matches || matches; pendingActionResult = actionResult.pendingActionResult; - loadingNavigation = getLoadingNavigation(location2, opts.submission); - flushSync3 = false; + loadingNavigation = getLoadingNavigation(location, opts.submission); + flushSync = false; fogOfWar.active = false; - request = createClientSideRequest( - init.history, - request.url, - request.signal - ); + request = createClientSideRequest(init.history, request.url, request.signal); } let { shortCircuited, matches: updatedMatches, loaderData, errors - } = await handleLoaders( - request, - location2, - matches, - scopedContext, - fogOfWar.active, - loadingNavigation, - opts && opts.submission, - opts && opts.fetcherSubmission, - opts && opts.replace, - opts && opts.initialHydration === true, - flushSync3, - pendingActionResult, - opts && opts.callSiteDefaultShouldRevalidate - ); + } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult); if (shortCircuited) { return; } pendingNavigationController = null; - completeNavigation(location2, { - matches: updatedMatches || matches, - ...getActionDataForCommit(pendingActionResult), + completeNavigation(location, _extends({ + matches: updatedMatches || matches + }, getActionDataForCommit(pendingActionResult), { loaderData, errors - }); + })); } - async function handleAction(request, location2, submission, matches, scopedContext, isFogOfWar, initialHydration, opts = {}) { + async function handleAction(request, location, submission, matches, isFogOfWar, opts) { + if (opts === void 0) { + opts = {}; + } interruptActiveLoads(); - let navigation = getSubmittingNavigation(location2, submission); - updateState({ navigation }, { flushSync: opts.flushSync === true }); + let navigation = getSubmittingNavigation(location, submission); + updateState({ + navigation + }, { + flushSync: opts.flushSync === true + }); if (isFogOfWar) { - let discoverResult = await discoverRoutes( - matches, - location2.pathname, - request.signal - ); + let discoverResult = await discoverRoutes(matches, location.pathname, request.signal); if (discoverResult.type === "aborted") { - return { shortCircuited: true }; + return { + shortCircuited: true + }; } else if (discoverResult.type === "error") { - if (discoverResult.partialMatches.length === 0) { - let { matches: matches2, route } = getShortCircuitMatches(dataRoutes); - return { - matches: matches2, - pendingActionResult: [ - route.id, - { - type: "error", - error: discoverResult.error - } - ] - }; - } let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id; return { matches: discoverResult.partialMatches, - pendingActionResult: [ - boundaryId, - { - type: "error", - error: discoverResult.error - } - ] + pendingActionResult: [boundaryId, { + type: ResultType.error, + error: discoverResult.error + }] }; } else if (!discoverResult.matches) { - let { notFoundMatches, error, route } = handleNavigational404( - location2.pathname - ); + let { + notFoundMatches, + error, + route + } = handleNavigational404(location.pathname); return { matches: notFoundMatches, - pendingActionResult: [ - route.id, - { - type: "error", - error - } - ] + pendingActionResult: [route.id, { + type: ResultType.error, + error + }] }; } else { matches = discoverResult.matches; } } let result; - let actionMatch = getTargetMatch(matches, location2); + let actionMatch = getTargetMatch(matches, location); if (!actionMatch.route.action && !actionMatch.route.lazy) { result = { - type: "error", + type: ResultType.error, error: getInternalRouterError(405, { method: request.method, - pathname: location2.pathname, + pathname: location.pathname, routeId: actionMatch.route.id }) }; } else { - let dsMatches = getTargetedDataStrategyMatches( - mapRouteProperties2, - manifest, - request, - matches, - actionMatch, - initialHydration ? [] : hydrationRouteProperties2, - scopedContext - ); - let results = await callDataStrategy( - request, - dsMatches, - scopedContext, - null - ); + let results = await callDataStrategy("action", state, request, [actionMatch], matches, null); result = results[actionMatch.route.id]; - if (!result) { - for (let match of matches) { - if (results[match.route.id]) { - result = results[match.route.id]; - break; - } - } - } if (request.signal.aborted) { - return { shortCircuited: true }; + return { + shortCircuited: true + }; } } if (isRedirectResult(result)) { @@ -2440,32 +1642,30 @@ function createRouter(init) { if (opts && opts.replace != null) { replace2 = opts.replace; } else { - let location22 = normalizeRedirectLocation( - result.response.headers.get("Location"), - new URL(request.url), - basename, - init.history - ); - replace2 = location22 === state.location.pathname + state.location.search; + let location2 = normalizeRedirectLocation(result.response.headers.get("Location"), new URL(request.url), basename, init.history); + replace2 = location2 === state.location.pathname + state.location.search; } await startRedirectNavigation(request, result, true, { submission, replace: replace2 }); - return { shortCircuited: true }; + return { + shortCircuited: true + }; + } + if (isDeferredResult(result)) { + throw getInternalRouterError(400, { + type: "defer-action" + }); } if (isErrorResult(result)) { let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id); if ((opts && opts.replace) !== true) { - pendingAction = "PUSH"; + pendingAction = Action.Push; } return { matches, - pendingActionResult: [ - boundaryMatch.route.id, - result, - actionMatch.route.id - ] + pendingActionResult: [boundaryMatch.route.id, result] }; } return { @@ -2473,41 +1673,27 @@ function createRouter(init) { pendingActionResult: [actionMatch.route.id, result] }; } - async function handleLoaders(request, location2, matches, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace2, initialHydration, flushSync3, pendingActionResult, callSiteDefaultShouldRevalidate) { - let loadingNavigation = overrideNavigation || getLoadingNavigation(location2, submission); + async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace2, initialHydration, flushSync, pendingActionResult) { + let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission); let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation); - let shouldUpdateNavigationState = !isUninterruptedRevalidation && !initialHydration; + let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration); if (isFogOfWar) { if (shouldUpdateNavigationState) { let actionData = getUpdatedActionData(pendingActionResult); - updateState( - { - navigation: loadingNavigation, - ...actionData !== void 0 ? { actionData } : {} - }, - { - flushSync: flushSync3 - } - ); + updateState(_extends({ + navigation: loadingNavigation + }, actionData !== void 0 ? { + actionData + } : {}), { + flushSync + }); } - let discoverResult = await discoverRoutes( - matches, - location2.pathname, - request.signal - ); + let discoverResult = await discoverRoutes(matches, location.pathname, request.signal); if (discoverResult.type === "aborted") { - return { shortCircuited: true }; + return { + shortCircuited: true + }; } else if (discoverResult.type === "error") { - if (discoverResult.partialMatches.length === 0) { - let { matches: matches2, route } = getShortCircuitMatches(dataRoutes); - return { - matches: matches2, - loaderData: {}, - errors: { - [route.id]: discoverResult.error - } - }; - } let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id; return { matches: discoverResult.partialMatches, @@ -2517,9 +1703,11 @@ function createRouter(init) { } }; } else if (!discoverResult.matches) { - let { error, notFoundMatches, route } = handleNavigational404( - location2.pathname - ); + let { + error, + notFoundMatches, + route + } = handleNavigational404(location.pathname); return { matches: notFoundMatches, loaderData: {}, @@ -2532,47 +1720,26 @@ function createRouter(init) { } } let routesToUse = inFlightDataRoutes || dataRoutes; - let { dsMatches, revalidatingFetchers } = getMatchesToLoad( - request, - scopedContext, - mapRouteProperties2, - manifest, - init.history, - state, - matches, - activeSubmission, - location2, - initialHydration ? [] : hydrationRouteProperties2, - initialHydration === true, - isRevalidationRequired, - cancelledFetcherLoads, - fetchersQueuedForDeletion, - fetchLoadMatches, - fetchRedirectIds, - routesToUse, - basename, - init.patchRoutesOnNavigation != null, - pendingActionResult, - callSiteDefaultShouldRevalidate - ); + let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult); + cancelActiveDeferreds((routeId) => !(matches && matches.some((m) => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some((m) => m.route.id === routeId)); pendingNavigationLoadId = ++incrementingLoadId; - if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some( - (m) => m.route.middleware && m.route.middleware.length > 0 - ) && revalidatingFetchers.length === 0) { + if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) { let updatedFetchers2 = markFetchRedirectsDone(); - completeNavigation( - location2, - { - matches, - loaderData: {}, - // Commit pending error if we're short circuiting - errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null, - ...getActionDataForCommit(pendingActionResult), - ...updatedFetchers2 ? { fetchers: new Map(state.fetchers) } : {} - }, - { flushSync: flushSync3 } - ); - return { shortCircuited: true }; + completeNavigation(location, _extends({ + matches, + loaderData: {}, + // Commit pending error if we're short circuiting + errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { + [pendingActionResult[0]]: pendingActionResult[1].error + } : null + }, getActionDataForCommit(pendingActionResult), updatedFetchers2 ? { + fetchers: new Map(state.fetchers) + } : {}), { + flushSync + }); + return { + shortCircuited: true + }; } if (shouldUpdateNavigationState) { let updates = {}; @@ -2586,7 +1753,9 @@ function createRouter(init) { if (revalidatingFetchers.length > 0) { updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers); } - updateState(updates, { flushSync: flushSync3 }); + updateState(updates, { + flushSync + }); } revalidatingFetchers.forEach((rf) => { abortFetcher(rf.key); @@ -2596,62 +1765,64 @@ function createRouter(init) { }); let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((f) => abortFetcher(f.key)); if (pendingNavigationController) { - pendingNavigationController.signal.addEventListener( - "abort", - abortPendingFetchRevalidations - ); + pendingNavigationController.signal.addEventListener("abort", abortPendingFetchRevalidations); } - let { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData( - dsMatches, - revalidatingFetchers, - request, - scopedContext - ); + let { + loaderResults, + fetcherResults + } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, request); if (request.signal.aborted) { - return { shortCircuited: true }; + return { + shortCircuited: true + }; } if (pendingNavigationController) { - pendingNavigationController.signal.removeEventListener( - "abort", - abortPendingFetchRevalidations - ); + pendingNavigationController.signal.removeEventListener("abort", abortPendingFetchRevalidations); } revalidatingFetchers.forEach((rf) => fetchControllers.delete(rf.key)); - let redirect2 = findRedirect(loaderResults); - if (redirect2) { - await startRedirectNavigation(request, redirect2.result, true, { + let redirect3 = findRedirect(loaderResults); + if (redirect3) { + await startRedirectNavigation(request, redirect3.result, true, { replace: replace2 }); - return { shortCircuited: true }; + return { + shortCircuited: true + }; } - redirect2 = findRedirect(fetcherResults); - if (redirect2) { - fetchRedirectIds.add(redirect2.key); - await startRedirectNavigation(request, redirect2.result, true, { + redirect3 = findRedirect(fetcherResults); + if (redirect3) { + fetchRedirectIds.add(redirect3.key); + await startRedirectNavigation(request, redirect3.result, true, { replace: replace2 }); - return { shortCircuited: true }; + return { + shortCircuited: true + }; } - let { loaderData, errors } = processLoaderData( - state, - matches, - loaderResults, - pendingActionResult, - revalidatingFetchers, - fetcherResults - ); - if (initialHydration && state.errors) { - errors = { ...state.errors, ...errors }; + let { + loaderData, + errors + } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds); + activeDeferreds.forEach((deferredData, routeId) => { + deferredData.subscribe((aborted) => { + if (aborted || deferredData.done) { + activeDeferreds.delete(routeId); + } + }); + }); + if (future.v7_partialHydration && initialHydration && state.errors) { + errors = _extends({}, state.errors, errors); } let updatedFetchers = markFetchRedirectsDone(); let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId); let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0; - return { + return _extends({ matches, loaderData, - errors, - ...shouldUpdateFetchers ? { fetchers: new Map(state.fetchers) } : {} - }; + errors + }, shouldUpdateFetchers ? { + fetchers: new Map(state.fetchers) + } : {}); } function getUpdatedActionData(pendingActionResult) { if (pendingActionResult && !isErrorResult(pendingActionResult[1])) { @@ -2669,160 +1840,116 @@ function createRouter(init) { function getUpdatedRevalidatingFetchers(revalidatingFetchers) { revalidatingFetchers.forEach((rf) => { let fetcher = state.fetchers.get(rf.key); - let revalidatingFetcher = getLoadingFetcher( - void 0, - fetcher ? fetcher.data : void 0 - ); + let revalidatingFetcher = getLoadingFetcher(void 0, fetcher ? fetcher.data : void 0); state.fetchers.set(rf.key, revalidatingFetcher); }); return new Map(state.fetchers); } - async function fetch2(key, routeId, href2, opts) { + function fetch(key, routeId, href, opts) { + if (isServer) { + throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback."); + } abortFetcher(key); - let flushSync3 = (opts && opts.flushSync) === true; + let flushSync = (opts && opts.flushSync) === true; let routesToUse = inFlightDataRoutes || dataRoutes; - let normalizedPath = normalizeTo( - state.location, - state.matches, - basename, - href2, - routeId, - opts == null ? void 0 : opts.relative - ); + let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative); let matches = matchRoutes(routesToUse, normalizedPath, basename); let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath); if (fogOfWar.active && fogOfWar.matches) { matches = fogOfWar.matches; } if (!matches) { - setFetcherError( - key, - routeId, - getInternalRouterError(404, { pathname: normalizedPath }), - { flushSync: flushSync3 } - ); + setFetcherError(key, routeId, getInternalRouterError(404, { + pathname: normalizedPath + }), { + flushSync + }); return; } - let { path, submission, error } = normalizeNavigateOptions( - true, - normalizedPath, - opts - ); + let { + path, + submission, + error + } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts); if (error) { - setFetcherError(key, routeId, error, { flushSync: flushSync3 }); + setFetcherError(key, routeId, error, { + flushSync + }); return; } - let scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider(); + let match = getTargetMatch(matches, path); let preventScrollReset = (opts && opts.preventScrollReset) === true; if (submission && isMutationMethod(submission.formMethod)) { - await handleFetcherAction( - key, - routeId, - path, - matches, - scopedContext, - fogOfWar.active, - flushSync3, - preventScrollReset, - submission, - opts && opts.unstable_defaultShouldRevalidate - ); + handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission); return; } - fetchLoadMatches.set(key, { routeId, path }); - await handleFetcherLoader( - key, + fetchLoadMatches.set(key, { routeId, - path, - matches, - scopedContext, - fogOfWar.active, - flushSync3, - preventScrollReset, - submission - ); + path + }); + handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission); } - async function handleFetcherAction(key, routeId, path, requestMatches, scopedContext, isFogOfWar, flushSync3, preventScrollReset, submission, callSiteDefaultShouldRevalidate) { + async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, preventScrollReset, submission) { interruptActiveLoads(); fetchLoadMatches.delete(key); + function detectAndHandle405Error(m) { + if (!m.route.action && !m.route.lazy) { + let error = getInternalRouterError(405, { + method: submission.formMethod, + pathname: path, + routeId + }); + setFetcherError(key, routeId, error, { + flushSync + }); + return true; + } + return false; + } + if (!isFogOfWar && detectAndHandle405Error(match)) { + return; + } let existingFetcher = state.fetchers.get(key); updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), { - flushSync: flushSync3 + flushSync }); let abortController = new AbortController(); - let fetchRequest = createClientSideRequest( - init.history, - path, - abortController.signal, - submission - ); + let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission); if (isFogOfWar) { - let discoverResult = await discoverRoutes( - requestMatches, - new URL(fetchRequest.url).pathname, - fetchRequest.signal, - key - ); + let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key); if (discoverResult.type === "aborted") { return; } else if (discoverResult.type === "error") { - setFetcherError(key, routeId, discoverResult.error, { flushSync: flushSync3 }); + setFetcherError(key, routeId, discoverResult.error, { + flushSync + }); return; } else if (!discoverResult.matches) { - setFetcherError( - key, - routeId, - getInternalRouterError(404, { pathname: path }), - { flushSync: flushSync3 } - ); + setFetcherError(key, routeId, getInternalRouterError(404, { + pathname: path + }), { + flushSync + }); return; } else { requestMatches = discoverResult.matches; - } - } - let match = getTargetMatch(requestMatches, path); - if (!match.route.action && !match.route.lazy) { - let error = getInternalRouterError(405, { - method: submission.formMethod, - pathname: path, - routeId - }); - setFetcherError(key, routeId, error, { flushSync: flushSync3 }); - return; - } - fetchControllers.set(key, abortController); - let originatingLoadId = incrementingLoadId; - let fetchMatches = getTargetedDataStrategyMatches( - mapRouteProperties2, - manifest, - fetchRequest, - requestMatches, - match, - hydrationRouteProperties2, - scopedContext - ); - let actionResults = await callDataStrategy( - fetchRequest, - fetchMatches, - scopedContext, - key - ); - let actionResult = actionResults[match.route.id]; - if (!actionResult) { - for (let match2 of fetchMatches) { - if (actionResults[match2.route.id]) { - actionResult = actionResults[match2.route.id]; - break; + match = getTargetMatch(requestMatches, path); + if (detectAndHandle405Error(match)) { + return; } } } + fetchControllers.set(key, abortController); + let originatingLoadId = incrementingLoadId; + let actionResults = await callDataStrategy("action", state, fetchRequest, [match], requestMatches, key); + let actionResult = actionResults[match.route.id]; if (fetchRequest.signal.aborted) { if (fetchControllers.get(key) === abortController) { fetchControllers.delete(key); } return; } - if (fetchersQueuedForDeletion.has(key)) { + if (future.v7_fetcherPersist && deletedFetchers.has(key)) { if (isRedirectResult(actionResult) || isErrorResult(actionResult)) { updateFetcherState(key, getDoneFetcher(void 0)); return; @@ -2847,12 +1974,13 @@ function createRouter(init) { return; } } + if (isDeferredResult(actionResult)) { + throw getInternalRouterError(400, { + type: "defer-action" + }); + } let nextLocation = state.navigation.location || state.location; - let revalidationRequest = createClientSideRequest( - init.history, - nextLocation, - abortController.signal - ); + let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal); let routesToUse = inFlightDataRoutes || dataRoutes; let matches = state.navigation.state !== "idle" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches; invariant(matches, "Didn't find any matches after fetcher action"); @@ -2860,95 +1988,54 @@ function createRouter(init) { fetchReloadIds.set(key, loadId); let loadFetcher = getLoadingFetcher(submission, actionResult.data); state.fetchers.set(key, loadFetcher); - let { dsMatches, revalidatingFetchers } = getMatchesToLoad( - revalidationRequest, - scopedContext, - mapRouteProperties2, - manifest, - init.history, - state, - matches, - submission, - nextLocation, - hydrationRouteProperties2, - false, - isRevalidationRequired, - cancelledFetcherLoads, - fetchersQueuedForDeletion, - fetchLoadMatches, - fetchRedirectIds, - routesToUse, - basename, - init.patchRoutesOnNavigation != null, - [match.route.id, actionResult], - callSiteDefaultShouldRevalidate - ); + let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]); revalidatingFetchers.filter((rf) => rf.key !== key).forEach((rf) => { let staleKey = rf.key; let existingFetcher2 = state.fetchers.get(staleKey); - let revalidatingFetcher = getLoadingFetcher( - void 0, - existingFetcher2 ? existingFetcher2.data : void 0 - ); + let revalidatingFetcher = getLoadingFetcher(void 0, existingFetcher2 ? existingFetcher2.data : void 0); state.fetchers.set(staleKey, revalidatingFetcher); abortFetcher(staleKey); if (rf.controller) { fetchControllers.set(staleKey, rf.controller); } }); - updateState({ fetchers: new Map(state.fetchers) }); + updateState({ + fetchers: new Map(state.fetchers) + }); let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((rf) => abortFetcher(rf.key)); - abortController.signal.addEventListener( - "abort", - abortPendingFetchRevalidations - ); - let { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData( - dsMatches, - revalidatingFetchers, - revalidationRequest, - scopedContext - ); + abortController.signal.addEventListener("abort", abortPendingFetchRevalidations); + let { + loaderResults, + fetcherResults + } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, revalidationRequest); if (abortController.signal.aborted) { return; } - abortController.signal.removeEventListener( - "abort", - abortPendingFetchRevalidations - ); + abortController.signal.removeEventListener("abort", abortPendingFetchRevalidations); fetchReloadIds.delete(key); fetchControllers.delete(key); revalidatingFetchers.forEach((r) => fetchControllers.delete(r.key)); + let redirect3 = findRedirect(loaderResults); + if (redirect3) { + return startRedirectNavigation(revalidationRequest, redirect3.result, false, { + preventScrollReset + }); + } + redirect3 = findRedirect(fetcherResults); + if (redirect3) { + fetchRedirectIds.add(redirect3.key); + return startRedirectNavigation(revalidationRequest, redirect3.result, false, { + preventScrollReset + }); + } + let { + loaderData, + errors + } = processLoaderData(state, matches, loaderResults, void 0, revalidatingFetchers, fetcherResults, activeDeferreds); if (state.fetchers.has(key)) { let doneFetcher = getDoneFetcher(actionResult.data); state.fetchers.set(key, doneFetcher); } - let redirect2 = findRedirect(loaderResults); - if (redirect2) { - return startRedirectNavigation( - revalidationRequest, - redirect2.result, - false, - { preventScrollReset } - ); - } - redirect2 = findRedirect(fetcherResults); - if (redirect2) { - fetchRedirectIds.add(redirect2.key); - return startRedirectNavigation( - revalidationRequest, - redirect2.result, - false, - { preventScrollReset } - ); - } - let { loaderData, errors } = processLoaderData( - state, - matches, - loaderResults, - void 0, - revalidatingFetchers, - fetcherResults - ); abortStaleFetchLoads(loadId); if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) { invariant(pendingAction, "Expected pending action"); @@ -2962,83 +2049,54 @@ function createRouter(init) { } else { updateState({ errors, - loaderData: mergeLoaderData( - state.loaderData, - loaderData, - matches, - errors - ), + loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors), fetchers: new Map(state.fetchers) }); isRevalidationRequired = false; } } - async function handleFetcherLoader(key, routeId, path, matches, scopedContext, isFogOfWar, flushSync3, preventScrollReset, submission) { + async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, preventScrollReset, submission) { let existingFetcher = state.fetchers.get(key); - updateFetcherState( - key, - getLoadingFetcher( - submission, - existingFetcher ? existingFetcher.data : void 0 - ), - { flushSync: flushSync3 } - ); + updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : void 0), { + flushSync + }); let abortController = new AbortController(); - let fetchRequest = createClientSideRequest( - init.history, - path, - abortController.signal - ); + let fetchRequest = createClientSideRequest(init.history, path, abortController.signal); if (isFogOfWar) { - let discoverResult = await discoverRoutes( - matches, - new URL(fetchRequest.url).pathname, - fetchRequest.signal, - key - ); + let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key); if (discoverResult.type === "aborted") { return; } else if (discoverResult.type === "error") { - setFetcherError(key, routeId, discoverResult.error, { flushSync: flushSync3 }); + setFetcherError(key, routeId, discoverResult.error, { + flushSync + }); return; } else if (!discoverResult.matches) { - setFetcherError( - key, - routeId, - getInternalRouterError(404, { pathname: path }), - { flushSync: flushSync3 } - ); + setFetcherError(key, routeId, getInternalRouterError(404, { + pathname: path + }), { + flushSync + }); return; } else { matches = discoverResult.matches; + match = getTargetMatch(matches, path); } } - let match = getTargetMatch(matches, path); fetchControllers.set(key, abortController); let originatingLoadId = incrementingLoadId; - let dsMatches = getTargetedDataStrategyMatches( - mapRouteProperties2, - manifest, - fetchRequest, - matches, - match, - hydrationRouteProperties2, - scopedContext - ); - let results = await callDataStrategy( - fetchRequest, - dsMatches, - scopedContext, - key - ); + let results = await callDataStrategy("loader", state, fetchRequest, [match], matches, key); let result = results[match.route.id]; + if (isDeferredResult(result)) { + result = await resolveDeferredData(result, fetchRequest.signal, true) || result; + } if (fetchControllers.get(key) === abortController) { fetchControllers.delete(key); } if (fetchRequest.signal.aborted) { return; } - if (fetchersQueuedForDeletion.has(key)) { + if (deletedFetchers.has(key)) { updateFetcherState(key, getDoneFetcher(void 0)); return; } @@ -3058,74 +2116,67 @@ function createRouter(init) { setFetcherError(key, routeId, result.error); return; } + invariant(!isDeferredResult(result), "Unhandled fetcher deferred data"); updateFetcherState(key, getDoneFetcher(result.data)); } - async function startRedirectNavigation(request, redirect2, isNavigation, { - submission, - fetcherSubmission, - preventScrollReset, - replace: replace2 - } = {}) { - if (!isNavigation) { - pendingPopstateNavigationDfd == null ? void 0 : pendingPopstateNavigationDfd.resolve(); - pendingPopstateNavigationDfd = null; - } - if (redirect2.response.headers.has("X-Remix-Revalidate")) { + async function startRedirectNavigation(request, redirect3, isNavigation, _temp2) { + let { + submission, + fetcherSubmission, + preventScrollReset, + replace: replace2 + } = _temp2 === void 0 ? {} : _temp2; + if (redirect3.response.headers.has("X-Remix-Revalidate")) { isRevalidationRequired = true; } - let location2 = redirect2.response.headers.get("Location"); - invariant(location2, "Expected a Location header on the redirect Response"); - location2 = normalizeRedirectLocation( - location2, - new URL(request.url), - basename, - init.history - ); - let redirectLocation = createLocation(state.location, location2, { + let location = redirect3.response.headers.get("Location"); + invariant(location, "Expected a Location header on the redirect Response"); + location = normalizeRedirectLocation(location, new URL(request.url), basename, init.history); + let redirectLocation = createLocation(state.location, location, { _isRedirect: true }); - if (isBrowser3) { + if (isBrowser2) { let isDocumentReload = false; - if (redirect2.response.headers.has("X-Remix-Reload-Document")) { + if (redirect3.response.headers.has("X-Remix-Reload-Document")) { isDocumentReload = true; - } else if (isAbsoluteUrl(location2)) { - const url = createBrowserURLImpl(location2, true); + } else if (ABSOLUTE_URL_REGEX.test(location)) { + const url = init.history.createURL(location); isDocumentReload = // Hard reload if it's an absolute URL to a new origin url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename stripBasename(url.pathname, basename) == null; } if (isDocumentReload) { if (replace2) { - routerWindow.location.replace(location2); + routerWindow.location.replace(location); } else { - routerWindow.location.assign(location2); + routerWindow.location.assign(location); } return; } } pendingNavigationController = null; - let redirectNavigationType = replace2 === true || redirect2.response.headers.has("X-Remix-Replace") ? "REPLACE" : "PUSH"; - let { formMethod, formAction, formEncType } = state.navigation; + let redirectHistoryAction = replace2 === true || redirect3.response.headers.has("X-Remix-Replace") ? Action.Replace : Action.Push; + let { + formMethod, + formAction, + formEncType + } = state.navigation; if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) { submission = getSubmissionFromNavigation(state.navigation); } let activeSubmission = submission || fetcherSubmission; - if (redirectPreserveMethodStatusCodes.has(redirect2.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) { - await startNavigation(redirectNavigationType, redirectLocation, { - submission: { - ...activeSubmission, - formAction: location2 - }, + if (redirectPreserveMethodStatusCodes.has(redirect3.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) { + await startNavigation(redirectHistoryAction, redirectLocation, { + submission: _extends({}, activeSubmission, { + formAction: location + }), // Preserve these flags across redirects preventScrollReset: preventScrollReset || pendingPreventScrollReset, enableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0 }); } else { - let overrideNavigation = getLoadingNavigation( - redirectLocation, - submission - ); - await startNavigation(redirectNavigationType, redirectLocation, { + let overrideNavigation = getLoadingNavigation(redirectLocation, submission); + await startNavigation(redirectHistoryAction, redirectLocation, { overrideNavigation, // Send fetcher submissions through for shouldRevalidate fetcherSubmission, @@ -3135,58 +2186,26 @@ function createRouter(init) { }); } } - async function callDataStrategy(request, matches, scopedContext, fetcherKey) { - var _a; + async function callDataStrategy(type, state2, request, matchesToLoad, matches, fetcherKey) { let results; let dataResults = {}; try { - results = await callDataStrategyImpl( - dataStrategyImpl, - request, - matches, - fetcherKey, - scopedContext, - false - ); + results = await callDataStrategyImpl(dataStrategyImpl, type, state2, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties2); } catch (e) { - matches.filter((m) => m.shouldLoad).forEach((m) => { + matchesToLoad.forEach((m) => { dataResults[m.route.id] = { - type: "error", + type: ResultType.error, error: e }; }); return dataResults; } - if (request.signal.aborted) { - return dataResults; - } - if (!isMutationMethod(request.method)) { - for (let match of matches) { - if (((_a = results[match.route.id]) == null ? void 0 : _a.type) === "error") { - break; - } - if (!results.hasOwnProperty(match.route.id) && !state.loaderData.hasOwnProperty(match.route.id) && (!state.errors || !state.errors.hasOwnProperty(match.route.id)) && match.shouldCallHandler()) { - results[match.route.id] = { - type: "error", - result: new Error( - `No result returned from dataStrategy for route ${match.route.id}` - ) - }; - } - } - } for (let [routeId, result] of Object.entries(results)) { - if (isRedirectDataStrategyResult(result)) { + if (isRedirectDataStrategyResultResult(result)) { let response = result.result; dataResults[routeId] = { - type: "redirect", - response: normalizeRelativeRoutingRedirectResponse( - response, - request, - routeId, - matches, - basename - ) + type: ResultType.redirect, + response: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, future.v7_relativeSplatPath) }; } else { dataResults[routeId] = await convertDataStrategyResultToDataResult(result); @@ -3194,41 +2213,30 @@ function createRouter(init) { } return dataResults; } - async function callLoadersAndMaybeResolveData(matches, fetchersToLoad, request, scopedContext) { - let loaderResultsPromise = callDataStrategy( - request, - matches, - scopedContext, - null - ); - let fetcherResultsPromise = Promise.all( - fetchersToLoad.map(async (f) => { - if (f.matches && f.match && f.request && f.controller) { - let results = await callDataStrategy( - f.request, - f.matches, - scopedContext, - f.key - ); - let result = results[f.match.route.id]; - return { [f.key]: result }; - } else { - return Promise.resolve({ - [f.key]: { - type: "error", - error: getInternalRouterError(404, { - pathname: f.path - }) - } - }); - } - }) - ); + async function callLoadersAndMaybeResolveData(state2, matches, matchesToLoad, fetchersToLoad, request) { + let currentMatches = state2.matches; + let loaderResultsPromise = callDataStrategy("loader", state2, request, matchesToLoad, matches, null); + let fetcherResultsPromise = Promise.all(fetchersToLoad.map(async (f) => { + if (f.matches && f.match && f.controller) { + let results = await callDataStrategy("loader", state2, createClientSideRequest(init.history, f.path, f.controller.signal), [f.match], f.matches, f.key); + let result = results[f.match.route.id]; + return { + [f.key]: result + }; + } else { + return Promise.resolve({ + [f.key]: { + type: ResultType.error, + error: getInternalRouterError(404, { + pathname: f.path + }) + } + }); + } + })); let loaderResults = await loaderResultsPromise; - let fetcherResults = (await fetcherResultsPromise).reduce( - (acc, r) => Object.assign(acc, r), - {} - ); + let fetcherResults = (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {}); + await Promise.all([resolveNavigationDeferredResults(matches, loaderResults, request.signal, currentMatches, state2.loaderData), resolveFetcherDeferredResults(matches, fetcherResults, fetchersToLoad)]); return { loaderResults, fetcherResults @@ -3236,6 +2244,7 @@ function createRouter(init) { } function interruptActiveLoads() { isRevalidationRequired = true; + cancelledDeferredRoutes.push(...cancelActiveDeferreds()); fetchLoadMatches.forEach((_, key) => { if (fetchControllers.has(key)) { cancelledFetcherLoads.add(key); @@ -3243,37 +2252,39 @@ function createRouter(init) { abortFetcher(key); }); } - function updateFetcherState(key, fetcher, opts = {}) { + function updateFetcherState(key, fetcher, opts) { + if (opts === void 0) { + opts = {}; + } state.fetchers.set(key, fetcher); - updateState( - { fetchers: new Map(state.fetchers) }, - { flushSync: (opts && opts.flushSync) === true } - ); + updateState({ + fetchers: new Map(state.fetchers) + }, { + flushSync: (opts && opts.flushSync) === true + }); } - function setFetcherError(key, routeId, error, opts = {}) { + function setFetcherError(key, routeId, error, opts) { + if (opts === void 0) { + opts = {}; + } let boundaryMatch = findNearestBoundary(state.matches, routeId); deleteFetcher(key); - updateState( - { - errors: { - [boundaryMatch.route.id]: error - }, - fetchers: new Map(state.fetchers) + updateState({ + errors: { + [boundaryMatch.route.id]: error }, - { flushSync: (opts && opts.flushSync) === true } - ); + fetchers: new Map(state.fetchers) + }, { + flushSync: (opts && opts.flushSync) === true + }); } function getFetcher(key) { activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1); - if (fetchersQueuedForDeletion.has(key)) { - fetchersQueuedForDeletion.delete(key); + if (deletedFetchers.has(key)) { + deletedFetchers.delete(key); } return state.fetchers.get(key) || IDLE_FETCHER; } - function resetFetcher(key, opts) { - abortFetcher(key, opts == null ? void 0 : opts.reason); - updateFetcherState(key, getDoneFetcher(null)); - } function deleteFetcher(key) { let fetcher = state.fetchers.get(key); if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) { @@ -3282,24 +2293,31 @@ function createRouter(init) { fetchLoadMatches.delete(key); fetchReloadIds.delete(key); fetchRedirectIds.delete(key); - fetchersQueuedForDeletion.delete(key); + if (future.v7_fetcherPersist) { + deletedFetchers.delete(key); + } cancelledFetcherLoads.delete(key); state.fetchers.delete(key); } - function queueFetcherForDeletion(key) { + function deleteFetcherAndUpdateState(key) { let count = (activeFetchers.get(key) || 0) - 1; if (count <= 0) { activeFetchers.delete(key); - fetchersQueuedForDeletion.add(key); + deletedFetchers.add(key); + if (!future.v7_fetcherPersist) { + deleteFetcher(key); + } } else { activeFetchers.set(key, count); } - updateState({ fetchers: new Map(state.fetchers) }); + updateState({ + fetchers: new Map(state.fetchers) + }); } - function abortFetcher(key, reason) { + function abortFetcher(key) { let controller = fetchControllers.get(key); if (controller) { - controller.abort(reason); + controller.abort(); fetchControllers.delete(key); } } @@ -3315,7 +2333,7 @@ function createRouter(init) { let updatedFetchers = false; for (let key of fetchRedirectIds) { let fetcher = state.fetchers.get(key); - invariant(fetcher, `Expected fetcher: ${key}`); + invariant(fetcher, "Expected fetcher: " + key); if (fetcher.state === "loading") { fetchRedirectIds.delete(key); doneKeys.push(key); @@ -3330,7 +2348,7 @@ function createRouter(init) { for (let [key, id] of fetchReloadIds) { if (id < landedId) { let fetcher = state.fetchers.get(key); - invariant(fetcher, `Expected fetcher: ${key}`); + invariant(fetcher, "Expected fetcher: " + key); if (fetcher.state === "loading") { abortFetcher(key); fetchReloadIds.delete(key); @@ -3354,19 +2372,19 @@ function createRouter(init) { } function updateBlocker(key, newBlocker) { let blocker = state.blockers.get(key) || IDLE_BLOCKER; - invariant( - blocker.state === "unblocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "proceeding" || blocker.state === "blocked" && newBlocker.state === "unblocked" || blocker.state === "proceeding" && newBlocker.state === "unblocked", - `Invalid blocker state transition: ${blocker.state} -> ${newBlocker.state}` - ); + invariant(blocker.state === "unblocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "blocked" || blocker.state === "blocked" && newBlocker.state === "proceeding" || blocker.state === "blocked" && newBlocker.state === "unblocked" || blocker.state === "proceeding" && newBlocker.state === "unblocked", "Invalid blocker state transition: " + blocker.state + " -> " + newBlocker.state); let blockers = new Map(state.blockers); blockers.set(key, newBlocker); - updateState({ blockers }); + updateState({ + blockers + }); } - function shouldBlockNavigation({ - currentLocation, - nextLocation, - historyAction - }) { + function shouldBlockNavigation(_ref2) { + let { + currentLocation, + nextLocation, + historyAction + } = _ref2; if (blockerFunctions.size === 0) { return; } @@ -3379,52 +2397,76 @@ function createRouter(init) { if (blocker && blocker.state === "proceeding") { return; } - if (blockerFunction({ currentLocation, nextLocation, historyAction })) { + if (blockerFunction({ + currentLocation, + nextLocation, + historyAction + })) { return blockerKey; } } function handleNavigational404(pathname) { - let error = getInternalRouterError(404, { pathname }); + let error = getInternalRouterError(404, { + pathname + }); let routesToUse = inFlightDataRoutes || dataRoutes; - let { matches, route } = getShortCircuitMatches(routesToUse); - return { notFoundMatches: matches, route, error }; + let { + matches, + route + } = getShortCircuitMatches(routesToUse); + cancelActiveDeferreds(); + return { + notFoundMatches: matches, + route, + error + }; + } + function cancelActiveDeferreds(predicate) { + let cancelledRouteIds = []; + activeDeferreds.forEach((dfd, routeId) => { + if (!predicate || predicate(routeId)) { + dfd.cancel(); + cancelledRouteIds.push(routeId); + activeDeferreds.delete(routeId); + } + }); + return cancelledRouteIds; } function enableScrollRestoration(positions, getPosition, getKey) { savedScrollPositions2 = positions; getScrollPosition = getPosition; - getScrollRestorationKey2 = getKey || null; + getScrollRestorationKey = getKey || null; if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) { initialScrollRestored = true; let y = getSavedScrollPosition(state.location, state.matches); if (y != null) { - updateState({ restoreScrollPosition: y }); + updateState({ + restoreScrollPosition: y + }); } } return () => { savedScrollPositions2 = null; getScrollPosition = null; - getScrollRestorationKey2 = null; + getScrollRestorationKey = null; }; } - function getScrollKey(location2, matches) { - if (getScrollRestorationKey2) { - let key = getScrollRestorationKey2( - location2, - matches.map((m) => convertRouteMatchToUiMatch(m, state.loaderData)) - ); - return key || location2.key; + function getScrollKey(location, matches) { + if (getScrollRestorationKey) { + let key = getScrollRestorationKey(location, matches.map((m) => convertRouteMatchToUiMatch(m, state.loaderData))); + return key || location.key; } - return location2.key; + return location.key; } - function saveScrollPosition(location2, matches) { + function saveScrollPosition(location, matches) { if (savedScrollPositions2 && getScrollPosition) { - let key = getScrollKey(location2, matches); + let key = getScrollKey(location, matches); savedScrollPositions2[key] = getScrollPosition(); } } - function getSavedScrollPosition(location2, matches) { + function getSavedScrollPosition(location, matches) { if (savedScrollPositions2) { - let key = getScrollKey(location2, matches); + let key = getScrollKey(location, matches); let y = savedScrollPositions2[key]; if (typeof y === "number") { return y; @@ -3433,32 +2475,34 @@ function createRouter(init) { return null; } function checkFogOfWar(matches, routesToUse, pathname) { - if (init.patchRoutesOnNavigation) { + if (patchRoutesOnNavigationImpl) { if (!matches) { - let fogMatches = matchRoutesImpl( - routesToUse, - pathname, - basename, - true - ); - return { active: true, matches: fogMatches || [] }; + let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true); + return { + active: true, + matches: fogMatches || [] + }; } else { if (Object.keys(matches[0].params).length > 0) { - let partialMatches = matchRoutesImpl( - routesToUse, - pathname, - basename, - true - ); - return { active: true, matches: partialMatches }; + let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true); + return { + active: true, + matches: partialMatches + }; } } } - return { active: false, matches: null }; + return { + active: false, + matches: null + }; } async function discoverRoutes(matches, pathname, signal, fetcherKey) { - if (!init.patchRoutesOnNavigation) { - return { type: "success", matches }; + if (!patchRoutesOnNavigationImpl) { + return { + type: "success", + matches + }; } let partialMatches = matches; while (true) { @@ -3466,97 +2510,63 @@ function createRouter(init) { let routesToUse = inFlightDataRoutes || dataRoutes; let localManifest = manifest; try { - await init.patchRoutesOnNavigation({ + await patchRoutesOnNavigationImpl({ signal, path: pathname, matches: partialMatches, fetcherKey, patch: (routeId, children) => { if (signal.aborted) return; - patchRoutesImpl( - routeId, - children, - routesToUse, - localManifest, - mapRouteProperties2, - false - ); + patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties2); } }); } catch (e) { - return { type: "error", error: e, partialMatches }; + return { + type: "error", + error: e, + partialMatches + }; } finally { if (isNonHMR && !signal.aborted) { dataRoutes = [...dataRoutes]; } } if (signal.aborted) { - return { type: "aborted" }; + return { + type: "aborted" + }; } let newMatches = matchRoutes(routesToUse, pathname, basename); - let newPartialMatches = null; if (newMatches) { - if (Object.keys(newMatches[0].params).length === 0) { - return { type: "success", matches: newMatches }; - } else { - newPartialMatches = matchRoutesImpl( - routesToUse, - pathname, - basename, - true - ); - let matchedDeeper = newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches( - partialMatches, - newPartialMatches.slice(0, partialMatches.length) - ); - if (!matchedDeeper) { - return { type: "success", matches: newMatches }; - } - } + return { + type: "success", + matches: newMatches + }; } - if (!newPartialMatches) { - newPartialMatches = matchRoutesImpl( - routesToUse, - pathname, - basename, - true - ); - } - if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) { - return { type: "success", matches: null }; + let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true); + if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every((m, i) => m.route.id === newPartialMatches[i].route.id)) { + return { + type: "success", + matches: null + }; } partialMatches = newPartialMatches; } } - function compareMatches(a, b) { - return a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id); - } function _internalSetRoutes(newRoutes) { manifest = {}; - inFlightDataRoutes = convertRoutesToDataRoutes( - newRoutes, - mapRouteProperties2, - void 0, - manifest - ); + inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties2, void 0, manifest); } - function patchRoutes(routeId, children, unstable_allowElementMutations = false) { + function patchRoutes(routeId, children) { let isNonHMR = inFlightDataRoutes == null; let routesToUse = inFlightDataRoutes || dataRoutes; - patchRoutesImpl( - routeId, - children, - routesToUse, - manifest, - mapRouteProperties2, - unstable_allowElementMutations - ); + patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2); if (isNonHMR) { dataRoutes = [...dataRoutes]; updateState({}); } } - router2 = { + router = { get basename() { return basename; }, @@ -3576,674 +2586,31 @@ function createRouter(init) { subscribe, enableScrollRestoration, navigate, - fetch: fetch2, + fetch, revalidate, // Passthrough to history-aware createHref used by useHref so we get proper // hash-aware URLs in DOM paths createHref: (to) => init.history.createHref(to), encodeLocation: (to) => init.history.encodeLocation(to), getFetcher, - resetFetcher, - deleteFetcher: queueFetcherForDeletion, + deleteFetcher: deleteFetcherAndUpdateState, dispose, getBlocker, deleteBlocker, patchRoutes, _internalFetchControllers: fetchControllers, + _internalActiveDeferreds: activeDeferreds, // TODO: Remove setRoutes, it's temporary to avoid dealing with // updating the tree while validating the update algorithm. - _internalSetRoutes, - _internalSetStateDoNotUseOrYouWillBreakYourApp(newState) { - updateState(newState); - } + _internalSetRoutes }; - if (init.unstable_instrumentations) { - router2 = instrumentClientSideRouter( - router2, - init.unstable_instrumentations.map((i) => i.router).filter(Boolean) - ); - } - return router2; -} -function createStaticHandler(routes, opts) { - invariant( - routes.length > 0, - "You must provide a non-empty routes array to createStaticHandler" - ); - let manifest = {}; - let basename = (opts ? opts.basename : null) || "/"; - let _mapRouteProperties = (opts == null ? void 0 : opts.mapRouteProperties) || defaultMapRouteProperties; - let mapRouteProperties2 = _mapRouteProperties; - if (opts == null ? void 0 : opts.unstable_instrumentations) { - let instrumentations = opts.unstable_instrumentations; - mapRouteProperties2 = (route) => { - return { - ..._mapRouteProperties(route), - ...getRouteInstrumentationUpdates( - instrumentations.map((i) => i.route).filter(Boolean), - route - ) - }; - }; - } - let dataRoutes = convertRoutesToDataRoutes( - routes, - mapRouteProperties2, - void 0, - manifest - ); - async function query(request, { - requestContext, - filterMatchesToLoad, - skipLoaderErrorBubbling, - skipRevalidation, - dataStrategy, - generateMiddlewareResponse - } = {}) { - let url = new URL(request.url); - let method = request.method; - let location2 = createLocation("", createPath(url), null, "default"); - let matches = matchRoutes(dataRoutes, location2, basename); - requestContext = requestContext != null ? requestContext : new RouterContextProvider(); - if (!isValidMethod(method) && method !== "HEAD") { - let error = getInternalRouterError(405, { method }); - let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes); - let staticContext = { - basename, - location: location2, - matches: methodNotAllowedMatches, - loaderData: {}, - actionData: null, - errors: { - [route.id]: error - }, - statusCode: error.status, - loaderHeaders: {}, - actionHeaders: {} - }; - return generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext; - } else if (!matches) { - let error = getInternalRouterError(404, { pathname: location2.pathname }); - let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes); - let staticContext = { - basename, - location: location2, - matches: notFoundMatches, - loaderData: {}, - actionData: null, - errors: { - [route.id]: error - }, - statusCode: error.status, - loaderHeaders: {}, - actionHeaders: {} - }; - return generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext; - } - if (generateMiddlewareResponse) { - invariant( - requestContext instanceof RouterContextProvider, - "When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`" - ); - try { - await loadLazyMiddlewareForMatches( - matches, - manifest, - mapRouteProperties2 - ); - let renderedStaticContext; - let response = await runServerMiddlewarePipeline( - { - request, - unstable_pattern: getRoutePattern(matches), - matches, - params: matches[0].params, - // If we're calling middleware then it must be enabled so we can cast - // this to the proper type knowing it's not an `AppLoadContext` - context: requestContext - }, - async () => { - let res = await generateMiddlewareResponse( - async (revalidationRequest, opts2 = {}) => { - let result2 = await queryImpl( - revalidationRequest, - location2, - matches, - requestContext, - dataStrategy || null, - skipLoaderErrorBubbling === true, - null, - "filterMatchesToLoad" in opts2 ? opts2.filterMatchesToLoad ?? null : filterMatchesToLoad ?? null, - skipRevalidation === true - ); - if (isResponse(result2)) { - return result2; - } - renderedStaticContext = { location: location2, basename, ...result2 }; - return renderedStaticContext; - } - ); - return res; - }, - async (error, routeId) => { - var _a; - if (isRedirectResponse(error)) { - return error; - } - if (isResponse(error)) { - try { - error = new ErrorResponseImpl( - error.status, - error.statusText, - await parseResponseBody(error) - ); - } catch (e) { - error = e; - } - } - if (isDataWithResponseInit(error)) { - error = dataWithResponseInitToErrorResponse(error); - } - if (renderedStaticContext) { - if (routeId in renderedStaticContext.loaderData) { - renderedStaticContext.loaderData[routeId] = void 0; - } - let staticContext = getStaticContextFromError( - dataRoutes, - renderedStaticContext, - error, - skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id - ); - return generateMiddlewareResponse( - () => Promise.resolve(staticContext) - ); - } else { - let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary( - matches, - ((_a = matches.find( - (m) => m.route.id === routeId || m.route.loader - )) == null ? void 0 : _a.route.id) || routeId - ).route.id; - let staticContext = { - matches, - location: location2, - basename, - loaderData: {}, - actionData: null, - errors: { - [boundaryRouteId]: error - }, - statusCode: isRouteErrorResponse(error) ? error.status : 500, - actionHeaders: {}, - loaderHeaders: {} - }; - return generateMiddlewareResponse( - () => Promise.resolve(staticContext) - ); - } - } - ); - invariant(isResponse(response), "Expected a response in query()"); - return response; - } catch (e) { - if (isResponse(e)) { - return e; - } - throw e; - } - } - let result = await queryImpl( - request, - location2, - matches, - requestContext, - dataStrategy || null, - skipLoaderErrorBubbling === true, - null, - filterMatchesToLoad || null, - skipRevalidation === true - ); - if (isResponse(result)) { - return result; - } - return { location: location2, basename, ...result }; - } - async function queryRoute(request, { - routeId, - requestContext, - dataStrategy, - generateMiddlewareResponse - } = {}) { - let url = new URL(request.url); - let method = request.method; - let location2 = createLocation("", createPath(url), null, "default"); - let matches = matchRoutes(dataRoutes, location2, basename); - requestContext = requestContext != null ? requestContext : new RouterContextProvider(); - if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") { - throw getInternalRouterError(405, { method }); - } else if (!matches) { - throw getInternalRouterError(404, { pathname: location2.pathname }); - } - let match = routeId ? matches.find((m) => m.route.id === routeId) : getTargetMatch(matches, location2); - if (routeId && !match) { - throw getInternalRouterError(403, { - pathname: location2.pathname, - routeId - }); - } else if (!match) { - throw getInternalRouterError(404, { pathname: location2.pathname }); - } - if (generateMiddlewareResponse) { - invariant( - requestContext instanceof RouterContextProvider, - "When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`" - ); - await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2); - let response = await runServerMiddlewarePipeline( - { - request, - unstable_pattern: getRoutePattern(matches), - matches, - params: matches[0].params, - // If we're calling middleware then it must be enabled so we can cast - // this to the proper type knowing it's not an `AppLoadContext` - context: requestContext - }, - async () => { - let res = await generateMiddlewareResponse( - async (innerRequest) => { - let result2 = await queryImpl( - innerRequest, - location2, - matches, - requestContext, - dataStrategy || null, - false, - match, - null, - false - ); - let processed = handleQueryResult(result2); - return isResponse(processed) ? processed : typeof processed === "string" ? new Response(processed) : Response.json(processed); - } - ); - return res; - }, - (error) => { - if (isDataWithResponseInit(error)) { - return Promise.resolve(dataWithResponseInitToResponse(error)); - } - if (isResponse(error)) { - return Promise.resolve(error); - } - throw error; - } - ); - return response; - } - let result = await queryImpl( - request, - location2, - matches, - requestContext, - dataStrategy || null, - false, - match, - null, - false - ); - return handleQueryResult(result); - function handleQueryResult(result2) { - if (isResponse(result2)) { - return result2; - } - let error = result2.errors ? Object.values(result2.errors)[0] : void 0; - if (error !== void 0) { - throw error; - } - if (result2.actionData) { - return Object.values(result2.actionData)[0]; - } - if (result2.loaderData) { - return Object.values(result2.loaderData)[0]; - } - return void 0; - } - } - async function queryImpl(request, location2, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, skipRevalidation) { - invariant( - request.signal, - "query()/queryRoute() requests must contain an AbortController signal" - ); - try { - if (isMutationMethod(request.method)) { - let result2 = await submit( - request, - matches, - routeMatch || getTargetMatch(matches, location2), - requestContext, - dataStrategy, - skipLoaderErrorBubbling, - routeMatch != null, - filterMatchesToLoad, - skipRevalidation - ); - return result2; - } - let result = await loadRouteData( - request, - matches, - requestContext, - dataStrategy, - skipLoaderErrorBubbling, - routeMatch, - filterMatchesToLoad - ); - return isResponse(result) ? result : { - ...result, - actionData: null, - actionHeaders: {} - }; - } catch (e) { - if (isDataStrategyResult(e) && isResponse(e.result)) { - if (e.type === "error") { - throw e.result; - } - return e.result; - } - if (isRedirectResponse(e)) { - return e; - } - throw e; - } - } - async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) { - let result; - if (!actionMatch.route.action && !actionMatch.route.lazy) { - let error = getInternalRouterError(405, { - method: request.method, - pathname: new URL(request.url).pathname, - routeId: actionMatch.route.id - }); - if (isRouteRequest) { - throw error; - } - result = { - type: "error", - error - }; - } else { - let dsMatches = getTargetedDataStrategyMatches( - mapRouteProperties2, - manifest, - request, - matches, - actionMatch, - [], - requestContext - ); - let results = await callDataStrategy( - request, - dsMatches, - isRouteRequest, - requestContext, - dataStrategy - ); - result = results[actionMatch.route.id]; - if (request.signal.aborted) { - throwStaticHandlerAbortedError(request, isRouteRequest); - } - } - if (isRedirectResult(result)) { - throw new Response(null, { - status: result.response.status, - headers: { - Location: result.response.headers.get("Location") - } - }); - } - if (isRouteRequest) { - if (isErrorResult(result)) { - throw result.error; - } - return { - matches: [actionMatch], - loaderData: {}, - actionData: { [actionMatch.route.id]: result.data }, - errors: null, - // Note: statusCode + headers are unused here since queryRoute will - // return the raw Response or value - statusCode: 200, - loaderHeaders: {}, - actionHeaders: {} - }; - } - if (skipRevalidation) { - if (isErrorResult(result)) { - let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id); - return { - statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500, - actionData: null, - actionHeaders: { - ...result.headers ? { [actionMatch.route.id]: result.headers } : {} - }, - matches, - loaderData: {}, - errors: { - [boundaryMatch.route.id]: result.error - }, - loaderHeaders: {} - }; - } else { - return { - actionData: { - [actionMatch.route.id]: result.data - }, - actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {}, - matches, - loaderData: {}, - errors: null, - statusCode: result.statusCode || 200, - loaderHeaders: {} - }; - } - } - let loaderRequest = new Request(request.url, { - headers: request.headers, - redirect: request.redirect, - signal: request.signal - }); - if (isErrorResult(result)) { - let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id); - let handlerContext2 = await loadRouteData( - loaderRequest, - matches, - requestContext, - dataStrategy, - skipLoaderErrorBubbling, - null, - filterMatchesToLoad, - [boundaryMatch.route.id, result] - ); - return { - ...handlerContext2, - statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500, - actionData: null, - actionHeaders: { - ...result.headers ? { [actionMatch.route.id]: result.headers } : {} - } - }; - } - let handlerContext = await loadRouteData( - loaderRequest, - matches, - requestContext, - dataStrategy, - skipLoaderErrorBubbling, - null, - filterMatchesToLoad - ); - return { - ...handlerContext, - actionData: { - [actionMatch.route.id]: result.data - }, - // action status codes take precedence over loader status codes - ...result.statusCode ? { statusCode: result.statusCode } : {}, - actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {} - }; - } - async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) { - let isRouteRequest = routeMatch != null; - if (isRouteRequest && !(routeMatch == null ? void 0 : routeMatch.route.loader) && !(routeMatch == null ? void 0 : routeMatch.route.lazy)) { - throw getInternalRouterError(400, { - method: request.method, - pathname: new URL(request.url).pathname, - routeId: routeMatch == null ? void 0 : routeMatch.route.id - }); - } - let dsMatches; - if (routeMatch) { - dsMatches = getTargetedDataStrategyMatches( - mapRouteProperties2, - manifest, - request, - matches, - routeMatch, - [], - requestContext - ); - } else { - let maxIdx = pendingActionResult && isErrorResult(pendingActionResult[1]) ? ( - // Up to but not including the boundary - matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1 - ) : void 0; - let pattern = getRoutePattern(matches); - dsMatches = matches.map((match, index) => { - if (maxIdx != null && index > maxIdx) { - return getDataStrategyMatch( - mapRouteProperties2, - manifest, - request, - pattern, - match, - [], - requestContext, - false - ); - } - return getDataStrategyMatch( - mapRouteProperties2, - manifest, - request, - pattern, - match, - [], - requestContext, - (match.route.loader || match.route.lazy) != null && (!filterMatchesToLoad || filterMatchesToLoad(match)) - ); - }); - } - if (!dataStrategy && !dsMatches.some((m) => m.shouldLoad)) { - return { - matches, - loaderData: {}, - errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { - [pendingActionResult[0]]: pendingActionResult[1].error - } : null, - statusCode: 200, - loaderHeaders: {} - }; - } - let results = await callDataStrategy( - request, - dsMatches, - isRouteRequest, - requestContext, - dataStrategy - ); - if (request.signal.aborted) { - throwStaticHandlerAbortedError(request, isRouteRequest); - } - let handlerContext = processRouteLoaderData( - matches, - results, - pendingActionResult, - true, - skipLoaderErrorBubbling - ); - return { - ...handlerContext, - matches - }; - } - async function callDataStrategy(request, matches, isRouteRequest, requestContext, dataStrategy) { - let results = await callDataStrategyImpl( - dataStrategy || defaultDataStrategy, - request, - matches, - null, - requestContext, - true - ); - let dataResults = {}; - await Promise.all( - matches.map(async (match) => { - if (!(match.route.id in results)) { - return; - } - let result = results[match.route.id]; - if (isRedirectDataStrategyResult(result)) { - let response = result.result; - throw normalizeRelativeRoutingRedirectResponse( - response, - request, - match.route.id, - matches, - basename - ); - } - if (isRouteRequest) { - if (isResponse(result.result)) { - throw result; - } else if (isDataWithResponseInit(result.result)) { - throw dataWithResponseInitToResponse(result.result); - } - } - dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result); - }) - ); - return dataResults; - } - return { - dataRoutes, - query, - queryRoute - }; -} -function getStaticContextFromError(routes, handlerContext, error, boundaryId) { - let errorBoundaryId = boundaryId || handlerContext._deepestRenderedBoundaryId || routes[0].id; - return { - ...handlerContext, - statusCode: isRouteErrorResponse(error) ? error.status : 500, - errors: { - [errorBoundaryId]: error - } - }; -} -function throwStaticHandlerAbortedError(request, isRouteRequest) { - if (request.signal.reason !== void 0) { - throw request.signal.reason; - } - let method = isRouteRequest ? "queryRoute" : "query"; - throw new Error( - `${method}() call aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}` - ); + return router; } +var UNSAFE_DEFERRED_SYMBOL = Symbol("deferred"); function isSubmissionNavigation(opts) { return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== void 0); } -function normalizeTo(location2, matches, basename, to, fromRouteId, relative) { +function normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) { let contextualMatches; let activeRouteMatch; if (fromRouteId) { @@ -4259,15 +2626,10 @@ function normalizeTo(location2, matches, basename, to, fromRouteId, relative) { contextualMatches = matches; activeRouteMatch = matches[matches.length - 1]; } - let path = resolveTo( - to ? to : ".", - getResolveToMatches(contextualMatches), - stripBasename(location2.pathname, basename) || location2.pathname, - relative === "path" - ); + let path = resolveTo(to ? to : ".", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === "path"); if (to == null) { - path.search = location2.search; - path.hash = location2.hash; + path.search = location.search; + path.hash = location.hash; } if ((to == null || to === "" || to === ".") && activeRouteMatch) { let nakedIndex = hasNakedIndexQuery(path.search); @@ -4279,30 +2641,36 @@ function normalizeTo(location2, matches, basename, to, fromRouteId, relative) { params.delete("index"); indexValues.filter((v) => v).forEach((v) => params.append("index", v)); let qs = params.toString(); - path.search = qs ? `?${qs}` : ""; + path.search = qs ? "?" + qs : ""; } } - if (basename !== "/") { - path.pathname = prependBasename({ basename, pathname: path.pathname }); + if (prependBasename && basename !== "/") { + path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]); } return createPath(path); } -function normalizeNavigateOptions(isFetcher, path, opts) { +function normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) { if (!opts || !isSubmissionNavigation(opts)) { - return { path }; + return { + path + }; } if (opts.formMethod && !isValidMethod(opts.formMethod)) { return { path, - error: getInternalRouterError(405, { method: opts.formMethod }) + error: getInternalRouterError(405, { + method: opts.formMethod + }) }; } let getInvalidBodyError = () => ({ path, - error: getInternalRouterError(400, { type: "invalid-body" }) + error: getInternalRouterError(400, { + type: "invalid-body" + }) }); let rawFormMethod = opts.formMethod || "get"; - let formMethod = rawFormMethod.toUpperCase(); + let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase(); let formAction = stripHashFromPath(path); if (opts.body !== void 0) { if (opts.formEncType === "text/plain") { @@ -4311,11 +2679,10 @@ function normalizeNavigateOptions(isFetcher, path, opts) { } let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ? ( // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data - Array.from(opts.body.entries()).reduce( - (acc, [name, value]) => `${acc}${name}=${value} -`, - "" - ) + Array.from(opts.body.entries()).reduce((acc, _ref3) => { + let [name, value] = _ref3; + return "" + acc + name + "=" + value + "\n"; + }, "") ) : String(opts.body); return { path, @@ -4333,7 +2700,7 @@ function normalizeNavigateOptions(isFetcher, path, opts) { return getInvalidBodyError(); } try { - let json = typeof opts.body === "string" ? JSON.parse(opts.body) : opts.body; + let json3 = typeof opts.body === "string" ? JSON.parse(opts.body) : opts.body; return { path, submission: { @@ -4341,7 +2708,7 @@ function normalizeNavigateOptions(isFetcher, path, opts) { formAction, formEncType: opts.formEncType, formData: void 0, - json, + json: json3, text: void 0 } }; @@ -4350,10 +2717,7 @@ function normalizeNavigateOptions(isFetcher, path, opts) { } } } - invariant( - typeof FormData === "function", - "FormData is not available in this environment" - ); + invariant(typeof FormData === "function", "FormData is not available in this environment"); let searchParams; let formData; if (opts.formData) { @@ -4385,210 +2749,136 @@ function normalizeNavigateOptions(isFetcher, path, opts) { text: void 0 }; if (isMutationMethod(submission.formMethod)) { - return { path, submission }; + return { + path, + submission + }; } let parsedPath = parsePath(path); if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) { searchParams.append("index", ""); } - parsedPath.search = `?${searchParams}`; - return { path: createPath(parsedPath), submission }; + parsedPath.search = "?" + searchParams; + return { + path: createPath(parsedPath), + submission + }; } -function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location2, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult, callSiteDefaultShouldRevalidate) { - var _a; +function getLoaderMatchesUntilBoundary(matches, boundaryId, includeBoundary) { + if (includeBoundary === void 0) { + includeBoundary = false; + } + let index = matches.findIndex((m) => m.route.id === boundaryId); + if (index >= 0) { + return matches.slice(0, includeBoundary ? index + 1 : index); + } + return matches; +} +function getMatchesToLoad(history, state, matches, submission, location, initialHydration, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) { let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0; let currentUrl = history.createURL(state.location); - let nextUrl = history.createURL(location2); - let maxIdx; + let nextUrl = history.createURL(location); + let boundaryMatches = matches; if (initialHydration && state.errors) { - let boundaryId = Object.keys(state.errors)[0]; - maxIdx = matches.findIndex((m) => m.route.id === boundaryId); + boundaryMatches = getLoaderMatchesUntilBoundary(matches, Object.keys(state.errors)[0], true); } else if (pendingActionResult && isErrorResult(pendingActionResult[1])) { - let boundaryId = pendingActionResult[0]; - maxIdx = matches.findIndex((m) => m.route.id === boundaryId) - 1; + boundaryMatches = getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]); } let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : void 0; - let shouldSkipRevalidation = actionStatus && actionStatus >= 400; - let baseShouldRevalidateArgs = { - currentUrl, - currentParams: ((_a = state.matches[0]) == null ? void 0 : _a.params) || {}, - nextUrl, - nextParams: matches[0].params, - ...submission, - actionResult, - actionStatus - }; - let pattern = getRoutePattern(matches); - let dsMatches = matches.map((match, index) => { - let { route } = match; - let forceShouldLoad = null; - if (maxIdx != null && index > maxIdx) { - forceShouldLoad = false; - } else if (route.lazy) { - forceShouldLoad = true; - } else if (!routeHasLoaderOrMiddleware(route)) { - forceShouldLoad = false; - } else if (initialHydration) { - forceShouldLoad = shouldLoadRouteOnHydration( - route, - state.loaderData, - state.errors - ); - } else if (isNewLoader(state.loaderData, state.matches[index], match)) { - forceShouldLoad = true; + let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400; + let navigationMatches = boundaryMatches.filter((match, index) => { + let { + route + } = match; + if (route.lazy) { + return true; } - if (forceShouldLoad !== null) { - return getDataStrategyMatch( - mapRouteProperties2, - manifest, - request, - pattern, - match, - lazyRoutePropertiesToSkip, - scopedContext, - forceShouldLoad - ); + if (route.loader == null) { + return false; } - let defaultShouldRevalidate = false; - if (typeof callSiteDefaultShouldRevalidate === "boolean") { - defaultShouldRevalidate = callSiteDefaultShouldRevalidate; - } else if (shouldSkipRevalidation) { - defaultShouldRevalidate = false; - } else if (isRevalidationRequired) { - defaultShouldRevalidate = true; - } else if (currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search) { - defaultShouldRevalidate = true; - } else if (currentUrl.search !== nextUrl.search) { - defaultShouldRevalidate = true; - } else if (isNewRouteInstance(state.matches[index], match)) { - defaultShouldRevalidate = true; + if (initialHydration) { + return shouldLoadRouteOnHydration(route, state.loaderData, state.errors); } - let shouldRevalidateArgs = { - ...baseShouldRevalidateArgs, - defaultShouldRevalidate - }; - let shouldLoad = shouldRevalidateLoader(match, shouldRevalidateArgs); - return getDataStrategyMatch( - mapRouteProperties2, - manifest, - request, - pattern, - match, - lazyRoutePropertiesToSkip, - scopedContext, - shouldLoad, - shouldRevalidateArgs, - callSiteDefaultShouldRevalidate - ); + if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some((id) => id === match.route.id)) { + return true; + } + let currentRouteMatch = state.matches[index]; + let nextRouteMatch = match; + return shouldRevalidateLoader(match, _extends({ + currentUrl, + currentParams: currentRouteMatch.params, + nextUrl, + nextParams: nextRouteMatch.params + }, submission, { + actionResult, + actionStatus, + defaultShouldRevalidate: shouldSkipRevalidation ? false : ( + // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate + isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search || // Search params affect all loaders + currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch) + ) + })); }); let revalidatingFetchers = []; fetchLoadMatches.forEach((f, key) => { - if (initialHydration || !matches.some((m) => m.route.id === f.routeId) || fetchersQueuedForDeletion.has(key)) { + if (initialHydration || !matches.some((m) => m.route.id === f.routeId) || deletedFetchers.has(key)) { return; } - let fetcher = state.fetchers.get(key); - let isMidInitialLoad = fetcher && fetcher.state !== "idle" && fetcher.data === void 0; let fetcherMatches = matchRoutes(routesToUse, f.path, basename); if (!fetcherMatches) { - if (hasPatchRoutesOnNavigation && isMidInitialLoad) { - return; - } revalidatingFetchers.push({ key, routeId: f.routeId, path: f.path, matches: null, match: null, - request: null, controller: null }); return; } - if (fetchRedirectIds.has(key)) { - return; - } + let fetcher = state.fetchers.get(key); let fetcherMatch = getTargetMatch(fetcherMatches, f.path); - let fetchController = new AbortController(); - let fetchRequest = createClientSideRequest( - history, - f.path, - fetchController.signal - ); - let fetcherDsMatches = null; - if (cancelledFetcherLoads.has(key)) { + let shouldRevalidate = false; + if (fetchRedirectIds.has(key)) { + shouldRevalidate = false; + } else if (cancelledFetcherLoads.has(key)) { cancelledFetcherLoads.delete(key); - fetcherDsMatches = getTargetedDataStrategyMatches( - mapRouteProperties2, - manifest, - fetchRequest, - fetcherMatches, - fetcherMatch, - lazyRoutePropertiesToSkip, - scopedContext - ); - } else if (isMidInitialLoad) { - if (isRevalidationRequired) { - fetcherDsMatches = getTargetedDataStrategyMatches( - mapRouteProperties2, - manifest, - fetchRequest, - fetcherMatches, - fetcherMatch, - lazyRoutePropertiesToSkip, - scopedContext - ); - } + shouldRevalidate = true; + } else if (fetcher && fetcher.state !== "idle" && fetcher.data === void 0) { + shouldRevalidate = isRevalidationRequired; } else { - let defaultShouldRevalidate; - if (typeof callSiteDefaultShouldRevalidate === "boolean") { - defaultShouldRevalidate = callSiteDefaultShouldRevalidate; - } else if (shouldSkipRevalidation) { - defaultShouldRevalidate = false; - } else { - defaultShouldRevalidate = isRevalidationRequired; - } - let shouldRevalidateArgs = { - ...baseShouldRevalidateArgs, - defaultShouldRevalidate - }; - if (shouldRevalidateLoader(fetcherMatch, shouldRevalidateArgs)) { - fetcherDsMatches = getTargetedDataStrategyMatches( - mapRouteProperties2, - manifest, - fetchRequest, - fetcherMatches, - fetcherMatch, - lazyRoutePropertiesToSkip, - scopedContext, - shouldRevalidateArgs - ); - } + shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({ + currentUrl, + currentParams: state.matches[state.matches.length - 1].params, + nextUrl, + nextParams: matches[matches.length - 1].params + }, submission, { + actionResult, + actionStatus, + defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired + })); } - if (fetcherDsMatches) { + if (shouldRevalidate) { revalidatingFetchers.push({ key, routeId: f.routeId, path: f.path, - matches: fetcherDsMatches, + matches: fetcherMatches, match: fetcherMatch, - request: fetchRequest, - controller: fetchController + controller: new AbortController() }); } }); - return { dsMatches, revalidatingFetchers }; -} -function routeHasLoaderOrMiddleware(route) { - return route.loader != null || route.middleware != null && route.middleware.length > 0; + return [navigationMatches, revalidatingFetchers]; } function shouldLoadRouteOnHydration(route, loaderData, errors) { if (route.lazy) { return true; } - if (!routeHasLoaderOrMiddleware(route)) { + if (!route.loader) { return false; } - let hasData = loaderData != null && route.id in loaderData; + let hasData = loaderData != null && loaderData[route.id] !== void 0; let hasError = errors != null && errors[route.id] !== void 0; if (!hasData && hasError) { return false; @@ -4604,7 +2894,7 @@ function isNewLoader(currentLoaderData, currentMatch, match) { !currentMatch || // [a, b] -> [a, c] match.route.id !== currentMatch.route.id ); - let isMissingData = !currentLoaderData.hasOwnProperty(match.route.id); + let isMissingData = currentLoaderData[match.route.id] === void 0; return isNew || isMissingData; } function isNewRouteInstance(currentMatch, match) { @@ -4625,14 +2915,12 @@ function shouldRevalidateLoader(loaderMatch, arg) { } return arg.defaultShouldRevalidate; } -function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2, allowElementMutations) { +function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2) { + var _childrenToPatch; let childrenToPatch; if (routeId) { let route = manifest[routeId]; - invariant( - route, - `No route found to patch children into: routeId = ${routeId}` - ); + invariant(route, "No route found to patch children into: routeId = " + routeId); if (!route.children) { route.children = []; } @@ -4640,47 +2928,9 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope } else { childrenToPatch = routesToUse; } - let uniqueChildren = []; - let existingChildren = []; - children.forEach((newRoute) => { - let existingRoute = childrenToPatch.find( - (existingRoute2) => isSameRoute(newRoute, existingRoute2) - ); - if (existingRoute) { - existingChildren.push({ existingRoute, newRoute }); - } else { - uniqueChildren.push(newRoute); - } - }); - if (uniqueChildren.length > 0) { - let newRoutes = convertRoutesToDataRoutes( - uniqueChildren, - mapRouteProperties2, - [routeId || "_", "patch", String((childrenToPatch == null ? void 0 : childrenToPatch.length) || "0")], - manifest - ); - childrenToPatch.push(...newRoutes); - } - if (allowElementMutations && existingChildren.length > 0) { - for (let i = 0; i < existingChildren.length; i++) { - let { existingRoute, newRoute } = existingChildren[i]; - let existingRouteTyped = existingRoute; - let [newRouteTyped] = convertRoutesToDataRoutes( - [newRoute], - mapRouteProperties2, - [], - // Doesn't matter for mutated routes since they already have an id - {}, - // Don't touch the manifest here since we're updating in place - true - ); - Object.assign(existingRouteTyped, { - element: newRouteTyped.element ? newRouteTyped.element : existingRouteTyped.element, - errorElement: newRouteTyped.errorElement ? newRouteTyped.errorElement : existingRouteTyped.errorElement, - hydrateFallbackElement: newRouteTyped.hydrateFallbackElement ? newRouteTyped.hydrateFallbackElement : existingRouteTyped.hydrateFallbackElement - }); - } - } + let uniqueChildren = children.filter((newRoute) => !childrenToPatch.some((existingRoute) => isSameRoute(newRoute, existingRoute))); + let newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties2, [routeId || "_", "patch", String(((_childrenToPatch = childrenToPatch) == null ? void 0 : _childrenToPatch.length) || "0")], manifest); + childrenToPatch.push(...newRoutes); } function isSameRoute(newRoute, existingRoute) { if ("id" in newRoute && "id" in existingRoute && newRoute.id === existingRoute.id) { @@ -4692,494 +2942,82 @@ function isSameRoute(newRoute, existingRoute) { if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) { return true; } - return newRoute.children.every( - (aChild, i) => { - var _a; - return (_a = existingRoute.children) == null ? void 0 : _a.some((bChild) => isSameRoute(aChild, bChild)); - } - ); + return newRoute.children.every((aChild, i) => { + var _existingRoute$childr; + return (_existingRoute$childr = existingRoute.children) == null ? void 0 : _existingRoute$childr.some((bChild) => isSameRoute(aChild, bChild)); + }); } -var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap(); -var loadLazyRouteProperty = ({ - key, - route, - manifest, - mapRouteProperties: mapRouteProperties2 -}) => { - let routeToUpdate = manifest[route.id]; - invariant(routeToUpdate, "No route found in manifest"); - if (!routeToUpdate.lazy || typeof routeToUpdate.lazy !== "object") { - return; - } - let lazyFn = routeToUpdate.lazy[key]; - if (!lazyFn) { - return; - } - let cache = lazyRoutePropertyCache.get(routeToUpdate); - if (!cache) { - cache = {}; - lazyRoutePropertyCache.set(routeToUpdate, cache); - } - let cachedPromise = cache[key]; - if (cachedPromise) { - return cachedPromise; - } - let propertyPromise = (async () => { - let isUnsupported = isUnsupportedLazyRouteObjectKey(key); - let staticRouteValue = routeToUpdate[key]; - let isStaticallyDefined = staticRouteValue !== void 0 && key !== "hasErrorBoundary"; - if (isUnsupported) { - warning( - !isUnsupported, - "Route property " + key + " is not a supported lazy route property. This property will be ignored." - ); - cache[key] = Promise.resolve(); - } else if (isStaticallyDefined) { - warning( - false, - `Route "${routeToUpdate.id}" has a static property "${key}" defined. The lazy property will be ignored.` - ); - } else { - let value = await lazyFn(); - if (value != null) { - Object.assign(routeToUpdate, { [key]: value }); - Object.assign(routeToUpdate, mapRouteProperties2(routeToUpdate)); - } - } - if (typeof routeToUpdate.lazy === "object") { - routeToUpdate.lazy[key] = void 0; - if (Object.values(routeToUpdate.lazy).every((value) => value === void 0)) { - routeToUpdate.lazy = void 0; - } - } - })(); - cache[key] = propertyPromise; - return propertyPromise; -}; -var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap(); -function loadLazyRoute(route, type, manifest, mapRouteProperties2, lazyRoutePropertiesToSkip) { - let routeToUpdate = manifest[route.id]; - invariant(routeToUpdate, "No route found in manifest"); +async function loadLazyRouteModule(route, mapRouteProperties2, manifest) { if (!route.lazy) { - return { - lazyRoutePromise: void 0, - lazyHandlerPromise: void 0 - }; + return; } - if (typeof route.lazy === "function") { - let cachedPromise = lazyRouteFunctionCache.get(routeToUpdate); - if (cachedPromise) { - return { - lazyRoutePromise: cachedPromise, - lazyHandlerPromise: cachedPromise - }; - } - let lazyRoutePromise2 = (async () => { - invariant( - typeof route.lazy === "function", - "No lazy route function found" - ); - let lazyRoute = await route.lazy(); - let routeUpdates = {}; - for (let lazyRouteProperty in lazyRoute) { - let lazyValue = lazyRoute[lazyRouteProperty]; - if (lazyValue === void 0) { - continue; - } - let isUnsupported = isUnsupportedLazyRouteFunctionKey(lazyRouteProperty); - let staticRouteValue = routeToUpdate[lazyRouteProperty]; - let isStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based - // on the route updates - lazyRouteProperty !== "hasErrorBoundary"; - if (isUnsupported) { - warning( - !isUnsupported, - "Route property " + lazyRouteProperty + " is not a supported property to be returned from a lazy route function. This property will be ignored." - ); - } else if (isStaticallyDefined) { - warning( - !isStaticallyDefined, - `Route "${routeToUpdate.id}" has a static property "${lazyRouteProperty}" defined but its lazy function is also returning a value for this property. The lazy route property "${lazyRouteProperty}" will be ignored.` - ); - } else { - routeUpdates[lazyRouteProperty] = lazyValue; - } - } - Object.assign(routeToUpdate, routeUpdates); - Object.assign(routeToUpdate, { - // To keep things framework agnostic, we use the provided `mapRouteProperties` - // function to set the framework-aware properties (`element`/`hasErrorBoundary`) - // since the logic will differ between frameworks. - ...mapRouteProperties2(routeToUpdate), - lazy: void 0 - }); - })(); - lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise2); - lazyRoutePromise2.catch(() => { - }); - return { - lazyRoutePromise: lazyRoutePromise2, - lazyHandlerPromise: lazyRoutePromise2 - }; + let lazyRoute = await route.lazy(); + if (!route.lazy) { + return; } - let lazyKeys = Object.keys(route.lazy); - let lazyPropertyPromises = []; - let lazyHandlerPromise = void 0; - for (let key of lazyKeys) { - if (lazyRoutePropertiesToSkip && lazyRoutePropertiesToSkip.includes(key)) { - continue; - } - let promise = loadLazyRouteProperty({ - key, - route, - manifest, - mapRouteProperties: mapRouteProperties2 - }); - if (promise) { - lazyPropertyPromises.push(promise); - if (key === type) { - lazyHandlerPromise = promise; - } + let routeToUpdate = manifest[route.id]; + invariant(routeToUpdate, "No route found in manifest"); + let routeUpdates = {}; + for (let lazyRouteProperty in lazyRoute) { + let staticRouteValue = routeToUpdate[lazyRouteProperty]; + let isPropertyStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based + // on the route updates + lazyRouteProperty !== "hasErrorBoundary"; + warning(!isPropertyStaticallyDefined, 'Route "' + routeToUpdate.id + '" has a static property "' + lazyRouteProperty + '" defined but its lazy function is also returning a value for this property. ' + ('The lazy route property "' + lazyRouteProperty + '" will be ignored.')); + if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) { + routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty]; } } - let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => { - }) : void 0; - lazyRoutePromise == null ? void 0 : lazyRoutePromise.catch(() => { - }); - lazyHandlerPromise == null ? void 0 : lazyHandlerPromise.catch(() => { - }); - return { - lazyRoutePromise, - lazyHandlerPromise - }; + Object.assign(routeToUpdate, routeUpdates); + Object.assign(routeToUpdate, _extends({}, mapRouteProperties2(routeToUpdate), { + lazy: void 0 + })); } -function isNonNullable(value) { - return value !== void 0; -} -function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2) { - let promises = matches.map(({ route }) => { - if (typeof route.lazy !== "object" || !route.lazy.middleware) { - return void 0; - } - return loadLazyRouteProperty({ - key: "middleware", - route, - manifest, - mapRouteProperties: mapRouteProperties2 - }); - }).filter(isNonNullable); - return promises.length > 0 ? Promise.all(promises) : void 0; -} -async function defaultDataStrategy(args) { - let matchesToLoad = args.matches.filter((m) => m.shouldLoad); - let keyedResults = {}; - let results = await Promise.all(matchesToLoad.map((m) => m.resolve())); - results.forEach((result, i) => { - keyedResults[matchesToLoad[i].route.id] = result; - }); - return keyedResults; -} -async function defaultDataStrategyWithMiddleware(args) { - if (!args.matches.some((m) => m.route.middleware)) { - return defaultDataStrategy(args); - } - return runClientMiddlewarePipeline(args, () => defaultDataStrategy(args)); -} -function runServerMiddlewarePipeline(args, handler, errorHandler) { - return runMiddlewarePipeline( - args, - handler, - processResult, - isResponse, - errorHandler - ); - function processResult(result) { - return isDataWithResponseInit(result) ? dataWithResponseInitToResponse(result) : result; - } -} -function runClientMiddlewarePipeline(args, handler) { - return runMiddlewarePipeline( - args, - handler, - (r) => { - if (isRedirectResponse(r)) { - throw r; - } - return r; - }, - isDataStrategyResults, - errorHandler - ); - function errorHandler(error, routeId, nextResult) { - if (nextResult) { - return Promise.resolve( - Object.assign(nextResult.value, { - [routeId]: { type: "error", result: error } - }) - ); - } else { - let { matches } = args; - let maxBoundaryIdx = Math.min( - // Throwing route - Math.max( - matches.findIndex((m) => m.route.id === routeId), - 0 - ), - // or the shallowest route that needs to load data - Math.max( - matches.findIndex((m) => m.shouldCallHandler()), - 0 - ) - ); - let boundaryRouteId = findNearestBoundary( - matches, - matches[maxBoundaryIdx].route.id - ).route.id; - return Promise.resolve({ - [boundaryRouteId]: { type: "error", result: error } - }); - } - } -} -async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) { - let { matches, request, params, context, unstable_pattern } = args; - let tuples = matches.flatMap( - (m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : [] - ); - let result = await callRouteMiddleware( - { - request, - params, - context, - unstable_pattern - }, - tuples, - handler, - processResult, - isResult, - errorHandler - ); - return result; -} -async function callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx = 0) { - let { request } = args; - if (request.signal.aborted) { - throw request.signal.reason ?? new Error(`Request aborted: ${request.method} ${request.url}`); - } - let tuple = middlewares[idx]; - if (!tuple) { - let result = await handler(); - return result; - } - let [routeId, middleware] = tuple; - let nextResult; - let next = async () => { - if (nextResult) { - throw new Error("You may only call `next()` once per middleware"); - } - try { - let result = await callRouteMiddleware( - args, - middlewares, - handler, - processResult, - isResult, - errorHandler, - idx + 1 - ); - nextResult = { value: result }; - return nextResult.value; - } catch (error) { - nextResult = { value: await errorHandler(error, routeId, nextResult) }; - return nextResult.value; - } - }; - try { - let value = await middleware(args, next); - let result = value != null ? processResult(value) : void 0; - if (isResult(result)) { - return result; - } else if (nextResult) { - return result ?? nextResult.value; - } else { - nextResult = { value: await next() }; - return nextResult.value; - } - } catch (error) { - let response = await errorHandler(error, routeId, nextResult); - return response; - } -} -function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip) { - let lazyMiddlewarePromise = loadLazyRouteProperty({ - key: "middleware", - route: match.route, - manifest, - mapRouteProperties: mapRouteProperties2 - }); - let lazyRoutePromises = loadLazyRoute( - match.route, - isMutationMethod(request.method) ? "action" : "loader", - manifest, - mapRouteProperties2, - lazyRoutePropertiesToSkip - ); - return { - middleware: lazyMiddlewarePromise, - route: lazyRoutePromises.lazyRoutePromise, - handler: lazyRoutePromises.lazyHandlerPromise - }; -} -function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) { - let isUsingNewApi = false; - let _lazyPromises = getDataStrategyMatchLazyPromises( - mapRouteProperties2, - manifest, - request, - match, - lazyRoutePropertiesToSkip - ); - return { - ...match, - _lazyPromises, - shouldLoad, - shouldRevalidateArgs, - shouldCallHandler(defaultShouldRevalidate) { - isUsingNewApi = true; - if (!shouldRevalidateArgs) { - return shouldLoad; - } - if (typeof callSiteDefaultShouldRevalidate === "boolean") { - return shouldRevalidateLoader(match, { - ...shouldRevalidateArgs, - defaultShouldRevalidate: callSiteDefaultShouldRevalidate - }); - } - if (typeof defaultShouldRevalidate === "boolean") { - return shouldRevalidateLoader(match, { - ...shouldRevalidateArgs, - defaultShouldRevalidate - }); - } - return shouldRevalidateLoader(match, shouldRevalidateArgs); - }, - resolve(handlerOverride) { - let { lazy, loader, middleware } = match.route; - let callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader); - let isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy; - if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) { - return callLoaderOrAction({ - request, - unstable_pattern, - match, - lazyHandlerPromise: _lazyPromises == null ? void 0 : _lazyPromises.handler, - lazyRoutePromise: _lazyPromises == null ? void 0 : _lazyPromises.route, - handlerOverride, - scopedContext - }); - } - return Promise.resolve({ type: "data", result: void 0 }); - } - }; -} -function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) { - return matches.map((match) => { - if (match.route.id !== targetMatch.route.id) { - return { - ...match, - shouldLoad: false, - shouldRevalidateArgs, - shouldCallHandler: () => false, - _lazyPromises: getDataStrategyMatchLazyPromises( - mapRouteProperties2, - manifest, - request, - match, - lazyRoutePropertiesToSkip - ), - resolve: () => Promise.resolve({ type: "data", result: void 0 }) - }; - } - return getDataStrategyMatch( - mapRouteProperties2, - manifest, - request, - getRoutePattern(matches), - match, - lazyRoutePropertiesToSkip, - scopedContext, - true, - shouldRevalidateArgs - ); - }); -} -async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) { - if (matches.some((m) => { - var _a; - return (_a = m._lazyPromises) == null ? void 0 : _a.middleware; - })) { - await Promise.all(matches.map((m) => { - var _a; - return (_a = m._lazyPromises) == null ? void 0 : _a.middleware; - })); - } - let dataStrategyArgs = { - request, - unstable_pattern: getRoutePattern(matches), - params: matches[0].params, - context: scopedContext, +async function defaultDataStrategy(_ref4) { + let { matches - }; - let runClientMiddleware = isStaticHandler ? () => { - throw new Error( - "You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`" - ); - } : (cb) => { - let typedDataStrategyArgs = dataStrategyArgs; - return runClientMiddlewarePipeline(typedDataStrategyArgs, () => { - return cb({ - ...typedDataStrategyArgs, - fetcherKey, - runClientMiddleware: () => { - throw new Error( - "Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler" - ); - } + } = _ref4; + let matchesToLoad = matches.filter((m) => m.shouldLoad); + let results = await Promise.all(matchesToLoad.map((m) => m.resolve())); + return results.reduce((acc, result, i) => Object.assign(acc, { + [matchesToLoad[i].route.id]: result + }), {}); +} +async function callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties2, requestContext) { + let loadRouteDefinitionsPromises = matches.map((m) => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties2, manifest) : void 0); + let dsMatches = matches.map((match, i) => { + let loadRoutePromise = loadRouteDefinitionsPromises[i]; + let shouldLoad = matchesToLoad.some((m) => m.route.id === match.route.id); + let resolve = async (handlerOverride) => { + if (handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) { + shouldLoad = true; + } + return shouldLoad ? callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, requestContext) : Promise.resolve({ + type: ResultType.data, + result: void 0 }); + }; + return _extends({}, match, { + shouldLoad, + resolve }); - }; + }); let results = await dataStrategyImpl({ - ...dataStrategyArgs, + matches: dsMatches, + request, + params: matches[0].params, fetcherKey, - runClientMiddleware + context: requestContext }); try { - await Promise.all( - matches.flatMap((m) => { - var _a, _b; - return [ - (_a = m._lazyPromises) == null ? void 0 : _a.handler, - (_b = m._lazyPromises) == null ? void 0 : _b.route - ]; - }) - ); + await Promise.all(loadRouteDefinitionsPromises); } catch (e) { } return results; } -async function callLoaderOrAction({ - request, - unstable_pattern, - match, - lazyHandlerPromise, - lazyRoutePromise, - handlerOverride, - scopedContext -}) { +async function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, staticContext) { let result; let onReject; - let isAction = isMutationMethod(request.method); - let type = isAction ? "action" : "loader"; let runHandler = (handler) => { let reject; let abortPromise = new Promise((_, r) => reject = r); @@ -5187,35 +3025,33 @@ async function callLoaderOrAction({ request.signal.addEventListener("abort", onReject); let actualHandler = (ctx) => { if (typeof handler !== "function") { - return Promise.reject( - new Error( - `You cannot call the handler for a route which defines a boolean "${type}" [routeId: ${match.route.id}]` - ) - ); + return Promise.reject(new Error("You cannot call the handler for a route which defines a boolean " + ('"' + type + '" [routeId: ' + match.route.id + "]"))); } - return handler( - { - request, - unstable_pattern, - params: match.params, - context: scopedContext - }, - ...ctx !== void 0 ? [ctx] : [] - ); + return handler({ + request, + params: match.params, + context: staticContext + }, ...ctx !== void 0 ? [ctx] : []); }; let handlerPromise = (async () => { try { let val = await (handlerOverride ? handlerOverride((ctx) => actualHandler(ctx)) : actualHandler()); - return { type: "data", result: val }; + return { + type: "data", + result: val + }; } catch (e) { - return { type: "error", result: e }; + return { + type: "error", + result: e + }; } })(); return Promise.race([handlerPromise, abortPromise]); }; try { - let handler = isAction ? match.route.action : match.route.loader; - if (lazyHandlerPromise || lazyRoutePromise) { + let handler = match.route[type]; + if (loadRoutePromise) { if (handler) { let handlerError; let [value] = await Promise.all([ @@ -5225,19 +3061,17 @@ async function callLoaderOrAction({ runHandler(handler).catch((e) => { handlerError = e; }), - // Ensure all lazy route promises are resolved before continuing - lazyHandlerPromise, - lazyRoutePromise + loadRoutePromise ]); if (handlerError !== void 0) { throw handlerError; } result = value; } else { - await lazyHandlerPromise; - let handler2 = isAction ? match.route.action : match.route.loader; - if (handler2) { - [result] = await Promise.all([runHandler(handler2), lazyRoutePromise]); + await loadRoutePromise; + handler = match.route[type]; + if (handler) { + result = await runHandler(handler); } else if (type === "action") { let url = new URL(request.url); let pathname = url.pathname + url.search; @@ -5247,7 +3081,10 @@ async function callLoaderOrAction({ routeId: match.route.id }); } else { - return { type: "data", result: void 0 }; + return { + type: ResultType.data, + result: void 0 + }; } } } else if (!handler) { @@ -5259,8 +3096,12 @@ async function callLoaderOrAction({ } else { result = await runHandler(handler); } + invariant(result.result !== void 0, "You defined " + (type === "action" ? "an action" : "a loader") + " for route " + ('"' + match.route.id + "\" but didn't return anything from your `" + type + "` ") + "function. Please return a value or `null`."); } catch (e) { - return { type: "error", result: e }; + return { + type: ResultType.error, + result: e + }; } finally { if (onReject) { request.signal.removeEventListener("abort", onReject); @@ -5268,93 +3109,104 @@ async function callLoaderOrAction({ } return result; } -async function parseResponseBody(response) { - let contentType = response.headers.get("Content-Type"); - if (contentType && /\bapplication\/json\b/.test(contentType)) { - return response.body == null ? null : response.json(); - } - return response.text(); -} async function convertDataStrategyResultToDataResult(dataStrategyResult) { - var _a, _b, _c, _d, _e; - let { result, type } = dataStrategyResult; + let { + result, + type + } = dataStrategyResult; if (isResponse(result)) { - let data2; + let data; try { - data2 = await parseResponseBody(result); + let contentType = result.headers.get("Content-Type"); + if (contentType && /\bapplication\/json\b/.test(contentType)) { + if (result.body == null) { + data = null; + } else { + data = await result.json(); + } + } else { + data = await result.text(); + } } catch (e) { - return { type: "error", error: e }; - } - if (type === "error") { return { - type: "error", - error: new ErrorResponseImpl(result.status, result.statusText, data2), + type: ResultType.error, + error: e + }; + } + if (type === ResultType.error) { + return { + type: ResultType.error, + error: new ErrorResponseImpl(result.status, result.statusText, data), statusCode: result.status, headers: result.headers }; } return { - type: "data", - data: data2, + type: ResultType.data, + data, statusCode: result.status, headers: result.headers }; } - if (type === "error") { + if (type === ResultType.error) { if (isDataWithResponseInit(result)) { + var _result$init3, _result$init4; if (result.data instanceof Error) { + var _result$init, _result$init2; return { - type: "error", + type: ResultType.error, error: result.data, - statusCode: (_a = result.init) == null ? void 0 : _a.status, - headers: ((_b = result.init) == null ? void 0 : _b.headers) ? new Headers(result.init.headers) : void 0 + statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status, + headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : void 0 }; } return { - type: "error", - error: dataWithResponseInitToErrorResponse(result), + type: ResultType.error, + error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, void 0, result.data), statusCode: isRouteErrorResponse(result) ? result.status : void 0, - headers: ((_c = result.init) == null ? void 0 : _c.headers) ? new Headers(result.init.headers) : void 0 + headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : void 0 }; } return { - type: "error", + type: ResultType.error, error: result, statusCode: isRouteErrorResponse(result) ? result.status : void 0 }; } - if (isDataWithResponseInit(result)) { + if (isDeferredData(result)) { + var _result$init5, _result$init6; return { - type: "data", - data: result.data, - statusCode: (_d = result.init) == null ? void 0 : _d.status, - headers: ((_e = result.init) == null ? void 0 : _e.headers) ? new Headers(result.init.headers) : void 0 + type: ResultType.deferred, + deferredData: result, + statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status, + headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers) }; } - return { type: "data", data: result }; + if (isDataWithResponseInit(result)) { + var _result$init7, _result$init8; + return { + type: ResultType.data, + data: result.data, + statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status, + headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : void 0 + }; + } + return { + type: ResultType.data, + data: result + }; } -function normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename) { - let location2 = response.headers.get("Location"); - invariant( - location2, - "Redirects returned/thrown from loaders/actions must have a Location header" - ); - if (!isAbsoluteUrl(location2)) { - let trimmedMatches = matches.slice( - 0, - matches.findIndex((m) => m.route.id === routeId) + 1 - ); - location2 = normalizeTo( - new URL(request.url), - trimmedMatches, - basename, - location2 - ); - response.headers.set("Location", location2); +function normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) { + let location = response.headers.get("Location"); + invariant(location, "Redirects returned/thrown from loaders/actions must have a Location header"); + if (!ABSOLUTE_URL_REGEX.test(location)) { + let trimmedMatches = matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1); + location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath); + response.headers.set("Location", location); } return response; } -function normalizeRedirectLocation(location2, currentUrl, basename, historyInstance) { +function normalizeRedirectLocation(location, currentUrl, basename, historyInstance) { let invalidProtocols = [ "about:", "blob:", @@ -5368,8 +3220,8 @@ function normalizeRedirectLocation(location2, currentUrl, basename, historyInsta // eslint-disable-next-line no-script-url "javascript:" ]; - if (isAbsoluteUrl(location2)) { - let normalizedLocation = location2; + if (ABSOLUTE_URL_REGEX.test(location)) { + let normalizedLocation = location; let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation); if (invalidProtocols.includes(url.protocol)) { throw new Error("Invalid redirect location"); @@ -5380,22 +3232,29 @@ function normalizeRedirectLocation(location2, currentUrl, basename, historyInsta } } try { - let url = historyInstance.createURL(location2); + let url = historyInstance.createURL(location); if (invalidProtocols.includes(url.protocol)) { throw new Error("Invalid redirect location"); } } catch (e) { } - return location2; + return location; } -function createClientSideRequest(history, location2, signal, submission) { - let url = history.createURL(stripHashFromPath(location2)).toString(); - let init = { signal }; +function createClientSideRequest(history, location, signal, submission) { + let url = history.createURL(stripHashFromPath(location)).toString(); + let init = { + signal + }; if (submission && isMutationMethod(submission.formMethod)) { - let { formMethod, formEncType } = submission; + let { + formMethod, + formEncType + } = submission; init.method = formMethod.toUpperCase(); if (formEncType === "application/json") { - init.headers = new Headers({ "Content-Type": formEncType }); + init.headers = new Headers({ + "Content-Type": formEncType + }); init.body = JSON.stringify(submission.json); } else if (formEncType === "text/plain") { init.body = submission.text; @@ -5421,7 +3280,7 @@ function convertSearchParamsToFormData(searchParams) { } return formData; } -function processRouteLoaderData(matches, results, pendingActionResult, isStaticHandler = false, skipLoaderErrorBubbling = false) { +function processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) { let loaderData = {}; let errors = null; let statusCode; @@ -5434,10 +3293,7 @@ function processRouteLoaderData(matches, results, pendingActionResult, isStaticH } let id = match.route.id; let result = results[id]; - invariant( - !isRedirectResult(result), - "Cannot handle redirect results in processLoaderData" - ); + invariant(!isRedirectResult(result), "Cannot handle redirect results in processLoaderData"); if (isErrorResult(result)) { let error = result.error; if (pendingError !== void 0) { @@ -5453,9 +3309,7 @@ function processRouteLoaderData(matches, results, pendingActionResult, isStaticH errors[boundaryMatch.route.id] = error; } } - if (!isStaticHandler) { - loaderData[id] = ResetLoaderDataSymbol; - } + loaderData[id] = void 0; if (!foundError) { foundError = true; statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500; @@ -5464,20 +3318,31 @@ function processRouteLoaderData(matches, results, pendingActionResult, isStaticH loaderHeaders[id] = result.headers; } } else { - loaderData[id] = result.data; - if (result.statusCode && result.statusCode !== 200 && !foundError) { - statusCode = result.statusCode; - } - if (result.headers) { - loaderHeaders[id] = result.headers; + if (isDeferredResult(result)) { + activeDeferreds.set(id, result.deferredData); + loaderData[id] = result.deferredData.data; + if (result.statusCode != null && result.statusCode !== 200 && !foundError) { + statusCode = result.statusCode; + } + if (result.headers) { + loaderHeaders[id] = result.headers; + } + } else { + loaderData[id] = result.data; + if (result.statusCode && result.statusCode !== 200 && !foundError) { + statusCode = result.statusCode; + } + if (result.headers) { + loaderHeaders[id] = result.headers; + } } } }); if (pendingError !== void 0 && pendingActionResult) { - errors = { [pendingActionResult[0]]: pendingError }; - if (pendingActionResult[2]) { - loaderData[pendingActionResult[2]] = void 0; - } + errors = { + [pendingActionResult[0]]: pendingError + }; + loaderData[pendingActionResult[0]] = void 0; } return { loaderData, @@ -5486,45 +3351,59 @@ function processRouteLoaderData(matches, results, pendingActionResult, isStaticH loaderHeaders }; } -function processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults) { - let { loaderData, errors } = processRouteLoaderData( +function processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) { + let { + loaderData, + errors + } = processRouteLoaderData( matches, results, - pendingActionResult + pendingActionResult, + activeDeferreds, + false + // This method is only called client side so we always want to bubble ); - revalidatingFetchers.filter((f) => !f.matches || f.matches.some((m) => m.shouldLoad)).forEach((rf) => { - let { key, match, controller } = rf; - if (controller && controller.signal.aborted) { - return; - } + revalidatingFetchers.forEach((rf) => { + let { + key, + match, + controller + } = rf; let result = fetcherResults[key]; invariant(result, "Did not find corresponding fetcher result"); - if (isErrorResult(result)) { + if (controller && controller.signal.aborted) { + return; + } else if (isErrorResult(result)) { let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id); if (!(errors && errors[boundaryMatch.route.id])) { - errors = { - ...errors, + errors = _extends({}, errors, { [boundaryMatch.route.id]: result.error - }; + }); } state.fetchers.delete(key); } else if (isRedirectResult(result)) { invariant(false, "Unhandled fetcher revalidation redirect"); + } else if (isDeferredResult(result)) { + invariant(false, "Unhandled fetcher deferred data"); } else { let doneFetcher = getDoneFetcher(result.data); state.fetchers.set(key, doneFetcher); } }); - return { loaderData, errors }; + return { + loaderData, + errors + }; } function mergeLoaderData(loaderData, newLoaderData, matches, errors) { - let mergedLoaderData = Object.entries(newLoaderData).filter(([, v]) => v !== ResetLoaderDataSymbol).reduce((merged, [k, v]) => { - merged[k] = v; - return merged; - }, {}); + let mergedLoaderData = _extends({}, newLoaderData); for (let match of matches) { let id = match.route.id; - if (!newLoaderData.hasOwnProperty(id) && loaderData.hasOwnProperty(id) && match.route.loader) { + if (newLoaderData.hasOwnProperty(id)) { + if (newLoaderData[id] !== void 0) { + mergedLoaderData[id] = newLoaderData[id]; + } + } else if (loaderData[id] !== void 0 && match.route.loader) { mergedLoaderData[id] = loaderData[id]; } if (errors && errors.hasOwnProperty(id)) { @@ -5552,69 +3431,70 @@ function findNearestBoundary(matches, routeId) { } function getShortCircuitMatches(routes) { let route = routes.length === 1 ? routes[0] : routes.find((r) => r.index || !r.path || r.path === "/") || { - id: `__shim-error-route__` + id: "__shim-error-route__" }; return { - matches: [ - { - params: {}, - pathname: "", - pathnameBase: "", - route - } - ], + matches: [{ + params: {}, + pathname: "", + pathnameBase: "", + route + }], route }; } -function getInternalRouterError(status, { - pathname, - routeId, - method, - type, - message -} = {}) { +function getInternalRouterError(status, _temp5) { + let { + pathname, + routeId, + method, + type, + message + } = _temp5 === void 0 ? {} : _temp5; let statusText = "Unknown Server Error"; let errorMessage = "Unknown @remix-run/router error"; if (status === 400) { statusText = "Bad Request"; if (method && pathname && routeId) { - errorMessage = `You made a ${method} request to "${pathname}" but did not provide a \`loader\` for route "${routeId}", so there is no way to handle the request.`; + errorMessage = "You made a " + method + ' request to "' + pathname + '" but ' + ('did not provide a `loader` for route "' + routeId + '", ') + "so there is no way to handle the request."; + } else if (type === "defer-action") { + errorMessage = "defer() is not supported in actions"; } else if (type === "invalid-body") { errorMessage = "Unable to encode submission body"; } } else if (status === 403) { statusText = "Forbidden"; - errorMessage = `Route "${routeId}" does not match URL "${pathname}"`; + errorMessage = 'Route "' + routeId + '" does not match URL "' + pathname + '"'; } else if (status === 404) { statusText = "Not Found"; - errorMessage = `No route matches URL "${pathname}"`; + errorMessage = 'No route matches URL "' + pathname + '"'; } else if (status === 405) { statusText = "Method Not Allowed"; if (method && pathname && routeId) { - errorMessage = `You made a ${method.toUpperCase()} request to "${pathname}" but did not provide an \`action\` for route "${routeId}", so there is no way to handle the request.`; + errorMessage = "You made a " + method.toUpperCase() + ' request to "' + pathname + '" but ' + ('did not provide an `action` for route "' + routeId + '", ') + "so there is no way to handle the request."; } else if (method) { - errorMessage = `Invalid request method "${method.toUpperCase()}"`; + errorMessage = 'Invalid request method "' + method.toUpperCase() + '"'; } } - return new ErrorResponseImpl( - status || 500, - statusText, - new Error(errorMessage), - true - ); + return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true); } function findRedirect(results) { let entries = Object.entries(results); for (let i = entries.length - 1; i >= 0; i--) { let [key, result] = entries[i]; if (isRedirectResult(result)) { - return { key, result }; + return { + key, + result + }; } } } function stripHashFromPath(path) { let parsedPath = typeof path === "string" ? parsePath(path) : path; - return createPath({ ...parsedPath, hash: "" }); + return createPath(_extends({}, parsedPath, { + hash: "" + })); } function isHashChangeOnly(a, b) { if (a.pathname !== b.pathname || a.search !== b.search) { @@ -5629,57 +3509,106 @@ function isHashChangeOnly(a, b) { } return false; } -function dataWithResponseInitToResponse(data2) { - return Response.json(data2.data, data2.init ?? void 0); -} -function dataWithResponseInitToErrorResponse(data2) { - var _a, _b; - return new ErrorResponseImpl( - ((_a = data2.init) == null ? void 0 : _a.status) ?? 500, - ((_b = data2.init) == null ? void 0 : _b.statusText) ?? "Internal Server Error", - data2.data - ); -} -function isDataStrategyResults(result) { - return result != null && typeof result === "object" && Object.entries(result).every( - ([key, value]) => typeof key === "string" && isDataStrategyResult(value) - ); -} -function isDataStrategyResult(result) { - return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" || result.type === "error"); -} -function isRedirectDataStrategyResult(result) { +function isRedirectDataStrategyResultResult(result) { return isResponse(result.result) && redirectStatusCodes.has(result.result.status); } +function isDeferredResult(result) { + return result.type === ResultType.deferred; +} function isErrorResult(result) { - return result.type === "error"; + return result.type === ResultType.error; } function isRedirectResult(result) { - return (result && result.type) === "redirect"; + return (result && result.type) === ResultType.redirect; } function isDataWithResponseInit(value) { return typeof value === "object" && value != null && "type" in value && "data" in value && "init" in value && value.type === "DataWithResponseInit"; } +function isDeferredData(value) { + let deferred = value; + return deferred && typeof deferred === "object" && typeof deferred.data === "object" && typeof deferred.subscribe === "function" && typeof deferred.cancel === "function" && typeof deferred.resolveData === "function"; +} function isResponse(value) { return value != null && typeof value.status === "number" && typeof value.statusText === "string" && typeof value.headers === "object" && typeof value.body !== "undefined"; } -function isRedirectStatusCode(statusCode) { - return redirectStatusCodes.has(statusCode); -} -function isRedirectResponse(result) { - return isResponse(result) && isRedirectStatusCode(result.status) && result.headers.has("Location"); -} function isValidMethod(method) { - return validRequestMethods.has(method.toUpperCase()); + return validRequestMethods.has(method.toLowerCase()); } function isMutationMethod(method) { - return validMutationMethods.has(method.toUpperCase()); + return validMutationMethods.has(method.toLowerCase()); +} +async function resolveNavigationDeferredResults(matches, results, signal, currentMatches, currentLoaderData) { + let entries = Object.entries(results); + for (let index = 0; index < entries.length; index++) { + let [routeId, result] = entries[index]; + let match = matches.find((m) => (m == null ? void 0 : m.route.id) === routeId); + if (!match) { + continue; + } + let currentMatch = currentMatches.find((m) => m.route.id === match.route.id); + let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== void 0; + if (isDeferredResult(result) && isRevalidatingLoader) { + await resolveDeferredData(result, signal, false).then((result2) => { + if (result2) { + results[routeId] = result2; + } + }); + } + } +} +async function resolveFetcherDeferredResults(matches, results, revalidatingFetchers) { + for (let index = 0; index < revalidatingFetchers.length; index++) { + let { + key, + routeId, + controller + } = revalidatingFetchers[index]; + let result = results[key]; + let match = matches.find((m) => (m == null ? void 0 : m.route.id) === routeId); + if (!match) { + continue; + } + if (isDeferredResult(result)) { + invariant(controller, "Expected an AbortController for revalidating fetcher deferred result"); + await resolveDeferredData(result, controller.signal, true).then((result2) => { + if (result2) { + results[key] = result2; + } + }); + } + } +} +async function resolveDeferredData(result, signal, unwrap) { + if (unwrap === void 0) { + unwrap = false; + } + let aborted = await result.deferredData.resolveData(signal); + if (aborted) { + return; + } + if (unwrap) { + try { + return { + type: ResultType.data, + data: result.deferredData.unwrappedData + }; + } catch (e) { + return { + type: ResultType.error, + error: e + }; + } + } + return { + type: ResultType.data, + data: result.deferredData.data + }; } function hasNakedIndexQuery(search) { return new URLSearchParams(search).getAll("index").some((v) => v === ""); } -function getTargetMatch(matches, location2) { - let search = typeof location2 === "string" ? parsePath(location2).search : location2.search; +function getTargetMatch(matches, location) { + let search = typeof location === "string" ? parsePath(location).search : location.search; if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || "")) { return matches[matches.length - 1]; } @@ -5687,7 +3616,14 @@ function getTargetMatch(matches, location2) { return pathMatches[pathMatches.length - 1]; } function getSubmissionFromNavigation(navigation) { - let { formMethod, formAction, formEncType, text, formData, json } = navigation; + let { + formMethod, + formAction, + formEncType, + text, + formData, + json: json3 + } = navigation; if (!formMethod || !formAction || !formEncType) { return; } @@ -5709,22 +3645,22 @@ function getSubmissionFromNavigation(navigation) { json: void 0, text: void 0 }; - } else if (json !== void 0) { + } else if (json3 !== void 0) { return { formMethod, formAction, formEncType, formData: void 0, - json, + json: json3, text: void 0 }; } } -function getLoadingNavigation(location2, submission) { +function getLoadingNavigation(location, submission) { if (submission) { let navigation = { state: "loading", - location: location2, + location, formMethod: submission.formMethod, formAction: submission.formAction, formEncType: submission.formEncType, @@ -5736,7 +3672,7 @@ function getLoadingNavigation(location2, submission) { } else { let navigation = { state: "loading", - location: location2, + location, formMethod: void 0, formAction: void 0, formEncType: void 0, @@ -5747,10 +3683,10 @@ function getLoadingNavigation(location2, submission) { return navigation; } } -function getSubmittingNavigation(location2, submission) { +function getSubmittingNavigation(location, submission) { let navigation = { state: "submitting", - location: location2, + location, formMethod: submission.formMethod, formAction: submission.formAction, formEncType: submission.formEncType, @@ -5760,7 +3696,7 @@ function getSubmittingNavigation(location2, submission) { }; return navigation; } -function getLoadingFetcher(submission, data2) { +function getLoadingFetcher(submission, data) { if (submission) { let fetcher = { state: "loading", @@ -5770,7 +3706,7 @@ function getLoadingFetcher(submission, data2) { formData: submission.formData, json: submission.json, text: submission.text, - data: data2 + data }; return fetcher; } else { @@ -5782,7 +3718,7 @@ function getLoadingFetcher(submission, data2) { formData: void 0, json: void 0, text: void 0, - data: data2 + data }; return fetcher; } @@ -5800,7 +3736,7 @@ function getSubmittingFetcher(submission, existingFetcher) { }; return fetcher; } -function getDoneFetcher(data2) { +function getDoneFetcher(data) { let fetcher = { state: "idle", formMethod: void 0, @@ -5809,18 +3745,16 @@ function getDoneFetcher(data2) { formData: void 0, json: void 0, text: void 0, - data: data2 + data }; return fetcher; } function restoreAppliedTransitions(_window, transitions) { try { - let sessionPositions = _window.sessionStorage.getItem( - TRANSITIONS_STORAGE_KEY - ); + let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY); if (sessionPositions) { - let json = JSON.parse(sessionPositions); - for (let [k, v] of Object.entries(json || {})) { + let json3 = JSON.parse(sessionPositions); + for (let [k, v] of Object.entries(json3 || {})) { if (v && Array.isArray(v)) { transitions.set(k, new Set(v || [])); } @@ -5831,380 +3765,326 @@ function restoreAppliedTransitions(_window, transitions) { } function persistAppliedTransitions(_window, transitions) { if (transitions.size > 0) { - let json = {}; + let json3 = {}; for (let [k, v] of transitions) { - json[k] = [...v]; + json3[k] = [...v]; } try { - _window.sessionStorage.setItem( - TRANSITIONS_STORAGE_KEY, - JSON.stringify(json) - ); + _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json3)); } catch (error) { - warning( - false, - `Failed to save applied view transitions in sessionStorage (${error}).` - ); + warning(false, "Failed to save applied view transitions in sessionStorage (" + error + ")."); } } } -function createDeferred() { - let resolve; - let reject; - let promise = new Promise((res, rej) => { - resolve = async (val) => { - res(val); - try { - await promise; - } catch (e) { + +// node_modules/react-router/dist/index.js +function _extends2() { + _extends2 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } } - }; - reject = async (error) => { - rej(error); - try { - await promise; - } catch (e) { - } - }; - }); - return { - promise, - //@ts-ignore - resolve, - //@ts-ignore - reject + } + return target; }; + return _extends2.apply(this, arguments); } var DataRouterContext = React.createContext(null); -DataRouterContext.displayName = "DataRouter"; -var DataRouterStateContext = React.createContext(null); -DataRouterStateContext.displayName = "DataRouterState"; -var RSCRouterContext = React.createContext(false); -function useIsRSCRouterContext() { - return React.useContext(RSCRouterContext); +if (true) { + DataRouterContext.displayName = "DataRouter"; +} +var DataRouterStateContext = React.createContext(null); +if (true) { + DataRouterStateContext.displayName = "DataRouterState"; } -var ViewTransitionContext = React.createContext({ - isTransitioning: false -}); -ViewTransitionContext.displayName = "ViewTransition"; -var FetchersContext = React.createContext( - /* @__PURE__ */ new Map() -); -FetchersContext.displayName = "Fetchers"; var AwaitContext = React.createContext(null); -AwaitContext.displayName = "Await"; -var AwaitContextProvider = (props) => React.createElement(AwaitContext.Provider, props); -var NavigationContext = React.createContext( - null -); -NavigationContext.displayName = "Navigation"; -var LocationContext = React.createContext( - null -); -LocationContext.displayName = "Location"; +if (true) { + AwaitContext.displayName = "Await"; +} +var NavigationContext = React.createContext(null); +if (true) { + NavigationContext.displayName = "Navigation"; +} +var LocationContext = React.createContext(null); +if (true) { + LocationContext.displayName = "Location"; +} var RouteContext = React.createContext({ outlet: null, matches: [], isDataRoute: false }); -RouteContext.displayName = "Route"; +if (true) { + RouteContext.displayName = "Route"; +} var RouteErrorContext = React.createContext(null); -RouteErrorContext.displayName = "RouteError"; -var ENABLE_DEV_WARNINGS = true; -var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR"; -var ERROR_DIGEST_REDIRECT = "REDIRECT"; -var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE"; -function decodeRedirectErrorDigest(digest) { - if (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:{`)) { - try { - let parsed = JSON.parse(digest.slice(28)); - if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string" && typeof parsed.location === "string" && typeof parsed.reloadDocument === "boolean" && typeof parsed.replace === "boolean") { - return parsed; - } - } catch { - } - } +if (true) { + RouteErrorContext.displayName = "RouteError"; } -function decodeRouteErrorResponseDigest(digest) { - if (digest.startsWith( - `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:{` - )) { - try { - let parsed = JSON.parse(digest.slice(40)); - if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string") { - return new ErrorResponseImpl( - parsed.status, - parsed.statusText, - parsed.data - ); - } - } catch { - } - } -} -function useHref(to, { relative } = {}) { - invariant( - useInRouterContext(), +function useHref(to, _temp) { + let { + relative + } = _temp === void 0 ? {} : _temp; + !useInRouterContext() ? true ? invariant( + false, // TODO: This error is probably because they somehow have 2 versions of the // router loaded. We can help them understand how to avoid that. - `useHref() may be used only in the context of a component.` - ); - let { basename, navigator } = React2.useContext(NavigationContext); - let { hash, pathname, search } = useResolvedPath(to, { relative }); + "useHref() may be used only in the context of a component." + ) : invariant(false) : void 0; + let { + basename, + navigator + } = React.useContext(NavigationContext); + let { + hash, + pathname, + search + } = useResolvedPath(to, { + relative + }); let joinedPathname = pathname; if (basename !== "/") { joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]); } - return navigator.createHref({ pathname: joinedPathname, search, hash }); + return navigator.createHref({ + pathname: joinedPathname, + search, + hash + }); } function useInRouterContext() { - return React2.useContext(LocationContext) != null; + return React.useContext(LocationContext) != null; } function useLocation() { - invariant( - useInRouterContext(), + !useInRouterContext() ? true ? invariant( + false, // TODO: This error is probably because they somehow have 2 versions of the // router loaded. We can help them understand how to avoid that. - `useLocation() may be used only in the context of a component.` - ); - return React2.useContext(LocationContext).location; + "useLocation() may be used only in the context of a component." + ) : invariant(false) : void 0; + return React.useContext(LocationContext).location; } function useNavigationType() { - return React2.useContext(LocationContext).navigationType; + return React.useContext(LocationContext).navigationType; } function useMatch(pattern) { - invariant( - useInRouterContext(), + !useInRouterContext() ? true ? invariant( + false, // TODO: This error is probably because they somehow have 2 versions of the // router loaded. We can help them understand how to avoid that. - `useMatch() may be used only in the context of a component.` - ); - let { pathname } = useLocation(); - return React2.useMemo( - () => matchPath(pattern, decodePath(pathname)), - [pathname, pattern] - ); + "useMatch() may be used only in the context of a component." + ) : invariant(false) : void 0; + let { + pathname + } = useLocation(); + return React.useMemo(() => matchPath(pattern, decodePath(pathname)), [pathname, pattern]); } -var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`; +var navigateEffectWarning = "You should call navigate() in a React.useEffect(), not when your component is first rendered."; function useIsomorphicLayoutEffect(cb) { - let isStatic = React2.useContext(NavigationContext).static; + let isStatic = React.useContext(NavigationContext).static; if (!isStatic) { - React2.useLayoutEffect(cb); + React.useLayoutEffect(cb); } } function useNavigate() { - let { isDataRoute } = React2.useContext(RouteContext); + let { + isDataRoute + } = React.useContext(RouteContext); return isDataRoute ? useNavigateStable() : useNavigateUnstable(); } function useNavigateUnstable() { - invariant( - useInRouterContext(), + !useInRouterContext() ? true ? invariant( + false, // TODO: This error is probably because they somehow have 2 versions of the // router loaded. We can help them understand how to avoid that. - `useNavigate() may be used only in the context of a component.` - ); - let dataRouterContext = React2.useContext(DataRouterContext); - let { basename, navigator } = React2.useContext(NavigationContext); - let { matches } = React2.useContext(RouteContext); - let { pathname: locationPathname } = useLocation(); - let routePathnamesJson = JSON.stringify(getResolveToMatches(matches)); - let activeRef = React2.useRef(false); + "useNavigate() may be used only in the context of a component." + ) : invariant(false) : void 0; + let dataRouterContext = React.useContext(DataRouterContext); + let { + basename, + future, + navigator + } = React.useContext(NavigationContext); + let { + matches + } = React.useContext(RouteContext); + let { + pathname: locationPathname + } = useLocation(); + let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath)); + let activeRef = React.useRef(false); useIsomorphicLayoutEffect(() => { activeRef.current = true; }); - let navigate = React2.useCallback( - (to, options = {}) => { - warning(activeRef.current, navigateEffectWarning); - if (!activeRef.current) return; - if (typeof to === "number") { - navigator.go(to); - return; - } - let path = resolveTo( - to, - JSON.parse(routePathnamesJson), - locationPathname, - options.relative === "path" - ); - if (dataRouterContext == null && basename !== "/") { - path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]); - } - (!!options.replace ? navigator.replace : navigator.push)( - path, - options.state, - options - ); - }, - [ - basename, - navigator, - routePathnamesJson, - locationPathname, - dataRouterContext - ] - ); + let navigate = React.useCallback(function(to, options) { + if (options === void 0) { + options = {}; + } + true ? warning(activeRef.current, navigateEffectWarning) : void 0; + if (!activeRef.current) return; + if (typeof to === "number") { + navigator.go(to); + return; + } + let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path"); + if (dataRouterContext == null && basename !== "/") { + path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]); + } + (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options); + }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]); return navigate; } -var OutletContext = React2.createContext(null); +var OutletContext = React.createContext(null); function useOutletContext() { - return React2.useContext(OutletContext); + return React.useContext(OutletContext); } function useOutlet(context) { - let outlet = React2.useContext(RouteContext).outlet; - return React2.useMemo( - () => outlet && React2.createElement(OutletContext.Provider, { value: context }, outlet), - [outlet, context] - ); + let outlet = React.useContext(RouteContext).outlet; + if (outlet) { + return React.createElement(OutletContext.Provider, { + value: context + }, outlet); + } + return outlet; } function useParams() { - let { matches } = React2.useContext(RouteContext); + let { + matches + } = React.useContext(RouteContext); let routeMatch = matches[matches.length - 1]; return routeMatch ? routeMatch.params : {}; } -function useResolvedPath(to, { relative } = {}) { - let { matches } = React2.useContext(RouteContext); - let { pathname: locationPathname } = useLocation(); - let routePathnamesJson = JSON.stringify(getResolveToMatches(matches)); - return React2.useMemo( - () => resolveTo( - to, - JSON.parse(routePathnamesJson), - locationPathname, - relative === "path" - ), - [to, routePathnamesJson, locationPathname, relative] - ); +function useResolvedPath(to, _temp2) { + let { + relative + } = _temp2 === void 0 ? {} : _temp2; + let { + future + } = React.useContext(NavigationContext); + let { + matches + } = React.useContext(RouteContext); + let { + pathname: locationPathname + } = useLocation(); + let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath)); + return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]); } function useRoutes(routes, locationArg) { return useRoutesImpl(routes, locationArg); } -function useRoutesImpl(routes, locationArg, dataRouterState, onError, future) { - var _a; - invariant( - useInRouterContext(), +function useRoutesImpl(routes, locationArg, dataRouterState, future) { + !useInRouterContext() ? true ? invariant( + false, // TODO: This error is probably because they somehow have 2 versions of the // router loaded. We can help them understand how to avoid that. - `useRoutes() may be used only in the context of a component.` - ); - let { navigator } = React2.useContext(NavigationContext); - let { matches: parentMatches } = React2.useContext(RouteContext); + "useRoutes() may be used only in the context of a component." + ) : invariant(false) : void 0; + let { + navigator + } = React.useContext(NavigationContext); + let { + matches: parentMatches + } = React.useContext(RouteContext); let routeMatch = parentMatches[parentMatches.length - 1]; let parentParams = routeMatch ? routeMatch.params : {}; let parentPathname = routeMatch ? routeMatch.pathname : "/"; let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/"; let parentRoute = routeMatch && routeMatch.route; - if (ENABLE_DEV_WARNINGS) { + if (true) { let parentPath = parentRoute && parentRoute.path || ""; - warningOnce( - parentPathname, - !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"), - `You rendered descendant (or called \`useRoutes()\`) at "${parentPathname}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*"), "You rendered descendant (or called `useRoutes()`) at " + ('"' + parentPathname + '" (under ) but the ') + `parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .` - ); +` + ('Please change the parent to .')); } let locationFromContext = useLocation(); - let location2; + let location; if (locationArg) { + var _parsedLocationArg$pa; let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg; - invariant( - parentPathnameBase === "/" || ((_a = parsedLocationArg.pathname) == null ? void 0 : _a.startsWith(parentPathnameBase)), - `When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.` - ); - location2 = parsedLocationArg; + !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? true ? invariant(false, "When overriding the location using `` or `useRoutes(routes, location)`, the location pathname must begin with the portion of the URL pathname that was " + ('matched by all parent routes. The current pathname base is "' + parentPathnameBase + '" ') + ('but pathname "' + parsedLocationArg.pathname + '" was given in the `location` prop.')) : invariant(false) : void 0; + location = parsedLocationArg; } else { - location2 = locationFromContext; + location = locationFromContext; } - let pathname = location2.pathname || "/"; + let pathname = location.pathname || "/"; let remainingPathname = pathname; if (parentPathnameBase !== "/") { let parentSegments = parentPathnameBase.replace(/^\//, "").split("/"); let segments = pathname.replace(/^\//, "").split("/"); remainingPathname = "/" + segments.slice(parentSegments.length).join("/"); } - let matches = matchRoutes(routes, { pathname: remainingPathname }); - if (ENABLE_DEV_WARNINGS) { - warning( - parentRoute || matches != null, - `No routes matched location "${location2.pathname}${location2.search}${location2.hash}" ` - ); - warning( - matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0, - `Matched leaf route at location "${location2.pathname}${location2.search}${location2.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.` - ); + let matches = matchRoutes(routes, { + pathname: remainingPathname + }); + if (true) { + true ? warning(parentRoute || matches != null, 'No routes matched location "' + location.pathname + location.search + location.hash + '" ') : void 0; + true ? warning(matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0, 'Matched leaf route at location "' + location.pathname + location.search + location.hash + '" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.') : void 0; } - let renderedMatches = _renderMatches( - matches && matches.map( - (match) => Object.assign({}, match, { - params: Object.assign({}, parentParams, match.params), - pathname: joinPaths([ - parentPathnameBase, - // Re-encode pathnames that were decoded inside matchRoutes. - // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses - // `new URL()` internally and we need to prevent it from treating - // them as separators - navigator.encodeLocation ? navigator.encodeLocation( - match.pathname.replace(/\?/g, "%3F").replace(/#/g, "%23") - ).pathname : match.pathname - ]), - pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([ - parentPathnameBase, - // Re-encode pathnames that were decoded inside matchRoutes - // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses - // `new URL()` internally and we need to prevent it from treating - // them as separators - navigator.encodeLocation ? navigator.encodeLocation( - match.pathnameBase.replace(/\?/g, "%3F").replace(/#/g, "%23") - ).pathname : match.pathnameBase - ]) - }) - ), - parentMatches, - dataRouterState, - onError, - future - ); + let renderedMatches = _renderMatches(matches && matches.map((match) => Object.assign({}, match, { + params: Object.assign({}, parentParams, match.params), + pathname: joinPaths([ + parentPathnameBase, + // Re-encode pathnames that were decoded inside matchRoutes + navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname + ]), + pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([ + parentPathnameBase, + // Re-encode pathnames that were decoded inside matchRoutes + navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase + ]) + })), parentMatches, dataRouterState, future); if (locationArg && renderedMatches) { - return React2.createElement( - LocationContext.Provider, - { - value: { - location: { - pathname: "/", - search: "", - hash: "", - state: null, - key: "default", - ...location2 - }, - navigationType: "POP" - /* Pop */ - } - }, - renderedMatches - ); + return React.createElement(LocationContext.Provider, { + value: { + location: _extends2({ + pathname: "/", + search: "", + hash: "", + state: null, + key: "default" + }, location), + navigationType: Action.Pop + } + }, renderedMatches); } return renderedMatches; } function DefaultErrorComponent() { let error = useRouteError(); - let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error); + let message = isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error); let stack = error instanceof Error ? error.stack : null; let lightgrey = "rgba(200,200,200, 0.5)"; - let preStyles = { padding: "0.5rem", backgroundColor: lightgrey }; - let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey }; + let preStyles = { + padding: "0.5rem", + backgroundColor: lightgrey + }; + let codeStyles = { + padding: "2px 4px", + backgroundColor: lightgrey + }; let devInfo = null; - if (ENABLE_DEV_WARNINGS) { - console.error( - "Error handled by React Router default ErrorBoundary:", - error - ); - devInfo = React2.createElement(React2.Fragment, null, React2.createElement("p", null, "💿 Hey developer 👋"), React2.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", React2.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", React2.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route.")); + if (true) { + console.error("Error handled by React Router default ErrorBoundary:", error); + devInfo = React.createElement(React.Fragment, null, React.createElement("p", null, "💿 Hey developer 👋"), React.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", React.createElement("code", { + style: codeStyles + }, "ErrorBoundary"), " or", " ", React.createElement("code", { + style: codeStyles + }, "errorElement"), " prop on your route.")); } - return React2.createElement(React2.Fragment, null, React2.createElement("h2", null, "Unexpected Application Error!"), React2.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? React2.createElement("pre", { style: preStyles }, stack) : null, devInfo); + return React.createElement(React.Fragment, null, React.createElement("h2", null, "Unexpected Application Error!"), React.createElement("h3", { + style: { + fontStyle: "italic" + } + }, message), stack ? React.createElement("pre", { + style: preStyles + }, stack) : null, devInfo); } -var defaultErrorElement = React2.createElement(DefaultErrorComponent, null); -var RenderErrorBoundary = class extends React2.Component { +var defaultErrorElement = React.createElement(DefaultErrorComponent, null); +var RenderErrorBoundary = class extends React.Component { constructor(props) { super(props); this.state = { @@ -6214,7 +4094,9 @@ var RenderErrorBoundary = class extends React2.Component { }; } static getDerivedStateFromError(error) { - return { error }; + return { + error + }; } static getDerivedStateFromProps(props, state) { if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") { @@ -6231,119 +4113,76 @@ var RenderErrorBoundary = class extends React2.Component { }; } componentDidCatch(error, errorInfo) { - if (this.props.onError) { - this.props.onError(error, errorInfo); - } else { - console.error( - "React Router caught the following error during render", - error - ); - } + console.error("React Router caught the following error during render", error, errorInfo); } render() { - let error = this.state.error; - if (this.context && typeof error === "object" && error && "digest" in error && typeof error.digest === "string") { - const decoded = decodeRouteErrorResponseDigest(error.digest); - if (decoded) error = decoded; - } - let result = error !== void 0 ? React2.createElement(RouteContext.Provider, { value: this.props.routeContext }, React2.createElement( - RouteErrorContext.Provider, - { - value: error, - children: this.props.component - } - )) : this.props.children; - if (this.context) { - return React2.createElement(RSCErrorHandler, { error }, result); - } - return result; + return this.state.error !== void 0 ? React.createElement(RouteContext.Provider, { + value: this.props.routeContext + }, React.createElement(RouteErrorContext.Provider, { + value: this.state.error, + children: this.props.component + })) : this.props.children; } }; -RenderErrorBoundary.contextType = RSCRouterContext; -var errorRedirectHandledMap = /* @__PURE__ */ new WeakMap(); -function RSCErrorHandler({ - children, - error -}) { - let { basename } = React2.useContext(NavigationContext); - if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") { - let redirect2 = decodeRedirectErrorDigest(error.digest); - if (redirect2) { - let existingRedirect = errorRedirectHandledMap.get(error); - if (existingRedirect) throw existingRedirect; - let parsed = parseToInfo(redirect2.location, basename); - if (isBrowser && !errorRedirectHandledMap.get(error)) { - if (parsed.isExternal || redirect2.reloadDocument) { - window.location.href = parsed.absoluteURL || parsed.to; - } else { - const redirectPromise = Promise.resolve().then( - () => window.__reactRouterDataRouter.navigate(parsed.to, { - replace: redirect2.replace - }) - ); - errorRedirectHandledMap.set(error, redirectPromise); - throw redirectPromise; - } - } - return React2.createElement( - "meta", - { - httpEquiv: "refresh", - content: `0;url=${parsed.absoluteURL || parsed.to}` - } - ); - } - } - return children; -} -function RenderedRoute({ routeContext, match, children }) { - let dataRouterContext = React2.useContext(DataRouterContext); +function RenderedRoute(_ref) { + let { + routeContext, + match, + children + } = _ref; + let dataRouterContext = React.useContext(DataRouterContext); if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) { dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id; } - return React2.createElement(RouteContext.Provider, { value: routeContext }, children); + return React.createElement(RouteContext.Provider, { + value: routeContext + }, children); } -function _renderMatches(matches, parentMatches = [], dataRouterState = null, onErrorHandler = null, future = null) { +function _renderMatches(matches, parentMatches, dataRouterState, future) { + var _dataRouterState; + if (parentMatches === void 0) { + parentMatches = []; + } + if (dataRouterState === void 0) { + dataRouterState = null; + } + if (future === void 0) { + future = null; + } if (matches == null) { + var _future; if (!dataRouterState) { return null; } if (dataRouterState.errors) { matches = dataRouterState.matches; - } else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) { + } else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) { matches = dataRouterState.matches; } else { return null; } } let renderedMatches = matches; - let errors = dataRouterState == null ? void 0 : dataRouterState.errors; + let errors = (_dataRouterState = dataRouterState) == null ? void 0 : _dataRouterState.errors; if (errors != null) { - let errorIndex = renderedMatches.findIndex( - (m) => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== void 0 - ); - invariant( - errorIndex >= 0, - `Could not find a matching route for errors on route IDs: ${Object.keys( - errors - ).join(",")}` - ); - renderedMatches = renderedMatches.slice( - 0, - Math.min(renderedMatches.length, errorIndex + 1) - ); + let errorIndex = renderedMatches.findIndex((m) => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== void 0); + !(errorIndex >= 0) ? true ? invariant(false, "Could not find a matching route for errors on route IDs: " + Object.keys(errors).join(",")) : invariant(false) : void 0; + renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1)); } let renderFallback = false; let fallbackIndex = -1; - if (dataRouterState) { + if (dataRouterState && future && future.v7_partialHydration) { for (let i = 0; i < renderedMatches.length; i++) { let match = renderedMatches[i]; if (match.route.HydrateFallback || match.route.hydrateFallbackElement) { fallbackIndex = i; } if (match.route.id) { - let { loaderData, errors: errors2 } = dataRouterState; - let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0); + let { + loaderData, + errors: errors2 + } = dataRouterState; + let needsToRunLoader = match.route.loader && loaderData[match.route.id] === void 0 && (!errors2 || errors2[match.route.id] === void 0); if (match.route.lazy || needsToRunLoader) { renderFallback = true; if (fallbackIndex >= 0) { @@ -6356,659 +4195,279 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, onE } } } - let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => { - var _a, _b; - onErrorHandler(error, { - location: dataRouterState.location, - params: ((_b = (_a = dataRouterState.matches) == null ? void 0 : _a[0]) == null ? void 0 : _b.params) ?? {}, - unstable_pattern: getRoutePattern(dataRouterState.matches), - errorInfo - }); - } : void 0; - return renderedMatches.reduceRight( - (outlet, match, index) => { - let error; - let shouldRenderHydrateFallback = false; - let errorElement = null; - let hydrateFallbackElement = null; - if (dataRouterState) { - error = errors && match.route.id ? errors[match.route.id] : void 0; - errorElement = match.route.errorElement || defaultErrorElement; - if (renderFallback) { - if (fallbackIndex < 0 && index === 0) { - warningOnce( - "route-fallback", - false, - "No `HydrateFallback` element provided to render during initial hydration" - ); - shouldRenderHydrateFallback = true; - hydrateFallbackElement = null; - } else if (fallbackIndex === index) { - shouldRenderHydrateFallback = true; - hydrateFallbackElement = match.route.hydrateFallbackElement || null; - } + return renderedMatches.reduceRight((outlet, match, index) => { + let error; + let shouldRenderHydrateFallback = false; + let errorElement = null; + let hydrateFallbackElement = null; + if (dataRouterState) { + error = errors && match.route.id ? errors[match.route.id] : void 0; + errorElement = match.route.errorElement || defaultErrorElement; + if (renderFallback) { + if (fallbackIndex < 0 && index === 0) { + warningOnce("route-fallback", false, "No `HydrateFallback` element provided to render during initial hydration"); + shouldRenderHydrateFallback = true; + hydrateFallbackElement = null; + } else if (fallbackIndex === index) { + shouldRenderHydrateFallback = true; + hydrateFallbackElement = match.route.hydrateFallbackElement || null; } } - let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1)); - let getChildren = () => { - let children; - if (error) { - children = errorElement; - } else if (shouldRenderHydrateFallback) { - children = hydrateFallbackElement; - } else if (match.route.Component) { - children = React2.createElement(match.route.Component, null); - } else if (match.route.element) { - children = match.route.element; - } else { - children = outlet; - } - return React2.createElement( - RenderedRoute, - { - match, - routeContext: { - outlet, - matches: matches2, - isDataRoute: dataRouterState != null - }, - children - } - ); - }; - return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? React2.createElement( - RenderErrorBoundary, - { - location: dataRouterState.location, - revalidation: dataRouterState.revalidation, - component: errorElement, - error, - children: getChildren(), - routeContext: { outlet: null, matches: matches2, isDataRoute: true }, - onError - } - ) : getChildren(); - }, - null - ); + } + let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1)); + let getChildren = () => { + let children; + if (error) { + children = errorElement; + } else if (shouldRenderHydrateFallback) { + children = hydrateFallbackElement; + } else if (match.route.Component) { + children = React.createElement(match.route.Component, null); + } else if (match.route.element) { + children = match.route.element; + } else { + children = outlet; + } + return React.createElement(RenderedRoute, { + match, + routeContext: { + outlet, + matches: matches2, + isDataRoute: dataRouterState != null + }, + children + }); + }; + return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? React.createElement(RenderErrorBoundary, { + location: dataRouterState.location, + revalidation: dataRouterState.revalidation, + component: errorElement, + error, + children: getChildren(), + routeContext: { + outlet: null, + matches: matches2, + isDataRoute: true + } + }) : getChildren(); + }, null); } +var DataRouterHook = function(DataRouterHook3) { + DataRouterHook3["UseBlocker"] = "useBlocker"; + DataRouterHook3["UseRevalidator"] = "useRevalidator"; + DataRouterHook3["UseNavigateStable"] = "useNavigate"; + return DataRouterHook3; +}(DataRouterHook || {}); +var DataRouterStateHook = function(DataRouterStateHook3) { + DataRouterStateHook3["UseBlocker"] = "useBlocker"; + DataRouterStateHook3["UseLoaderData"] = "useLoaderData"; + DataRouterStateHook3["UseActionData"] = "useActionData"; + DataRouterStateHook3["UseRouteError"] = "useRouteError"; + DataRouterStateHook3["UseNavigation"] = "useNavigation"; + DataRouterStateHook3["UseRouteLoaderData"] = "useRouteLoaderData"; + DataRouterStateHook3["UseMatches"] = "useMatches"; + DataRouterStateHook3["UseRevalidator"] = "useRevalidator"; + DataRouterStateHook3["UseNavigateStable"] = "useNavigate"; + DataRouterStateHook3["UseRouteId"] = "useRouteId"; + return DataRouterStateHook3; +}(DataRouterStateHook || {}); function getDataRouterConsoleError(hookName) { - return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`; + return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router."; } function useDataRouterContext(hookName) { - let ctx = React2.useContext(DataRouterContext); - invariant(ctx, getDataRouterConsoleError(hookName)); + let ctx = React.useContext(DataRouterContext); + !ctx ? true ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0; return ctx; } function useDataRouterState(hookName) { - let state = React2.useContext(DataRouterStateContext); - invariant(state, getDataRouterConsoleError(hookName)); + let state = React.useContext(DataRouterStateContext); + !state ? true ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0; return state; } function useRouteContext(hookName) { - let route = React2.useContext(RouteContext); - invariant(route, getDataRouterConsoleError(hookName)); + let route = React.useContext(RouteContext); + !route ? true ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0; return route; } function useCurrentRouteId(hookName) { let route = useRouteContext(hookName); let thisRoute = route.matches[route.matches.length - 1]; - invariant( - thisRoute.route.id, - `${hookName} can only be used on routes that contain a unique "id"` - ); + !thisRoute.route.id ? true ? invariant(false, hookName + ' can only be used on routes that contain a unique "id"') : invariant(false) : void 0; return thisRoute.route.id; } function useRouteId() { - return useCurrentRouteId( - "useRouteId" - /* UseRouteId */ - ); + return useCurrentRouteId(DataRouterStateHook.UseRouteId); } function useNavigation() { - let state = useDataRouterState( - "useNavigation" - /* UseNavigation */ - ); + let state = useDataRouterState(DataRouterStateHook.UseNavigation); return state.navigation; } function useRevalidator() { - let dataRouterContext = useDataRouterContext( - "useRevalidator" - /* UseRevalidator */ - ); - let state = useDataRouterState( - "useRevalidator" - /* UseRevalidator */ - ); - let revalidate = React2.useCallback(async () => { - await dataRouterContext.router.revalidate(); - }, [dataRouterContext.router]); - return React2.useMemo( - () => ({ revalidate, state: state.revalidation }), - [revalidate, state.revalidation] - ); + let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator); + let state = useDataRouterState(DataRouterStateHook.UseRevalidator); + return React.useMemo(() => ({ + revalidate: dataRouterContext.router.revalidate, + state: state.revalidation + }), [dataRouterContext.router.revalidate, state.revalidation]); } function useMatches() { - let { matches, loaderData } = useDataRouterState( - "useMatches" - /* UseMatches */ - ); - return React2.useMemo( - () => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), - [matches, loaderData] - ); + let { + matches, + loaderData + } = useDataRouterState(DataRouterStateHook.UseMatches); + return React.useMemo(() => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]); } function useLoaderData() { - let state = useDataRouterState( - "useLoaderData" - /* UseLoaderData */ - ); - let routeId = useCurrentRouteId( - "useLoaderData" - /* UseLoaderData */ - ); + let state = useDataRouterState(DataRouterStateHook.UseLoaderData); + let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData); + if (state.errors && state.errors[routeId] != null) { + console.error("You cannot `useLoaderData` in an errorElement (routeId: " + routeId + ")"); + return void 0; + } return state.loaderData[routeId]; } function useRouteLoaderData(routeId) { - let state = useDataRouterState( - "useRouteLoaderData" - /* UseRouteLoaderData */ - ); + let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData); return state.loaderData[routeId]; } function useActionData() { - let state = useDataRouterState( - "useActionData" - /* UseActionData */ - ); - let routeId = useCurrentRouteId( - "useLoaderData" - /* UseLoaderData */ - ); + let state = useDataRouterState(DataRouterStateHook.UseActionData); + let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData); return state.actionData ? state.actionData[routeId] : void 0; } function useRouteError() { - var _a; - let error = React2.useContext(RouteErrorContext); - let state = useDataRouterState( - "useRouteError" - /* UseRouteError */ - ); - let routeId = useCurrentRouteId( - "useRouteError" - /* UseRouteError */ - ); + var _state$errors; + let error = React.useContext(RouteErrorContext); + let state = useDataRouterState(DataRouterStateHook.UseRouteError); + let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError); if (error !== void 0) { return error; } - return (_a = state.errors) == null ? void 0 : _a[routeId]; + return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId]; } function useAsyncValue() { - let value = React2.useContext(AwaitContext); + let value = React.useContext(AwaitContext); return value == null ? void 0 : value._data; } function useAsyncError() { - let value = React2.useContext(AwaitContext); + let value = React.useContext(AwaitContext); return value == null ? void 0 : value._error; } var blockerId = 0; function useBlocker(shouldBlock) { - let { router: router2, basename } = useDataRouterContext( - "useBlocker" - /* UseBlocker */ - ); - let state = useDataRouterState( - "useBlocker" - /* UseBlocker */ - ); - let [blockerKey, setBlockerKey] = React2.useState(""); - let blockerFunction = React2.useCallback( - (arg) => { - if (typeof shouldBlock !== "function") { - return !!shouldBlock; - } - if (basename === "/") { - return shouldBlock(arg); - } - let { currentLocation, nextLocation, historyAction } = arg; - return shouldBlock({ - currentLocation: { - ...currentLocation, - pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname - }, - nextLocation: { - ...nextLocation, - pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname - }, - historyAction - }); - }, - [basename, shouldBlock] - ); - React2.useEffect(() => { + let { + router, + basename + } = useDataRouterContext(DataRouterHook.UseBlocker); + let state = useDataRouterState(DataRouterStateHook.UseBlocker); + let [blockerKey, setBlockerKey] = React.useState(""); + let blockerFunction = React.useCallback((arg) => { + if (typeof shouldBlock !== "function") { + return !!shouldBlock; + } + if (basename === "/") { + return shouldBlock(arg); + } + let { + currentLocation, + nextLocation, + historyAction + } = arg; + return shouldBlock({ + currentLocation: _extends2({}, currentLocation, { + pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname + }), + nextLocation: _extends2({}, nextLocation, { + pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname + }), + historyAction + }); + }, [basename, shouldBlock]); + React.useEffect(() => { let key = String(++blockerId); setBlockerKey(key); - return () => router2.deleteBlocker(key); - }, [router2]); - React2.useEffect(() => { + return () => router.deleteBlocker(key); + }, [router]); + React.useEffect(() => { if (blockerKey !== "") { - router2.getBlocker(blockerKey, blockerFunction); + router.getBlocker(blockerKey, blockerFunction); } - }, [router2, blockerKey, blockerFunction]); + }, [router, blockerKey, blockerFunction]); return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER; } function useNavigateStable() { - let { router: router2 } = useDataRouterContext( - "useNavigate" - /* UseNavigateStable */ - ); - let id = useCurrentRouteId( - "useNavigate" - /* UseNavigateStable */ - ); - let activeRef = React2.useRef(false); + let { + router + } = useDataRouterContext(DataRouterHook.UseNavigateStable); + let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable); + let activeRef = React.useRef(false); useIsomorphicLayoutEffect(() => { activeRef.current = true; }); - let navigate = React2.useCallback( - async (to, options = {}) => { - warning(activeRef.current, navigateEffectWarning); - if (!activeRef.current) return; - if (typeof to === "number") { - await router2.navigate(to); - } else { - await router2.navigate(to, { fromRouteId: id, ...options }); - } - }, - [router2, id] - ); + let navigate = React.useCallback(function(to, options) { + if (options === void 0) { + options = {}; + } + true ? warning(activeRef.current, navigateEffectWarning) : void 0; + if (!activeRef.current) return; + if (typeof to === "number") { + router.navigate(to); + } else { + router.navigate(to, _extends2({ + fromRouteId: id + }, options)); + } + }, [router, id]); return navigate; } -var alreadyWarned = {}; +var alreadyWarned$1 = {}; function warningOnce(key, cond, message) { - if (!cond && !alreadyWarned[key]) { - alreadyWarned[key] = true; - warning(false, message); + if (!cond && !alreadyWarned$1[key]) { + alreadyWarned$1[key] = true; + true ? warning(false, message) : void 0; } } -function useRoute(...args) { - var _a; - const currentRouteId = useCurrentRouteId( - "useRoute" - /* UseRoute */ - ); - const id = args[0] ?? currentRouteId; - const state = useDataRouterState( - "useRoute" - /* UseRoute */ - ); - const route = state.matches.find(({ route: route2 }) => route2.id === id); - if (route === void 0) return void 0; - return { - handle: route.route.handle, - loaderData: state.loaderData[id], - actionData: (_a = state.actionData) == null ? void 0 : _a[id] - }; -} -var alreadyWarned2 = {}; -function warnOnce(condition, message) { - if (!condition && !alreadyWarned2[message]) { - alreadyWarned2[message] = true; +var alreadyWarned = {}; +function warnOnce(key, message) { + if (!alreadyWarned[message]) { + alreadyWarned[message] = true; console.warn(message); } } -var USE_OPTIMISTIC = "useOptimistic"; -var useOptimisticImpl = React3[USE_OPTIMISTIC]; -var stableUseOptimisticSetter = () => void 0; -function useOptimisticSafe(val) { - if (useOptimisticImpl) { - return useOptimisticImpl(val); - } else { - return [val, stableUseOptimisticSetter]; +var logDeprecation = (flag, msg, link) => warnOnce(flag, "⚠️ React Router Future Flag Warning: " + msg + ". " + ("You can use the `" + flag + "` future flag to opt-in early. ") + ("For more information, see " + link + ".")); +function logV6DeprecationWarnings(renderFuture, routerFuture) { + if ((renderFuture == null ? void 0 : renderFuture.v7_startTransition) === void 0) { + logDeprecation("v7_startTransition", "React Router will begin wrapping state updates in `React.startTransition` in v7", "https://reactrouter.com/v6/upgrading/future#v7_starttransition"); + } + if ((renderFuture == null ? void 0 : renderFuture.v7_relativeSplatPath) === void 0 && (!routerFuture || routerFuture.v7_relativeSplatPath === void 0)) { + logDeprecation("v7_relativeSplatPath", "Relative route resolution within Splat routes is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"); + } + if (routerFuture) { + if (routerFuture.v7_fetcherPersist === void 0) { + logDeprecation("v7_fetcherPersist", "The persistence behavior of fetchers is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"); + } + if (routerFuture.v7_normalizeFormMethod === void 0) { + logDeprecation("v7_normalizeFormMethod", "Casing of `formMethod` fields is being normalized to uppercase in v7", "https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"); + } + if (routerFuture.v7_partialHydration === void 0) { + logDeprecation("v7_partialHydration", "`RouterProvider` hydration behavior is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_partialhydration"); + } + if (routerFuture.v7_skipActionErrorRevalidation === void 0) { + logDeprecation("v7_skipActionErrorRevalidation", "The revalidation behavior after 4xx/5xx `action` responses is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"); + } } } -function mapRouteProperties(route) { - let updates = { - // Note: this check also occurs in createRoutesFromChildren so update - // there if you change this -- please and thank you! - hasErrorBoundary: route.hasErrorBoundary || route.ErrorBoundary != null || route.errorElement != null - }; - if (route.Component) { - if (ENABLE_DEV_WARNINGS) { - if (route.element) { - warning( - false, - "You should not include both `Component` and `element` on your route - `Component` will be used." - ); - } - } - Object.assign(updates, { - element: React3.createElement(route.Component), - Component: void 0 - }); - } - if (route.HydrateFallback) { - if (ENABLE_DEV_WARNINGS) { - if (route.hydrateFallbackElement) { - warning( - false, - "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used." - ); - } - } - Object.assign(updates, { - hydrateFallbackElement: React3.createElement(route.HydrateFallback), - HydrateFallback: void 0 - }); - } - if (route.ErrorBoundary) { - if (ENABLE_DEV_WARNINGS) { - if (route.errorElement) { - warning( - false, - "You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used." - ); - } - } - Object.assign(updates, { - errorElement: React3.createElement(route.ErrorBoundary), - ErrorBoundary: void 0 - }); - } - return updates; -} -var hydrationRouteProperties = [ - "HydrateFallback", - "hydrateFallbackElement" -]; -function createMemoryRouter(routes, opts) { - return createRouter({ - basename: opts == null ? void 0 : opts.basename, - getContext: opts == null ? void 0 : opts.getContext, - future: opts == null ? void 0 : opts.future, - history: createMemoryHistory({ - initialEntries: opts == null ? void 0 : opts.initialEntries, - initialIndex: opts == null ? void 0 : opts.initialIndex - }), - hydrationData: opts == null ? void 0 : opts.hydrationData, - routes, - hydrationRouteProperties, - mapRouteProperties, - dataStrategy: opts == null ? void 0 : opts.dataStrategy, - patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation, - unstable_instrumentations: opts == null ? void 0 : opts.unstable_instrumentations - }).initialize(); -} -var Deferred = class { - constructor() { - this.status = "pending"; - this.promise = new Promise((resolve, reject) => { - this.resolve = (value) => { - if (this.status === "pending") { - this.status = "resolved"; - resolve(value); - } - }; - this.reject = (reason) => { - if (this.status === "pending") { - this.status = "rejected"; - reject(reason); - } - }; - }); - } -}; -function RouterProvider({ - router: router2, - flushSync: reactDomFlushSyncImpl, - onError, - unstable_useTransitions -}) { - let unstable_rsc = useIsRSCRouterContext(); - unstable_useTransitions = unstable_rsc || unstable_useTransitions; - let [_state, setStateImpl] = React3.useState(router2.state); - let [state, setOptimisticState] = useOptimisticSafe(_state); - let [pendingState, setPendingState] = React3.useState(); - let [vtContext, setVtContext] = React3.useState({ - isTransitioning: false - }); - let [renderDfd, setRenderDfd] = React3.useState(); - let [transition, setTransition] = React3.useState(); - let [interruption, setInterruption] = React3.useState(); - let fetcherData = React3.useRef(/* @__PURE__ */ new Map()); - let setState = React3.useCallback( - (newState, { deletedFetchers, newErrors, flushSync: flushSync3, viewTransitionOpts }) => { - if (newErrors && onError) { - Object.values(newErrors).forEach( - (error) => { - var _a; - return onError(error, { - location: newState.location, - params: ((_a = newState.matches[0]) == null ? void 0 : _a.params) ?? {}, - unstable_pattern: getRoutePattern(newState.matches) - }); - } - ); - } - newState.fetchers.forEach((fetcher, key) => { - if (fetcher.data !== void 0) { - fetcherData.current.set(key, fetcher.data); - } - }); - deletedFetchers.forEach((key) => fetcherData.current.delete(key)); - warnOnce( - flushSync3 === false || reactDomFlushSyncImpl != null, - 'You provided the `flushSync` option to a router update, but you are not using the `` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.' - ); - let isViewTransitionAvailable = router2.window != null && router2.window.document != null && typeof router2.window.document.startViewTransition === "function"; - warnOnce( - viewTransitionOpts == null || isViewTransitionAvailable, - "You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available." - ); - if (!viewTransitionOpts || !isViewTransitionAvailable) { - if (reactDomFlushSyncImpl && flushSync3) { - reactDomFlushSyncImpl(() => setStateImpl(newState)); - } else if (unstable_useTransitions === false) { - setStateImpl(newState); - } else { - React3.startTransition(() => { - if (unstable_useTransitions === true) { - setOptimisticState((s) => getOptimisticRouterState(s, newState)); - } - setStateImpl(newState); - }); - } - return; - } - if (reactDomFlushSyncImpl && flushSync3) { - reactDomFlushSyncImpl(() => { - if (transition) { - renderDfd == null ? void 0 : renderDfd.resolve(); - transition.skipTransition(); - } - setVtContext({ - isTransitioning: true, - flushSync: true, - currentLocation: viewTransitionOpts.currentLocation, - nextLocation: viewTransitionOpts.nextLocation - }); - }); - let t = router2.window.document.startViewTransition(() => { - reactDomFlushSyncImpl(() => setStateImpl(newState)); - }); - t.finished.finally(() => { - reactDomFlushSyncImpl(() => { - setRenderDfd(void 0); - setTransition(void 0); - setPendingState(void 0); - setVtContext({ isTransitioning: false }); - }); - }); - reactDomFlushSyncImpl(() => setTransition(t)); - return; - } - if (transition) { - renderDfd == null ? void 0 : renderDfd.resolve(); - transition.skipTransition(); - setInterruption({ - state: newState, - currentLocation: viewTransitionOpts.currentLocation, - nextLocation: viewTransitionOpts.nextLocation - }); - } else { - setPendingState(newState); - setVtContext({ - isTransitioning: true, - flushSync: false, - currentLocation: viewTransitionOpts.currentLocation, - nextLocation: viewTransitionOpts.nextLocation - }); - } - }, - [ - router2.window, - reactDomFlushSyncImpl, - transition, - renderDfd, - unstable_useTransitions, - setOptimisticState, - onError - ] - ); - React3.useLayoutEffect(() => router2.subscribe(setState), [router2, setState]); - React3.useEffect(() => { - if (vtContext.isTransitioning && !vtContext.flushSync) { - setRenderDfd(new Deferred()); - } - }, [vtContext]); - React3.useEffect(() => { - if (renderDfd && pendingState && router2.window) { - let newState = pendingState; - let renderPromise = renderDfd.promise; - let transition2 = router2.window.document.startViewTransition(async () => { - if (unstable_useTransitions === false) { - setStateImpl(newState); - } else { - React3.startTransition(() => { - if (unstable_useTransitions === true) { - setOptimisticState((s) => getOptimisticRouterState(s, newState)); - } - setStateImpl(newState); - }); - } - await renderPromise; - }); - transition2.finished.finally(() => { - setRenderDfd(void 0); - setTransition(void 0); - setPendingState(void 0); - setVtContext({ isTransitioning: false }); - }); - setTransition(transition2); - } - }, [ - pendingState, - renderDfd, - router2.window, - unstable_useTransitions, - setOptimisticState - ]); - React3.useEffect(() => { - if (renderDfd && pendingState && state.location.key === pendingState.location.key) { - renderDfd.resolve(); - } - }, [renderDfd, transition, state.location, pendingState]); - React3.useEffect(() => { - if (!vtContext.isTransitioning && interruption) { - setPendingState(interruption.state); - setVtContext({ - isTransitioning: true, - flushSync: false, - currentLocation: interruption.currentLocation, - nextLocation: interruption.nextLocation - }); - setInterruption(void 0); - } - }, [vtContext.isTransitioning, interruption]); - let navigator = React3.useMemo(() => { - return { - createHref: router2.createHref, - encodeLocation: router2.encodeLocation, - go: (n) => router2.navigate(n), - push: (to, state2, opts) => router2.navigate(to, { - state: state2, - preventScrollReset: opts == null ? void 0 : opts.preventScrollReset - }), - replace: (to, state2, opts) => router2.navigate(to, { - replace: true, - state: state2, - preventScrollReset: opts == null ? void 0 : opts.preventScrollReset - }) - }; - }, [router2]); - let basename = router2.basename || "/"; - let dataRouterContext = React3.useMemo( - () => ({ - router: router2, - navigator, - static: false, - basename, - onError - }), - [router2, navigator, basename, onError] - ); - return React3.createElement(React3.Fragment, null, React3.createElement(DataRouterContext.Provider, { value: dataRouterContext }, React3.createElement(DataRouterStateContext.Provider, { value: state }, React3.createElement(FetchersContext.Provider, { value: fetcherData.current }, React3.createElement(ViewTransitionContext.Provider, { value: vtContext }, React3.createElement( - Router, - { - basename, - location: state.location, - navigationType: state.historyAction, - navigator, - unstable_useTransitions - }, - React3.createElement( - MemoizedDataRoutes, - { - routes: router2.routes, - future: router2.future, - state, - onError - } - ) - ))))), null); -} -function getOptimisticRouterState(currentState, newState) { - return { - // Don't surface "current location specific" stuff mid-navigation - // (historyAction, location, matches, loaderData, errors, initialized, - // restoreScroll, preventScrollReset, blockers, etc.) - ...currentState, - // Only surface "pending/in-flight stuff" - // (navigation, revalidation, actionData, fetchers, ) - navigation: newState.navigation.state !== "idle" ? newState.navigation : currentState.navigation, - revalidation: newState.revalidation !== "idle" ? newState.revalidation : currentState.revalidation, - actionData: newState.navigation.state !== "submitting" ? newState.actionData : currentState.actionData, - fetchers: newState.fetchers - }; -} -var MemoizedDataRoutes = React3.memo(DataRoutes); -function DataRoutes({ - routes, - future, - state, - onError -}) { - return useRoutesImpl(routes, void 0, state, onError, future); -} -function MemoryRouter({ - basename, - children, - initialEntries, - initialIndex, - unstable_useTransitions -}) { - let historyRef = React3.useRef(); +var START_TRANSITION = "startTransition"; +var startTransitionImpl = React[START_TRANSITION]; +function MemoryRouter(_ref3) { + let { + basename, + children, + initialEntries, + initialIndex, + future + } = _ref3; + let historyRef = React.useRef(); if (historyRef.current == null) { historyRef.current = createMemoryHistory({ initialEntries, @@ -7017,98 +4476,87 @@ function MemoryRouter({ }); } let history = historyRef.current; - let [state, setStateImpl] = React3.useState({ + let [state, setStateImpl] = React.useState({ action: history.action, location: history.location }); - let setState = React3.useCallback( - (newState) => { - if (unstable_useTransitions === false) { - setStateImpl(newState); - } else { - React3.startTransition(() => setStateImpl(newState)); - } - }, - [unstable_useTransitions] - ); - React3.useLayoutEffect(() => history.listen(setState), [history, setState]); - return React3.createElement( - Router, - { - basename, - children, - location: state.location, - navigationType: state.action, - navigator: history, - unstable_useTransitions - } - ); + let { + v7_startTransition + } = future || {}; + let setState = React.useCallback((newState) => { + v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState); + }, [setStateImpl, v7_startTransition]); + React.useLayoutEffect(() => history.listen(setState), [history, setState]); + React.useEffect(() => logV6DeprecationWarnings(future), [future]); + return React.createElement(Router, { + basename, + children, + location: state.location, + navigationType: state.action, + navigator: history, + future + }); } -function Navigate({ - to, - replace: replace2, - state, - relative -}) { - invariant( - useInRouterContext(), +function Navigate(_ref4) { + let { + to, + replace: replace2, + state, + relative + } = _ref4; + !useInRouterContext() ? true ? invariant( + false, // TODO: This error is probably because they somehow have 2 versions of // the router loaded. We can help them understand how to avoid that. - ` may be used only in the context of a component.` - ); - let { static: isStatic } = React3.useContext(NavigationContext); - warning( - !isStatic, - ` must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.` - ); - let { matches } = React3.useContext(RouteContext); - let { pathname: locationPathname } = useLocation(); + " may be used only in the context of a component." + ) : invariant(false) : void 0; + let { + future, + static: isStatic + } = React.useContext(NavigationContext); + true ? warning(!isStatic, " must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.") : void 0; + let { + matches + } = React.useContext(RouteContext); + let { + pathname: locationPathname + } = useLocation(); let navigate = useNavigate(); - let path = resolveTo( - to, - getResolveToMatches(matches), - locationPathname, - relative === "path" - ); + let path = resolveTo(to, getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === "path"); let jsonPath = JSON.stringify(path); - React3.useEffect(() => { - navigate(JSON.parse(jsonPath), { replace: replace2, state, relative }); - }, [navigate, jsonPath, relative, replace2, state]); + React.useEffect(() => navigate(JSON.parse(jsonPath), { + replace: replace2, + state, + relative + }), [navigate, jsonPath, relative, replace2, state]); return null; } function Outlet(props) { return useOutlet(props.context); } -function Route(props) { - invariant( - false, - `A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .` - ); +function Route(_props) { + true ? invariant(false, "A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .") : invariant(false); } -function Router({ - basename: basenameProp = "/", - children = null, - location: locationProp, - navigationType = "POP", - navigator, - static: staticProp = false, - unstable_useTransitions -}) { - invariant( - !useInRouterContext(), - `You cannot render a inside another . You should never have more than one in your app.` - ); +function Router(_ref5) { + let { + basename: basenameProp = "/", + children = null, + location: locationProp, + navigationType = Action.Pop, + navigator, + static: staticProp = false, + future + } = _ref5; + !!useInRouterContext() ? true ? invariant(false, "You cannot render a inside another . You should never have more than one in your app.") : invariant(false) : void 0; let basename = basenameProp.replace(/^\/*/, "/"); - let navigationContext = React3.useMemo( - () => ({ - basename, - navigator, - static: staticProp, - unstable_useTransitions, - future: {} - }), - [basename, navigator, staticProp, unstable_useTransitions] - ); + let navigationContext = React.useMemo(() => ({ + basename, + navigator, + static: staticProp, + future: _extends2({ + v7_relativeSplatPath: false + }, future) + }), [basename, future, navigator, staticProp]); if (typeof locationProp === "string") { locationProp = parsePath(locationProp); } @@ -7119,7 +4567,7 @@ function Router({ state = null, key = "default" } = locationProp; - let locationContext = React3.useMemo(() => { + let locationContext = React.useMemo(() => { let trailingPathname = stripBasename(pathname, basename); if (trailingPathname == null) { return null; @@ -7135,143 +4583,145 @@ function Router({ navigationType }; }, [basename, pathname, search, hash, state, key, navigationType]); - warning( - locationContext != null, - ` is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the won't render anything.` - ); + true ? warning(locationContext != null, ' is not able to match the URL ' + ('"' + pathname + search + hash + '" because it does not start with the ') + "basename, so the won't render anything.") : void 0; if (locationContext == null) { return null; } - return React3.createElement(NavigationContext.Provider, { value: navigationContext }, React3.createElement(LocationContext.Provider, { children, value: locationContext })); + return React.createElement(NavigationContext.Provider, { + value: navigationContext + }, React.createElement(LocationContext.Provider, { + children, + value: locationContext + })); } -function Routes({ - children, - location: location2 -}) { - return useRoutes(createRoutesFromChildren(children), location2); +function Routes(_ref6) { + let { + children, + location + } = _ref6; + return useRoutes(createRoutesFromChildren(children), location); } -function Await({ - children, - errorElement, - resolve -}) { - let dataRouterContext = React3.useContext(DataRouterContext); - let dataRouterStateContext = React3.useContext(DataRouterStateContext); - let onError = React3.useCallback( - (error, errorInfo) => { - var _a; - if (dataRouterContext && dataRouterContext.onError && dataRouterStateContext) { - dataRouterContext.onError(error, { - location: dataRouterStateContext.location, - params: ((_a = dataRouterStateContext.matches[0]) == null ? void 0 : _a.params) || {}, - unstable_pattern: getRoutePattern(dataRouterStateContext.matches), - errorInfo - }); - } - }, - [dataRouterContext, dataRouterStateContext] - ); - return React3.createElement( - AwaitErrorBoundary, - { - resolve, - errorElement, - onError - }, - React3.createElement(ResolveAwait, null, children) - ); +function Await(_ref7) { + let { + children, + errorElement, + resolve + } = _ref7; + return React.createElement(AwaitErrorBoundary, { + resolve, + errorElement + }, React.createElement(ResolveAwait, null, children)); } -var AwaitErrorBoundary = class extends React3.Component { +var AwaitRenderStatus = function(AwaitRenderStatus2) { + AwaitRenderStatus2[AwaitRenderStatus2["pending"] = 0] = "pending"; + AwaitRenderStatus2[AwaitRenderStatus2["success"] = 1] = "success"; + AwaitRenderStatus2[AwaitRenderStatus2["error"] = 2] = "error"; + return AwaitRenderStatus2; +}(AwaitRenderStatus || {}); +var neverSettledPromise = new Promise(() => { +}); +var AwaitErrorBoundary = class extends React.Component { constructor(props) { super(props); - this.state = { error: null }; + this.state = { + error: null + }; } static getDerivedStateFromError(error) { - return { error }; + return { + error + }; } componentDidCatch(error, errorInfo) { - if (this.props.onError) { - this.props.onError(error, errorInfo); - } else { - console.error( - " caught the following error during render", - error, - errorInfo - ); - } + console.error(" caught the following error during render", error, errorInfo); } render() { - let { children, errorElement, resolve } = this.props; + let { + children, + errorElement, + resolve + } = this.props; let promise = null; - let status = 0; + let status = AwaitRenderStatus.pending; if (!(resolve instanceof Promise)) { - status = 1; + status = AwaitRenderStatus.success; promise = Promise.resolve(); - Object.defineProperty(promise, "_tracked", { get: () => true }); - Object.defineProperty(promise, "_data", { get: () => resolve }); + Object.defineProperty(promise, "_tracked", { + get: () => true + }); + Object.defineProperty(promise, "_data", { + get: () => resolve + }); } else if (this.state.error) { - status = 2; + status = AwaitRenderStatus.error; let renderError = this.state.error; promise = Promise.reject().catch(() => { }); - Object.defineProperty(promise, "_tracked", { get: () => true }); - Object.defineProperty(promise, "_error", { get: () => renderError }); + Object.defineProperty(promise, "_tracked", { + get: () => true + }); + Object.defineProperty(promise, "_error", { + get: () => renderError + }); } else if (resolve._tracked) { promise = resolve; - status = "_error" in promise ? 2 : "_data" in promise ? 1 : 0; + status = "_error" in promise ? AwaitRenderStatus.error : "_data" in promise ? AwaitRenderStatus.success : AwaitRenderStatus.pending; } else { - status = 0; - Object.defineProperty(resolve, "_tracked", { get: () => true }); - promise = resolve.then( - (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }), - (error) => { - var _a, _b; - (_b = (_a = this.props).onError) == null ? void 0 : _b.call(_a, error); - Object.defineProperty(resolve, "_error", { get: () => error }); - } - ); + status = AwaitRenderStatus.pending; + Object.defineProperty(resolve, "_tracked", { + get: () => true + }); + promise = resolve.then((data) => Object.defineProperty(resolve, "_data", { + get: () => data + }), (error) => Object.defineProperty(resolve, "_error", { + get: () => error + })); } - if (status === 2 && !errorElement) { + if (status === AwaitRenderStatus.error && promise._error instanceof AbortedDeferredError) { + throw neverSettledPromise; + } + if (status === AwaitRenderStatus.error && !errorElement) { throw promise._error; } - if (status === 2) { - return React3.createElement(AwaitContext.Provider, { value: promise, children: errorElement }); + if (status === AwaitRenderStatus.error) { + return React.createElement(AwaitContext.Provider, { + value: promise, + children: errorElement + }); } - if (status === 1) { - return React3.createElement(AwaitContext.Provider, { value: promise, children }); + if (status === AwaitRenderStatus.success) { + return React.createElement(AwaitContext.Provider, { + value: promise, + children + }); } throw promise; } }; -function ResolveAwait({ - children -}) { - let data2 = useAsyncValue(); - let toRender = typeof children === "function" ? children(data2) : children; - return React3.createElement(React3.Fragment, null, toRender); +function ResolveAwait(_ref8) { + let { + children + } = _ref8; + let data = useAsyncValue(); + let toRender = typeof children === "function" ? children(data) : children; + return React.createElement(React.Fragment, null, toRender); } -function createRoutesFromChildren(children, parentPath = []) { +function createRoutesFromChildren(children, parentPath) { + if (parentPath === void 0) { + parentPath = []; + } let routes = []; - React3.Children.forEach(children, (element, index) => { - if (!React3.isValidElement(element)) { + React.Children.forEach(children, (element, index) => { + if (!React.isValidElement(element)) { return; } let treePath = [...parentPath, index]; - if (element.type === React3.Fragment) { - routes.push.apply( - routes, - createRoutesFromChildren(element.props.children, treePath) - ); + if (element.type === React.Fragment) { + routes.push.apply(routes, createRoutesFromChildren(element.props.children, treePath)); return; } - invariant( - element.type === Route, - `[${typeof element.type === "string" ? element.type : element.type.name}] is not a component. All component children of must be a or ` - ); - invariant( - !element.props.index || !element.props.children, - "An index route cannot have child routes." - ); + !(element.type === Route) ? true ? invariant(false, "[" + (typeof element.type === "string" ? element.type : element.type.name) + "] is not a component. All component children of must be a or ") : invariant(false) : void 0; + !(!element.props.index || !element.props.children) ? true ? invariant(false, "An index route cannot have child routes.") : invariant(false) : void 0; let route = { id: element.props.id || treePath.join("-"), caseSensitive: element.props.caseSensitive, @@ -7279,95 +4729,115 @@ function createRoutesFromChildren(children, parentPath = []) { Component: element.props.Component, index: element.props.index, path: element.props.path, - middleware: element.props.middleware, loader: element.props.loader, action: element.props.action, - hydrateFallbackElement: element.props.hydrateFallbackElement, - HydrateFallback: element.props.HydrateFallback, errorElement: element.props.errorElement, ErrorBoundary: element.props.ErrorBoundary, - hasErrorBoundary: element.props.hasErrorBoundary === true || element.props.ErrorBoundary != null || element.props.errorElement != null, + hasErrorBoundary: element.props.ErrorBoundary != null || element.props.errorElement != null, shouldRevalidate: element.props.shouldRevalidate, handle: element.props.handle, lazy: element.props.lazy }; if (element.props.children) { - route.children = createRoutesFromChildren( - element.props.children, - treePath - ); + route.children = createRoutesFromChildren(element.props.children, treePath); } routes.push(route); }); return routes; } -var createRoutesFromElements = createRoutesFromChildren; function renderMatches(matches) { return _renderMatches(matches); } -function useRouteComponentProps() { - return { - params: useParams(), - loaderData: useLoaderData(), - actionData: useActionData(), - matches: useMatches() +function mapRouteProperties(route) { + let updates = { + // Note: this check also occurs in createRoutesFromChildren so update + // there if you change this -- please and thank you! + hasErrorBoundary: route.ErrorBoundary != null || route.errorElement != null }; + if (route.Component) { + if (true) { + if (route.element) { + true ? warning(false, "You should not include both `Component` and `element` on your route - `Component` will be used.") : void 0; + } + } + Object.assign(updates, { + element: React.createElement(route.Component), + Component: void 0 + }); + } + if (route.HydrateFallback) { + if (true) { + if (route.hydrateFallbackElement) { + true ? warning(false, "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used.") : void 0; + } + } + Object.assign(updates, { + hydrateFallbackElement: React.createElement(route.HydrateFallback), + HydrateFallback: void 0 + }); + } + if (route.ErrorBoundary) { + if (true) { + if (route.errorElement) { + true ? warning(false, "You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used.") : void 0; + } + } + Object.assign(updates, { + errorElement: React.createElement(route.ErrorBoundary), + ErrorBoundary: void 0 + }); + } + return updates; } -function WithComponentProps({ - children -}) { - const props = useRouteComponentProps(); - return React3.cloneElement(children, props); +function createMemoryRouter(routes, opts) { + return createRouter({ + basename: opts == null ? void 0 : opts.basename, + future: _extends2({}, opts == null ? void 0 : opts.future, { + v7_prependBasename: true + }), + history: createMemoryHistory({ + initialEntries: opts == null ? void 0 : opts.initialEntries, + initialIndex: opts == null ? void 0 : opts.initialIndex + }), + hydrationData: opts == null ? void 0 : opts.hydrationData, + routes, + mapRouteProperties, + dataStrategy: opts == null ? void 0 : opts.dataStrategy, + patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation + }).initialize(); } -function withComponentProps(Component4) { - return function WithComponentProps2() { - const props = useRouteComponentProps(); - return React3.createElement(Component4, props); + +// node_modules/react-router-dom/dist/index.js +function _extends3() { + _extends3 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; }; + return _extends3.apply(this, arguments); } -function useHydrateFallbackProps() { - return { - params: useParams(), - loaderData: useLoaderData(), - actionData: useActionData() - }; -} -function WithHydrateFallbackProps({ - children -}) { - const props = useHydrateFallbackProps(); - return React3.cloneElement(children, props); -} -function withHydrateFallbackProps(HydrateFallback) { - return function WithHydrateFallbackProps2() { - const props = useHydrateFallbackProps(); - return React3.createElement(HydrateFallback, props); - }; -} -function useErrorBoundaryProps() { - return { - params: useParams(), - loaderData: useLoaderData(), - actionData: useActionData(), - error: useRouteError() - }; -} -function WithErrorBoundaryProps({ - children -}) { - const props = useErrorBoundaryProps(); - return React3.cloneElement(children, props); -} -function withErrorBoundaryProps(ErrorBoundary) { - return function WithErrorBoundaryProps2() { - const props = useErrorBoundaryProps(); - return React3.createElement(ErrorBoundary, props); - }; +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; } var defaultMethod = "get"; var defaultEncType = "application/x-www-form-urlencoded"; function isHtmlElement(object) { - return typeof HTMLElement !== "undefined" && object instanceof HTMLElement; + return object != null && typeof object.tagName === "string"; } function isButtonElement(object) { return isHtmlElement(object) && object.tagName.toLowerCase() === "button"; @@ -7386,15 +4856,14 @@ function shouldProcessLinkClick(event, target) { (!target || target === "_self") && // Let browser handle "target=_blank" etc. !isModifiedEvent(event); } -function createSearchParams(init = "") { - return new URLSearchParams( - typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo2, key) => { - let value = init[key]; - return memo2.concat( - Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]] - ); - }, []) - ); +function createSearchParams(init) { + if (init === void 0) { + init = ""; + } + return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo2, key) => { + let value = init[key]; + return memo2.concat(Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]); + }, [])); } function getSearchParamsForLocation(locationSearch, defaultSearchParams) { let searchParams = createSearchParams(locationSearch); @@ -7425,17 +4894,10 @@ function isFormDataSubmitterSupported() { } return _formDataSupportsSubmitter; } -var supportedFormEncTypes = /* @__PURE__ */ new Set([ - "application/x-www-form-urlencoded", - "multipart/form-data", - "text/plain" -]); +var supportedFormEncTypes = /* @__PURE__ */ new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]); function getFormEncType(encType) { if (encType != null && !supportedFormEncTypes.has(encType)) { - warning( - false, - `"${encType}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${defaultEncType}"` - ); + true ? warning(false, '"' + encType + '" is not a valid `encType` for ``/`` ' + ('and will default to "' + defaultEncType + '"')) : void 0; return null; } return encType; @@ -7455,9 +4917,7 @@ function getFormSubmissionInfo(target, basename) { } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) { let form = target.form; if (form == null) { - throw new Error( - `Cannot submit a