Skip to content

Commit

Permalink
Merge branch 'main' into debug-middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwilliams committed Jul 27, 2023
2 parents 61dc0ac + c271eb1 commit 43090f0
Show file tree
Hide file tree
Showing 41 changed files with 1,276 additions and 548 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-buckets-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"inngest": patch
---

Add `x-inngest-no-retry: true` header when non-retriable for internal executor changes
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
37 changes: 37 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Backport

on:
pull_request_target:
types:
- closed
- labeled

jobs:
backport:
name: Backport
runs-on: ubuntu-latest
# Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
github.event.pull_request.merged
&& (
github.event.action == 'closed'
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport')
)
)
steps:
- uses: tibdex/backport@v2
with:
github_token: ${{ secrets.CHANGESET_GITHUB_TOKEN }}
body_template: |-
## Summary
This is an automated backport of <%= mergeCommitSha %> from #<%= number %> to **<%= base %>**. It was created because a maintainer labeled #<%= number %> with the <kbd>[backport <%= base %>](https://github.com/inngest/inngest-js/labels/backport%20<%= base %>)</kbd> label.
When this PR is merged, it will create a PR to release **<%= base %>** if a changeset is found.
## Related
- #<%= number %>
56 changes: 31 additions & 25 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_call:
push:
branches:
- 'renovate/**'
- "renovate/**"

concurrency:
group: pr-${{ github.ref }}
Expand Down Expand Up @@ -39,13 +39,13 @@ jobs:
fail-fast: false
matrix:
tsVersion:
- 'latest'
- 'next'
- '~5.1.0'
- '~5.0.0'
- '~4.9.0'
- '~4.8.0'
- "~4.7.0"
- "latest"
- "next"
- "~5.1.0"
- "~5.0.0"
- "~4.9.0"
- "~4.8.0"
- "~4.7.0"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-and-build
Expand All @@ -69,8 +69,23 @@ jobs:
- uses: ./.github/actions/setup-and-build
- run: yarn lint

package:
name: Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-and-build
- name: Package as tarball
run: yarn local:pack
- name: Archive package tarball
uses: actions/upload-artifact@v3
with:
name: inngestpkg
path: inngest.tgz

examples:
name: Test examples
needs: package
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -101,14 +116,6 @@ jobs:
path: examples/${{ matrix.repo }}
ref: main

# Get the SDK ready and link it locally
- name: Prepare SDK for linking
run: yarn prelink
working-directory: sdk
- name: Create link to SDK
run: yarn link
working-directory: sdk/dist

# If we find a deno.json file in the example repo, we need to pull Deno on
# to the toolchain.
- name: Check if Deno is used
Expand Down Expand Up @@ -149,23 +156,22 @@ jobs:
# Locally linking the lib to a Deno repo is harder, as Deno doesn't
# support local linking between ESM and CJS. Instead, we run a manual
# shim script to bend paths and adjust the target repo's import path.
- name: Link local SDK to example
- name: Download pre-built SDK
uses: actions/download-artifact@v3
with:
name: inngestpkg
path: examples/${{ matrix.repo }}

- name: Install pre-built SDK to example
run: |
if test -f deno.json; then
deno run --allow-read --allow-write ../../../sdk/deno_compat/link.ts
else
yarnv=$(volta run --yarn $(cat ../../../sdk/package.json | jq -r .volta.yarn) yarn -v)
if [[ $yarnv == 3* ]]; then
touch ../../../sdk/dist/yarn.lock
yarn link ../../../sdk/dist
else
volta run --yarn $(cat ../../../sdk/package.json | jq -r .volta.yarn) yarn link inngest
fi
volta run --yarn $(cat ../../../sdk/package.json | jq -r .volta.yarn) yarn add ./inngest.tgz
fi
working-directory: examples/${{ matrix.repo }}


# Copy any SDK function examples to the example repo so that we're always
# testing many functions against many handlers.
- name: Find inngest functions path in example
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ on:
push:
branches:
- main
- 'v*.x'

