forked from sagemath/cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.coffee
1155 lines (978 loc) · 36.5 KB
/
message.coffee
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
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###
#
# Library for working with JSON messages for Salvus.
#
# (c) 2012, William Stein
#
# We use functions to work with messages to ensure some level of
# consistency, defaults, and avoid errors from typos, etc.
#
###
misc = require('misc')
defaults = misc.defaults
required = defaults.required
message = (obj) ->
exports[obj.event] = (opts={}) ->
if opts.event?
throw "ValueError: must not define 'event' when calling message creation function (opts=#{JSON.stringify(opts)}, obj=#{JSON.stringify(obj)})"
defaults(opts, obj)
############################################
# Compute server messages
#############################################
message
event : 'compute_server_status'
running_children : undefined # list of child process names (e.g., 'sage_server', 'console_server', 'project_server') that are running
############################################
# Sage session management; executing code
#############################################
# hub --> sage_server&console_server, etc. and browser --> hub
message
event : 'start_session'
type : required # "sage", "console"; later this could be "R", "octave", etc.
# TODO: project_id should be required
project_id : undefined # the project that this session will start in
session_uuid : undefined # set by the hub -- client setting this will be ignored.
params : undefined # extra parameters that control the type of session
id : undefined
limits : undefined
# hub --> browser
message
event : 'session_started'
id : undefined
session_uuid : undefined
limits : undefined
data_channel : undefined # The data_channel is a single UTF-16
# character; this is used for
# efficiently sending and receiving
# non-JSON data (except channel
# '\u0000', which is JSON).
# hub --> client
message
event : 'session_reconnect'
session_uuid : undefined # at least one of session_uuid or data_channel must be defined
data_channel : undefined
# client <--> hub <--> local_hub
# info = {
# sage_sessions : {uuid:{desc:info.desc, status:info.status}, ...},
# console_sessions : {uuid:{}, ...}
# }
message
event : 'project_session_info'
id : undefined
project_id : undefined
info : undefined
#
# A period ping message must usually be sent by the client to keep a
# worksheet/console open, except when worksheet/console is explicitly
# put in a special (screen-like/nohup) mode.
#
# client --> hub
message
event : 'ping_session'
id : undefined
session_uuid : undefined
# client --> hub
message
event : 'connect_to_session'
id : undefined
type : required
project_id : required
session_uuid : required
params : undefined # extra parameters that control the type of session -- if we have to create a new one
message
event : 'session_connected'
id : undefined
session_uuid : required
data_channel : undefined # used for certain types of sessions
history : undefined # used for console/terminal sessions
# sage_server&console_server --> hub
message
event : 'session_description'
pid : required
limits : undefined
# client --> hub --> session servers
message
event : 'send_signal'
id : undefined
session_uuid : undefined # from browser-->hub this must be set
pid : undefined # from hub-->sage_server this must be set
signal : 2 # 2 = SIGINT, 3 = SIGQUIT, 9 = SIGKILL
message
event : 'signal_sent'
id : required
# Restart the underlying Sage process for this session; the session
# with the given id still exists, it's just that the underlying sage
# process got restarted.
# client --> hub
message
event : 'restart_session'
session_uuid : required
id : undefined
# client <----> hub <--> sage_server
message
event : 'terminate_session'
project_id : undefined
session_uuid : undefined
reason : undefined
done : undefined
# client --> hub --> sage_server
message
event : 'execute_code'
id : undefined
code : required
data : undefined
session_uuid : undefined
preparse : true
allow_cache : true
# Output resulting from evaluating code that is displayed by the browser.
# sage_server --> local hub --> hubs --> clients
message
event : 'output'
id : undefined # the id for this particular computation
stdout : undefined # plain text stream
stderr : undefined # error text stream -- colored to indicate an error
html : undefined # arbitrary html stream
tex : undefined # tex/latex stream -- is an object {tex:..., display:...}
hide : undefined # 'input' or 'output'; hide display of given component of cell
show : undefined # 'input' or 'output'; show display of given component of cell
auto : undefined # true or false; sets whether or not cell auto-executess on process restart
javascript : undefined # javascript code evaluation stream (see also 'execute_javascript' to run code directly in browser that is not part of the output stream).
interact : undefined # create an interact layout defined by a JSON object
obj : undefined # used for passing any JSON-able object along as output; this is used, e.g., by interact.
file : undefined # used for passing a file -- is an object {filename:..., uuid:..., show:true}; the file is at https://cloud.sagemath.com/blobs/filename?uuid=[the uuid]
done : false # the sequences of messages for a given code evaluation is done.
session_uuid : undefined # the uuid of the session that produced this output
once : undefined # if given, message is transient; it is not saved by the worksheet, etc.
clear : undefined # if true, clears all output of the current cell before rendering message.
events : undefined # {'event_name':'name of Python callable to call', ...} -- only for images right now
# This message tells the client to execute the given Javascript code
# in the browser. (For safety, the client may choose to ignore this
# message.) If coffeescript==true, then the code is assumed to be
# coffeescript and is first compiled to Javascript. This message is
# "out of band", i.e., not meant to be part of any particular output
# cell. That is why there is no id key.
# sage_server --> hub --> client
message
event : 'execute_javascript'
session_uuid : undefined # set by the hub, since sage_server doesn't (need to) know the session_uuid.
code : required
obj : undefined
coffeescript : false
cell_id : undefined # if set, eval scope contains an object cell that refers to the cell in the worksheet with this id.
############################################
# Session Introspection
#############################################
# An introspect message from the client can result in numerous types
# of responses (but there will only be one response). The id of the
# message from hub back to client will match the id of the message
# from client to hub; the client is responsible for deciding
# what/where/how to deal with the message.
# client --> hub --> sage_server
message
event : 'introspect'
id : undefined
session_uuid : required
line : required
preparse : true
# hub --> client (can be sent in response to introspect message)
message
event : 'introspect_completions'
id : undefined # match id of 'introspect' message
target : required # 'Ellip'
completions : required # ['sis', 'ticCurve', 'ticCurve_from_c4c6', ...]
# hub --> client (can be sent in response to introspect message)
message
event : 'introspect_docstring'
id : undefined
target : required
docstring : required
# hub --> client
message
event : 'introspect_source_code'
id : undefined
target : required
source_code : required
############################################
# CodeMirror editor sessions
#############################################
# client --> hub --> local_hub
message
event : 'codemirror_get_session'
path : undefined # at least one of path or session_uuid must be defined
session_uuid : undefined
project_id : required
id : undefined
# local_hub --> hub --> client
message
event : 'codemirror_session'
id : undefined
session_uuid : required
path : required # absolute path
content : required
readonly : false # if true, the file must be treated as "read-only" by the client.
# A list of edits that should be applied, along with the
# last version of edits received before.
# client <--> hub <--> local_hub
message
event : 'codemirror_diffsync'
id : undefined
session_uuid : undefined
edit_stack : required
last_version_ack : required
# Suggest to the connected big hub that there is data ready to be synced:
# local_hub --> hub --> client
message
event : 'codemirror_diffsync_ready'
session_uuid : undefined
# Hub uses this message to tell client that client should try to sync later, since hub is
# busy now with some other locking sync operation.
# local_hub <-- hub
message
event : 'codemirror_diffsync_retry_later'
id : undefined
# Write out whatever is on local_hub to the physical disk
# client --> hub --> local_hub
message
event : 'codemirror_write_to_disk'
id : undefined
session_uuid : undefined
# Replace what is on local_hub by what is on physical disk (will push out a
# codemirror_change message, so any browser client has a chance to undo this).
# client --> hub --> local_hub
message
event : 'codemirror_read_from_disk'
id : undefined
session_uuid : undefined
# Request the current content of the file. This may be
# used to refresh the content in a client, even after a session started.
# client --> hub --> local_hub
message
event : 'codemirror_get_content'
id : undefined
session_uuid : undefined
# Sent in response to a codemirror_get_content message.
# local_hub --> hub --> client
message
event : 'codemirror_content'
id : undefined
content : required
# Disconnect a client from a codemirror editing session.
# local_hub --> hub
# client --> hub
message
event : 'codemirror_disconnect'
id : undefined
session_uuid : required
# Broadcast mesg to all clients connected to this session.
# This is used for cursors, updating session id's, etc.
# client <--> hub <--> local_hub
message
event : 'codemirror_bcast'
session_uuid : required
self : undefined # if true, message will also be sent to self from global hub.
name : undefined
color : undefined
date : undefined
mesg : required # arbitrary message, can have event, etc., attributes.
# This is used so that a client can execute code in the Sage process that is running
# controlled by a codemirror sync session. This is mainly used to implement interact
# in synchronized worksheets that are embedded in a single codemirror editor.
# client --> hub --> local_hub --> sage_server
message
event : 'codemirror_execute_code'
id : undefined
code : required
data : undefined
session_uuid : required
preparse : true
# Introspection in the context of a codemirror editing session.
# client --> hub --> sage_server
message
event : 'codemirror_introspect'
id : undefined
session_uuid : required
line : required
preparse : true
# client --> hub --> local_hub
message
event : 'codemirror_send_signal'
id : undefined
session_uuid : required
signal : 2 # 2 = SIGINT, 3 = SIGQUIT, 9 = SIGKILL
############################################
# Ping/pong
#############################################
# browser --> hub
message
event : 'ping'
id : undefined
# hub --> browser; sent in response to a ping
message
event : 'pong'
id : undefined
############################################
# Account Management
#############################################
# client --> hub
message
event : 'create_account'
id : undefined
first_name : required
last_name : required
email_address : required
password : required
agreed_to_terms: required
# hub --> client
message
event : 'account_creation_failed'
id : required
reason : required
# client <--> hub
message
event : 'email_address_availability'
id : undefined
email_address : required
is_available : undefined
# client --> hub
message
id : undefined
event : 'sign_in'
email_address : required
password : required
remember_me : false
# client --> hub
message
id : undefined
event : 'sign_in_failed'
email_address : required
reason : required
# hub --> client; sent in response to either create_account or log_in
message
event : 'signed_in'
id : undefined # message uuid
account_id : required # uuid of user's account
first_name : required # user's first name
last_name : required # user's last name
email_address : required # address they just signed in using
remember_me : required # true if sign in accomplished via remember_me cookie; otherwise, false.
hub : required # ip address (on vpn) of hub user connected to.
# client --> hub
message
event : 'sign_out'
id : undefined
# hub --> client
message
event : 'signed_out'
id : undefined
# client --> hub
message
event : 'change_password'
id : undefined
email_address : required
old_password : required
new_password : required
# hub --> client
# if error is true, that means the password was not changed; would
# happen if password is wrong (message:'invalid password').
message
event : 'changed_password'
id : undefined
error : undefined
# client --> hub: "please send a password reset email"
message
event : "forgot_password"
id : undefined
email_address : required
# hub --> client "a password reset email was sent, or there was an error"
message
event : "forgot_password_response"
id : undefined
error : false
# client --> hub: "reset a password using this id code that was sent in a password reset email"
message
event : "reset_forgot_password"
id : undefined
reset_code : required
new_password : required
message
event : "reset_forgot_password_response"
id : undefined
error : false
# client --> hub
message
event : 'change_email_address'
id : undefined
account_id : required
old_email_address : required
new_email_address : required
password : required
# hub --> client
message
event : 'changed_email_address'
id : undefined
error : false # some other error
ttl : undefined # if user is trying to change password too often, this is time to wait
############################################
# Account Settings
#############################################
# client --> hub
message
event : "get_account_settings"
id : undefined
account_id : required
# settings that require the password in the message (so user must
# explicitly retype password to change these):
exports.restricted_account_settings =
plan_id : undefined
plan_name : undefined
plan_starttime : undefined
storage_limit : undefined
session_limit : undefined
max_session_time : undefined
ram_limit : undefined
support_level : undefined
email_address : undefined
connect_Github : undefined
connect_Google : undefined
connect_Dropbox : undefined
# these can be changed without additional re-typing of the password
# (of course, user must have somehow logged in):
exports.unrestricted_account_settings =
first_name : required
last_name : required
default_system : required
evaluate_key : required
email_new_features : required
email_maintenance : required
enable_tooltips : required
autosave : required # time in seconds or 0 to disable
terminal : required # JSON object -- client interprets
editor_settings : required # JSON object -- client interprets
other_settings : required # JSON object
exports.account_settings_defaults =
plan_id : 0 # the free trial plan
default_system : 'sage'
evaluate_key : 'Shift-Enter'
email_new_features : true
email_maintenance : true
enable_tooltips : true
connect_Github : ''
connect_Google : ''
connect_Dropbox : ''
autosave : 180
other_settings :
confirm_close : false
editor_settings :
strip_trailing_whitespace : true
line_wrapping : true
line_numbers : true
smart_indent : true
electric_chars : true
match_brackets : true
first_line_number : 1
indent_unit : 4
tab_size : 4
bindings : "standard"
theme : "standard"
undo_depth : 200
terminal :
font_size : 14
color_scheme : 'solarized-light'
font : 'droid-sans-mono'
# client <--> hub
message(
misc.merge({},
event : "account_settings"
account_id : required
id : undefined
password : undefined # only set when sending message from client to hub; must be set to change restricted settings
exports.unrestricted_account_settings,
exports.restricted_account_settings
)
)
message
event : 'account_settings_saved'
id : undefined
message
event : 'error'
id : undefined
error : undefined
message
event : 'success'
id : undefined
# You need to reconnect.
message
event : 'reconnect'
id : undefined
reason : undefined # optional to make logs more informative
#############################################
# Scratch worksheet
#############################################
message
event : 'save_scratch_worksheet'
data : required
id : undefined
message
event : 'load_scratch_worksheet'
id : undefined
message
event : 'delete_scratch_worksheet'
id : undefined
message
event : 'scratch_worksheet_loaded'
id : undefined
data : undefined # undefined means there is no scratch worksheet yet
############################################
# User Feedback
#############################################
message
event : 'report_feedback'
id : undefined
category : required # 'bug', 'idea', 'comment'
description : required # text
nps : undefined # net promotor score; integer 1,2,...,9
message
event : 'feedback_reported'
error : undefined
id : required
message
event : 'get_all_feedback_from_user'
error : undefined
id : undefined
message
event : 'all_feedback_from_user'
id : required
error : undefined
data : required # JSON list of objects
######################################################################################
# This is a message that goes
# hub --> client
# In response, the client grabs "/cookies?id=...,set=...,get=..." via an AJAX call.
# During that call the server can get/set HTTP-only cookies.
# (Note that the /cookies url gets customized by base_url.)
######################################################################################
message
event : 'cookies'
id : required
url : "/cookies"
set : undefined # name of a cookie to set
get : undefined # name of a cookie to get
###################################################################################
#
# Project Server <---> Hub interaction
#
# These messages are mainly focused on working with individual projects.
#
# Architecture:
#
# * The database stores a files object (with the file tree), logs
# (of each branch) and a sequence of git bundles that when
# combined together give the complete history of the repository.
# Total disk usage per project is limited by hard/soft disk quota,
# and includes the space taken by the revision history (the .git
# directory).
#
# * A project should only be opened by at most one project_server at
# any given time (not implemented: if this is violated then we'll
# merge the resulting conflicting repo's.)
#
# * Which project_server that has a project opened is stored in the
# database. If a hub cannot connect to a given project server,
# the hub assigns a new project_server for the project and opens
# the project on the new project_server. (The error also gets
# logged to the database.) All hubs will use this new project
# server henceforth.
#
###################################################################################
# The open_project message causes the project_server to create a new
# project or prepare to receive one (as a sequence of blob messages)
# from a hub.
#
# hub --> project_server
message
event : 'open_project'
id : required
project_id : required # uuid of the project, which impacts
# where project is extracted, etc.
quota : required # Maximum amount of disk space/inodes this
# project can use. This is an object
# {disk:{soft:megabytes, hard:megabytes}, inode:{soft:num, hard:num}}
idle_timeout : required # A time in seconds; if the project_server
# does not receive any messages related
# to this project for this many seconds,
# then it does the same thing as when
# receiving a 'close_project' message.
ssh_public_key: required # ssh key of the one UNIX user that is allowed to access this account (this is running the hub).
# A project_server sends the project_opened message to the hub once
# the project_server has received and unbundled all bundles that
# define a project.
# project_server --> hub
message
event : 'project_opened'
id : required
# A hub sends the save_project message to a project_server to request
# that the project_server save a snapshot of this project. On
# success, the project_server will respond by sending a project_saved
# message then sending individual the bundles n.bundle for n >=
# starting_bundle_number.
#
# client --> hub --> project_server
message
event : 'save_project'
id : undefined
project_id : required # uuid of a project
# The project_saved message is sent to a hub by a project_server when
# the project_servers creates a new snapshot of the project in
# response to a save_project message.
# project_server --> hub
message
event : 'project_saved'
id : required # message id, which matches the save_project message
bundle_uuids : required # {uuid:bundle_number, uuid:bundle_number, ...} -- bundles are sent as blobs in separate messages.
#############################################
#
# Client/user browsing snapshots of a project, restoring, etc.
#
#############################################
message
event : 'snap'
id : undefined
command : required # 'ls', 'restore', 'log', 'last', 'status'
project_id : required
# if snapshot not given, then command must be "ls", and server returns a list of available snapshots in reverse order
snapshot : undefined
path : '.' # when 'ls', returns listing of files in this path (if snapshot given), with slash
# at end of filename to denote a directory.
timeout : 600 # how long to wait for response from the storage server before sending an error
list : undefined # response message is of same type, but has this filled in for 'ls' and 'log' commands.
timezone_offset: 0 # the difference (UTC time) - (local time), in minutes, where local time is of the client
######################################################################
# Execute a program in a given project
######################################################################
# client --> project
message
event : 'project_exec'
id : undefined
project_id : undefined
path : '' # if relative, is a path under home; if absolute is what it is.
command : required
args : []
timeout : 10 # maximum allowed time, in seconds.
max_output : undefined # maximum number of characters in the output
bash : false # if true, args are ignored and command is run as a bash command
err_on_exit : true # if exit code is nonzero send error return message instead of the usual output.
# project --> client
message
event : 'project_exec_output'
id : required
stdout : required
stderr : required
exit_code : required
# client --> project
message
event : 'project_restart'
id : undefined
project_id : required
#############################################################################
# A hub sends this message to the project_server to request that the
# project_server close the project. This immediately deletes all files
# and clears up all resources allocated for this project. So make
# sure to send a save_project message first!
#
# client --> hub --> project_server
message
event : 'close_project'
id : undefined
project_id : required
# A project_server sends this message in response to a close_project
# message, to indicate that files have been cleaned up and relevant
# processes killed.
# project_server --> hub
message
event : 'project_closed'
id : required # id of message (matches close_project message above)
# The read_file_from_project message is sent by the hub to request
# that the project_server read a file from a project and send it back
# to the hub as a blob. Also sent by client to hub to request a file
# or directory. If path is a directory, the optional archive field
# specifies how to create a single file archive, with supported
# options including: 'tar', 'tar.bz2', 'tar.gz', 'zip', '7z'.
#
# client --> hub --> project_server
message
event : 'read_file_from_project'
id : undefined
project_id : required
path : required
archive : 'tar.bz2'
# The file_read_from_project message is sent by the project_server
# when it finishes reading the file from disk.
# project_server --> hub
message
event : 'file_read_from_project'
id : required
data_uuid : required # The project_server will send the raw data of the file as a blob with this uuid.
archive : undefined # if defined, means that file (or directory) was archived (tarred up) and this string was added to end of filename.
# hub --> client
message
event : 'temporary_link_to_file_read_from_project'
id : required
url : required
# The client sends this message to the hub in order to write (or
# create) a plain text file (binary files not allowed, since sending
# them via JSON makes no sense).
# client --> hub
message
event : 'read_text_file_from_project'
id : undefined
project_id : required
path : required
# hub --> client
message
event : 'text_file_read_from_project'
id : required
content : required
# client --> hub --> project_server
message
event : 'make_directory_in_project'
id : required
project_id : required
path : required
# project_server --> hub --> client
message
event : 'directory_made_in_project'
id : required
# client --> hub --> project_server
message
event : 'move_file_in_project'
id : undefined
project_id : required
src : required
dest : required
# project_server --> hub --> client
message
event : 'file_moved_in_project'
id : required
# client --> hub --> project_server
message
event : 'remove_file_from_project'
id : undefined
project_id : required
path : required
# The write_file_to_project message is sent from the hub to the
# project_server to tell the project_server to write a file to a
# project. If the path includes directories that don't exists,
# they are automatically created (this is in fact the only way
# to make a new directory).
# hub --> project_server
message
event : 'write_file_to_project'
id : required
project_id : required
path : required
data_uuid : required # hub sends raw data as a blob with this uuid immediately.
# The client sends this message to the hub in order to write (or
# create) a plain text file (binary files not allowed, since sending
# them via JSON makes no sense).
# client --> hub
message
event : 'write_text_file_to_project'
id : undefined
project_id : required
path : required
content : required
# The file_written_to_project message is sent by a project_server to
# confirm successful write of the file to the project.
# project_server --> hub
message
event : 'file_written_to_project'
id : required
############################################
# Branches
############################################
# client --> hub
message
event : 'create_project_branch'
id : undefined
project_id : required
branch : required
message
event : 'checkout_project_branch'
id : undefined
project_id : required
branch : required
message
event : 'delete_project_branch'
id : undefined
project_id : required
branch : required
message
event : 'merge_project_branch'
id : undefined
project_id : required
branch : required
############################################
# Managing multiple projects
############################################
# client --> hub
message
event : 'create_project'
id : undefined
title : required
description: required
public : required
# client --> hub
message
event : 'delete_project'
id : undefined
project_id : required
# client --> hub
message
event : 'move_project'
id : undefined
project_id : required
message
event : 'project_moved'
id : undefined
location : required # new location
# client --> hub
message
event : 'undelete_project'
id : undefined
project_id : required
# hub --> client
message
event : 'project_created'
id : required
project_id : required
# Get info about a single project (instead of all projects)
# client --> hub
message
event : 'get_project_info'
project_id : required
id : undefined
# Response to get_project_info message.