Newer
Older
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
import {siteSettings} from './defaults'
/**
* Enum of Classes that should generate pages
* @readonly
* @enum {array}
*/
export const publicDocumentTypes = [
'HumanMadeObject',
'Actor',
'Group',
'Concept',
'ObjectType',
'Place',
]
export const actorsQuery = `
{
"items": *[_type in ["Actor", "Group"]] | order(label, desc){
_id,
_type,
label,
hasType[]-> {
_id,
label
},
image,
"count": count(*[references(^._id)]),
},
${siteSettings}
}
`
export const alertQuery = `
*[_type == "Alert"][0] | order(_createdAt desc) {
...
}
`
export const conceptsQuery = `
{
"items": *[_type in ["Concept", "ObjectType"]] | order(label.nor desc){
_id,
_type,
label,
"count": count(*[references(^._id)]),
},
${siteSettings}
}
`
export const registryQuery = `
{
"items": *[_type in ["Concept", "ObjectType", "Actor", "Group"]] | order(label, label.nor){
_id,
_type,
label,
"count": count(*[references(^._id)]),
},
${siteSettings}
}
`
export const frontpageQuery = `
{
"frontpage": *[ _id == "frontpage" ][0] {
_id,
...,
navMenu-> {
...,
items[] {
...,
"route": landingPageRoute->.slug.current
}
},
content[] {
disabled != true => {
...
},
_type == 'MiradorGallery' && disabled != true => @{
...,
items[] {
"manifest": coalesce(manifestRef->.subjectOfManifest, manifestUrl),
canvasUrl,
},
},
_type == 'SingleObject' && disabled != true => @{
...,
item-> {
"manifest": coalesce(subjectOfManifest, manifestUrl),
canvasUrl,
}
},
_type == 'Grid' => @{
...,
items[] {
...,
"route": landingPageRoute->.slug.current
}
}
}
},
"latest": *[ _type == "HumanMadeObject"][0..10] {
_id,
label,
hasType[]-> {
...
},
image,
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
}
`
export const idsQuery = `
*[_type in [...$publicDocumentTypes]] {
_id
}
`
export const routesQuery = `
*[ _type == "Route" ] {
_id,
_type,
slug
}
`
export const routeQuery = `
{
"route": *[ _type == "Route" && slug.current == $joinID ][0] {
...,
page->{
...,
navMenu->{
...,
items[]{
...,
"route": landingPageRoute->.slug.current
}
},
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
body[] {
...,
_type == 'PageHeader' => @{
...,
"palette": illustration.image.asset->.metadata.palette{
darkMuted,
darkVibrant,
dominant,
lightMuted,
vibrantMuted,
muted,
vibrant
}
},
_type == 'MiradorGallery' => @{
...,
items[] {
_id,
label,
view,
"owner": manifestRef->.hasCurrentOwner[]->{
_id,
label
},
"manifest": coalesce(
manifestRef->.subjectOfManifest,
manifestUrl,
"/api/manifest/" + manifestRef->._id
),
canvasUrl,
},
},
_type == 'SingleObject' => @{
...,
view,
item-> {
_id,
label,
"owner": hasCurrentOwner[]-> {
_id,
label
},
"manifest": coalesce(
subjectOfManifest,
manifestUrl,
"/api/manifest/" + _id
),
canvasUrl,
}
}
},
_type == 'PageHeader' => @{
...,
"palette": illustration.image.asset->.metadata.palette{
darkMuted,
darkVibrant,
dominant,
lightMuted,
vibrantMuted,
muted,
vibrant
}
},
_type == 'MiradorGallery' => @{
...,
items[] {
view,
"owner": manifestRef->.hasCurrentOwner[]->{
"manifest": coalesce(
manifestRef->.subjectOfManifest,
manifestUrl,
"/api/manifest/" + manifestRef->._id
),
canvasUrl,
},
},
_type == 'SingleObject' => @{
...,
_id,
label,
"owner": hasCurrentOwner[]-> {
_id,
label
},
"manifest": coalesce(
subjectOfManifest,
manifestUrl,
"/api/manifest/" + _id
),
}
}
}
}
},
${siteSettings}
}
`
export const humanMadeObjectsQuery = `{
"items": *[_type == "HumanMadeObject"] | order(label){
_id,
_type,
label,
preferredIdentifier,
hasType[]-> {
_id,
label
},
image,
"description": referredToBy[]{
...
},
hasCurrentOwner[0]->{
_id,
},
"creation": activityStream[]{
_type in ["Production", "BeginningOfExistence"] => @{
"creators": contributionAssignedBy[]{
"name": assignedActor->.label,
"_id": assignedActor->._id
},
timespan
}
},
"aspectRatio": image.asset->.metadata.dimensions.aspectRatio,
},
${siteSettings}
}`
export const typeQuery = `
*[_id == $id][0] {
_type
}
`
// Fields
export const humanMadeObjectFields = `
_id,
_type,
depicts[]-> {
_id,
label,
image
},
label,
hasType[]-> {
...
},
image{
...,
"palette": asset->.metadata.palette{
darkVibrant,
dominant,
lightMuted,
vibrantMuted,
muted,
vibrant
}
},
subjectOfManifest,
"manifest": coalesce(
subjectOfManifest,
"/api/manifest/" + _id
),
preferredIdentifier,
identifiedBy[] {
...,
hasType[]-> {
...
},
language[]-> {
...
}
},
activityStream[]{
_type == 'reference' => @->{
...,
contributionAssignedBy[]{
_id,
label,
image{
asset->
}
}
}
},
...,
hasType[]-> {
...
},
tookPlaceAt[]->,
movedFrom->{
_id,
label,
geoJSON
},
movedTo->{
_id,
label,
geoJSON
},
contributionAssignedBy[]{
_id,
label,
image{
asset->
}
}
},
...,
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
_id,
label,
image{
asset->
}
}
},
target->{
_id,
label,
image{
asset->
}
}
},
referredToBy[] {
...,
body[] {
...,
_type == 'reference' => @->{
_id,
_type,
preferredIdentifier,
label,
subjectOfManifest,
image{
...,
asset->
}
}
},
hasType[]-> {
...
},
language-> {
...
}
},
hasCurrentOwner[]-> {
_id,
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
},
subject[]-> {
...
},
`
export const groupFields = `
_id,
_type,
label,
hasType[]-> {
...
},
image {
...
},
referredToBy[] {
...
},
"hasMember": *[_type in ["Actor", "Group"] && references(^._id)]{
_id,
_type,
label
},
"mentionedIn": *[_type in ["HumanMadeObject"] && references(^._id)]{
_id,
_type,
label,
preferredIdentifier,
hasType[]-> {
_id,
label
},
image,
"description": referredToBy[]{
...
},
hasCurrentOwner[0]->{
_id,
},
"creation": activityStream[]{
_type in ["Production", "BeginningOfExistence"] => @{
"creators": contributionAssignedBy[]{
"name": assignedActor->.label,
"_id": assignedActor->._id
},
timespan
}
},
"aspectRatio": image.asset->.metadata.dimensions.aspectRatio,
}
`
export const pageFields = `
...,
navMenu->{
...,
items[]{
...,
"route": landingPageRoute->.slug.current
}
},
content[] {
...,
_type == 'MiradorGallery' => @{
...,
items[] {
"manifest": coalesce(manifestRef->.subjectOfManifest, manifestUrl),
canvasUrl,
},
},
_type == 'SingleObject' => @{
...,
item-> {
"manifest": coalesce(subjectOfManifest, manifestUrl),
_type == 'Grid' => @{
...,
items[] {
...,
"route": landingPageRoute->.slug.current
}
}