effect-inngest 0.3.0-beta.0 → 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.
- package/README.md +1 -1
- package/dist/Client.d.ts +2 -2
- package/dist/Client.js +3 -1
- package/dist/Event.d.ts +2 -2
- package/dist/Event.js +2 -1
- package/dist/Function.d.ts +9 -7
- package/dist/Function.js +1 -1
- package/dist/Group.d.ts +2 -2
- package/dist/HttpApi.d.ts +3 -3
- package/package.json +12 -4
- package/src/Client.ts +7 -7
- package/src/Event.ts +2 -2
- package/src/Function.ts +23 -18
- package/src/Group.ts +1 -1
package/README.md
CHANGED
|
@@ -459,7 +459,7 @@ const ProcessOrder = InngestFunction.make("process-order", {
|
|
|
459
459
|
debounce: { period: Duration.seconds(5) },
|
|
460
460
|
idempotency: "event.data.orderId",
|
|
461
461
|
timeouts: { finish: Duration.hours(1) },
|
|
462
|
-
cancelOn: [{ event:
|
|
462
|
+
cancelOn: [{ event: OrderCancelled, if: "event.data.orderId == async.data.orderId" }],
|
|
463
463
|
priority: { run: "event.data.isPremium ? 100 : 0" },
|
|
464
464
|
});
|
|
465
465
|
```
|
package/dist/Client.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as _$effect_Cause0 from "effect/Cause";
|
|
|
7
7
|
|
|
8
8
|
//#region src/Client.d.ts
|
|
9
9
|
declare namespace Client_d_exports {
|
|
10
|
-
export { CheckpointApiError, CheckpointRetrySchedule, CheckpointingOption, ClientConfig, EventPayload, InngestClient, InngestConfig, layer, layerConfig, layerFromEnv };
|
|
10
|
+
export { CheckpointApiError, CheckpointRetrySchedule, CheckpointingOption, ClientConfig, ClientMode, EventPayload, InngestClient, InngestClientService, InngestConfig, SendEventError, SendEventResponse, TypeId, layer, layerConfig, layerFromEnv };
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* @since 0.1.0
|
|
@@ -212,4 +212,4 @@ declare const layerConfig: (config: Config.Wrap<ClientConfig>) => Layer.Layer<In
|
|
|
212
212
|
*/
|
|
213
213
|
declare const layerFromEnv: Layer.Layer<InngestClient | InngestConfig, Config.ConfigError, HttpClient.HttpClient>;
|
|
214
214
|
//#endregion
|
|
215
|
-
export { CheckpointApiError, CheckpointRetrySchedule, type CheckpointingOption, ClientConfig, Client_d_exports, EventPayload, InngestClient, InngestConfig, layer, layerConfig, layerFromEnv };
|
|
215
|
+
export { CheckpointApiError, CheckpointRetrySchedule, type CheckpointingOption, ClientConfig, ClientMode, Client_d_exports, EventPayload, InngestClient, InngestClientService, InngestConfig, SendEventError, SendEventResponse, TypeId, layer, layerConfig, layerFromEnv };
|
package/dist/Client.js
CHANGED
|
@@ -16,6 +16,8 @@ var Client_exports = /* @__PURE__ */ __exportAll({
|
|
|
16
16
|
EventPayload: () => EventPayload,
|
|
17
17
|
InngestClient: () => InngestClient,
|
|
18
18
|
InngestConfig: () => InngestConfig,
|
|
19
|
+
SendEventError: () => SendEventError,
|
|
20
|
+
TypeId: () => TypeId,
|
|
19
21
|
layer: () => layer,
|
|
20
22
|
layerConfig: () => layerConfig,
|
|
21
23
|
layerFromEnv: () => layerFromEnv
|
|
@@ -203,4 +205,4 @@ const layerFromEnv = layerConfig(Config.all({
|
|
|
203
205
|
signingKeyFallback: Config.string("INNGEST_SIGNING_KEY_FALLBACK").pipe(Config.option, Config.map(Option.getOrUndefined))
|
|
204
206
|
}));
|
|
205
207
|
//#endregion
|
|
206
|
-
export { CheckpointApiError, CheckpointRetrySchedule, Client_exports, EventPayload, InngestClient, InngestConfig, layer, layerConfig, layerFromEnv };
|
|
208
|
+
export { CheckpointApiError, CheckpointRetrySchedule, Client_exports, EventPayload, InngestClient, InngestConfig, SendEventError, TypeId, layer, layerConfig, layerFromEnv };
|
package/dist/Event.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { MakeOptions } from "effect/Schema";
|
|
|
3
3
|
|
|
4
4
|
//#region src/Event.d.ts
|
|
5
5
|
declare namespace Event_d_exports {
|
|
6
|
-
export { EventData, EventDefinition, EventEnvelope, EventType, isEventSchema, make };
|
|
6
|
+
export { EventData, EventDefinition, EventEnvelope, EventOptions, EventType, TypeId, isEventSchema, make };
|
|
7
7
|
}
|
|
8
8
|
declare const TypeId: unique symbol;
|
|
9
9
|
interface EventOptions extends MakeOptions {
|
|
@@ -40,4 +40,4 @@ declare function make<const Name extends string>(name: Name): EventDefinition<Na
|
|
|
40
40
|
declare function make<const Name extends string, const DataSchema extends Schema.Top>(name: Name, schema: DataSchema): EventDefinition<Name, DataSchema>;
|
|
41
41
|
declare const isEventSchema: (value: unknown) => value is EventDefinition;
|
|
42
42
|
//#endregion
|
|
43
|
-
export { EventDefinition, EventType, Event_d_exports };
|
|
43
|
+
export { EventData, EventDefinition, EventEnvelope, EventOptions, EventType, Event_d_exports, TypeId, isEventSchema, make };
|
package/dist/Event.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Predicate, Schema } from "effect";
|
|
|
10
10
|
* @since 0.1.0
|
|
11
11
|
*/
|
|
12
12
|
var Event_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
+
TypeId: () => TypeId,
|
|
13
14
|
isEventSchema: () => isEventSchema,
|
|
14
15
|
make: () => make
|
|
15
16
|
});
|
|
@@ -43,4 +44,4 @@ function make(name, schema = Schema.Struct({})) {
|
|
|
43
44
|
}
|
|
44
45
|
const isEventSchema = (value) => Schema.isSchema(value) && Predicate.hasProperty(value, TypeId);
|
|
45
46
|
//#endregion
|
|
46
|
-
export { Event_exports, make };
|
|
47
|
+
export { Event_exports, TypeId, isEventSchema, make };
|
package/dist/Function.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Pipeable } from "effect/Pipeable";
|
|
|
5
5
|
|
|
6
6
|
//#region src/Function.d.ts
|
|
7
7
|
declare namespace Function_d_exports {
|
|
8
|
-
export { CheckpointingOption, CronTrigger, EventTrigger, FunctionOptions, InngestFunction, Trigger, TriggerInput, TypeId, make };
|
|
8
|
+
export { BatchEventsOption, CancellationOption, CheckpointingOption, ConcurrencyOption, CronTrigger, DebounceOption, EventSchema, EventTrigger, FunctionOptions, FunctionRegistration, InngestFunction, PriorityOption, RateLimitOption, RegistrationConfig, Retries, SingletonOption, ThrottleOption, TimeoutsOption, Trigger, TriggerInput, TypeId, make };
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* @since 0.1.0
|
|
@@ -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
|
*
|
|
@@ -196,7 +197,7 @@ interface CancellationOption {
|
|
|
196
197
|
/**
|
|
197
198
|
* The name of the event that should cancel the function run.
|
|
198
199
|
*/
|
|
199
|
-
readonly event:
|
|
200
|
+
readonly event: EventSchema;
|
|
200
201
|
/**
|
|
201
202
|
* The expression that must evaluate to true in order to cancel the function run. There
|
|
202
203
|
* are two variables available in this expression:
|
|
@@ -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> =
|
|
399
|
-
type
|
|
400
|
-
readonly batchEvents:
|
|
401
|
-
} ?
|
|
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;
|
|
@@ -442,4 +444,4 @@ declare function make<const Tag extends string, T extends TriggerInput, S extend
|
|
|
442
444
|
readonly success: S;
|
|
443
445
|
} & O): InngestFunction<Tag, NormalizeTriggers<T>, S, O>;
|
|
444
446
|
//#endregion
|
|
445
|
-
export { type CheckpointingOption, CronTrigger, EventTrigger, FunctionOptions, Function_d_exports, InngestFunction, Trigger, TriggerInput, TypeId, make };
|
|
447
|
+
export { BatchEventsOption, CancellationOption, type CheckpointingOption, ConcurrencyOption, CronTrigger, DebounceOption, EventSchema, EventTrigger, FunctionOptions, FunctionRegistration, Function_d_exports, InngestFunction, PriorityOption, RateLimitOption, RegistrationConfig, Retries, SingletonOption, ThrottleOption, TimeoutsOption, Trigger, TriggerInput, TypeId, make };
|
package/dist/Function.js
CHANGED
|
@@ -32,7 +32,7 @@ const Proto = {
|
|
|
32
32
|
else triggers.push({ cron: t.cron });
|
|
33
33
|
const opts = this.options;
|
|
34
34
|
const cancel = opts.cancelOn?.map((c) => ({
|
|
35
|
-
event: c.event,
|
|
35
|
+
event: c.event.identifier,
|
|
36
36
|
if: c.if,
|
|
37
37
|
timeout: c.timeout ? encodeDuration(c.timeout) : void 0
|
|
38
38
|
}));
|
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 [
|
|
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 |
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"types": "./dist/Client.d.ts",
|
|
43
43
|
"import": "./src/Client.ts"
|
|
44
44
|
},
|
|
45
|
+
"./Event": {
|
|
46
|
+
"types": "./dist/Event.d.ts",
|
|
47
|
+
"import": "./src/Event.ts"
|
|
48
|
+
},
|
|
45
49
|
"./Events": {
|
|
46
50
|
"types": "./dist/Events.d.ts",
|
|
47
51
|
"import": "./src/Events.ts"
|
|
@@ -71,6 +75,10 @@
|
|
|
71
75
|
"types": "./dist/Client.d.ts",
|
|
72
76
|
"import": "./dist/Client.js"
|
|
73
77
|
},
|
|
78
|
+
"./Event": {
|
|
79
|
+
"types": "./dist/Event.d.ts",
|
|
80
|
+
"import": "./dist/Event.js"
|
|
81
|
+
},
|
|
74
82
|
"./Events": {
|
|
75
83
|
"types": "./dist/Events.d.ts",
|
|
76
84
|
"import": "./dist/Events.js"
|
|
@@ -108,13 +116,13 @@
|
|
|
108
116
|
"@ast-grep/cli": "^0.43.0",
|
|
109
117
|
"@changesets/changelog-github": "^0.6.0",
|
|
110
118
|
"@changesets/cli": "^2.31.0",
|
|
111
|
-
"@effect/platform-bun": "4.0.0-beta.
|
|
119
|
+
"@effect/platform-bun": "4.0.0-beta.85",
|
|
112
120
|
"@effect/tsgo": "0.14.3",
|
|
113
|
-
"@effect/vitest": "4.0.0-beta.
|
|
121
|
+
"@effect/vitest": "4.0.0-beta.85",
|
|
114
122
|
"@types/bun": "1.3.12",
|
|
115
123
|
"@typescript/native-preview": "^7.0.0-dev.20260420.1",
|
|
116
124
|
"@vitest/coverage-v8": "4.1.5",
|
|
117
|
-
"effect": "4.0.0-beta.
|
|
125
|
+
"effect": "4.0.0-beta.85",
|
|
118
126
|
"inngest": "^4.5.1",
|
|
119
127
|
"mockttp": "^4.4.2",
|
|
120
128
|
"typescript": "^5.9.3",
|
package/src/Client.ts
CHANGED
|
@@ -17,21 +17,21 @@ export { CheckpointApiError } from "./internal/checkpoint.js";
|
|
|
17
17
|
* @category type ids
|
|
18
18
|
* @internal
|
|
19
19
|
*/
|
|
20
|
-
const TypeId: unique symbol = Symbol.for("effect-inngest/Client");
|
|
20
|
+
export const TypeId: unique symbol = Symbol.for("effect-inngest/Client");
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @since 0.1.0
|
|
24
24
|
* @category type ids
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
|
-
type TypeId = typeof TypeId;
|
|
27
|
+
export type TypeId = typeof TypeId;
|
|
28
28
|
|
|
29
29
|
const DEFAULT_EVENT_BASE_URL = "https://inn.gs/";
|
|
30
30
|
const DEFAULT_API_BASE_URL = "https://api.inngest.com/";
|
|
31
31
|
const DEFAULT_DEV_SERVER_URL = "http://localhost:8288/";
|
|
32
32
|
const SDK_VERSION = "2.0.0";
|
|
33
33
|
|
|
34
|
-
type ClientMode = "dev" | "cloud";
|
|
34
|
+
export type ClientMode = "dev" | "cloud";
|
|
35
35
|
|
|
36
36
|
export interface ClientConfig {
|
|
37
37
|
/**
|
|
@@ -147,15 +147,15 @@ const SendEventResponse = Schema.Struct({
|
|
|
147
147
|
status: Schema.optional(Schema.Number),
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
type EventPayload = typeof EventPayload.Type;
|
|
151
|
-
type SendEventResponse = typeof SendEventResponse.Type;
|
|
150
|
+
export type EventPayload = typeof EventPayload.Type;
|
|
151
|
+
export type SendEventResponse = typeof SendEventResponse.Type;
|
|
152
152
|
|
|
153
|
-
class SendEventError extends Schema.TaggedErrorClass<SendEventError>()("SendEventError", {
|
|
153
|
+
export class SendEventError extends Schema.TaggedErrorClass<SendEventError>()("SendEventError", {
|
|
154
154
|
message: Schema.String,
|
|
155
155
|
events: Schema.Array(Schema.String),
|
|
156
156
|
}) {}
|
|
157
157
|
|
|
158
|
-
interface InngestClientService {
|
|
158
|
+
export interface InngestClientService {
|
|
159
159
|
readonly [TypeId]: TypeId;
|
|
160
160
|
readonly config: ClientConfig;
|
|
161
161
|
readonly mode: ClientMode;
|
package/src/Event.ts
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
import { Predicate, Schema } from "effect";
|
|
10
10
|
import type { MakeOptions } from "effect/Schema";
|
|
11
11
|
|
|
12
|
-
const TypeId: unique symbol = Symbol.for("effect-inngest/Event");
|
|
12
|
+
export const TypeId: unique symbol = Symbol.for("effect-inngest/Event");
|
|
13
13
|
|
|
14
|
-
interface EventOptions extends MakeOptions {
|
|
14
|
+
export interface EventOptions extends MakeOptions {
|
|
15
15
|
readonly id?: string;
|
|
16
16
|
readonly ts?: number;
|
|
17
17
|
readonly v?: string;
|
package/src/Function.ts
CHANGED
|
@@ -22,7 +22,8 @@ export const TypeId: unique symbol = Symbol.for("effect-inngest/Function");
|
|
|
22
22
|
*/
|
|
23
23
|
export type TypeId = typeof TypeId;
|
|
24
24
|
|
|
25
|
-
type EventSchema = InngestEvent.EventDefinition;
|
|
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.
|
|
@@ -59,7 +60,7 @@ export type Trigger<E extends EventSchema = EventSchema> = EventTrigger<E> | Cro
|
|
|
59
60
|
*/
|
|
60
61
|
export type TriggerInput<E extends EventSchema = EventSchema> = Trigger<E> | ReadonlyArray<Trigger<E>>;
|
|
61
62
|
|
|
62
|
-
interface ConcurrencyOption {
|
|
63
|
+
export interface ConcurrencyOption {
|
|
63
64
|
/**
|
|
64
65
|
* The concurrency limit for this option, adding a limit on how many concurrent
|
|
65
66
|
* steps can execute at once.
|
|
@@ -90,7 +91,7 @@ interface ConcurrencyOption {
|
|
|
90
91
|
readonly scope?: "fn" | "env" | "account";
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
interface RateLimitOption {
|
|
94
|
+
export interface RateLimitOption {
|
|
94
95
|
/**
|
|
95
96
|
* An optional key to use for rate limiting, similar to idempotency.
|
|
96
97
|
*/
|
|
@@ -107,7 +108,7 @@ interface RateLimitOption {
|
|
|
107
108
|
readonly period: Duration.Input;
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
interface ThrottleOption {
|
|
111
|
+
export interface ThrottleOption {
|
|
111
112
|
/**
|
|
112
113
|
* An optional expression which returns a throttling key for controlling throttling.
|
|
113
114
|
* Every unique key is its own throttle limit. Event data may be used within this
|
|
@@ -135,7 +136,7 @@ interface ThrottleOption {
|
|
|
135
136
|
readonly burst?: number;
|
|
136
137
|
}
|
|
137
138
|
|
|
138
|
-
interface DebounceOption {
|
|
139
|
+
export interface DebounceOption {
|
|
139
140
|
/**
|
|
140
141
|
* An optional key to use for debouncing.
|
|
141
142
|
*/
|
|
@@ -154,7 +155,7 @@ interface DebounceOption {
|
|
|
154
155
|
readonly timeout?: Duration.Input;
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
interface BatchEventsOption {
|
|
158
|
+
export interface BatchEventsOption {
|
|
158
159
|
/**
|
|
159
160
|
* The maximum number of events to be consumed in one batch.
|
|
160
161
|
*/
|
|
@@ -178,7 +179,7 @@ interface BatchEventsOption {
|
|
|
178
179
|
readonly if?: string;
|
|
179
180
|
}
|
|
180
181
|
|
|
181
|
-
interface PriorityOption {
|
|
182
|
+
export interface PriorityOption {
|
|
182
183
|
/**
|
|
183
184
|
* An expression to use to determine the priority of a function run. The
|
|
184
185
|
* expression can return a number between `-600` and `600`, where `600`
|
|
@@ -189,7 +190,7 @@ interface PriorityOption {
|
|
|
189
190
|
readonly run?: string;
|
|
190
191
|
}
|
|
191
192
|
|
|
192
|
-
interface TimeoutsOption {
|
|
193
|
+
export interface TimeoutsOption {
|
|
193
194
|
/**
|
|
194
195
|
* Start represents the timeout for starting a function. If the time
|
|
195
196
|
* between scheduling and starting a function exceeds this value, the
|
|
@@ -208,7 +209,7 @@ interface TimeoutsOption {
|
|
|
208
209
|
readonly finish?: Duration.Input;
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
interface SingletonOption {
|
|
212
|
+
export interface SingletonOption {
|
|
212
213
|
/**
|
|
213
214
|
* An optional key expression used to scope singleton execution.
|
|
214
215
|
* Each unique key has its own singleton lock. Event data can be referenced,
|
|
@@ -224,11 +225,11 @@ interface SingletonOption {
|
|
|
224
225
|
readonly mode: "skip" | "cancel";
|
|
225
226
|
}
|
|
226
227
|
|
|
227
|
-
interface CancellationOption {
|
|
228
|
+
export interface CancellationOption {
|
|
228
229
|
/**
|
|
229
230
|
* The name of the event that should cancel the function run.
|
|
230
231
|
*/
|
|
231
|
-
readonly event:
|
|
232
|
+
readonly event: EventSchema;
|
|
232
233
|
|
|
233
234
|
/**
|
|
234
235
|
* The expression that must evaluate to true in order to cancel the function run. There
|
|
@@ -246,7 +247,7 @@ interface CancellationOption {
|
|
|
246
247
|
readonly timeout?: Duration.Input;
|
|
247
248
|
}
|
|
248
249
|
|
|
249
|
-
type Retries = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
250
|
+
export type Retries = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
250
251
|
|
|
251
252
|
/**
|
|
252
253
|
* @since 0.1.0
|
|
@@ -343,12 +344,12 @@ export interface FunctionOptions {
|
|
|
343
344
|
readonly checkpointing?: CheckpointingOption;
|
|
344
345
|
}
|
|
345
346
|
|
|
346
|
-
interface RegistrationConfig {
|
|
347
|
+
export interface RegistrationConfig {
|
|
347
348
|
readonly appId: string;
|
|
348
349
|
readonly url: string;
|
|
349
350
|
}
|
|
350
351
|
|
|
351
|
-
interface FunctionRegistration {
|
|
352
|
+
export interface FunctionRegistration {
|
|
352
353
|
readonly id: string;
|
|
353
354
|
readonly name: string;
|
|
354
355
|
readonly triggers: ReadonlyArray<{
|
|
@@ -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> =
|
|
447
|
-
export type
|
|
448
|
-
|
|
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>>;
|
|
@@ -481,7 +486,7 @@ const Proto = {
|
|
|
481
486
|
|
|
482
487
|
const opts = this.options;
|
|
483
488
|
const cancel = opts.cancelOn?.map((c) => ({
|
|
484
|
-
event: c.event,
|
|
489
|
+
event: c.event.identifier,
|
|
485
490
|
if: c.if,
|
|
486
491
|
timeout: c.timeout ? encodeDuration(c.timeout) : undefined,
|
|
487
492
|
}));
|
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 [
|
|
44
|
+
readonly [Tag in InngestFunction.Tag<Fns>]: HandlerFrom<Fns, Tag>;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|