-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
168 lines (153 loc) · 4.2 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
directive @scalarInfo(
baseType: String!
) on SCALAR
"a 64-bit integer"
scalar Int64 @scalarInfo(baseType: "Int")
enum FileType {
regular
dir
symlink
namedPipe
socket
device
charDevice
irregular
}
"a representation of the file's mode"
type FileMode {
"the type of file"
type: FileType!
"permission bits"
perm: Int!
"whether or not the sticky bit is set"
sticky: Boolean!
}
"a generic file"
interface File {
"file ID"
id: ID!
"the file's name, without path"
name: String!
"the full path to the file"
path: String!
"the size of the file, in bytes"
size: Int64
"the file mode"
mode: FileMode!
"file modification time"
modTime: String!
"the parent directory of this file, or null if at the root directory"
parent: File
}
"file contents (read) or write encoding"
enum Encoding {
auto # only valid as input to RegularFile.contents
utf8
base64
}
"the contents of a file"
type FileContents {
"the file's data contents"
data: String!
"the position of the file after the read if there is more data to read, to be used with seek"
next: Int64
"the encoding of data"
encoding: Encoding!
"set to a warning if there was data loss"
warning: String
}
type RegularFile implements File {
id: ID!
name: String!
path: String!
size: Int64
mode: FileMode!
modTime: String!
parent: File
# maxReadBytes is the max bytes to return, default (-1) for unlimited.
# The implementation may enforce a hard cap on the bytes read, requiring paging with next/seek.
# Negative seek means don't seek.
"the contents of this file"
contents(encoding: Encoding! = auto, maxReadBytes: Int64! = -1, seek: Int64! = -1): FileContents!
}
type Dir implements File {
id: ID!
name: String!
path: String!
size: Int64
mode: FileMode!
modTime: String!
parent: File
# first is max children to return, default (-1) for unlimited.
# The children are in no particular order.
"this directory's nested (child) files"
children(first: Int! = -1): [File!]!
# escaping this parent dir is not allowed.
"returns the specified nested file, or null if it doesn't exist"
file(path: String!): File
}
# do not reference Internal_OtherFile; the other file types may be moved to new types.
"do not reference this type or depend on it in any way"
type Internal_OtherFile implements File {
id: ID!
name: String!
path: String!
size: Int64!
mode: FileMode!
modTime: String!
parent: File
}
"a generic result of an operation"
interface Result {
"a string describing the operation"
s: String!
"any warning messages, or null"
warning: String
}
type OKResult implements Result {
s: String!
warning: String
}
"the result of a file operation"
type FileResult implements Result {
s: String!
warning: String
"the target file"
file: File!
}
type Query {
"get the root dir"
root: Dir!
# Returns the specified dir. There is no concept of a current/working directory.
# If the dir doesn't exist, null is returned.
"returns the specified dir, or null if it doesn't exist"
cd(path: String!): Dir
# essentially a shortcut for root.file(path)
"returns the specified nested file, or null if it doesn't exist"
file(path: String!): File
}
"specifies how a file is to be opened"
enum FileOpen {
"create file if it doesn't exist"
create
"file must not exist"
new
"truncate the file if it exists"
truncate
"writes will be appended to the end of the file"
append
}
type Mutation {
"remove the specified file; if a directory, it must be empty"
remove(path: String!): OKResult!
"rename a file"
rename(path: String!, newName: String!): FileResult!
"change a file's mode (permission bits)"
chmod(path: String!, mode: Int!): FileResult!
"write to the specified file"
write(path: String!, contents: String!, open: [FileOpen!]! = [create, truncate], encoding: Encoding! = utf8): FileResult!
"make a single dir"
mkdir(path: String!): FileResult!
"make entire dir path, attempts to create any missing dirs"
mkdirAll(path: String!): FileResult!
}