document-drive 1.29.4-dev.2 → 1.29.4-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,91 @@
1
+ // This is your Prisma schema file,
2
+ // learn more about it in the docs: https://pris.ly/d/prisma-schema
3
+
4
+ generator client {
5
+ provider = "prisma-client-js"
6
+ output = "../src/storage/prisma/client"
7
+ }
8
+
9
+ datasource db {
10
+ provider = "postgresql"
11
+ url = env("DATABASE_URL")
12
+ }
13
+
14
+ model Drive {
15
+ id String @id
16
+ slug String @unique
17
+ driveDocuments DriveDocument[]
18
+ }
19
+
20
+ model Document {
21
+ id String @id
22
+ created DateTime @default(now())
23
+ lastModified DateTime @default(now())
24
+ isDrive Boolean
25
+ revision String
26
+ name String?
27
+ operations Operation[]
28
+ initialState String // json object with the scope as keys of the root object
29
+ documentType String
30
+ meta String?
31
+ synchronizationUnits SynchronizationUnit[]
32
+ driveDocuments DriveDocument[]
33
+ }
34
+
35
+ // Model to map the many-to-many relationship between drives and documents
36
+ model DriveDocument {
37
+ driveId String
38
+ documentId String
39
+ drive Drive @relation(fields: [driveId], references: [id], onDelete: Cascade)
40
+ document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
41
+
42
+ @@id([driveId, documentId])
43
+ @@index([driveId])
44
+ @@index([documentId])
45
+ }
46
+
47
+ model Operation {
48
+ id String @id @default(uuid())
49
+ opId String?
50
+ Document Document? @relation(fields: [documentId], references: [id], onDelete: Cascade)
51
+ documentId String
52
+ scope String
53
+ branch String
54
+ index Int
55
+ skip Int
56
+ hash String
57
+ timestamp DateTime
58
+ input String
59
+ type String
60
+ attachments Attachment[]
61
+ syncId String?
62
+ clipboard Boolean? @default(false)
63
+ context Json?
64
+ resultingState Bytes?
65
+
66
+ SynchronizationUnit SynchronizationUnit? @relation(fields: [syncId], references: [id], onDelete: Cascade)
67
+
68
+ @@unique([documentId, scope, branch, index(sort: Asc)], name: "unique_operation")
69
+ }
70
+
71
+ model SynchronizationUnit {
72
+ id String @id
73
+ documentId String
74
+
75
+ Document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
76
+ scope String
77
+ branch String
78
+ operations Operation[]
79
+ }
80
+
81
+ model Attachment {
82
+ id String @id @default(uuid())
83
+ operationId String
84
+ Operation Operation @relation(fields: [operationId], references: [id], onDelete: Cascade)
85
+
86
+ mimeType String
87
+ data String
88
+ filename String?
89
+ extension String?
90
+ hash String
91
+ }
@@ -0,0 +1 @@
1
+ export * from './index'
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/storage/prisma/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAWxC,KAAK;CAGN"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/storage/prisma/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAWxC,KAAK;CAGN"}
@@ -1,6 +1,5 @@
1
1
  import { PrismaStorage } from "#storage/prisma/index";
2
- import Prisma from "./client/index.js";
3
- const PrismaClient = Prisma.PrismaClient;
2
+ import { PrismaClient } from "./client/index.js";
4
3
  export class PrismaStorageFactory {
5
4
  prisma;
6
5
  cache;