Files
triggerdotdev--trigger.dev/references/nextjs-reference/src/trigger.ts
T
Matt Aitken ad14983e21 React status hooks (#493)
* Added stripInternal to SDK tsconfig

* Statuses can now be set from a run, and are stored in the database

* Added the key to the returned status

* Made the test job have an extra step and only pass in some of the options

* client.getRunStatuses() and the corresponding endpoint

* client.getRun() now includes status info

* Fixed circular dependency schema

* Translate null to undefined

* Added the react package to the nextjs-reference tsconfig

* Removed unused OpenAI integration from nextjs-reference project

* New hooks for getting the statuses

* Disabled most of the nextjs-reference jobs

* Updated the hooks UI

* Updated the endpoints to deal with null statuses values

* The hook is working, with an example

* Changeset: “You can create statuses in your Jobs that can then be read using React hooks”

* Changeset config is back to the old changelog style

* WIP on new React hooks guide

* Guide docs for the new hooks

* Added the status hooks to the React hooks guide

* Removed the links to the status hooks reference for now

* Re-ordered the hooks

* Fix for an error in the docs

* Set a default of a blank array for the GetRunSchema
2023-09-21 10:24:37 -07:00

38 lines
911 B
TypeScript

import { setupServer } from "msw/node";
import { handlers } from "./mocks/handlers";
const mockServer = setupServer(...handlers);
mockServer.listen({
onUnhandledRequest: "bypass",
});
import { Github } from "@trigger.dev/github";
import { OpenAI } from "@trigger.dev/openai";
import { TriggerClient } from "@trigger.dev/sdk";
import { Slack } from "@trigger.dev/slack";
export const client = new TriggerClient({
id: "nextjs-example",
apiKey: process.env.TRIGGER_API_KEY,
apiUrl: process.env.TRIGGER_API_URL,
verbose: false,
ioLogLocalEnabled: true,
});
export const github = new Github({
id: "github",
octokitRequest: { fetch },
});
export const githubUser = new Github({
id: "github-user",
octokitRequest: { fetch },
});
// const githubLocal = new Github({
// id: "github-local",
// token: process.env.GITHUB_TOKEN,
// });
export const slack = new Slack({ id: "my-slack-new" });