inngest 0.3.0 → 0.4.0-beta.1

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.
Files changed (45) hide show
  1. package/dist/components/Inngest.d.ts +57 -0
  2. package/dist/components/Inngest.d.ts.map +1 -0
  3. package/dist/components/Inngest.js +103 -0
  4. package/dist/components/Inngest.js.map +1 -0
  5. package/dist/components/InngestFunction.d.ts +16 -0
  6. package/dist/components/InngestFunction.d.ts.map +1 -0
  7. package/dist/components/InngestFunction.js +84 -0
  8. package/dist/components/InngestFunction.js.map +1 -0
  9. package/dist/components/InngestStep.d.ts +12 -0
  10. package/dist/components/InngestStep.d.ts.map +1 -0
  11. package/dist/components/InngestStep.js +33 -0
  12. package/dist/components/InngestStep.js.map +1 -0
  13. package/dist/handlers/default.d.ts +80 -0
  14. package/dist/handlers/default.d.ts.map +1 -0
  15. package/dist/handlers/default.js +167 -0
  16. package/dist/handlers/default.js.map +1 -0
  17. package/dist/handlers/next.d.ts +3 -0
  18. package/dist/handlers/next.d.ts.map +1 -0
  19. package/dist/handlers/next.js +58 -0
  20. package/dist/handlers/next.js.map +1 -0
  21. package/dist/helpers/consts.d.ts +3 -0
  22. package/dist/helpers/consts.d.ts.map +1 -0
  23. package/dist/helpers/consts.js +6 -0
  24. package/dist/helpers/consts.js.map +1 -0
  25. package/dist/helpers/func.d.ts +4 -0
  26. package/dist/helpers/func.d.ts.map +1 -0
  27. package/dist/helpers/func.js +12 -0
  28. package/dist/helpers/func.js.map +1 -0
  29. package/dist/index.d.ts +4 -121
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +8 -69
  32. package/dist/index.js.map +1 -1
  33. package/dist/types.d.ts +162 -0
  34. package/dist/types.d.ts.map +1 -0
  35. package/dist/types.js +3 -0
  36. package/dist/types.js.map +1 -0
  37. package/dist/version.d.ts +2 -0
  38. package/dist/version.d.ts.map +1 -0
  39. package/dist/version.js +6 -0
  40. package/dist/version.js.map +1 -0
  41. package/package.json +8 -6
  42. package/dist/init.d.ts +0 -3
  43. package/dist/init.d.ts.map +0 -1
  44. package/dist/init.js +0 -70
  45. package/dist/init.js.map +0 -1
