Skip to content

Commit

Permalink
fix brekaing changes from updating
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed Aug 1, 2024
1 parent cc1d69f commit 283c3e5
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 83 deletions.
18 changes: 9 additions & 9 deletions packages/uploadthing/src/internal/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ export const createRequestHandler = <TRouter extends FileRouter>(
"x-uploadthing-version": clientVersion,
} = yield* HttpServerRequest.schemaHeaders(
S.Struct({
"uploadthing-hook": S.optional(UploadThingHook),
"x-uploadthing-package": S.optional(S.String, {
default: () => "unknown",
}),
"x-uploadthing-version": S.optional(S.String, {
default: () => pkgJson.version,
}),
"uploadthing-hook": UploadThingHook.pipe(S.optional),
"x-uploadthing-package": S.String.pipe(
S.optionalWith({ default: () => "unknown" }),
),
"x-uploadthing-version": S.String.pipe(
S.optionalWith({ default: () => pkgJson.version }),
),
}),
);

Expand All @@ -159,7 +159,7 @@ export const createRequestHandler = <TRouter extends FileRouter>(

const { slug, actionType } = yield* HttpRouter.schemaParams(
S.Struct({
actionType: S.optional(ActionType),
actionType: ActionType.pipe(S.optional),
slug: S.String,
}),
);
Expand Down Expand Up @@ -322,7 +322,7 @@ const handleCallbackRequest = (opts: {
S.Struct({
status: S.String,
file: UploadedFileData,
metadata: S.Record(S.String, S.Unknown),
metadata: S.Record({ key: S.String, value: S.Unknown }),
}),
);
yield* Effect.logDebug("Handling callback request with input:").pipe(
Expand Down
10 changes: 5 additions & 5 deletions packages/uploadthing/src/internal/shared-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export const ParsedToken = S.Struct({
apiKey: S.String.pipe(S.startsWith("sk_")),
appId: S.String,
regions: S.NonEmptyArray(S.String),
ingestHost: S.optional(S.String, {
default: () => "ingest.uploadthing.com",
}),
ingestHost: S.String.pipe(
S.optionalWith({ default: () => "ingest.uploadthing.com" }),
),
});

export const UploadThingToken = S.Base64.pipe(
export const UploadThingToken = S.Uint8ArrayFromBase64.pipe(
S.compose(DecodeString),
S.compose(S.parseJson(ParsedToken)),
);
Expand All @@ -54,7 +54,7 @@ export class FileUploadData extends S.Class<FileUploadData>("FileUploadData")({
name: S.String,
size: S.Number,
type: S.String,
lastModified: S.optional(S.Number),
lastModified: S.Number.pipe(S.optional),
}) {}

/**
Expand Down
149 changes: 80 additions & 69 deletions pnpm-lock.yaml

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

0 comments on commit 283c3e5

Please sign in to comment.