-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
export.js
114 lines (104 loc) · 2.27 KB
/
export.js
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
'use strict'
const template = {
id: 'https://tropy.org/v1/tropy#test-template',
fields: [{
property: 'http://example.com/property',
datatype: 'http://example.com/property#datatype',
label: 'My Label'
}, {
property: 'http://example.com/empty-property',
datatype: 'http://example.com/empty-property#datatype',
label: 'Empty'
}]
}
const items = [
{
id: 1,
template: 'https://tropy.org/v1/tropy#test-template',
photos: [11, 12]
},
{
id: 2,
template: 'https://tropy.org/v1/tropy#test-template',
lists: [1],
tags: [1]
}
]
const metadata = {
// metadata of first item
1: {
'http://example.com/property': {
text: 'value',
type: 'http://example.com/property#datatype'
},
'http://example.com/custom-property': {
text: 'custom',
type: 'http://example.com/custom-property#type'
}
},
// metadata of first photo
11: {
'http://example.com/photo-property': {
text: 'photo property',
type: 'http://example.com/photo-property#type'
},
'http://example.com/custom-property': {
text: 'custom property',
type: 'http://example.com/custom-property#type'
}
},
// metadata of a selection
21: {
'http://example.com/selection-property': {
text: 'selection property',
type: 'http://example.com/selection-property#type'
}
}
}
const props = {
'http://example.com/custom-property': { label: 'Non-template Property' },
'http://example.com/photo-property': { label: 'hello world' },
'http://example.com/selection-property': { label: 'select prop' }
}
const photos = {
11: { id: 11, path: '/path' },
12: { id: 12, path: '/another', selections: [21], notes: [1] }
}
const lists = {
1: { name: 'list1' }
}
const tags = {
1: { name: 'mytag' }
}
const notes = {
1: {
text: 'photo note',
state: {
doc: {
type: 'doc',
content: [{
type: 'paragraph',
content: [{
type: 'text',
text: 'photo note'
}]
}]
}
}
},
2: { text: 'selection note', state: {} }
}
const selections = {
21: { x: 10, y: 20, width: 30, height: 40, notes: [2] }
}
module.exports = {
template,
items,
metadata,
props,
photos,
lists,
tags,
notes,
selections
}