dokuments 3.2.0__tar.gz → 3.3.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dokuments
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Summary: The python client for dokuments, the arkitekt document service
5
5
  Author-email: jhnnsrs <jhnnsrs@gmail.com>
6
6
  Requires-Python: >=3.11
@@ -69,7 +69,9 @@ from arkitekt import easy
69
69
  from dokuments import dokuments_service
70
70
 
71
71
  with easy("my-script", dokuments_service) as dokuments:
72
- file = dokuments.from_file_like(file="scan.pdf") # a path, a Path or a binary file object
72
+ file = dokuments.from_file_like(
73
+ file="scan.pdf"
74
+ ) # a path, a Path or a binary file object
73
75
  document = dokuments.create_document(title="My scan", file=file.id)
74
76
  print(document.id, file.store.download()) # the bytes, through a scoped read grant
75
77
  ```
@@ -54,7 +54,9 @@ from arkitekt import easy
54
54
  from dokuments import dokuments_service
55
55
 
56
56
  with easy("my-script", dokuments_service) as dokuments:
57
- file = dokuments.from_file_like(file="scan.pdf") # a path, a Path or a binary file object
57
+ file = dokuments.from_file_like(
58
+ file="scan.pdf"
59
+ ) # a path, a Path or a binary file object
58
60
  document = dokuments.create_document(title="My scan", file=file.id)
59
61
  print(document.id, file.store.download()) # the bytes, through a scoped read grant
60
62
  ```
@@ -1,6 +1,5 @@
1
- from .dokuments import Dokuments
2
-
3
1
  # The service is declared with arkitekt-spec, a core dependency: it is always there.
4
2
  from .arkitekt import dokuments as dokuments_service
3
+ from .dokuments import Dokuments
5
4
 
6
5
  __all__ = ["Dokuments", "dokuments_service"]
