Skip to content

Commit

Permalink
remove type files, still needed explict types for build
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolls1 committed Feb 20, 2024
1 parent 54f3919 commit c3b67b3
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 326 deletions.
2 changes: 1 addition & 1 deletion example/storybook/helpers/DataProviderDecorator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const DataOverrideProvider: React.FC<DataOverrideProviderProps> = ({
builder,
children,
}) => {
const axiosInstance = axios.create();
const axiosInstance = axios.create() as any;
const mock = new MockAdapter(axiosInstance);

if (builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { HttpClientContextProvider } from '../../../../../src/hooks/useHttpClien
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { DeveloperConfigProvider } from '../../../../../src/components/DeveloperConfigProvider';

const axiosInstance = axios.create();
const axiosInstance = axios.create() as any;
const mock = new MockAdapter(axiosInstance);

export const MockEnvironmentDecorator = ({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"dependencies": {
"@lifeomic/chromicons-native": "^2.16.1",
"@lifeomic/one-query": "^3.3.0",
"@lifeomic/react-client": "^1.3.0",
"@lifeomic/react-client": "^1.3.2",
"@types/fhir": "^0.0.36",
"color": "^4.2.3",
"d3-scale": "3.2.1",
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/apps-api.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { setupServer } from 'msw/node';
import { renderHook } from '@testing-library/react-native';
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
import { useAppsAPIMutation } from './apps-api';
import { AppsAPIEndpoints } from '../types/apps-rest-types';
import { AuthAPIEndpoints } from '@lifeomic/react-client';

const server = setupServer();
server.listen({ onUnhandledRequest: 'error' });

const adoptAppsAPIMocking = createAPIMockingUtility<AppsAPIEndpoints>({
const adoptAppsAPIMocking = createAPIMockingUtility<AuthAPIEndpoints>({
server,
baseUrl: 'https://apps.us.lifeomic.com',
});
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/apps-api.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createAPIHooks } from '@lifeomic/one-query';
import axios from 'axios';

import { AppsAPIEndpoints } from '../types/apps-rest-types';
import { AuthAPIEndpoints } from '@lifeomic/react-client';
import { useDeveloperConfig } from './useDeveloperConfig';

export const defaultBaseURL = 'https://apps.us.lifeomic.com';

const hooks = createAPIHooks<AppsAPIEndpoints>({
const hooks = createAPIHooks<AuthAPIEndpoints>({
name: 'lifeomic-apps-react-native-sdk',
client: () => {
// hook will be used according to rules of hooks
Expand Down
18 changes: 11 additions & 7 deletions src/hooks/rest-api.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import {
createRestAPIHooks,
RestAPIEndpoints as ClientRestAPIEndpoints,
} from '@lifeomic/react-client';
import { createRestAPIHooks, RestAPIEndpoints } from '@lifeomic/react-client';
import { useHttpClient } from './useHttpClient';
import { RestAPIEndpoints } from '../types/rest-types';
import { AppConfig } from './useAppConfig';
import { APIQueryHooks, RequestPayloadOf } from '@lifeomic/one-query';
import {
UseQueryOptions,
UseQueryResult,
} from '@tanstack/react-query/build/lib/types';
import { AxiosRequestConfig } from 'axios';

export type Endpoints = RestAPIEndpoints & ClientRestAPIEndpoints;
export type Overrides = {
'GET /v1/life-research/projects/:projectId/app-config': {
Request: {};
Response: AppConfig;
};
};

declare type RestrictedUseQueryOptions<
Response,
Expand All @@ -21,7 +23,9 @@ declare type RestrictedUseQueryOptions<
axios?: AxiosRequestConfig;
};

const hooks: APIQueryHooks<Endpoints> = createRestAPIHooks<Endpoints>({
export type Endpoints = RestAPIEndpoints & Overrides;

const hooks: APIQueryHooks<Endpoints> = createRestAPIHooks<Overrides>({
name: 'lifeomic-react-native-sdk',
client: () => {
// This function is explicitly documented as being hooks-compatible.
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useConsent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useRestCache,
Endpoints,
} from './rest-api';
import { RestAPIEndpoints } from '../types/rest-types';
import { RestAPIEndpoints } from '@lifeomic/react-client';
import { RequestPayloadOf } from '@lifeomic/one-query';
import {
UseMutationResult,
Expand Down
11 changes: 7 additions & 4 deletions src/test-utils/rest-api-mocking.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { createAPIMocker } from '@lifeomic/one-query/test-utils';
import { RestAPIEndpoints } from '../types/rest-types';
import { APIMocker, createAPIMocker } from '@lifeomic/one-query/test-utils';
import { RestAPIEndpoints } from '@lifeomic/react-client';
import { SetupServerApi, setupServer } from 'msw/node';
import { Overrides } from 'src/hooks/rest-api';

Check failure on line 4 in src/test-utils/rest-api-mocking.ts

View workflow job for this annotation

GitHub Actions / main

'src/hooks/rest-api' import is restricted from being used by a pattern

const server = setupServer();
server.listen({ onUnhandledRequest: 'error' });

export const createRestAPIMock = () =>
createAPIMocker<RestAPIEndpoints>(
export const createRestAPIMock: () => APIMocker<
RestAPIEndpoints & Overrides
> = () =>
createAPIMocker<RestAPIEndpoints & Overrides>(
server as SetupServerApi,
'https://api.us.lifeomic.com',
);
50 changes: 0 additions & 50 deletions src/types/apps-rest-types.ts

This file was deleted.

106 changes: 0 additions & 106 deletions src/types/fhir-api-types.ts

This file was deleted.

Loading

0 comments on commit c3b67b3

Please sign in to comment.