Skip to content

Commit

Permalink
fix(dashboard): organization members check (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiiBz authored Jul 25, 2023
1 parent 6effd41 commit aee172d
Show file tree
Hide file tree
Showing 26 changed files with 229 additions and 131 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-points-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lagon/dashboard': patch
---

Fix organization members check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ storybook-static/
.env
tsconfig.tsbuildinfo
snapshot.bin
.vercel
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
v8 = "0.74.2"
v8 = "0.74.3"

[dev-dependencies]
tokio = { version = "1", features = ["rt", "time", "macros"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/runtime_crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
v8 = "0.74.2"
v8 = "0.74.3"
anyhow = "1.0.72"
rand = "0.8.5"
uuid = { version = "1.4.1", features = ["v4", "fast-rng"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/runtime_http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
v8 = "0.74.2"
v8 = "0.74.3"
hyper = { version = "0.14.27", features = ["client", "http1", "http2", "tcp"] }
anyhow = "1.0.72"
lagon-runtime-v8-utils = { path = "../runtime_v8_utils" }
2 changes: 1 addition & 1 deletion crates/runtime_isolate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
v8 = "0.74.2"
v8 = "0.74.3"
tokio = { version = "1", features = ["rt-multi-thread"] }
futures = "0.3.28"
hyper = { version = "0.14.27", features = ["client"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/runtime_v8_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "0.1.0"
edition = "2021"

[dependencies]
v8 = "0.74.2"
v8 = "0.74.3"
anyhow = "1.0.72"
hyper = "0.14.27"
2 changes: 1 addition & 1 deletion docker/Dockerfile.dashboard
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.4.0-bullseye-slim AS base
FROM node:20.5.0-bullseye-slim AS base
RUN corepack enable
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.serverless
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM node:20.4.0-bullseye-slim as js-runtime
FROM node:20.5.0-bullseye-slim as js-runtime
WORKDIR /app
COPY ./packages/js-runtime/src/ ./src
COPY ./packages/js-runtime/package.json ./
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
"lint-staged": {
"*.{ts,tsx}": "eslint --fix"
},
"packageManager": "pnpm@8.6.9",
"packageManager": "pnpm@8.6.10",
"engines": {
"node": ">=16.0.0",
"pnpm": ">=8.0.0"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.1",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@typescript-eslint/typescript-estree": "^5.59.11",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@typescript-eslint/typescript-estree": "^6.2.0",
"c8": "^8.0.0",
"esbuild": "^0.18.7",
"eslint": "^8.38.0",
Expand All @@ -38,7 +38,7 @@
"prettier": "^3.0.0",
"prettier-plugin-tailwindcss": "^0.4.1",
"tsup": "^7.1.0",
"turbo": "^1.10.9",
"turbo": "^1.10.11",
"typescript": "^5.1.3",
"vitest": "^0.33.0"
}
Expand Down
12 changes: 6 additions & 6 deletions packages/dashboard/lib/api/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export async function checkCanAddMember({ organizationId, plan }: { organization
});

// We add 1 because the owner isn't counted in the members
// if (organizationMembers + 1 >= plan.organizationMembers) {
// throw new TRPCError({
// code: 'BAD_REQUEST',
// message: `You can only have ${plan.organizationMembers} Members per Organization in your current plan`,
// });
// }
if (organizationMembers + 1 >= plan.organizationMembers) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: `You can only have ${plan.organizationMembers} Members per Organization in your current plan`,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { trpc } from 'lib/trpc';
import useFunction from 'lib/hooks/useFunction';
import { QueryObserverBaseResult } from '@tanstack/react-query';
import { useScopedI18n } from 'locales';
import cronstrue from 'cronstrue';

type FunctionDeploymentsProps = {
func: ReturnType<typeof useFunction>['data'];
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@prisma/client": "^5.0.0",
"@radix-ui/react-alert-dialog": "^1.0.0",
"@radix-ui/react-tabs": "^1.0.0",
"@react-email/button": "^0.0.9",
"@react-email/button": "^0.0.10",
"@react-email/container": "0.0.8",
"@react-email/head": "^0.0.5",
"@react-email/hr": "^0.0.5",
Expand Down
5 changes: 3 additions & 2 deletions packages/integrations/astro/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AstroAdapter, AstroIntegration } from 'astro';
import type { AstroAdapter, AstroConfig, AstroIntegration } from 'astro';
import esbuild from 'esbuild';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
Expand All @@ -19,7 +19,8 @@ export function getAdapter(args?: Options): AstroAdapter {
}

export default function createIntegration(args?: Options): AstroIntegration {
let _buildConfig: any;
let _buildConfig: AstroConfig['build'];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let _vite: any;
return {
name: '@lagon/astro',
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/remix/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function createRequestHandler({ build, mode }: { build: ServerBuild; mode
return async (request: Request) => {
try {
return handleRequest(request);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (e: any) {
if (process.env.NODE_ENV === 'development') {
return new Response(e.message || e.toString(), {
Expand Down
1 change: 1 addition & 0 deletions packages/js-runtime/src/runtime/encoding/TextEncoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
globalThis.TextEncoder = class {
readonly encoding = 'utf-8';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult {
// TODO
throw new Error('Not implemented');
Expand Down
13 changes: 7 additions & 6 deletions packages/js-runtime/src/runtime/global/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
// @ts-ignore
globalThis.FileReader = class extends EventTarget {
readonly error: DOMException | null = null;
onabort: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null = null;
onerror: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null = null;
onload: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null = null;
onloadend: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null = null;
onloadstart: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null = null;
onprogress: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null = null;
onabort: ((this: FileReader, ev: ProgressEvent<FileReader>) => unknown) | null = null;
onerror: ((this: FileReader, ev: ProgressEvent<FileReader>) => unknown) | null = null;
onload: ((this: FileReader, ev: ProgressEvent<FileReader>) => unknown) | null = null;
onloadend: ((this: FileReader, ev: ProgressEvent<FileReader>) => unknown) | null = null;
onloadstart: ((this: FileReader, ev: ProgressEvent<FileReader>) => unknown) | null = null;
onprogress: ((this: FileReader, ev: ProgressEvent<FileReader>) => unknown) | null = null;
readonly readyState: number = FileReader.EMPTY;
readonly result: string | ArrayBuffer | null = null;

Expand Down Expand Up @@ -55,6 +55,7 @@
this.read(blob.text(), btoa);
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
readAsText(blob: Blob, encoding?: string) {
this.read(blob.text());
}
Expand Down
2 changes: 1 addition & 1 deletion packages/js-runtime/src/runtime/http/FormData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
}

forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any) {
forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: unknown) {
this.fields.forEach((values, key) => {
values.forEach(value => {
callbackfn.call(thisArg, value, key, this);
Expand Down
4 changes: 1 addition & 3 deletions packages/js-runtime/src/runtime/http/Headers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(globalThis => {
const SET_COOKIE = 'set-cookie';
const CONTENT_TYPE = 'content-type';
// eslint-disable-next-line no-control-regex
const NORMALIZE_VALUE_REGEX = new RegExp('^[\x0A\x0D\x09\x20]+|[\x0A\x0D\x09\x20]+$', 'g');

globalThis.Headers = class {
private h: [string, string][] = [];
Expand Down Expand Up @@ -157,7 +155,7 @@
}
}

forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) {
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: unknown) {
for (const [key, value] of this.entries()) {
callbackfn.call(thisArg, value, key, this);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/js-runtime/src/runtime/http/URL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@
}
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
static createObjectURL(obj: Blob): string {
// TODO
throw new Error('Not implemented');
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
static revokeObjectURL(url: string) {
// TODO
throw new Error('Not implemented');
Expand Down
2 changes: 1 addition & 1 deletion packages/js-runtime/src/runtime/http/URLSearchParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
}
}

forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any) {
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: unknown) {
for (const [name, value] of this.list) {
callbackfn.call(thisArg, value, name, this);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@storybook/testing-library": "^0.2.0",
"@types/react": "^18.0.9",
"autoprefixer": "^10.4.7",
"class-variance-authority": "^0.6.0",
"class-variance-authority": "^0.7.0",
"final-form": "^4.20.7",
"next": "13.4.12",
"postcss": "^8.4.22",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type FormProps = {
onSubmit: FinalFormFormProps['onSubmit'];
onSubmitSuccess: FinalFormFormProps['onSubmit'];
onSubmitError?: FinalFormFormProps['onSubmit'];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children: ReactNode | (({ form, values }: { form: FormApi; values: Record<string, any> }) => ReactNode);
};

Expand Down
Loading

4 comments on commit aee172d

@vercel
Copy link

@vercel vercel bot commented on aee172d Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./packages/docs

docs-lagon.vercel.app
docs.lagon.app
docs-git-main-lagon.vercel.app
lagon-docs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on aee172d Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

www – ./www

lagon.app
www-lagon.vercel.app
lagon.dev
www-git-main-lagon.vercel.app

@vercel
Copy link

@vercel vercel bot commented on aee172d Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

storybook – ./packages/ui

storybook-swart-eight.vercel.app
storybook-git-main-lagon.vercel.app
ui.lagon.app
storybook-lagon.vercel.app

@vercel
Copy link

@vercel vercel bot commented on aee172d Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dashboard – ./packages/dashboard

dashboard-git-main-lagon.vercel.app
dashboard-lagon.vercel.app
dash.lagon.app

Please sign in to comment.