@datagouv/components-next 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/main.css +56 -1
- package/dist/Control-BNCDn-8E.js +148 -0
- package/dist/{Datafair.client-x39O4yfF.js → Datafair.client-Dls5AHTE.js} +1 -1
- package/dist/Event-BOgJUhNR.js +738 -0
- package/dist/Image-BN-4XkIn.js +247 -0
- package/dist/{JsonPreview.client-BMsC5JcY.js → JsonPreview.client-DPDTs433.js} +14 -14
- package/dist/Map-BdT3i2C4.js +7609 -0
- package/dist/MapContainer.client-BdAzd7bj.js +105 -0
- package/dist/OSM-CamriM9b.js +71 -0
- package/dist/{PdfPreview.client-COOkEkRA.js → PdfPreview.client-CopqSDyt.js} +3 -3
- package/dist/{Pmtiles.client-BaiIo4VZ.js → Pmtiles.client-mF6xaOO_.js} +2 -2
- package/dist/ScaleLine-BiesrgOv.js +165 -0
- package/dist/Swagger.client-eJ7gpfZA.js +4 -0
- package/dist/Tile-DCuqwNOI.js +1206 -0
- package/dist/TileImage-CmZf8EdU.js +1067 -0
- package/dist/View-DcDc7N2K.js +2858 -0
- package/dist/{XmlPreview.client-CAdN0w_Y.js → XmlPreview.client-C0OgBkSq.js} +7 -7
- package/dist/common-C4rDcQpp.js +243 -0
- package/dist/components-next.css +1 -1
- package/dist/components-next.js +153 -117
- package/dist/components.css +1 -1
- package/dist/{MapContainer.client-DeSo8EvG.js → index-BRGqW8aQ.js} +4975 -21416
- package/dist/leaflet-src-7m1mB8LI.js +6338 -0
- package/dist/{main-Dgri3TQL.js → main-CNHxAJ8J.js} +56758 -51450
- package/dist/proj-CKwYjU38.js +1569 -0
- package/dist/tilecoord-YW3qEH_j.js +884 -0
- package/dist/{vue3-xml-viewer.common-D6skc_Ai.js → vue3-xml-viewer.common-CmAdQfIy.js} +1 -1
- package/package.json +5 -1
- package/src/components/ActivityList/ActivityList.vue +6 -2
- package/src/components/AppLink.vue +4 -1
- package/src/components/Avatar.vue +2 -2
- package/src/components/AvatarWithName.vue +8 -4
- package/src/components/BouncingDots.vue +21 -0
- package/src/components/BrandedButton.vue +2 -0
- package/src/components/CopyButton.vue +19 -7
- package/src/components/DataserviceCard.vue +83 -118
- package/src/components/DatasetCard.vue +110 -171
- package/src/components/DatasetInformation/DatasetEmbedSection.vue +43 -0
- package/src/components/DatasetInformation/DatasetInformationSection.vue +73 -0
- package/src/components/DatasetInformation/DatasetSchemaSection.vue +74 -0
- package/src/components/DatasetInformation/DatasetSpatialSection.vue +59 -0
- package/src/components/DatasetInformation/DatasetTemporalitySection.vue +45 -0
- package/src/components/DatasetInformation/index.ts +5 -0
- package/src/components/DatasetQualityTooltipContent.vue +3 -3
- package/src/components/DescriptionList.vue +1 -4
- package/src/components/DescriptionListDetails.vue +5 -0
- package/src/components/DescriptionListTerm.vue +5 -0
- package/src/components/DiscussionMessageCard.vue +63 -0
- package/src/components/ExtraAccordion.vue +4 -4
- package/src/components/Form/BadgeSelect.vue +35 -0
- package/src/components/Form/FormatSelect.vue +28 -0
- package/src/components/Form/GeozoneSelect.vue +52 -0
- package/src/components/Form/GranularitySelect.vue +29 -0
- package/src/components/Form/LicenseSelect.vue +30 -0
- package/src/components/Form/OrganizationSelect.vue +62 -0
- package/src/components/Form/OrganizationTypeSelect.vue +34 -0
- package/src/components/Form/ReuseTopicSelect.vue +29 -0
- package/src/components/Form/SchemaSelect.vue +30 -0
- package/src/components/Form/SearchableSelect.vue +334 -0
- package/src/components/Form/SelectGroup.vue +132 -0
- package/src/components/Form/TagSelect.vue +38 -0
- package/src/components/LeafletMap.vue +31 -0
- package/src/components/LicenseBadge.vue +24 -0
- package/src/components/LoadingBlock.vue +23 -2
- package/src/components/MarkdownViewer.vue +3 -1
- package/src/components/ObjectCard.vue +42 -0
- package/src/components/ObjectCardBadge.vue +22 -0
- package/src/components/ObjectCardHeader.vue +35 -0
- package/src/components/ObjectCardOwner.vue +43 -0
- package/src/components/ObjectCardShortDescription.vue +28 -0
- package/src/components/OrganizationCard.vue +35 -20
- package/src/components/OrganizationLogo.vue +1 -1
- package/src/components/OrganizationNameWithCertificate.vue +13 -7
- package/src/components/OwnerTypeIcon.vue +1 -0
- package/src/components/Pagination.vue +1 -1
- package/src/components/Placeholder.vue +5 -2
- package/src/components/PostCard.vue +62 -0
- package/src/components/RadioGroup.vue +32 -0
- package/src/components/RadioInput.vue +64 -0
- package/src/components/ResourceAccordion/EditButton.vue +2 -3
- package/src/components/ResourceAccordion/MapContainer.client.vue +20 -16
- package/src/components/ResourceAccordion/Metadata.vue +11 -24
- package/src/components/ResourceAccordion/Pmtiles.client.vue +1 -1
- package/src/components/ResourceAccordion/Preview.vue +1 -1
- package/src/components/ResourceAccordion/ResourceAccordion.vue +30 -20
- package/src/components/ResourceAccordion/ResourceIcon.vue +1 -0
- package/src/components/ResourceAccordion/SchemaBadge.vue +2 -2
- package/src/components/ResourceExplorer/ResourceExplorer.vue +243 -0
- package/src/components/ResourceExplorer/ResourceExplorerSidebar.vue +116 -0
- package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +361 -0
- package/src/components/ReuseCard.vue +8 -28
- package/src/components/ReuseHorizontalCard.vue +80 -0
- package/src/components/Search/BasicAndAdvancedFilters.vue +49 -0
- package/src/components/Search/Filter/AccessTypeFilter.vue +37 -0
- package/src/components/Search/Filter/DatasetBadgeFilter.vue +40 -0
- package/src/components/Search/Filter/FilterButtonGroup.vue +78 -0
- package/src/components/Search/Filter/FormatFamilyFilter.vue +39 -0
- package/src/components/Search/Filter/LastUpdateRangeFilter.vue +37 -0
- package/src/components/Search/Filter/ProducerTypeFilter.vue +39 -0
- package/src/components/Search/Filter/ReuseTypeFilter.vue +42 -0
- package/src/components/Search/GlobalSearch.vue +611 -0
- package/src/components/Search/SearchInput.vue +63 -0
- package/src/components/Search/Sidemenu.vue +38 -0
- package/src/components/StatBox.vue +5 -5
- package/src/components/Tag.vue +30 -0
- package/src/components/Toggletip.vue +6 -2
- package/src/components/Tooltip.vue +2 -3
- package/src/components/TopicCard.vue +134 -0
- package/src/components/radioGroupContext.ts +9 -0
- package/src/composables/useDebouncedRef.ts +31 -0
- package/src/composables/useMetrics.ts +4 -3
- package/src/composables/useResourceCapabilities.ts +118 -0
- package/src/composables/useRouteQueryBoolean.ts +10 -0
- package/src/composables/useSelectModelSync.ts +89 -0
- package/src/composables/useStableQueryParams.ts +84 -0
- package/src/config.ts +4 -0
- package/src/functions/api.ts +17 -6
- package/src/functions/api.types.ts +4 -2
- package/src/functions/datasets.ts +1 -29
- package/src/functions/description.ts +33 -0
- package/src/functions/helpers.ts +11 -0
- package/src/functions/markdown.ts +60 -16
- package/src/functions/metrics.ts +33 -0
- package/src/functions/organizations.ts +5 -5
- package/src/main.ts +89 -7
- package/src/types/dataservices.ts +14 -12
- package/src/types/datasets.ts +20 -7
- package/src/types/discussions.ts +20 -0
- package/src/types/licenses.ts +3 -3
- package/src/types/organizations.ts +13 -1
- package/src/types/owned.ts +4 -2
- package/src/types/pages.ts +70 -0
- package/src/types/posts.ts +27 -0
- package/src/types/resources.ts +6 -0
- package/src/types/reuses.ts +14 -5
- package/src/types/search.ts +379 -0
- package/src/types/users.ts +12 -3
- package/dist/Swagger.client-CpLgaLg6.js +0 -4
- package/src/components/DatasetInformationPanel.vue +0 -211
package/src/types/datasets.ts
CHANGED
|
@@ -23,9 +23,18 @@ export type Quality = {
|
|
|
23
23
|
update_fulfilled_in_time: boolean
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export type
|
|
27
|
-
|
|
26
|
+
export type DatasetReference = {
|
|
27
|
+
class: 'Dataset'
|
|
28
|
+
id: string
|
|
28
29
|
acronym: string
|
|
30
|
+
page: string
|
|
31
|
+
title: string
|
|
32
|
+
uri: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type BaseDataset = Owned & WithAccessType & {
|
|
36
|
+
title: DatasetReference['title']
|
|
37
|
+
acronym: DatasetReference['acronym']
|
|
29
38
|
archived: boolean
|
|
30
39
|
description: string
|
|
31
40
|
description_short: string
|
|
@@ -58,10 +67,10 @@ export type Rel = {
|
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
export type Dataset = BaseDataset & {
|
|
61
|
-
id:
|
|
70
|
+
id: DatasetReference['id']
|
|
62
71
|
badges: Badges
|
|
63
72
|
deleted: string | null
|
|
64
|
-
page:
|
|
73
|
+
page: DatasetReference['page']
|
|
65
74
|
resources: Array<Resource>
|
|
66
75
|
community_resources: Array<Resource>
|
|
67
76
|
created_at: string
|
|
@@ -71,7 +80,7 @@ export type Dataset = BaseDataset & {
|
|
|
71
80
|
created_at_internal: string
|
|
72
81
|
last_modified_internal: string
|
|
73
82
|
}
|
|
74
|
-
uri:
|
|
83
|
+
uri: DatasetReference['uri']
|
|
75
84
|
slug: string
|
|
76
85
|
quality: Quality
|
|
77
86
|
metrics: {
|
|
@@ -94,9 +103,13 @@ export type DatasetV2 = Owned & Omit<Dataset, 'resources' | 'community_resources
|
|
|
94
103
|
community_resources: Rel
|
|
95
104
|
}
|
|
96
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Dataset with fully populated nested objects (license, frequency, spatial).
|
|
108
|
+
* Retrieve this version by adding the header `X-Get-Datasets-Full-Objects: True` to the request: GET /api/2/datasets/{id}/
|
|
109
|
+
*/
|
|
97
110
|
export type DatasetV2WithFullObject = Owned & Omit<DatasetV2, 'license' | 'frequency' | 'spatial'> & {
|
|
98
|
-
license: License
|
|
99
|
-
frequency: Frequency
|
|
111
|
+
license: License | null
|
|
112
|
+
frequency: Frequency | null
|
|
100
113
|
spatial: {
|
|
101
114
|
zones?: Array<SpatialZone>
|
|
102
115
|
granularity?: Granularity
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OrganizationReference } from './organizations'
|
|
2
|
+
import type { UserReference } from './users'
|
|
3
|
+
|
|
4
|
+
export type Comment = {
|
|
5
|
+
content: string
|
|
6
|
+
posted_by: UserReference
|
|
7
|
+
posted_on: string
|
|
8
|
+
posted_by_organization: OrganizationReference | null
|
|
9
|
+
last_modified_at?: string | null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface Thread {
|
|
13
|
+
id: string
|
|
14
|
+
title: string
|
|
15
|
+
user: UserReference
|
|
16
|
+
organization: OrganizationReference | null
|
|
17
|
+
created: string
|
|
18
|
+
discussion: Array<Comment>
|
|
19
|
+
self_web_url?: string
|
|
20
|
+
}
|
package/src/types/licenses.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type License = {
|
|
2
|
-
alternate_titles: Array<string>
|
|
3
|
-
alternate_urls: Array<string>
|
|
2
|
+
alternate_titles: Array<string> | null
|
|
3
|
+
alternate_urls: Array<string> | null
|
|
4
4
|
flags: Array<string>
|
|
5
5
|
id: string
|
|
6
6
|
maintainer: string | null
|
|
7
7
|
title: string
|
|
8
|
-
url: string
|
|
8
|
+
url: string | null
|
|
9
9
|
}
|
|
@@ -24,6 +24,7 @@ export type NewOrganization = {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export type OrganizationReference = {
|
|
27
|
+
class: 'Organization'
|
|
27
28
|
id: string
|
|
28
29
|
name: string
|
|
29
30
|
acronym: string | null
|
|
@@ -33,9 +34,20 @@ export type OrganizationReference = {
|
|
|
33
34
|
logo: string
|
|
34
35
|
logo_thumbnail: string
|
|
35
36
|
badges: Badges
|
|
37
|
+
permissions: { delete: boolean, edit: boolean, harvest: boolean, members: boolean, private: boolean }
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
export type Organization =
|
|
40
|
+
export type Organization = {
|
|
41
|
+
id: OrganizationReference['id']
|
|
42
|
+
name: OrganizationReference['name']
|
|
43
|
+
acronym: OrganizationReference['acronym']
|
|
44
|
+
slug: OrganizationReference['slug']
|
|
45
|
+
uri: OrganizationReference['uri']
|
|
46
|
+
page: OrganizationReference['page']
|
|
47
|
+
logo: OrganizationReference['logo']
|
|
48
|
+
logo_thumbnail: OrganizationReference['logo_thumbnail']
|
|
49
|
+
badges: OrganizationReference['badges']
|
|
50
|
+
permissions: OrganizationReference['permissions']
|
|
39
51
|
url: string // URL of the org website
|
|
40
52
|
description: string
|
|
41
53
|
business_number_id: string
|
package/src/types/owned.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OrganizationReference } from './organizations'
|
|
2
|
-
import type { UserReference } from './users'
|
|
1
|
+
import type { Organization, OrganizationReference } from './organizations'
|
|
2
|
+
import type { User, UserReference } from './users'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A resource, dataset, reuse or any other object owned by an organization or a user.
|
|
@@ -7,3 +7,5 @@ import type { UserReference } from './users'
|
|
|
7
7
|
export type Owned = { organization: OrganizationReference, owner: never | null } | { organization: never | null, owner: UserReference }
|
|
8
8
|
|
|
9
9
|
export type OwnedWithId = { organization: string, owner: never | null } | { organization: never | null, owner: string }
|
|
10
|
+
|
|
11
|
+
export type OwnedWithFullObject = { organization: Organization, owner: never | null } | { organization: never | null, owner: User }
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { DatasetV2 } from './datasets'
|
|
2
|
+
import type { Dataservice } from './dataservices'
|
|
3
|
+
import type { Reuse } from './reuses'
|
|
4
|
+
|
|
5
|
+
export type Page = {
|
|
6
|
+
id: string
|
|
7
|
+
blocs: Array<PageBloc>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type BlocWithTitle = {
|
|
11
|
+
title: string
|
|
12
|
+
subtitle: string | null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type DatasetsListBloc = {
|
|
16
|
+
class: 'DatasetsListBloc'
|
|
17
|
+
datasets: Array<DatasetV2>
|
|
18
|
+
} & BlocWithTitle & { id: string }
|
|
19
|
+
export type DataservicesListBloc = {
|
|
20
|
+
class: 'DataservicesListBloc'
|
|
21
|
+
dataservices: Array<Dataservice>
|
|
22
|
+
} & BlocWithTitle & { id: string }
|
|
23
|
+
export type ReusesListBloc = {
|
|
24
|
+
class: 'ReusesListBloc'
|
|
25
|
+
reuses: Array<Reuse>
|
|
26
|
+
} & BlocWithTitle & { id: string }
|
|
27
|
+
|
|
28
|
+
export type LinkInBloc = {
|
|
29
|
+
title: string
|
|
30
|
+
url: string
|
|
31
|
+
color: string | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type LinksListBloc = {
|
|
35
|
+
class: 'LinksListBloc'
|
|
36
|
+
paragraph: string | null
|
|
37
|
+
main_link_title: string | null
|
|
38
|
+
main_link_url: string | null
|
|
39
|
+
links: Array<LinkInBloc>
|
|
40
|
+
} & BlocWithTitle & { id: string }
|
|
41
|
+
|
|
42
|
+
export type MarkdownBloc = {
|
|
43
|
+
class: 'MarkdownBloc'
|
|
44
|
+
content: string
|
|
45
|
+
} & BlocWithTitle & { id: string }
|
|
46
|
+
|
|
47
|
+
export type ContentBloc = DatasetsListBloc | DataservicesListBloc | ReusesListBloc | LinksListBloc | MarkdownBloc
|
|
48
|
+
|
|
49
|
+
export type AccordionItemBloc = {
|
|
50
|
+
title: string
|
|
51
|
+
content: Array<ContentBloc>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type AccordionListBloc = {
|
|
55
|
+
class: 'AccordionListBloc'
|
|
56
|
+
title: string | null
|
|
57
|
+
description: string | null
|
|
58
|
+
items: Array<AccordionItemBloc>
|
|
59
|
+
} & { id: string }
|
|
60
|
+
|
|
61
|
+
export type HeroBloc = {
|
|
62
|
+
class: 'HeroBloc'
|
|
63
|
+
title: string
|
|
64
|
+
description: string | null
|
|
65
|
+
color: 'primary' | 'green' | 'purple'
|
|
66
|
+
main_link_title: string | null
|
|
67
|
+
main_link_url: string | null
|
|
68
|
+
} & { id: string }
|
|
69
|
+
|
|
70
|
+
export type PageBloc = ContentBloc | AccordionListBloc | HeroBloc
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Dataset } from './datasets'
|
|
2
|
+
import type { Page } from './pages'
|
|
3
|
+
import type { Reuse } from './reuses'
|
|
4
|
+
import type { User } from './users'
|
|
5
|
+
|
|
6
|
+
export type Post = {
|
|
7
|
+
body_type: 'markdown' | 'html' | 'blocs'
|
|
8
|
+
content: string
|
|
9
|
+
content_as_page: Page | null
|
|
10
|
+
created_at: string
|
|
11
|
+
credit_to: string
|
|
12
|
+
credit_url: string
|
|
13
|
+
datasets: Array<Pick<Dataset, 'acronym' | 'id' | 'page' | 'title' | 'uri'>>
|
|
14
|
+
headline: string
|
|
15
|
+
id: string
|
|
16
|
+
image: string | null
|
|
17
|
+
kind: 'news' | 'page'
|
|
18
|
+
last_modified: string
|
|
19
|
+
name: string
|
|
20
|
+
owner: User
|
|
21
|
+
page: string
|
|
22
|
+
published: string | null
|
|
23
|
+
reuses: Array<Pick<Reuse, 'id' | 'image' | 'image_thumbnail' | 'page' | 'title' | 'uri'>>
|
|
24
|
+
slug: string
|
|
25
|
+
tags: Array<string>
|
|
26
|
+
url: string
|
|
27
|
+
}
|
package/src/types/resources.ts
CHANGED
|
@@ -35,3 +35,9 @@ export type Resource = {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export type CommunityResource = Owned & Resource & { dataset: Omit<Dataset, 'resources' | 'community_resources'>, permissions: { edit: boolean, delete: boolean } }
|
|
38
|
+
|
|
39
|
+
export interface ResourceGroup {
|
|
40
|
+
type: ResourceType
|
|
41
|
+
total: number
|
|
42
|
+
items: Resource[]
|
|
43
|
+
}
|
package/src/types/reuses.ts
CHANGED
|
@@ -3,8 +3,17 @@ import type { Dataset } from './datasets'
|
|
|
3
3
|
import type { Badges } from './badges'
|
|
4
4
|
import type { Dataservice } from './dataservices'
|
|
5
5
|
|
|
6
|
-
export type
|
|
6
|
+
export type ReuseReference = {
|
|
7
|
+
class: 'Reuse'
|
|
8
|
+
id: string
|
|
7
9
|
title: string
|
|
10
|
+
image: string | null
|
|
11
|
+
uri: string
|
|
12
|
+
page: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type BaseReuse = Owned & {
|
|
16
|
+
title: ReuseReference['title']
|
|
8
17
|
description: string
|
|
9
18
|
tags: Array<string> | null
|
|
10
19
|
datasets: Array<Dataset | string>
|
|
@@ -25,8 +34,8 @@ export type Reuse = BaseReuse & {
|
|
|
25
34
|
deleted: string | null
|
|
26
35
|
extras: Record<string, unknown>
|
|
27
36
|
featured: boolean
|
|
28
|
-
id:
|
|
29
|
-
image:
|
|
37
|
+
id: ReuseReference['id']
|
|
38
|
+
image: ReuseReference['image']
|
|
30
39
|
image_thumbnail: string | null
|
|
31
40
|
last_modified: string
|
|
32
41
|
metrics: {
|
|
@@ -37,8 +46,8 @@ export type Reuse = BaseReuse & {
|
|
|
37
46
|
views: number
|
|
38
47
|
}
|
|
39
48
|
slug: string
|
|
40
|
-
page:
|
|
41
|
-
uri:
|
|
49
|
+
page: ReuseReference['page']
|
|
50
|
+
uri: ReuseReference['uri']
|
|
42
51
|
permissions: { edit: boolean, delete: boolean }
|
|
43
52
|
}
|
|
44
53
|
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import type { PaginatedArray } from './api'
|
|
2
|
+
import type { AccessType } from './access_types'
|
|
3
|
+
import type {
|
|
4
|
+
CERTIFIED,
|
|
5
|
+
PUBLIC_SERVICE,
|
|
6
|
+
ASSOCIATION,
|
|
7
|
+
COMPANY,
|
|
8
|
+
LOCAL_AUTHORITY,
|
|
9
|
+
USER,
|
|
10
|
+
OrganizationTypes } from '../functions/organizations'
|
|
11
|
+
|
|
12
|
+
// Common types
|
|
13
|
+
|
|
14
|
+
export type LastUpdateRange = 'last_30_days' | 'last_12_months' | 'last_3_years'
|
|
15
|
+
|
|
16
|
+
export type ProducerType = Exclude<OrganizationTypes, 'other'> | typeof USER | 'not-specified'
|
|
17
|
+
|
|
18
|
+
export type OrganizationBadgeFilter = typeof CERTIFIED | typeof PUBLIC_SERVICE | typeof ASSOCIATION | typeof COMPANY | typeof LOCAL_AUTHORITY
|
|
19
|
+
|
|
20
|
+
// Base query params (common to all searches)
|
|
21
|
+
|
|
22
|
+
export type BaseSearchQueryParams<Sort extends string> = {
|
|
23
|
+
q?: string
|
|
24
|
+
sort?: Sort
|
|
25
|
+
page?: number
|
|
26
|
+
page_size?: number
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Facet types
|
|
30
|
+
|
|
31
|
+
export type FacetItem = {
|
|
32
|
+
count: number
|
|
33
|
+
name: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Dataset Search
|
|
37
|
+
|
|
38
|
+
export type DatasetBadgeFilter = 'pivotal-data' | 'spd' | 'inspire' | 'hvd' | 'sl' | 'sr'
|
|
39
|
+
|
|
40
|
+
export type DatasetFormatFamily = 'tabular' | 'machine_readable' | 'geographical' | 'documents' | 'other'
|
|
41
|
+
|
|
42
|
+
export type DatasetAccessTypeFilter = AccessType | 'all'
|
|
43
|
+
|
|
44
|
+
export type DatasetGranularityFilter
|
|
45
|
+
= | 'other'
|
|
46
|
+
| 'country'
|
|
47
|
+
| 'country-group'
|
|
48
|
+
| 'country-subset'
|
|
49
|
+
| 'poi'
|
|
50
|
+
| 'fr:commune'
|
|
51
|
+
| 'fr:epci'
|
|
52
|
+
| 'fr:departement'
|
|
53
|
+
| 'fr:region'
|
|
54
|
+
| 'fr:canton'
|
|
55
|
+
| 'fr:collectivite'
|
|
56
|
+
| 'fr:iris'
|
|
57
|
+
| 'fr:arrondissement'
|
|
58
|
+
|
|
59
|
+
export type DatasetLicenseFilter
|
|
60
|
+
= | 'lov2'
|
|
61
|
+
| 'notspecified'
|
|
62
|
+
| 'fr-lo'
|
|
63
|
+
| 'odc-odbl'
|
|
64
|
+
| 'other-at'
|
|
65
|
+
| 'other-pd'
|
|
66
|
+
| 'cc-by'
|
|
67
|
+
| 'other-open'
|
|
68
|
+
| 'cc-by-sa'
|
|
69
|
+
| 'odc-by'
|
|
70
|
+
| 'cc-zero'
|
|
71
|
+
| 'odc-pddl'
|
|
72
|
+
|
|
73
|
+
export type DatasetSearchSort = 'created' | 'last_update' | 'reuses' | 'followers' | 'views' | '-created' | '-last_update' | '-reuses' | '-followers' | '-views'
|
|
74
|
+
|
|
75
|
+
export type DatasetSearchFilters = {
|
|
76
|
+
tag?: string | string[]
|
|
77
|
+
badge?: DatasetBadgeFilter
|
|
78
|
+
organization?: string
|
|
79
|
+
organization_badge?: OrganizationBadgeFilter
|
|
80
|
+
license?: DatasetLicenseFilter | string
|
|
81
|
+
geozone?: string
|
|
82
|
+
granularity?: DatasetGranularityFilter | DatasetGranularityFilter[]
|
|
83
|
+
format?: string | string[]
|
|
84
|
+
schema?: string | string[]
|
|
85
|
+
temporal_coverage?: string
|
|
86
|
+
featured?: boolean
|
|
87
|
+
topic?: string
|
|
88
|
+
access_type?: DatasetAccessTypeFilter
|
|
89
|
+
format_family?: DatasetFormatFamily
|
|
90
|
+
producer_type?: ProducerType
|
|
91
|
+
last_update_range?: LastUpdateRange
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type DatasetSearchQueryParams = BaseSearchQueryParams<DatasetSearchSort> & DatasetSearchFilters
|
|
95
|
+
|
|
96
|
+
export type DatasetSearchFacets = {
|
|
97
|
+
access_type: FacetItem[]
|
|
98
|
+
badge: FacetItem[]
|
|
99
|
+
format: FacetItem[]
|
|
100
|
+
format_family: FacetItem[]
|
|
101
|
+
geozone: FacetItem[]
|
|
102
|
+
granularity: FacetItem[]
|
|
103
|
+
last_update: FacetItem[]
|
|
104
|
+
license: FacetItem[]
|
|
105
|
+
organization_id_with_name: FacetItem[]
|
|
106
|
+
producer_type: FacetItem[]
|
|
107
|
+
schema: FacetItem[]
|
|
108
|
+
tag: FacetItem[]
|
|
109
|
+
topics: FacetItem[]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Dataservice Search
|
|
113
|
+
|
|
114
|
+
export type DataserviceAccessTypeFilter = AccessType | 'all'
|
|
115
|
+
|
|
116
|
+
export type DataserviceSearchSort = 'created' | 'views' | 'followers' | '-created' | '-views' | '-followers'
|
|
117
|
+
|
|
118
|
+
export type DataserviceSearchFilters = {
|
|
119
|
+
tag?: string | string[]
|
|
120
|
+
topic?: string
|
|
121
|
+
organization?: string
|
|
122
|
+
archived?: boolean
|
|
123
|
+
featured?: boolean
|
|
124
|
+
access_type?: DataserviceAccessTypeFilter
|
|
125
|
+
producer_type?: ProducerType
|
|
126
|
+
last_update_range?: LastUpdateRange
|
|
127
|
+
is_restricted?: boolean
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type DataserviceSearchQueryParams = BaseSearchQueryParams<DataserviceSearchSort> & DataserviceSearchFilters
|
|
131
|
+
|
|
132
|
+
export type DataserviceSearchFacets = {
|
|
133
|
+
access_type: FacetItem[]
|
|
134
|
+
badge: FacetItem[]
|
|
135
|
+
last_update: FacetItem[]
|
|
136
|
+
organization_id_with_name: FacetItem[]
|
|
137
|
+
producer_type: FacetItem[]
|
|
138
|
+
tag: FacetItem[]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Reuse Search
|
|
142
|
+
|
|
143
|
+
export type ReuseTopicFilter
|
|
144
|
+
= | 'others'
|
|
145
|
+
| 'health'
|
|
146
|
+
| 'transport_and_mobility'
|
|
147
|
+
| 'politics_and_public_life'
|
|
148
|
+
| 'housing_and_development'
|
|
149
|
+
| 'environment_and_energy'
|
|
150
|
+
| 'culture_and_recreation'
|
|
151
|
+
| 'society_and_demography'
|
|
152
|
+
| 'economy_and_business'
|
|
153
|
+
| 'open_data_tools'
|
|
154
|
+
| 'education_and_research'
|
|
155
|
+
| 'food_and_agriculture'
|
|
156
|
+
| 'law_and_justice'
|
|
157
|
+
| 'safety_and_security'
|
|
158
|
+
| 'work_and_training'
|
|
159
|
+
|
|
160
|
+
export type ReuseTypeFilter
|
|
161
|
+
= | 'visualization'
|
|
162
|
+
| 'application'
|
|
163
|
+
| 'post'
|
|
164
|
+
| 'news_article'
|
|
165
|
+
| 'api'
|
|
166
|
+
| 'paper'
|
|
167
|
+
| 'idea'
|
|
168
|
+
| 'hardware'
|
|
169
|
+
|
|
170
|
+
export type ReuseSearchSort = 'created' | 'datasets' | 'followers' | 'views' | '-created' | '-datasets' | '-followers' | '-views'
|
|
171
|
+
|
|
172
|
+
export type ReuseSearchFilters = {
|
|
173
|
+
tag?: string | string[]
|
|
174
|
+
organization?: string
|
|
175
|
+
organization_badge?: OrganizationBadgeFilter
|
|
176
|
+
owner?: string
|
|
177
|
+
type?: ReuseTypeFilter
|
|
178
|
+
badge?: string
|
|
179
|
+
featured?: boolean
|
|
180
|
+
topic?: ReuseTopicFilter
|
|
181
|
+
archived?: boolean
|
|
182
|
+
producer_type?: ProducerType
|
|
183
|
+
last_update_range?: LastUpdateRange
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export type ReuseSearchQueryParams = BaseSearchQueryParams<ReuseSearchSort> & ReuseSearchFilters
|
|
187
|
+
|
|
188
|
+
export type ReuseSearchFacets = {
|
|
189
|
+
badge: FacetItem[]
|
|
190
|
+
last_update: FacetItem[]
|
|
191
|
+
organization_id_with_name: FacetItem[]
|
|
192
|
+
producer_type: FacetItem[]
|
|
193
|
+
tag: FacetItem[]
|
|
194
|
+
topic: FacetItem[]
|
|
195
|
+
type: FacetItem[]
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Organization Search
|
|
199
|
+
|
|
200
|
+
export type OrganizationSearchSort = 'reuses' | 'datasets' | 'followers' | 'views' | 'created' | '-reuses' | '-datasets' | '-followers' | '-views' | '-created'
|
|
201
|
+
|
|
202
|
+
export type OrganizationSearchFilters = {
|
|
203
|
+
badge?: OrganizationBadgeFilter
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type OrganizationSearchQueryParams = BaseSearchQueryParams<OrganizationSearchSort> & OrganizationSearchFilters
|
|
207
|
+
|
|
208
|
+
export type OrganizationSearchFacets = {
|
|
209
|
+
producer_type: FacetItem[]
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Post Search
|
|
213
|
+
|
|
214
|
+
export type PostSearchSort = 'created' | 'last_modified' | 'published' | '-created' | '-last_modified' | '-published'
|
|
215
|
+
|
|
216
|
+
export type PostSearchFilters = {
|
|
217
|
+
tag?: string | string[]
|
|
218
|
+
last_update_range?: LastUpdateRange
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export type PostSearchQueryParams = BaseSearchQueryParams<PostSearchSort> & PostSearchFilters
|
|
222
|
+
|
|
223
|
+
export type PostSearchFacets = {
|
|
224
|
+
last_update: FacetItem[]
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Discussion Search
|
|
228
|
+
|
|
229
|
+
export type DiscussionObjectType = 'Dataset' | 'Dataservice'
|
|
230
|
+
|
|
231
|
+
export type DiscussionSearchSort = 'created' | 'closed' | '-created' | '-closed'
|
|
232
|
+
|
|
233
|
+
export type DiscussionSearchFilters = {
|
|
234
|
+
closed?: boolean
|
|
235
|
+
last_update_range?: LastUpdateRange
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type DiscussionSearchQueryParams = BaseSearchQueryParams<DiscussionSearchSort> & DiscussionSearchFilters
|
|
239
|
+
|
|
240
|
+
export type DiscussionSearchFacets = {
|
|
241
|
+
last_update: FacetItem[]
|
|
242
|
+
object_type: FacetItem[]
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Topic Search
|
|
246
|
+
|
|
247
|
+
export type TopicSearchSort = 'name' | 'created' | 'last_modified' | '-name' | '-created' | '-last_modified'
|
|
248
|
+
|
|
249
|
+
export type TopicSearchFilters = {
|
|
250
|
+
tag?: string | string[]
|
|
251
|
+
featured?: boolean
|
|
252
|
+
last_update_range?: LastUpdateRange
|
|
253
|
+
organization?: string
|
|
254
|
+
producer_type?: ProducerType
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export type TopicSearchQueryParams = BaseSearchQueryParams<TopicSearchSort> & TopicSearchFilters
|
|
258
|
+
|
|
259
|
+
export type TopicSearchFacets = {
|
|
260
|
+
last_update: FacetItem[]
|
|
261
|
+
organization_id_with_name: FacetItem[]
|
|
262
|
+
producer_type: FacetItem[]
|
|
263
|
+
tag: FacetItem[]
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Search response with facets
|
|
267
|
+
|
|
268
|
+
export type SearchResponseWithFacets<T, F> = PaginatedArray<T> & {
|
|
269
|
+
facets: F
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export type DatasetSearchResponse<T> = SearchResponseWithFacets<T, DatasetSearchFacets>
|
|
273
|
+
export type DataserviceSearchResponse<T> = SearchResponseWithFacets<T, DataserviceSearchFacets>
|
|
274
|
+
export type ReuseSearchResponse<T> = SearchResponseWithFacets<T, ReuseSearchFacets>
|
|
275
|
+
export type OrganizationSearchResponse<T> = SearchResponseWithFacets<T, OrganizationSearchFacets>
|
|
276
|
+
export type PostSearchResponse<T> = SearchResponseWithFacets<T, PostSearchFacets>
|
|
277
|
+
export type DiscussionSearchResponse<T> = SearchResponseWithFacets<T, DiscussionSearchFacets>
|
|
278
|
+
export type TopicSearchResponse<T> = SearchResponseWithFacets<T, TopicSearchFacets>
|
|
279
|
+
|
|
280
|
+
// GlobalSearch configuration types
|
|
281
|
+
|
|
282
|
+
export type HiddenFilter<Filters> = {
|
|
283
|
+
[K in keyof Filters]: { key: K, value: Filters[K] }
|
|
284
|
+
}[keyof Filters]
|
|
285
|
+
|
|
286
|
+
export type SortOption<Sort extends string> = {
|
|
287
|
+
value: Sort
|
|
288
|
+
label: string
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export type DatasetSearchConfig = {
|
|
292
|
+
class: 'datasets'
|
|
293
|
+
name?: string
|
|
294
|
+
hiddenFilters?: HiddenFilter<DatasetSearchFilters>[]
|
|
295
|
+
basicFilters?: (keyof DatasetSearchFilters)[]
|
|
296
|
+
advancedFilters?: (keyof DatasetSearchFilters)[]
|
|
297
|
+
sortOptions?: SortOption<DatasetSearchSort>[]
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export type DataserviceSearchConfig = {
|
|
301
|
+
class: 'dataservices'
|
|
302
|
+
name?: string
|
|
303
|
+
hiddenFilters?: HiddenFilter<DataserviceSearchFilters>[]
|
|
304
|
+
basicFilters?: (keyof DataserviceSearchFilters)[]
|
|
305
|
+
advancedFilters?: (keyof DataserviceSearchFilters)[]
|
|
306
|
+
sortOptions?: SortOption<DataserviceSearchSort>[]
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export type ReuseSearchConfig = {
|
|
310
|
+
class: 'reuses'
|
|
311
|
+
name?: string
|
|
312
|
+
hiddenFilters?: HiddenFilter<ReuseSearchFilters>[]
|
|
313
|
+
basicFilters?: (keyof ReuseSearchFilters)[]
|
|
314
|
+
advancedFilters?: (keyof ReuseSearchFilters)[]
|
|
315
|
+
sortOptions?: SortOption<ReuseSearchSort>[]
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export type SearchTypeConfig = DatasetSearchConfig | DataserviceSearchConfig | ReuseSearchConfig
|
|
319
|
+
|
|
320
|
+
export type SearchType = SearchTypeConfig['class']
|
|
321
|
+
|
|
322
|
+
export type GlobalSearchConfig = SearchTypeConfig[]
|
|
323
|
+
|
|
324
|
+
// Helper functions for default configs
|
|
325
|
+
|
|
326
|
+
export const defaultDatasetSortOptions: SortOption<DatasetSearchSort>[] = [
|
|
327
|
+
{ value: '-created', label: 'Date de création' },
|
|
328
|
+
{ value: '-last_update', label: 'Dernière mise à jour' },
|
|
329
|
+
{ value: '-followers', label: `Nombre d'abonnés` },
|
|
330
|
+
{ value: '-reuses', label: 'Nombre de réutilisations' },
|
|
331
|
+
]
|
|
332
|
+
|
|
333
|
+
export const defaultDataserviceSortOptions: SortOption<DataserviceSearchSort>[] = [
|
|
334
|
+
{ value: '-created', label: 'Date de création' },
|
|
335
|
+
]
|
|
336
|
+
|
|
337
|
+
export const defaultReuseSortOptions: SortOption<ReuseSearchSort>[] = [
|
|
338
|
+
{ value: '-created', label: 'Date de création' },
|
|
339
|
+
{ value: '-followers', label: `Nombre d'abonnés` },
|
|
340
|
+
{ value: '-datasets', label: 'Nombre de jeux de données' },
|
|
341
|
+
]
|
|
342
|
+
|
|
343
|
+
export function getDefaultDatasetConfig(overrides?: Partial<Omit<DatasetSearchConfig, 'class'>>): DatasetSearchConfig {
|
|
344
|
+
return {
|
|
345
|
+
class: 'datasets',
|
|
346
|
+
basicFilters: ['format_family', 'access_type', 'last_update_range', 'producer_type', 'badge'],
|
|
347
|
+
advancedFilters: ['organization', 'organization_badge', 'tag', 'format', 'license', 'schema', 'geozone', 'granularity'],
|
|
348
|
+
sortOptions: defaultDatasetSortOptions,
|
|
349
|
+
...overrides,
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export function getDefaultDataserviceConfig(overrides?: Partial<Omit<DataserviceSearchConfig, 'class'>>): DataserviceSearchConfig {
|
|
354
|
+
return {
|
|
355
|
+
class: 'dataservices',
|
|
356
|
+
basicFilters: ['access_type', 'last_update_range', 'producer_type'],
|
|
357
|
+
advancedFilters: ['organization', 'tag'],
|
|
358
|
+
sortOptions: defaultDataserviceSortOptions,
|
|
359
|
+
...overrides,
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export function getDefaultReuseConfig(overrides?: Partial<Omit<ReuseSearchConfig, 'class'>>): ReuseSearchConfig {
|
|
364
|
+
return {
|
|
365
|
+
class: 'reuses',
|
|
366
|
+
basicFilters: ['type', 'topic', 'last_update_range', 'producer_type'],
|
|
367
|
+
advancedFilters: ['organization', 'organization_badge', 'tag'],
|
|
368
|
+
sortOptions: defaultReuseSortOptions,
|
|
369
|
+
...overrides,
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export function getDefaultGlobalSearchConfig(): GlobalSearchConfig {
|
|
374
|
+
return [
|
|
375
|
+
getDefaultDatasetConfig(),
|
|
376
|
+
getDefaultDataserviceConfig(),
|
|
377
|
+
getDefaultReuseConfig(),
|
|
378
|
+
]
|
|
379
|
+
}
|
package/src/types/users.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OrganizationReference } from './organizations'
|
|
2
2
|
|
|
3
3
|
export type UserReference = {
|
|
4
|
+
class: 'User'
|
|
4
5
|
id: string
|
|
5
6
|
first_name: string
|
|
6
7
|
last_name: string
|
|
@@ -11,13 +12,21 @@ export type UserReference = {
|
|
|
11
12
|
avatar_thumbnail: string
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export type User =
|
|
15
|
+
export type User = {
|
|
16
|
+
id: UserReference['id']
|
|
17
|
+
first_name: UserReference['first_name']
|
|
18
|
+
last_name: UserReference['last_name']
|
|
19
|
+
slug: UserReference['slug']
|
|
20
|
+
uri: UserReference['uri']
|
|
21
|
+
page: UserReference['page']
|
|
22
|
+
avatar: UserReference['avatar']
|
|
23
|
+
avatar_thumbnail: UserReference['avatar_thumbnail']
|
|
15
24
|
apikey?: string
|
|
16
25
|
email?: string
|
|
17
26
|
about: string
|
|
18
27
|
website?: string
|
|
19
28
|
roles?: Array<string>
|
|
20
|
-
organizations: Array<
|
|
29
|
+
organizations: Array<OrganizationReference>
|
|
21
30
|
last_login_at: string | null
|
|
22
31
|
since: string | null
|
|
23
32
|
metrics: {
|