Skip to content
Closed
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: 5 additions & 1 deletion .github/workflows/waspc-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ jobs:

- name: Ensure examples/todoApp compiles and builds
if: matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-latest'
run: ./examples/todoApp/ensure_app_compiles_and_builds.sh
run: ./tools/ensure_app_compiles_and_builds.sh ./examples/todoApp

- name: Ensure examples/crud-testing compiles and builds
if: matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-latest'
run: ./tools/ensure_app_compiles_and_builds.sh ./examples/crud-testing
Comment on lines +168 to +170
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice thinking!

Hm, but could we maybe instead move the Crud stuff to todoApp? This goes towards the effort of having one "end all be all" testing app.


- name: Headless - Cache Node Modules
id: headless-cache-node-modules
Expand Down
1 change: 1 addition & 0 deletions waspc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### 🔧 Small improvements

- Show a friendlier error when there are no routes defined in the wasp file ([#2643](https://github.com/wasp-lang/wasp/pull/2643))
- The generated server code is now type-checked before building ([#2709](https://github.com/wasp-lang/wasp/pull/2709))

## 0.16.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type PrimitiveJSONValue = string | number | boolean | undefined | null

export interface JSONArray extends Array<JSONValue> {}

type SerializableJSONValue =
| Symbol
export type SerializableJSONValue =
| symbol
| Set<SuperJSONValue>
| Map<SuperJSONValue, SuperJSONValue>
| undefined
Expand All @@ -30,14 +30,14 @@ type SerializableJSONValue =
| RegExp

// Here's where we excluded `ClassInstance` (which was `any`) from the union.
type SuperJSONValue =
export type SuperJSONValue =
| JSONValue
| SerializableJSONValue
| SuperJSONArray
| SuperJSONObject

interface SuperJSONArray extends Array<SuperJSONValue> {}
export interface SuperJSONArray extends Array<SuperJSONValue> {}

interface SuperJSONObject {
export interface SuperJSONObject {
[key: string]: SuperJSONValue
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { OAuth2Provider, OAuth2ProviderWithPKCE } from "arctic";

export function defineProvider<
OAuthClient extends OAuth2Provider | OAuth2ProviderWithPKCE
OAuthClient extends OAuth2Provider | OAuth2ProviderWithPKCE,
const Id extends string
>({
id,
displayName,
oAuthClient,
}: {
id: string;
id: Id;
displayName: string;
oAuthClient: OAuthClient;
}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
_{= crud.entityUpper =},
} from "../_types";
import type { Prisma } from "@prisma/client";
import type { Payload } from "../_types/serialization";
import type { Payload, SuperJSONObject } from "../_types/serialization";
import type {
{= crud.entityUpper =},
} from "wasp/entities";
Expand All @@ -37,7 +37,7 @@ type _WaspEntity = {= crud.entityUpper =}
/**
* PUBLIC API
*/
export namespace {= crud.name =} {
export declare namespace {= crud.name =} {
{=# crud.operations.GetAll =}
export type GetAllQuery<Input extends Payload = never, Output extends Payload = Payload> = {= queryType =}<[_WaspEntityTagged], Input, Output>
{=/ crud.operations.GetAll =}
Expand All @@ -61,7 +61,7 @@ export namespace {= crud.name =} {

/**
* PRIVATE API
*
*
* The types with the `Resolved` suffix are the types that are used internally by the Wasp client
* to implement full-stack type safety.
*/
Expand All @@ -79,7 +79,7 @@ export type GetAllQueryResolved = typeof _waspGetAllQuery

{=# crud.operations.Get =}
{=^ overrides.Get.isDefined =}
type GetInput = Prisma.{= crud.entityUpper =}WhereUniqueInput
type GetInput = SuperJSONObject & Prisma.{= crud.entityUpper =}WhereUniqueInput
type GetOutput = _WaspEntity | null
export type GetQueryResolved = {= crud.name =}.GetQuery<GetInput, GetOutput>
{=/ overrides.Get.isDefined =}
Expand All @@ -91,7 +91,7 @@ export type GetQueryResolved = typeof _waspGetQuery

{=# crud.operations.Create =}
{=^ overrides.Create.isDefined =}
type CreateInput = Prisma.XOR<
type CreateInput = SuperJSONObject & Prisma.XOR<
Prisma.{= crud.entityUpper =}CreateInput,
Prisma.{= crud.entityUpper =}UncheckedCreateInput
>
Expand All @@ -106,7 +106,7 @@ export type CreateActionResolved = typeof _waspCreateAction

{=# crud.operations.Update =}
{=^ overrides.Update.isDefined =}
type UpdateInput = Prisma.XOR<
type UpdateInput = SuperJSONObject & Prisma.XOR<
Prisma.{= crud.entityUpper =}UpdateInput,
Prisma.{= crud.entityUpper =}UncheckedUpdateInput
>
Expand All @@ -123,7 +123,7 @@ export type UpdateActionResolved = typeof _waspUpdateAction

{=# crud.operations.Delete =}
{=^ overrides.Delete.isDefined =}
type DeleteInput = Prisma.{= crud.entityUpper =}WhereUniqueInput
type DeleteInput = SuperJSONObject & Prisma.{= crud.entityUpper =}WhereUniqueInput
type DeleteOutput = _WaspEntity
export type DeleteActionResolved = {= crud.name =}.DeleteAction<DeleteInput, DeleteOutput>
{=/ overrides.Delete.isDefined =}
Expand Down
8 changes: 4 additions & 4 deletions waspc/data/Generator/templates/sdk/wasp/server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ type RequestWithExtraFields = Request & {
* if given middleware returns promise, reject of that promise will be correctly handled,
* meaning that error will be forwarded to next().
*/
export const handleRejection = (
export const handleRejection = <Req extends Request = RequestWithExtraFields, Res extends Response = Response>(
middleware: (
req: RequestWithExtraFields,
res: Response,
req: Req,
res: Res,
next: NextFunction
) => any
) =>
async (req: RequestWithExtraFields, res: Response, next: NextFunction) => {
async (req: Req, res: Res, next: NextFunction) => {
try {
await middleware(req, res, next)
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion waspc/data/Generator/templates/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"comment-filip": "The server.js location changed because we have now included client source files above .wasp/out/server/src.",
"scripts": {
"bundle": "rollup --config --silent",
"bundle": "tsc --build && rollup --config --silent",
"start": "node --enable-source-maps -r dotenv/config bundle/server.js",
"bundle-and-start": "npm run bundle && npm run start",
"watch": "nodemon --exec 'npm run bundle-and-start || exit 1'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import {
serialize as superjsonSerialize,
} from 'superjson'
import { handleRejection } from 'wasp/server/utils'
{=# isAuthEnabled =}
import { makeAuthUserIfPossible } from 'wasp/auth/user'
{=/ isAuthEnabled =}

export function createOperation (handlerFn) {
return handleRejection(async (req, res) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import http from 'http'
import { Server, Socket } from 'socket.io'
import type { ServerType } from 'wasp/server/webSocket'

import { config, prisma } from 'wasp/server'

Expand All @@ -17,7 +16,7 @@ import { makeAuthUserIfPossible } from 'wasp/auth/user'
export async function init(server: http.Server): Promise<void> {
// TODO: In the future, we can consider allowing a clustering option.
// Ref: https://github.com/wasp-lang/wasp/issues/1228
const io: ServerType = new Server(server, {
const io = new Server(server, {
cors: {
origin: config.frontendUrl,
}
Expand Down

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading
Loading