@@ -0,0 +1 @@
1
+ {"version": "6.5.0"}
@@ -0,0 +1,554 @@
1
+ directive @auth(required_scopes: [String!], required_roles: [String!], required_org_roles: [String!], any_scope_of: [String!], any_role_of: [String!], any_org_role_of: [String!], allow_scoped: Boolean) on FIELD_DEFINITION
2
+
3
+ directive @identified(by: String!) on OBJECT
4
+
5
+ schema @link(url: "https://specs.apollo.dev/federation/v2.11", import: ["@key"]) {
6
+ query: Query
7
+ mutation: Mutation
8
+ subscription: Subscription
9
+ }
10
+
11
+ """Objects to put in a collaboration at once: all of them, or none"""
12
+ input AddManyToCollaborationInput {
13
+ """The collaboration's key (lok's)"""
14
+ collaboration: ID!
15
+
16
+ """What to put in; a whole before its parts"""
17
+ objects: [CollaborationObjectRef!]!
18
+
19
+ """
20
+ The collaboration's name, kept here when these are the first things put in
21
+ """
22
+ name: String = null
23
+ }
24
+
25
+ """
26
+ A number of bytes. 64-bit, unlike Int: serialized as a JSON number, and accepted as a number or a numeric string.
27
+ """
28
+ scalar ByteCount
29
+
30
+ """
31
+ What a guest granted it sees of the organization: the objects put in it, and what is part of them.
32
+ """
33
+ type Collaboration {
34
+ id: ID!
35
+ name: String!
36
+ description: String
37
+ createdAt: DateTime!
38
+
39
+ """
40
+ The collaboration's key across the hub: what lok grants, and what names it in every service
41
+ """
42
+ key: ID!
43
+
44
+ """
45
+ What is in the collaboration, oldest first; what is part of these is in it too. `brought` keeps what was put in by hand (false) or only what came along with it (true)
46
+ """
47
+ items(brought: Boolean = null, pagination: OffsetPaginationInput = null): [CollaborationItem!]!
48
+
49
+ """
50
+ How many objects are in the collaboration: all of them, or (`brought`) only those put in by hand (false) or only those that came along with one (true)
51
+ """
52
+ itemCount(brought: Boolean = null): Int!
53
+ }
54
+
55
+ """
56
+ One object in a collaboration: put there, or brought along with one that needs it to be seen.
57
+ """
58
+ type CollaborationItem {
59
+ id: ID!
60
+
61
+ """The object's id, in its structure"""
62
+ objectId: String!
63
+ addedAt: DateTime!
64
+
65
+ """The structure the object is known by across the hub: @mikro/scene"""
66
+ identifier: String
67
+
68
+ """
69
+ Whether it is in the collaboration only as what another object in it needs to be seen
70
+ """
71
+ brought: Boolean!
72
+ }
73
+
74
+ """An object to put in, or take out of, a collaboration"""
75
+ input CollaborationObjectInput {
76
+ """The collaboration's key (lok's)"""
77
+ collaboration: ID!
78
+
79
+ """The structure the object is known by: @mikro/scene"""
80
+ identifier: String!
81
+
82
+ """The object's id"""
83
+ object: ID!
84
+
85
+ """
86
+ The collaboration's name, kept here when this is the first thing put in
87
+ """
88
+ name: String = null
89
+ }
90
+
91
+ """An object, by its structure and id"""
92
+ input CollaborationObjectRef {
93
+ """The structure the object is known by: @mikro/scene"""
94
+ identifier: String!
95
+
96
+ """The object's id"""
97
+ object: ID!
98
+ }
99
+
100
+ """
101
+ How many collaborations the organization has (a guest: theirs), and how much is in them
102
+ """
103
+ type CollaborationStats {
104
+ """How many collaborations"""
105
+ count: Int!
106
+
107
+ """How many objects are in them altogether, brought along ones included"""
108
+ itemCount: Int!
109
+ }
110
+
111
+ input CreateDocumentInput {
112
+ file: ID = null
113
+ title: String!
114
+ }
115
+
116
+ input CreatePageInput {
117
+ image: FileLike!
118
+ index: Int!
119
+ document: ID!
120
+ ocrResult: OCRPageResultInput!
121
+ content: String = null
122
+ }
123
+
124
+ """Date with time (isoformat)"""
125
+ scalar DateTime
126
+
127
+ input DeleteFileInput {
128
+ id: ID!
129
+ }
130
+
131
+ type Document @identified(by: "@dokuments/document") {
132
+ id: ID!
133
+ file: File!
134
+ title: String!
135
+ processedAt: String
136
+
137
+ """The document's pages, in reading order (by index)."""
138
+ pages(filters: PageFilter, pagination: OffsetPaginationInput): [Page!]!
139
+
140
+ """How many pages the document has."""
141
+ pageCount: Int!
142
+ }
143
+
144
+ input DocumentFilter {
145
+ ids: [ID!]
146
+
147
+ """
148
+ Only what is in this collaboration (its key): put in, or part of what was
149
+ """
150
+ inCollaboration: ID
151
+
152
+ """Only what the workflow (its root task id) created"""
153
+ createdUnder: ID
154
+ id: ID
155
+ search: String
156
+ AND: DocumentFilter
157
+ OR: DocumentFilter
158
+ NOT: DocumentFilter
159
+ DISTINCT: Boolean
160
+ }
161
+
162
+ type File @identified(by: "@dokuments/file") {
163
+ id: ID!
164
+ name: String!
165
+ store: MediaStore
166
+
167
+ """The documents that reference this file"""
168
+ documents(filters: DocumentFilter, pagination: OffsetPaginationInput): [Document!]!
169
+ }
170
+
171
+ type FileEvent {
172
+ create: File
173
+ delete: ID
174
+ update: File
175
+ moved: File
176
+ }
177
+
178
+ input FileFilter {
179
+ ids: [ID!]
180
+ search: String
181
+
182
+ """
183
+ Only what is in this collaboration (its key): put in, or part of what was
184
+ """
185
+ inCollaboration: ID
186
+
187
+ """Only what the workflow (its root task id) created"""
188
+ createdUnder: ID
189
+ id: ID
190
+ name: StrFilterLookup
191
+ AND: FileFilter
192
+ OR: FileFilter
193
+ NOT: FileFilter
194
+ DISTINCT: Boolean
195
+ }
196
+
197
+ """
198
+ The `FileLike` scalar type represents a reference to a big file storage previously created by the user n a datalayer
199
+ """
200
+ scalar FileLike
201
+
202
+ input FinishMediaUploadInput {
203
+ storeId: String!
204
+ valid: Boolean! = true
205
+ }
206
+
207
+ input FromFileLike {
208
+ file: FileLike!
209
+ dataset: ID = null
210
+ origins: [ID!] = null
211
+ }
212
+
213
+ """Temporary S3 credentials for reading a media object."""
214
+ type GeneralMediaAccessGrant {
215
+ status: String!
216
+ accessKey: String!
217
+ secretKey: String!
218
+ sessionToken: String!
219
+ region: String!
220
+ bucket: String!
221
+ prefix: String!
222
+ expiresIn: Int!
223
+ }
224
+
225
+ """Temporary S3 credentials for reading a media object."""
226
+ type MediaAccessGrant {
227
+ status: String!
228
+ accessKey: String!
229
+ secretKey: String!
230
+ sessionToken: String!
231
+ region: String!
232
+ bucket: String!
233
+ key: String!
234
+ path: String!
235
+ expiresIn: Int!
236
+ store: String
237
+ }
238
+
239
+ type MediaStore @key(fields: "id", resolvable: true) {
240
+ id: ID!
241
+ path: String!
242
+ bucket: String!
243
+ key: String!
244
+
245
+ """
246
+ The byte budget the upload grant advertised for this store. Advertised, not enforced: a session policy bounds what a credential may write, never how much, so a store may exceed this
247
+ """
248
+ maxBytes: ByteCount
249
+
250
+ """
251
+ How many bytes this store actually holds, measured when its upload was finished. Null while unfinished, or for stores written before this was recorded
252
+ """
253
+ sizeBytes: ByteCount
254
+ originalFileName: String
255
+ contentType: String
256
+
257
+ """Get temporary S3 read credentials for the media object."""
258
+ accessGrant: MediaAccessGrant!
259
+ }
260
+
261
+ """Temporary S3 credentials for uploading a media object."""
262
+ type MediaUploadGrant {
263
+ status: String!
264
+ accessKey: String!
265
+ secretKey: String!
266
+ sessionToken: String!
267
+ region: String!
268
+ bucket: String!
269
+ key: String!
270
+ path: String!
271
+ expiresIn: Int!
272
+ store: String!
273
+ maxBytes: ByteCount!
274
+ originalFileName: String
275
+ uploadFileName: String!
276
+ uploadContentType: String
277
+ }
278
+
279
+ type Mutation {
280
+ """
281
+ Request temporary S3 credentials to upload one file (a document, or a page's image).
282
+ """
283
+ requestMediaUpload(input: RequestMediaUploadInput!): MediaUploadGrant! @auth(required_scopes: ["dokuments_write"], any_role_of: ["dokuments_editor"])
284
+
285
+ """Finalize an upload after the client has written the object."""
286
+ finishMediaUpload(input: FinishMediaUploadInput!): MediaStore! @auth(required_scopes: ["dokuments_write"], any_role_of: ["dokuments_editor"])
287
+
288
+ """
289
+ Reissue upload credentials for a media upload still in flight, to the same key, so a write that outlives its credentials carries on. Only the uploader may, never for a finished store, and never past the upload's time limit
290
+ """
291
+ refreshMediaUpload(input: RefreshUploadInput!): MediaUploadGrant! @auth(required_scopes: ["dokuments_write"], any_role_of: ["dokuments_editor"])
292
+
293
+ """
294
+ Request temporary S3 read credentials for an uploaded file (a file's bytes, or a page's image). A guest of the organization gets them only for what is in one of their collaborations.
295
+ """
296
+ requestMediaAccess(input: RequestMediaAccessInput!): MediaAccessGrant! @auth(required_scopes: ["dokuments_read"], allow_scoped: true)
297
+
298
+ """Request temporary S3 read credentials for the organization's files."""
299
+ requestGeneralMediaAccess(input: RequestGeneralMediaAccessInput!): GeneralMediaAccessGrant! @auth(required_scopes: ["dokuments_read"])
300
+
301
+ """Create a file from file-like data"""
302
+ fromFileLike(input: FromFileLike!): File! @auth(required_scopes: ["dokuments_write"], any_role_of: ["dokuments_editor"])
303
+
304
+ """Delete an existing file"""
305
+ deleteFile(input: DeleteFileInput!): ID! @auth(required_scopes: ["dokuments_write"], any_role_of: ["dokuments_editor"])
306
+
307
+ """Create a new document"""
308
+ createDocument(input: CreateDocumentInput!): Document! @auth(required_scopes: ["dokuments_write"], any_role_of: ["dokuments_editor"])
309
+
310
+ """Create a new page in a document"""
311
+ createPage(input: CreatePageInput!): Page! @auth(required_scopes: ["dokuments_write"], any_role_of: ["dokuments_editor"])
312
+
313
+ """
314
+ Put a file in a collaboration (lok's, by its key), with its bytes and its pages' images: its documents and their pages are in it with it. The collaboration's row here is made the first time something is put in
315
+ """
316
+ addToCollaboration(input: CollaborationObjectInput!): Collaboration! @auth(required_scopes: ["dokuments_share"], any_role_of: ["dokuments_editor"])
317
+
318
+ """
319
+ Put several files in a collaboration (by its key) at once, each with what it needs to be seen: all of them, or none
320
+ """
321
+ addManyToCollaboration(input: AddManyToCollaborationInput!): Collaboration! @auth(required_scopes: ["dokuments_share"], any_role_of: ["dokuments_editor"])
322
+
323
+ """
324
+ Put what a workflow (its root task) created in dokuments in a collaboration, as it is now: what it makes later is not. A document or page made in the workflow for a file made before it, and not shared, is left out and reported; `dryRun` only says what would be put in
325
+ """
326
+ shareWorkflow(input: ShareWorkflowInput!): WorkflowShare! @auth(required_scopes: ["dokuments_share"], any_role_of: ["dokuments_editor"])
327
+
328
+ """
329
+ Take a file out of a collaboration, with what it brought that nothing else there needs
330
+ """
331
+ removeFromCollaboration(input: CollaborationObjectInput!): Collaboration! @auth(required_scopes: ["dokuments_share"], any_role_of: ["dokuments_editor"])
332
+
333
+ """
334
+ Take everything dokuments put in a collaboration (by its key) out of it: whoever was granted it sees nothing of it here any more. lok's collaboration, and its grants, stay
335
+ """
336
+ deleteCollaboration(key: ID!): ID! @auth(required_scopes: ["dokuments_share"], any_role_of: ["dokuments_editor"])
337
+ }
338
+
339
+ type OCRPageResult {
340
+ lines: [OCRTextLine!]!
341
+ angle: Float!
342
+ }
343
+
344
+ input OCRPageResultInput {
345
+ """Estimated rotation angle of the page"""
346
+ angle: Float!
347
+ lines: [OCRTextLineInput!]!
348
+ }
349
+
350
+ type OCRTextLine {
351
+ text: String!
352
+ score: Float!
353
+ angle: Float!
354
+ bbox: [[Int!]!]!
355
+ }
356
+
357
+ input OCRTextLineInput {
358
+ text: String!
359
+ score: Float!
360
+ angle: Float!
361
+ bbox: [[Int!]!]!
362
+ }
363
+
364
+ input OffsetPaginationInput {
365
+ offset: Int! = 0
366
+ limit: Int
367
+ }
368
+
369
+ type Page @identified(by: "@dokuments/page") {
370
+ id: ID!
371
+ document: Document!
372
+ index: Int!
373
+ image: MediaStore!
374
+
375
+ """
376
+ The content of the page as a flat string. Null when no text was recognised on it.
377
+ """
378
+ content: String
379
+ ocrResult: OCRPageResult
380
+ }
381
+
382
+ input PageFilter {
383
+ ids: [ID!]
384
+
385
+ """
386
+ Only what is in this collaboration (its key): put in, or part of what was
387
+ """
388
+ inCollaboration: ID
389
+
390
+ """Only what the workflow (its root task id) created"""
391
+ createdUnder: ID
392
+ id: ID
393
+ search: String
394
+ AND: PageFilter
395
+ OR: PageFilter
396
+ NOT: PageFilter
397
+ DISTINCT: Boolean
398
+ }
399
+
400
+ type Query {
401
+ _entities(representations: [_Any!]!): [_Entity]!
402
+ _service: _Service!
403
+ files(filters: FileFilter, pagination: OffsetPaginationInput): [File!]! @auth(required_scopes: ["dokuments_read"])
404
+ documents(filters: DocumentFilter, pagination: OffsetPaginationInput): [Document!]! @auth(required_scopes: ["dokuments_read"])
405
+ pages(filters: PageFilter, pagination: OffsetPaginationInput): [Page!]! @auth(required_scopes: ["dokuments_read"])
406
+
407
+ """
408
+ List the organization's collaborations that hold something of dokuments (a guest: the collaborations granted to them)
409
+ """
410
+ collaborations(pagination: OffsetPaginationInput = null): [Collaboration!]! @auth(required_scopes: ["dokuments_read"])
411
+
412
+ """Get a single collaboration by its key (lok's): what was put in it here"""
413
+ collaboration(key: ID!): Collaboration! @auth(required_scopes: ["dokuments_read"])
414
+
415
+ """
416
+ Count the collaborations `collaborations` lists, and the objects in them
417
+ """
418
+ collaborationsStats: CollaborationStats! @auth(required_scopes: ["dokuments_read"])
419
+ file(
420
+ """The unique identifier of an object"""
421
+ id: ID!
422
+ ): File! @auth(required_scopes: ["dokuments_read"])
423
+ document(
424
+ """The unique identifier of an object"""
425
+ id: ID!
426
+ ): Document! @auth(required_scopes: ["dokuments_read"])
427
+ page(
428
+ """The unique identifier of an object"""
429
+ id: ID!
430
+ ): Page! @auth(required_scopes: ["dokuments_read"])
431
+ }
432
+
433
+ input RefreshUploadInput {
434
+ storeId: String!
435
+ }
436
+
437
+ input RequestGeneralMediaAccessInput {
438
+ expiresIn: Int = null
439
+ }
440
+
441
+ input RequestMediaAccessInput {
442
+ storeId: String!
443
+ }
444
+
445
+ input RequestMediaUploadInput {
446
+ originalFileName: String!
447
+ fileSize: ByteCount!
448
+ contentType: String = null
449
+ }
450
+
451
+ """Put what a workflow created in a collaboration, as it is now"""
452
+ input ShareWorkflowInput {
453
+ """The collaboration's key (lok's)"""
454
+ collaboration: ID!
455
+
456
+ """
457
+ The workflow: the id of the task a person started, the root of every task it caused
458
+ """
459
+ rootTask: ID!
460
+
461
+ """Only say what would be put in, and what left out"""
462
+ dryRun: Boolean! = false
463
+
464
+ """The collaboration's name, kept here when this puts the first things in"""
465
+ name: String = null
466
+ }
467
+
468
+ """An object, by its structure and id"""
469
+ type SharedObject {
470
+ """The structure the object is known by: @mikro/scene"""
471
+ identifier: String
472
+
473
+ """The object's id"""
474
+ object: ID!
475
+ }
476
+
477
+ """
478
+ Created in the workflow, but part of something made before it that is not shared: left out
479
+ """
480
+ type SkippedObject {
481
+ """The structure the object is known by"""
482
+ identifier: String
483
+
484
+ """The object's id"""
485
+ object: ID!
486
+
487
+ """The structure of what it is part of"""
488
+ wholeIdentifier: String
489
+
490
+ """
491
+ The id of what it is part of: put that in, and share the workflow again, to bring it
492
+ """
493
+ whole: ID!
494
+ }
495
+
496
+ input StrFilterLookup {
497
+ exact: String
498
+ iExact: String
499
+ contains: String
500
+ iContains: String
501
+ inList: [String!]
502
+ gt: String
503
+ gte: String
504
+ lt: String
505
+ lte: String
506
+ startsWith: String
507
+ iStartsWith: String
508
+ endsWith: String
509
+ iEndsWith: String
510
+ range: [String!]
511
+ isNull: Boolean
512
+ regex: String
513
+ iRegex: String
514
+ }
515
+
516
+ type Subscription {
517
+ """Subscribe to real-time file updates"""
518
+ files(dataset: ID = null): FileEvent! @auth(required_scopes: ["dokuments_read"])
519
+ }
520
+
521
+ """
522
+ What sharing a workflow put in a collaboration here (or, tried, would put in)
523
+ """
524
+ type WorkflowShare {
525
+ """The collaboration's key"""
526
+ collaboration: ID!
527
+
528
+ """Whether nothing was written"""
529
+ dryRun: Boolean!
530
+
531
+ """Put in, with what each needs to be seen"""
532
+ added: [SharedObject!]!
533
+
534
+ """
535
+ How many parts came along with their whole, without being put in themselves
536
+ """
537
+ covered: Int!
538
+
539
+ """Left out: parts of something made before the workflow and not shared"""
540
+ skipped: [SkippedObject!]!
541
+
542
+ """
543
+ Structures here that cannot say what created their objects: not looked at
544
+ """
545
+ unknown: [String!]!
546
+ }
547
+
548
+ scalar _Any
549
+
550
+ union _Entity = MediaStore
551
+
552
+ type _Service {
553
+ sdl: String!
554
+ }
@@ -212,8 +212,8 @@ class Page(BaseModel):
212
212
  typename: Literal["Page"] = Field(alias="__typename", default="Page", exclude=True)
