@openneuro/app 4.47.6 → 5.0.0-alpha.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.
Files changed (41) hide show
  1. package/package.json +2 -2
  2. package/src/client.jsx +6 -4
  3. package/src/scripts/authentication/__tests__/profile.spec.js +79 -13
  4. package/src/scripts/authentication/profile.ts +9 -0
  5. package/src/scripts/contributors/contributor.tsx +3 -2
  6. package/src/scripts/contributors/contributors-list.tsx +0 -1
  7. package/src/scripts/datalad/dataset/dataset-query-fragments.js +0 -2
  8. package/src/scripts/datalad/mutations/delete-comment.jsx +1 -1
  9. package/src/scripts/dataset/components/dataset-event-item.tsx +4 -4
  10. package/src/scripts/dataset/download/__tests__/download-script.spec.tsx +1 -1
  11. package/src/scripts/dataset/download/download-script.tsx +21 -10
  12. package/src/scripts/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +4 -4
  13. package/src/scripts/dataset/files/file-tree-unloaded-directory.jsx +2 -5
  14. package/src/scripts/dataset/files/file-tree.tsx +1 -1
  15. package/src/scripts/dataset/mutations/delete-file.jsx +11 -16
  16. package/src/scripts/dataset/mutations/hold-deletion.tsx +57 -0
  17. package/src/scripts/dataset/routes/__tests__/snapshot.spec.tsx +56 -0
  18. package/src/scripts/dataset/routes/admin-datalad.jsx +10 -0
  19. package/src/scripts/dataset/routes/snapshot.tsx +8 -2
  20. package/src/scripts/pages/front-page/aggregate-queries/use-publicDatasets-count.ts +2 -4
  21. package/src/scripts/queries/dataset.ts +1 -1
  22. package/src/scripts/queries/datasetEvents.ts +2 -2
  23. package/src/scripts/queries/user.ts +2 -12
  24. package/src/scripts/search/inputs/__tests__/sort-by-select.spec.tsx +4 -26
  25. package/src/scripts/search/inputs/sort-by-select.tsx +6 -6
  26. package/src/scripts/search/use-search-results.tsx +38 -256
  27. package/src/scripts/types/event-types.ts +21 -8
  28. package/src/scripts/users/__tests__/user-routes.spec.tsx +2 -11
  29. package/src/scripts/users/notifications/user-notification-accordion-actions.tsx +5 -5
  30. package/src/scripts/users/notifications/user-notification-accordion-header.tsx +4 -1
  31. package/src/scripts/users/notifications/user-notification-accordion.tsx +12 -5
  32. package/src/scripts/users/notifications/user-notification-reason-input.tsx +6 -3
  33. package/src/scripts/users/notifications/user-notifications-accordion-body.tsx +3 -3
  34. package/src/scripts/users/user-datasets-view.tsx +83 -164
  35. package/src/scripts/users/user-menu.tsx +1 -1
  36. package/src/scripts/datalad/dataset/comments-fragments.js +0 -22
  37. package/src/scripts/datalad/mutations/follow.jsx +0 -54
  38. package/src/scripts/datalad/mutations/publish.jsx +0 -58
  39. package/src/scripts/datalad/mutations/star.jsx +0 -54
  40. package/src/scripts/pages/admin/user-fragment.ts +0 -21
  41. package/src/scripts/search/es-query-builders.ts +0 -107
@@ -1,107 +0,0 @@
1
- // Builds query components using the Elasticsearch Query DSL
2
- // https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html
3
-
4
- const emptyQuery = () => ({
5
- bool: {},
6
- })
7
- export function BoolQuery() {
8
- this.query = emptyQuery()
9
- }
10
- BoolQuery.prototype.addClause = function (type: string, query: object) {
11
- if (this.query.bool[type]) {
12
- this.query.bool[type] = [...this.query.bool[type], query]
13
- } else {
14
- this.query.bool[type] = [query]
15
- }
16
- }
17
- BoolQuery.prototype.get = function () {
18
- return this.query
19
- }
20
- BoolQuery.prototype.toString = function () {
21
- return JSON.stringify(this.query)
22
- }
23
- BoolQuery.prototype.isEmpty = function () {
24
- return JSON.stringify(this.query) === JSON.stringify(emptyQuery())
25
- }
26
-
27
- export const simpleQueryString = (
28
- queryString: string,
29
- fields?: string[],
30
- fuzzy = true,
31
- ) => ({
32
- simple_query_string: {
33
- query: `${queryString}${fuzzy ? "~" : ""}`,
34
- fields,
35
- },
36
- })
37
-
38
- export const matchQuery = (
39
- field: string,
40
- queryString: string,
41
- fuzziness?: string,
42
- operator?: string,
43
- ) => ({
44
- match: {
45
- [field]: {
46
- query: queryString,
47
- fuzziness,
48
- operator,
49
- },
50
- },
51
- })
52
-
53
- export const multiMatchQuery = (
54
- field: string,
55
- queryStrings: string[],
56
- fuzziness?: string,
57
- operator?: string,
58
- ) => {
59
- return {
60
- bool: {
61
- should: queryStrings.map((queryString) =>
62
- matchQuery(field, queryString, fuzziness, operator)
63
- ),
64
- minimum_should_match: 1,
65
- },
66
- }
67
- }
68
-
69
- export const rangeQuery = (
70
- field,
71
- gte?: number | string,
72
- lte?: number | string,
73
- relation: string = "INTERSECTS",
74
- ) => ({
75
- range: {
76
- [field]: {
77
- gte,
78
- lte,
79
- relation,
80
- },
81
- },
82
- })
83
-
84
- export const rangeListLengthQuery = (field, gte: number, lte: number) => {
85
- return {
86
- script: {
87
- script: {
88
- lang: "painless",
89
- source: `
90
- if (doc[params.field].size() != 0) {
91
- return ( doc[params.field].size() >= params.gte && doc[params.field].size() <= params.lte )
92
- } else return false`,
93
- params: {
94
- field,
95
- gte,
96
- lte,
97
- },
98
- },
99
- },
100
- }
101
- }
102
-
103
- /** SimpleQueryString join multiple terms with and `+`. */
104
- export const sqsJoinWithAND = (list: string[]) =>
105
- list.map((str) => `${str}`).join(" + ")
106
- export const joinWithOR = (list: string[]) =>
107
- list.map((str) => `${str}`).join(" | ")