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
93
94
95
96
97
98
99
100
101
102
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,
}
}
}
},
"latest": *[ _type == "HumanMadeObject"][0..10] {
_id,
label,
hasType[]-> {
...
},
image,
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
}
`
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
}
},
content[] {
...,
_type == 'PageHeader' => @{
...,
"palette": illustration.image.asset->.metadata.palette{
darkMuted,
darkVibrant,
dominant,
lightMuted,
vibrantMuted,
muted,
vibrant
}
},
_type == 'MiradorGallery' => @{
...,
items[] {
_id,
label,
"owner": hasCurrentOwner[]->{
_id,
label
},
"manifest": coalesce(
manifestRef->.subjectOfManifest,
manifestUrl,
"/api/manifest/" + manifestRef->._id
),
canvasUrl,
},
},
_type == 'SingleObject' => @{
...,
item-> {
_id,
label,
"owner": hasCurrentOwner[]-> {
_id,
label
},
"manifest": coalesce(
subjectOfManifest,
manifestUrl,
"/api/manifest/" + _id
),
}
}
}
}
},
${siteSettings}
}
`
export const humanMadeObjectsQuery = `{
"items": *[_type == "HumanMadeObject"] | order(preferredIdentifier){
_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->
}
}
},
...,
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
_id,
label,
image{
asset->
}
}
},
target->{
_id,
label,
image{
asset->
}
}
},
referredToBy[] {
...,
body[] {
...,
_type == 'reference' => @->{
_id,
_type,
preferredIdentifier,
label,
subjectOfManifest,
image{
...,
asset->
}
}
},
hasType[]-> {
...
},
language-> {
...
}
},
hasCurrentOwner[]-> {
_id,
label
},
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,
label
},
"creation": activityStream[]{
_type in ["Production", "BeginningOfExistence"] => @{
"creators": contributionAssignedBy[]{
"name": assignedActor->.label,
"_id": assignedActor->._id
},
timespan
}
},
"aspectRatio": image.asset->.metadata.dimensions.aspectRatio,
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
}
`
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),
canvasUrl,
}
}
}
`