Skip to content

Commit

Permalink
Version Packages (beta) (#4083)
Browse files Browse the repository at this point in the history
* Version Packages (beta)

* pnpm lock

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
  • Loading branch information
3 people committed Mar 31, 2023
1 parent acc07ce commit f2da4f1
Show file tree
Hide file tree
Showing 55 changed files with 677 additions and 249 deletions.
15 changes: 14 additions & 1 deletion .changeset/pre.json
Expand Up @@ -46,7 +46,9 @@
"@blitzjs/recipe-theme-ui": "0.34.0-canary.0",
"@blitzjs/recipe-vanilla-extract": "0.34.0-canary.0",
"test-rpc-path-root": "0.0.0",
"test-full-auth-with-rpc": "0.0.0"
"test-full-auth-with-rpc": "0.0.0",
"next-blitz-auth": "0.1.0",
"test-app-dir": "0.0.0"
},
"changesets": [
"afraid-dancers-juggle",
Expand All @@ -67,6 +69,7 @@
"calm-nails-wait",
"calm-papayas-protect",
"calm-tomatoes-drive",
"chatty-fireants-leave",
"chilled-carrots-own",
"chilly-candles-care",
"chilly-nails-nail",
Expand All @@ -77,6 +80,7 @@
"cool-doors-invent",
"cool-horses-check",
"cuddly-pugs-crash",
"cuddly-singers-perform",
"curly-rules-speak",
"curly-seas-serve",
"curvy-days-attend",
Expand All @@ -91,13 +95,17 @@
"eleven-lobsters-drop",
"empty-berries-rule",
"empty-pants-search",
"empty-spiders-lay",
"empty-turkeys-wave",
"fair-carrots-guess",
"fair-kangaroos-clean",
"fair-wombats-sneeze",
"famous-kings-explain",
"fast-adults-guess",
"fast-clocks-push",
"fast-pans-impress",
"fast-papayas-grow",
"fast-toys-wash",
"fast-trainers-kneel",
"few-dogs-fetch",
"few-hounds-worry",
Expand All @@ -109,6 +117,7 @@
"forty-timers-rhyme",
"four-brooms-juggle",
"four-meals-fry",
"four-radios-tickle",
"four-sheep-judge",
"funny-cups-pay",
"fuzzy-bees-warn",
Expand Down Expand Up @@ -169,6 +178,7 @@
"lucky-cows-try",
"lucky-months-guess",
"lucky-years-turn",
"mean-ears-speak",
"mean-gorillas-reply",
"modern-cameras-pull",
"modern-games-dream",
Expand Down Expand Up @@ -234,6 +244,7 @@
"silent-colts-reply",
"silent-lies-run",
"silly-apricots-share",
"silly-peas-work",
"silly-shoes-agree",
"six-apricots-kick",
"slimy-humans-impress",
Expand All @@ -258,6 +269,7 @@
"stale-jobs-drum",
"stale-parents-yawn",
"strong-apes-reply",
"strong-chicken-study",
"strong-keys-lie",
"stupid-rabbits-jump",
"stupid-walls-sell",
Expand All @@ -266,6 +278,7 @@
"swift-glasses-laugh",
"swift-poets-travel",
"tall-meals-learn",
"tall-radios-clean",
"tame-keys-reply",
"tame-pumpkins-nail",
"tasty-maps-fetch",
Expand Down
9 changes: 6 additions & 3 deletions .changeset/tall-radios-clean.md
@@ -1,5 +1,4 @@
---
"next-blitz-auth": patch
"@blitzjs/auth": patch
"@blitzjs/rpc": patch
"blitz": patch
Expand All @@ -11,9 +10,10 @@ feature: Nextjs 13 App Directory Utility Methods

This hook is implemented as the replacement of the [`BlitzPage` seurity auth utilities](https://blitzjs.com/docs/authorization#secure-your-pages) provided for the pages directory to work with React Server Components in the Nextjs 13 app directory
It can be used in any asynchronous server component be it in `page.ts` or in the layouts in `layout.ts`
It uses the new [`redirect` function](https://beta.nextjs.org/docs/api-reference/redirect) to provide the required authorization in server side
It uses the new [`redirect` function](https://beta.nextjs.org/docs/api-reference/redirect) to provide the required authorization in server side

#### API

```ts
useAuthenticatedBlitzContext({
redirectTo,
Expand All @@ -27,7 +27,9 @@ useAuthenticatedBlitzContext({
```

#### Usage

**Example Usage in React Server Component in `app` directory in Next 13**

```ts
import {getAppSession, useAuthenticatedBlitzContext} from "src/blitz-server"
...
Expand All @@ -41,11 +43,12 @@ await useAuthenticatedBlitzContext({
### 🔧 New Blitz RPC Hook `invokeResolver`

#### API

```ts
invokeResolver<T extends (...args: any) => any, TInput = FirstParam<T>>(
queryFn: T,
params: TInput,
): Promise<PromiseReturnType<T>>
): Promise<PromiseReturnType<T>>
```

#### Example Usage
Expand Down
81 changes: 81 additions & 0 deletions apps/next13/CHANGELOG.md
@@ -0,0 +1,81 @@
# next-blitz-auth

## 0.1.1-beta.0

### Patch Changes

- 37aeaa7fa: feature: Nextjs 13 App Directory Utility Methods

### 🔧 New Blitz Auth Hook `useAuthenticatedBlitzContext`

This hook is implemented as the replacement of the [`BlitzPage` seurity auth utilities](https://blitzjs.com/docs/authorization#secure-your-pages) provided for the pages directory to work with React Server Components in the Nextjs 13 app directory
It can be used in any asynchronous server component be it in `page.ts` or in the layouts in `layout.ts`
It uses the new [`redirect` function](https://beta.nextjs.org/docs/api-reference/redirect) to provide the required authorization in server side

#### API

```ts
useAuthenticatedBlitzContext({
redirectTo,
redirectAuthenticatedTo,
role,
}: {
redirectTo?: string | RouteUrlObject
redirectAuthenticatedTo?: string | RouteUrlObject | ((ctx: Ctx) => string | RouteUrlObject)
role?: string | string[]
}): Promise<void>
```

#### Usage

**Example Usage in React Server Component in `app` directory in Next 13**

```ts
import {getAppSession, useAuthenticatedBlitzContext} from "src/blitz-server"
...
await useAuthenticatedBlitzContext({
redirectTo: "/auth/login",
role: ["admin"],
redirectAuthenticatedTo: "/dashboard",
})
```

### 🔧 New Blitz RPC Hook `invokeResolver`

#### API

```ts
invokeResolver<T extends (...args: any) => any, TInput = FirstParam<T>>(
queryFn: T,
params: TInput,
): Promise<PromiseReturnType<T>>
```

#### Example Usage

```ts
...
import {invokeResolver, useAuthenticatedBlitzContext} from "../src/blitz-server"
import getCurrentUser from "../src/users/queries/getCurrentUser"

export default async function Home() {
await useAuthenticatedBlitzContext({
redirectTo: "/auth/login",
})
const user = await invokeResolver(getCurrentUser, null)
...
```
- Updated dependencies [cadefb88e]
- Updated dependencies [6f18cbdc9]
- Updated dependencies [acc07ce94]
- Updated dependencies [ea7561b8e]
- Updated dependencies [9529dbd6f]
- Updated dependencies [ea7561b8e]
- Updated dependencies [6e88a847f]
- Updated dependencies [37aeaa7fa]
- blitz@2.0.0-beta.24
- @blitzjs/auth@2.0.0-beta.24
- @blitzjs/next@2.0.0-beta.24
- @blitzjs/rpc@2.0.0-beta.24
- @blitzjs/config@2.0.0-beta.24
2 changes: 1 addition & 1 deletion apps/next13/package.json
@@ -1,6 +1,6 @@
{
"name": "next-blitz-auth",
"version": "0.1.0",
"version": "0.1.1-beta.0",
"private": true,
"scripts": {
"blitz:dev": "next dev",
Expand Down
2 changes: 1 addition & 1 deletion apps/toolkit-app-passportjs/package.json
Expand Up @@ -30,7 +30,7 @@
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"next": "13.2.4",
"openid-client": "5.2.1",
"prisma": "4.6.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/toolkit-app/package.json
Expand Up @@ -31,7 +31,7 @@
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"next": "13.2.4",
"next-auth": "4.18.7",
"prisma": "4.6.1",
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/auth-with-rpc/package.json
Expand Up @@ -17,14 +17,14 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.23",
"@blitzjs/config": "workspace:2.0.0-beta.23",
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"@blitzjs/auth": "workspace:2.0.0-beta.24",
"@blitzjs/config": "workspace:2.0.0-beta.24",
"@blitzjs/next": "workspace:2.0.0-beta.24",
"@blitzjs/rpc": "workspace:2.0.0-beta.24",
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"delay": "5.0.0",
"next": "13.2.4",
"prisma": "4.6.1",
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/auth/package.json
Expand Up @@ -17,11 +17,11 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.23",
"@blitzjs/config": "workspace:2.0.0-beta.23",
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/auth": "workspace:2.0.0-beta.24",
"@blitzjs/config": "workspace:2.0.0-beta.24",
"@blitzjs/next": "workspace:2.0.0-beta.24",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"lowdb": "3.0.0",
"next": "13.2.4",
"prisma": "4.6.1",
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/get-initial-props/package.json
Expand Up @@ -16,19 +16,19 @@
"schema": "db/schema.prisma"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.23",
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"@blitzjs/auth": "workspace:2.0.0-beta.24",
"@blitzjs/next": "workspace:2.0.0-beta.24",
"@blitzjs/rpc": "workspace:2.0.0-beta.24",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"lowdb": "3.0.0",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.23",
"@blitzjs/config": "workspace:2.0.0-beta.24",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/middleware/package.json
Expand Up @@ -11,10 +11,10 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
},
"dependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.23",
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.23",
"@blitzjs/config": "workspace:2.0.0-beta.24",
"@blitzjs/next": "workspace:2.0.0-beta.24",
"@blitzjs/rpc": "workspace:2.0.0-beta.24",
"blitz": "workspace:2.0.0-beta.24",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/next-13-app-dir/package.json
Expand Up @@ -17,12 +17,12 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.23",
"@blitzjs/config": "workspace:2.0.0-beta.23",
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"@blitzjs/auth": "workspace:2.0.0-beta.24",
"@blitzjs/config": "workspace:2.0.0-beta.24",
"@blitzjs/next": "workspace:2.0.0-beta.24",
"@blitzjs/rpc": "workspace:2.0.0-beta.24",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"lowdb": "3.0.0",
"next": "13.2.4",
"prisma": "4.6.1",
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/no-suspense/package.json
Expand Up @@ -16,19 +16,19 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.23",
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"@blitzjs/auth": "workspace:2.0.0-beta.24",
"@blitzjs/next": "workspace:2.0.0-beta.24",
"@blitzjs/rpc": "workspace:2.0.0-beta.24",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"lowdb": "3.0.0",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.23",
"@blitzjs/config": "workspace:2.0.0-beta.24",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/qm/package.json
Expand Up @@ -8,13 +8,13 @@
"clean": "rm -rf .turbo && rm -rf node_modules"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.23",
"@blitzjs/config": "workspace:2.0.0-beta.23",
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"@blitzjs/auth": "workspace:2.0.0-beta.24",
"@blitzjs/config": "workspace:2.0.0-beta.24",
"@blitzjs/next": "workspace:2.0.0-beta.24",
"@blitzjs/rpc": "workspace:2.0.0-beta.24",
"@prisma/client": "4.6.1",
"@tanstack/react-query": "4.0.10",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/react-query-utils/package.json
Expand Up @@ -16,18 +16,18 @@
"schema": "db/schema.prisma"
},
"dependencies": {
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"@blitzjs/next": "workspace:2.0.0-beta.24",
"@blitzjs/rpc": "workspace:2.0.0-beta.24",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.24",
"lowdb": "3.0.0",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.23",
"@blitzjs/config": "workspace:2.0.0-beta.24",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
Expand Down

0 comments on commit f2da4f1

Please sign in to comment.