Skip to content

Commit

Permalink
Merge branch 'main' into feat/invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwilliams committed Oct 25, 2023
2 parents c62e95a + 76a61db commit 4c71b9a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
10 changes: 10 additions & 0 deletions packages/inngest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# inngest

## 3.4.0

### Minor Changes

- [#370](https://github.com/inngest/inngest-js/pull/370) [`48b201a`](https://github.com/inngest/inngest-js/commit/48b201a90f343a1927f38118b732615f77f9ca7f) Thanks [@tonyhb](https://github.com/tonyhb)! - Update concurrency with new scopes and multiple keys

### Patch Changes

- [#369](https://github.com/inngest/inngest-js/pull/369) [`e1046cd`](https://github.com/inngest/inngest-js/commit/e1046cd62430b5599512eb697ebf5ac3fbfd6bb6) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Change `No request version` log from warn to debug

## 3.3.0

### Minor Changes
Expand Down
8 changes: 3 additions & 5 deletions packages/inngest/etc/inngest.api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/inngest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inngest",
"version": "3.3.0",
"version": "3.4.0",
"description": "Official SDK for Inngest.com",
"main": "./index.js",
"types": "./index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/inngest/src/helpers/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const fnDataVersionSchema = z.object({
.optional()
.transform<ExecutionVersion>((v) => {
if (typeof v === "undefined") {
console.warn(
console.debug(
`No request version specified by executor; defaulting to v${PREFERRED_EXECUTION_VERSION}`
);

Expand Down
33 changes: 32 additions & 1 deletion packages/inngest/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,37 @@ export type TriggerOptions<T extends string> = StrictUnion<
}
>;

export interface ConcurrencyOption {
/**
* The concurrency limit for this option, adding a limit on how many concurrent
* steps can execute at once.
*/
limit: number;

/**
* An optional concurrency key, as an expression using the common expression language
* (CEL). The result of this expression is used to create new concurrency groups, or
* sub-queues, for each function run.
*
* The event is passed into this expression as "event".
*
* Examples:
* - `event.data.user_id`: this evaluates to the user_id in the event.data object.
* - `event.data.user_id + "-" + event.data.account_id`: creates a new group per user/account
* - `"ai"`: references a custom string
*/
key?: string;

/**
* An optional scope for the concurrency group. By default, concurrency limits are
* scoped to functions - one function's concurrency limits do not impact other functions.
*
* Changing this "scope" allows concurrency limits to work across environments (eg. production
* vs branch environments) or across your account (global).
*/
scope?: "fn" | "env" | "account";
}

/**
* A set of options for configuring an Inngest function.
*
Expand Down Expand Up @@ -691,7 +722,7 @@ export interface FunctionOptions<
*
* Specifying just a number means specifying only the concurrency limit.
*/
concurrency?: number | { limit: number; key?: string };
concurrency?: number | ConcurrencyOption | [ConcurrencyOption, ConcurrencyOption];

Check warning on line 725 in packages/inngest/src/types.ts

View workflow job for this annotation

GitHub Actions / Lint

Replace `·number·|·ConcurrencyOption` with `⏎····|·number⏎····|·ConcurrencyOption⏎···`

/**
* batchEvents specifies the batch configuration on when this function
Expand Down

0 comments on commit 4c71b9a

Please sign in to comment.