Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): lock file maintenance #8229

Merged
merged 5 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions design-system/packages/button/src/hooks/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export const buttonToneValues = [
] as const;
export const buttonWeightValues = ['bold', 'light', 'none', 'link'] as const;

export type SizeKey = typeof buttonSizeValues[number];
export type ToneKey = typeof buttonToneValues[number];
export type WeightKey = typeof buttonWeightValues[number];
export type SizeKey = (typeof buttonSizeValues)[number];
export type ToneKey = (typeof buttonToneValues)[number];
export type WeightKey = (typeof buttonWeightValues)[number];

export type ButtonPropDefaults = {
size: SizeKey;
Expand Down
2 changes: 1 addition & 1 deletion design-system/packages/core/src/components/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTheme } from '../theme';
import { Box, BoxProps } from './Box';

export const HeadingTypes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;
type HeadingType = typeof HeadingTypes[number];
type HeadingType = (typeof HeadingTypes)[number];

type HeadingProps = {
/** The type of heading. */
Expand Down
4 changes: 2 additions & 2 deletions design-system/packages/loading/src/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const loadingToneValues = [
'help',
] as const;

export type SizeKey = typeof loadingSizeValues[number];
export type ToneKey = typeof loadingToneValues[number];
export type SizeKey = (typeof loadingSizeValues)[number];
export type ToneKey = (typeof loadingToneValues)[number];

// NOTE: a more accurate implementation might use `aria-busy="true|false"` on
// the wrapping element, but it's difficult to abstract
Expand Down
2 changes: 1 addition & 1 deletion design-system/packages/notice/src/hooks/notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const noticeToneValues = [
'help',
] as const;

export type ToneKey = typeof noticeToneValues[number];
export type ToneKey = (typeof noticeToneValues)[number];

type NoticeTokensProps = {
tone: ToneKey;
Expand Down
4 changes: 2 additions & 2 deletions design-system/packages/options/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const CheckMark = ({
);
};

export const OptionPrimitive: typeof reactSelectComponents['Option'] = ({
export const OptionPrimitive: (typeof reactSelectComponents)['Option'] = ({
children,
isDisabled,
isFocused,
Expand Down Expand Up @@ -120,7 +120,7 @@ export const OptionPrimitive: typeof reactSelectComponents['Option'] = ({
);
};

const Control: typeof reactSelectComponents['Control'] = ({ selectProps, ...props }) => {
const Control: (typeof reactSelectComponents)['Control'] = ({ selectProps, ...props }) => {
return <reactSelectComponents.Control selectProps={selectProps} {...props} />;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const widthMap = {
full: '100%',
};

export type SizeKey = typeof segmentedControlSizeValues[number];
export type SizeKey = (typeof segmentedControlSizeValues)[number];
export type WidthKey = 'small' | 'medium' | 'large' | 'full';

export type ControlTokensProps = {
Expand Down
4 changes: 2 additions & 2 deletions docs/components/docs/DocumentEditorDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const documentFeaturesProp = fields.object({

type DocumentFeaturesFormValue = Parameters<
InferRenderersForComponentBlocks<
Record<'documentFeatures', ComponentBlock<typeof documentFeaturesProp['fields']>>
Record<'documentFeatures', ComponentBlock<(typeof documentFeaturesProp)['fields']>>
>['documentFeatures']
>[0];

Expand Down Expand Up @@ -171,7 +171,7 @@ function objToShorthand<
Obj extends Record<string, undefined | true | readonly any[] | Record<string, any>>
>(obj: Obj): Obj | true | undefined {
const values = Object.values(obj);
let state: typeof values[number] = values[0]!;
let state: (typeof values)[number] = values[0]!;
for (const val of values) {
if (val !== state || (val !== undefined && val !== true)) {
return obj;
Expand Down
38 changes: 9 additions & 29 deletions docs/pages/docs/config/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export default config({
port: 3000,
maxFileSize: 200 * 1024 * 1024,
healthCheck: true,
extendExpressApp: (app, commonContext) => { /* ... */ },
extendExpressApp: (app, commonContext) => { /* ... */ },
extendHttpServer: (httpServer, commonContext, graphQLSchema) => { /* ... */ },
},
/* ... */
Expand Down Expand Up @@ -336,14 +336,14 @@ import { useServer as wsUseServer } from 'graphql-ws/lib/use/ws';

export default config({
server: {
extendHttpServer: (httpServer, commonContext, graphqlSchema) => {
const wss = new WebSocketServer({
server: httpServer,
path: '/api/graphql',
});

wsUseServer({ schema: graphqlSchema }, wss);
},
extendHttpServer: (httpServer, commonContext, graphqlSchema) => {
const wss = new WebSocketServer({
server: httpServer,
path: '/api/graphql',
});

wsUseServer({ schema: graphqlSchema }, wss);
},
},
});
```
Expand Down Expand Up @@ -535,26 +535,6 @@ export default config({
});
```

## Experimental Options

The following flags allow you to enable features which are still in preview.
These features are not guaranteed to work, and should be used with caution.

```typescript
import { config } from '@keystone-6/core';

export default config({
experimental: {
generateNextGraphqlAPI: true,
}
/* ... */
});
```

Options:

- `generateNextGraphqlAPI`: Creates a file at `node_modules/.keystone/next/graphql-api` with `default` and `config` exports that can be re-exported in a Next API route

## Related resources

{% related-content %}
Expand Down
30 changes: 15 additions & 15 deletions examples/nextjs-keystone/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ export function Header() {
const passwordRef = useRef<HTMLInputElement | null>(null);

useEffect(() => {
getCurrentLoggedInUser()
.then(data => {
if (data?.authenticatedItem?.id) {
setUser(data.authenticatedItem);
(async function () {
try {
const user = await getCurrentLoggedInUser();
if (user?.authenticatedItem?.id) {
setUser(user.authenticatedItem);
}
})
.finally(() => {
} finally {
setLoading(false);
});
}
})();
}, []);

const login = () => {
const login = async () => {
if (emailRef.current && passwordRef.current) {
const email = emailRef.current.value;
const password = passwordRef.current.value;

authenticateUser({ email, password }).then(data => {
if (data?.authenticateUserWithPassword?.item?.id) {
window.location.reload();
}
});
const user = await authenticateUser({ email, password });
if (user?.authenticateUserWithPassword?.item?.id) {
window.location.reload();
}
}
};

Expand Down Expand Up @@ -67,7 +67,7 @@ export function Header() {
);
}

function authenticateUser({ email, password }: { email: string; password: string }) {
function authenticateUser({ email, password }: { email: string; password: string }): Promise<any> {
const mutation = gql`
mutation authenticate($email: String!, $password: String!) {
authenticateUserWithPassword(email: $email, password: $password) {
Expand Down Expand Up @@ -101,7 +101,7 @@ function endUserSession() {
return client.request(mutation);
}

function getCurrentLoggedInUser() {
function getCurrentLoggedInUser(): Promise<any> {
const query = gql`
query authenticate {
authenticatedItem {
Expand Down
28 changes: 15 additions & 13 deletions examples/nextjs-keystone/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,21 @@ function ClientRenderedContent() {

// Fetch users from REST api route
useEffect(() => {
const query = gql`
{
users {
id
name
email
}
}
`;

client.request(query).then(data => {
setUsers(data.users);
});
client
.request(
gql`
{
users {
id
name
email
}
}
`
)
.then((data: any) => {
setUsers(data.users);
});
}, []);

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/gql/getMagicAuthLinkSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function getMagicAuthLinkSchema<I extends string>({
// TODO: type required by pnpm :(
}): graphql.Extension {
const RedeemItemMagicAuthTokenFailure = graphql.object<{
code: typeof errorCodes[number];
code: (typeof errorCodes)[number];
message: string;
}>()({
name: gqlNames.RedeemItemMagicAuthTokenFailure,
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/gql/getPasswordResetSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function getPasswordResetSchema<I extends string, S extends string>({
// TODO: return type required by pnpm :(
}): graphql.Extension {
const getResult = (name: string) =>
graphql.object<{ code: typeof errorCodes[number]; message: string }>()({
graphql.object<{ code: (typeof errorCodes)[number]; message: string }>()({
name,
fields: {
code: graphql.field({ type: graphql.nonNull(PasswordResetRedemptionErrorCode) }),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { multiselect } from '..';

type MatrixValue = typeof testMatrix[number];
type MatrixValue = (typeof testMatrix)[number];

export const name = 'multiselect';
export const typeFunction = multiselect;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/fields/types/relationship/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const relationship =

const hideCreate = config.ui?.hideCreate ?? false;
const refLabelField: typeof foreignFieldKey = foreignListMeta.labelField;
const refSearchFields: typeof foreignFieldKey[] = foreignListMeta.fields
const refSearchFields: (typeof foreignFieldKey)[] = foreignListMeta.fields
.filter(x => x.search)
.map(x => x.key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function useItemState({
setItems: useCallback(
(items: Items) => {
setItemsState(state => {
let itemsForState: typeof state['items'] = {};
let itemsForState: (typeof state)['items'] = {};
Object.keys(items).forEach(id => {
if (items[id] === state.items[id]?.current) {
itemsForState[id] = state.items[id];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export {
fieldName,
} from '../test-fixtures';

type MatrixValue = typeof testMatrix[number];
type MatrixValue = (typeof testMatrix)[number];

export const name = 'Select with isNullable: false';
export const typeFunction = (config: any) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { select } from '..';

type MatrixValue = typeof testMatrix[number];
type MatrixValue = (typeof testMatrix)[number];

export const name = 'Select';
export const typeFunction = select;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/scripts/tests/migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ async function getGeneratedMigration(
const migrations: {
migration_name: string;
finished_at: string;
}[] = await prismaClient.$queryRaw`SELECT migration_name,finished_at FROM _prisma_migrations ORDER BY finished_at DESC`;
}[] =
await prismaClient.$queryRaw`SELECT migration_name,finished_at FROM _prisma_migrations ORDER BY finished_at DESC`;
await prismaClient.$disconnect();
expect(migrations).toHaveLength(expectedNumberOfMigrations);
expect(migrations.every(x => !!x.finished_at)).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function createGetPreviewProps<Schema extends ComponentSchema, ChildField
[Kind in ComponentSchema['kind']]: (
schema: Extract<ComponentSchema, { kind: Kind }>,
value: ValueForComponentSchema<Extract<ComponentSchema, { kind: Kind }>>,
memoized: ReturnType<typeof memoizedInfoForSchema[Kind]>,
memoized: ReturnType<(typeof memoizedInfoForSchema)[Kind]>,
path: readonly string[],
getInnerProp: <Field extends ComponentSchema>(
schema: Field,
Expand Down Expand Up @@ -363,7 +363,7 @@ export function createGetPreviewProps<Schema extends ComponentSchema, ChildField
props: GenericPreviewProps<Schema, ChildFieldElement>;
value: unknown;
schema: Schema;
cached: ReturnType<typeof memoizedInfoForSchema[Schema['kind']]>;
cached: ReturnType<(typeof memoizedInfoForSchema)[Schema['kind']]>;
inner: Map<string, MemoState<ComponentSchema>>;
};

Expand Down
Loading