Skip to content

Commit

Permalink
Merge branch 'main' into send-event-error-parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwilliams committed Sep 26, 2023
2 parents 45e933f + 9889e42 commit 61be33b
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 9 deletions.
6 changes: 6 additions & 0 deletions packages/inngest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# inngest

## 2.7.1

### Patch Changes

- [#325](https://github.com/inngest/inngest-js/pull/325) [`b8858c9`](https://github.com/inngest/inngest-js/commit/b8858c9be1cab32d4e781cf3588047181bfed6a7) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Hotfix: Ensure `ProxyLogger` (and some other used classes/types) is correctly exported from `"inngest"`

## 2.7.0

### Minor Changes
Expand Down
43 changes: 40 additions & 3 deletions packages/inngest/etc/inngest.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ export interface ClientOptions {
// @public
export type Combine<TCurr extends Record<string, EventPayload>, TInc extends StandardEventSchemas> = IsStringLiteral<keyof TCurr & string> extends true ? Simplify<Omit<TCurr, keyof StandardEventSchemaToPayload<TInc>> & StandardEventSchemaToPayload<TInc>> : StandardEventSchemaToPayload<TInc>;

// Warning: (ae-forgotten-export) The symbol "TriggerOptions" needs to be exported by the entry point index.d.ts
//
// @public
export type EventNameFromTrigger<Events extends Record<string, EventPayload>, T extends TriggerOptions<keyof Events & string>> = T extends string ? T : T extends {
event: string;
Expand Down Expand Up @@ -244,6 +242,9 @@ export type LiteralZodEventSchema = z.ZodObject<{
user?: z.AnyZodObject | z.ZodAny;
}>;

// @public
export type LogArg = unknown;

// @public
export type LogLevel = "fatal" | "error" | "warn" | "info" | "debug" | "silent";

Expand Down Expand Up @@ -286,6 +287,25 @@ export class NonRetriableError extends Error {
readonly cause?: unknown;
}

// @public
export class ProxyLogger implements Logger {
constructor(logger: Logger);
// (undocumented)
debug(...args: LogArg[]): void;
// (undocumented)
disable(): void;
// (undocumented)
enable(): void;
// (undocumented)
error(...args: LogArg[]): void;
// (undocumented)
flush(): Promise<void>;
// (undocumented)
info(...args: LogArg[]): void;
// (undocumented)
warn(...args: LogArg[]): void;
}

// @public
export enum queryKeys {
// (undocumented)
Expand Down Expand Up @@ -344,9 +364,26 @@ export type StandardEventSchemaToPayload<T> = Simplify<{
};
}>;

// @public
export type StrictUnion<T> = StrictUnionHelper<T, T>;

// @public
export type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;

// @public
export type TimeStr = `${`${number}w` | ""}${`${number}d` | ""}${`${number}h` | ""}${`${number}m` | ""}${`${number}s` | ""}`;

// @public
export type TriggerOptions<T extends string> = T | StrictUnion<{
event: T;
if?: string;
} | {
cron: string;
}>;

// @public
export type UnionKeys<T> = T extends T ? keyof T : never;

// @public
export type ZodEventSchemas = Record<string, {
data?: z.AnyZodObject | z.ZodAny;
Expand All @@ -362,7 +399,7 @@ export type ZodEventSchemas = Record<string, {
// src/components/InngestMiddleware.ts:332:5 - (ae-forgotten-export) The symbol "MiddlewareSendEventInput" needs to be exported by the entry point index.d.ts
// src/components/InngestMiddleware.ts:342:5 - (ae-forgotten-export) The symbol "MiddlewareSendEventOutput" needs to be exported by the entry point index.d.ts
// src/types.ts:51:5 - (ae-forgotten-export) The symbol "failureEventErrorSchema" needs to be exported by the entry point index.d.ts
// src/types.ts:715:5 - (ae-forgotten-export) The symbol "TimeStrBatch" needs to be exported by the entry point index.d.ts
// src/types.ts:717:5 - (ae-forgotten-export) The symbol "TimeStrBatch" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
9 changes: 7 additions & 2 deletions packages/inngest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inngest",
"version": "2.7.0",
"version": "2.7.1",
"description": "Official SDK for Inngest.com",
"main": "./index.js",
"types": "./index.d.ts",
Expand Down Expand Up @@ -93,7 +93,12 @@
"require": "./deno/fresh.js",
"import": "./deno/fresh.js",
"types": "./deno/fresh.d.ts"
}
},
"./api/*": "./api/*.js",
"./components": "./components/*.js",
"./deno/*": "./deno/*.js",
"./helpers/*": "./helpers/*.js",
"./middleware/*": "./middleware/*.js"
},
"homepage": "https://github.com/inngest/inngest-js#readme",
"repository": {
Expand Down
10 changes: 8 additions & 2 deletions packages/inngest/src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,29 @@ export type KeysNotOfType<T, U> = {

/**
* Returns all keys from objects in the union `T`.
*
* @public
*/
type UnionKeys<T> = T extends T ? keyof T : never;
export type UnionKeys<T> = T extends T ? keyof T : never;

/**
* Enforces strict union comformity by ensuring that all potential keys in a
* union of objects are accounted for in every object.
*
* Requires two generics to be used, so is abstracted by {@link StrictUnion}.
*
* @public
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type StrictUnionHelper<T, TAll> = T extends any
export type StrictUnionHelper<T, TAll> = T extends any
? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>>
: never;

/**
* Enforces strict union comformity by ensuring that all potential keys in a
* union of objects are accounted for in every object.
*
* @public
*/
export type StrictUnion<T> = StrictUnionHelper<T, T>;

Expand Down
10 changes: 9 additions & 1 deletion packages/inngest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ export type {
} from "./components/InngestMiddleware";
export { NonRetriableError } from "./components/NonRetriableError";
export { headerKeys, internalEvents, queryKeys } from "./helpers/consts";
export type { IsStringLiteral } from "./helpers/types";
export type {
IsStringLiteral,
StrictUnion,
StrictUnionHelper,
UnionKeys,
} from "./helpers/types";
export { ProxyLogger } from "./middleware/logger";
export type { LogArg } from "./middleware/logger";
export type {
ClientOptions,
EventNameFromTrigger,
Expand All @@ -30,4 +37,5 @@ export type {
LogLevel,
RegisterOptions,
TimeStr,
TriggerOptions,
} from "./types";
6 changes: 5 additions & 1 deletion packages/inngest/src/middleware/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* - values used for string interpolation, basically anything
*
* See https://linear.app/inngest/issue/INN-1342/flush-logs-on-function-exitreturns for more details
*
* @public
*/
type LogArg = unknown;
export type LogArg = unknown;

/**
* Based on https://datatracker.ietf.org/doc/html/rfc5424#autoid-11
Expand Down Expand Up @@ -46,6 +48,8 @@ export class DefaultLogger implements Logger {
* context, so it doesn't result in duplicated logging.
*
* And also attempt to allow enough time for the logger to flush all logs.
*
* @public
*/
export class ProxyLogger implements Logger {
readonly #logger: Logger;
Expand Down
2 changes: 2 additions & 0 deletions packages/inngest/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ export interface InternalRegisterOptions extends RegisterOptions {

/**
* A user-friendly method of specifying a trigger for an Inngest function.
*
* @public
*/
export type TriggerOptions<T extends string> =
| T
Expand Down

0 comments on commit 61be33b

Please sign in to comment.