213
213
  id: ID
214
214
  index: int
215
- content: str
216
- "The content of the page as a flat string."
215
+ content: str | None = Field(default=None)
216
+ "The content of the page as a flat string. Null when no text was recognised on it."
217
217
  model_config = ConfigDict(frozen=True)
218
218
 
219
219
  class Meta:
@@ -257,6 +257,7 @@ class Document(BaseModel):
257
257
  id: ID
258
258
  title: str
259
259
  pages: tuple[Page, ...]
260
+ "The document's pages, in reading order (by index)."
260
261
  model_config = ConfigDict(frozen=True)
261
262
 
262
263
  class Meta:
@@ -355,7 +356,7 @@ class RequestMediaAccessMutation(BaseModel):
355
356
  """No documentation found for this operation."""
356
357
 
357
358
  request_media_access: MediaAccessGrant = Field(alias="requestMediaAccess")
358
- "Request temporary S3 read credentials for an uploaded file."
359
+ "Request temporary S3 read credentials for an uploaded file (a file's bytes, or a page's image). A guest of the organization gets them only for what is in one of their collaborations."
359
360
 
360
361
  class Arguments(BaseModel):
361
362
  """Arguments for RequestMediaAccess"""
@@ -682,7 +683,7 @@ class DokumentsApi:
682
683
  async def arequest_media_access(self, store_id: str) -> MediaAccessGrant:
