inngest 2.7.1 → 3.0.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/CHANGELOG.md +52 -0
- package/api/api.js +4 -4
- package/api/schema.d.ts +54 -6
- package/api/schema.d.ts.map +1 -1
- package/api/schema.js +17 -7
- package/api/schema.js.map +1 -1
- package/cloudflare.d.ts +6 -3
- package/cloudflare.d.ts.map +1 -1
- package/cloudflare.js +19 -41
- package/cloudflare.js.map +1 -1
- package/components/EventSchemas.d.ts +1 -12
- package/components/EventSchemas.d.ts.map +1 -1
- package/components/EventSchemas.js.map +1 -1
- package/components/Inngest.d.ts +44 -57
- package/components/Inngest.d.ts.map +1 -1
- package/components/Inngest.js +91 -59
- package/components/Inngest.js.map +1 -1
- package/components/InngestCommHandler.d.ts +156 -198
- package/components/InngestCommHandler.d.ts.map +1 -1
- package/components/InngestCommHandler.js +311 -305
- package/components/InngestCommHandler.js.map +1 -1
- package/components/InngestFunction.d.ts +9 -82
- package/components/InngestFunction.d.ts.map +1 -1
- package/components/InngestFunction.js +21 -413
- package/components/InngestFunction.js.map +1 -1
- package/components/InngestMiddleware.d.ts +37 -26
- package/components/InngestMiddleware.d.ts.map +1 -1
- package/components/InngestMiddleware.js +1 -3
- package/components/InngestMiddleware.js.map +1 -1
- package/components/InngestStepTools.d.ts +69 -37
- package/components/InngestStepTools.d.ts.map +1 -1
- package/components/InngestStepTools.js +34 -95
- package/components/InngestStepTools.js.map +1 -1
- package/components/NonRetriableError.d.ts.map +1 -1
- package/components/NonRetriableError.js +1 -0
- package/components/NonRetriableError.js.map +1 -1
- package/components/RetryAfterError.d.ts +38 -0
- package/components/RetryAfterError.d.ts.map +1 -0
- package/components/RetryAfterError.js +42 -0
- package/components/RetryAfterError.js.map +1 -0
- package/components/execution/InngestExecution.d.ts +72 -0
- package/components/execution/InngestExecution.d.ts.map +1 -0
- package/components/execution/InngestExecution.js +23 -0
- package/components/execution/InngestExecution.js.map +1 -0
- package/components/execution/v0.d.ts +114 -0
- package/components/execution/v0.d.ts.map +1 -0
- package/components/execution/v0.js +394 -0
- package/components/execution/v0.js.map +1 -0
- package/components/execution/v1.d.ts +88 -0
- package/components/execution/v1.d.ts.map +1 -0
- package/components/execution/v1.js +673 -0
- package/components/execution/v1.js.map +1 -0
- package/deno/fresh.d.ts +3 -3
- package/deno/fresh.d.ts.map +1 -1
- package/deno/fresh.js +17 -38
- package/deno/fresh.js.map +1 -1
- package/digitalocean.d.ts +5 -5
- package/digitalocean.d.ts.map +1 -1
- package/digitalocean.js +14 -46
- package/digitalocean.js.map +1 -1
- package/edge.d.ts +5 -5
- package/edge.d.ts.map +1 -1
- package/edge.js +16 -38
- package/edge.js.map +1 -1
- package/express.d.ts +7 -3
- package/express.d.ts.map +1 -1
- package/express.js +38 -45
- package/express.js.map +1 -1
- package/fastify.d.ts +8 -3
- package/fastify.d.ts.map +1 -1
- package/fastify.js +37 -47
- package/fastify.js.map +1 -1
- package/h3.d.ts +4 -3
- package/h3.d.ts.map +1 -1
- package/h3.js +18 -45
- package/h3.js.map +1 -1
- package/helpers/ServerTiming.d.ts.map +1 -1
- package/helpers/ServerTiming.js +2 -1
- package/helpers/ServerTiming.js.map +1 -1
- package/helpers/consts.d.ts +23 -9
- package/helpers/consts.d.ts.map +1 -1
- package/helpers/consts.js +31 -13
- package/helpers/consts.js.map +1 -1
- package/helpers/devserver.d.ts +0 -34
- package/helpers/devserver.d.ts.map +1 -1
- package/helpers/devserver.js.map +1 -1
- package/helpers/env.d.ts +14 -6
- package/helpers/env.d.ts.map +1 -1
- package/helpers/env.js +4 -4
- package/helpers/env.js.map +1 -1
- package/helpers/errors.d.ts +37 -2
- package/helpers/errors.d.ts.map +1 -1
- package/helpers/errors.js +66 -15
- package/helpers/errors.js.map +1 -1
- package/helpers/functions.d.ts +52 -5
- package/helpers/functions.d.ts.map +1 -1
- package/helpers/functions.js +121 -22
- package/helpers/functions.js.map +1 -1
- package/helpers/promises.d.ts +45 -0
- package/helpers/promises.d.ts.map +1 -1
- package/helpers/promises.js +69 -1
- package/helpers/promises.js.map +1 -1
- package/helpers/strings.d.ts +6 -1
- package/helpers/strings.d.ts.map +1 -1
- package/helpers/strings.js +7 -2
- package/helpers/strings.js.map +1 -1
- package/helpers/types.d.ts +5 -17
- package/helpers/types.d.ts.map +1 -1
- package/index.d.ts +4 -2
- package/index.d.ts.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/lambda.d.ts +10 -8
- package/lambda.d.ts.map +1 -1
- package/lambda.js +48 -72
- package/lambda.js.map +1 -1
- package/next.d.ts +11 -5
- package/next.d.ts.map +1 -1
- package/next.js +84 -103
- package/next.js.map +1 -1
- package/nuxt.d.ts +3 -3
- package/nuxt.d.ts.map +1 -1
- package/nuxt.js +5 -6
- package/nuxt.js.map +1 -1
- package/package.json +5 -4
- package/redwood.d.ts +4 -3
- package/redwood.d.ts.map +1 -1
- package/redwood.js +22 -48
- package/redwood.js.map +1 -1
- package/remix.d.ts +7 -5
- package/remix.d.ts.map +1 -1
- package/remix.js +15 -36
- package/remix.js.map +1 -1
- package/types.d.ts +150 -218
- package/types.d.ts.map +1 -1
- package/types.js +38 -45
- package/types.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/helpers/scalar.d.ts +0 -8
- package/helpers/scalar.d.ts.map +0 -1
- package/helpers/scalar.js +0 -19
- package/helpers/scalar.js.map +0 -1
package/helpers/promises.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveNextTick = exports.resolveAfterPending = exports.createFrozenPromise = void 0;
|
|
3
|
+
exports.resolveNextTick = exports.runAsPromise = exports.createTimeoutPromise = exports.createDeferredPromise = exports.resolveAfterPending = exports.createFrozenPromise = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Some environments don't allow access to the global queueMicrotask(). While we
|
|
6
6
|
* had assumed this was only true for those powered by earlier versions of Node
|
|
@@ -61,6 +61,74 @@ const resolveAfterPending = () => {
|
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
63
|
exports.resolveAfterPending = resolveAfterPending;
|
|
64
|
+
/**
|
|
65
|
+
* Creates and returns Promise that can be resolved or rejected with the
|
|
66
|
+
* returned `resolve` and `reject` functions.
|
|
67
|
+
*
|
|
68
|
+
* Resolving or rejecting the function will return a new set of Promise control
|
|
69
|
+
* functions. These can be ignored if the original Promise is all that's needed.
|
|
70
|
+
*/
|
|
71
|
+
const createDeferredPromise = () => {
|
|
72
|
+
let resolve;
|
|
73
|
+
let reject;
|
|
74
|
+
const promise = new Promise((_resolve, _reject) => {
|
|
75
|
+
resolve = (value) => {
|
|
76
|
+
_resolve(value);
|
|
77
|
+
return (0, exports.createDeferredPromise)();
|
|
78
|
+
};
|
|
79
|
+
reject = (reason) => {
|
|
80
|
+
_reject(reason);
|
|
81
|
+
return (0, exports.createDeferredPromise)();
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
85
|
+
return { promise, resolve: resolve, reject: reject };
|
|
86
|
+
};
|
|
87
|
+
exports.createDeferredPromise = createDeferredPromise;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a Promise that will resolve after the given duration, along with
|
|
90
|
+
* methods to start, clear, and reset the timeout.
|
|
91
|
+
*/
|
|
92
|
+
const createTimeoutPromise = (duration) => {
|
|
93
|
+
const { promise, resolve } = (0, exports.createDeferredPromise)();
|
|
94
|
+
let timeout;
|
|
95
|
+
// eslint-disable-next-line prefer-const
|
|
96
|
+
let ret;
|
|
97
|
+
const start = () => {
|
|
98
|
+
if (timeout)
|
|
99
|
+
return ret;
|
|
100
|
+
timeout = setTimeout(() => {
|
|
101
|
+
resolve();
|
|
102
|
+
}, duration);
|
|
103
|
+
return ret;
|
|
104
|
+
};
|
|
105
|
+
const clear = () => {
|
|
106
|
+
clearTimeout(timeout);
|
|
107
|
+
timeout = undefined;
|
|
108
|
+
};
|
|
109
|
+
const reset = () => {
|
|
110
|
+
clear();
|
|
111
|
+
return start();
|
|
112
|
+
};
|
|
113
|
+
ret = Object.assign(promise, { start, clear, reset });
|
|
114
|
+
return ret;
|
|
115
|
+
};
|
|
116
|
+
exports.createTimeoutPromise = createTimeoutPromise;
|
|
117
|
+
/**
|
|
118
|
+
* Take any function and safely promisify such that both synchronous and
|
|
119
|
+
* asynchronous errors are caught and returned as a rejected Promise.
|
|
120
|
+
*
|
|
121
|
+
* The passed `fn` can be undefined to support functions that may conditionally
|
|
122
|
+
* be defined.
|
|
123
|
+
*/
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
|
+
const runAsPromise = (fn
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
+
) => {
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
129
|
+
return Promise.resolve().then(fn);
|
|
130
|
+
};
|
|
131
|
+
exports.runAsPromise = runAsPromise;
|
|
64
132
|
/**
|
|
65
133
|
* Returns a Promise that resolve after the current event loop tick.
|
|
66
134
|
*/
|
package/helpers/promises.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promises.js","sourceRoot":"","sources":["../../src/helpers/promises.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,kBAAkB,GAAG,CAAC,QAAoB,EAAQ,EAAE;IACxD,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACI,MAAM,mBAAmB,GAAG,GAAqB,EAAE;IACxD,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF;;;GAGG;AACI,MAAM,mBAAmB,GA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G,UAAU,CAAC,GAAG,EAAE;YACxB,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,QAAQ,CAAC,CAAC;QAEb,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,GAAG,SAAS,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,KAAK,EAAE,CAAC;QACR,OAAO,KAAK,EAAE,CAAC;IACjB,CAAC,CAAC;IAEF,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAEtD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AA9BW,QAAA,oBAAoB,wBA8B/B;AAEF;;;;;;GAMG;AACH,8DAA8D;AACvD,MAAM,YAAY,GAAG,CAC1B,EAAK;AACL,8DAA8D;EACH,EAAE;IAC7D,+DAA+D;IAC/D,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB;AAEF;;GAEG;AACI,MAAM,eAAe,GAAG,GAAkB,EAAE;IACjD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B"}
|
package/helpers/strings.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export { default as stringify } from "json-stringify-safe";
|
|
2
2
|
/**
|
|
3
|
-
* Returns a slugified string used
|
|
3
|
+
* Returns a slugified string used to generate consistent IDs.
|
|
4
|
+
*
|
|
5
|
+
* This can be used to generate a consistent ID for a function when migrating
|
|
6
|
+
* from v2 to v3 of the SDK.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
4
9
|
*/
|
|
5
10
|
export declare const slugify: (str: string) => string;
|
|
6
11
|
/**
|
package/helpers/strings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE3D
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,MASrC,CAAC;AAqBF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,UAIX,MAAM,GAAG,MAAM,GAAG,IAAI,KAC5B,MAqBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAW,OAAO,KAAG,MAAM,GAAG,SAQ1D,CAAC;AAEF,eAAO,MAAM,cAAc,eAAgB,MAAM,GAAG,SAAS,KAAG,MAU/D,CAAC"}
|
package/helpers/strings.js
CHANGED
|
@@ -4,12 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.hashSigningKey = exports.stringifyUnknown = exports.timeStr = exports.slugify = exports.stringify = void 0;
|
|
7
|
-
const ms_1 = __importDefault(require("ms"));
|
|
8
7
|
const hash_js_1 = require("hash.js");
|
|
8
|
+
const ms_1 = __importDefault(require("ms"));
|
|
9
9
|
var json_stringify_safe_1 = require("json-stringify-safe");
|
|
10
10
|
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return __importDefault(json_stringify_safe_1).default; } });
|
|
11
11
|
/**
|
|
12
|
-
* Returns a slugified string used
|
|
12
|
+
* Returns a slugified string used to generate consistent IDs.
|
|
13
|
+
*
|
|
14
|
+
* This can be used to generate a consistent ID for a function when migrating
|
|
15
|
+
* from v2 to v3 of the SDK.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
13
18
|
*/
|
|
14
19
|
const slugify = (str) => {
|
|
15
20
|
const join = "-";
|
package/helpers/strings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAiC;AACjC,4CAAoB;AAEpB,2DAA2D;AAAlD,iIAAA,OAAO,OAAa;AAE7B;;;;;;;GAOG;AACI,MAAM,OAAO,GAAG,CAAC,GAAW,EAAU,EAAE;IAC7C,MAAM,IAAI,GAAG,GAAG,CAAC;IACjB,OAAO,GAAG;SACP,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC;SAC7B,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;SACpB,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AATW,QAAA,OAAO,WASlB;AAEF,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;AAClC,MAAM,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC;AAC3B,MAAM,IAAI,GAAG,MAAM,GAAG,EAAE,CAAC;AACzB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;AACtB,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AAErB;;;GAGG;AACH,MAAM,OAAO,GAAG;IACd,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,G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C,UAA8B,EAAU,EAAE;;IACvE,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,EAAE,CAAC;KACX;IAED,MAAM,MAAM,GAAG,CAAA,MAAA,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,0CAAE,KAAK,EAAE,KAAI,EAAE,CAAC;IAClE,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAEtD,+DAA+D;IAC/D,OAAO,GAAG,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACjE,CAAC,CAAC;AAVW,QAAA,cAAc,kBAUzB"}
|
package/helpers/types.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { type Simplify } from "type-fest";
|
|
2
2
|
import { type EventPayload } from "../types";
|
|
3
|
-
/**
|
|
4
|
-
* Returns a union of all of the values in a given object, regardless of key.
|
|
5
|
-
*/
|
|
6
|
-
export type ValueOf<T> = T extends Record<string, unknown> ? {
|
|
7
|
-
[K in keyof T]: T[K];
|
|
8
|
-
}[keyof T] : never;
|
|
9
3
|
/**
|
|
10
4
|
* Returns the given generic as either itself or an array of itself.
|
|
11
5
|
*/
|
|
@@ -26,10 +20,6 @@ export type PartialK<T, K extends PropertyKey = PropertyKey> = Partial<Pick<T, E
|
|
|
26
20
|
export type SendEventPayload<Events extends Record<string, EventPayload>> = SingleOrArray<{
|
|
27
21
|
[K in keyof Events]: PartialK<Omit<Events[K], "v">, "ts">;
|
|
28
22
|
}[keyof Events]>;
|
|
29
|
-
/**
|
|
30
|
-
* Retrieve an event's name based on the given payload. Defaults to `string`.
|
|
31
|
-
*/
|
|
32
|
-
export type EventName<Event extends EventPayload> = Event extends EventPayload ? Event["name"] : string;
|
|
33
23
|
/**
|
|
34
24
|
* A list of simple, JSON-compatible, primitive types that contain no other
|
|
35
25
|
* values.
|
|
@@ -55,13 +45,6 @@ type Path<T> = T extends Array<infer V> ? StringPath<number, V> : {
|
|
|
55
45
|
* paths of known objects.
|
|
56
46
|
*/
|
|
57
47
|
export type ObjectPaths<T extends Record<string, any>> = Path<T>;
|
|
58
|
-
/**
|
|
59
|
-
* Filter out all keys from `T` where the associated value does not match type
|
|
60
|
-
* `U`.
|
|
61
|
-
*/
|
|
62
|
-
export type KeysNotOfType<T, U> = {
|
|
63
|
-
[P in keyof T]: T[P] extends U ? never : P;
|
|
64
|
-
}[keyof T];
|
|
65
48
|
/**
|
|
66
49
|
* Returns all keys from objects in the union `T`.
|
|
67
50
|
*
|
|
@@ -156,5 +139,10 @@ export type ExclusiveKeys<T, Keys1 extends keyof T, Keys2 extends keyof T> = (Om
|
|
|
156
139
|
* types and unique properties are marked as optional.
|
|
157
140
|
*/
|
|
158
141
|
export type Either<A, B> = Partial<A> & Partial<B> & (A | B);
|
|
142
|
+
/**
|
|
143
|
+
* Given a function `T`, return the parameters of that function, except for the
|
|
144
|
+
* first one.
|
|
145
|
+
*/
|
|
146
|
+
export type ParametersExceptFirst<T> = T extends (arg0: any, ...rest: infer U) => any ? U : never;
|
|
159
147
|
export {};
|
|
160
148
|
//# sourceMappingURL=types.d.ts.map
|
package/helpers/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/helpers/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/helpers/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC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MAAM,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,IAAI,IAAI,SAAS;IACvD,MAAM,MAAM;IACZ,GAAG,MAAM,KAAK;CACf,GACG,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,GAChE,IAAI,CAAC;AAET;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,CAAC,EAAE,KAAK,SAAS,MAAM,CAAC,IACrE,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG;KAAG,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK;CAAE,CAAC,GAC3C,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG;KAAG,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK;CAAE,CAAC,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,CAE/C,IAAI,EAAE,GAAG,EACT,GAAG,IAAI,EAAE,MAAM,CAAC,KAElB,GAAG,GACC,CAAC,GACD,KAAK,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -2,13 +2,15 @@ export { EventSchemas, type Combine, type LiteralZodEventSchema, type StandardEv
|
|
|
2
2
|
export { Inngest } from "./components/Inngest";
|
|
3
3
|
export type { EventsFromOpts } from "./components/Inngest";
|
|
4
4
|
export { InngestCommHandler } from "./components/InngestCommHandler";
|
|
5
|
-
export type {
|
|
5
|
+
export type { ServeHandlerOptions } from "./components/InngestCommHandler";
|
|
6
6
|
export { InngestMiddleware } from "./components/InngestMiddleware";
|
|
7
7
|
export type { MiddlewareOptions, MiddlewareRegisterFn, MiddlewareRegisterReturn, } from "./components/InngestMiddleware";
|
|
8
8
|
export { NonRetriableError } from "./components/NonRetriableError";
|
|
9
|
+
export { RetryAfterError } from "./components/RetryAfterError";
|
|
9
10
|
export { headerKeys, internalEvents, queryKeys } from "./helpers/consts";
|
|
11
|
+
export { slugify } from "./helpers/strings";
|
|
10
12
|
export type { IsStringLiteral, StrictUnion, StrictUnionHelper, UnionKeys, } from "./helpers/types";
|
|
11
13
|
export { ProxyLogger } from "./middleware/logger";
|
|
12
14
|
export type { LogArg } from "./middleware/logger";
|
|
13
|
-
export type { ClientOptions, EventNameFromTrigger, EventPayload, FailureEventArgs, FailureEventPayload, FunctionOptions, GetEvents, LogLevel, RegisterOptions, TimeStr, TriggerOptions, } from "./types";
|
|
15
|
+
export type { ClientOptions, EventNameFromTrigger, EventPayload, FailureEventArgs, FailureEventPayload, FunctionOptions, GetEvents, LogLevel, RegisterOptions, StepOptions, StepOptionsOrId, TimeStr, TriggerOptions, } from "./types";
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,QAAQ,EACR,eAAe,EACf,WAAW,EACX,eAAe,EACf,OAAO,EACP,cAAc,GACf,MAAM,SAAS,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProxyLogger = exports.queryKeys = exports.internalEvents = exports.headerKeys = exports.NonRetriableError = exports.InngestMiddleware = exports.InngestCommHandler = exports.Inngest = exports.EventSchemas = void 0;
|
|
3
|
+
exports.ProxyLogger = exports.slugify = exports.queryKeys = exports.internalEvents = exports.headerKeys = exports.RetryAfterError = exports.NonRetriableError = exports.InngestMiddleware = exports.InngestCommHandler = exports.Inngest = exports.EventSchemas = void 0;
|
|
4
4
|
var EventSchemas_1 = require("./components/EventSchemas");
|
|
5
5
|
Object.defineProperty(exports, "EventSchemas", { enumerable: true, get: function () { return EventSchemas_1.EventSchemas; } });
|
|
6
6
|
var Inngest_1 = require("./components/Inngest");
|
|
@@ -11,10 +11,14 @@ var InngestMiddleware_1 = require("./components/InngestMiddleware");
|
|
|
11
11
|
Object.defineProperty(exports, "InngestMiddleware", { enumerable: true, get: function () { return InngestMiddleware_1.InngestMiddleware; } });
|
|
12
12
|
var NonRetriableError_1 = require("./components/NonRetriableError");
|
|
13
13
|
Object.defineProperty(exports, "NonRetriableError", { enumerable: true, get: function () { return NonRetriableError_1.NonRetriableError; } });
|
|
14
|
+
var RetryAfterError_1 = require("./components/RetryAfterError");
|
|
15
|
+
Object.defineProperty(exports, "RetryAfterError", { enumerable: true, get: function () { return RetryAfterError_1.RetryAfterError; } });
|
|
14
16
|
var consts_1 = require("./helpers/consts");
|
|
15
17
|
Object.defineProperty(exports, "headerKeys", { enumerable: true, get: function () { return consts_1.headerKeys; } });
|
|
16
18
|
Object.defineProperty(exports, "internalEvents", { enumerable: true, get: function () { return consts_1.internalEvents; } });
|
|
17
19
|
Object.defineProperty(exports, "queryKeys", { enumerable: true, get: function () { return consts_1.queryKeys; } });
|
|
20
|
+
var strings_1 = require("./helpers/strings");
|
|
21
|
+
Object.defineProperty(exports, "slugify", { enumerable: true, get: function () { return strings_1.slugify; } });
|
|
18
22
|
var logger_1 = require("./middleware/logger");
|
|
19
23
|
Object.defineProperty(exports, "ProxyLogger", { enumerable: true, get: function () { return logger_1.ProxyLogger; } });
|
|
20
24
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0DAOmC;AANjC,4GAAA,YAAY,OAAA;AAOd,gDAA+C;AAAtC,kGAAA,OAAO,OAAA;AAEhB,sEAAqE;AAA5D,wHAAA,kBAAkB,OAAA;AAE3B,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAM1B,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAC1B,2CAAyE;AAAhE,oGAAA,UAAU,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,mGAAA,SAAS,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0DAOmC;AANjC,4GAAA,YAAY,OAAA;AAOd,gDAA+C;AAAtC,kGAAA,OAAO,OAAA;AAEhB,sEAAqE;AAA5D,wHAAA,kBAAkB,OAAA;AAE3B,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAM1B,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAC1B,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AACxB,2CAAyE;AAAhE,oGAAA,UAAU,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,mGAAA,SAAS,OAAA;AAC9C,6CAA4C;AAAnC,kGAAA,OAAO,OAAA;AAOhB,8CAAkD;AAAzC,qGAAA,WAAW,OAAA"}
|
package/lambda.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type APIGatewayProxyEventV2, type APIGatewayProxyResult, type Context } from "aws-lambda";
|
|
2
|
+
import { type ServeHandlerOptions } from "./components/InngestCommHandler";
|
|
3
|
+
import { type Either } from "./helpers/types";
|
|
2
4
|
import { type SupportedFrameworkName } from "./types";
|
|
3
|
-
export declare const
|
|
5
|
+
export declare const frameworkName: SupportedFrameworkName;
|
|
4
6
|
/**
|
|
5
7
|
* With AWS Lambda, serve and register any declared functions with Inngest,
|
|
6
8
|
* making them available to be triggered by events.
|
|
@@ -11,20 +13,20 @@ export declare const name: SupportedFrameworkName;
|
|
|
11
13
|
* import { Inngest } from "inngest";
|
|
12
14
|
* import { serve } from "inngest/lambda";
|
|
13
15
|
*
|
|
14
|
-
* const inngest = new Inngest({
|
|
16
|
+
* const inngest = new Inngest({ id: "my-lambda-app" });
|
|
15
17
|
*
|
|
16
18
|
* const fn = inngest.createFunction(
|
|
17
|
-
* {
|
|
19
|
+
* { id: "hello-world" },
|
|
18
20
|
* { event: "test/hello.world" },
|
|
19
21
|
* async ({ event }) => {
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
+
* return "Hello World";
|
|
23
|
+
* }
|
|
22
24
|
* );
|
|
23
25
|
*
|
|
24
|
-
* export const handler = serve(inngest, [fn]);
|
|
26
|
+
* export const handler = serve({ client: inngest, functions: [fn] });
|
|
25
27
|
* ```
|
|
26
28
|
*
|
|
27
29
|
* @public
|
|
28
30
|
*/
|
|
29
|
-
export declare const serve:
|
|
31
|
+
export declare const serve: (options: ServeHandlerOptions) => (event: Either<import("aws-lambda").APIGatewayProxyEvent, APIGatewayProxyEventV2>, _context: Context) => Promise<APIGatewayProxyResult>;
|
|
30
32
|
//# sourceMappingURL=lambda.d.ts.map
|
package/lambda.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.d.ts","sourceRoot":"","sources":["../src/lambda.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lambda.d.ts","sourceRoot":"","sources":["../src/lambda.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,aAAa,EAAE,sBAAqC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,KAAK,YAAa,mBAAmB,4IA2DjD,CAAC"}
|
package/lambda.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serve = exports.
|
|
3
|
+
exports.serve = exports.frameworkName = void 0;
|
|
4
4
|
const InngestCommHandler_1 = require("./components/InngestCommHandler");
|
|
5
|
-
|
|
6
|
-
exports.name = "aws-lambda";
|
|
5
|
+
exports.frameworkName = "aws-lambda";
|
|
7
6
|
/**
|
|
8
7
|
* With AWS Lambda, serve and register any declared functions with Inngest,
|
|
9
8
|
* making them available to be triggered by events.
|
|
@@ -14,85 +13,62 @@ exports.name = "aws-lambda";
|
|
|
14
13
|
* import { Inngest } from "inngest";
|
|
15
14
|
* import { serve } from "inngest/lambda";
|
|
16
15
|
*
|
|
17
|
-
* const inngest = new Inngest({
|
|
16
|
+
* const inngest = new Inngest({ id: "my-lambda-app" });
|
|
18
17
|
*
|
|
19
18
|
* const fn = inngest.createFunction(
|
|
20
|
-
* {
|
|
19
|
+
* { id: "hello-world" },
|
|
21
20
|
* { event: "test/hello.world" },
|
|
22
21
|
* async ({ event }) => {
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* return "Hello World";
|
|
23
|
+
* }
|
|
25
24
|
* );
|
|
26
25
|
*
|
|
27
|
-
* export const handler = serve(inngest, [fn]);
|
|
26
|
+
* export const handler = serve({ client: inngest, functions: [fn] });
|
|
28
27
|
* ```
|
|
29
28
|
*
|
|
30
29
|
* @public
|
|
31
30
|
*/
|
|
32
|
-
const serve = (
|
|
33
|
-
const handler = new InngestCommHandler_1.InngestCommHandler(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
: event.body
|
|
74
|
-
: "{}"),
|
|
75
|
-
fnId: (_a = event.queryStringParameters) === null || _a === void 0 ? void 0 : _a[consts_1.queryKeys.FnId],
|
|
76
|
-
stepId: (_b = event.queryStringParameters) === null || _b === void 0 ? void 0 : _b[consts_1.queryKeys.StepId],
|
|
77
|
-
signature: event.headers[consts_1.headerKeys.Signature],
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
view: () => {
|
|
82
|
-
if (method === "GET") {
|
|
83
|
-
return {
|
|
84
|
-
isIntrospection: Object.hasOwnProperty.call(event.queryStringParameters || {}, consts_1.queryKeys.Introspect),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
}, ({ body, status, headers }) => {
|
|
90
|
-
return Promise.resolve({
|
|
91
|
-
body,
|
|
92
|
-
statusCode: status,
|
|
93
|
-
headers,
|
|
94
|
-
});
|
|
95
|
-
});
|
|
31
|
+
const serve = (options) => {
|
|
32
|
+
const handler = new InngestCommHandler_1.InngestCommHandler(Object.assign(Object.assign({ frameworkName: exports.frameworkName }, options), { handler: (event, _context) => {
|
|
33
|
+
/**
|
|
34
|
+
* Try to handle multiple incoming event types, as Lambda can have many
|
|
35
|
+
* triggers.
|
|
36
|
+
*
|
|
37
|
+
* This still doesn't handle all cases, but it's a start.
|
|
38
|
+
*/
|
|
39
|
+
const eventIsV2 = ((ev) => {
|
|
40
|
+
return ev.version === "2.0";
|
|
41
|
+
})(event);
|
|
42
|
+
return {
|
|
43
|
+
body: () => {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
45
|
+
return JSON.parse(event.body
|
|
46
|
+
? event.isBase64Encoded
|
|
47
|
+
? Buffer.from(event.body, "base64").toString()
|
|
48
|
+
: event.body
|
|
49
|
+
: "{}");
|
|
50
|
+
},
|
|
51
|
+
headers: (key) => event.headers[key],
|
|
52
|
+
method: () => {
|
|
53
|
+
return eventIsV2
|
|
54
|
+
? event.requestContext.http.method
|
|
55
|
+
: event.httpMethod;
|
|
56
|
+
},
|
|
57
|
+
url: () => {
|
|
58
|
+
const path = eventIsV2 ? event.requestContext.http.path : event.path;
|
|
59
|
+
const proto = event.headers["x-forwarded-proto"] || "https";
|
|
60
|
+
const url = new URL(path, `${proto}://${event.headers.host || ""}`);
|
|
61
|
+
return url;
|
|
62
|
+
},
|
|
63
|
+
queryString: (key) => {
|
|
64
|
+
var _a;
|
|
65
|
+
return (_a = event.queryStringParameters) === null || _a === void 0 ? void 0 : _a[key];
|
|
66
|
+
},
|
|
67
|
+
transformResponse: ({ body, status: statusCode, headers, }) => {
|
|
68
|
+
return Promise.resolve({ body, statusCode, headers });
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
} }));
|
|
96
72
|
return handler.createHandler();
|
|
97
73
|
};
|
|
98
74
|
exports.serve = serve;
|
package/lambda.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.js","sourceRoot":"","sources":["../src/lambda.ts"],"names":[],"mappings":";;;AAMA,wEAGyC;
|
|
1
|
+
{"version":3,"file":"lambda.js","sourceRoot":"","sources":["../src/lambda.ts"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AAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,OAAO,CAAC;oBAC5D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;oBAEpE,OAAO,GAAG,CAAC;gBACb,CAAC;gBACD,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE;;oBACnB,OAAO,MAAA,KAAK,CAAC,qBAAqB,0CAAG,GAAG,CAAC,CAAC;gBAC5C,CAAC;gBACD,iBAAiB,EAAE,CAAC,EAClB,IAAI,EACJ,MAAM,EAAE,UAAU,EAClB,OAAO,GACR,EAAkC,EAAE;oBACnC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;gBACxD,CAAC;aACF,CAAC;QACJ,CAAC,IACD,CAAC;IAEH,OAAO,OAAO,CAAC,aAAa,EAAE,CAAC;AACjC,CAAC,CAAC;AA3DW,QAAA,KAAK,SA2DhB"}
|
package/next.d.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type NextApiRequest, type NextApiResponse } from "next";
|
|
2
|
+
import { type NextRequest } from "next/server";
|
|
3
|
+
import { type ServeHandlerOptions } from "./components/InngestCommHandler";
|
|
4
|
+
import { type Either } from "./helpers/types";
|
|
2
5
|
import { type SupportedFrameworkName } from "./types";
|
|
3
|
-
export declare const
|
|
6
|
+
export declare const frameworkName: SupportedFrameworkName;
|
|
4
7
|
/**
|
|
5
8
|
* In Next.js, serve and register any declared functions with Inngest, making
|
|
6
9
|
* them available to be triggered by events.
|
|
7
10
|
*
|
|
8
11
|
* @example Next.js <=12 can export the handler directly
|
|
9
12
|
* ```ts
|
|
10
|
-
* export default serve(inngest, [fn1, fn2]);
|
|
13
|
+
* export default serve({ client: inngest, functions: [fn1, fn2] });
|
|
11
14
|
* ```
|
|
12
15
|
*
|
|
13
16
|
* @example Next.js >=13 with the `app` dir must export individual methods
|
|
14
17
|
* ```ts
|
|
15
|
-
* export const { GET, POST, PUT } = serve(
|
|
18
|
+
* export const { GET, POST, PUT } = serve({
|
|
19
|
+
* client: inngest,
|
|
20
|
+
* functions: [fn1, fn2],
|
|
21
|
+
* });
|
|
16
22
|
* ```
|
|
17
23
|
*
|
|
18
24
|
* @public
|
|
19
25
|
*/
|
|
20
|
-
export declare const serve:
|
|
26
|
+
export declare const serve: (options: ServeHandlerOptions) => (req: Either<NextApiRequest, NextRequest>, res: NextApiResponse) => Promise<Response | undefined>;
|
|
21
27
|
//# sourceMappingURL=next.d.ts.map
|
package/next.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,MAAM,CAAC;AACjE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,aAAa,EAAE,sBAAiC,CAAC;AAQ9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK,YAAa,mBAAmB,sGA4HjD,CAAC"}
|