-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathschema.graphql
579 lines (498 loc) · 10.6 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
"""
A user of web3.storage.
"""
type User {
name: String!
picture: String
email: String!
issuer: String! @unique
"""
GitHub user handle, may be null if user logged in via email.
"""
github: String
"""
Cryptographic public address of the Magic User.
"""
publicAddress: String!
"""
User authentification keys.
"""
keys: [AuthToken!]! @relation
"""
Creation date.
"""
created: Time!
"""
Used storage in bytes.
"""
usedStorage: Long
}
"""
API authentication tokens.
"""
type AuthToken {
"""
User assigned name.
"""
name: String!
"""
Secret that corresponds to this token.
"""
secret: String!
"""
Uploads made using this token.
"""
uploads: [Upload!]! @relation
"""
User this token belongs to.
"""
user: User! @relation
"""
Creation date.
"""
created: Time!
"""
Deletion date.
"""
deleted: Time
}
"""
Details of the root of a file/directory stored on web3.storage.
"""
type Content {
"""
Root CID for this content.
"""
cid: String! @unique
"""
IPFS nodes pinning this content.
"""
pins: [Pin]! @relation
"""
Content for deals is aggregated together. Each aggregation has many entries.
These are the entries that this content appears in.
"""
aggregateEntries: [AggregateEntry!]! @relation
"""
Size of the DAG in bytes. Set if known on upload or for partials is set when
content is fully pinned in at least one location.
"""
dagSize: Long
"""
Creation date.
"""
created: Time!
}
"""
Information for piece of content pinned in IPFS.
"""
type Pin {
"""
The content being pinned.
"""
content: Content! @relation
"""
Identifier for the service that is pinning this pin.
"""
location: PinLocation! @relation
"""
Pinning status at this location.
"""
status: PinStatus!
"""
Last time the status was updated.
"""
updated: Time!
"""
Creation date.
"""
created: Time!
}
"""
Location of a pin.
"""
type PinLocation {
"""
Known pins at this location.
"""
pins: [Pin]! @relation
"""
Libp2p peer ID of the node pinning this pin.
"""
peerId: String! @unique
"""
Name of the peer pinning this pin.
"""
peerName: String
"""
Geographic region this node resides in.
"""
region: String
}
enum PinStatus {
Undefined
ClusterError
PinError
UnpinError
Pinned
Pinning
Unpinning
Unpinned
Remote
PinQueued
UnpinQueued
Sharded
}
"""
Tracks requests to replicate content to more nodes.
"""
type PinRequest {
"""
Root CID to Pin.
"""
cid: String! @unique
"""
The content that we want replicated.
"""
content: Content! @relation
"""
Number of times we have tried to pin this CID
"""
attempts: Int!
"""
Last time attempts was updated
"""
updated: Time!
"""
When the PinRequest was created
"""
created: Time!
}
"""
A request to keep a Pin in sync with the nodes that are pinning it.
"""
type PinSyncRequest {
"""
The pin to keep in sync.
"""
pin: Pin! @relation
"""
When the PinSyncRequest was created.
"""
created: Time!
}
"""
Details of the backups created for an upload.
"""
type Backup {
"""
Upload that originated the backup
"""
upload: Upload! @relation
"""
Backup url.
"""
url: String!
"""
Creation date.
"""
created: Time!
"""
Deletion date.
"""
deleted: Time
}
"""
An upload created by a user.
"""
type Upload {
"""
User that uploaded this content.
"""
user: User! @relation
"""
User authentication token that was used to upload this content.
Note: nullable, because the user may have used a Magic.link token.
"""
authToken: AuthToken @relation
"""
User provided name for this upload.
"""
name: String
"""
Type of received upload data.
"""
type: UploadType!
"""
The root of the uploaded content.
"""
content: Content! @relation
"""
Creation date.
"""
created: Time!
"""
Deletion date.
"""
deleted: Time
}
"""
Type of received upload data.
"""
enum UploadType {
"""
A CAR file upload.
"""
Car
"""
Files uploaded and converted into a CAR file.
"""
Upload
"""
A raw blob upload in the request body.
"""
Blob
"""
A multi file upload using a multipart request.
"""
Multipart
}
"""
An aggregate of content for inclusion in a Filecoin deal.
"""
type Aggregate {
"""
CID of the root of the aggregate data.
"""
dataCid: String! @unique
"""
Piece CID.
"""
pieceCid: String!
"""
Deals this aggregation can be found in.
"""
deals: [Deal!]! @relation
"""
Entries included in this aggregate.
"""
entries: [AggregateEntry!]! @relation
"""
Creation date.
"""
created: Time!
}
"""
Information about an entry included in an aggregate.
"""
type AggregateEntry {
"""
The content this entry is for.
"""
content: Content! @relation
"""
The aggregate this entry resides in.
"""
aggregate: Aggregate! @relation
"""
Selector for extracting stored data from the aggregate data root.
"""
dataModelSelector: String
}
"""
Filecoin deal for an aggregation of content.
"""
type Deal {
"""
Content aggregate for this deal.
"""
aggregate: Aggregate! @relation
"""
ID of storage provider this deal was made with.
"""
storageProvider: String!
"""
Identifier for the deal stored on chain.
"""
dealId: Long! @unique
"""
Time when deal will be active.
"""
activation: Time
"""
Time when deal has expired and will renew.
"""
renewal: Time
"""
Current deal status.
"""
status: DealStatus!
"""
Human readable reason for the current status.
"""
statusReason: String
"""
Creation date.
"""
created: Time!
"""
Last time this deal was updated.
"""
updated: Time!
}
enum DealStatus {
Queued
Published
Active
Terminated
}
enum SortDirection {
Asc
Desc
}
enum UploadListSortBy {
Date,
Name
}
type Metric {
"""
Unique key identifying the metric.
"""
key: String! @unique
"""
Current value for the metric, see updated property for last calculation date.
"""
value: Long!
"""
Last time this metric was updated.
"""
updated: Time!
}
type Query {
"""
Find all uploads created after a given date. Note: this INCLUDES deleted uploads.
"""
findUploadsCreatedAfter(since: Time!): [Upload!]! @resolver(paginated: true)
findUploadsByUser(where: FindUploadsByUserInput!, sortBy: UploadListSortBy, sortOrder: SortDirection): [Upload!]! @resolver(paginated: true)
findContentByCid(cid: String!): Content @resolver
findContentByCreated(from: Time!, to: Time): [Content!]! @resolver(paginated: true)
findUserByIssuer(issuer: String!): User @resolver
findAuthTokensByUser(user: ID!): [AuthToken!]! @resolver(paginated: true)
"""
Verify the User with the passed issuer owns the AuthToken with the passed secret.
"""
verifyAuthToken(issuer: String!, secret: String!): AuthToken @resolver
findPinsByStatus(status: PinStatus!): [Pin!]! @resolver(paginated: true)
findPinsByStatusAndCreated(status: PinStatus!, from: Time!, to: Time): [Pin!]! @resolver(paginated: true)
findAllPinRequests: [PinRequest!]! @resolver(paginated: true)
findUsersByCreated(from: Time!, to: Time): [User!]! @resolver(paginated: true)
countUsers(from: Time!, to: Time): [Long]! @resolver(paginated: true)
countUploads(from: Time!, to: Time): [Long]! @resolver(paginated: true)
countContent(from: Time!, to: Time): [Long]! @resolver(paginated: true)
countPins(from: Time!, to: Time): [Long]! @resolver(paginated: true)
countPinsByStatus(status: PinStatus!, from: Time!, to: Time): [Long]! @resolver(paginated: true)
sumContentDagSize(from: Time!, to: Time): [Long]! @resolver(paginated: true)
sumPinDagSize(from: Time!, to: Time): [Long]! @resolver(paginated: true)
findMetricByKey(key: String!): Metric @resolver
findPinSyncRequests(from: Time, to: Time): [PinSyncRequest!]! @resolver(paginated: true)
}
type Mutation {
createOrUpdateUser(data: CreateOrUpdateUserInput!): User! @resolver
createAuthToken(data: CreateAuthTokenInput): AuthToken! @resolver
createUpload(data: CreateUploadInput!): Upload! @resolver
deleteAuthToken(user: ID!, authToken: ID!): AuthToken! @resolver
deleteUserUpload(user: ID!, cid: String!): Upload! @resolver
renameUserUpload(user: ID!, cid: String!, name: String!): Upload! @resolver
deleteUploadByUserAndContent(user: ID!, content: ID!): Upload! @resolver
createAggregate(data: CreateAggregateInput!): Aggregate! @resolver
"""
Adds new entries to the aggregate, existing entries are ignored.
"""
addAggregateEntries(dataCid: String!, entries: [AggregateEntryInput!]!): Aggregate! @resolver
createOrUpdateDeal(data: CreateOrUpdateDealInput!): Deal! @resolver
"""
Creates a new pin object (and location) or updates an existing pin object.
"""
createOrUpdatePin(data: CreateOrUpdatePinInput): Pin! @resolver
updateContentDagSize(content: ID!, dagSize: Long!): Content! @resolver
createPinRequest(cid: String!): PinRequest! @resolver
deletePinRequests(requests: [ID!]!): [PinRequest!]! @resolver
incrementPinRequestAttempts(pinRequest: ID!): PinRequest! @resolver
incrementUserUsedStorage(user: ID!, amount: Long!): User! @resolver
createOrUpdateMetric(data: CreateOrUpdateMetricInput!): Metric! @resolver
updatePins(pins: [UpdatePinInput!]!): [Pin!]! @resolver
createPinSyncRequests(pins: [ID!]!): [PinSyncRequest!]! @resolver
deletePinSyncRequests(requests: [ID!]!): [PinSyncRequest!]! @resolver
}
input CreateAggregateInput {
dataCid: String!
pieceCid: String!
}
input AggregateEntryInput {
cid: String!
dataModelSelector: String
dagSize: Long
}
input CreateOrUpdateDealInput {
"""
CID of the aggregate included in this deal. Required for create, ignored for update.
"""
dataCid: String
storageProvider: String
dealId: Long!
activation: Time
renewal: Time
status: DealStatus!
statusReason: String
}
input FindUploadsByUserInput {
user: ID!
createdBefore: Time!
}
input CreateOrUpdateUserInput {
name: String!
picture: String
email: String!
issuer: String!
github: String
publicAddress: String!
}
input CreateAuthTokenInput {
user: ID!
name: String!
secret: String!
}
input CreateUploadInput {
user: ID!
authToken: ID
cid: String!
type: UploadType!
name: String
backupUrls: [String]!
dagSize: Long
chunkSize: Long # decremented, unused
pins: [PinInput!]!
}
input PinInput {
status: PinStatus!
location: PinLocationInput!
}
input PinLocationInput {
peerId: String!,
peerName: String
region: String
}
input CreateOrUpdatePinInput {
content: ID!
status: PinStatus!
location: PinLocationInput!
}
input CreateOrUpdateMetricInput {
key: String!
value: Long!
updated: Time
}
input UpdatePinInput {
pin: ID!
status: PinStatus!
}