@gen3/core 0.10.44

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 (86) hide show
  1. package/dist/cjs/index.js +2243 -0
  2. package/dist/cjs/index.js.map +1 -0
  3. package/dist/dts/api.d.ts +8 -0
  4. package/dist/dts/constants.d.ts +32 -0
  5. package/dist/dts/dataAccess.d.ts +35 -0
  6. package/dist/dts/features/aiSearch/aiSearchSlice.d.ts +38 -0
  7. package/dist/dts/features/aiSearch/index.d.ts +2 -0
  8. package/dist/dts/features/app/store.d.ts +6 -0
  9. package/dist/dts/features/authz/authzMappingSlice.d.ts +141 -0
  10. package/dist/dts/features/authz/index.d.ts +3 -0
  11. package/dist/dts/features/authz/types.d.ts +5 -0
  12. package/dist/dts/features/cohort/cohortBuilderConfigSlice.d.ts +0 -0
  13. package/dist/dts/features/cohort/cohortSlice.d.ts +95 -0
  14. package/dist/dts/features/cohort/index.d.ts +2 -0
  15. package/dist/dts/features/cohort/types.d.ts +0 -0
  16. package/dist/dts/features/download/constants.d.ts +14 -0
  17. package/dist/dts/features/download/downloadStatusApi.d.ts +19 -0
  18. package/dist/dts/features/download/index.d.ts +2 -0
  19. package/dist/dts/features/download/types.d.ts +20 -0
  20. package/dist/dts/features/drsResolver/drsHostnameSlice.d.ts +5 -0
  21. package/dist/dts/features/drsResolver/index.d.ts +2 -0
  22. package/dist/dts/features/drsResolver/resolvers/cachedDRSResolver.d.ts +1 -0
  23. package/dist/dts/features/drsResolver/resolvers/dataGUIDSDotOrg.d.ts +6 -0
  24. package/dist/dts/features/drsResolver/resolvers/tests/dataGUIDSDotOrg.unit.test.d.ts +1 -0
  25. package/dist/dts/features/drsResolver/types.d.ts +0 -0
  26. package/dist/dts/features/drsResolver/utils.d.ts +6 -0
  27. package/dist/dts/features/fence/credentialsApi.d.ts +35 -0
  28. package/dist/dts/features/fence/fenceApi.d.ts +37 -0
  29. package/dist/dts/features/fence/index.d.ts +6 -0
  30. package/dist/dts/features/fence/jwtApi.d.ts +12 -0
  31. package/dist/dts/features/fence/types.d.ts +12 -0
  32. package/dist/dts/features/fence/utils.d.ts +12 -0
  33. package/dist/dts/features/filters/filters.d.ts +122 -0
  34. package/dist/dts/features/filters/index.d.ts +4 -0
  35. package/dist/dts/features/filters/tests/utils.unit.test.d.ts +1 -0
  36. package/dist/dts/features/filters/types.d.ts +113 -0
  37. package/dist/dts/features/filters/utils.d.ts +26 -0
  38. package/dist/dts/features/gen3/gen3Api.d.ts +11 -0
  39. package/dist/dts/features/gen3/index.d.ts +2 -0
  40. package/dist/dts/features/gen3Apps/Gen3App.d.ts +48 -0
  41. package/dist/dts/features/gen3Apps/gen3AppRegistry.d.ts +7 -0
  42. package/dist/dts/features/gen3Apps/gen3AppsSlice.d.ts +19 -0
  43. package/dist/dts/features/gen3Apps/index.d.ts +3 -0
  44. package/dist/dts/features/graphQL/graphQLSlice.d.ts +12 -0
  45. package/dist/dts/features/graphQL/index.d.ts +1 -0
  46. package/dist/dts/features/guppy/conversion.d.ts +23 -0
  47. package/dist/dts/features/guppy/guppyApi.d.ts +41 -0
  48. package/dist/dts/features/guppy/guppyDownloadSlice.d.ts +21 -0
  49. package/dist/dts/features/guppy/guppySlice.d.ts +120 -0
  50. package/dist/dts/features/guppy/index.d.ts +6 -0
  51. package/dist/dts/features/guppy/tests/downloadFromGuppy.unit.test.d.ts +1 -0
  52. package/dist/dts/features/guppy/types.d.ts +33 -0
  53. package/dist/dts/features/guppy/utils.d.ts +28 -0
  54. package/dist/dts/features/metadata/index.d.ts +3 -0
  55. package/dist/dts/features/metadata/metadataSlice.d.ts +56 -0
  56. package/dist/dts/features/metadata/types.d.ts +12 -0
  57. package/dist/dts/features/modals/index.d.ts +2 -0
  58. package/dist/dts/features/modals/modalsSlice.d.ts +26 -0
  59. package/dist/dts/features/submission/authMappingUtils.d.ts +15 -0
  60. package/dist/dts/features/submission/index.d.ts +3 -0
  61. package/dist/dts/features/submission/submissionApi.d.ts +43 -0
  62. package/dist/dts/features/submission/types.d.ts +46 -0
  63. package/dist/dts/features/user/externalLoginsSlice.d.ts +14 -0
  64. package/dist/dts/features/user/hooks.d.ts +18 -0
  65. package/dist/dts/features/user/index.d.ts +5 -0
  66. package/dist/dts/features/user/test/useGetExternalLoginsQuery.unit.test.d.ts +1 -0
  67. package/dist/dts/features/user/types.d.ts +50 -0
  68. package/dist/dts/features/user/userSlice.d.ts +53 -0
  69. package/dist/dts/features/user/userSliceRTK.d.ts +484 -0
  70. package/dist/dts/features/workspace/index.d.ts +2 -0
  71. package/dist/dts/features/workspace/types.d.ts +0 -0
  72. package/dist/dts/features/workspace/workspacesSlice.d.ts +6 -0
  73. package/dist/dts/hooks.d.ts +36 -0
  74. package/dist/dts/index.d.ts +23 -0
  75. package/dist/dts/provider.d.ts +2 -0
  76. package/dist/dts/reducers.d.ts +22 -0
  77. package/dist/dts/store.d.ts +53 -0
  78. package/dist/dts/store.unit.test.d.ts +2 -0
  79. package/dist/dts/types/index.d.ts +51 -0
  80. package/dist/dts/utils/extractvalues.d.ts +9 -0
  81. package/dist/dts/utils/index.d.ts +2 -0
  82. package/dist/dts/utils/ts-utils.d.ts +4 -0
  83. package/dist/esm/index.js +2083 -0
  84. package/dist/esm/index.js.map +1 -0
  85. package/dist/index.d.ts +1604 -0
  86. package/package.json +70 -0