683
684
  """RequestMediaAccess
684
685
 
685
- Request temporary S3 read credentials for an uploaded file.
686
+ Request temporary S3 read credentials for an uploaded file (a file's bytes, or a page's image). A guest of the organization gets them only for what is in one of their collaborations.
686
687
 
687
688
  Args:
688
689
  store_id: The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text. (required)
@@ -701,7 +702,7 @@ class DokumentsApi:
701
702
  def request_media_access(self, store_id: str) -> MediaAccessGrant:
702
703
  """RequestMediaAccess
703
704
 
704
- Request temporary S3 read credentials for an uploaded file.
705
+ Request temporary S3 read credentials for an uploaded file (a file's bytes, or a page's image). A guest of the organization gets them only for what is in one of their collaborations.
705
706
 
706
707
  Args:
707
708
  store_id: The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text. (required)
@@ -8,9 +8,11 @@ ask for the ``Dokuments`` it returns. An app takes all of it in with
8
8
  import os
9
9
  from typing import Annotated
10
10
 
11
+ from arkitekt_spec.declare.app import AppRegistry
12
+ from arkitekt_spec.declare.tested import tested_against
13
+ from arkitekt_spec.declare.widgets import SearchWidget
11
14
  from fakts import Alias, Require, TokenLoader
12
15
  from fakts.contrib.rath.auth import FaktsAuthLink
