effect-inngest 0.3.0-beta.1 → 0.3.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ declare const TypeId: unique symbol;
18
18
  */
19
19
  type TypeId = typeof TypeId;
20
20
  type EventSchema = EventDefinition;
21
+ type EventEnvelope<Event extends EventSchema> = EventType<Event>;
21
22
  /**
22
23
  * An event-based trigger configuration.
23
24
  *
@@ -395,10 +396,11 @@ declare namespace InngestFunction {
395
396
  type Tag<F> = F extends InngestFunction<infer T, any, any, any> ? T : never;
396
397
  type Triggers<F> = F extends InngestFunction<any, infer T, any, any> ? T : never;
397
398
  type Events<F> = F extends InngestFunction<any, infer T, any, any> ? (T extends EventTrigger<infer E> ? E : never) : never;
398
- type EventPayload<F> = EventType<Events<F>>;
399
- type EventType<F> = Options<F> extends {
400
- readonly batchEvents: BatchEventsOption;
401
- } ? ReadonlyArray<EventPayload<F>> : EventPayload<F>;
399
+ type EventPayload<F> = EventEnvelope<Events<F>>;
400
+ type HasBatchEvents<O> = O extends {
401
+ readonly batchEvents: infer BatchEvents;
402
+ } ? Exclude<BatchEvents, undefined> extends BatchEventsOption ? true : false : false;
403
+ type EventType<F> = HasBatchEvents<Options<F>> extends true ? ReadonlyArray<EventPayload<F>> : EventPayload<F>;
402
404
  type SuccessSchema<F> = F extends InngestFunction<any, any, infer S, any> ? S : never;
403
405
  type Success<F> = Schema.Schema.Type<SuccessSchema<F>>;
404
406
  type Options<F> = F extends InngestFunction<any, any, any, infer O> ? O : never;
package/dist/Group.d.ts CHANGED
@@ -29,7 +29,7 @@ type HandlerFn<F extends InngestFunction.Any> = (context: HandlerContext<F>) =>
29
29
  * @since 0.1.0
30
30
  * @category models
31
31
  */
32
- type HandlersFrom<Fns extends InngestFunction.Any> = { readonly [F in Fns as InngestFunction.Tag<F>]: HandlerFn<F> };
32
+ type HandlersFrom<Fns extends InngestFunction.Any> = { readonly [Tag in InngestFunction.Tag<Fns>]: HandlerFrom<Fns, Tag> };
33
33
  /**
34
34
  * @since 0.1.0
35
35
  * @category models
@@ -127,7 +127,7 @@ declare const make: <Fns extends ReadonlyArray<InngestFunction.Any>>(...fns: Fns
127
127
  * )
128
128
  * ```
129
129
  */
