New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

inngest

Package Overview
Dependencies
Maintainers
4
Versions
667
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inngest - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

6

CHANGELOG.md
# inngest
## 2.1.0
### Minor Changes
- b74477f: Add optional `id` property to all step tooling, allowing users to override state recovery
## 2.0.2

@@ -4,0 +10,0 @@

12

components/InngestStepTools.d.ts
import { type Jsonify } from "type-fest";
import { type ObjectPaths, type SendEventPayload } from "../helpers/types";
import { StepOpCode, type ClientOptions, type EventPayload, type HashedOp } from "../types";
import { StepOpCode, type ClientOptions, type EventPayload, type HashedOp, type StepOpts } from "../types";
import { type EventsFromOpts, type Inngest } from "./Inngest";

@@ -46,3 +46,3 @@ import { type ExecutionState } from "./InngestFunction";

*/
sendEvent: <Payload extends SendEventPayload<EventsFromOpts<TOpts>>>(payload: Payload) => Promise<void>;
sendEvent: <Payload extends SendEventPayload<EventsFromOpts<TOpts>>>(payload: Payload, opts?: StepOpts) => Promise<void>;
/**

@@ -74,3 +74,3 @@ * Wait for a particular event to be received before continuing. When the

*/
run: <T extends () => unknown>(name: string, fn: T) => Promise<Jsonify<T extends () => Promise<infer U> ? Awaited<U extends void ? null : U> : ReturnType<T> extends void ? null : ReturnType<T>>>;
run: <T extends () => unknown>(name: string, fn: T, opts?: StepOpts) => Promise<Jsonify<T extends () => Promise<infer U> ? Awaited<U extends void ? null : U> : ReturnType<T> extends void ? null : ReturnType<T>>>;
/**

@@ -86,3 +86,3 @@ * Wait a specified amount of time before continuing.

*/
sleep: (time: number | string) => Promise<void>;
sleep: (time: number | string, opts?: StepOpts) => Promise<void>;
/**

@@ -94,3 +94,3 @@ * Wait until a particular date before continuing by passing a `Date`.

*/
sleepUntil: (time: Date | string) => Promise<void>;
sleepUntil: (time: Date | string, opts?: StepOpts) => Promise<void>;
};

@@ -101,3 +101,3 @@ /**

*/
interface WaitForEventOpts<TriggeringEvent extends EventPayload, IncomingEvent extends EventPayload> {
interface WaitForEventOpts<TriggeringEvent extends EventPayload, IncomingEvent extends EventPayload> extends StepOpts {
/**

@@ -104,0 +104,0 @@ * The step function will wait for the event for a maximum of this time, at

@@ -26,12 +26,22 @@ "use strict";

* Create a unique hash of an operation using only a subset of the operation's
* properties; will never use `data` and will guarantee the order of the object
* so we don't rely on individual tools for that.
* properties; will never use `data` and will guarantee the order of the
* object so we don't rely on individual tools for that.
*
* If the operation already contains an ID, the current ID will be used
* instead, so that users can provide their own IDs.
*/
const hashOp = (
/**
* The op to generate a hash from. We only use a subset of the op's properties
* when creating the hash.
* The op to generate a hash from. We only use a subset of the op's
* properties when creating the hash.
*/
op) => {
var _a, _b, _c, _d;
/**
* If the op already has an ID, we don't need to generate one. This allows
* users to specify their own IDs.
*/
if (op.id) {
return op;
}
const obj = {

@@ -124,4 +134,5 @@ parent: (_b = (_a = state.currentOp) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null,

*/
sendEvent: createTool(() => {
sendEvent: createTool((_payload, opts) => {
return {
id: opts === null || opts === void 0 ? void 0 : opts.id,
op: types_1.StepOpCode.StepPlanned,

@@ -158,3 +169,5 @@ name: "sendEvent",

};
let id;
if (typeof opts !== "string") {
id = opts === null || opts === void 0 ? void 0 : opts.id;
if (opts === null || opts === void 0 ? void 0 : opts.match) {

@@ -168,2 +181,3 @@ matchOpts.if = `event.${opts.match} == async.${opts.match}`;

return {
id,
op: types_1.StepOpCode.WaitForEvent,

@@ -186,4 +200,5 @@ name: event,

*/
run: createTool((name) => {
run: createTool((name, _fn, opts) => {
return {
id: opts === null || opts === void 0 ? void 0 : opts.id,
op: types_1.StepOpCode.StepPlanned,

@@ -203,3 +218,3 @@ name,

*/
sleep: createTool((time) => {
sleep: createTool((time, opts) => {
/**

@@ -210,2 +225,3 @@ * The presence of this operation in the returned stack indicates that the

return {
id: opts === null || opts === void 0 ? void 0 : opts.id,
op: types_1.StepOpCode.Sleep,

@@ -221,3 +237,3 @@ name: (0, strings_1.timeStr)(time),

*/
sleepUntil: createTool((time) => {
sleepUntil: createTool((time, opts) => {
const date = typeof time === "string" ? new Date(time) : time;

@@ -230,2 +246,3 @@ /**

return {
id: opts === null || opts === void 0 ? void 0 : opts.id,
op: types_1.StepOpCode.Sleep,

@@ -232,0 +249,0 @@ name: date.toISOString(),

{
"name": "inngest",
"version": "2.0.2",
"version": "2.1.0",
"description": "Official SDK for Inngest.com",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -805,2 +805,17 @@ import { z } from "zod";

export type SupportedFrameworkName = "cloudflare-pages" | "digitalocean" | "edge" | "express" | "aws-lambda" | "nextjs" | "nuxt" | "redwoodjs" | "remix" | "deno/fresh";
/**
* A set of options that can be passed to any step to configure it.
*/
export interface StepOpts {
/**
* Passing an `id` for a step will overwrite the generated hash that is used
* by Inngest to pause and resume a function.
*
* This is useful if you want to ensure that a step is always the same ID even
* if the code changes.
*
* We recommend not using this unless you have a specific reason to do so.
*/
id?: string;
}
//# sourceMappingURL=types.d.ts.map

@@ -1,2 +0,2 @@

export declare const version = "2.0.2";
export declare const version = "2.1.0";
//# sourceMappingURL=version.d.ts.map

@@ -5,3 +5,3 @@ "use strict";

// Generated by genversion.
exports.version = "2.0.2";
exports.version = "2.1.0";
//# 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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc