effect-inngest 0.2.0-beta.0 → 0.3.0-beta.0
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 +89 -67
- package/dist/Client.d.ts +29 -12
- package/dist/Client.js +35 -32
- package/dist/Event.d.ts +43 -0
- package/dist/Event.js +46 -0
- package/dist/Events.d.ts +32 -35
- package/dist/Events.js +15 -12
- package/dist/Function.d.ts +17 -10
- package/dist/Function.js +22 -18
- package/dist/Group.d.ts +18 -8
- package/dist/Group.js +24 -68
- package/dist/HttpApi.d.ts +7 -7
- package/dist/HttpApi.js +8 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/internal/checkpoint/Config.d.ts +10 -0
- package/dist/internal/checkpoint/Config.js +29 -0
- package/dist/internal/checkpoint/Error.d.ts +11 -0
- package/dist/internal/checkpoint/Error.js +8 -0
- package/dist/internal/checkpoint/State.d.ts +1 -0
- package/dist/internal/checkpoint/State.js +54 -0
- package/dist/internal/checkpoint.d.ts +2 -32
- package/dist/internal/codec/EventPayload.d.ts +6 -0
- package/dist/internal/codec/EventPayload.js +60 -0
- package/dist/internal/codec/StepResult.js +55 -0
- package/dist/internal/domain/ExecutionInput.d.ts +40 -0
- package/dist/internal/domain/ExecutionInput.js +57 -0
- package/dist/internal/domain/ExecutionSuspension.d.ts +34 -0
- package/dist/internal/domain/ExecutionSuspension.js +64 -0
- package/dist/internal/domain/FunctionDefinition.js +13 -0
- package/dist/internal/domain/Memo.d.ts +22 -0
- package/dist/internal/domain/Memo.js +18 -0
- package/dist/internal/domain/StepCommand.d.ts +79 -0
- package/dist/internal/domain/StepCommand.js +124 -0
- package/dist/internal/domain/StepInfo.d.ts +12 -0
- package/dist/internal/domain/StepInfo.js +10 -0
- package/dist/internal/domain/StepInput.d.ts +10 -0
- package/dist/internal/driver.js +14 -225
- package/dist/internal/errors.d.ts +1 -21
- package/dist/internal/errors.js +2 -51
- package/dist/internal/execution/CheckpointRun.js +25 -0
- package/dist/internal/execution/ExecutionFailure.js +19 -0
- package/dist/internal/execution/ExecutionHeaders.js +58 -0
- package/dist/internal/execution/ExecutionResponse.js +68 -0
- package/dist/internal/execution/ExecutionResult.js +56 -0
- package/dist/internal/execution/ExecutionScope.js +30 -0
- package/dist/internal/execution/HandlerRun.js +16 -0
- package/dist/internal/handler.d.ts +2 -4
- package/dist/internal/handler.js +87 -82
- package/dist/internal/protocol.d.ts +120 -5
- package/dist/internal/protocol.js +313 -150
- package/dist/internal/runtime/CheckpointContext.js +5 -0
- package/dist/internal/runtime/HandlerContext.d.ts +13 -0
- package/dist/internal/runtime/HandlerContext.js +19 -0
- package/dist/internal/runtime/HandlerFiberScope.d.ts +10 -0
- package/dist/internal/runtime/HandlerFiberScope.js +5 -0
- package/dist/internal/runtime/StepCommandBus.d.ts +27 -0
- package/dist/internal/runtime/StepCommandBus.js +76 -0
- package/dist/internal/runtime/StepIdentity.d.ts +27 -0
- package/dist/internal/runtime/StepIdentity.js +46 -0
- package/dist/internal/runtime/StepTools.d.ts +83 -0
- package/dist/internal/runtime/StepTools.js +76 -0
- package/dist/internal/runtime/steps/InvokeStep.js +43 -0
- package/dist/internal/runtime/steps/SendEventStep.js +46 -0
- package/dist/internal/runtime/steps/SleepStep.js +22 -0
- package/dist/internal/runtime/steps/SleepUntilStep.js +22 -0
- package/dist/internal/runtime/steps/StepRun.js +48 -0
- package/dist/internal/runtime/steps/WaitForEventStep.js +27 -0
- package/dist/internal/serve/HttpApp.js +71 -0
- package/dist/internal/serve/Request.js +23 -0
- package/dist/internal/{signature.d.ts → serve/Signature.d.ts} +2 -5
- package/dist/internal/serve/Signature.js +123 -0
- package/dist/internal/wire/Duration.js +19 -0
- package/dist/internal/wire/Timestamp.js +14 -0
- package/package.json +17 -10
- package/src/Client.ts +69 -67
- package/src/Event.ts +107 -0
- package/src/Events.ts +50 -30
- package/src/Function.ts +58 -39
- package/src/Group.ts +54 -119
- package/src/HttpApi.ts +5 -6
- package/src/index.ts +21 -11
- package/src/internal/checkpoint/Config.ts +74 -0
- package/src/internal/checkpoint/Error.ts +6 -0
- package/src/internal/checkpoint/State.ts +107 -0
- package/src/internal/checkpoint.ts +3 -218
- package/src/internal/codec/EventPayload.ts +98 -0
- package/src/internal/codec/StepResult.ts +95 -0
- package/src/internal/domain/ExecutionInput.ts +66 -0
- package/src/internal/domain/ExecutionSuspension.ts +79 -0
- package/src/internal/domain/FunctionDefinition.ts +30 -0
- package/src/internal/domain/Memo.ts +28 -0
- package/src/internal/domain/StepCommand.ts +166 -0
- package/src/internal/domain/StepInfo.ts +8 -0
- package/src/internal/domain/StepInput.ts +10 -0
- package/src/internal/driver.ts +26 -332
- package/src/internal/errors.ts +1 -102
- package/src/internal/execution/CheckpointRun.ts +33 -0
- package/src/internal/execution/ExecutionFailure.ts +19 -0
- package/src/internal/execution/ExecutionHeaders.ts +86 -0
- package/src/internal/execution/ExecutionResponse.ts +79 -0
- package/src/internal/execution/ExecutionResult.ts +57 -0
- package/src/internal/execution/ExecutionScope.ts +41 -0
- package/src/internal/execution/HandlerRun.ts +38 -0
- package/src/internal/handler.ts +94 -87
- package/src/internal/protocol.ts +239 -72
- package/src/internal/runtime/CheckpointContext.ts +7 -0
- package/src/internal/runtime/HandlerContext.ts +21 -0
- package/src/internal/runtime/HandlerFiberScope.ts +9 -0
- package/src/internal/runtime/StepCommandBus.ts +129 -0
- package/src/internal/runtime/StepIdentity.ts +67 -0
- package/src/internal/runtime/StepTools.ts +161 -0
- package/src/internal/runtime/steps/InvokeStep.ts +71 -0
- package/src/internal/runtime/steps/SendEventStep.ts +67 -0
- package/src/internal/runtime/steps/SleepStep.ts +34 -0
- package/src/internal/runtime/steps/SleepUntilStep.ts +34 -0
- package/src/internal/runtime/steps/StepRun.ts +95 -0
- package/src/internal/runtime/steps/WaitForEventStep.ts +55 -0
- package/src/internal/serve/HttpApp.ts +123 -0
- package/src/internal/serve/Request.ts +27 -0
- package/src/internal/serve/Signature.ts +170 -0
- package/src/internal/wire/Duration.ts +31 -0
- package/src/internal/wire/Timestamp.ts +11 -0
- package/dist/internal/checkpoint.js +0 -112
- package/dist/internal/constants.js +0 -14
- package/dist/internal/driver.d.ts +0 -1
- package/dist/internal/helpers.js +0 -47
- package/dist/internal/interrupts.d.ts +0 -1
- package/dist/internal/interrupts.js +0 -43
- package/dist/internal/memo.js +0 -58
- package/dist/internal/signature.js +0 -113
- package/dist/internal/step.d.ts +0 -53
- package/dist/internal/step.js +0 -208
- package/src/internal/constants.ts +0 -11
- package/src/internal/helpers.ts +0 -58
- package/src/internal/interrupts.ts +0 -62
- package/src/internal/memo.ts +0 -88
- package/src/internal/signature.ts +0 -176
- package/src/internal/step.ts +0 -447
package/dist/Events.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EventDefinition } from "./Event.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
2
3
|
|
|
3
4
|
//#region src/Events.d.ts
|
|
4
5
|
declare namespace Events_d_exports {
|
|
@@ -15,71 +16,67 @@ declare const JsonError_base: Schema.Class<JsonError, Schema.Struct<{
|
|
|
15
16
|
* @since 0.1.0
|
|
16
17
|
*/
|
|
17
18
|
declare class JsonError extends JsonError_base {}
|
|
18
|
-
declare const FunctionFailed_base: Schema.Class<FunctionFailed, Schema.TaggedStruct<"inngest/function.failed", {
|
|
19
|
-
readonly function_id: Schema.String;
|
|
20
|
-
readonly run_id: Schema.String;
|
|
21
|
-
readonly error: typeof JsonError;
|
|
22
|
-
readonly event: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
23
|
-
}>, {}>;
|
|
24
19
|
/**
|
|
25
20
|
* Sent when a function fails after exhausting all retries.
|
|
26
21
|
* Trigger on this to handle failures (e.g., alerting, cleanup).
|
|
27
22
|
* @since 0.1.0
|
|
28
23
|
*/
|
|
29
|
-
declare
|
|
30
|
-
|
|
24
|
+
declare const FunctionFailed: EventDefinition<"inngest/function.failed", Schema.Struct<{
|
|
25
|
+
readonly function_id: Schema.String;
|
|
26
|
+
readonly run_id: Schema.String;
|
|
27
|
+
readonly error: typeof JsonError;
|
|
28
|
+
readonly event: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
29
|
+
}>>;
|
|
30
|
+
declare const FunctionFinishedError: EventDefinition<"inngest/function.finished", Schema.Struct<{
|
|
31
31
|
readonly function_id: Schema.String;
|
|
32
32
|
readonly run_id: Schema.String;
|
|
33
33
|
readonly correlation_id: Schema.optional<Schema.String>;
|
|
34
34
|
readonly error: typeof JsonError;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
* Sent when a function finishes with an error.
|
|
38
|
-
* @since 0.1.0
|
|
39
|
-
*/
|
|
40
|
-
declare class FunctionFinishedError extends FunctionFinishedError_base {}
|
|
41
|
-
declare const FunctionFinishedSuccess_base: Schema.Class<FunctionFinishedSuccess, Schema.TaggedStruct<"inngest/function.finished", {
|
|
35
|
+
}>>;
|
|
36
|
+
declare const FunctionFinishedSuccess: EventDefinition<"inngest/function.finished", Schema.Struct<{
|
|
42
37
|
readonly function_id: Schema.String;
|
|
43
38
|
readonly run_id: Schema.String;
|
|
44
39
|
readonly correlation_id: Schema.optional<Schema.String>;
|
|
45
40
|
readonly result: Schema.Unknown;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Sent when a function finishes successfully.
|
|
49
|
-
* @since 0.1.0
|
|
50
|
-
*/
|
|
51
|
-
declare class FunctionFinishedSuccess extends FunctionFinishedSuccess_base {}
|
|
41
|
+
}>>;
|
|
52
42
|
/**
|
|
53
43
|
* Union of both FunctionFinished variants.
|
|
54
44
|
* @since 0.1.0
|
|
55
45
|
*/
|
|
56
|
-
declare const FunctionFinished: Schema.Union<readonly [
|
|
57
|
-
type FunctionFinished = typeof FunctionFinished.Type;
|
|
58
|
-
declare const FunctionCancelled_base: Schema.Class<FunctionCancelled, Schema.TaggedStruct<"inngest/function.cancelled", {
|
|
46
|
+
declare const FunctionFinished: EventDefinition<"inngest/function.finished", Schema.Union<readonly [Schema.Struct<{
|
|
59
47
|
readonly function_id: Schema.String;
|
|
60
48
|
readonly run_id: Schema.String;
|
|
61
49
|
readonly correlation_id: Schema.optional<Schema.String>;
|
|
62
|
-
|
|
50
|
+
readonly error: typeof JsonError;
|
|
51
|
+
}>, Schema.Struct<{
|
|
52
|
+
readonly function_id: Schema.String;
|
|
53
|
+
readonly run_id: Schema.String;
|
|
54
|
+
readonly correlation_id: Schema.optional<Schema.String>;
|
|
55
|
+
readonly result: Schema.Unknown;
|
|
56
|
+
}>]>>;
|
|
57
|
+
type FunctionFinished = typeof FunctionFinished.Type;
|
|
63
58
|
/**
|
|
64
59
|
* Sent when a function is cancelled.
|
|
65
60
|
* @since 0.1.0
|
|
66
61
|
*/
|
|
67
|
-
declare
|
|
68
|
-
|
|
69
|
-
readonly
|
|
70
|
-
|
|
62
|
+
declare const FunctionCancelled: EventDefinition<"inngest/function.cancelled", Schema.Struct<{
|
|
63
|
+
readonly function_id: Schema.String;
|
|
64
|
+
readonly run_id: Schema.String;
|
|
65
|
+
readonly correlation_id: Schema.optional<Schema.String>;
|
|
66
|
+
}>>;
|
|
71
67
|
/**
|
|
72
68
|
* Sent when a function is invoked via step.invoke().
|
|
73
69
|
* @since 0.1.0
|
|
74
70
|
*/
|
|
75
|
-
declare
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}>, {}>;
|
|
71
|
+
declare const FunctionInvoked: EventDefinition<"inngest/function.invoked", Schema.StructWithRest<Schema.Struct<{
|
|
72
|
+
readonly _inngest: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
73
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
|
|
79
74
|
/**
|
|
80
75
|
* Sent when a cron trigger fires.
|
|
81
76
|
* @since 0.1.0
|
|
82
77
|
*/
|
|
83
|
-
declare
|
|
78
|
+
declare const ScheduledTimer: EventDefinition<"inngest/scheduled.timer", Schema.Struct<{
|
|
79
|
+
readonly cron: Schema.String;
|
|
80
|
+
}>>;
|
|
84
81
|
//#endregion
|
|
85
82
|
export { Events_d_exports, FunctionCancelled, FunctionFailed, FunctionFinished, FunctionFinishedError, FunctionFinishedSuccess, FunctionInvoked, JsonError, ScheduledTimer };
|
package/dist/Events.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
2
|
+
import { make } from "./Event.js";
|
|
3
|
+
import { Schema } from "effect";
|
|
3
4
|
//#region src/Events.ts
|
|
4
5
|
/**
|
|
5
6
|
* Internal Inngest events that the platform sends automatically.
|
|
@@ -31,55 +32,57 @@ var JsonError = class extends Schema.Class("JsonError")({
|
|
|
31
32
|
* Trigger on this to handle failures (e.g., alerting, cleanup).
|
|
32
33
|
* @since 0.1.0
|
|
33
34
|
*/
|
|
34
|
-
|
|
35
|
+
const FunctionFailed = make("inngest/function.failed", Schema.Struct({
|
|
35
36
|
function_id: Schema.String,
|
|
36
37
|
run_id: Schema.String,
|
|
37
38
|
error: JsonError,
|
|
38
39
|
event: Schema.Record(Schema.String, Schema.Unknown)
|
|
39
|
-
})
|
|
40
|
+
}));
|
|
40
41
|
/**
|
|
41
42
|
* Sent when a function finishes with an error.
|
|
42
43
|
* @since 0.1.0
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
+
const FunctionFinishedErrorData = Schema.Struct({
|
|
45
46
|
function_id: Schema.String,
|
|
46
47
|
run_id: Schema.String,
|
|
47
48
|
correlation_id: Schema.optional(Schema.String),
|
|
48
49
|
error: JsonError
|
|
49
|
-
})
|
|
50
|
+
});
|
|
51
|
+
const FunctionFinishedError = make("inngest/function.finished", FunctionFinishedErrorData);
|
|
50
52
|
/**
|
|
51
53
|
* Sent when a function finishes successfully.
|
|
52
54
|
* @since 0.1.0
|
|
53
55
|
*/
|
|
54
|
-
|
|
56
|
+
const FunctionFinishedSuccessData = Schema.Struct({
|
|
55
57
|
function_id: Schema.String,
|
|
56
58
|
run_id: Schema.String,
|
|
57
59
|
correlation_id: Schema.optional(Schema.String),
|
|
58
60
|
result: Schema.Unknown
|
|
59
|
-
})
|
|
61
|
+
});
|
|
62
|
+
const FunctionFinishedSuccess = make("inngest/function.finished", FunctionFinishedSuccessData);
|
|
60
63
|
/**
|
|
61
64
|
* Union of both FunctionFinished variants.
|
|
62
65
|
* @since 0.1.0
|
|
63
66
|
*/
|
|
64
|
-
const FunctionFinished = Schema.Union([
|
|
67
|
+
const FunctionFinished = make("inngest/function.finished", Schema.Union([FunctionFinishedErrorData, FunctionFinishedSuccessData]));
|
|
65
68
|
/**
|
|
66
69
|
* Sent when a function is cancelled.
|
|
67
70
|
* @since 0.1.0
|
|
68
71
|
*/
|
|
69
|
-
|
|
72
|
+
const FunctionCancelled = make("inngest/function.cancelled", Schema.Struct({
|
|
70
73
|
function_id: Schema.String,
|
|
71
74
|
run_id: Schema.String,
|
|
72
75
|
correlation_id: Schema.optional(Schema.String)
|
|
73
|
-
})
|
|
76
|
+
}));
|
|
74
77
|
/**
|
|
75
78
|
* Sent when a function is invoked via step.invoke().
|
|
76
79
|
* @since 0.1.0
|
|
77
80
|
*/
|
|
78
|
-
|
|
81
|
+
const FunctionInvoked = make("inngest/function.invoked", Schema.StructWithRest(Schema.Struct({ _inngest: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)) }), [Schema.Record(Schema.String, Schema.Unknown)]));
|
|
79
82
|
/**
|
|
80
83
|
* Sent when a cron trigger fires.
|
|
81
84
|
* @since 0.1.0
|
|
82
85
|
*/
|
|
83
|
-
|
|
86
|
+
const ScheduledTimer = make("inngest/scheduled.timer", Schema.Struct({ cron: Schema.String }));
|
|
84
87
|
//#endregion
|
|
85
88
|
export { Events_exports, FunctionCancelled, FunctionFailed, FunctionFinished, FunctionFinishedError, FunctionFinishedSuccess, FunctionInvoked, JsonError, ScheduledTimer };
|
package/dist/Function.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CheckpointingOption } from "./internal/checkpoint.js";
|
|
1
|
+
import { CheckpointingOption } from "./internal/checkpoint/Config.js";
|
|
2
|
+
import { EventDefinition, EventType } from "./Event.js";
|
|
2
3
|
import { Duration, Schema } from "effect";
|
|
3
4
|
import { Pipeable } from "effect/Pipeable";
|
|
4
5
|
|
|
@@ -16,9 +17,7 @@ declare const TypeId: unique symbol;
|
|
|
16
17
|
* @category type ids
|
|
17
18
|
*/
|
|
18
19
|
type TypeId = typeof TypeId;
|
|
19
|
-
type EventSchema =
|
|
20
|
-
readonly identifier: string;
|
|
21
|
-
};
|
|
20
|
+
type EventSchema = EventDefinition;
|
|
22
21
|
/**
|
|
23
22
|
* An event-based trigger configuration.
|
|
24
23
|
*
|
|
@@ -344,7 +343,11 @@ interface FunctionRegistration {
|
|
|
344
343
|
readonly period: string;
|
|
345
344
|
readonly timeout?: string;
|
|
346
345
|
};
|
|
347
|
-
readonly concurrency?:
|
|
346
|
+
readonly concurrency?: {
|
|
347
|
+
readonly key?: string;
|
|
348
|
+
readonly limit: number;
|
|
349
|
+
readonly scope?: string;
|
|
350
|
+
} | ReadonlyArray<{
|
|
348
351
|
readonly key?: string;
|
|
349
352
|
readonly limit: number;
|
|
350
353
|
readonly scope?: string;
|
|
@@ -374,7 +377,7 @@ interface FunctionRegistration {
|
|
|
374
377
|
* @since 0.1.0
|
|
375
378
|
* @category models
|
|
376
379
|
*/
|
|
377
|
-
interface InngestFunction<Tag extends string, Triggers extends Trigger, Success extends Schema.
|
|
380
|
+
interface InngestFunction<Tag extends string, Triggers extends Trigger, Success extends Schema.Codec<unknown, unknown, never, never>, Options extends FunctionOptions = FunctionOptions> extends Pipeable {
|
|
378
381
|
readonly [TypeId]: TypeId;
|
|
379
382
|
readonly _tag: Tag;
|
|
380
383
|
readonly key: string;
|
|
@@ -388,12 +391,16 @@ interface InngestFunction<Tag extends string, Triggers extends Trigger, Success
|
|
|
388
391
|
* @category models
|
|
389
392
|
*/
|
|
390
393
|
declare namespace InngestFunction {
|
|
391
|
-
type Any = InngestFunction<string, Trigger, Schema.
|
|
394
|
+
type Any = InngestFunction<string, Trigger, Schema.Codec<any, any, never, never>, FunctionOptions>;
|
|
392
395
|
type Tag<F> = F extends InngestFunction<infer T, any, any, any> ? T : never;
|
|
393
396
|
type Triggers<F> = F extends InngestFunction<any, infer T, any, any> ? T : never;
|
|
394
397
|
type Events<F> = F extends InngestFunction<any, infer T, any, any> ? (T extends EventTrigger<infer E> ? E : never) : never;
|
|
395
|
-
type
|
|
396
|
-
type
|
|
398
|
+
type EventPayload<F> = EventType<Events<F>>;
|
|
399
|
+
type EventType<F> = Options<F> extends {
|
|
400
|
+
readonly batchEvents: BatchEventsOption;
|
|
401
|
+
} ? ReadonlyArray<EventPayload<F>> : EventPayload<F>;
|
|
402
|
+
type SuccessSchema<F> = F extends InngestFunction<any, any, infer S, any> ? S : never;
|
|
403
|
+
type Success<F> = Schema.Schema.Type<SuccessSchema<F>>;
|
|
397
404
|
type Options<F> = F extends InngestFunction<any, any, any, infer O> ? O : never;
|
|
398
405
|
}
|
|
399
406
|
type NormalizeTriggers<T extends TriggerInput> = T extends ReadonlyArray<Trigger> ? T[number] : T;
|
|
@@ -430,7 +437,7 @@ type NormalizeTriggers<T extends TriggerInput> = T extends ReadonlyArray<Trigger
|
|
|
430
437
|
* })
|
|
431
438
|
* ```
|
|
432
439
|
*/
|
|
433
|
-
declare function make<const Tag extends string, T extends TriggerInput, S extends Schema.
|
|
440
|
+
declare function make<const Tag extends string, T extends TriggerInput, S extends Schema.Codec<unknown, unknown, never, never>, const O extends FunctionOptions = {}>(tag: Tag, options: {
|
|
434
441
|
readonly trigger: T;
|
|
435
442
|
readonly success: S;
|
|
436
443
|
} & O): InngestFunction<Tag, NormalizeTriggers<T>, S, O>;
|
package/dist/Function.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import { resolveConfig, toRegistration } from "./internal/checkpoint.js";
|
|
4
|
-
import { Array, Predicate } from "effect";
|
|
2
|
+
import { InngestDuration } from "./internal/wire/Duration.js";
|
|
3
|
+
import { resolveConfig, toRegistration } from "./internal/checkpoint/Config.js";
|
|
4
|
+
import { Array, Duration, Option, Predicate, Schema } from "effect";
|
|
5
5
|
import { pipeArguments } from "effect/Pipeable";
|
|
6
6
|
//#region src/Function.ts
|
|
7
7
|
/**
|
|
@@ -17,6 +17,7 @@ var Function_exports = /* @__PURE__ */ __exportAll({
|
|
|
17
17
|
*/
|
|
18
18
|
const TypeId = Symbol.for("effect-inngest/Function");
|
|
19
19
|
const isEventTrigger = (t) => Predicate.hasProperty(t, "event");
|
|
20
|
+
const encodeDuration = (input) => Schema.encodeSync(InngestDuration)(Duration.fromInputUnsafe(input));
|
|
20
21
|
const Proto = {
|
|
21
22
|
[TypeId]: TypeId,
|
|
22
23
|
pipe() {
|
|
@@ -33,33 +34,35 @@ const Proto = {
|
|
|
33
34
|
const cancel = opts.cancelOn?.map((c) => ({
|
|
34
35
|
event: c.event,
|
|
35
36
|
if: c.if,
|
|
36
|
-
timeout: c.timeout ?
|
|
37
|
+
timeout: c.timeout ? encodeDuration(c.timeout) : void 0
|
|
37
38
|
}));
|
|
38
39
|
const timeouts = opts.timeouts?.start || opts.timeouts?.finish ? {
|
|
39
|
-
start: opts.timeouts.start ?
|
|
40
|
-
finish: opts.timeouts.finish ?
|
|
40
|
+
start: opts.timeouts.start ? encodeDuration(opts.timeouts.start) : void 0,
|
|
41
|
+
finish: opts.timeouts.finish ? encodeDuration(opts.timeouts.finish) : void 0
|
|
41
42
|
} : void 0;
|
|
42
43
|
const rateLimit = opts.rateLimit ? {
|
|
43
44
|
key: opts.rateLimit.key,
|
|
44
45
|
limit: opts.rateLimit.limit,
|
|
45
|
-
period:
|
|
46
|
+
period: encodeDuration(opts.rateLimit.period)
|
|
46
47
|
} : void 0;
|
|
47
48
|
const throttle = opts.throttle ? {
|
|
48
49
|
key: opts.throttle.key,
|
|
49
50
|
limit: opts.throttle.limit,
|
|
50
|
-
period:
|
|
51
|
+
period: encodeDuration(opts.throttle.period),
|
|
51
52
|
burst: opts.throttle.burst
|
|
52
53
|
} : void 0;
|
|
53
54
|
const debounce = opts.debounce ? {
|
|
54
55
|
key: opts.debounce.key,
|
|
55
|
-
period:
|
|
56
|
-
timeout: opts.debounce.timeout ?
|
|
56
|
+
period: encodeDuration(opts.debounce.period),
|
|
57
|
+
timeout: opts.debounce.timeout ? encodeDuration(opts.debounce.timeout) : void 0
|
|
57
58
|
} : void 0;
|
|
58
|
-
const
|
|
59
|
-
key:
|
|
60
|
-
limit:
|
|
61
|
-
scope:
|
|
62
|
-
})
|
|
59
|
+
const serializeConcurrencyOption = (option) => ({
|
|
60
|
+
key: option.key,
|
|
61
|
+
limit: option.limit,
|
|
62
|
+
scope: option.scope
|
|
63
|
+
});
|
|
64
|
+
const isConcurrencyOptions = (value) => Array.isArray(value);
|
|
65
|
+
const concurrency = Option.fromNullishOr(opts.concurrency).pipe(Option.map((value) => Predicate.isNumber(value) ? { limit: value } : isConcurrencyOptions(value) ? Array.map(value, serializeConcurrencyOption) : serializeConcurrencyOption(value)), Option.getOrUndefined);
|
|
63
66
|
const priority = opts.priority ? { run: opts.priority.run } : void 0;
|
|
64
67
|
const singleton = opts.singleton ? {
|
|
65
68
|
key: opts.singleton.key,
|
|
@@ -67,11 +70,12 @@ const Proto = {
|
|
|
67
70
|
} : void 0;
|
|
68
71
|
const batchEvents = opts.batchEvents ? {
|
|
69
72
|
maxSize: opts.batchEvents.maxSize,
|
|
70
|
-
timeout:
|
|
73
|
+
timeout: encodeDuration(opts.batchEvents.timeout),
|
|
71
74
|
key: opts.batchEvents.key
|
|
72
75
|
} : void 0;
|
|
73
76
|
const idempotency = opts.idempotency;
|
|
74
|
-
const
|
|
77
|
+
const retries = Predicate.isNotUndefined(opts.retries) ? { attempts: opts.retries } : void 0;
|
|
78
|
+
const resolvedCheckpoint = Predicate.isNotUndefined(opts.checkpointing) ? resolveConfig(opts.checkpointing, void 0) : void 0;
|
|
75
79
|
const checkpoint = resolvedCheckpoint ? toRegistration(resolvedCheckpoint) : void 0;
|
|
76
80
|
const fnId = `${config.appId}-${this._tag}`;
|
|
77
81
|
const stepUrl = new URL(config.url);
|
|
@@ -88,7 +92,7 @@ const Proto = {
|
|
|
88
92
|
type: "http",
|
|
89
93
|
url: stepUrl.href
|
|
90
94
|
},
|
|
91
|
-
retries
|
|
95
|
+
retries
|
|
92
96
|
} },
|
|
93
97
|
cancel: cancel && cancel.length > 0 ? cancel : void 0,
|
|
94
98
|
timeouts,
|
package/dist/Group.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { InngestClient } from "./Client.js";
|
|
2
2
|
import { InngestFunction } from "./Function.js";
|
|
3
|
-
import { HandlerContext } from "./internal/
|
|
4
|
-
import
|
|
3
|
+
import { HandlerContext } from "./internal/runtime/HandlerContext.js";
|
|
4
|
+
import { Context, Effect, Layer } from "effect";
|
|
5
5
|
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
8
|
-
import * as Context from "effect/Context";
|
|
9
|
-
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as _$effect_unstable_http_HttpServerRequest0 from "effect/unstable/http/HttpServerRequest";
|
|
7
|
+
import * as _$effect_unstable_http_HttpServerResponse0 from "effect/unstable/http/HttpServerResponse";
|
|
10
8
|
|
|
11
9
|
//#region src/Group.d.ts
|
|
12
10
|
declare namespace Group_d_exports {
|
|
@@ -65,7 +63,7 @@ interface Handler<Tag extends string> {
|
|
|
65
63
|
* @since 0.1.0
|
|
66
64
|
* @category models
|
|
67
65
|
*/
|
|
68
|
-
type ToHandler<F extends InngestFunction.Any> = F extends InngestFunction<infer
|
|
66
|
+
type ToHandler<F extends InngestFunction.Any> = F extends InngestFunction<infer Tag, infer _Triggers, infer _Success> ? Handler<Tag> : never;
|
|
69
67
|
/**
|
|
70
68
|
* @since 0.1.0
|
|
71
69
|
* @category models
|
|
@@ -73,6 +71,10 @@ type ToHandler<F extends InngestFunction.Any> = F extends InngestFunction<infer
|
|
|
73
71
|
interface InngestGroup<Fns extends InngestFunction.Any> {
|
|
74
72
|
readonly [TypeId]: TypeId;
|
|
75
73
|
readonly functions: ReadonlyMap<string, Fns>;
|
|
74
|
+
/**
|
|
75
|
+
* Implement all handlers for the functions in this group, returning a context object.
|
|
76
|
+
*/
|
|
77
|
+
readonly toHandlers: <H extends HandlersFrom<Fns>>(handlers: H) => Effect.Effect<Context.Context<ToHandler<Fns>>, never, HandlersRequirements<H>>;
|
|
76
78
|
/**
|
|
77
79
|
* Implement all handlers for the functions in this group.
|
|
78
80
|
*/
|
|
@@ -81,6 +83,14 @@ interface InngestGroup<Fns extends InngestFunction.Any> {
|
|
|
81
83
|
* Implement a single handler from the group.
|
|
82
84
|
*/
|
|
83
85
|
readonly toLayerHandler: <Tag extends InngestFunction.Tag<Fns>, H extends HandlerFrom<Fns, Tag>>(tag: Tag, handler: H) => Layer.Layer<Handler<Tag>, never, HandlerRequirements<H>>;
|
|
86
|
+
/**
|
|
87
|
+
* Retrieve a handler for a specific function in the group.
|
|
88
|
+
*/
|
|
89
|
+
readonly accessHandler: <Tag extends InngestFunction.Tag<Fns>>(tag: Tag) => Effect.Effect<(context: HandlerContext<Extract<Fns, {
|
|
90
|
+
readonly _tag: Tag;
|
|
91
|
+
}>>) => Effect.Effect<InngestFunction.Success<Extract<Fns, {
|
|
92
|
+
readonly _tag: Tag;
|
|
93
|
+
}>>, unknown>, never, Handler<Tag>>;
|
|
84
94
|
}
|
|
85
95
|
/**
|
|
86
96
|
* @since 0.1.0
|
|
@@ -117,7 +127,7 @@ declare const make: <Fns extends ReadonlyArray<InngestFunction.Any>>(...fns: Fns
|
|
|
117
127
|
* )
|
|
118
128
|
* ```
|
|
119
129
|
*/
|
|
120
|
-
declare const toHttpApp: (group: InngestGroup.Any) => Effect.Effect<
|
|
130
|
+
declare const toHttpApp: (group: InngestGroup.Any) => Effect.Effect<_$effect_unstable_http_HttpServerResponse0.HttpServerResponse, never, InngestClient | HttpClient.HttpClient | _$effect_unstable_http_HttpServerRequest0.HttpServerRequest>;
|
|
121
131
|
/**
|
|
122
132
|
* Create a standalone web handler from an InngestGroup.
|
|
123
133
|
*
|
package/dist/Group.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import { handleExecution, handleIntrospection, handleRegistration, verifyAndParseRequestBody } from "./internal/handler.js";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
8
|
-
import * as Schema from "effect/Schema";
|
|
2
|
+
import "./internal/runtime/HandlerContext.js";
|
|
3
|
+
import { toHttpApp as toHttpApp$1, toWebHandler as toWebHandler$1 } from "./internal/serve/HttpApp.js";
|
|
4
|
+
import { Context, Effect, Layer } from "effect";
|
|
9
5
|
import "effect/unstable/http/HttpClient";
|
|
10
|
-
import * as HttpEffect from "effect/unstable/http/HttpEffect";
|
|
11
|
-
import * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
|
|
12
|
-
import * as HttpServerResponse from "effect/unstable/http/HttpServerResponse";
|
|
13
|
-
import * as UrlParams from "effect/unstable/http/UrlParams";
|
|
14
|
-
import * as Context from "effect/Context";
|
|
15
|
-
import * as Layer from "effect/Layer";
|
|
16
6
|
//#region src/Group.ts
|
|
17
7
|
var Group_exports = /* @__PURE__ */ __exportAll({
|
|
18
8
|
TypeId: () => TypeId,
|
|
@@ -27,20 +17,24 @@ var Group_exports = /* @__PURE__ */ __exportAll({
|
|
|
27
17
|
const TypeId = Symbol.for("effect-inngest/Group");
|
|
28
18
|
const Proto = {
|
|
29
19
|
[TypeId]: TypeId,
|
|
30
|
-
|
|
20
|
+
toHandlers(handlers) {
|
|
31
21
|
const functions = this.functions;
|
|
32
|
-
return
|
|
22
|
+
return Effect.gen(function* () {
|
|
33
23
|
const context = yield* Effect.context();
|
|
34
24
|
const contextMap = /* @__PURE__ */ new Map();
|
|
35
25
|
for (const [tag, handler] of Object.entries(handlers)) {
|
|
36
26
|
const fn = functions.get(tag);
|
|
37
27
|
contextMap.set(fn.key, {
|
|
28
|
+
tag: fn._tag,
|
|
38
29
|
handler,
|
|
39
30
|
context
|
|
40
31
|
});
|
|
41
32
|
}
|
|
42
33
|
return Context.makeUnsafe(contextMap);
|
|
43
|
-
})
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
toLayer(handlers) {
|
|
37
|
+
return Layer.effectContext(this.toHandlers(handlers));
|
|
44
38
|
},
|
|
45
39
|
toLayerHandler(tag, handler) {
|
|
46
40
|
const fn = this.functions.get(tag);
|
|
@@ -48,11 +42,19 @@ const Proto = {
|
|
|
48
42
|
const context = yield* Effect.context();
|
|
49
43
|
const contextMap = /* @__PURE__ */ new Map();
|
|
50
44
|
contextMap.set(fn.key, {
|
|
45
|
+
tag: fn._tag,
|
|
51
46
|
handler,
|
|
52
47
|
context
|
|
53
48
|
});
|
|
54
49
|
return Context.makeUnsafe(contextMap);
|
|
55
50
|
}));
|
|
51
|
+
},
|
|
52
|
+
accessHandler(tag) {
|
|
53
|
+
return Effect.contextWith((parentContext) => {
|
|
54
|
+
const fn = this.functions.get(tag);
|
|
55
|
+
const { handler, context } = parentContext.mapUnsafe.get(fn.key);
|
|
56
|
+
return Effect.succeed((handlerContext) => Effect.provide(handler(handlerContext), context));
|
|
57
|
+
});
|
|
56
58
|
}
|
|
57
59
|
};
|
|
58
60
|
/**
|
|
@@ -86,57 +88,8 @@ const make = (...fns) => {
|
|
|
86
88
|
* ```
|
|
87
89
|
*/
|
|
88
90
|
const toHttpApp = Effect.fn("InngestGroup.toHttpApp")(function* (group) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const requestUrl = Option.match(HttpServerRequest.toURL(request), {
|
|
92
|
-
onNone: () => request.url,
|
|
93
|
-
onSome: (url) => url.toString()
|
|
94
|
-
});
|
|
95
|
-
if (method === "GET") {
|
|
96
|
-
const result = yield* handleIntrospection(group, requestUrl);
|
|
97
|
-
return yield* HttpServerResponse.json(result.body, {
|
|
98
|
-
status: result.status,
|
|
99
|
-
headers: result.headers
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
if (method === "PUT") {
|
|
103
|
-
const result = yield* handleRegistration(group, requestUrl);
|
|
104
|
-
return yield* HttpServerResponse.json(result.body, {
|
|
105
|
-
status: result.status,
|
|
106
|
-
headers: result.headers
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
if (method === "POST") {
|
|
110
|
-
const url = yield* Option.match(HttpServerRequest.toURL(request), {
|
|
111
|
-
onNone: () => Effect.fail(HttpServerResponse.jsonUnsafe({ error: "Unable to parse request URL" }, {
|
|
112
|
-
status: 400,
|
|
113
|
-
headers: { [Headers.NoRetry]: "true" }
|
|
114
|
-
})),
|
|
115
|
-
onSome: (u) => Effect.succeed(u)
|
|
116
|
-
});
|
|
117
|
-
const ExecuteParamsSchema = UrlParams.schemaRecord.pipe(Schema.decodeTo(Schema.Struct({
|
|
118
|
-
fnId: Schema.String,
|
|
119
|
-
stepId: Schema.optional(Schema.String)
|
|
120
|
-
})));
|
|
121
|
-
const params = yield* Schema.decodeUnknownEffect(ExecuteParamsSchema)(UrlParams.fromInput(url.searchParams)).pipe(Effect.catch(() => Effect.fail(HttpServerResponse.jsonUnsafe({ error: "Missing or invalid fnId query parameter" }, {
|
|
122
|
-
status: 400,
|
|
123
|
-
headers: { [Headers.NoRetry]: "true" }
|
|
124
|
-
}))));
|
|
125
|
-
const body = yield* verifyAndParseRequestBody(request).pipe(Effect.provide(SignatureLive), Effect.catch((error) => Effect.fail(HttpServerResponse.jsonUnsafe({ error: error.message }, {
|
|
126
|
-
status: error._tag === "SignatureError" ? 401 : 400,
|
|
127
|
-
headers: { [Headers.NoRetry]: "true" }
|
|
128
|
-
}))));
|
|
129
|
-
const result = yield* handleExecution(group, params.fnId, params.stepId, body);
|
|
130
|
-
return yield* HttpServerResponse.json(result.body, {
|
|
131
|
-
status: result.status,
|
|
132
|
-
headers: result.headers
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
return yield* HttpServerResponse.json({ error: `Method ${method} not allowed` }, { status: 405 });
|
|
136
|
-
}, Effect.catchCause((cause) => HttpServerResponse.json({
|
|
137
|
-
error: "Internal server error",
|
|
138
|
-
cause: String(cause)
|
|
139
|
-
}, { status: 500 }).pipe(Effect.orDie)));
|
|
91
|
+
return yield* toHttpApp$1(group);
|
|
92
|
+
});
|
|
140
93
|
/**
|
|
141
94
|
* Create a standalone web handler from an InngestGroup.
|
|
142
95
|
*
|
|
@@ -161,6 +114,9 @@ const toHttpApp = Effect.fn("InngestGroup.toHttpApp")(function* (group) {
|
|
|
161
114
|
* process.on("SIGTERM", dispose)
|
|
162
115
|
* ```
|
|
163
116
|
*/
|
|
164
|
-
const toWebHandler = (group, options) =>
|
|
117
|
+
const toWebHandler = (group, options) => toWebHandler$1({
|
|
118
|
+
group,
|
|
119
|
+
options
|
|
120
|
+
});
|
|
165
121
|
//#endregion
|
|
166
122
|
export { Group_exports, TypeId, make, toHttpApp, toWebHandler };
|
package/dist/HttpApi.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { InngestClient } from "./Client.js";
|
|
2
2
|
import { InngestGroup } from "./Group.js";
|
|
3
|
-
import { SignatureError } from "./internal/
|
|
3
|
+
import { SignatureError } from "./internal/serve/Signature.js";
|
|
4
4
|
import { InvalidRequestError } from "./internal/handler.js";
|
|
5
|
-
import
|
|
5
|
+
import { Layer, Schema } from "effect";
|
|
6
6
|
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
7
|
-
import * as Layer from "effect/Layer";
|
|
8
|
-
import * as _$effect_Cause0 from "effect/Cause";
|
|
9
7
|
import * as HttpApi from "effect/unstable/httpapi/HttpApi";
|
|
10
8
|
import * as HttpApiEndpoint from "effect/unstable/httpapi/HttpApiEndpoint";
|
|
11
9
|
import * as HttpApiGroup from "effect/unstable/httpapi/HttpApiGroup";
|
|
10
|
+
import * as _$effect_Cause0 from "effect/Cause";
|
|
12
11
|
|
|
13
12
|
//#region src/HttpApi.d.ts
|
|
14
13
|
declare namespace HttpApi_d_exports {
|
|
@@ -22,7 +21,7 @@ declare const InngestApiGroup_base: HttpApiGroup.HttpApiGroup<"inngest", HttpApi
|
|
|
22
21
|
readonly function_count: Schema.Number;
|
|
23
22
|
readonly has_event_key: Schema.Boolean;
|
|
24
23
|
readonly has_signing_key: Schema.Boolean;
|
|
25
|
-
readonly has_signing_key_fallback: Schema.Boolean
|
|
24
|
+
readonly has_signing_key_fallback: Schema.optional<Schema.Boolean>;
|
|
26
25
|
readonly mode: Schema.Literals<readonly ["cloud", "dev"]>;
|
|
27
26
|
readonly schema_version: Schema.Literal<"2024-05-24">;
|
|
28
27
|
readonly extra: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
@@ -43,11 +42,12 @@ declare const InngestApiGroup_base: HttpApiGroup.HttpApiGroup<"inngest", HttpApi
|
|
|
43
42
|
readonly function_count: Schema.Number;
|
|
44
43
|
readonly has_event_key: Schema.Boolean;
|
|
45
44
|
readonly has_signing_key: Schema.Boolean;
|
|
46
|
-
readonly has_signing_key_fallback: Schema.Boolean
|
|
45
|
+
readonly has_signing_key_fallback: Schema.optional<Schema.Boolean>;
|
|
47
46
|
readonly mode: Schema.Literals<readonly ["cloud", "dev"]>;
|
|
48
47
|
readonly schema_version: Schema.Literal<"2024-05-24">;
|
|
49
48
|
readonly extra: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
50
|
-
readonly authentication_succeeded: Schema.Union<readonly [Schema.Literal<false>, Schema.Null]
|
|
49
|
+
readonly authentication_succeeded: Schema.optional<Schema.Union<readonly [Schema.Literal<false>, Schema.Null]>>;
|
|
50
|
+
readonly capabilities: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
51
51
|
readonly functions: Schema.optionalKey<Schema.$Array<Schema.Unknown>>;
|
|
52
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<{
|
|
53
53
|
readonly message: Schema.String;
|
package/dist/HttpApi.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { IntrospectionResponse, RegisterResponse } from "./internal/protocol.js";
|
|
3
|
-
import { SignatureError, SignatureLive } from "./internal/
|
|
3
|
+
import { SignatureError, SignatureLive } from "./internal/serve/Signature.js";
|
|
4
4
|
import { InvalidRequestError, handleExecution, handleIntrospection, handleRegistration, verifyAndParseRequestBody } from "./internal/handler.js";
|
|
5
|
-
import
|
|
6
|
-
import * as Option from "effect/Option";
|
|
7
|
-
import * as Schema from "effect/Schema";
|
|
5
|
+
import { Effect, Layer, Option, Schema } from "effect";
|
|
8
6
|
import "effect/unstable/http/HttpClient";
|
|
9
7
|
import * as HttpServerRequest from "effect/unstable/http/HttpServerRequest";
|
|
10
|
-
import * as Layer from "effect/Layer";
|
|
11
8
|
import "effect/unstable/httpapi/HttpApi";
|
|
12
9
|
import * as HttpApiBuilder from "effect/unstable/httpapi/HttpApiBuilder";
|
|
13
10
|
import * as HttpApiEndpoint from "effect/unstable/httpapi/HttpApiEndpoint";
|
|
@@ -55,7 +52,12 @@ const layerGroup = (api, group) => {
|
|
|
55
52
|
onSome: (url) => url.toString()
|
|
56
53
|
});
|
|
57
54
|
return HttpApiBuilder.group(api, "inngest", Effect.fn(function* (handlers) {
|
|
58
|
-
return handlers.handle("introspect", ({ request }) => handleIntrospection(group, toUrl(request)).pipe(Effect.map((r) => r.body))).handle("register", ({ request }) => handleRegistration(group, toUrl(request)).pipe(Effect.map((r) => r.body))).handleRaw("execute", ({ query, request }) => verifyAndParseRequestBody(request).pipe(Effect.flatMap((payload) => handleExecution(
|
|
55
|
+
return handlers.handle("introspect", ({ request }) => handleIntrospection(group, toUrl(request)).pipe(Effect.map((r) => r.body))).handle("register", ({ request }) => handleRegistration(group, toUrl(request)).pipe(Effect.map((r) => r.body))).handleRaw("execute", ({ query, request }) => verifyAndParseRequestBody(request).pipe(Effect.flatMap((payload) => handleExecution({
|
|
56
|
+
group,
|
|
57
|
+
fnId: query.fnId,
|
|
58
|
+
urlStepId: query.stepId,
|
|
59
|
+
body: payload
|
|
60
|
+
})), Effect.map((r) => r.body)));
|
|
59
61
|
})).pipe(Layer.provide(SignatureLive));
|
|
60
62
|
};
|
|
61
63
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Client_d_exports } from "./Client.js";
|
|
2
|
+
import { Event_d_exports } from "./Event.js";
|
|
2
3
|
import { Events_d_exports } from "./Events.js";
|
|
3
4
|
import { Function_d_exports } from "./Function.js";
|
|
4
5
|
import { NonRetriableError, RetryAfterError } from "./internal/errors.js";
|
|
5
6
|
import { Group_d_exports } from "./Group.js";
|
|
6
7
|
import { HttpApi_d_exports } from "./HttpApi.js";
|
|
7
|
-
export { Client_d_exports as InngestClient, Events_d_exports as InngestEvents, Function_d_exports as InngestFunction, Group_d_exports as InngestGroup, HttpApi_d_exports as InngestHttpApi, NonRetriableError, RetryAfterError };
|
|
8
|
+
export { Client_d_exports as InngestClient, Event_d_exports as InngestEvent, Events_d_exports as InngestEvents, Function_d_exports as InngestFunction, Group_d_exports as InngestGroup, HttpApi_d_exports as InngestHttpApi, NonRetriableError, RetryAfterError };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Function_exports } from "./Function.js";
|
|
2
|
+
import { Event_exports } from "./Event.js";
|
|
2
3
|
import { Client_exports } from "./Client.js";
|
|
3
4
|
import { NonRetriableError, RetryAfterError } from "./internal/errors.js";
|
|
5
|
+
import { Events_exports } from "./Events.js";
|
|
4
6
|
import { Group_exports } from "./Group.js";
|
|
5
7
|
import { HttpApi_exports } from "./HttpApi.js";
|
|
6
|
-
|
|
7
|
-
export { Client_exports as InngestClient, Events_exports as InngestEvents, Function_exports as InngestFunction, Group_exports as InngestGroup, HttpApi_exports as InngestHttpApi, NonRetriableError, RetryAfterError };
|
|
8
|
+
export { Client_exports as InngestClient, Event_exports as InngestEvent, Events_exports as InngestEvents, Function_exports as InngestFunction, Group_exports as InngestGroup, HttpApi_exports as InngestHttpApi, NonRetriableError, RetryAfterError };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Duration } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/internal/checkpoint/Config.d.ts
|
|
4
|
+
type CheckpointingOption = boolean | {
|
|
5
|
+
readonly bufferedSteps?: number;
|
|
6
|
+
readonly maxInterval?: Duration.Input;
|
|
7
|
+
readonly maxRuntime?: Duration.Input;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { CheckpointingOption };
|