concurrency: ${{ github.workflow }}-${{ github.ref }}
concurrency: ${{ github.workflow }}

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -21,11 +22,16 @@ jobs:
with:
persist-credentials: false
- uses: ./.github/actions/setup-and-build
- run: node scripts/generateReleaseConfig.js
env:
BRANCH: ${{ github.ref_name }}
- uses: changesets/action@v1
id: changesets
with:
publish: yarn release
title: ${{ github.ref_name == 'main' && 'Release @latest' || format('Release {0}', github.ref_name) }}
env:
GITHUB_TOKEN: ${{ secrets.CHANGESET_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_ENV: test # disable npm access checks; they don't work in CI
BRANCH: ${{ github.ref_name }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ temp/
coverage/

tsdoc-metadata.json

/.direnv/
/inngest.tgz
/landing/vite.config.ts.*
84 changes: 84 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,89 @@
# inngest

## 2.4.0

### Minor Changes

- 6cb6719: Allow filtering of events within triggers

### Patch Changes

- 55c889c: Expose raw error message if status is unknown

## 2.3.0

### Minor Changes

- 7792a62: Add support for streaming to `inngest/remix`

## 2.2.1

### Patch Changes

- 1120e29: Genercize mixed async error; the same symptom can be caused by a few different errors

## 2.2.0

### Minor Changes

- d0a8976: Add support for batching events.

Introduces a new configuration to function configurations.

```ts
batchEvents?: { maxSize: 100, timeout: "5s" }
```

This will take Inngest start execution when one of the following conditions are met.

1. The batch is full
2. Time is up

When the SDK gets invoked, the list of events will be available via a newly exported field `events`.

```ts
createFunction(
{ name: "my func", batchEvents: { maxSize: 100, timeout: "5s" } },
{ event: "my/event" },
async ({ event, events, step }) => {
// events is accessible with the list of events
// event will still be a single event object, which will be the
// 1st event of the list.

const result = step.run("do something with events", () => {
return events.map(() => doSomething());
});

return { success: true, result };
}
);
```

### Patch Changes

- 591f73d: Set `ts` field on sent events if undefined
- 1cbf65e: Alter registration response to include `modified` for deployment deduplication

## 2.1.0

### Minor Changes

- b74477f: Add optional `id` property to all step tooling, allowing users to override state recovery

## 2.0.2

### Patch Changes

- 023d761: Harden error serialization to ensure uncaught exceptions don't slip through during function runs

## 2.0.1

### Patch Changes

- 3ef0b36: Add better visibility into serve handlers issues
- 4226b85: Fix middleware `transformOutput` hook not running if an asynchronous, non-step function's body threw
- cc3929d: Fix a very rare bug in which `step.sleep()` hashing could produce different IDs across different executions

## 2.0.0

### Major Changes
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ yarn add ./inngest.tgz && framework dev

To release to production, we use [Changesets](https://github.com/changesets/changesets). This means that releasing and changelog generation is all managed through PRs, where a bot will guide you through the process of announcing changes in PRs and releasing them once merged to `main`.

#### Legacy versions

Merging and releasing to previous major versions of the SDK is also supported.

- Add a `backport v*.x` label (e.g. `backport v1.x`) to a PR to have a backport PR generated when the initial PR is merged.
- Merging into a `v*.x` branch creates a release PR (named **Release v1.x**, for example) the same as the `main` branch. Simply merge to release.

#### Snapshot versions

If a local `inngest.tgz` isn't ideal, we can release a tagged version to npm. For now, this is relatively manual. For this, please ensure you are in an open PR branch for observability.
Expand Down
8 changes: 8 additions & 0 deletions etc/inngest.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export type FailureEventPayload<P extends EventPayload = EventPayload> = {

// @public
export interface FunctionOptions<Events extends Record<string, EventPayload>, Event extends keyof Events & string> {
batchEvents?: {
maxSize: number;
timeout: TimeStrBatch;
};
// Warning: (ae-forgotten-export) The symbol "Cancellation" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand Down Expand Up @@ -113,6 +117,8 @@ export enum headerKeys {
// (undocumented)
Framework = "x-inngest-framework",
// (undocumented)
NoRetry = "x-inngest-no-retry",
// (undocumented)
Platform = "x-inngest-platform",
// (undocumented)
SdkVersion = "x-inngest-sdk",
Expand Down Expand Up @@ -171,6 +177,7 @@ export class InngestCommHandler<H extends Handler_2, TResTransform extends (res:
protected register(url: URL, devServerHost: string | undefined, deployId: string | undefined | null, getHeaders: () => Record<string, string>): Promise<{
status: number;
message: string;
modified: boolean;
}>;
// Warning: (ae-forgotten-export) The symbol "RegisterRequest" needs to be exported by the entry point index.d.ts
//
Expand Down Expand Up @@ -334,6 +341,7 @@ export type ZodEventSchemas = Record<string, {
// src/components/InngestMiddleware.ts:332:5 - (ae-forgotten-export) The symbol "MiddlewareSendEventInput" needs to be exported by the entry point index.d.ts
// src/components/InngestMiddleware.ts:342:5 - (ae-forgotten-export) The symbol "MiddlewareSendEventOutput" needs to be exported by the entry point index.d.ts
// src/types.ts:51:5 - (ae-forgotten-export) The symbol "failureEventErrorSchema" needs to be exported by the entry point index.d.ts
// src/types.ts:675:5 - (ae-forgotten-export) The symbol "TimeStrBatch" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
6 changes: 3 additions & 3 deletions landing/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1171,9 +1171,9 @@ screenfull@^5.1.0:
integrity sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==

semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
version "6.3.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==

set-harmonic-interval@^1.0.1:
version "1.0.1"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inngest",
"version": "2.0.0",
"version": "2.4.0",
"description": "Official SDK for Inngest.com",
"main": "./index.js",
"types": "./index.d.ts",
Expand Down
30 changes: 30 additions & 0 deletions scripts/generateReleaseConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const fs = require("node:fs");
const path = require("node:path");

const config = {
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": process.env.BRANCH || "main",
"updateInternalDependencies": "patch",
"ignore": [],
};

console.log("Writing release config:", config);

const rootDir = path.join(__dirname, "..");
process.chdir(rootDir);

const changesetDir = path.join(rootDir, ".changeset");
const configName = "config.json";
const configPath = path.join(changesetDir, configName);

const serializedConfig = JSON.stringify(config, null, 2);

fs.writeFileSync(
configPath,
serializedConfig,
);
Loading

0 comments on commit 43090f0

Please sign in to comment.