Files: b85045658dceb1b66821e40f21509c2e1937c463 / lib / ssbSchemaDefintions.js
1410 bytesRaw
1 | const { msgIdRegex, feedIdRegex, blobIdRegex } = require('ssb-ref') |
2 | |
3 | module.exports = { |
4 | messageId: { |
5 | type: 'string', |
6 | pattern: msgIdRegex |
7 | }, |
8 | feedId: { |
9 | type: 'string', |
10 | pattern: feedIdRegex |
11 | }, |
12 | blobId: { |
13 | type: 'string', |
14 | pattern: blobIdRegex |
15 | }, |
16 | mentions: { |
17 | message: { |
18 | type: 'object', |
19 | required: ['link'], |
20 | properties: { |
21 | link: { $ref: '#/definitions/messageId' } |
22 | } |
23 | }, |
24 | feed: { |
25 | type: 'object', |
26 | required: ['link', 'name'], |
27 | properties: { |
28 | link: { $ref: '#/definitions/feedId' }, |
29 | name: { type: 'string' } |
30 | } |
31 | }, |
32 | blob: { |
33 | type: 'object', |
34 | required: ['link', 'name'], |
35 | properties: { |
36 | link: { $ref: '#/definitions/blobId' }, |
37 | name: { type: 'string' } |
38 | } |
39 | }, |
40 | any: { |
41 | oneOf: [ |
42 | { type: 'null' }, |
43 | { |
44 | type: 'array', |
45 | items: { |
46 | oneOf: [ |
47 | { $ref: '#/definitions/mentions/message' }, |
48 | { $ref: '#/definitions/mentions/feed' }, |
49 | { $ref: '#/definitions/mentions/blob' } |
50 | ] |
51 | } |
52 | } |
53 | ] |
54 | } |
55 | }, |
56 | recps: { |
57 | oneOf: [ |
58 | { type: 'null' }, |
59 | { |
60 | type: 'array', |
61 | items: { |
62 | oneOf: [ |
63 | { $ref: '#/definitions/feedId' }, |
64 | { $ref: '#/definitions/mentions/feed' } |
65 | ] |
66 | } |
67 | } |
68 | ] |
69 | } |
70 | } |
71 |
Built with git-ssb-web