@@ -0,0 +1,113 @@
1
+ export interface Intersection {
2
+ operator: 'and';
3
+ operands: ReadonlyArray<Operation>;
4
+ }
5
+ export interface Union {
6
+ operator: 'or';
7
+ operands: ReadonlyArray<Operation>;
8
+ }
9
+ export interface Equals {
10
+ operator: '=';
11
+ field: string;
12
+ operand: number | string;
13
+ }
14
+ export interface NotEquals {
15
+ operator: '!=';
16
+ field: string;
17
+ operand: number | string;
18
+ }
19
+ export interface Includes {
20
+ operator: 'in';
21
+ field: string;
22
+ operands: ReadonlyArray<string | number>;
23
+ }
24
+ export interface Comparison {
25
+ field: string;
26
+ operand: string | number;
27
+ }
28
+ export interface LessThan extends Comparison {
29
+ operator: '<';
30
+ }
31
+ export interface LessThanOrEquals extends Comparison {
32
+ operator: '<=';
33
+ }
34
+ export interface GreaterThan extends Comparison {
35
+ operator: '>';
36
+ }
37
+ export interface GreaterThanOrEquals extends Comparison {
38
+ operator: '>=';
39
+ }
40
+ export interface Exists {
41
+ readonly operator: 'exists';
42
+ readonly field: string;
43
+ }
44
+ export interface Missing {
45
+ readonly operator: 'missing';
46
+ readonly field: string;
47
+ }
48
+ export interface ExcludeIfAny {
49
+ readonly operator: 'excludeifany';
50
+ readonly field: string;
51
+ readonly operands: ReadonlyArray<string | number>;
52
+ }
53
+ export interface Excludes {
54
+ readonly operator: 'excludes';
55
+ readonly field: string;
56
+ readonly operands: ReadonlyArray<string | number>;
57
+ }
58
+ export interface NestedFilter {
59
+ operator: 'nested';
60
+ path: string;
61
+ operand: Operation;
62
+ }
63
+ export type Operation = Intersection | Union | Includes | Equals | NotEquals | LessThan | LessThanOrEquals | GreaterThan | GreaterThanOrEquals | NestedFilter | ExcludeIfAny | Excludes;
64
+ export type OperationWithField = Includes | Equals | NotEquals | LessThan | LessThanOrEquals | GreaterThan | GreaterThanOrEquals | ExcludeIfAny | Excludes;
65
+ export interface FilterSet {
66
+ readonly root: Record<string, Operation>;
67
+ readonly mode: 'and' | 'or';
68
+ }
69
+ export interface OperationHandler<T> {
70
+ handleEquals: (op: Equals) => T;
71
+ handleNotEquals: (op: NotEquals) => T;
72
+ handleLessThan: (op: LessThan) => T;
73
+ handleLessThanOrEquals: (op: LessThanOrEquals) => T;
74
+ handleGreaterThan: (op: GreaterThan) => T;
75
+ handleGreaterThanOrEquals: (op: GreaterThanOrEquals) => T;
76
+ handleIncludes: (op: Includes) => T;
77
+ handleExcludes: (op: Excludes) => T;
78
+ handleExcludeIfAny: (op: ExcludeIfAny) => T;
79
+ handleIntersection: (op: Intersection) => T;
80
+ handleUnion: (op: Union) => T;
81
+ handleNestedFilter: (op: NestedFilter) => T;
82
+ }
83
+ /**
84
+ * Operand types for filter operations
85
+ */
86
+ export type EnumFilterValue = ReadonlyArray<string | number>;
87
+ export type RangeFilterValue = string | number;
88
+ export type SetFilterValue = ReadonlyArray<Operation>;
89
+ export type FilterValue = EnumFilterValue | RangeFilterValue | SetFilterValue | undefined;
90
+ export type FacetBucket = {
91
+ key: string;
92
+ doc_count: number;
93
+ };
94
+ export type HistogramBucket = {
95
+ key: string | [number, number];
96
+ count: number;
97
+ };
98
+ export type FacetType = 'enum' | 'exact' | 'range' | 'age' | 'year' | 'years' | 'days' | 'percent' | 'datetime' | 'toggle' | 'multiselect';
99
+ export interface AllowableRange {
100
+ readonly minimum?: number;
101
+ readonly maximum?: number;
102
+ }
103
+ export interface FacetDefinition {
104
+ readonly description?: string;
105
+ readonly field: string;
106
+ readonly dataField: string;
107
+ readonly index: string;
108
+ readonly type: FacetType;
109
+ readonly range?: AllowableRange;
110
+ readonly hasData?: boolean;
111
+ readonly label?: string;
112
+ }
113
+ export type IndexedFilterSet = Record<string, FilterSet>;
@@ -0,0 +1,26 @@
1
+ export declare const trimFirstFieldNameToTitle: (fieldName: string, trim?: boolean) => string;
2
+ /**
3
+ * Converts a filter name to a title,
4
+ * For example files.input.experimental_strategy will get converted to Experimental Strategy
5
+ * if sections == 2 then the output would be Input Experimental Strategy
6
+ * @param fieldName input filter expected to be: string.firstpart_secondpart
7
+ * @param sections number of "sections" string.string.string to got back from the end of the field
8
+ */
9
+ export declare const fieldNameToTitle: (fieldName: string, sections?: number) => string;
10
+ /**
11
+ * Extracts the index name from the field name
12
+ * @param fieldName
13
+ */
14
+ export declare const extractIndexFromFullFieldName: (fieldName: string) => string;
15
+ /**
16
+ * prepend the index name to the field name
17
+ */
18
+ export declare const prependIndexToFieldName: (fieldName: string, index: string) => string;
19
+ /**
20
+ * extract the field name from the index.field name
21
+ */
22
+ export declare const extractFieldNameFromFullFieldName: (fieldName: string) => string;
23
+ /**
24
+ * extract the field name and the index from the index.field name returning as a tuple
25
+ */
26
+ export declare const extractIndexAndFieldNameFromFullFieldName: (fieldName: string) => [string, string];
@@ -0,0 +1,11 @@
1
+ import { Middleware, Reducer } from '@reduxjs/toolkit';
2
+ /**
3
+ * Creates a base class core API for building other API endpoints on top of.
4
+ * @param reducerPath - The root key name that the other slices will be derived from
5
+ * @param baseQuery: - The template query which the slices will addon to
6
+ * @param endpoints - Base API endpoints that should exist in every slice
7
+ * @returns: The generated base API
8
+ */
9
+ export declare const gen3Api: import("@reduxjs/toolkit/dist/query/apiTypes").Api<import("@reduxjs/toolkit/dist/query/baseQueryTypes").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query/fetchBaseQuery").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query/fetchBaseQuery").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query/fetchBaseQuery").FetchBaseQueryMeta>, {}, "gen3Services", never, keyof import("@reduxjs/toolkit/dist/query/apiTypes").ApiModules<any, any, any, any>>;
10
+ export declare const gen3ServicesReducer: Reducer;
11
+ export declare const gen3ServicesReducerMiddleware: Middleware;
@@ -0,0 +1,2 @@
1
+ import { gen3Api } from './gen3Api';
2
+ export { gen3Api };
@@ -0,0 +1,48 @@
1
+ import React, { ComponentType } from 'react';
2
+ import { EntityType } from './gen3AppsSlice';
3
+ import { AnyAction } from '@reduxjs/toolkit';
4
+ import { Store, Action } from 'redux';
5
+ import { DataStatus } from '../../dataAccess';
6
+ export interface CreateGen3AppOptions {
7
+ readonly App: ComponentType;
8
+ readonly name: string;
9
+ readonly version: string;
10
+ readonly requiredEntityTypes: ReadonlyArray<EntityType>;
11
+ }
12
+ export declare const getGen3AppId: (name: string, version: string) => string;
13
+ /**
14
+ * TODO: can't tell what anything in this directory is doing.
15
+ */
16
+ export declare const createGen3App: ({ App, name, version, requiredEntityTypes, }: CreateGen3AppOptions) => React.FC;
17
+ export interface AppDataSelectorResponse<T> {
18
+ readonly data?: T;
19
+ readonly status: DataStatus;
20
+ readonly error?: string;
21
+ }
22
+ export interface UseAppDataResponse<T> {
23
+ readonly data?: T;
24
+ readonly error?: string;
25
+ readonly isUninitialized: boolean;
26
+ readonly isFetching: boolean;
27
+ readonly isSuccess: boolean;
28
+ readonly isError: boolean;
29
+ }
30
+ export interface UseAppDataHook<P, T> {
31
+ (...params: P[]): UseAppDataResponse<T>;
32
+ }
33
+ export interface CreateGEN3AppStore {
34
+ readonly name: string;
35
+ readonly version: string;
36
+ readonly reducers: (...args: any) => any;
37
+ }
38
+ export declare const createAppStore: (options: CreateGEN3AppStore) => Record<any, any>;
39
+ export interface CreateGen3AppWithOwnStoreOptions<A extends Action = AnyAction, S = any> {
40
+ readonly App: ComponentType;
41
+ readonly id: string;
42
+ readonly name: string;
43
+ readonly version: string;
44
+ readonly requiredEntityTypes: ReadonlyArray<EntityType>;
45
+ readonly store: Store<S, A>;
46
+ readonly context: any;
47
+ }
48
+ export declare const createGen3AppWithOwnStore: <A extends Action = AnyAction, S = any>(options: CreateGen3AppWithOwnStoreOptions<A, S>) => React.ReactNode;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A registry for the Gen3 Apps.
3
+ */
4
+ export declare const REGISTRY: Record<string, React.ReactNode>;
5
+ export declare const registerGen3App: (id: string, gen3App: React.ReactNode) => void;
6
+ export declare const lookupGen3App: (id: string) => React.ReactNode;
7
+ export declare const computeGen3AppId: (name: string, version: string) => string;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { CoreState } from '../../reducers';
3
+ export interface Gen3AppsState {
4
+ readonly gen3Apps: Readonly<Record<string, Gen3AppMetadata>>;
5
+ readonly currentAppId?: string;
6
+ }
7
+ export interface Gen3AppMetadata {
8
+ readonly id: string;
9
+ readonly name: string;
10
+ readonly version: string;
11
+ readonly requiredEntityTypes: ReadonlyArray<EntityType>;
12
+ }
13
+ export type EntityType = 'case' | 'gene' | 'ssm' | 'cnv' | 'file';
14
+ export declare const gen3AppReducer: import("redux").Reducer<Gen3AppsState>;
15
+ export declare const addGen3AppMetadata: import("@reduxjs/toolkit").ActionCreatorWithPayload<Gen3AppMetadata, "gen3Apps/addGen3AppMetadata">;
16
+ export declare const selectGen3AppIds: (state: CoreState) => ReadonlyArray<string>;
17
+ export declare const selectAllGen3AppMetadata: (state: CoreState) => ReadonlyArray<Gen3AppMetadata>;
18
+ export declare const selectGen3AppMetadataById: (state: CoreState, appId: string) => Gen3AppMetadata;
19
+ export declare const selectGen3AppById: (appId: string) => React.ReactNode;
@@ -0,0 +1,3 @@
1
+ import { createGen3App, getGen3AppId } from './Gen3App';
2
+ import { selectGen3AppMetadataById, selectGen3AppById } from './gen3AppsSlice';
3
+ export { createGen3App, selectGen3AppMetadataById, selectGen3AppById, getGen3AppId, };
@@ -0,0 +1,12 @@
1
+ import { JSONObject } from '../../types';
2
+ export declare const graphQLWithTags: import("@reduxjs/toolkit/dist/query").Api<import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, import("@reduxjs/toolkit/dist/query/endpointDefinitions").UpdateDefinitions<{}, "graphQL", never>, "gen3Services", "graphQL", keyof import("@reduxjs/toolkit/dist/query").ApiModules<any, any, any, any>>;
3
+ /**
4
+ * Creates a graphQLAPI for graphql queries to elasticsearch indices via guppy
5
+ * @see https://github.com/uc-cdis/guppy/blob/master/doc/queries.md
6
+ * @param query - Resolver function which configures the graphql query with graphQLParams argument
7
+ * @returns: A guppy search API for fetching metadata
8
+ */
9
+ export declare const graphQLAPI: import("@reduxjs/toolkit/dist/query").Api<import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, import("@reduxjs/toolkit/dist/query/endpointDefinitions").UpdateDefinitions<{}, "graphQL", never> & {
10
+ graphQL: import("@reduxjs/toolkit/dist/query").QueryDefinition<JSONObject, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, "graphQL", JSONObject, "gen3Services">;
11
+ }, "gen3Services", "graphQL", keyof import("@reduxjs/toolkit/dist/query").ApiModules<any, any, any, any>>;
12
+ export declare const useGraphQLQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<JSONObject, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, "graphQL", JSONObject, "gen3Services">>;
@@ -0,0 +1 @@
1
+ export * from './graphQLSlice';
@@ -0,0 +1,23 @@
1
+ import { JSONArray, JSONObject } from '../../types';
2
+ import { FILE_DELIMITERS } from '../../constants';
3
+ import { UnparseConfig } from 'papaparse';
4
+ /**
5
+ * Flattens a deep nested JSON object skipping
6
+ * the first level to avoid potentially flattening
7
+ * non-nested data.
8
+ * @param {JSON} json
9
+ */
10
+ export declare function flattenJson(json: JSONObject): JSONArray;
11
+ /**
12
+ * Converts JSON based on a config.
13
+ * @param {JSON} json
14
+ * @param {Object} config
15
+ */
16
+ export declare function conversion(json: JSONArray, config: UnparseConfig): Promise<string>;
17
+ /**
18
+ * Converts JSON to a specified file format.
19
+ * Defaults to JSON if file format is not supported.
20
+ * @param {JSON} json
21
+ * @param {string} format
22
+ */
23
+ export declare function jsonToFormat(json: JSONObject, format: keyof typeof FILE_DELIMITERS): Promise<string | JSONObject>;
@@ -0,0 +1,41 @@
1
+ import type { Middleware, Reducer } from '@reduxjs/toolkit';
2
+ import { JSONObject } from '../../types';
3
+ export interface guppyFetchError {
4
+ readonly url: string;
5
+ readonly status: number;
6
+ readonly statusText: string;
7
+ readonly text: string;
8
+ readonly variables?: Record<string, any>;
9
+ }
10
+ export interface guppyApiSliceRequest {
11
+ readonly query: string;
12
+ readonly variables?: Record<string, unknown>;
13
+ }
14
+ export interface guppyApiResponse<H = JSONObject> {
15
+ readonly data: H;
16
+ readonly errors: Record<string, string>;
17
+ }
18
+ export interface SortOption {
19
+ field: string;
20
+ order: string;
21
+ }
22
+ export interface TablePageOffsetProps {
23
+ readonly pageSize?: number;
24
+ readonly offset?: number;
25
+ readonly sorts?: Array<SortOption>;
26
+ readonly searchTerm?: string;
27
+ }
28
+ /**
29
+ * Creates a base class core API for guppy API calls.
30
+ * @returns: guppy core API with guppyAPIFetch base query
31
+ */
32
+ export declare const guppyApi: import("@reduxjs/toolkit/dist/query").Api<(query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
33
+ data: any;
34
+ error?: undefined;
35
+ } | {
36
+ error: unknown;
37
+ data?: undefined;
38
+ }>, {}, "guppy", never, keyof import("@reduxjs/toolkit/dist/query").ApiModules<any, any, any, any>>;
39
+ export declare const guppyAPISliceMiddleware: Middleware;
40
+ export declare const guppyApiSliceReducerPath: string;
41
+ export declare const guppyApiReducer: Reducer;
@@ -0,0 +1,21 @@
1
+ import { GQLFilter } from '../filters';
2
+ import { BaseGuppyDataRequest, GuppyDownloadDataParams } from './types';
3
+ export interface GuppyDownloadDataQueryParams extends BaseGuppyDataRequest {
4
+ filter: GQLFilter;
5
+ }
6
+ interface DownloadRequestStatus {
7
+ readonly status: string;
8
+ readonly message: string;
9
+ }
10
+ /**
11
+ * Creates a Guppy API for fetching bulk (> 10K rows) elasticsearch data
12
+ * @see https://github.com/uc-cdis/guppy/blob/master/doc/download.md
13
+ * @param endpoints - Resolver function which configures the query with
14
+ * type, filter, accessibility, fields, and sort arguments
15
+ * @returns: A guppy download API for fetching bulk metadata
16
+ */
17
+ export declare const downloadRequestApi: import("@reduxjs/toolkit/dist/query").Api<import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, {
18
+ downloadFromGuppy: import("@reduxjs/toolkit/dist/query").MutationDefinition<GuppyDownloadDataParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, DownloadRequestStatus, "gen3Services">;
19
+ }, "gen3Services", never, keyof import("@reduxjs/toolkit/dist/query").ApiModules<any, any, any, any>>;
20
+ export declare const useDownloadFromGuppyMutation: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseMutation<import("@reduxjs/toolkit/dist/query").MutationDefinition<GuppyDownloadDataParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, DownloadRequestStatus, "gen3Services">>;
21
+ export {};
@@ -0,0 +1,120 @@
1
+ import { SWRResponse, Fetcher } from 'swr';
2
+ import { AggregationsData, JSONObject } from '../../types';
3
+ import { Accessibility } from '../../constants';
4
+ import { FilterSet } from '../filters';
5
+ import { guppyApiSliceRequest } from './guppyApi';
6
+ import { CoreState } from '../../reducers';
7
+ export interface GraphQLQuery {
8
+ query: string;
9
+ variables?: Record<string, unknown>;
10
+ }
11
+ export declare const fetchJson: Fetcher<JSONObject, string>;
12
+ export declare const useGetStatus: () => SWRResponse<JSONObject, Error>;
13
+ export type AggregationResponse = Record<string, JSONObject>;
14
+ export interface RawDataAndTotalCountsParams {
15
+ type: string;
16
+ fields: string[];
17
+ filters: FilterSet;
18
+ sort?: ReadonlyArray<Record<string, 'asc' | 'desc'>>;
19
+ offset?: number;
20
+ size?: number;
21
+ accessibility?: Accessibility;
22
+ format?: string;
23
+ }
24
+ interface AccessibleDataSliceParams {
25
+ type: string;
26
+ fields: ReadonlyArray<string>;
27
+ accessType: Accessibility;
28
+ }
29
+ interface QueryAggsParams {
30
+ type: string;
31
+ fields: ReadonlyArray<string>;
32
+ filters: FilterSet;
33
+ accessibility?: Accessibility;
34
+ }
35
+ interface QueryForSubAggsParams {
36
+ type: string;
37
+ mainField: string;
38
+ numericAggAsText: boolean;
39
+ termsFields?: ReadonlyArray<string>;
40
+ missingFields?: ReadonlyArray<string>;
41
+ gqlFilter?: FilterSet;
42
+ accessibility?: Accessibility;
43
+ }
44
+ interface QueryCountsParams {
45
+ type: string;
46
+ filters: FilterSet;
47
+ accessibility?: Accessibility;
48
+ }
49
+ interface QueryForFileCountSummaryParams {
50
+ type: string;
51
+ field: string;
52
+ filters: FilterSet;
53
+ }
54
+ export declare const rawDataQueryStrForEachField: (field: string) => string;
55
+ export declare const useGetArrayTypes: () => import("../../types").JSONValue;
56
+ export declare const useGetRawDataAndTotalCountsQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<RawDataAndTotalCountsParams, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
57
+ data: any;
58
+ error?: undefined;
59
+ } | {
60
+ error: unknown;
61
+ data?: undefined;
62
+ }>, never, any, "guppy">>, useGetAccessibleDataQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<AccessibleDataSliceParams, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
63
+ data: any;
64
+ error?: undefined;
65
+ } | {
66
+ error: unknown;
67
+ data?: undefined;
68
+ }>, never, any, "guppy">>, useGetAllFieldsForTypeQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<{
69
+ type: string;
70
+ }, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
71
+ data: any;
72
+ error?: undefined;
73
+ } | {
74
+ error: unknown;
75
+ data?: undefined;
76
+ }>, never, any, "guppy">>, useGetAggsQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<QueryAggsParams, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
77
+ data: any;
78
+ error?: undefined;
79
+ } | {
80
+ error: unknown;
81
+ data?: undefined;
82
+ }>, never, AggregationsData, "guppy">>, useGetSubAggsQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<QueryForSubAggsParams, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
83
+ data: any;
84
+ error?: undefined;
85
+ } | {
86
+ error: unknown;
87
+ data?: undefined;
88
+ }>, never, AggregationsData, "guppy">>, useGetCountsQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<QueryCountsParams, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
89
+ data: any;
90
+ error?: undefined;
91
+ } | {
92
+ error: unknown;
93
+ data?: undefined;
94
+ }>, never, number, "guppy">>, useGetFieldCountSummaryQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<QueryForFileCountSummaryParams, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
95
+ data: any;
96
+ error?: undefined;
97
+ } | {
98
+ error: unknown;
99
+ data?: undefined;
100
+ }>, never, Record<string, any>, "guppy">>, useGetFieldsForIndexQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<string, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
101
+ data: any;
102
+ error?: undefined;
103
+ } | {
104
+ error: unknown;
105
+ data?: undefined;
106
+ }>, never, any, "guppy">>, useGeneralGQLQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<guppyApiSliceRequest, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
107
+ data: any;
108
+ error?: undefined;
109
+ } | {
110
+ error: unknown;
111
+ data?: undefined;
112
+ }>, never, Record<string, unknown>, "guppy">>, useLazyGeneralGQLQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseLazyQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<guppyApiSliceRequest, (query: guppyApiSliceRequest, api: import("@reduxjs/toolkit/dist/query").BaseQueryApi) => Promise<{
113
+ data: any;
114
+ error?: undefined;
115
+ } | {
116
+ error: unknown;
117
+ data?: undefined;
118
+ }>, never, Record<string, unknown>, "guppy">>;
119
+ export declare const selectAggDataForIndex: (state: CoreState, index: string, field: string) => any;
120
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from './guppyApi';
2
+ export * from './guppySlice';
3
+ import { downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useGetIndexFields } from './utils';
4
+ import { useDownloadFromGuppyMutation } from './guppyDownloadSlice';
5
+ export * from './types';
6
+ export { downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useDownloadFromGuppyMutation, useGetIndexFields, };
@@ -0,0 +1,33 @@
1
+ import { FilterSet } from '../filters';
2
+ import { Accessibility } from '../../constants';
3
+ export interface BaseGuppyDataRequest {
4
+ type: string;
5
+ accessibility?: Accessibility;
6
+ fields: string[];
7
+ sort?: string[];
8
+ }
9
+ export interface GuppyDownloadDataParams extends BaseGuppyDataRequest {
10
+ filter: FilterSet;
11
+ format: 'json' | 'csv' | 'tsv';
12
+ rootPath?: string;
13
+ }
14
+ export interface GuppyActionFunctionParams extends Record<string, any> {
15
+ type: string;
16
+ accessibility?: Accessibility;
17
+ fields: string[];
18
+ sort?: string[];
19
+ filter: FilterSet;
20
+ }
21
+ export interface GuppyActionParams<T extends Record<string, any>> {
22
+ parameters: T;
23
+ onStart?: () => void;
24
+ onDone?: (blob: Blob) => void;
25
+ onError?: (error: Error) => void;
26
+ onAbort?: () => void;
27
+ signal?: AbortSignal;
28
+ }
29
+ export interface GuppyDownloadActionFunctionParams extends GuppyDownloadDataParams {
30
+ filename: string;
31
+ }
32
+ export type GuppyActionFunction<T extends Record<string, any>> = (args: GuppyActionParams<T>) => void;
33
+ export type DownloadFromGuppyParams = GuppyActionParams<GuppyDownloadDataParams>;
@@ -0,0 +1,28 @@
1
+ import { DownloadFromGuppyParams } from './types';
2
+ /**
3
+ * Represents a configuration for making a fetch request.
4
+ *
5
+ * @typedef {Object} FetchConfig
6
+ * @property {string} method - The HTTP method to use for the request.
7
+ * @property {Object<string, string>} headers - The headers to include in the request.
8
+ * @property {string} body - The request body.
9
+ */
10
+ export type FetchConfig = {
11
+ method: string;
12
+ headers: Record<string, string>;
13
+ body: string;
14
+ };
15
+ /**
16
+ * Downloads a file from Guppy using the provided parameters.
17
+ * It will optionally convert the data to the specified format.
18
+ *
19
+ * @param {DownloadFromGuppyParams} parameters - The parameters to use for the download request.
20
+ * @param onStart - The function to call when the download starts.
21
+ * @param onDone - The function to call when the download is done.
22
+ * @param onError - The function to call when the download fails.
23
+ * @param onAbort - The function to call when the download is aborted.
24
+ * @param signal - AbortSignal to use for the request.
25
+ */
26
+ export declare const downloadFromGuppyToBlob: ({ parameters, onStart, onDone, onError, onAbort, signal, }: DownloadFromGuppyParams) => Promise<void>;
27
+ export declare const downloadJSONDataFromGuppy: ({ parameters, onAbort, signal, }: DownloadFromGuppyParams) => Promise<any>;
28
+ export declare const useGetIndexFields: (index: string) => any;
@@ -0,0 +1,3 @@
1
+ import { useGetAggMDSQuery, useGetMDSQuery, useGetTagsQuery, useGetDataQuery, useGetCrosswalkDataQuery, useLazyGetCrosswalkDataQuery, useGetIndexAggMDSQuery, type MetadataPaginationParams, type MetadataRequestParams, type MetadataResponse } from './metadataSlice';
2
+ import { type CrosswalkEntry, type CrosswalkInfo, type IndexedMetadataFilters } from './types';
3
+ export { type MetadataPaginationParams, type MetadataRequestParams, type MetadataResponse, type CrosswalkEntry, type CrosswalkInfo, type IndexedMetadataFilters, useGetAggMDSQuery, useGetMDSQuery, useGetTagsQuery, useGetDataQuery, useGetCrosswalkDataQuery, useLazyGetCrosswalkDataQuery, useGetIndexAggMDSQuery, };
@@ -0,0 +1,56 @@
1
+ import { JSONObject } from '../../types';
2
+ import { CrosswalkInfo, IndexedMetadataFilters } from './types';
3
+ export interface Metadata {
4
+ readonly entries: Array<Record<string, unknown>>;
5
+ }
6
+ export type CrosswalkArray = Array<CrosswalkInfo>;
7
+ interface ToMapping {
8
+ id: string;
9
+ dataPath: string[];
10
+ }
11
+ interface CrossWalkParams {
12
+ readonly ids: string[];
13
+ readonly toPaths: Array<ToMapping>;
14
+ }
15
+ export interface MetadataResponse {
16
+ data: Array<JSONObject>;
17
+ hits: number;
18
+ }
19
+ export interface MetadataPaginationParams {
20
+ pageSize: number;
21
+ offset: number;
22
+ }
23
+ export interface MetadataRequestParams extends MetadataPaginationParams {
24
+ guidType: string;
25
+ studyField: string;
26
+ }
27
+ interface IndexedMetadataRequestParams extends MetadataRequestParams {
28
+ indexKeys: Array<string>;
29
+ filterEmpty?: IndexedMetadataFilters;
30
+ }
31
+ /**
32
+ * Defines metadataApi service using a base URL and expected endpoints. Derived from gen3Api core API.
33
+ *
34
+ * @param endpoints - Defines endpoints used in discovery page
35
+ * @param getAggMDS - Queries aggregate metadata service
36
+ * @see https://github.com/uc-cdis/metadata-service/blob/master/docs/agg_mds.md
37
+ * @see https://petstore.swagger.io/?url=https://raw.githubusercontent.com/uc-cdis/metadata-service/master/docs/openapi.yaml#/Aggregate/get_aggregate_metadata_aggregate_metadata_get
38
+ * @param getMDS - Queries normal metadata service
39
+ * @see https://petstore.swagger.io/?url=https://raw.githubusercontent.com/uc-cdis/metadata-service/master/docs/openapi.yaml#/Query/search_metadata_metadata_get
40
+ * @param getIndexAggMDS - queries the Aggregate Metadata service and returns all common passed in indexKeys
41
+ * @param getTags - Probably refering to Aggregate metadata service summary statistics query
42
+ * @see https://petstore.swagger.io/?url=https://raw.githubusercontent.com/uc-cdis/metadata-service/master/docs/openapi.yaml#/Aggregate/get_aggregate_tags_aggregate_tags_get
43
+ * @param getData - Looks like a duplicate of getMDS handler. unused in ./frontend package
44
+ * @param getCrosswalkData - Maps ids from one source to another
45
+ * @returns: A guppy download API for fetching bulk metadata
46
+ */
47
+ export declare const metadataApi: import("@reduxjs/toolkit/dist/query").Api<import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, {
48
+ getAggMDS: import("@reduxjs/toolkit/dist/query").QueryDefinition<MetadataRequestParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, MetadataResponse, "gen3Services">;
49
+ getIndexAggMDS: import("@reduxjs/toolkit/dist/query").QueryDefinition<IndexedMetadataRequestParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, MetadataResponse, "gen3Services">;
50
+ getMDS: import("@reduxjs/toolkit/dist/query").QueryDefinition<MetadataRequestParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, MetadataResponse, "gen3Services">;
51
+ getTags: import("@reduxjs/toolkit/dist/query").QueryDefinition<string, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, Metadata, "gen3Services">;
52
+ getData: import("@reduxjs/toolkit/dist/query").QueryDefinition<string, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, Metadata, "gen3Services">;
53
+ getCrosswalkData: import("@reduxjs/toolkit/dist/query").QueryDefinition<CrossWalkParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, CrosswalkArray, "gen3Services">;
54
+ }, "gen3Services", never, keyof import("@reduxjs/toolkit/dist/query").ApiModules<any, any, any, any>>;
55
+ export declare const useGetAggMDSQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<MetadataRequestParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, MetadataResponse, "gen3Services">>, useGetMDSQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<MetadataRequestParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, MetadataResponse, "gen3Services">>, useGetTagsQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<string, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, Metadata, "gen3Services">>, useGetDataQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<string, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, Metadata, "gen3Services">>, useGetCrosswalkDataQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<CrossWalkParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, CrosswalkArray, "gen3Services">>, useLazyGetCrosswalkDataQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseLazyQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<CrossWalkParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, CrosswalkArray, "gen3Services">>, useGetIndexAggMDSQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/dist/query").QueryDefinition<IndexedMetadataRequestParams, import("@reduxjs/toolkit/dist/query").BaseQueryFn<string | import("@reduxjs/toolkit/dist/query").FetchArgs, unknown, import("@reduxjs/toolkit/dist/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/dist/query").FetchBaseQueryMeta>, never, MetadataResponse, "gen3Services">>;
56
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface CrosswalkEntry {
2
+ fromId: string;
3
+ matches: Record<string, string | undefined>;
4
+ }
5
+ export interface IndexedMetadataFilters {
6
+ limit: number;
7
+ keys: string[];
8
+ }
9
+ export interface CrosswalkInfo {
10
+ readonly from: string;
11
+ readonly to: Record<string, string>;
12
+ }
@@ -0,0 +1,2 @@
1
+ import { Modals, showModal, hideModal, selectCurrentModal, selectCurrentMessage } from './modalsSlice';
2
+ export { Modals, showModal, hideModal, selectCurrentModal, selectCurrentMessage, };