@@ -0,0 +1,57 @@
1
+ /// <reference types="node" />
2
+ import * as InngestT from "../types";
3
+ import { InngestFunction } from "./InngestFunction";
4
+ /**
5
+ * A client used to interact with the Inngest API by sending or reacting to
6
+ * events.
7
+ *
8
+ * To provide event typing, make sure to pass in your generated event types as
9
+ * the first generic.
10
+ */
11
+ export declare class Inngest<Events extends Record<string, InngestT.EventPayload>> {
12
+ #private;
13
+ /**
14
+ * The name of this instance, most commonly the name of the application it
15
+ * resides in.
16
+ */
17
+ readonly name: string;
18
+ /**
19
+ * Inngest event key, used to send events to Inngest Cloud.
20
+ */
21
+ private readonly eventKey;
22
+ /**
23
+ * Base URL for Inngest Cloud.
24
+ */
25
+ readonly inngestBaseUrl: URL;
26
+ /**
27
+ * The URL of the Inngest Cloud API.
28
+ */
29
+ private readonly inngestApiUrl;
30
+ /**
31
+ * An Axios instance used for communicating with Inngest Cloud.
32
+ *
33
+ * @link https://npm.im/axios
34
+ */
35
+ private readonly client;
36
+ constructor(
37
+ /**
38
+ * The name of this instance, most commonly the name of the application it
39
+ * resides in.
40
+ */
41
+ name: string,
42
+ /**
43
+ * Inngest event key, used to send events to Inngest Cloud.
44
+ */
45
+ eventKey: string, { inngestBaseUrl }?: InngestT.ClientOptions);
46
+ /**
47
+ * Send event(s) to Inngest
48
+ */
49
+ send<Event extends keyof Events>(name: Event, payload: Omit<Events[Event], "name"> | Omit<Events[Event], "name">[]): Promise<boolean>;
50
+ /**
51
+ * Given an event to listen to, run the given function when that event is
52
+ * seen.
53
+ */
54
+ createFunction<Event extends keyof Events, Fn extends InngestT.StepFn<Events[Event], string, "step">>(name: string, event: Event, fn: Fn): InngestFunction<Events>;
55
+ createFunction<Event extends keyof Events, Fn extends InngestT.StepFn<Events[Event], string, "step">>(opts: InngestT.FunctionOptions, event: Event, fn: Fn): Inng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e,CAAC,MAAM,CAAC;IACvD,cAAc,CACnB,KAAK,SAAS,MAAM,MAAM,EAC1B,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAEzD,IAAI,EAAE,QAAQ,CAAC,eAAe,EAC9B,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,EAAE,GACL,eAAe,CAAC,MAAM,CAAC;CAiB3B"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ var _Inngest_instances, _Inngest_getResponseError;
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Inngest = void 0;
13
+ const axios_1 = __importDefault(require("axios"));
14
+ const InngestFunction_1 = require("./InngestFunction");
15
+ const InngestStep_1 = require("./InngestStep");
16
+ /**
17
+ * A client used to interact with the Inngest API by sending or reacting to
18
+ * events.
19
+ *
20
+ * To provide event typing, make sure to pass in your generated event types as
21
+ * the first generic.
22
+ */
23
+ class Inngest {
24
+ constructor(
25
+ /**
26
+ * The name of this instance, most commonly the name of the application it
27
+ * resides in.
28
+ */
29
+ name,
30
+ /**
31
+ * Inngest event key, used to send events to Inngest Cloud.
32
+ */
33
+ eventKey, { inngestBaseUrl = "https://inn.gs/" } = {}) {
34
+ _Inngest_instances.add(this);
35
+ if (!name) {
36
+ throw new Error("A name must be passed to create an Inngest instance.");
37
+ }
38
+ if (!eventKey) {
39
+ throw new Error("An event key must be passed to create an Inngest instance.");
40
+ }
41
+ this.name = name;
42
+ this.eventKey = eventKey;
43
+ this.inngestBaseUrl = new URL(inngestBaseUrl);
44
+ this.inngestApiUrl = new URL(`e/${this.eventKey}`, this.inngestBaseUrl);
45
+ this.client = axios_1.default.create({
46
+ timeout: 0,
47
+ headers: {
48
+ "Content-Type": "application/json",
49
+ "User-Agent": "InngestJS 0.1.0",
50
+ },
51
+ validateStatus: () => true,
52
+ maxRedirects: 0,
53
+ });
54
+ }
55
+ /**
56
+ * Send event(s) to Inngest
57
+ */
58
+ async send(name, payload) {
59
+ const response = await this.client.post(this.inngestApiUrl.href, Object.assign(Object.assign({}, payload), { name }));
60
+ if (response.status >= 200 && response.status < 300) {
61
+ return true;
62
+ }
63
+ throw __classPrivateFieldGet(this, _Inngest_instances, "m", _Inngest_getResponseError).call(this, response);
64
+ }
65
+ createFunction(nameOrOpts, event, fn) {
66
+ return new InngestFunction_1.InngestFunction(typeof nameOrOpts === "string" ? { name: nameOrOpts } : nameOrOpts, event, {
67
+ step: new InngestStep_1.InngestStep(fn),
68
+ });
69
+ }
70
+ }
71
+ exports.Inngest = Inngest;
72
+ _Inngest_instances = new WeakSet(), _Inngest_getResponseError = function _Inngest_getResponseError(response) {
73
+ let errorMessage = "Unknown error";
74
+ switch (response.status) {
75
+ case 401:
76
+ errorMessage = "Event key Not Found";
77
+ break;
78
+ case 400:
79
+ errorMessage = "Cannot process event payload";
80
+ break;
81
+ case 403:
82
+ errorMessage = "Forbidden";
83
+ break;
84
+ case 404:
85
+ errorMessage = "Event key not found";
86
+ break;
87
+ case 406:
88
+ errorMessage = `${JSON.stringify(response.data)}`;
89
+ break;
90
+ case 409:
91
+ case 412:
92
+ errorMessage = "Event transformation failed";
93
+ break;
94
+ case 413:
95
+ errorMessage = "Event payload too large";
96
+ break;
97
+ case 500:
98
+ errorMessage = "Internal server error";
99
+ break;
100
+ }
101
+ return new Error(`Inngest API Error: ${response.status} ${errorMessage}`);
102
+ };
103
+ //# sourceMappingURL=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{ EventPayload, FunctionOptions, Steps } from "../types";
2
+ export declare class InngestFunction<Events extends Record<string, EventPayload>> {
3
+ #private;
4
+ constructor(opts: FunctionOptions, trigger: keyof Events, steps: Steps);
5
+ get id(): string;
6
+ get name(): string;
7
+ /**
8
+ * Retrieve the Inngest config for this function.
9
+ */
10
+ private getConfig;
11
+ /**
12
+ * Run a step in this function defined by `stepId` with `data`.
13
+ */
14
+ private runStep;
15
+ }
16
+ //# sourceMappingURL=InngestFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InngestFunction.d.ts","sourceRoot":"","sources":["../../src/components/InngestFunction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAkB,eAAe,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhF,qBAAa,eAAe,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;;gBAK1D,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,MAAM,EAAE,KAAK,EAAE,KAAK;IAMtE,IAAW,EAAE,WAEZ;IAED,IAAW,IAAI,WAEd;IAED;;OAEG;IACH,OAAO,CAAC,SAAS;IAmCjB;;OAEG;IACH,OAAO,CAAC,OAAO;CAsBhB"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _InngestFunction_instances, _InngestFunction_opts, _InngestFunction_trigger, _InngestFunction_steps, _InngestFunction_generateId;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.InngestFunction = void 0;
16
+ const consts_1 = require("../helpers/consts");
17
+ class InngestFunction {
18
+ constructor(opts, trigger, steps) {
19
+ _InngestFunction_instances.add(this);
20
+ _InngestFunction_opts.set(this, void 0);
21
+ _InngestFunction_trigger.set(this, void 0);
22
+ _InngestFunction_steps.set(this, void 0);
23
+ __classPrivateFieldSet(this, _InngestFunction_opts, opts, "f");
24
+ __classPrivateFieldSet(this, _InngestFunction_trigger, trigger, "f");
25
+ __classPrivateFieldSet(this, _InngestFunction_steps, steps || {}, "f");
26
+ }
27
+ get id() {
28
+ return __classPrivateFieldGet(this, _InngestFunction_opts, "f").id || __classPrivateFieldGet(this, _InngestFunction_instances, "m", _InngestFunction_generateId).call(this);
29
+ }
30
+ get name() {
31
+ return __classPrivateFieldGet(this, _InngestFunction_opts, "f").name;
32
+ }
33
+ /**
34
+ * Retrieve the Inngest config for this function.
35
+ */
36
+ getConfig(
37
+ /**
38
+ * Must be provided a URL that will be used to access the function and step.
39
+ * This function can't be expected to know how it will be accessed, so
40
+ * relies on an outside method providing context.
41
+ */
42
+ baseUrl) {
43
+ return {
44
+ id: this.id,
45
+ name: this.name,
46
+ triggers: [{ event: __classPrivateFieldGet(this, _InngestFunction_trigger, "f") }],
47
+ steps: Object.keys(__classPrivateFieldGet(this, _InngestFunction_steps, "f")).reduce((acc, stepId) => {
48
+ const url = new URL(baseUrl.href);
49
+ url.searchParams.set(consts_1.fnIdParam, __classPrivateFieldGet(this, _InngestFunction_opts, "f").name);
50
+ url.searchParams.set(consts_1.stepIdParam, stepId);
51
+ return Object.assign(Object.assign({}, acc), { [stepId]: {
52
+ id: stepId,
53
+ name: stepId,
54
+ runtime: {
55
+ type: "http",
56
+ url: url.href,
57
+ },
58
+ } });
59
+ }, {}),
60
+ };
61
+ }
62
+ /**
63
+ * Run a step in this function defined by `stepId` with `data`.
64
+ */
65
+ runStep(stepId, data) {
66
+ const step = __classPrivateFieldGet(this, _InngestFunction_steps, "f")[stepId];
67
+ if (!step) {
68
+ throw new Error(`Could not find step with ID "${stepId}" in function "${this.name}"`);
69
+ }
70
+ return step["run"](data);
71
+ }
72
+ }
73
+ exports.InngestFunction = InngestFunction;
74
+ _InngestFunction_opts = new WeakMap(), _InngestFunction_trigger = new WeakMap(), _InngestFunction_steps = new WeakMap(), _InngestFunction_instances = new WeakSet(), _InngestFunction_generateId = function _InngestFunction_generateId() {
75
+ const join = "-";
76
+ return __classPrivateFieldGet(this, _InngestFunction_opts, "f").name
77
+ .toLowerCase()
78
+ .replaceAll(/[^a-z0-9-]+/g, join)
79
+ .replaceAll(/-+/g, join)
80
+ .split(join)
81
+ .filter(Boolean)
82
+ .join(join);
83
+ };
84
+ //# sourceMappingURL=InngestFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InngestFunction.js","sourceRoot":"","sources":["../../src/components/InngestFunction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8CAA2D;AAG3D,MAAa,eAAe;IAK1B,YAAY,IAAqB,EAAE,OAAqB,EAAE,KAAY;;QAJtE,wCAAgC;QAChC,2CAAgC;QAChC,yCAAuB;QAGrB,uBAAA,IAAI,yBAAS,IAAI,MAAA,CAAC;QAClB,uBAAA,IAAI,4BAAY,OAAO,MAAA,CAAC;QACxB,uBAAA,IAAI,0BAAU,KAAK,IAAI,EAAE,MAAA,CAAC;IAC5B,CAAC;IAED,IAAW,EAAE;QACX,OAAO,uBAAA,IAAI,6BAAM,CAAC,EAAE,IAAI,uBAAA,IAAI,+DAAY,MAAhB,IAAI,CAAc,CAAC;IAC7C,CAAC;IAED,IAAW,IAAI;QACb,OAAO,uBAAA,IAAI,6BAAM,C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O,uBAAA,IAAI,6BAAM,CAAC,IAAI;SACnB,WAAW,EAAE;SACb,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC;SAChC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC;SACvB,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A typed, individual step within an `InngestFunction`.
3
+ */
4
+ export declare class InngestStep<Input extends any[], Output> {
5
+ #private;
6
+ constructor(fn: (...args: Input) => Output);
7
+ /**
8
+ * Run this step with the given `data`.
9
+ */
10
+ private run;
11
+ }
12
+ //# sourceMappingURL=InngestStep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InngestStep.d.ts","sourceRoot":"","sources":["../../src/components/InngestStep.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAW,CAAC,KAAK,SAAS,GAAG,EAAE,EAAE,MAAM;;gBAGtC,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,MAAM;IAI1C;;OAEG;YACW,GAAG;CAGlB"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _InngestStep_fn;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.InngestStep = void 0;
16
+ /**
17
+ * A typed, individual step within an `InngestFunction`.
18
+ */
19
+ class InngestStep {
20
+ constructor(fn) {
21
+ _InngestStep_fn.set(this, void 0);
22
+ __classPrivateFieldSet(this, _InngestStep_fn, fn, "f");
23
+ }
24
+ /**
25
+ * Run this step with the given `data`.
26
+ */
27
+ async run(data) {
28
+ return __classPrivateFieldGet(this, _InngestStep_fn, "f").call(this, data);
29
+ }
30
+ }
31
+ exports.InngestStep = InngestStep;
32
+ _InngestStep_fn = new WeakMap();
33
+ //# sourceMappingURL=InngestStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InngestStep.js","sourceRoot":"","sources":["../../src/components/InngestStep.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,MAAa,WAAW;IAGtB,YAAY,EAA8B;QAF1C,kCAAuC;QAGrC,uBAAA,IAAI,mBAAO,EAAE,MAAA,CAAC;IAChB,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,GAAG,CAAC,IAAS;QACzB,OAAO,uBAAA,IAAI,uBAAI,MAAR,IAAI,EAAK,IAAI,CAAC,CAAC;IACxB,CAAC;CACF;AAbD,kCAaC"}
@@ -0,0 +1,80 @@
1
+ /// <reference types="node" />
2
+ import { Inngest } from "../components/Inngest";
3
+ import { InngestFunction } from "../components/InngestFunction";
4
+ import { ClientOptions, EventPayload, FunctionConfig, RegisterPingResponse, StepRunResponse } from "../types";
5
+ /**
6
+ * A handler for registering Inngest functions. This type should be used
7
+ * whenever a handler for a new framework is being added to enforce that the
8
+ * registration process is always the same for the user.
9
+ */
10
+ export declare type RegisterHandler = (
11
+ /**
12
+ * The name of this app, used to scope and group Inngest functions, or
13
+ * the `Inngest` instance used to declare all functions.
14
+ */
15
+ nameOrInngest: string | Inngest<any>,
16
+ /**
17
+ * A key used to sign requests to and from Inngest in order to prove that the
18
+ * source is legitimate.
19
+ *
20
+ * @link TODO
21
+ */
22
+ signingKey: string, functions: InngestFunction<any>[], opts?: ClientOptions) => any;
23
+ /**
24
+ * Register any declared functions with Inngest, making them available to be
25
+ * triggered by events.
26
+ *
27
+ * Can either take an `Inngest` instance and a signing key, or can be used to
28
+ * create custom handlers by passing in an `InngestCommHandler`.
29
+ *
30
+ * @link TODO
31
+ */
32
+ export declare const register: <Events extends Record<string, EventPayload>>(...args: [nameOrInngest: string | Inngest<Events>, signingKey: string, functions: InngestFunction<Events>[], opts?: ClientOptions | undefined] | [commHandler: InngestCommHandler]) => any;
33
+ /**
34
+ * TODO Instead of `createHandler`, expose `createRequest` and `handleResponse`
35
+ *
36
+ * Overriding `createHandler` requires that we always remember crucial steps,
37
+ * e.g. validating signatures, handling POST, etc.
38
+ *
39
+ * We should instead require that new comm handlers override only two functions:
40
+ *
41
+ * `createRequest()`
42
+ * This is the function that is exposed. It must return a valid `HandlerRequest`
43
+ *
44
+ * `handleResponse()`
45
+ * The input is a `StepResponse`, and output can be anything needed for the
46
+ * platform
47
+ */
48
+ export declare class InngestCommHandler {
49
+ name: string;
50
+ /**
51
+ * Base URL for Inngest Cloud.
52
+ */
53
+ private readonly inngestBaseUrl;
54
+ /**
55
+ * The URL of the Inngest function registration endpoint.
56
+ */
57
+ private readonly inngestRegisterUrl;
58
+ protected readonly frameworkName: string;
59
+ protected readonly signingKey: string;
60
+ /**
61
+ * An Axios instance used for communicating with Inngest Cloud.
62
+ *
63
+ * @link https://npm.im/axios
64
+ */
65
+ private readonly client;
66
+ /**
67
+ * A private collection of functions that have been registered. This map is
68
+ * used to find and register functions when interacting with Inngest Cloud.
69
+ */
70
+ private readonly fns;
71
+ constructor(nameOrInngest: string | Inngest<any>, signingKey: string, functions: InngestFunction<any>[], { inngestBaseUrl }?: ClientOptions);
72
+ createHandler(): any;
73
+ protected runStep(functionId: string, stepId: string, data: any): Promise<StepRunResponse>;
74
+ protected configs(url: URL): FunctionConfig[];
75
+ protected register(url: URL): Promise<void>;
76
+ protected pong(url: URL): RegisterPingResponse;
77
+ protected validateSignature(): boolean;
78
+ protected signResponse(): string;
79
+ }
80
+ //# sourceMappingURL=default.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/handlers/default.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,eAAe,EAChB,MAAM,UAAU,CAAC;AAGlB;;;;GAIG;AACH,oBAAY,eAAe,GAAG;AAC5B;;;GAGG;AACH,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;AAEpC;;;;;GAKG;AACH,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,EACjC,IAAI,CAAC,EAAE,aAAa,KACjB,GAAG,CAAC;AAET;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,0OAkBpB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,qBAAa,kBAAkB;IACtB,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAM;IAErC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAM;IAEzC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAa;IACrD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAEtC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IAEvC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA4C;gBAG9D,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,EACpC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,EACjC,EAAE,cAAc,EAAE,GAAE,aAAkB;IA0CjC,aAAa,IAAI,GAAG;cA4CX,OAAO,CACrB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,eAAe,CAAC;IA8B3B,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,EAAE;cAI7B,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BjD,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,oBAAoB;IAW9C,SAAS,CAAC,iBAAiB,IAAI,OAAO;IAItC,SAAS,CAAC,YAAY,IAAI,MAAM;CAGjC"}
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.InngestCommHandler = exports.register = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const zod_1 = require("zod");
9
+ const Inngest_1 = require("../components/Inngest");
10
+ const consts_1 = require("../helpers/consts");
11
+ const version_1 = require("../version");
12
+ /**
13
+ * Register any declared functions with Inngest, making them available to be
14
+ * triggered by events.
15
+ *
16
+ * Can either take an `Inngest` instance and a signing key, or can be used to
17
+ * create custom handlers by passing in an `InngestCommHandler`.
18
+ *
19
+ * @link TODO
20
+ */
21
+ const register = (...args) => {
22
+ if (args.length === 1) {
23
+ return args[0].createHandler();
24
+ }
25
+ const [nameOrInngest, signingKey, fns, opts] = args;
26
+ const handler = new InngestCommHandler(nameOrInngest, signingKey, fns, opts);
27
+ return handler.createHandler();
28
+ };
29
+ exports.register = register;
30
+ /**
31
+ * TODO Instead of `createHandler`, expose `createRequest` and `handleResponse`
32
+ *
33
+ * Overriding `createHandler` requires that we always remember crucial steps,
34
+ * e.g. validating signatures, handling POST, etc.
35
+ *
36
+ * We should instead require that new comm handlers override only two functions:
37
+ *
38
+ * `createRequest()`
39
+ * This is the function that is exposed. It must return a valid `HandlerRequest`
40
+ *
41
+ * `handleResponse()`
42
+ * The input is a `StepResponse`, and output can be anything needed for the
43
+ * platform
44
+ */
45
+ class InngestCommHandler {
46
+ constructor(nameOrInngest, signingKey, functions, { inngestBaseUrl } = {}) {
47
+ this.frameworkName = "default";
48
+ /**
49
+ * A private collection of functions that have been registered. This map is
50
+ * used to find and register functions when interacting with Inngest Cloud.
51
+ */
52
+ this.fns = {};
53
+ this.name =
54
+ typeof nameOrInngest === "string" ? nameOrInngest : nameOrInngest.name;
55
+ this.fns = functions.reduce((acc, fn) => {
56
+ if (acc[fn.id]) {
57
+ throw new Error(`Duplicate function ID "${fn.id}"; please change a function's name or provide an explicit ID to avoid conflicts.`);
58
+ }
59
+ return Object.assign(Object.assign({}, acc), { [fn.id]: fn });
60
+ }, {});
61
+ this.inngestBaseUrl = new URL(inngestBaseUrl ||
62
+ (nameOrInngest instanceof Inngest_1.Inngest
63
+ ? nameOrInngest.inngestBaseUrl.href
64
+ : "https://inn.gs/"));
65
+ this.inngestRegisterUrl = new URL("x/register", this.inngestBaseUrl);
66
+ this.signingKey = signingKey;
67
+ this.client = axios_1.default.create({
68
+ timeout: 0,
69
+ headers: {
70
+ "Content-Type": "application/json",
71
+ "User-Agent": `InngestJS v${version_1.version}`,
72
+ },
73
+ validateStatus: () => true,
74
+ maxRedirects: 0,
75
+ });
76
+ }
77
+ createHandler() {
78
+ return async (req, res) => {
79
+ console.log("Something hit the default handler!");
80
+ const reqUrl = new URL(req.originalUrl, req.hostname);
81
+ switch (req.method) {
82
+ case "PUT":
83
+ console.log("It was a PUT request");
84
+ // Push config to Inngest.
85
+ await this.register(reqUrl);
86
+ return void res.sendStatus(200);
87
+ case "GET":
88
+ console.log("It was a GET request");
89
+ // Inngest is asking for config; confirm signed and send.
90
+ this.validateSignature(); //TODO
91
+ const pingRes = this.pong(reqUrl);
92
+ this.signResponse(); // TODO
93
+ return void res.json(pingRes);
94
+ case "POST":
95
+ console.log("It was a POST request");
96
+ // Inngest is trying to run a step; confirm signed and run.
97
+ const { fnId, stepId } = zod_1.z
98
+ .object({
99
+ fnId: zod_1.z.string().min(1),
100
+ stepId: zod_1.z.string().min(1),
101
+ })
102
+ .parse({
103
+ fnId: req.query[consts_1.fnIdParam],
104
+ stepId: req.query[consts_1.stepIdParam],
105
+ });
106
+ const stepRes = await this.runStep(fnId, stepId, req.body);
107
+ return void res.json(stepRes);
108
+ default:
109
+ return void res.sendStatus(405);
110
+ }
111
+ };
112
+ }
113
+ async runStep(functionId, stepId, data) {
114
+ console.log("Trying to run step", stepId, "in function", functionId, "with data", data);
115
+ try {
116
+ const fn = this.fns[functionId];
117
+ if (!fn) {
118
+ throw new Error(`Could not find function with ID "${functionId}"`);
119
+ }
120
+ const body = await fn["runStep"](stepId, data);
121
+ return {
122
+ status: 200,
123
+ body: JSON.stringify(body),
124
+ };
125
+ }
126
+ catch (err) {
127
+ return {
128
+ status: 500,
129
+ error: err.stack || err.message,
130
+ };
131
+ }
132
+ }
133
+ configs(url) {
134
+ return Object.values(this.fns).map((fn) => fn["getConfig"](url));
135
+ }
136
+ async register(url) {
137
+ const body = {
138
+ url: url.href,
139
+ hash: "TODO",
140
+ };
141
+ const config = {
142
+ headers: {
143
+ Authorization: `Bearer ${this.signingKey}`,
144
+ },
145
+ };
146
+ const res = await this.client.post(this.inngestRegisterUrl.href, body, config);
147
+ console.log("hit the register URL", this.inngestRegisterUrl.href, "with:", body, "and", config, "and got back:", res.status, res.data);
148
+ }
149
+ pong(url) {
150
+ return {
151
+ deployType: "ping",
152
+ framework: this.frameworkName,
153
+ appName: this.name,
154
+ functions: this.configs(url),
155
+ sdk: `js:v${version_1.version}`,
156
+ v: "0.1",
157
+ };
158
+ }
159
+ validateSignature() {
160
+ return true;
161
+ }
162
+ signResponse() {
163
+ return "";
164
+ }
165
+ }
166
+ exports.InngestCommHandler = InngestCommHandler;
167
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/handlers/default.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAiE;AAEjE,6BAAwB;AACxB,mDAAgD;AAEhD,8CAA2D;AAQ3D,wCAAqC;AAyBrC;;;;;;;;GAQG;AACI,MAAM,QAAQ,GAAG,CACtB,GAAG,IAOkC,EACrC,EAAE;IACF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;KAChC;IAED,MAAM,CAAC,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;IACpD,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAE7E,OAAO,OAAO,CAAC,aAAa,EAAE,CAAC;AACjC,CAAC,CAAC;AAlBW,QAAA,QAAQ,YAkBnB;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAa,kBAAkB;IA6B7B,YACE,aAAoC,EACpC,UAAkB,EAClB,SAAiC,EACjC,EAAE,cAAc,KAAoB,EAAE;QApBrB,kBAAa,GAAW,SAAS,CAAC;QAUrD;;;WAGG;QACc,QAAG,GAAyC,EAAE,CAAC;QAQ9D,IAAI,CAAC,IAAI;YACP,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC;QAEzE,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,MAAM,CACzB,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE;YACV,IAAI,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;gBACd,MAAM,IAAI,K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AAC,IAAI,CACT,CAAC;IACJ,CAAC;IAES,IAAI,CAAC,GAAQ;QACrB,OAAO;YACL,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,IAAI,CAAC,aAAa;YAC7B,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;YAC5B,GAAG,EAAE,OAAO,iBAAO,EAAE;YACrB,CAAC,EAAE,KAAK;SACT,CAAC;IACJ,CAAC;IAES,iBAAiB;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAES,YAAY;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AA9MD,gDA8MC"}
@@ -0,0 +1,3 @@
1
+ import { RegisterHandler } from "./default";
2
+ export declare const register: RegisterHandler;
3
+ //# sourceMappingURL=next.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/handlers/next.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,eAAe,EAChB,MAAM,WAAW,CAAC;AAsDnB,eAAO,MAAM,QAAQ,EAAE,eAStB,CAAC"}