Comparing version 0.4.15 to 0.4.16-cfp.1
@@ -1,5 +0,5 @@ | ||
import { ServeHandler } from "./handlers/default"; | ||
import { ServeHandler } from "./express"; | ||
/** | ||
* In Cloudflare Pages, serve and register any declared functions with Inngest, | ||
* making them available to be triggered by events. | ||
* In Cloudflare, serve and register any declared functions with Inngest, making | ||
* them available to be triggered by events. | ||
* | ||
@@ -6,0 +6,0 @@ * @public |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.register = void 0; | ||
// Import and set polyfills before other imports | ||
const buffer_1 = require("buffer"); | ||
if (typeof window !== "undefined") { | ||
window.Buffer = buffer_1.Buffer; | ||
window.global = window; | ||
} | ||
// Regular imports | ||
const zod_1 = require("zod"); | ||
const default_1 = require("./handlers/default"); | ||
const express_1 = require("./express"); | ||
const consts_1 = require("./helpers/consts"); | ||
class CloudflareCommHandler extends default_1.InngestCommHandler { | ||
class CloudflareCommHandler extends express_1.InngestCommHandler { | ||
constructor() { | ||
super(...arguments); | ||
this.frameworkName = "cloudflare-pages"; | ||
this.frameworkName = "remix"; | ||
} | ||
createHandler() { | ||
return async ({ request: req, env, }) => { | ||
return async ({ request: req, }) => { | ||
let reqUrl; | ||
@@ -30,5 +23,2 @@ try { | ||
} | ||
if (!this.signingKey) { | ||
this.signingKey = env.INNGEST_SIGNING_KEY; | ||
} | ||
switch (req.method) { | ||
@@ -51,3 +41,3 @@ case "PUT": { | ||
}); | ||
const stepRes = await this.runStep(fnId, stepId, req.body); | ||
const stepRes = await this.runStep(fnId, stepId, await req.json()); | ||
if (stepRes.status === 500) { | ||
@@ -69,4 +59,4 @@ return new Response(JSON.stringify(stepRes.error), { | ||
/** | ||
* In Cloudflare Pages, serve and register any declared functions with Inngest, | ||
* making them available to be triggered by events. | ||
* In Cloudflare, serve and register any declared functions with Inngest, making | ||
* them available to be triggered by events. | ||
* | ||
@@ -76,5 +66,5 @@ * @public | ||
const register = (nameOrInngest, signingKey, fns, opts) => { | ||
return (0, default_1.serve)(new CloudflareCommHandler(nameOrInngest, signingKey, fns, opts)); | ||
return (0, express_1.serve)(new CloudflareCommHandler(nameOrInngest, signingKey, fns, opts)); | ||
}; | ||
exports.register = register; | ||
//# sourceMappingURL=cloudflare.js.map |
@@ -12,3 +12,3 @@ import { PartialK, SendEventPayload, SingleOrArray } from "../helpers/types"; | ||
* ```ts | ||
* const inngest = new Inngest<Events>("My App", process.env.INNGEST_EVENT_KEY); | ||
* const inngest = new Inngest<Events>({ name: "My App" }); | ||
* | ||
@@ -18,10 +18,10 @@ * // or to provide custom events too | ||
* Events & { | ||
* "demo/event.blah": { | ||
* name: "demo/event.blah"; | ||
* "app/user.created": { | ||
* name: "app/user.created"; | ||
* data: { | ||
* bar: boolean; | ||
* foo: boolean; | ||
* }; | ||
* }; | ||
* } | ||
* >("My App", process.env.INNGEST_EVENT_KEY); | ||
* >({ name: "My App" }); | ||
* ``` | ||
@@ -64,3 +64,3 @@ * | ||
* ```ts | ||
* const inngest = new Inngest<Events>("My App", process.env.INNGEST_EVENT_KEY); | ||
* const inngest = new Inngest<Events>({ name: "My App" }); | ||
* | ||
@@ -70,10 +70,10 @@ * // or to provide custom events too | ||
* Events & { | ||
* "demo/event.blah": { | ||
* name: "demo/event.blah"; | ||
* "app/user.created": { | ||
* name: "app/user.created"; | ||
* data: { | ||
* bar: boolean; | ||
* foo: boolean; | ||
* }; | ||
* }; | ||
* } | ||
* >("My App", process.env.INNGEST_EVENT_KEY); | ||
* >({ name: "My App" }); | ||
* ``` | ||
@@ -80,0 +80,0 @@ */ |
@@ -25,3 +25,3 @@ "use strict"; | ||
* ```ts | ||
* const inngest = new Inngest<Events>("My App", process.env.INNGEST_EVENT_KEY); | ||
* const inngest = new Inngest<Events>({ name: "My App" }); | ||
* | ||
@@ -31,10 +31,10 @@ * // or to provide custom events too | ||
* Events & { | ||
* "demo/event.blah": { | ||
* name: "demo/event.blah"; | ||
* "app/user.created": { | ||
* name: "app/user.created"; | ||
* data: { | ||
* bar: boolean; | ||
* foo: boolean; | ||
* }; | ||
* }; | ||
* } | ||
* >("My App", process.env.INNGEST_EVENT_KEY); | ||
* >({ name: "My App" }); | ||
* ``` | ||
@@ -53,3 +53,3 @@ * | ||
* ```ts | ||
* const inngest = new Inngest<Events>("My App", process.env.INNGEST_EVENT_KEY); | ||
* const inngest = new Inngest<Events>({ name: "My App" }); | ||
* | ||
@@ -59,10 +59,10 @@ * // or to provide custom events too | ||
* Events & { | ||
* "demo/event.blah": { | ||
* name: "demo/event.blah"; | ||
* "app/user.created": { | ||
* name: "app/user.created"; | ||
* data: { | ||
* bar: boolean; | ||
* foo: boolean; | ||
* }; | ||
* }; | ||
* } | ||
* >("My App", process.env.INNGEST_EVENT_KEY); | ||
* >({ name: "My App" }); | ||
* ``` | ||
@@ -69,0 +69,0 @@ */ |
@@ -28,3 +28,3 @@ import { EventPayload, FunctionOptions, FunctionTrigger, Steps } from "../types"; | ||
*/ | ||
get id(): string; | ||
id(prefix?: string): string; | ||
/** | ||
@@ -31,0 +31,0 @@ * The name of this function as it will appear in the Inngest Cloud UI. |
@@ -50,5 +50,5 @@ "use strict"; | ||
*/ | ||
get id() { | ||
id(prefix) { | ||
if (!__classPrivateFieldGet(this, _InngestFunction_opts, "f").id) { | ||
__classPrivateFieldGet(this, _InngestFunction_opts, "f").id = __classPrivateFieldGet(this, _InngestFunction_instances, "m", _InngestFunction_generateId).call(this); | ||
__classPrivateFieldGet(this, _InngestFunction_opts, "f").id = __classPrivateFieldGet(this, _InngestFunction_instances, "m", _InngestFunction_generateId).call(this, prefix); | ||
} | ||
@@ -72,5 +72,6 @@ return __classPrivateFieldGet(this, _InngestFunction_opts, "f").id; | ||
*/ | ||
baseUrl) { | ||
baseUrl, appPrefix) { | ||
const id = this.id(appPrefix); | ||
return { | ||
id: this.id, | ||
id, | ||
name: this.name, | ||
@@ -80,3 +81,3 @@ triggers: [__classPrivateFieldGet(this, _InngestFunction_trigger, "f")], | ||
const url = new URL(baseUrl.href); | ||
url.searchParams.set(consts_1.fnIdParam, this.id); | ||
url.searchParams.set(consts_1.fnIdParam, id); | ||
url.searchParams.set(consts_1.stepIdParam, stepId); | ||
@@ -106,5 +107,6 @@ return Object.assign(Object.assign({}, acc), { [stepId]: { | ||
exports.InngestFunction = InngestFunction; | ||
_InngestFunction_opts = new WeakMap(), _InngestFunction_trigger = new WeakMap(), _InngestFunction_steps = new WeakMap(), _InngestFunction_instances = new WeakSet(), _InngestFunction_generateId = function _InngestFunction_generateId() { | ||
_InngestFunction_opts = new WeakMap(), _InngestFunction_trigger = new WeakMap(), _InngestFunction_steps = new WeakMap(), _InngestFunction_instances = new WeakSet(), _InngestFunction_generateId = function _InngestFunction_generateId(prefix) { | ||
const join = "-"; | ||
return __classPrivateFieldGet(this, _InngestFunction_opts, "f").name | ||
return [prefix || "", __classPrivateFieldGet(this, _InngestFunction_opts, "f").name] | ||
.join("-") | ||
.toLowerCase() | ||
@@ -111,0 +113,0 @@ .replaceAll(/[^a-z0-9-]+/g, join) |
export { Inngest } from "./components/Inngest"; | ||
export { InngestCommHandler, serve, ServeHandler as RegisterHandler, } from "./handlers/default"; | ||
export { createFunction, createScheduledFunction } from "./helpers/func"; | ||
export { ClientOptions, EventPayload, FunctionOptions, RegisterOptions, StepFn, } from "./types"; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createScheduledFunction = exports.createFunction = exports.serve = exports.InngestCommHandler = exports.Inngest = void 0; | ||
exports.createScheduledFunction = exports.createFunction = exports.Inngest = void 0; | ||
var Inngest_1 = require("./components/Inngest"); | ||
Object.defineProperty(exports, "Inngest", { enumerable: true, get: function () { return Inngest_1.Inngest; } }); | ||
var default_1 = require("./handlers/default"); | ||
Object.defineProperty(exports, "InngestCommHandler", { enumerable: true, get: function () { return default_1.InngestCommHandler; } }); | ||
Object.defineProperty(exports, "serve", { enumerable: true, get: function () { return default_1.serve; } }); | ||
var func_1 = require("./helpers/func"); | ||
@@ -10,0 +7,0 @@ Object.defineProperty(exports, "createFunction", { enumerable: true, get: function () { return func_1.createFunction; } }); |
@@ -1,2 +0,2 @@ | ||
import { ServeHandler } from "./handlers/default"; | ||
import { ServeHandler } from "./express"; | ||
/** | ||
@@ -3,0 +3,0 @@ * In Next.js, serve and register any declared functions with Inngest, making |
@@ -5,5 +5,5 @@ "use strict"; | ||
const zod_1 = require("zod"); | ||
const default_1 = require("./handlers/default"); | ||
const express_1 = require("./express"); | ||
const consts_1 = require("./helpers/consts"); | ||
class NextCommHandler extends default_1.InngestCommHandler { | ||
class NextCommHandler extends express_1.InngestCommHandler { | ||
constructor() { | ||
@@ -59,5 +59,5 @@ super(...arguments); | ||
const serve = (nameOrInngest, signingKey, fns, opts) => { | ||
return (0, default_1.serve)(new NextCommHandler(nameOrInngest, signingKey, fns, opts)); | ||
return (0, express_1.serve)(new NextCommHandler(nameOrInngest, signingKey, fns, opts)); | ||
}; | ||
exports.serve = serve; | ||
//# sourceMappingURL=next.js.map |
{ | ||
"name": "inngest", | ||
"version": "0.4.15", | ||
"version": "0.4.16-cfp.1", | ||
"description": "Official SDK for Inngest.com", | ||
@@ -19,5 +19,6 @@ "main": "./index.js", | ||
"prebuild": "genversion --semi --double --es6 ./src/version.ts", | ||
"build": "yarn run clean && tsc", | ||
"build": "yarn run clean && tsc --project tsconfig.build.json", | ||
"test": "jest --passWithNoTests", | ||
"clean": "rm -rf ./dist", | ||
"lint": "eslint .", | ||
"postversion": "yarn run build && yarn run build:copy", | ||
@@ -28,3 +29,3 @@ "release": "yarn run np", | ||
"dev:build": "nodemon -w src -e ts -i version.ts --delay 300ms -x 'yarn run build && yarn run build:check --local'", | ||
"dev:lint": "nodemon -w src -e ts -i version.ts --delay 300ms -x 'eslint .'", | ||
"dev:lint": "nodemon -w src -e ts -i version.ts --delay 300ms -x 'yarn lint'", | ||
"build:api": "api-extractor run --local --verbose", | ||
@@ -53,5 +54,3 @@ "build:check": "api-extractor run --verbose", | ||
"cross-fetch": "^3.1.5", | ||
"events": "^3.3.0", | ||
"isomorphic-crypto": "^3.0.0", | ||
"stream": "^0.0.2", | ||
"sha.js": "^2.4.11", | ||
"zod": "^3.19.1" | ||
@@ -63,2 +62,3 @@ }, | ||
"@types/jest": "^27.4.1", | ||
"@types/sha.js": "^2.4.0", | ||
"@typescript-eslint/eslint-plugin": "^5.38.0", | ||
@@ -65,0 +65,0 @@ "@typescript-eslint/parser": "^5.38.0", |
@@ -1,2 +0,2 @@ | ||
import { ServeHandler } from "./handlers/default"; | ||
import { ServeHandler } from "./express"; | ||
/** | ||
@@ -3,0 +3,0 @@ * In Remix, serve and register any declared functions with Inngest, making them |
17
remix.js
@@ -6,3 +6,3 @@ "use strict"; | ||
const zod_1 = require("zod"); | ||
const default_1 = require("./handlers/default"); | ||
const express_1 = require("./express"); | ||
const consts_1 = require("./helpers/consts"); | ||
@@ -13,3 +13,3 @@ /** | ||
*/ | ||
class RemixCommHandler extends default_1.InngestCommHandler { | ||
class RemixCommHandler extends express_1.InngestCommHandler { | ||
constructor() { | ||
@@ -47,4 +47,11 @@ super(...arguments); | ||
}); | ||
const stepRes = await this.runStep(fnId, stepId, req.body); | ||
return new cross_fetch_1.Response(JSON.stringify(stepRes), { status: 200 }); | ||
const stepRes = await this.runStep(fnId, stepId, await req.json()); | ||
if (stepRes.status === 500) { | ||
return new cross_fetch_1.Response(JSON.stringify(stepRes.error), { | ||
status: stepRes.status, | ||
}); | ||
} | ||
return new cross_fetch_1.Response(JSON.stringify(stepRes.body), { | ||
status: stepRes.status, | ||
}); | ||
} | ||
@@ -64,5 +71,5 @@ default: | ||
const register = (nameOrInngest, signingKey, fns, opts) => { | ||
return (0, default_1.serve)(new RemixCommHandler(nameOrInngest, signingKey, fns, opts)); | ||
return (0, express_1.serve)(new RemixCommHandler(nameOrInngest, signingKey, fns, opts)); | ||
}; | ||
exports.register = register; | ||
//# sourceMappingURL=remix.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.4.15"; | ||
export declare const version = "0.4.16-cfp.1"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Generated by genversion. | ||
exports.version = "0.4.15"; | ||
exports.version = "0.4.16-cfp.1"; | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5
126975
20
59
1568
+ Addedsha.js@^2.4.11
- Removedevents@^3.3.0
- Removedisomorphic-crypto@^3.0.0
- Removedstream@^0.0.2
- Removedasn1.js@4.10.1(transitive)
- Removedbn.js@4.12.15.2.1(transitive)
- Removedbrorand@1.1.0(transitive)
- Removedbrowserify-aes@1.2.0(transitive)
- Removedbrowserify-cipher@1.0.1(transitive)
- Removedbrowserify-des@1.0.2(transitive)
- Removedbrowserify-rsa@4.1.1(transitive)
- Removedbrowserify-sign@4.2.3(transitive)
- Removedbuffer-xor@1.0.3(transitive)
- Removedcipher-base@1.0.6(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcreate-ecdh@4.0.4(transitive)
- Removedcreate-hash@1.2.0(transitive)
- Removedcreate-hmac@1.1.7(transitive)
- Removedcrypto-browserify@3.12.1(transitive)
- Removeddes.js@1.1.0(transitive)
- Removeddiffie-hellman@5.0.3(transitive)
- Removedelliptic@6.6.1(transitive)
- Removedemitter-component@1.1.2(transitive)
- Removedevents@3.3.0(transitive)
- Removedevp_bytestokey@1.0.3(transitive)
- Removedhash-base@3.0.5(transitive)
- Removedhash.js@1.1.7(transitive)
- Removedhmac-drbg@1.0.1(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisomorphic-crypto@3.0.0(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removedmiller-rabin@4.0.1(transitive)
- Removedminimalistic-assert@1.0.1(transitive)
- Removedminimalistic-crypto-utils@1.0.1(transitive)
- Removedparse-asn1@5.1.7(transitive)
- Removedpbkdf2@3.1.2(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpublic-encrypt@4.0.3(transitive)
- Removedrandombytes@2.1.0(transitive)
- Removedrandomfill@1.0.4(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstream@0.0.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)