13
- from graphql import OperationType
14
16
  from rath.links.aiohttp import AIOHttpLink
15
17
  from rath.links.compose import compose
16
18
  from rath.links.dictinglink import DictingLink
@@ -18,15 +20,12 @@ from rath.links.file import FileExtraction
18
20
  from rath.links.graphql_ws import GraphQLWSLink
19
21
  from rath.links.split import SplitLink
20
22
 
21
- from arkitekt_spec.declare.app import AppRegistry
22
- from arkitekt_spec.declare.tested import tested_against
23
- from arkitekt_spec.declare.widgets import SearchWidget
24
-
25
23
  from dokuments.api.schema import File, SearchFilesQuery
26
24
  from dokuments.datalayer import DataLayer
27
25
  from dokuments.dokuments import Dokuments
28
26
  from dokuments.links.upload import UploadLink
29
27
  from dokuments.rath import DokumentsRath
28
+ from graphql import OperationType
30
29
 
31
30
 
32
31
  def build_relative_path(*path: str) -> str:
@@ -49,7 +48,9 @@ TESTED = tested_against("dokuments")
49
48
  def dokuments(
50
49
  dokuments: Annotated[
51
50
  Alias,
52
- Require("live.arkitekt.dokuments", "Where the user's documents live", version=TESTED),
51
+ Require(
52
+ "live.arkitekt.dokuments", "Where the user's documents live", version=TESTED
53
+ ),
53
54
  ],
54
55
  datalayer: Annotated[
55
56
  Alias,
@@ -82,8 +83,16 @@ def dokuments(
82
83
  UploadLink(datalayer=store),
83
84
  FaktsAuthLink(token_loader=tokens),
84
85
  SplitLink(
85
- left=AIOHttpLink(endpoint_url=dokuments.to_http_path("graphql"), proxy=dokuments.proxy, ssl_context=dokuments.ssl_context()),
86
- right=GraphQLWSLink(ws_endpoint_url=dokuments.to_ws_path("graphql"), proxy=dokuments.proxy, ssl_context=dokuments.ssl_context()),
86
+ left=AIOHttpLink(
87
+ endpoint_url=dokuments.to_http_path("graphql"),
88
+ proxy=dokuments.proxy,
89
+ ssl_context=dokuments.ssl_context(),
90
+ ),
91
+ right=GraphQLWSLink(
92
+ ws_endpoint_url=dokuments.to_ws_path("graphql"),
93
+ proxy=dokuments.proxy,
94
+ ssl_context=dokuments.ssl_context(),
95
+ ),
87
96
  split=lambda o: o.node.operation != OperationType.SUBSCRIPTION,
88
97
  ),
89
98
  ),