Skip to content

Commit

Permalink
Update dependencies (#131)
Browse files Browse the repository at this point in the history
Signed-off-by: Nik Nasr <[email protected]>
  • Loading branch information
nikrooz authored Dec 28, 2024
1 parent 51c186b commit ad0bef7
Show file tree
Hide file tree
Showing 14 changed files with 2,517 additions and 2,504 deletions.
41 changes: 0 additions & 41 deletions .eslintrc.json

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ Thumbs.db
.nx
**/playwright/.auth
test-results

vite.config.*.timestamp*
vitest.config.*.timestamp*
6 changes: 5 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ module.exports = [
...nx.configs['flat/typescript'],
...nx.configs['flat/javascript'],
{
ignores: ['**/dist'],
ignores: [
'**/dist',
'vite.config.*.timestamp*',
'vitest.config.*.timestamp*',
],
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
Expand Down
47 changes: 30 additions & 17 deletions libs/data-access/admin-api/src/lib/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import createClient from 'openapi-fetch';

const client = createClient<paths>({});
const errorMiddleware: Middleware = {
async onResponse({ response }) {
async onResponse({ response, request }) {
if (!response.ok) {
if (response.status === 401) {
// TODO: change import
Expand All @@ -28,6 +28,12 @@ const errorMiddleware: Middleware = {
}
throw new Error(body);
}
if (response.ok && request.url.endsWith('health')) {
return new Response(JSON.stringify({}), {
...response,
headers: { ...response.headers, 'content-type': 'application/json' },
});
}
return response;
},
};
Expand All @@ -49,6 +55,7 @@ export type SupportedMethods<Path extends keyof paths> = keyof {
};
}
| never;
responses: Record<number, any>;
}>
? PossibleMethod
: never]: paths[Path];
Expand Down Expand Up @@ -84,10 +91,14 @@ export type OperationBody<
export type QueryOptions<
Path extends keyof paths,
Method extends SupportedMethods<Path>
> = UseQueryOptions<
FetchResponse<paths[Path][Method], {}, 'application/json'>['data'],
RestateError | Error
>;
> = paths[Path][Method] extends {
responses: Record<number, any>;
}
? UseQueryOptions<
FetchResponse<paths[Path][Method], {}, 'application/json'>['data'],
RestateError | Error
>
: never;

type QueryFn<
Path extends keyof paths,
Expand All @@ -104,14 +115,16 @@ export type MutationOptions<
Method extends SupportedMethods<Path>,
Parameters extends OperationParameters<Path, Method>,
Body extends OperationBody<Path, Method>
> = UseMutationOptions<
FetchResponse<paths[Path][Method], {}, 'application/json'>['data'],
RestateError | Error,
{
parameters?: Parameters;
body?: Body;
}
>;
> = paths[Path][Method] extends { responses: Record<number, any> }
? UseMutationOptions<
FetchResponse<paths[Path][Method], {}, 'application/json'>['data'],
RestateError | Error,
{
parameters?: Parameters;
body?: Body;
}
>
: never;

type MutationFn<
Path extends keyof paths,
Expand Down Expand Up @@ -203,7 +216,7 @@ export function adminApi<
return {
queryKey: key,
meta: { path, method, isAdmin: true },
queryFn: async ({ signal }: { signal: AbortSignal }) => {
queryFn: (async ({ signal }: { signal: AbortSignal }) => {
const { data } = await (client as any)[String(method).toUpperCase()](
path,
{
Expand All @@ -218,14 +231,14 @@ export function adminApi<
}
);
return data;
},
}) as any,
refetchOnMount: true,
};
} else {
return {
mutationKey: key,
meta: { path, method, isAdmin: true },
mutationFn: async (variables: {
mutationFn: (async (variables: {
parameters?: Parameters;
body?: Body;
}) => {
Expand All @@ -238,7 +251,7 @@ export function adminApi<
}
);
return data;
},
}) as any,
};
}
}
4 changes: 2 additions & 2 deletions libs/data-access/admin-api/src/lib/api/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ export function useListDeployments(

export function useHealth(options?: HookQueryOptions<'/health', 'get'>) {
const baseUrl = useAdminBaseUrl();

const queryOptions = adminApi('query', '/health', 'get', { baseUrl });
return useQuery({
...adminApi('query', '/health', 'get', { baseUrl }),
...queryOptions,
...options,
});
}
Expand Down
12 changes: 0 additions & 12 deletions libs/util/errors/.babelrc

This file was deleted.

27 changes: 1 addition & 26 deletions libs/util/errors/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const baseConfig = require('../../../eslint.config.js');

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});

module.exports = [
...baseConfig,
...compat.extends('plugin:@nx/react'),
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.ts', '**/*.tsx'],
// Override or add rules here
rules: {},
},
{
files: ['**/*.js', '**/*.jsx'],
// Override or add rules here
rules: {},
},
];
module.exports = [...baseConfig];
File renamed without changes.
14 changes: 7 additions & 7 deletions libs/util/errors/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true
"module": "commonjs",
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true
},
"files": [],
"include": [],
Expand All @@ -15,6 +16,5 @@
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../../tsconfig.base.json"
]
}
30 changes: 14 additions & 16 deletions libs/util/errors/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"types": [
"node",

"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts"
]
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": [
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx"
],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
"vite.config.ts",
"vitest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx"
]
}
6 changes: 3 additions & 3 deletions libs/util/errors/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../../../node_modules/.vite/libs/util/errors',

plugins: [react(), nxViteTsPaths()],
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],

// Uncomment this if you are using workers.
// worker: {
Expand All @@ -16,7 +16,7 @@ export default defineConfig({
test: {
watch: false,
globals: true,
environment: 'jsdom',
environment: 'node',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
Expand Down
14 changes: 0 additions & 14 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@
"options": {
"targetName": "e2e"
}
},
{
"plugin": "@nx/remix/plugin",
"options": {
"buildTargetName": "build",
"devTargetName": "dev",
"startTargetName": "start",
"typecheckTargetName": "typecheck"
}
}
],
"generators": {
Expand All @@ -70,11 +61,6 @@
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"@nx/remix:build": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
}
}
}
Loading

0 comments on commit ad0bef7

Please sign in to comment.