-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmessageFormats.coffee
68 lines (49 loc) · 1.58 KB
/
messageFormats.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
JaySchema = require 'jayschema'
jsv = new JaySchema
module.exports =
# stream formats
streamInPolicy: (policy) ->
validator = {
type: 'object'
required: ['dataSources']
properties:
onDebug:
type: 'function'
identityLookup:
type: 'function'
dataSources:
type: 'object'
additionalProperties:
type: 'object'
properties:
manifest: # limit what fields should be allowed
'$ref': '#/definitions/manifestNode'
payload: # get initial data for this collection
type: 'function'
required: true
delta: # wire up deltas for this collection
type: 'function'
required: true
disconnect:
type: 'function'
definitions:
manifestNode:
type: ['object', 'boolean']
additionalProperties: #TODO: change to regex, disallow []
'$ref': '#/definitions/manifestNode'
}
jsv.validate policy, validator
streamOutManifest: (manifest) ->
streamInDelta: (delta) ->
# array elements should be objects
# array elements should have ids
# path should be '.' or 'foo' or 'foo.bar' or 'foo[5]'
# each path section can only contain one set of []
streamOutDelta: (delta) ->
streamInPayload: (payload) ->
# array elements should be objects
# array elements should have ids
streamOutPayload: (payload) ->
# collector formats
collectorData: (manifest, data) ->
collectorEvent: (manifest, event) ->