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

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,246 @@
1
+
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+ const {
5
+ Decimal,
6
+ objectEnumValues,
7
+ makeStrictEnum,
8
+ Public,
9
+ getRuntime,
10
+ } = require('./runtime/index-browser.js')
11
+
12
+
13
+ const Prisma = {}
14
+
15
+ exports.Prisma = Prisma
16
+ exports.$Enums = {}
17
+
18
+ /**
19
+ * Prisma Client JS version: 5.17.0
20
+ * Query Engine version: 393aa359c9ad4a4bb28630fb5613f9c281cde053
21
+ */
22
+ Prisma.prismaVersion = {
23
+ client: "5.17.0",
24
+ engine: "393aa359c9ad4a4bb28630fb5613f9c281cde053"
25
+ }
26
+
27
+ Prisma.PrismaClientKnownRequestError = () => {
28
+ const runtimeName = getRuntime().prettyName;
29
+ throw new Error(`PrismaClientKnownRequestError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
30
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
31
+ )};
32
+ Prisma.PrismaClientUnknownRequestError = () => {
33
+ const runtimeName = getRuntime().prettyName;
34
+ throw new Error(`PrismaClientUnknownRequestError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
35
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
36
+ )}
37
+ Prisma.PrismaClientRustPanicError = () => {
38
+ const runtimeName = getRuntime().prettyName;
39
+ throw new Error(`PrismaClientRustPanicError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
40
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
41
+ )}
42
+ Prisma.PrismaClientInitializationError = () => {
43
+ const runtimeName = getRuntime().prettyName;
44
+ throw new Error(`PrismaClientInitializationError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
45
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
46
+ )}
47
+ Prisma.PrismaClientValidationError = () => {
48
+ const runtimeName = getRuntime().prettyName;
49
+ throw new Error(`PrismaClientValidationError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
50
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
51
+ )}
52
+ Prisma.NotFoundError = () => {
53
+ const runtimeName = getRuntime().prettyName;
54
+ throw new Error(`NotFoundError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
55
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
56
+ )}
57
+ Prisma.Decimal = Decimal
58
+
59
+ /**
60
+ * Re-export of sql-template-tag
61
+ */
62
+ Prisma.sql = () => {
63
+ const runtimeName = getRuntime().prettyName;
64
+ throw new Error(`sqltag is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
65
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
66
+ )}
67
+ Prisma.empty = () => {
68
+ const runtimeName = getRuntime().prettyName;
69
+ throw new Error(`empty is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
70
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
71
+ )}
72
+ Prisma.join = () => {
73
+ const runtimeName = getRuntime().prettyName;
74
+ throw new Error(`join is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
75
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
76
+ )}
77
+ Prisma.raw = () => {
78
+ const runtimeName = getRuntime().prettyName;
79
+ throw new Error(`raw is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
80
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
81
+ )}
82
+ Prisma.validator = Public.validator
83
+
84
+ /**
85
+ * Extensions
86
+ */
87
+ Prisma.getExtensionContext = () => {
88
+ const runtimeName = getRuntime().prettyName;
89
+ throw new Error(`Extensions.getExtensionContext is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
90
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
91
+ )}
92
+ Prisma.defineExtension = () => {
93
+ const runtimeName = getRuntime().prettyName;
94
+ throw new Error(`Extensions.defineExtension is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
95
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
96
+ )}
97
+
98
+ /**
99
+ * Shorthand utilities for JSON filtering
100
+ */
101
+ Prisma.DbNull = objectEnumValues.instances.DbNull
102
+ Prisma.JsonNull = objectEnumValues.instances.JsonNull
103
+ Prisma.AnyNull = objectEnumValues.instances.AnyNull
104
+
105
+ Prisma.NullTypes = {
106
+ DbNull: objectEnumValues.classes.DbNull,
107
+ JsonNull: objectEnumValues.classes.JsonNull,
108
+ AnyNull: objectEnumValues.classes.AnyNull
109
+ }
110
+
111
+ /**
112
+ * Enums
113
+ */
114
+
115
+ exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
116
+ ReadUncommitted: 'ReadUncommitted',
117
+ ReadCommitted: 'ReadCommitted',
118
+ RepeatableRead: 'RepeatableRead',
119
+ Serializable: 'Serializable'
120
+ });
121
+
122
+ exports.Prisma.DriveScalarFieldEnum = {
123
+ id: 'id'
124
+ };
125
+
126
+ exports.Prisma.DocumentScalarFieldEnum = {
127
+ id: 'id',
128
+ ordinal: 'ordinal',
129
+ created: 'created',
130
+ lastModified: 'lastModified',
131
+ slug: 'slug',
132
+ revision: 'revision',
133
+ name: 'name',
134
+ initialState: 'initialState',
135
+ documentType: 'documentType',
136
+ meta: 'meta',
137
+ scopes: 'scopes'
138
+ };
139
+
140
+ exports.Prisma.DriveDocumentScalarFieldEnum = {
141
+ driveId: 'driveId',
142
+ documentId: 'documentId'
143
+ };
144
+
145
+ exports.Prisma.OperationScalarFieldEnum = {
146
+ id: 'id',
147
+ opId: 'opId',
148
+ documentId: 'documentId',
149
+ scope: 'scope',
150
+ branch: 'branch',
151
+ index: 'index',
152
+ skip: 'skip',
153
+ hash: 'hash',
154
+ timestamp: 'timestamp',
155
+ actionId: 'actionId',
156
+ input: 'input',
157
+ type: 'type',
158
+ syncId: 'syncId',
159
+ clipboard: 'clipboard',
160
+ context: 'context',
161
+ resultingState: 'resultingState'
162
+ };
163
+
164
+ exports.Prisma.SynchronizationUnitScalarFieldEnum = {
165
+ id: 'id',
166
+ documentId: 'documentId',
167
+ scope: 'scope',
168
+ branch: 'branch'
169
+ };
170
+
171
+ exports.Prisma.AttachmentScalarFieldEnum = {
172
+ id: 'id',
173
+ operationId: 'operationId',
174
+ mimeType: 'mimeType',
175
+ data: 'data',
176
+ filename: 'filename',
177
+ extension: 'extension',
178
+ hash: 'hash'
179
+ };
180
+
181
+ exports.Prisma.SortOrder = {
182
+ asc: 'asc',
183
+ desc: 'desc'
184
+ };
185
+
186
+ exports.Prisma.NullableJsonNullValueInput = {
187
+ DbNull: Prisma.DbNull,
188
+ JsonNull: Prisma.JsonNull
189
+ };
190
+
191
+ exports.Prisma.QueryMode = {
192
+ default: 'default',
193
+ insensitive: 'insensitive'
194
+ };
195
+
196
+ exports.Prisma.NullsOrder = {
197
+ first: 'first',
198
+ last: 'last'
199
+ };
200
+
201
+ exports.Prisma.JsonNullValueFilter = {
202
+ DbNull: Prisma.DbNull,
203
+ JsonNull: Prisma.JsonNull,
204
+ AnyNull: Prisma.AnyNull
205
+ };
206
+
207
+
208
+ exports.Prisma.ModelName = {
209
+ Drive: 'Drive',
210
+ Document: 'Document',
211
+ DriveDocument: 'DriveDocument',
212
+ Operation: 'Operation',
213
+ SynchronizationUnit: 'SynchronizationUnit',
214
+ Attachment: 'Attachment'
215
+ };
216
+
217
+ /**
218
+ * This is a stub Prisma Client that will error at runtime if called.
219
+ */
220
+ class PrismaClient {
221
+ constructor() {
222
+ return new Proxy(this, {
223
+ get(target, prop) {
224
+ let message
225
+ const runtime = getRuntime()
226
+ if (runtime.isEdge) {
227
+ message = `PrismaClient is not configured to run in ${runtime.prettyName}. In order to run Prisma Client on edge runtime, either:
228
+ - Use Prisma Accelerate: https://pris.ly/d/accelerate
229
+ - Use Driver Adapters: https://pris.ly/d/driver-adapters
230
+ `;
231
+ } else {
232
+ message = 'PrismaClient is unable to run in this browser environment, or has been bundled for the browser (running in `' + runtime.prettyName + '`).'
233
+ }
234
+
235
+ message += `
236
+ If this is unexpected, please open an issue: https://pris.ly/prisma-prisma-bug-report`
237
+
238
+ throw new Error(message)
239
+ }
240
+ })
241
+ }
242
+ }
243
+
244
+ exports.PrismaClient = PrismaClient
245
+
246
+ Object.assign(exports, Prisma)
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.79",
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
+ "document-model": "4.1.0-dev.79",
72
+ "@powerhousedao/config": "4.1.0-dev.79"
72
73
  },
73
74
  "devDependencies": {
74
75
  "@anatine/zod-mock": "^3.14.0",
@@ -87,6 +88,7 @@
87
88
  "scripts": {
88
89
  "tsc": "tsc",
89
90
  "lint": "eslint",
91
+ "build": "pnpm run copy-prisma",
90
92
  "release": "semantic-release",
91
93
  "test": "vitest run --coverage --exclude \"test/flaky/**\"",
92
94
  "test:flaky": "vitest run --coverage test/flaky",
@@ -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
+ }