document-drive 4.1.0-dev.77 → 4.1.0-dev.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-drive",
3
- "version": "4.1.0-dev.77",
3
+ "version": "4.1.0-dev.78",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -36,7 +36,8 @@
36
36
  },
37
37
  "files": [
38
38
  "./dist",
39
- "./src/storage/prisma/client"
39
+ "./src/storage/prisma/client",
40
+ "./prisma/schema.prisma"
40
41
  ],
41
42
  "sideEffects": false,
42
43
  "optionalDependencies": {
@@ -67,8 +68,8 @@
67
68
  "sqlite3": "^5.1.7",
68
69
  "uuid": "^11.0.5",
69
70
  "zod": "^3.24.3",
70
- "@powerhousedao/config": "4.1.0-dev.77",
71
- "document-model": "4.1.0-dev.77"
71
+ "@powerhousedao/config": "4.1.0-dev.78",
72
+ "document-model": "4.1.0-dev.78"
72
73
  },
73
74
  "devDependencies": {
74
75
  "@anatine/zod-mock": "^3.14.0",
@@ -0,0 +1,93 @@
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
+ binaryTargets = ["native", "linux-musl"]
7
+ output = "../src/storage/prisma/client"
8
+ }
9
+
10
+ datasource db {
11
+ provider = "postgresql"
12
+ url = env("DATABASE_URL")
13
+ }
14
+
15
+ model Drive {
16
+ id String @id
17
+ driveDocuments DriveDocument[]
18
+ }
19
+
20
+ model Document {
21
+ id String @id
22
+ // ordinal used only for paging
23
+ ordinal Int @default(autoincrement()) @unique
24
+ created DateTime @default(now())
25
+ lastModified DateTime @default(now())
26
+ slug String? @unique
27
+ revision String
28
+ name String?
29
+ operations Operation[]
30
+ initialState String // json object with the scope as keys of the root object
31
+ documentType String
32
+ meta String?
33
+ synchronizationUnits SynchronizationUnit[]
34
+ scopes String[]
35
+ }
36
+
37
+ // Model to map the many-to-many relationship between drives and documents
38
+ model DriveDocument {
39
+ driveId String
40
+ documentId String
41
+ drive Drive @relation(fields: [driveId], references: [id], onDelete: Cascade)
42
+
43
+ @@id([driveId, documentId])
44
+ @@index([driveId])
45
+ @@index([documentId])
46
+ }
47
+
48
+ model Operation {
49
+ id String @id @default(uuid())
50
+ opId String?
51
+ Document Document? @relation(fields: [documentId], references: [id], onDelete: Cascade)
52
+ documentId String
53
+ scope String
54
+ branch String
55
+ index Int
56
+ skip Int
57
+ hash String
58
+ timestamp DateTime
59
+ actionId String
60
+ input String
61
+ type String
62
+ attachments Attachment[]
63
+ syncId String?
64
+ clipboard Boolean? @default(false)
65
+ context Json?
66
+ resultingState Bytes?
67
+
68
+ SynchronizationUnit SynchronizationUnit? @relation(fields: [syncId], references: [id], onDelete: Cascade)
69
+
70
+ @@unique([documentId, scope, branch, index(sort: Asc)], name: "unique_operation")
71
+ }
72
+
73
+ model SynchronizationUnit {
74
+ id String @id
75
+ documentId String
76
+
77
+ Document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
78
+ scope String
79
+ branch String
80
+ operations Operation[]
81
+ }
82
+
83
+ model Attachment {
84
+ id String @id @default(uuid())
85
+ operationId String
86
+ Operation Operation @relation(fields: [operationId], references: [id], onDelete: Cascade)
87
+
88
+ mimeType String
89
+ data String
90
+ filename String?
91
+ extension String?
92
+ hash String
93
+ }