130
- declare const toHttpApp: (group: InngestGroup.Any) => Effect.Effect<_$effect_unstable_http_HttpServerResponse0.HttpServerResponse, never, InngestClient | HttpClient.HttpClient | _$effect_unstable_http_HttpServerRequest0.HttpServerRequest>;
130
+ declare const toHttpApp: (group: InngestGroup.Any) => Effect.Effect<_$effect_unstable_http_HttpServerResponse0.HttpServerResponse, never, InngestClient | _$effect_unstable_http_HttpServerRequest0.HttpServerRequest | HttpClient.HttpClient>;
131
131
  /**
132
132
  * Create a standalone web handler from an InngestGroup.
133
133
  *
package/dist/HttpApi.d.ts CHANGED
@@ -49,13 +49,13 @@ declare const InngestApiGroup_base: HttpApiGroup.HttpApiGroup<"inngest", HttpApi
49
49
  readonly authentication_succeeded: Schema.optional<Schema.Union<readonly [Schema.Literal<false>, Schema.Null]>>;
50
50
  readonly capabilities: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
51
51
  readonly functions: Schema.optionalKey<Schema.$Array<Schema.Unknown>>;
52
- }>]>>, HttpApiEndpoint.Json<typeof FunctionNotFoundError | typeof InvalidRequestError | typeof SignatureError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"register", "PUT", "/", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
52
+ }>]>>, HttpApiEndpoint.Json<typeof InvalidRequestError | typeof FunctionNotFoundError | typeof SignatureError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"register", "PUT", "/", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
53
53
  readonly message: Schema.String;
54
54
  readonly modified: Schema.Boolean;
55
- }>>, HttpApiEndpoint.Json<typeof FunctionNotFoundError | typeof InvalidRequestError | typeof SignatureError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"execute", "POST", "/", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<Schema.Struct<{
55
+ }>>, HttpApiEndpoint.Json<typeof InvalidRequestError | typeof FunctionNotFoundError | typeof SignatureError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"execute", "POST", "/", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<Schema.Struct<{
56
56
  readonly fnId: Schema.String;
57
57
  readonly stepId: Schema.optional<Schema.String>;
58
- }>>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Unknown>, HttpApiEndpoint.Json<typeof FunctionNotFoundError | typeof InvalidRequestError | typeof SignatureError>, never, never>, false>;
58
+ }>>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Unknown>, HttpApiEndpoint.Json<typeof InvalidRequestError | typeof FunctionNotFoundError | typeof SignatureError>, never, never>, false>;
59
59
  /**
60
60
  * @since 0.1.0
61
61
  * @category api
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect-inngest",
3
- "version": "0.3.0-beta.1",
3
+ "version": "0.3.0-beta.2",
4
4
  "description": "Native Effect client library for Inngest - build durable, type-safe workflows",
5
5
  "keywords": [
6
6
  "background-jobs",
@@ -116,13 +116,13 @@
116
116
  "@ast-grep/cli": "^0.43.0",
117
117
  "@changesets/changelog-github": "^0.6.0",
118
118
  "@changesets/cli": "^2.31.0",
119
- "@effect/platform-bun": "4.0.0-beta.83",
119
+ "@effect/platform-bun": "4.0.0-beta.85",
120
120
  "@effect/tsgo": "0.14.3",
121
- "@effect/vitest": "4.0.0-beta.83",
121
+ "@effect/vitest": "4.0.0-beta.85",
122
122
  "@types/bun": "1.3.12",
123
123
  "@typescript/native-preview": "^7.0.0-dev.20260420.1",
124
124
  "@vitest/coverage-v8": "4.1.5",
125
- "effect": "4.0.0-beta.83",
125
+ "effect": "4.0.0-beta.85",
126
126
  "inngest": "^4.5.1",
127
127
  "mockttp": "^4.4.2",
128
128
  "typescript": "^5.9.3",
package/src/Function.ts CHANGED
@@ -23,6 +23,7 @@ export const TypeId: unique symbol = Symbol.for("effect-inngest/Function");
23
23
  export type TypeId = typeof TypeId;
24
24
 
25
25
  export type EventSchema = InngestEvent.EventDefinition;
26
+ type EventEnvelope<Event extends EventSchema> = InngestEvent.EventType<Event>;
26
27
 
27
28
  /**
28
29
  * An event-based trigger configuration.
@@ -443,9 +444,13 @@ export declare namespace InngestFunction {
443
444
  export type Triggers<F> = F extends InngestFunction<any, infer T, any, any> ? T : never;
444
445
  export type Events<F> =
445
446
  F extends InngestFunction<any, infer T, any, any> ? (T extends EventTrigger<infer E> ? E : never) : never;
446
- export type EventPayload<F> = InngestEvent.EventType<Events<F>>;
447
- export type EventType<F> =
448
- Options<F> extends { readonly batchEvents: BatchEventsOption } ? ReadonlyArray<EventPayload<F>> : EventPayload<F>;
447
+ export type EventPayload<F> = EventEnvelope<Events<F>>;
448
+ export type HasBatchEvents<O> = O extends { readonly batchEvents: infer BatchEvents }
449
+ ? Exclude<BatchEvents, undefined> extends BatchEventsOption
450
+ ? true
451
+ : false
452
+ : false;
453
+ export type EventType<F> = HasBatchEvents<Options<F>> extends true ? ReadonlyArray<EventPayload<F>> : EventPayload<F>;
449
454
 
450
455
  export type SuccessSchema<F> = F extends InngestFunction<any, any, infer S, any> ? S : never;
451
456
  export type Success<F> = Schema.Schema.Type<SuccessSchema<F>>;
package/src/Group.ts CHANGED
@@ -41,7 +41,7 @@ export type HandlerFn<F extends InngestFunction.Any> = (
41
41
  * @category models
42
42
  */
43
43
  export type HandlersFrom<Fns extends InngestFunction.Any> = {
44
- readonly [F in Fns as InngestFunction.Tag<F>]: HandlerFn<F>;
44
+ readonly [Tag in InngestFunction.Tag<Fns>]: HandlerFrom<Fns, Tag>;
45
45
  };
46
46
 
47
47
  /**