|
@@ -0,0 +1,101 @@
|
|
|
+import { ComponentType } from 'react';
|
|
|
+import { GetUserRolesFunc } from '../router';
|
|
|
+import { Pub } from '../pub';
|
|
|
+
|
|
|
+type QueryRoute = {
|
|
|
+ path? : string,
|
|
|
+ args: any[]|Function,
|
|
|
+ component? : ComponentType,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ query: QueryFuncType,
|
|
|
+ cacheTimeout?: number,
|
|
|
+ hidePendingOnRefresh?: boolean
|
|
|
+ avoidRepeatInProgress?: boolean,
|
|
|
+ forceRefreshAfterTimeout?: boolean,
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+ Pending?: ComponentType,
|
|
|
+ Error?: ComponentType,
|
|
|
+
|
|
|
+ errorQueryComponentErrorProp?: string,
|
|
|
+ componentQueryResultProp? : string,
|
|
|
+}
|
|
|
+
|
|
|
+type QueryRoutes = {
|
|
|
+ [name: string]: QueryRoute
|
|
|
+}
|
|
|
+
|
|
|
+type CreateQueryRoutesOptions = {
|
|
|
+
|
|
|
+ query: QueryFuncType,
|
|
|
+ cacheTimeout?: number,
|
|
|
+ hidePendingOnRefresh?: boolean
|
|
|
+ avoidRepeatInProgress?: boolean,
|
|
|
+ forceRefreshAfterTimeout?: boolean,
|
|
|
+
|
|
|
+
|
|
|
+ Pending?: ComponentType,
|
|
|
+ Error?: ComponentType,
|
|
|
+ errorQueryComponentErrorProp?: string,
|
|
|
+ componentQueryResultProp? : string,
|
|
|
+
|
|
|
+
|
|
|
+ getUserRoles: GetUserRolesFunc,
|
|
|
+ fallback: string|Function
|
|
|
+ routeRoles: string[]
|
|
|
+
|
|
|
+ queryRoutes: QueryRoutes
|
|
|
+}
|
|
|
+
|
|
|
+type QueryRoutesResult = {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Route: ComponentType,
|
|
|
+
|
|
|
+ [name: string]: ComponentType,
|
|
|
+
|
|
|
+ Link: ComponentType,
|
|
|
+
|
|
|
+ [name: string]: ComponentType,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ makeQuery: Function,
|
|
|
+ query: Function,
|
|
|
+ forceQuery: Function,
|
|
|
+ Hook: ComponentType,
|
|
|
+
|
|
|
+
|
|
|
+ [name: string]: ComponentType,
|
|
|
+}
|
|
|
+
|
|
|
+type QueryRoutesResults = {
|
|
|
+ [name: string]: QueryRoutesResult
|
|
|
+}
|
|
|
+
|
|
|
+type CreateQueryRoutesResult = {
|
|
|
+
|
|
|
+
|
|
|
+ NamedRoute: ComponentType,
|
|
|
+ PrivateRoute: ComponentType,
|
|
|
+ NamedLink ; ComponentType,
|
|
|
+
|
|
|
+
|
|
|
+ AllRoutes: ComponentType,
|
|
|
+
|
|
|
+
|
|
|
+ queryPub: Pub,
|
|
|
+ withQueryFunc: Function,
|
|
|
+ createQuery: Function,
|
|
|
+
|
|
|
+ queryRoutes: QueryRoutesResults
|
|
|
+}
|
|
|
+
|
|
|
+export const createQueryRoutes = (options) => {
|
|
|
+
|
|
|
+}
|