v3: new build system fixes round 2 (#1283)
* Fixed empty env vars overriding in dev runs * Don’t import package.json anymore * fix node10 moduleResolution in @trigger.dev/core * Support self-hosters pushing to a custom registry when running deploy * dev: Fixed stuck runs when a child run fails with a process exit * Make some doc notes about known issues and docker hub private repos * Fix --project-ref when running deploy * Fix —config option when deploying * Fixing the flushing/killing process with the new build system * Add monorepo-react-email e2e test fixture * Fix issue with emitDecoratorMetadata and tsconfigs with extends * Got the emit decorator metadata fixture working * Fixed typechecking yarn e2e CLI tests in monorepos * Add remote forced externals system, in case we come across another package that cannot be bundled (spurred on by header-generator) * Remote externals now powered by JSON Hero to be easier to update * resolve config source files * Add a —javascript option to init, defaults to typescript * Add support for prisma typed sql * Remove msw and retry.interceptFetch * Add missing code to the openai retries example * Don’t generate the v3 catalog prisma client during CI * Fixed v3-catalog task imports * Remove interceptor usage in task file * Only import import-in-the-middle hook if there are instrumented packages * Fix yarn.lock file
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
Fixed empty env vars overriding in dev runs
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@trigger.dev/build": patch
|
||||
---
|
||||
|
||||
Fix issue with emitDecoratorMetadata and tsconfigs with extends
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@trigger.dev/sdk": patch
|
||||
"trigger.dev": patch
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
Support self-hosters pushing to a custom registry when running deploy
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@trigger.dev/build": patch
|
||||
---
|
||||
|
||||
Add support for prisma typed sql
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
Fix --project-ref when running deploy
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
Fixed stuck runs when a child run fails with a process exit
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
Add remote forced externals system, in case we come across another package that cannot be bundled (spurred on by header-generator)
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@trigger.dev/sdk": patch
|
||||
---
|
||||
|
||||
Remove msw and retry.interceptFetch
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
fix node10 moduleResolution in @trigger.dev/core
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
Only import import-in-the-middle hook if there are instrumented packages
|
||||
Vendored
+9
-10
@@ -20,15 +20,6 @@
|
||||
"url": "http://localhost:3030",
|
||||
"webRoot": "${workspaceFolder}/apps/webapp/app"
|
||||
},
|
||||
{
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"name": "Debug v2 job catalog",
|
||||
"command": "pnpm run byo-auth",
|
||||
"envFile": "${workspaceFolder}/references/job-catalog/.env",
|
||||
"cwd": "${workspaceFolder}/references/job-catalog",
|
||||
"sourceMaps": true
|
||||
},
|
||||
{
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
@@ -89,9 +80,17 @@
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"name": "Debug CLI e2e tests",
|
||||
"command": "PM=yarn pnpm run test:e2e",
|
||||
"command": "MOD=otel-telemetry-loader pnpm run test:e2e",
|
||||
"cwd": "${workspaceFolder}/packages/cli-v3",
|
||||
"sourceMaps": true
|
||||
},
|
||||
{
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"name": "debug v3 hello-world dev",
|
||||
"command": "pnpm exec triggerdev dev",
|
||||
"cwd": "${workspaceFolder}/references/hello-world",
|
||||
"sourceMaps": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
|
||||
externalBuildData:
|
||||
deployment.externalBuildData as InitializeDeploymentResponseBody["externalBuildData"],
|
||||
imageTag,
|
||||
registryHost: env.DEPLOY_REGISTRY_HOST,
|
||||
registryHost: body.data.registryHost ?? env.DEPLOY_REGISTRY_HOST,
|
||||
};
|
||||
|
||||
return json(responseBody, { status: 200 });
|
||||
|
||||
@@ -9,7 +9,13 @@ export async function action({ request }: ActionFunctionArgs) {
|
||||
}
|
||||
|
||||
try {
|
||||
return await reportComputeUsage(request);
|
||||
const result = await reportComputeUsage(request);
|
||||
|
||||
if (result === undefined) {
|
||||
return new Response(null, { status: 500 });
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
logger.error("Error reporting compute usage", { error: e });
|
||||
return new Response(null, { status: 500 });
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
syncDeclarativeSchedules,
|
||||
} from "./createBackgroundWorker.server";
|
||||
import { TimeoutDeploymentService } from "./timeoutDeployment.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
|
||||
export class CreateDeploymentBackgroundWorkerService extends BaseService {
|
||||
public async call(
|
||||
|
||||
@@ -29,7 +29,9 @@ export class InitializeDeploymentService extends BaseService {
|
||||
const nextVersion = calculateNextBuildVersion(latestDeployment?.version);
|
||||
|
||||
// Try and create a depot build and get back the external build data
|
||||
const externalBuildData = await createRemoteImageBuild(environment.project);
|
||||
const externalBuildData = !!payload.selfHosted
|
||||
? await createRemoteImageBuild(environment.project)
|
||||
: undefined;
|
||||
|
||||
const triggeredBy = payload.userId
|
||||
? await this._prisma.user.findUnique({
|
||||
@@ -65,7 +67,9 @@ export class InitializeDeploymentService extends BaseService {
|
||||
new Date(Date.now() + 180_000) // 3 minutes
|
||||
);
|
||||
|
||||
const imageTag = `${env.DEPLOY_REGISTRY_NAMESPACE}/${environment.project.externalRef}:${deployment.version}.${environment.slug}`;
|
||||
const imageTag = `${payload.namespace ?? env.DEPLOY_REGISTRY_NAMESPACE}/${
|
||||
environment.project.externalRef
|
||||
}:${deployment.version}.${environment.slug}`;
|
||||
|
||||
return { deployment, imageTag };
|
||||
});
|
||||
|
||||
@@ -200,8 +200,11 @@ In this complicated example:
|
||||
- If there are no Response headers we let the normal retrying logic handle it (return undefined).
|
||||
- If we've run out of requests or tokens we retry at the time specified in the headers.
|
||||
|
||||
```ts
|
||||
<CodeGroup>
|
||||
|
||||
```ts tasks.ts
|
||||
import { task } from "@trigger.dev/sdk/v3";
|
||||
import { calculateISO8601DurationOpenAIVariantResetAt, openai } from "./openai.js";
|
||||
|
||||
export const openaiTask = task({
|
||||
id: "openai-task",
|
||||
@@ -257,6 +260,48 @@ export const openaiTask = task({
|
||||
});
|
||||
```
|
||||
|
||||
```ts openai.ts
|
||||
import { OpenAI } from "openai";
|
||||
|
||||
export const openai = new OpenAI({ apiKey: env.OPENAI_API_KEY });
|
||||
|
||||
export function calculateISO8601DurationOpenAIVariantResetAt(
|
||||
resets: string,
|
||||
now: Date = new Date()
|
||||
): Date | undefined {
|
||||
// Check if the input is null or undefined
|
||||
if (!resets) return undefined;
|
||||
|
||||
// Regular expression to match the duration string pattern
|
||||
const pattern = /^(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?(?:(\d+)ms)?$/;
|
||||
const match = resets.match(pattern);
|
||||
|
||||
// If the string doesn't match the expected format, return undefined
|
||||
if (!match) return undefined;
|
||||
|
||||
// Extract days, hours, minutes, seconds, and milliseconds from the string
|
||||
const days = parseInt(match[1] ?? "0", 10) || 0;
|
||||
const hours = parseInt(match[2] ?? "0", 10) || 0;
|
||||
const minutes = parseInt(match[3] ?? "0", 10) || 0;
|
||||
const seconds = parseFloat(match[4] ?? "0") || 0;
|
||||
const milliseconds = parseInt(match[5] ?? "0", 10) || 0;
|
||||
|
||||
// Calculate the future date based on the current date plus the extracted time
|
||||
const resetAt = new Date(now);
|
||||
resetAt.setDate(resetAt.getDate() + days);
|
||||
resetAt.setHours(resetAt.getHours() + hours);
|
||||
resetAt.setMinutes(resetAt.getMinutes() + minutes);
|
||||
resetAt.setSeconds(resetAt.getSeconds() + Math.floor(seconds));
|
||||
resetAt.setMilliseconds(
|
||||
resetAt.getMilliseconds() + (seconds - Math.floor(seconds)) * 1000 + milliseconds
|
||||
);
|
||||
|
||||
return resetAt;
|
||||
}
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
## Preventing retries
|
||||
|
||||
### Using `AbortTaskRunError`
|
||||
|
||||
@@ -399,7 +399,24 @@ You can now authenticate the `dev` command using the `TRIGGER_ACCESS_TOKEN` envi
|
||||
TRIGGER_ACCESS_TOKEN=<your access token> npx trigger.dev@0.0.0-prerelease-20240905123715 dev
|
||||
```
|
||||
|
||||
### Better deploy support for self-hosters
|
||||
|
||||
You can now specify a custom registry and namespace when deploying via a self-hosted instance of Trigger.dev:
|
||||
|
||||
```sh
|
||||
npx trigger.dev@0.0.0-prerelease-20240905123715 deploy --self-hosted --load-image --push --registry docker.io --namespace mydockerhubusername
|
||||
```
|
||||
|
||||
All you have to do is create a repository in dockerhub that matches the project ref of your Trigger.dev project (e.g. `proj_rrkpdguyagvsoktglnod`)
|
||||
|
||||
<Note>
|
||||
Docker Hub will automatically create a repository the first time you push, which is public by
|
||||
default. If you want to keep these images private, make sure you create the repository before you
|
||||
first run the `deploy` command
|
||||
</Note>
|
||||
|
||||
## Known issues
|
||||
|
||||
- Path aliases are not yet support in your `trigger.config.ts` file. To workaround this issue you'll need to rewrite path aliases to their relative paths. (See [this](https://github.com/unjs/jiti/issues/166) and [this](https://knip.dev/reference/known-issues#path-aliases-in-config-files)) for more info.
|
||||
- Some events in the run trace view may get permanently stuck in a loading state. This is a known issue and we're working on a fix.
|
||||
- `*.test.ts` and `.spec.ts` files inside the trigger dirs will be bundled and could cause issues. You'll need to move these files outside of the trigger dirs to avoid this issue.
|
||||
|
||||
@@ -63,7 +63,8 @@
|
||||
"dependencies": {
|
||||
"@trigger.dev/core": "workspace:3.0.0-beta.56",
|
||||
"pkg-types": "^1.1.3",
|
||||
"tinyglobby": "^0.2.2"
|
||||
"tinyglobby": "^0.2.2",
|
||||
"tsconfck": "3.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.14.14",
|
||||
|
||||
@@ -9,6 +9,10 @@ export type PrismaExtensionOptions = {
|
||||
schema: string;
|
||||
migrate?: boolean;
|
||||
version?: string;
|
||||
/**
|
||||
* Adds the `--sql` flag to the `prisma generate` command. This will generate the SQL files for the Prisma schema. Requires the `typedSql preview feature and prisma 5.19.0 or later.
|
||||
*/
|
||||
typedSql?: boolean;
|
||||
/**
|
||||
* The client generator to use. Set this param to prevent all generators in the prisma schema from being generated.
|
||||
*
|
||||
@@ -114,9 +118,40 @@ export class PrismaExtension implements BuildExtension {
|
||||
|
||||
let prismaDir: string | undefined;
|
||||
|
||||
const generatorFlag = this.options.clientGenerator
|
||||
? `--generator=${this.options.clientGenerator}`
|
||||
: "";
|
||||
const generatorFlags: string[] = [];
|
||||
|
||||
if (this.options.clientGenerator) {
|
||||
generatorFlags.push(`--generator=${this.options.clientGenerator}`);
|
||||
}
|
||||
|
||||
if (this.options.typedSql) {
|
||||
generatorFlags.push(`--sql`);
|
||||
|
||||
const schemaDir = dirname(this._resolvedSchemaPath);
|
||||
const prismaDir = dirname(schemaDir);
|
||||
|
||||
context.logger.debug(`Using typedSql`);
|
||||
|
||||
// Find all the files prisma/sql/*.sql
|
||||
const sqlFiles = await readdir(join(prismaDir, "sql")).then((files) =>
|
||||
files.filter((file) => file.endsWith(".sql"))
|
||||
);
|
||||
|
||||
context.logger.debug(`Found sql files`, {
|
||||
sqlFiles,
|
||||
});
|
||||
|
||||
const sqlDestinationPath = join(manifest.outputPath, "prisma", "sql");
|
||||
|
||||
for (const file of sqlFiles) {
|
||||
const destination = join(sqlDestinationPath, file);
|
||||
const source = join(prismaDir, "sql", file);
|
||||
|
||||
context.logger.debug(`Copying the sql from ${source} to ${destination}`);
|
||||
|
||||
await cp(source, destination);
|
||||
}
|
||||
}
|
||||
|
||||
if (usingSchemaFolder) {
|
||||
const schemaDir = dirname(this._resolvedSchemaPath);
|
||||
@@ -150,7 +185,7 @@ export class PrismaExtension implements BuildExtension {
|
||||
commands.push(
|
||||
`${binaryForRuntime(
|
||||
manifest.runtime
|
||||
)} node_modules/prisma/build/index.js generate ${generatorFlag}` // Don't add the --schema flag or this will fail
|
||||
)} node_modules/prisma/build/index.js generate ${generatorFlags.join(" ")}` // Don't add the --schema flag or this will fail
|
||||
);
|
||||
} else {
|
||||
prismaDir = dirname(this._resolvedSchemaPath);
|
||||
@@ -169,7 +204,9 @@ export class PrismaExtension implements BuildExtension {
|
||||
commands.push(
|
||||
`${binaryForRuntime(
|
||||
manifest.runtime
|
||||
)} node_modules/prisma/build/index.js generate --schema=./prisma/schema.prisma ${generatorFlag}`
|
||||
)} node_modules/prisma/build/index.js generate --schema=./prisma/schema.prisma ${generatorFlags.join(
|
||||
" "
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +1,68 @@
|
||||
import { BuildExtension, esbuildPlugin } from "@trigger.dev/core/v3/build";
|
||||
import type { Plugin } from "esbuild";
|
||||
import { BuildExtension } from "@trigger.dev/core/v3/build";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { readTSConfig } from "pkg-types";
|
||||
import typescriptPkg from "typescript";
|
||||
|
||||
const { transpileModule, ModuleKind } = typescriptPkg;
|
||||
|
||||
const decoratorMatcher = new RegExp(/((?<![(\s]\s*['"])@\w[.[\]\w\d]*\s*(?![;])[((?=\s)])/);
|
||||
|
||||
export type EmitDecoratorMetadataOptions = {
|
||||
path?: string;
|
||||
};
|
||||
|
||||
export function emitDecoratorMetadata(options: EmitDecoratorMetadataOptions = {}): BuildExtension {
|
||||
return esbuildPlugin(plugin(options));
|
||||
}
|
||||
|
||||
function plugin(options: EmitDecoratorMetadataOptions = {}): Plugin {
|
||||
export function emitDecoratorMetadata(): BuildExtension {
|
||||
return {
|
||||
name: "emitDecoratorMetadata",
|
||||
async setup(build) {
|
||||
const tsconfig = await readTSConfig(options.path);
|
||||
onBuildStart(context) {
|
||||
context.registerPlugin({
|
||||
name: "emitDecoratorMetadata",
|
||||
async setup(build) {
|
||||
const { parseNative, TSConfckCache } = await import("tsconfck");
|
||||
const cache = new TSConfckCache<any>();
|
||||
|
||||
if (!tsconfig) {
|
||||
return;
|
||||
}
|
||||
build.onLoad({ filter: /\.ts$/ }, async (args) => {
|
||||
context.logger.debug("emitDecoratorMetadata onLoad", { args });
|
||||
|
||||
if (!tsconfig.compilerOptions?.emitDecoratorMetadata) {
|
||||
console.warn(
|
||||
"Typescript decorators plugin requires `emitDecoratorMetadata` to be set to true in your tsconfig.json"
|
||||
);
|
||||
const { tsconfigFile, tsconfig } = await parseNative(args.path, {
|
||||
ignoreNodeModules: true,
|
||||
cache,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
context.logger.debug("emitDecoratorMetadata parsed native tsconfig", {
|
||||
tsconfig,
|
||||
tsconfigFile,
|
||||
args,
|
||||
});
|
||||
|
||||
build.onLoad({ filter: /\.ts$/ }, async (args) => {
|
||||
const ts = await readFile(args.path, "utf8");
|
||||
if (tsconfig.compilerOptions?.emitDecoratorMetadata !== true) {
|
||||
context.logger.debug("emitDecoratorMetadata skipping", {
|
||||
args,
|
||||
tsconfig,
|
||||
});
|
||||
|
||||
if (!ts) return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Find the decorator and if there isn't one, return out
|
||||
if (!decoratorMatcher.test(ts)) {
|
||||
return;
|
||||
}
|
||||
const ts = await readFile(args.path, "utf8");
|
||||
|
||||
const program = transpileModule(ts, {
|
||||
fileName: args.path,
|
||||
compilerOptions: {
|
||||
...tsconfig.compilerOptions,
|
||||
module: ModuleKind.ES2022,
|
||||
},
|
||||
});
|
||||
if (!ts) return undefined;
|
||||
|
||||
return { contents: program.outputText };
|
||||
// Find the decorator and if there isn't one, return out
|
||||
if (!decoratorMatcher.test(ts)) {
|
||||
context.logger.debug("emitDecoratorMetadata skipping, no decorators found", {
|
||||
args,
|
||||
});
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const program = transpileModule(ts, {
|
||||
fileName: args.path,
|
||||
compilerOptions: {
|
||||
...tsconfig.compilerOptions,
|
||||
module: ModuleKind.ES2022,
|
||||
},
|
||||
});
|
||||
|
||||
return { contents: program.outputText };
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@ To do so, it runs the deploy code against fixture projects that are located unde
|
||||
Those fixtures reproduce minimal project structure and contents, in order to reproduce known bugs and run fast.
|
||||
|
||||
**Notes**
|
||||
|
||||
- The suite uses vitest
|
||||
- Everything happens locally
|
||||
- There is no login required
|
||||
@@ -63,69 +64,116 @@ This will test your fixture project, and generate outputs in the `packages/cli-v
|
||||
|
||||
1. Create a new `packages/cli-v3/e2e/fixtures/<fixture-name>` folder.
|
||||
|
||||
It will hold the project to test.
|
||||
It will hold the project to test.
|
||||
|
||||
2. Add a `package.json` file in your `packages/cli-v3/e2e/fixtures/<fixture-name>` folder.
|
||||
|
||||
Use the following template:
|
||||
Use the following template:
|
||||
|
||||
```json package.json
|
||||
{
|
||||
"name": "<fixture-name>",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"pnpm": "8.15.5",
|
||||
"yarn": "4.2.2"
|
||||
},
|
||||
"packageManager": "pnpm@8.15.5"
|
||||
}
|
||||
```
|
||||
```json package.json
|
||||
{
|
||||
"name": "<fixture-name>",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"pnpm": "8.15.5",
|
||||
"yarn": "4.2.2"
|
||||
},
|
||||
"packageManager": "pnpm@8.15.5"
|
||||
}
|
||||
```
|
||||
|
||||
> The `engines` field is used to store the versions of pnpm and yarn to use when running the suite.
|
||||
> The `engines` field is used to store the versions of pnpm and yarn to use when running the suite.
|
||||
|
||||
3. Add an empty `pnpm-workspace.yaml` in your `packages/cli-v3/e2e/fixtures/<fixture-name>` folder.
|
||||
|
||||
This is necessary to prevent the Trigger.dev monorepo from handling this project.
|
||||
Please check https://github.com/pnpm/pnpm/issues/2412 for more inforation.
|
||||
This is necessary to prevent the Trigger.dev monorepo from handling this project.
|
||||
Please check https://github.com/pnpm/pnpm/issues/2412 for more inforation.
|
||||
|
||||
4. Add an empty `yarn.lock` in your fixture folder.
|
||||
|
||||
This is necessary to allow to use `yarn` without having a warning on the current project being a `pnpm` project.
|
||||
This is necessary to allow to use `yarn` without having a warning on the current project being a `pnpm` project.
|
||||
|
||||
5. Add the following `.yarnrc.yaml` in your fixture folder.
|
||||
|
||||
This will avoid having `.pnp.cjs` and `.pnp.loader.mjs` and keep versioned files to a minimum.
|
||||
This will avoid having `.pnp.cjs` and `.pnp.loader.mjs` and keep versioned files to a minimum.
|
||||
|
||||
```yaml .yarnrc.yml
|
||||
nodeLinker: node-modules
|
||||
```
|
||||
```yaml .yarnrc.yml
|
||||
nodeLinker: node-modules
|
||||
```
|
||||
|
||||
6. Install the fixture dependencies and generate lockfiles.
|
||||
|
||||
Like you would in any project.
|
||||
E.g. if your fixture contains a trigger task that uses the `jsdom` library:
|
||||
Like you would in any project.
|
||||
E.g. if your fixture contains a trigger task that uses the `jsdom` library:
|
||||
|
||||
```sh
|
||||
cd packages/cli-v3/e2e/fixtures/<fixture-name>
|
||||
corepack use pnpm@8.15.5
|
||||
pnpm install jsdom
|
||||
```
|
||||
```sh
|
||||
cd packages/cli-v3/e2e/fixtures/<fixture-name>
|
||||
corepack use pnpm@8.15.5
|
||||
pnpm install jsdom
|
||||
```
|
||||
|
||||
> This will update the `package.json` and generate the `pnpm-lock.yaml` file.
|
||||
> This will update the `package.json` and generate the `pnpm-lock.yaml` file.
|
||||
|
||||
7. To run the test suite against multiple package manager, we need to generate the other lockfiles.
|
||||
7. Make sure typescript is installed in the fixture project.
|
||||
|
||||
```sh
|
||||
cd packages/cli-v3/e2e/fixtures/<fixture-name>
|
||||
rm -rf **/node_modules
|
||||
npm install
|
||||
rm -rf **/node_modules
|
||||
corepack use yarn@4.2.2 # will update the yarn lockfile
|
||||
```
|
||||
```sh
|
||||
cd packages/cli-v3/e2e/fixtures/<fixture-name>
|
||||
corepack use pnpm@8.15.5
|
||||
pnpm install typescript
|
||||
```
|
||||
|
||||
> Do it in this order, otherwise `npm install` will update the existing `yarn.lock` file with legacy version 1.
|
||||
> This is necessary to typecheck the project during the test suite.
|
||||
|
||||
8. Create a new `packages/cli-v3/e2e/fixtures/trigger` folder, and create a trigger task in it.
|
||||
8. Add a tsconfig.json file similar to the one below:
|
||||
|
||||
```json tsconfig.json
|
||||
{
|
||||
"include": ["src/**/*.ts", "trigger.config.ts"],
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"moduleDetection": "force",
|
||||
"verbatimModuleSyntax": false,
|
||||
"jsx": "react",
|
||||
"strict": true,
|
||||
"alwaysStrict": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"resolveJsonModule": true,
|
||||
"removeComments": false,
|
||||
"esModuleInterop": true,
|
||||
"emitDecoratorMetadata": false,
|
||||
"experimentalDecorators": false,
|
||||
"downlevelIteration": true,
|
||||
"isolatedModules": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"pretty": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
9. To run the test suite against multiple package manager, we need to generate the other lockfiles.
|
||||
|
||||
```sh
|
||||
cd packages/cli-v3/e2e/fixtures/<fixture-name>
|
||||
rm -rf **/node_modules
|
||||
npm install
|
||||
rm -rf **/node_modules
|
||||
corepack use yarn@4.2.2 # will update the yarn lockfile
|
||||
```
|
||||
|
||||
> Do it in this order, otherwise `npm install` will update the existing `yarn.lock` file with legacy version 1.
|
||||
|
||||
10. Create a new `packages/cli-v3/e2e/fixtures/trigger` folder, and create a trigger task in it.
|
||||
|
||||
Here is an example:
|
||||
|
||||
@@ -140,7 +188,7 @@ This will test your fixture project, and generate outputs in the `packages/cli-v
|
||||
});
|
||||
```
|
||||
|
||||
9. Add a trigger configuration file.
|
||||
11. Add a trigger configuration file.
|
||||
|
||||
The configuration file is mandatory here, the E2E suite does not execute `trigger.dev` commands.
|
||||
|
||||
@@ -153,9 +201,9 @@ This will test your fixture project, and generate outputs in the `packages/cli-v
|
||||
|
||||
> The project reference can be anything here, as the suite runs locally without connecting to the platform.
|
||||
|
||||
10. Commit your changes.
|
||||
12. Commit your changes.
|
||||
|
||||
11. Add your fixture test configuration in `fixtures.config.js`.
|
||||
13. Add your fixture test configuration in `fixtures.config.js`.
|
||||
|
||||
```javascript fixtures.config.js
|
||||
export const fixturesConfig = [
|
||||
|
||||
@@ -14,6 +14,7 @@ import { E2EOptions, E2EOptionsSchema } from "./schemas.js";
|
||||
import { executeTestCaseRun, runTsc } from "./utils.js";
|
||||
import { normalizeImportPath } from "../src/utilities/normalizeImportPath.js";
|
||||
import { installFixtureDeps, LOCKFILES, PackageManager, parsePackageManager } from "./utils.js";
|
||||
import { alwaysExternal } from "@trigger.dev/core/v3/build";
|
||||
|
||||
const TIMEOUT = 120_000;
|
||||
|
||||
@@ -127,6 +128,8 @@ describe.concurrent("buildWorker", async () => {
|
||||
id,
|
||||
tempDir,
|
||||
tsconfig,
|
||||
packageManager,
|
||||
fixtureDir,
|
||||
workspaceDir,
|
||||
wantConfigInvalidError,
|
||||
wantConfigNotFoundError,
|
||||
@@ -164,7 +167,11 @@ describe.concurrent("buildWorker", async () => {
|
||||
expect(resolvedConfig!).toBeTruthy();
|
||||
|
||||
if (tsconfig) {
|
||||
const tscResult = await runTsc(workspaceDir, tsconfig);
|
||||
const tscResult = await runTsc(
|
||||
workspaceDir,
|
||||
tsconfig,
|
||||
packageManager === "yarn" ? fixtureDir : undefined
|
||||
);
|
||||
|
||||
expect(tscResult.success).toBe(true);
|
||||
}
|
||||
@@ -181,6 +188,7 @@ describe.concurrent("buildWorker", async () => {
|
||||
destination: destination.path,
|
||||
resolvedConfig: resolvedConfig!,
|
||||
rewritePaths: false,
|
||||
forcedExternals: alwaysExternal,
|
||||
});
|
||||
})(),
|
||||
wantBuildWorkerError ? "does not build" : "builds"
|
||||
@@ -194,7 +202,14 @@ describe.concurrent("buildWorker", async () => {
|
||||
await buildExpect.resolves.not.toThrowError();
|
||||
|
||||
if (buildManifestMatcher) {
|
||||
expect(buildManifest!).toMatchObject(buildManifestMatcher);
|
||||
for (const external of buildManifestMatcher.externals ?? []) {
|
||||
expect(buildManifest!.externals).toContainEqual(external);
|
||||
}
|
||||
|
||||
for (const file of buildManifestMatcher.files ?? []) {
|
||||
const found = (buildManifestMatcher.files ?? []).find((f) => f?.entry === file?.entry);
|
||||
expect(found).toBeTruthy();
|
||||
}
|
||||
} else {
|
||||
expect(buildManifest!).toBeTruthy();
|
||||
}
|
||||
@@ -203,7 +218,12 @@ describe.concurrent("buildWorker", async () => {
|
||||
|
||||
const rewrittenManifest = rewriteBuildManifestPaths(buildManifest!, destination.path);
|
||||
|
||||
expect(rewrittenManifest.loaderEntryPoint).toBe("/app/src/entryPoints/loader.mjs");
|
||||
if (resolvedConfig!.instrumentedPackageNames?.length ?? 0 > 0) {
|
||||
expect(rewrittenManifest.loaderEntryPoint).toBe("/app/src/entryPoints/loader.mjs");
|
||||
} else {
|
||||
expect(rewrittenManifest.loaderEntryPoint).toBeUndefined();
|
||||
}
|
||||
|
||||
expect(rewrittenManifest.indexWorkerEntryPoint).toBe(
|
||||
"/app/src/entryPoints/deploy-index-worker.mjs"
|
||||
);
|
||||
@@ -222,7 +242,7 @@ describe.concurrent("buildWorker", async () => {
|
||||
nodeOptions: buildManifest!.loaderEntryPoint
|
||||
? `--import=${normalizeImportPath(buildManifest!.loaderEntryPoint)}`
|
||||
: undefined,
|
||||
env: {},
|
||||
env: testCase.envVars ?? {},
|
||||
otelHookExclude: buildManifest!.otelImportHook?.exclude,
|
||||
otelHookInclude: buildManifest!.otelImportHook?.include,
|
||||
handleStdout(data) {
|
||||
@@ -262,7 +282,7 @@ describe.concurrent("buildWorker", async () => {
|
||||
}
|
||||
|
||||
for (const taskRun of runs || []) {
|
||||
const { result, totalDurationMs } = await executeTestCaseRun({
|
||||
const { result, totalDurationMs, spans } = await executeTestCaseRun({
|
||||
run: taskRun,
|
||||
testCase,
|
||||
destination: destination.path,
|
||||
@@ -270,10 +290,30 @@ describe.concurrent("buildWorker", async () => {
|
||||
contentHash: buildManifest!.contentHash,
|
||||
});
|
||||
|
||||
logger.debug("Task run result", result);
|
||||
|
||||
expect(result.ok).toBe(taskRun.result.ok);
|
||||
|
||||
if (taskRun.result.durationMs) {
|
||||
expect(totalDurationMs).toBeGreaterThanOrEqual(taskRun.result.durationMs);
|
||||
if (result.ok) {
|
||||
if (taskRun.result.durationMs) {
|
||||
expect(totalDurationMs).toBeGreaterThanOrEqual(taskRun.result.durationMs);
|
||||
}
|
||||
|
||||
if (taskRun.result.output) {
|
||||
expect(result.output).toEqual(taskRun.result.output);
|
||||
}
|
||||
|
||||
if (taskRun.result.outputType) {
|
||||
expect(result.outputType).toEqual(taskRun.result.outputType);
|
||||
}
|
||||
|
||||
if (taskRun.result.spans) {
|
||||
for (const spanName of taskRun.result.spans) {
|
||||
const foundSpan = spans.find((span) => span.name === spanName);
|
||||
|
||||
expect(foundSpan).toBeTruthy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ export interface TestCaseRun {
|
||||
result: {
|
||||
ok: boolean;
|
||||
durationMs?: number;
|
||||
output?: string;
|
||||
outputType?: string;
|
||||
spans?: string[];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,6 +38,7 @@ export interface TestCase {
|
||||
workerManifestMatcher?: DeepPartial<WorkerManifest>;
|
||||
runs?: TestCaseRun[];
|
||||
tsconfig?: string;
|
||||
envVars?: { [key: string]: string };
|
||||
}
|
||||
|
||||
export const fixturesConfig: TestCase[] = [
|
||||
@@ -68,4 +72,111 @@ export const fixturesConfig: TestCase[] = [
|
||||
],
|
||||
tsconfig: "tsconfig.json",
|
||||
},
|
||||
{
|
||||
id: "otel-telemetry-loader",
|
||||
buildManifestMatcher: {
|
||||
runtime: "node",
|
||||
externals: [
|
||||
{
|
||||
name: "openai",
|
||||
version: "4.47.0",
|
||||
},
|
||||
{
|
||||
name: "import-in-the-middle",
|
||||
version: "1.11.0",
|
||||
},
|
||||
],
|
||||
files: [{ entry: "src/trigger/ai.ts" }],
|
||||
},
|
||||
workerManifestMatcher: {
|
||||
tasks: [
|
||||
{
|
||||
id: "ai",
|
||||
filePath: "src/trigger/ai.ts",
|
||||
exportName: "aiTask",
|
||||
},
|
||||
],
|
||||
},
|
||||
runs: [
|
||||
{
|
||||
task: { id: "ai", filePath: "src/trigger/ai.ts", exportName: "aiTask" },
|
||||
payload: '{"prompt":"be funny"}',
|
||||
result: { ok: true, durationMs: 1 },
|
||||
},
|
||||
],
|
||||
tsconfig: "tsconfig.json",
|
||||
envVars: {
|
||||
OPENAI_API_KEY: "my-api-key",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "emit-decorator-metadata",
|
||||
buildManifestMatcher: {
|
||||
runtime: "node",
|
||||
externals: [
|
||||
{
|
||||
name: "import-in-the-middle",
|
||||
version: "1.11.0",
|
||||
},
|
||||
],
|
||||
files: [{ entry: "src/trigger/decorators.ts" }],
|
||||
},
|
||||
workerManifestMatcher: {
|
||||
tasks: [
|
||||
{
|
||||
id: "decoratorsTask",
|
||||
filePath: "src/trigger/decorators.ts",
|
||||
exportName: "decoratorsTask",
|
||||
},
|
||||
],
|
||||
},
|
||||
runs: [
|
||||
{
|
||||
task: {
|
||||
id: "decoratorsTask",
|
||||
filePath: "src/trigger/decorators.ts",
|
||||
exportName: "decoratorsTask",
|
||||
},
|
||||
payload: "{}",
|
||||
result: { ok: true, durationMs: 1 },
|
||||
},
|
||||
],
|
||||
tsconfig: "tsconfig.json",
|
||||
},
|
||||
{
|
||||
id: "monorepo-react-email",
|
||||
workspaceRelativeDir: "packages/trigger",
|
||||
tsconfig: "tsconfig.json",
|
||||
buildManifestMatcher: {
|
||||
runtime: "node",
|
||||
externals: [
|
||||
{
|
||||
name: "import-in-the-middle",
|
||||
version: "1.11.0",
|
||||
},
|
||||
],
|
||||
files: [{ entry: "src/reactEmail.tsx" }],
|
||||
},
|
||||
workerManifestMatcher: {
|
||||
tasks: [
|
||||
{
|
||||
id: "react-email",
|
||||
filePath: "src/reactEmail.tsx",
|
||||
exportName: "reactEmail",
|
||||
},
|
||||
],
|
||||
},
|
||||
runs: [
|
||||
{
|
||||
task: { id: "react-email", filePath: "src/reactEmail.tsx", exportName: "reactEmail" },
|
||||
payload: "{}",
|
||||
result: {
|
||||
ok: true,
|
||||
output:
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--$--><html dir="ltr" lang="en"><a href="https://example.com" style="line-height:100%;text-decoration:none;display:inline-block;max-width:100%;mso-padding-alt:0px;background:#000;color:#fff;padding:12px 20px 12px 20px" target="_blank"><span><!--[if mso]><i style="mso-font-width:500%;mso-text-raise:18" hidden>  </i><![endif]--></span><span style="max-width:100%;display:inline-block;line-height:120%;mso-padding-alt:0px;mso-text-raise:9px">Click me</span><span><!--[if mso]><i style="mso-font-width:500%" hidden>  ​</i><![endif]--></span></a></html><!--/$-->',
|
||||
outputType: "text/plain",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
nodeLinker: node-modules
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "emit-decorator-metadata",
|
||||
"private": true,
|
||||
"packageManager": "yarn@4.2.2+sha256.1aa43a5304405be7a7cb9cb5de7b97de9c4e8ddd3273e4dad00d6ae3eb39f0ef",
|
||||
"engines": {
|
||||
"pnpm": "8.15.5",
|
||||
"yarn": "4.2.2"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@trigger.dev/sdk": "0.0.0-cli-e2e-20240910161832",
|
||||
"reflect-metadata": "0.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trigger.dev/build": "0.0.0-cli-e2e-20240910161832",
|
||||
"@types/node": "22.5.4",
|
||||
"typescript": "5.5.4"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
# https://github.com/pnpm/pnpm/issues/2412
|
||||
packages:
|
||||
- "packages/*"
|
||||
@@ -0,0 +1,57 @@
|
||||
import "reflect-metadata";
|
||||
import { task } from "@trigger.dev/sdk/v3";
|
||||
import { setTimeout } from "node:timers/promises";
|
||||
|
||||
class Point {
|
||||
constructor(
|
||||
public x: number,
|
||||
public y: number
|
||||
) {}
|
||||
}
|
||||
|
||||
class Line {
|
||||
private _start: Point;
|
||||
private _end: Point;
|
||||
|
||||
@validate
|
||||
set start(value: Point) {
|
||||
this._start = value;
|
||||
}
|
||||
|
||||
get start() {
|
||||
return this._start;
|
||||
}
|
||||
|
||||
@validate
|
||||
set end(value: Point) {
|
||||
this._end = value;
|
||||
}
|
||||
|
||||
get end() {
|
||||
return this._end;
|
||||
}
|
||||
}
|
||||
|
||||
function validate<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) {
|
||||
let set = descriptor.set!;
|
||||
|
||||
descriptor.set = function (value: T) {
|
||||
let type = Reflect.getMetadata("design:type", target, propertyKey);
|
||||
|
||||
if (!(value instanceof type)) {
|
||||
throw new TypeError(`Invalid type, got ${typeof value} not ${type.name}.`);
|
||||
}
|
||||
|
||||
set.call(this, value);
|
||||
};
|
||||
}
|
||||
|
||||
export const decoratorsTask = task({
|
||||
id: "decoratorsTask",
|
||||
run: async () => {
|
||||
const line = new Line();
|
||||
line.start = new Point(0, 0);
|
||||
|
||||
console.log("Hello, World!", { line });
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineConfig } from "@trigger.dev/sdk/v3";
|
||||
import { emitDecoratorMetadata } from "@trigger.dev/build/extensions/typescript";
|
||||
|
||||
export default defineConfig({
|
||||
project: "<fixture project>",
|
||||
dirs: ["./src/trigger"],
|
||||
build: {
|
||||
extensions: [emitDecoratorMetadata()],
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"moduleDetection": "force",
|
||||
"verbatimModuleSyntax": false,
|
||||
"jsx": "react",
|
||||
"strict": true,
|
||||
"alwaysStrict": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"resolveJsonModule": true,
|
||||
"removeComments": false,
|
||||
"esModuleInterop": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"downlevelIteration": true,
|
||||
"isolatedModules": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"pretty": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"include": ["src/**/*.ts", "trigger.config.ts"],
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"emitDecoratorMetadata": true
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+21
-21
@@ -9,7 +9,7 @@
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@trigger.dev/sdk": "0.0.0-prerelease-20240825150620"
|
||||
"@trigger.dev/sdk": "0.0.0-cli-e2e-20240910161832"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "5.5.4"
|
||||
@@ -53,9 +53,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@grpc/grpc-js": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.11.1.tgz",
|
||||
"integrity": "sha512-gyt/WayZrVPH2w/UTLansS7F9Nwld472JxxaETamrM8HNlsa+jSLNyKAZmhxI2Me4c3mQHFiS1wWHDY1g1Kthw==",
|
||||
"version": "1.11.2",
|
||||
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.11.2.tgz",
|
||||
"integrity": "sha512-DWp92gDD7/Qkj7r8kus6/HCINeo3yPZWZ3paKgDgsbKbSpoxKg1yvN8xe2Q8uE3zOsPe3bX8FQX2+XValq2yTw==",
|
||||
"dependencies": {
|
||||
"@grpc/proto-loader": "^0.7.13",
|
||||
"@js-sdsl/ordered-map": "^4.4.2"
|
||||
@@ -588,9 +588,9 @@
|
||||
"integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA=="
|
||||
},
|
||||
"node_modules/@trigger.dev/core": {
|
||||
"version": "0.0.0-prerelease-20240825150620",
|
||||
"resolved": "https://registry.npmjs.org/@trigger.dev/core/-/core-0.0.0-prerelease-20240825150620.tgz",
|
||||
"integrity": "sha512-lFlYRMygi8T3i8qnx+hzmd5u2HnoA4lkmeA7e1ESTBgD8b/TsHIkwfcNk6eLmlnspvE2dQp7x7Am0Ss/g7L4fw==",
|
||||
"version": "0.0.0-cli-e2e-20240910161832",
|
||||
"resolved": "https://registry.npmjs.org/@trigger.dev/core/-/core-0.0.0-cli-e2e-20240910161832.tgz",
|
||||
"integrity": "sha512-YuBuP2Te6YCI5QVEU3gw5z1qTHnKStJIrsi5xVbtjYTwTCcmxdnf2TCGz08gc3Ug8e3g0j9HuyISDtuILXTadg==",
|
||||
"dependencies": {
|
||||
"@google-cloud/precise-date": "^4.0.0",
|
||||
"@opentelemetry/api": "1.9.0",
|
||||
@@ -617,14 +617,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@trigger.dev/sdk": {
|
||||
"version": "0.0.0-prerelease-20240825150620",
|
||||
"resolved": "https://registry.npmjs.org/@trigger.dev/sdk/-/sdk-0.0.0-prerelease-20240825150620.tgz",
|
||||
"integrity": "sha512-cKCZ0/ZOaozkWo0bBjGZ5TWpok2lMc/KeUKLfefPUYgb04GoMGUCHzWdQeKgJwXursvDn9/dXxCWA1RuOQRmMQ==",
|
||||
"version": "0.0.0-cli-e2e-20240910161832",
|
||||
"resolved": "https://registry.npmjs.org/@trigger.dev/sdk/-/sdk-0.0.0-cli-e2e-20240910161832.tgz",
|
||||
"integrity": "sha512-MgzaZkxplLdsr1QyZAbFfoLLW3Ui/XjwTLv38eeo98StCdPwJe1zEc4R4IR/BsPi5m67PbLPK3qjuwMDz9lIFQ==",
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "1.9.0",
|
||||
"@opentelemetry/api-logs": "0.52.1",
|
||||
"@opentelemetry/semantic-conventions": "1.25.1",
|
||||
"@trigger.dev/core": "0.0.0-prerelease-20240825150620",
|
||||
"@trigger.dev/core": "0.0.0-cli-e2e-20240910161832",
|
||||
"chalk": "^5.2.0",
|
||||
"cronstrue": "^2.21.0",
|
||||
"debug": "^4.3.4",
|
||||
@@ -760,9 +760,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/cjs-module-lexer": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.0.tgz",
|
||||
"integrity": "sha512-N1NGmowPlGBLsOZLPvm48StN04V4YvQRL0i6b7ctrVY3epjP/ct7hFLOItz6pDIvRjwpfPxi52a2UWV2ziir8g=="
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz",
|
||||
"integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA=="
|
||||
},
|
||||
"node_modules/cli-spinners": {
|
||||
"version": "2.9.2",
|
||||
@@ -872,11 +872,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz",
|
||||
"integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==",
|
||||
"version": "4.3.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
|
||||
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
@@ -1143,9 +1143,9 @@
|
||||
"integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A=="
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/msw": {
|
||||
"version": "2.4.1",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@trigger.dev/sdk": "0.0.0-prerelease-20240825150620"
|
||||
"@trigger.dev/sdk": "0.0.0-cli-e2e-20240910161832"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "5.5.4"
|
||||
|
||||
+7
-7
@@ -9,8 +9,8 @@ importers:
|
||||
.:
|
||||
dependencies:
|
||||
'@trigger.dev/sdk':
|
||||
specifier: 0.0.0-prerelease-20240825150620
|
||||
version: 0.0.0-prerelease-20240825150620(typescript@5.5.4)
|
||||
specifier: 0.0.0-cli-e2e-20240910161832
|
||||
version: 0.0.0-cli-e2e-20240910161832(typescript@5.5.4)
|
||||
devDependencies:
|
||||
typescript:
|
||||
specifier: 5.5.4
|
||||
@@ -447,8 +447,8 @@ packages:
|
||||
resolution: {integrity: sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==}
|
||||
dev: false
|
||||
|
||||
/@trigger.dev/core@0.0.0-prerelease-20240825150620:
|
||||
resolution: {integrity: sha512-lFlYRMygi8T3i8qnx+hzmd5u2HnoA4lkmeA7e1ESTBgD8b/TsHIkwfcNk6eLmlnspvE2dQp7x7Am0Ss/g7L4fw==}
|
||||
/@trigger.dev/core@0.0.0-cli-e2e-20240910161832:
|
||||
resolution: {integrity: sha512-YuBuP2Te6YCI5QVEU3gw5z1qTHnKStJIrsi5xVbtjYTwTCcmxdnf2TCGz08gc3Ug8e3g0j9HuyISDtuILXTadg==}
|
||||
engines: {node: '>=18.20.0'}
|
||||
dependencies:
|
||||
'@google-cloud/precise-date': 4.0.0
|
||||
@@ -476,14 +476,14 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/@trigger.dev/sdk@0.0.0-prerelease-20240825150620(typescript@5.5.4):
|
||||
resolution: {integrity: sha512-cKCZ0/ZOaozkWo0bBjGZ5TWpok2lMc/KeUKLfefPUYgb04GoMGUCHzWdQeKgJwXursvDn9/dXxCWA1RuOQRmMQ==}
|
||||
/@trigger.dev/sdk@0.0.0-cli-e2e-20240910161832(typescript@5.5.4):
|
||||
resolution: {integrity: sha512-MgzaZkxplLdsr1QyZAbFfoLLW3Ui/XjwTLv38eeo98StCdPwJe1zEc4R4IR/BsPi5m67PbLPK3qjuwMDz9lIFQ==}
|
||||
engines: {node: '>=18.20.0'}
|
||||
dependencies:
|
||||
'@opentelemetry/api': 1.9.0
|
||||
'@opentelemetry/api-logs': 0.52.1
|
||||
'@opentelemetry/semantic-conventions': 1.25.1
|
||||
'@trigger.dev/core': 0.0.0-prerelease-20240825150620
|
||||
'@trigger.dev/core': 0.0.0-cli-e2e-20240910161832
|
||||
chalk: 5.3.0
|
||||
cronstrue: 2.50.0
|
||||
debug: 4.3.6
|
||||
|
||||
@@ -41,12 +41,12 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"@grpc/grpc-js@npm:^1.7.1":
|
||||
version: 1.11.1
|
||||
resolution: "@grpc/grpc-js@npm:1.11.1"
|
||||
version: 1.11.2
|
||||
resolution: "@grpc/grpc-js@npm:1.11.2"
|
||||
dependencies:
|
||||
"@grpc/proto-loader": "npm:^0.7.13"
|
||||
"@js-sdsl/ordered-map": "npm:^4.4.2"
|
||||
checksum: 10c0/1b15112d91b0f99e4843b068572935ecdc3e22a330a1b2ec81be84aeefad703b29f8e557088e448a6f696a1fccf10edf37166f0a533119f7db03aae4cedd34df
|
||||
checksum: 10c0/d69a1db3726d7a09a54394971bd54c77dfc2e8f48b23384771a2074ecc947b240ea065b4f1d74300e76fd47d7914071460d98702bd1512b7a9d6085eac6a6012
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -525,9 +525,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@trigger.dev/core@npm:0.0.0-prerelease-20240825150620":
|
||||
version: 0.0.0-prerelease-20240825150620
|
||||
resolution: "@trigger.dev/core@npm:0.0.0-prerelease-20240825150620"
|
||||
"@trigger.dev/core@npm:0.0.0-cli-e2e-20240910161832":
|
||||
version: 0.0.0-cli-e2e-20240910161832
|
||||
resolution: "@trigger.dev/core@npm:0.0.0-cli-e2e-20240910161832"
|
||||
dependencies:
|
||||
"@google-cloud/precise-date": "npm:^4.0.0"
|
||||
"@opentelemetry/api": "npm:1.9.0"
|
||||
@@ -548,18 +548,18 @@ __metadata:
|
||||
zod: "npm:3.22.3"
|
||||
zod-error: "npm:1.5.0"
|
||||
zod-validation-error: "npm:^1.5.0"
|
||||
checksum: 10c0/66a5700835a9d758a26eeabb77e8c98cca6f002642c25643ddbfd15ff9cb562156a43613b7325f52d3fbe6e11cd7c9291efbcfd28b1b8c48c822676ed67dea31
|
||||
checksum: 10c0/d82b59aa782256adc951d3760edd4c202bb0f98a4c3c5030e913575cca5dac66683cea719081d708a5f1d6c0a71aee67cf0059c5380c06489d74cab84c8d7ef7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@trigger.dev/sdk@npm:0.0.0-prerelease-20240825150620":
|
||||
version: 0.0.0-prerelease-20240825150620
|
||||
resolution: "@trigger.dev/sdk@npm:0.0.0-prerelease-20240825150620"
|
||||
"@trigger.dev/sdk@npm:0.0.0-cli-e2e-20240910161832":
|
||||
version: 0.0.0-cli-e2e-20240910161832
|
||||
resolution: "@trigger.dev/sdk@npm:0.0.0-cli-e2e-20240910161832"
|
||||
dependencies:
|
||||
"@opentelemetry/api": "npm:1.9.0"
|
||||
"@opentelemetry/api-logs": "npm:0.52.1"
|
||||
"@opentelemetry/semantic-conventions": "npm:1.25.1"
|
||||
"@trigger.dev/core": "npm:0.0.0-prerelease-20240825150620"
|
||||
"@trigger.dev/core": "npm:0.0.0-cli-e2e-20240910161832"
|
||||
chalk: "npm:^5.2.0"
|
||||
cronstrue: "npm:^2.21.0"
|
||||
debug: "npm:^4.3.4"
|
||||
@@ -571,7 +571,7 @@ __metadata:
|
||||
uuid: "npm:^9.0.0"
|
||||
ws: "npm:^8.11.0"
|
||||
zod: "npm:3.22.3"
|
||||
checksum: 10c0/aafe995e9bf99d373101e563a14df55ab895b5e7590837b876621fd6c835c286a64bc4bb2382ec22e65e0983abc88b7fd778dfb53800935ce4a89899123989db
|
||||
checksum: 10c0/763da613a6f192e823857027e3d50d06de4061ce548df077000145f4ce573f601ac39dd9c6c6f1d4dc9cc78ed596e9e2d268c2f21196d327b14e6ccc2b9dea4a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -698,9 +698,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"cjs-module-lexer@npm:^1.2.2":
|
||||
version: 1.4.0
|
||||
resolution: "cjs-module-lexer@npm:1.4.0"
|
||||
checksum: 10c0/b5ef03e10297c24f0db56b13d7d2f92e377499c83d7bf9352ec73df544b5310e024dfb1779a6b810e7a06eb18caa6a0e2da5f11df8116af73306f362e67fb61a
|
||||
version: 1.4.1
|
||||
resolution: "cjs-module-lexer@npm:1.4.1"
|
||||
checksum: 10c0/5a7d8279629c9ba8ccf38078c2fed75b7737973ced22b9b5a54180efa57fb2fe2bb7bec6aec55e3b8f3f5044f5d7b240347ad9bd285e7c3d0ee5b0a1d0504dfc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -782,14 +782,14 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:~4.3.1, debug@npm:~4.3.2":
|
||||
version: 4.3.6
|
||||
resolution: "debug@npm:4.3.6"
|
||||
version: 4.3.7
|
||||
resolution: "debug@npm:4.3.7"
|
||||
dependencies:
|
||||
ms: "npm:2.1.2"
|
||||
ms: "npm:^2.1.3"
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
checksum: 10c0/3293416bff072389c101697d4611c402a6bacd1900ac20c0492f61a9cdd6b3b29750fc7f5e299f8058469ef60ff8fb79b86395a30374fbd2490113c1c7112285
|
||||
checksum: 10c0/1471db19c3b06d485a622d62f65947a19a23fbd0dd73f7fd3eafb697eec5360cde447fb075919987899b1a2096e85d35d4eb5a4de09a57600ac9cf7e6c8e768b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -903,7 +903,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "hello-world@workspace:."
|
||||
dependencies:
|
||||
"@trigger.dev/sdk": "npm:0.0.0-prerelease-20240825150620"
|
||||
"@trigger.dev/sdk": "npm:0.0.0-cli-e2e-20240910161832"
|
||||
typescript: "npm:5.5.4"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
@@ -1027,10 +1027,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ms@npm:2.1.2":
|
||||
version: 2.1.2
|
||||
resolution: "ms@npm:2.1.2"
|
||||
checksum: 10c0/a437714e2f90dbf881b5191d35a6db792efbca5badf112f87b9e1c712aace4b4b9b742dd6537f3edf90fd6f684de897cec230abde57e87883766712ddda297cc
|
||||
"ms@npm:^2.1.3":
|
||||
version: 2.1.3
|
||||
resolution: "ms@npm:2.1.3"
|
||||
checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
nodeLinker: node-modules
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "monorepo-react-email",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@8.15.5+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589",
|
||||
"engines": {
|
||||
"pnpm": "8.15.5",
|
||||
"yarn": "4.2.2"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@repo/email",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@react-email/components": "0.0.24",
|
||||
"@react-email/render": "1.0.1",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-email": "^3.0.1"
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Button, Html } from "@react-email/components";
|
||||
import { render } from "@react-email/render";
|
||||
|
||||
function ExampleEmail(props: {}) {
|
||||
return (
|
||||
<Html>
|
||||
<Button
|
||||
href="https://example.com"
|
||||
style={{ background: "#000", color: "#fff", padding: "12px 20px" }}
|
||||
>
|
||||
Click me
|
||||
</Button>
|
||||
</Html>
|
||||
);
|
||||
}
|
||||
|
||||
export function renderExampleEmail() {
|
||||
return render(<ExampleEmail />);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./emails";
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"moduleDetection": "force",
|
||||
"verbatimModuleSyntax": false,
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"alwaysStrict": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"resolveJsonModule": true,
|
||||
"removeComments": false,
|
||||
"esModuleInterop": true,
|
||||
"emitDecoratorMetadata": false,
|
||||
"experimentalDecorators": false,
|
||||
"downlevelIteration": true,
|
||||
"isolatedModules": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"pretty": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@repo/trigger",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@repo/email": "workspace:*",
|
||||
"@trigger.dev/sdk": "0.0.0-cli-e2e-20240910161832"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "5.5.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { task } from "@trigger.dev/sdk/v3";
|
||||
import { renderExampleEmail } from "@repo/email";
|
||||
|
||||
export const reactEmail = task({
|
||||
id: "react-email",
|
||||
run: async () => {
|
||||
return await renderExampleEmail();
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import { defineConfig } from "@trigger.dev/sdk/v3";
|
||||
|
||||
export default defineConfig({
|
||||
project: "<fixture project>",
|
||||
dirs: ["./src"],
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"include": ["src/**/*.ts", "trigger.config.ts"],
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"moduleDetection": "force",
|
||||
"verbatimModuleSyntax": false,
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"alwaysStrict": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"resolveJsonModule": true,
|
||||
"removeComments": false,
|
||||
"esModuleInterop": true,
|
||||
"emitDecoratorMetadata": false,
|
||||
"experimentalDecorators": false,
|
||||
"downlevelIteration": true,
|
||||
"isolatedModules": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"pretty": true
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
# https://github.com/pnpm/pnpm/issues/2412
|
||||
packages:
|
||||
- "packages/*"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
nodeLinker: node-modules
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "otel-telemetry-loader",
|
||||
"private": true,
|
||||
"packageManager": "yarn@4.2.2+sha256.1aa43a5304405be7a7cb9cb5de7b97de9c4e8ddd3273e4dad00d6ae3eb39f0ef",
|
||||
"engines": {
|
||||
"pnpm": "8.15.5",
|
||||
"yarn": "4.2.2"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@trigger.dev/sdk": "0.0.0-cli-e2e-20240910161832",
|
||||
"openai": "4.47.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@traceloop/instrumentation-openai": "^0.10.0",
|
||||
"typescript": "5.5.4"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
# https://github.com/pnpm/pnpm/issues/2412
|
||||
packages:
|
||||
- "packages/*"
|
||||
@@ -0,0 +1,20 @@
|
||||
import { task } from "@trigger.dev/sdk/v3";
|
||||
|
||||
import OpenAI from "openai";
|
||||
|
||||
const openai = new OpenAI({
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
baseURL: process.env.OPENAI_BASE_URL,
|
||||
});
|
||||
|
||||
export const aiTask = task({
|
||||
id: "ai",
|
||||
run: async (payload: { prompt: string }) => {
|
||||
const chatCompletion = await openai.chat.completions.create({
|
||||
messages: [{ role: "user", content: payload.prompt }],
|
||||
model: "gpt-3.5-turbo",
|
||||
});
|
||||
|
||||
return chatCompletion.choices[0];
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import { defineConfig } from "@trigger.dev/sdk/v3";
|
||||
import { OpenAIInstrumentation } from "@traceloop/instrumentation-openai";
|
||||
|
||||
export default defineConfig({
|
||||
project: "<fixture project>",
|
||||
dirs: ["./src/trigger"],
|
||||
instrumentations: [new OpenAIInstrumentation()],
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"include": ["src/**/*.ts", "trigger.config.ts"],
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"moduleDetection": "force",
|
||||
"verbatimModuleSyntax": false,
|
||||
"jsx": "react",
|
||||
"strict": true,
|
||||
"alwaysStrict": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"resolveJsonModule": true,
|
||||
"removeComments": false,
|
||||
"esModuleInterop": true,
|
||||
"emitDecoratorMetadata": false,
|
||||
"experimentalDecorators": false,
|
||||
"downlevelIteration": true,
|
||||
"isolatedModules": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"pretty": true
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -150,10 +150,11 @@ export interface TscResult {
|
||||
|
||||
export async function runTsc(
|
||||
cwd: string,
|
||||
tsconfigName: string = "tsconfig.json"
|
||||
tsconfigName: string = "tsconfig.json",
|
||||
binBasePath: string = cwd
|
||||
): Promise<TscResult> {
|
||||
const tsconfigPath = nodePath.join(cwd, tsconfigName);
|
||||
const tscPath = nodePath.join(cwd, "node_modules", ".bin", "tsc");
|
||||
const tscPath = nodePath.join(binBasePath, "node_modules", ".bin", "tsc");
|
||||
|
||||
// Ensure the tsconfig file exists
|
||||
try {
|
||||
@@ -163,6 +164,10 @@ export async function runTsc(
|
||||
}
|
||||
|
||||
try {
|
||||
logger.debug(`Running TypeScript compiler: ${tscPath} --project ${tsconfigPath} --noEmit`, {
|
||||
cwd,
|
||||
});
|
||||
|
||||
const result = await execa(tscPath, ["--project", tsconfigPath, "--noEmit"], {
|
||||
cwd,
|
||||
reject: false,
|
||||
@@ -171,6 +176,9 @@ export async function runTsc(
|
||||
const success = result.exitCode === 0;
|
||||
const errors = success ? [] : parseTypeScriptErrors(result.stderr);
|
||||
|
||||
logger.debug(result.stdout);
|
||||
logger.debug(result.stderr);
|
||||
|
||||
return {
|
||||
success,
|
||||
errors,
|
||||
@@ -215,6 +223,16 @@ export type ExecuteTaskRunResult = {
|
||||
result: TaskRunExecutionResult;
|
||||
usageReports: Array<ExecuteTaskRunUsageReport>;
|
||||
totalDurationMs: number;
|
||||
spans: Array<ExecuteTaskTraceEvent>;
|
||||
};
|
||||
|
||||
export type ExecuteTaskTraceEvent = {
|
||||
name: string;
|
||||
traceId: string;
|
||||
spanId: string;
|
||||
parentSpanId?: string;
|
||||
durationMs: number;
|
||||
attributes?: { [key: string]: string | number | boolean | undefined };
|
||||
};
|
||||
|
||||
export async function executeTestCaseRun({
|
||||
@@ -225,6 +243,7 @@ export async function executeTestCaseRun({
|
||||
contentHash,
|
||||
}: ExecuteTaskCaseRunOptions): Promise<ExecuteTaskRunResult> {
|
||||
const usageReports: Array<ExecuteTaskRunUsageReport> = [];
|
||||
const spans: Array<ExecuteTaskTraceEvent> = [];
|
||||
|
||||
// Create a disposable "server" instance.
|
||||
const server = await createTestHttpServer({
|
||||
@@ -239,6 +258,9 @@ export async function executeTestCaseRun({
|
||||
return Response.json({});
|
||||
});
|
||||
router.post("/v1/traces", async ({ req }) => {
|
||||
const jsonBody = await req.json();
|
||||
|
||||
spans.push(...parseTraceBodyIntoEvents(jsonBody));
|
||||
// TODO: Implement trace endpoint
|
||||
return Response.json({});
|
||||
});
|
||||
@@ -246,6 +268,30 @@ export async function executeTestCaseRun({
|
||||
// TODO: Implement logs endpoint
|
||||
return Response.json({});
|
||||
});
|
||||
router.post("/v1/chat/completions", async ({ req }) => {
|
||||
return Response.json({
|
||||
id: "chatcmpl-7XYZ123ABC456DEF789GHI",
|
||||
object: "chat.completion",
|
||||
created: 1631619199,
|
||||
model: "gpt-3.5-turbo-0613",
|
||||
choices: [
|
||||
{
|
||||
index: 0,
|
||||
message: {
|
||||
role: "assistant",
|
||||
content:
|
||||
"The capital of France is Paris. Paris is not only the political capital but also the cultural and economic center of France. It's known for its iconic landmarks such as the Eiffel Tower, the Louvre Museum, and Notre-Dame Cathedral.",
|
||||
},
|
||||
finish_reason: "stop",
|
||||
},
|
||||
],
|
||||
usage: {
|
||||
prompt_tokens: 29,
|
||||
completion_tokens: 48,
|
||||
total_tokens: 77,
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -260,6 +306,8 @@ export async function executeTestCaseRun({
|
||||
TRIGGER_SECRET_KEY: "test-secret",
|
||||
TRIGGER_API_URL: server.http.url().origin,
|
||||
USAGE_HEARTBEAT_INTERVAL_MS: "500",
|
||||
OPENAI_API_KEY: "api-key",
|
||||
OPENAI_BASE_URL: server.http.url().origin + "/v1",
|
||||
},
|
||||
serverWorker: {
|
||||
id: "test",
|
||||
@@ -330,8 +378,99 @@ export async function executeTestCaseRun({
|
||||
result,
|
||||
usageReports,
|
||||
totalDurationMs: usageReports.reduce((acc, report) => acc + report.durationMs, 0),
|
||||
spans,
|
||||
};
|
||||
} finally {
|
||||
await server.close();
|
||||
}
|
||||
}
|
||||
|
||||
function parseTraceBodyIntoEvents(body: any): ExecuteTaskTraceEvent[] {
|
||||
return body.resourceSpans.flatMap(parseResourceSpanIntoEvents);
|
||||
}
|
||||
|
||||
function parseResourceSpanIntoEvents(resourceSpan: any): ExecuteTaskTraceEvent[] {
|
||||
return resourceSpan.scopeSpans.flatMap((scopeSpan: any) =>
|
||||
parseScopeSpanIntoEvents(scopeSpan, resourceSpan.resource)
|
||||
);
|
||||
}
|
||||
|
||||
function parseScopeSpanIntoEvents(scopeSpan: any, resource: any): ExecuteTaskTraceEvent[] {
|
||||
return scopeSpan.spans.flatMap((span: any) => parseSpanInEvent(span, resource));
|
||||
}
|
||||
|
||||
function parseSpanInEvent(span: any, resource: any): ExecuteTaskTraceEvent {
|
||||
return {
|
||||
name: span.name,
|
||||
traceId: span.traceId,
|
||||
spanId: span.spanId,
|
||||
parentSpanId: span.parentSpanId,
|
||||
durationMs: calculateSpanDurationMs(span),
|
||||
attributes: {
|
||||
...parseAttributes(resource.attributes),
|
||||
...parseAttributes(span.attributes),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function calculateSpanDurationMs(span: any): number {
|
||||
return Number(BigInt(span.endTimeUnixNano) - BigInt(span.startTimeUnixNano) / BigInt(1e6));
|
||||
}
|
||||
|
||||
function parseAttributes(attributes: any): ExecuteTaskTraceEvent["attributes"] {
|
||||
if (!attributes) return {};
|
||||
|
||||
return attributes.reduce((acc: any, attribute: any) => {
|
||||
acc[attribute.key] = isStringValue(attribute.value)
|
||||
? attribute.value.stringValue
|
||||
: isIntValue(attribute.value)
|
||||
? Number(attribute.value.intValue)
|
||||
: isDoubleValue(attribute.value)
|
||||
? attribute.value.doubleValue
|
||||
: isBoolValue(attribute.value)
|
||||
? attribute.value.boolValue
|
||||
: isBytesValue(attribute.value)
|
||||
? binaryToHex(attribute.value.bytesValue)
|
||||
: undefined;
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function isBoolValue(value: any | undefined): value is { boolValue: boolean } {
|
||||
if (!value) return false;
|
||||
|
||||
return typeof value.boolValue === "boolean";
|
||||
}
|
||||
|
||||
function isStringValue(value: any | undefined): value is { stringValue: string } {
|
||||
if (!value) return false;
|
||||
|
||||
return typeof value.stringValue === "string";
|
||||
}
|
||||
|
||||
function isIntValue(value: any | undefined): value is { intValue: bigint } {
|
||||
if (!value) return false;
|
||||
|
||||
return typeof value.intValue === "number";
|
||||
}
|
||||
|
||||
function isDoubleValue(value: any | undefined): value is { doubleValue: number } {
|
||||
if (!value) return false;
|
||||
|
||||
return typeof value.doubleValue === "number";
|
||||
}
|
||||
|
||||
function isBytesValue(value: any | undefined): value is { bytesValue: Buffer } {
|
||||
if (!value) return false;
|
||||
|
||||
return Buffer.isBuffer(value.bytesValue);
|
||||
}
|
||||
function binaryToHex(buffer: Buffer | string): string;
|
||||
function binaryToHex(buffer: Buffer | string | undefined): string | undefined;
|
||||
function binaryToHex(buffer: Buffer | string | undefined): string | undefined {
|
||||
if (!buffer) return undefined;
|
||||
if (typeof buffer === "string") return buffer;
|
||||
|
||||
return Buffer.from(Array.from(buffer)).toString("hex");
|
||||
}
|
||||
|
||||
@@ -63,6 +63,18 @@ export class CliApiClient {
|
||||
});
|
||||
}
|
||||
|
||||
async retrieveExternals() {
|
||||
return wrapZodFetch(
|
||||
z.object({ externals: z.array(z.string()) }),
|
||||
`https://jsonhero.io/j/GU7CwoDOL40k.json`,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async getProject(projectRef: string) {
|
||||
if (!this.accessToken) {
|
||||
throw new Error("getProject: No access token");
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
resolvePluginsForContext,
|
||||
} from "./extensions.js";
|
||||
import { createExternalsBuildExtension } from "./externals.js";
|
||||
import { getInstrumentedPackageNames } from "./instrumentation.js";
|
||||
import {
|
||||
deployIndexController,
|
||||
deployIndexWorker,
|
||||
@@ -27,6 +26,7 @@ import { readPackageJSON, writePackageJSON } from "pkg-types";
|
||||
import { writeJSONFile } from "../utilities/fileSystem.js";
|
||||
import { isWindows } from "std-env";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { logger } from "../utilities/logger.js";
|
||||
|
||||
export type BuildWorkerEventListener = {
|
||||
onBundleStart?: () => void;
|
||||
@@ -41,12 +41,21 @@ export type BuildWorkerOptions = {
|
||||
listener?: BuildWorkerEventListener;
|
||||
envVars?: Record<string, string>;
|
||||
rewritePaths?: boolean;
|
||||
forcedExternals?: string[];
|
||||
};
|
||||
|
||||
export async function buildWorker(options: BuildWorkerOptions) {
|
||||
logger.debug("Starting buildWorker", {
|
||||
options,
|
||||
});
|
||||
|
||||
const resolvedConfig = options.resolvedConfig;
|
||||
|
||||
const externalsExtension = createExternalsBuildExtension(options.target, resolvedConfig);
|
||||
const externalsExtension = createExternalsBuildExtension(
|
||||
options.target,
|
||||
resolvedConfig,
|
||||
options.forcedExternals
|
||||
);
|
||||
const buildContext = createBuildContext("deploy", resolvedConfig);
|
||||
buildContext.prependExtension(externalsExtension);
|
||||
await notifyExtensionOnBuildStart(buildContext);
|
||||
@@ -76,7 +85,7 @@ export async function buildWorker(options: BuildWorkerOptions) {
|
||||
cliPackageVersion: VERSION,
|
||||
target: "deploy",
|
||||
files: bundleResult.files,
|
||||
sources: await resolveFileSources(bundleResult.files, resolvedConfig.workingDir),
|
||||
sources: await resolveFileSources(bundleResult.files, resolvedConfig),
|
||||
config: {
|
||||
project: resolvedConfig.project,
|
||||
dirs: resolvedConfig.dirs,
|
||||
@@ -86,7 +95,7 @@ export async function buildWorker(options: BuildWorkerOptions) {
|
||||
runWorkerEntryPoint: bundleResult.runWorkerEntryPoint ?? deployRunWorker,
|
||||
indexControllerEntryPoint: bundleResult.indexControllerEntryPoint ?? deployIndexController,
|
||||
indexWorkerEntryPoint: bundleResult.indexWorkerEntryPoint ?? deployIndexWorker,
|
||||
loaderEntryPoint: bundleResult.loaderEntryPoint ?? telemetryEntryPoint,
|
||||
loaderEntryPoint: bundleResult.loaderEntryPoint,
|
||||
configPath: bundleResult.configPath,
|
||||
customConditions: resolvedConfig.build.conditions ?? [],
|
||||
deploy: {
|
||||
@@ -94,7 +103,7 @@ export async function buildWorker(options: BuildWorkerOptions) {
|
||||
},
|
||||
build: {},
|
||||
otelImportHook: {
|
||||
include: getInstrumentedPackageNames(resolvedConfig),
|
||||
include: resolvedConfig.instrumentedPackageNames ?? [],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
isRunControllerForTarget,
|
||||
isRunWorkerForTarget,
|
||||
shims,
|
||||
telemetryEntryPoint,
|
||||
} from "./packageModules.js";
|
||||
import { buildPlugins } from "./plugins.js";
|
||||
|
||||
@@ -228,6 +229,10 @@ async function getEntryPoints(target: BuildTarget, config: ResolvedConfig) {
|
||||
projectEntryPoints.push(...deployEntryPoints);
|
||||
}
|
||||
|
||||
if (config.instrumentedPackageNames?.length ?? 0 > 0) {
|
||||
projectEntryPoints.push(telemetryEntryPoint);
|
||||
}
|
||||
|
||||
return projectEntryPoints;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,15 @@ import { mkdir, symlink } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
import { readPackageJSON, resolvePackageJSON } from "pkg-types";
|
||||
import nodeResolve from "resolve";
|
||||
import { getInstrumentedPackageNames } from "./instrumentation.js";
|
||||
import { BuildTarget } from "@trigger.dev/core/v3/schemas";
|
||||
import { BuildExtension, BuildLogger, ResolvedConfig } from "@trigger.dev/core/v3/build";
|
||||
import {
|
||||
alwaysExternal,
|
||||
BuildExtension,
|
||||
BuildLogger,
|
||||
ResolvedConfig,
|
||||
} from "@trigger.dev/core/v3/build";
|
||||
import { logger } from "../utilities/logger.js";
|
||||
|
||||
const FORCED_EXTERNALS = ["import-in-the-middle"];
|
||||
import { CliApiClient } from "../apiClient.js";
|
||||
|
||||
/**
|
||||
* externals in dev might not be resolvable from the worker directory
|
||||
@@ -110,11 +113,12 @@ export type ExternalsCollector = {
|
||||
|
||||
function createExternalsCollector(
|
||||
target: BuildTarget,
|
||||
resolvedConfig: ResolvedConfig
|
||||
resolvedConfig: ResolvedConfig,
|
||||
forcedExternal: string[] = []
|
||||
): ExternalsCollector {
|
||||
const externals: Array<CollectedExternal> = [];
|
||||
|
||||
const maybeExternals = discoverMaybeExternals(target, resolvedConfig);
|
||||
const maybeExternals = discoverMaybeExternals(target, resolvedConfig, forcedExternal);
|
||||
|
||||
return {
|
||||
externals,
|
||||
@@ -233,10 +237,14 @@ function createExternalsCollector(
|
||||
|
||||
type MaybeExternal = { raw: string; filter: RegExp };
|
||||
|
||||
function discoverMaybeExternals(target: BuildTarget, config: ResolvedConfig): Array<MaybeExternal> {
|
||||
function discoverMaybeExternals(
|
||||
target: BuildTarget,
|
||||
config: ResolvedConfig,
|
||||
forcedExternal: string[] = []
|
||||
): Array<MaybeExternal> {
|
||||
const external: Array<MaybeExternal> = [];
|
||||
|
||||
for (const externalName of FORCED_EXTERNALS) {
|
||||
for (const externalName of forcedExternal) {
|
||||
const externalRegex = makeRe(externalName);
|
||||
|
||||
if (!externalRegex) {
|
||||
@@ -264,7 +272,7 @@ function discoverMaybeExternals(target: BuildTarget, config: ResolvedConfig): Ar
|
||||
}
|
||||
}
|
||||
|
||||
for (const externalName of getInstrumentedPackageNames(config)) {
|
||||
for (const externalName of config.instrumentedPackageNames ?? []) {
|
||||
const externalRegex = makeExternalRegexp(externalName);
|
||||
|
||||
if (!externalRegex) {
|
||||
@@ -299,9 +307,10 @@ function discoverMaybeExternals(target: BuildTarget, config: ResolvedConfig): Ar
|
||||
|
||||
export function createExternalsBuildExtension(
|
||||
target: BuildTarget,
|
||||
config: ResolvedConfig
|
||||
config: ResolvedConfig,
|
||||
forcedExternal: string[] = []
|
||||
): BuildExtension {
|
||||
const { externals, plugin } = createExternalsCollector(target, config);
|
||||
const { externals, plugin } = createExternalsCollector(target, config, forcedExternal);
|
||||
|
||||
return {
|
||||
name: "externals",
|
||||
@@ -357,3 +366,21 @@ function packageNameForImportPath(importPath: string): string {
|
||||
return parts[0] as string;
|
||||
}
|
||||
}
|
||||
|
||||
export async function resolveAlwaysExternal(client: CliApiClient): Promise<string[]> {
|
||||
try {
|
||||
const response = await client.retrieveExternals();
|
||||
|
||||
if (response.success) {
|
||||
return response.data.externals;
|
||||
}
|
||||
|
||||
return alwaysExternal;
|
||||
} catch (error) {
|
||||
logger.debug("[externals][resolveAlwaysExternal] Unable to retrieve externals", {
|
||||
error,
|
||||
});
|
||||
|
||||
return alwaysExternal;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { InstrumentationModuleDefinition } from "@opentelemetry/instrumentation";
|
||||
import { ResolvedConfig } from "@trigger.dev/core/v3/build";
|
||||
import { builtinModules } from "node:module";
|
||||
|
||||
export function getInstrumentedPackageNames(
|
||||
config: ResolvedConfig
|
||||
): Array<string> {
|
||||
const packageNames = [];
|
||||
|
||||
if (config.instrumentations) {
|
||||
for (const instrumentation of config.instrumentations) {
|
||||
const moduleDefinitions = (
|
||||
instrumentation as any
|
||||
).getModuleDefinitions?.() as Array<InstrumentationModuleDefinition>;
|
||||
|
||||
if (!Array.isArray(moduleDefinitions)) {
|
||||
continue
|
||||
}
|
||||
|
||||
for (const moduleDefinition of moduleDefinitions) {
|
||||
if (!builtinModules.includes(moduleDefinition.name)) {
|
||||
packageNames.push(moduleDefinition.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return packageNames;
|
||||
}
|
||||
@@ -12,13 +12,12 @@ export const deployIndexWorker = join(sourceDir, "entryPoints", "deploy-index-wo
|
||||
|
||||
export const telemetryEntryPoint = join(sourceDir, "entryPoints", "loader.js");
|
||||
|
||||
export const devEntryPoints = [devRunWorker, devIndexWorker, telemetryEntryPoint];
|
||||
export const devEntryPoints = [devRunWorker, devIndexWorker];
|
||||
export const deployEntryPoints = [
|
||||
deployRunController,
|
||||
deployRunWorker,
|
||||
deployIndexController,
|
||||
deployIndexWorker,
|
||||
telemetryEntryPoint,
|
||||
];
|
||||
|
||||
export const esmShimPath = join(sourceDir, "shims", "esm.js");
|
||||
|
||||
@@ -36,6 +36,7 @@ import { getTmpDir } from "../utilities/tempDirectories.js";
|
||||
import { spinner } from "../utilities/windows.js";
|
||||
import { login } from "./login.js";
|
||||
import { updateTriggerPackages } from "./update.js";
|
||||
import { resolveAlwaysExternal } from "../build/externals.js";
|
||||
|
||||
const DeployCommandOptions = CommonCommandOptions.extend({
|
||||
dryRun: z.boolean().default(false),
|
||||
@@ -43,6 +44,7 @@ const DeployCommandOptions = CommonCommandOptions.extend({
|
||||
env: z.enum(["prod", "staging"]),
|
||||
loadImage: z.boolean().default(false),
|
||||
buildPlatform: z.enum(["linux/amd64", "linux/arm64"]).default("linux/amd64"),
|
||||
namespace: z.string().optional(),
|
||||
selfHosted: z.boolean().default(false),
|
||||
registry: z.string().optional(),
|
||||
push: z.boolean().default(false),
|
||||
@@ -119,6 +121,12 @@ export function configureDeployCommand(program: Command) {
|
||||
"(Coming soon) Specify the tag to use when pushing the image to the registry"
|
||||
).hideHelp()
|
||||
)
|
||||
.addOption(
|
||||
new CommandOption(
|
||||
"--namespace <namespace>",
|
||||
"Specify the namespace to use when pushing the image to the registry"
|
||||
).hideHelp()
|
||||
)
|
||||
.addOption(
|
||||
new CommandOption("--load-image", "Load the built image into your local docker").hideHelp()
|
||||
)
|
||||
@@ -180,6 +188,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
|
||||
const resolvedConfig = await loadConfig({
|
||||
cwd: projectPath,
|
||||
overrides: { project: options.projectRef },
|
||||
configFile: options.config,
|
||||
});
|
||||
|
||||
logger.debug("Resolved config", resolvedConfig);
|
||||
@@ -203,6 +212,8 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
|
||||
|
||||
const $buildSpinner = spinner();
|
||||
|
||||
const forcedExternals = await resolveAlwaysExternal(projectClient.client);
|
||||
|
||||
const buildManifest = await buildWorker({
|
||||
target: "deploy",
|
||||
environment: options.env,
|
||||
@@ -210,6 +221,7 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
|
||||
resolvedConfig,
|
||||
rewritePaths: true,
|
||||
envVars: serverEnvVars.success ? serverEnvVars.data.variables : {},
|
||||
forcedExternals,
|
||||
listener: {
|
||||
onBundleStart() {
|
||||
$buildSpinner.start("Building project");
|
||||
@@ -232,6 +244,9 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
|
||||
const deploymentResponse = await projectClient.client.initializeDeployment({
|
||||
contentHash: buildManifest.contentHash,
|
||||
userId: authorization.userId,
|
||||
selfHosted: options.selfHosted,
|
||||
registryHost: options.registry,
|
||||
namespace: options.namespace,
|
||||
});
|
||||
|
||||
if (!deploymentResponse.success) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Command } from "commander";
|
||||
import { z } from "zod";
|
||||
import { CommonCommandOptions, commonOptions, wrapCommandAction } from "../cli/common.js";
|
||||
import { watchConfig } from "../config.js";
|
||||
import { startDevSession } from "../dev/devSession.js";
|
||||
import { DevSessionInstance, startDevSession } from "../dev/devSession.js";
|
||||
import { chalkError } from "../utilities/cliOutput.js";
|
||||
import { printDevBanner, printStandloneInitialBanner } from "../utilities/initialBanner.js";
|
||||
import { logger } from "../utilities/logger.js";
|
||||
@@ -106,13 +106,20 @@ async function startDev(options: StartDevOptions) {
|
||||
displayedUpdateMessage = await updateTriggerPackages(options.cwd, { ...options }, true, true);
|
||||
}
|
||||
|
||||
let devInstance: DevSessionInstance | undefined;
|
||||
|
||||
printDevBanner(displayedUpdateMessage);
|
||||
|
||||
watcher = await watchConfig({
|
||||
cwd: options.cwd,
|
||||
async onUpdate(config) {
|
||||
logger.debug("Updated config, rerendering", { config });
|
||||
// rerender(await getDevReactElement(config));
|
||||
|
||||
if (devInstance) {
|
||||
devInstance.stop();
|
||||
}
|
||||
|
||||
devInstance = await bootDevSession(config);
|
||||
},
|
||||
overrides: {
|
||||
project: options.projectRef,
|
||||
@@ -147,14 +154,14 @@ async function startDev(options: StartDevOptions) {
|
||||
});
|
||||
}
|
||||
|
||||
const devSession = await bootDevSession(watcher.config);
|
||||
devInstance = await bootDevSession(watcher.config);
|
||||
|
||||
const waitUntilExit = async () => {};
|
||||
|
||||
return {
|
||||
watcher,
|
||||
stop: async () => {
|
||||
devSession.stop();
|
||||
devInstance?.stop();
|
||||
await watcher?.stop();
|
||||
},
|
||||
waitUntilExit,
|
||||
|
||||
@@ -41,6 +41,7 @@ const InitCommandOptions = CommonCommandOptions.extend({
|
||||
skipPackageInstall: z.boolean().default(false),
|
||||
pkgArgs: z.string().optional(),
|
||||
gitRef: z.string().default("main"),
|
||||
javascript: z.boolean().default(false),
|
||||
});
|
||||
|
||||
type InitCommandOptions = z.infer<typeof InitCommandOptions>;
|
||||
@@ -55,6 +56,7 @@ export function configureInitCommand(program: Command) {
|
||||
"-p, --project-ref <project ref>",
|
||||
"The project ref to use when initializing the project"
|
||||
)
|
||||
.option("--javascript", "Initialize the project with JavaScript instead of TypeScript", false)
|
||||
.option(
|
||||
"-t, --tag <package tag>",
|
||||
"The version of the @trigger.dev/sdk package to install",
|
||||
@@ -161,7 +163,7 @@ async function _initCommand(dir: string, options: InitCommandOptions) {
|
||||
log.info("Skipping package installation");
|
||||
}
|
||||
|
||||
const language = tsconfigPath ? "typescript" : "javascript";
|
||||
const language = options.javascript ? "javascript" : "typescript";
|
||||
|
||||
// Create the trigger dir
|
||||
const triggerDir = await createTriggerDir(dir, options, language);
|
||||
@@ -170,7 +172,7 @@ async function _initCommand(dir: string, options: InitCommandOptions) {
|
||||
await writeConfigFile(dir, selectedProject, options, triggerDir, language);
|
||||
|
||||
// Add trigger.config.ts to tsconfig.json
|
||||
if (tsconfigPath) {
|
||||
if (tsconfigPath && language === "typescript") {
|
||||
await addConfigFileToTsConfig(tsconfigPath, options);
|
||||
}
|
||||
|
||||
@@ -428,7 +430,7 @@ async function installPackages(dir: string, options: InitCommandOptions) {
|
||||
|
||||
installSpinner.start(`Adding @trigger.dev/sdk@${options.tag}`);
|
||||
|
||||
await addDependency(`@trigger.dev/sdk@${options.tag}`, { cwd: projectDir });
|
||||
await addDependency(`@trigger.dev/sdk@${options.tag}`, { cwd: projectDir, silent: true });
|
||||
|
||||
installSpinner.stop(`@trigger.dev/sdk@${options.tag} installed`);
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
syncEnvVars,
|
||||
} from "@trigger.dev/build/extensions/core";
|
||||
import { prettyWarning } from "./utilities/cliOutput.js";
|
||||
import type { InstrumentationModuleDefinition } from "@opentelemetry/instrumentation";
|
||||
import { builtinModules } from "node:module";
|
||||
|
||||
export type ResolveConfigOptions = {
|
||||
cwd?: string;
|
||||
@@ -23,14 +25,17 @@ export type ResolveConfigOptions = {
|
||||
|
||||
export async function loadConfig({
|
||||
cwd = process.cwd(),
|
||||
overrides,
|
||||
configFile,
|
||||
}: ResolveConfigOptions = {}): Promise<ResolvedConfig> {
|
||||
const result = await c12.loadConfig<TriggerConfig>({
|
||||
name: "trigger",
|
||||
cwd,
|
||||
configFile,
|
||||
jitiOptions: { debug: logger.loggerLevel === "debug" },
|
||||
});
|
||||
|
||||
return await resolveConfig(cwd, result);
|
||||
return await resolveConfig(cwd, result, overrides);
|
||||
}
|
||||
|
||||
type ResolveWatchConfigOptions = ResolveConfigOptions & {
|
||||
@@ -179,6 +184,7 @@ async function resolveConfig(
|
||||
return {
|
||||
...mergedConfig,
|
||||
dirs: Array.from(new Set(mergedConfig.dirs)),
|
||||
instrumentedPackageNames: getInstrumentedPackageNames(mergedConfig),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -295,3 +301,27 @@ function adaptResolveEnvVarsToSyncEnvVarsExtension(
|
||||
{ override: true }
|
||||
);
|
||||
}
|
||||
|
||||
function getInstrumentedPackageNames(config: ResolvedConfig): Array<string> {
|
||||
const packageNames = [];
|
||||
|
||||
if (config.instrumentations) {
|
||||
for (const instrumentation of config.instrumentations) {
|
||||
const moduleDefinitions = (
|
||||
instrumentation as any
|
||||
).getModuleDefinitions?.() as Array<InstrumentationModuleDefinition>;
|
||||
|
||||
if (!Array.isArray(moduleDefinitions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const moduleDefinition of moduleDefinitions) {
|
||||
if (!builtinModules.includes(moduleDefinition.name)) {
|
||||
packageNames.push(moduleDefinition.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return packageNames;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import { eventBus } from "../utilities/eventBus.js";
|
||||
import { writeJSONFile } from "../utilities/fileSystem.js";
|
||||
import { logger } from "../utilities/logger.js";
|
||||
import { execOptionsForRuntime } from "@trigger.dev/core/v3/build";
|
||||
import { sanitizeEnvVars } from "../utilities/sanitizeEnvVars.js";
|
||||
|
||||
export type CurrentWorkers = BackgroundWorkerCoordinator["currentWorkers"];
|
||||
export class BackgroundWorkerCoordinator {
|
||||
@@ -318,8 +319,9 @@ export class BackgroundWorker {
|
||||
const processOptions: TaskRunProcessOptions = {
|
||||
payload,
|
||||
env: {
|
||||
...this.params.env,
|
||||
...payload.environment,
|
||||
...sanitizeEnvVars(this.params.env),
|
||||
// TODO: this needs the stripEmptyValues stuff too
|
||||
...sanitizeEnvVars(payload.environment ?? {}),
|
||||
TRIGGER_WORKER_MANIFEST_PATH: this.workerManifestPath,
|
||||
},
|
||||
serverWorker: this.serverWorker,
|
||||
@@ -500,7 +502,7 @@ export class BackgroundWorker {
|
||||
} catch (e) {
|
||||
if (e instanceof CancelledProcessError) {
|
||||
return {
|
||||
id: payload.execution.attempt.id,
|
||||
id: payload.execution.run.id,
|
||||
ok: false,
|
||||
retry: undefined,
|
||||
error: {
|
||||
@@ -512,7 +514,7 @@ export class BackgroundWorker {
|
||||
|
||||
if (e instanceof CleanupProcessError) {
|
||||
return {
|
||||
id: payload.execution.attempt.id,
|
||||
id: payload.execution.run.id,
|
||||
ok: false,
|
||||
retry: undefined,
|
||||
error: {
|
||||
@@ -524,7 +526,7 @@ export class BackgroundWorker {
|
||||
|
||||
if (e instanceof UnexpectedExitError) {
|
||||
return {
|
||||
id: payload.execution.attempt.id,
|
||||
id: payload.execution.run.id,
|
||||
ok: false,
|
||||
retry: undefined,
|
||||
error: {
|
||||
@@ -537,7 +539,7 @@ export class BackgroundWorker {
|
||||
}
|
||||
|
||||
return {
|
||||
id: payload.execution.attempt.id,
|
||||
id: payload.execution.run.id,
|
||||
ok: false,
|
||||
retry: undefined,
|
||||
error: {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
notifyExtensionOnBuildStart,
|
||||
resolvePluginsForContext,
|
||||
} from "../build/extensions.js";
|
||||
import { createExternalsBuildExtension } from "../build/externals.js";
|
||||
import { createExternalsBuildExtension, resolveAlwaysExternal } from "../build/externals.js";
|
||||
import { copyManifestToDir } from "../build/manifests.js";
|
||||
import { devIndexWorker, devRunWorker, telemetryEntryPoint } from "../build/packageModules.js";
|
||||
import { type DevCommandOptions } from "../commands/dev.js";
|
||||
@@ -27,7 +27,6 @@ import { EphemeralDirectory, getTmpDir } from "../utilities/tempDirectories.js";
|
||||
import { VERSION } from "../version.js";
|
||||
import { startDevOutput } from "./devOutput.js";
|
||||
import { startWorkerRuntime } from "./workerRuntime.js";
|
||||
import { getInstrumentedPackageNames } from "../build/instrumentation.js";
|
||||
|
||||
export type DevSessionOptions = {
|
||||
name: string | undefined;
|
||||
@@ -40,13 +39,17 @@ export type DevSessionOptions = {
|
||||
onErr?: (error: Error) => void;
|
||||
};
|
||||
|
||||
export type DevSessionInstance = {
|
||||
stop: () => void;
|
||||
};
|
||||
|
||||
export async function startDevSession({
|
||||
rawConfig,
|
||||
name,
|
||||
rawArgs,
|
||||
client,
|
||||
dashboardUrl,
|
||||
}: DevSessionOptions) {
|
||||
}: DevSessionOptions): Promise<DevSessionInstance> {
|
||||
const destination = getTmpDir(rawConfig.workingDir, "build");
|
||||
|
||||
const runtime = await startWorkerRuntime({
|
||||
@@ -64,9 +67,15 @@ export async function startDevSession({
|
||||
args: rawArgs,
|
||||
});
|
||||
|
||||
logger.debug("Starting dev session", { destination: destination.path, rawConfig });
|
||||
const alwaysExternal = await resolveAlwaysExternal(client);
|
||||
|
||||
const externalsExtension = createExternalsBuildExtension("dev", rawConfig);
|
||||
logger.debug("Starting dev session", {
|
||||
destination: destination.path,
|
||||
rawConfig,
|
||||
alwaysExternal,
|
||||
});
|
||||
|
||||
const externalsExtension = createExternalsBuildExtension("dev", rawConfig, alwaysExternal);
|
||||
const buildContext = createBuildContext("dev", rawConfig);
|
||||
buildContext.prependExtension(externalsExtension);
|
||||
await notifyExtensionOnBuildStart(buildContext);
|
||||
@@ -188,7 +197,7 @@ async function createBuildManifestFromBundle(
|
||||
environment: "dev",
|
||||
target: "dev",
|
||||
files: bundle.files,
|
||||
sources: await resolveFileSources(bundle.files, resolvedConfig.workingDir),
|
||||
sources: await resolveFileSources(bundle.files, resolvedConfig),
|
||||
externals: [],
|
||||
config: {
|
||||
project: resolvedConfig.project,
|
||||
@@ -197,7 +206,7 @@ async function createBuildManifestFromBundle(
|
||||
outputPath: destination,
|
||||
runWorkerEntryPoint: bundle.runWorkerEntryPoint ?? devRunWorker,
|
||||
indexWorkerEntryPoint: bundle.indexWorkerEntryPoint ?? devIndexWorker,
|
||||
loaderEntryPoint: bundle.loaderEntryPoint ?? telemetryEntryPoint,
|
||||
loaderEntryPoint: bundle.loaderEntryPoint,
|
||||
configPath: bundle.configPath,
|
||||
customConditions: resolvedConfig.build.conditions ?? [],
|
||||
deploy: {
|
||||
@@ -205,7 +214,7 @@ async function createBuildManifestFromBundle(
|
||||
},
|
||||
build: {},
|
||||
otelImportHook: {
|
||||
include: getInstrumentedPackageNames(resolvedConfig),
|
||||
include: resolvedConfig.instrumentedPackageNames ?? [],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ import { ClientRequestArgs } from "node:http";
|
||||
import { WebSocket } from "partysocket";
|
||||
import { ClientOptions, WebSocket as wsWebSocket } from "ws";
|
||||
import { CliApiClient } from "../apiClient.js";
|
||||
import { getInstrumentedPackageNames } from "../build/instrumentation.js";
|
||||
import { DevCommandOptions } from "../commands/dev.js";
|
||||
import { chalkError, chalkTask } from "../utilities/cliOutput.js";
|
||||
import { resolveDotEnvVars } from "../utilities/dotEnv.js";
|
||||
import { eventBus } from "../utilities/eventBus.js";
|
||||
import { logger } from "../utilities/logger.js";
|
||||
import { resolveTaskSourceFiles } from "../utilities/sourceFiles.js";
|
||||
import { resolveSourceFiles } from "../utilities/sourceFiles.js";
|
||||
import { BackgroundWorker, BackgroundWorkerCoordinator } from "./backgroundWorker.js";
|
||||
import { sanitizeEnvVars } from "../utilities/sanitizeEnvVars.js";
|
||||
|
||||
export interface WorkerRuntime {
|
||||
shutdown(): Promise<void>;
|
||||
@@ -192,7 +192,7 @@ class DevWorkerRuntime implements WorkerRuntime {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceFiles = resolveTaskSourceFiles(manifest.sources, backgroundWorker.manifest.tasks);
|
||||
const sourceFiles = resolveSourceFiles(manifest.sources, backgroundWorker.manifest.tasks);
|
||||
|
||||
const backgroundWorkerBody: CreateBackgroundWorkerRequestBody = {
|
||||
localOnly: true,
|
||||
@@ -229,22 +229,16 @@ class DevWorkerRuntime implements WorkerRuntime {
|
||||
|
||||
const processEnv = gatherProcessEnv();
|
||||
const dotEnvVars = resolveDotEnvVars(undefined, this.options.args.envFile);
|
||||
const OTEL_IMPORT_HOOK_INCLUDES = getInstrumentedPackageNames(this.options.config).join(",");
|
||||
|
||||
const stripEmptyValues = (obj: Record<string, string | undefined>) => {
|
||||
return Object.fromEntries(
|
||||
Object.entries(obj).filter(([, value]) =>
|
||||
typeof value === "string" ? !!value.trim() : !!value
|
||||
)
|
||||
);
|
||||
};
|
||||
const OTEL_IMPORT_HOOK_INCLUDES = (this.options.config.instrumentedPackageNames ?? []).join(
|
||||
","
|
||||
);
|
||||
|
||||
return {
|
||||
...stripEmptyValues(processEnv),
|
||||
...stripEmptyValues(
|
||||
...sanitizeEnvVars(processEnv),
|
||||
...sanitizeEnvVars(
|
||||
environmentVariablesResponse.success ? environmentVariablesResponse.data.variables : {}
|
||||
),
|
||||
...stripEmptyValues(dotEnvVars),
|
||||
...sanitizeEnvVars(dotEnvVars),
|
||||
TRIGGER_API_URL: this.options.client.apiURL,
|
||||
TRIGGER_SECRET_KEY: this.options.client.accessToken!,
|
||||
OTEL_EXPORTER_OTLP_COMPRESSION: "none",
|
||||
|
||||
@@ -8,7 +8,8 @@ import { join } from "node:path";
|
||||
import { env } from "std-env";
|
||||
import { CliApiClient } from "../apiClient.js";
|
||||
import { indexWorkerManifest } from "../indexing/indexWorkerManifest.js";
|
||||
import { resolveTaskSourceFiles } from "../utilities/sourceFiles.js";
|
||||
import { resolveSourceFiles } from "../utilities/sourceFiles.js";
|
||||
import { execOptionsForRuntime } from "@trigger.dev/core/v3/build";
|
||||
|
||||
async function loadBuildManifest() {
|
||||
const manifestContents = await readFile("./build.json", "utf-8");
|
||||
@@ -67,9 +68,7 @@ async function indexDeployment({
|
||||
runtime: buildManifest.runtime,
|
||||
indexWorkerPath: buildManifest.indexWorkerEntryPoint,
|
||||
buildManifestPath: "./build.json",
|
||||
nodeOptions: buildManifest.loaderEntryPoint
|
||||
? `--import=${buildManifest.loaderEntryPoint}`
|
||||
: undefined,
|
||||
nodeOptions: execOptionsForRuntime(buildManifest.runtime, buildManifest),
|
||||
env: $env.data.variables,
|
||||
otelHookExclude: buildManifest.otelImportHook?.exclude,
|
||||
otelHookInclude: buildManifest.otelImportHook?.include,
|
||||
@@ -87,7 +86,7 @@ async function indexDeployment({
|
||||
|
||||
await writeFile(join(process.cwd(), "index.json"), JSON.stringify(workerManifest, null, 2));
|
||||
|
||||
const sourceFiles = resolveTaskSourceFiles(buildManifest.sources, workerManifest.tasks);
|
||||
const sourceFiles = resolveSourceFiles(buildManifest.sources, workerManifest.tasks);
|
||||
|
||||
const backgroundWorkerBody: CreateBackgroundWorkerRequestBody = {
|
||||
localOnly: true,
|
||||
|
||||
@@ -153,7 +153,7 @@ class ProdWorker {
|
||||
if (this._taskRunProcess) {
|
||||
this._taskRunProcess.onTaskRunHeartbeat.detach();
|
||||
this._taskRunProcess.onWaitForDuration.detach();
|
||||
await this._taskRunProcess.cleanup(true);
|
||||
await this._taskRunProcess.kill();
|
||||
}
|
||||
|
||||
if (!gracefulExitTimeoutElapsed) {
|
||||
@@ -362,16 +362,8 @@ class ProdWorker {
|
||||
}
|
||||
|
||||
// MARK: RETRY PREP
|
||||
async #prepareForRetry(shouldExit: boolean, exitCode?: number) {
|
||||
logger.log("prepare for retry", { shouldExit, exitCode });
|
||||
|
||||
// Graceful shutdown on final attempt
|
||||
if (shouldExit) {
|
||||
await this.#exitGracefully(false, exitCode);
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear state for next execution
|
||||
async #prepareForRetry() {
|
||||
// Clear state for retrying
|
||||
this.paused = false;
|
||||
this.waitForPostStart = false;
|
||||
this.executing = false;
|
||||
@@ -534,7 +526,13 @@ class ProdWorker {
|
||||
? EXIT_CODE_CHILD_NONZERO
|
||||
: 0;
|
||||
|
||||
await this.#prepareForRetry(shouldExit, exitCode);
|
||||
if (shouldExit) {
|
||||
// Exit after completion, without any retrying
|
||||
await this.#exitGracefully(false, exitCode);
|
||||
} else {
|
||||
// We aren't exiting, so we need to prepare for the next attempt
|
||||
await this.#prepareForRetry();
|
||||
}
|
||||
|
||||
if (willCheckpointAndRestore) {
|
||||
logger.error("This worker should never be checkpointed between attempts. This is a bug.");
|
||||
@@ -772,7 +770,13 @@ class ProdWorker {
|
||||
|
||||
this.completed.add(execution.attempt.id);
|
||||
|
||||
await this._taskRunProcess.startFlushingProcess();
|
||||
try {
|
||||
await this._taskRunProcess.cleanup(true);
|
||||
} catch (error) {
|
||||
logger.error("Failed to cleanup task run process, submitting completion anyway", {
|
||||
error,
|
||||
});
|
||||
}
|
||||
|
||||
await this.#submitAttemptCompletion(execution, completion);
|
||||
} catch (error) {
|
||||
@@ -1140,7 +1144,7 @@ class ProdWorker {
|
||||
|
||||
const currentTaskRunProcess = this._taskRunProcess;
|
||||
|
||||
await currentTaskRunProcess.cleanup();
|
||||
await currentTaskRunProcess.kill();
|
||||
}
|
||||
|
||||
// MARK: HTTP SERVER
|
||||
|
||||
@@ -63,7 +63,6 @@ export class TaskRunProcess {
|
||||
private _isBeingKilled: boolean = false;
|
||||
private _isBeingCancelled: boolean = false;
|
||||
private _stderr: Array<string> = [];
|
||||
private _flushingProcess?: FlushingProcess;
|
||||
|
||||
public onTaskRunHeartbeat: Evt<string> = new Evt();
|
||||
public onExit: Evt<{ code: number | null; signal: NodeJS.Signals | null; pid?: number }> =
|
||||
@@ -80,12 +79,21 @@ export class TaskRunProcess {
|
||||
async cancel() {
|
||||
this._isBeingCancelled = true;
|
||||
|
||||
await this.startFlushingProcess();
|
||||
try {
|
||||
await this.#flush();
|
||||
} catch (err) {
|
||||
logger.error("Error flushing task run process", { err });
|
||||
}
|
||||
|
||||
await this.kill();
|
||||
}
|
||||
|
||||
async cleanup(kill = true) {
|
||||
await this.startFlushingProcess();
|
||||
try {
|
||||
await this.#flush();
|
||||
} catch (err) {
|
||||
logger.error("Error flushing task run process", { err });
|
||||
}
|
||||
|
||||
if (kill) {
|
||||
await this.kill("SIGKILL");
|
||||
@@ -183,14 +191,6 @@ export class TaskRunProcess {
|
||||
this._child.stderr?.on("data", this.#handleStdErr.bind(this));
|
||||
}
|
||||
|
||||
async startFlushingProcess() {
|
||||
if (this._flushingProcess) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._flushingProcess = new FlushingProcess(() => this.#flush());
|
||||
}
|
||||
|
||||
async #flush(timeoutInMs: number = 5_000) {
|
||||
logger.debug("flushing task run process", { pid: this.pid });
|
||||
|
||||
@@ -369,12 +369,6 @@ export class TaskRunProcess {
|
||||
|
||||
this.onIsBeingKilled.post(this);
|
||||
|
||||
try {
|
||||
await this._flushingProcess?.waitForCompletion();
|
||||
} catch (err) {
|
||||
logger.error("Error flushing task run process", { err });
|
||||
}
|
||||
|
||||
this._child?.kill(signal);
|
||||
|
||||
if (timeoutInMs) {
|
||||
@@ -394,15 +388,3 @@ export class TaskRunProcess {
|
||||
function executorArgs(workerManifest: WorkerManifest): string[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
class FlushingProcess {
|
||||
private _flushPromise: Promise<void>;
|
||||
|
||||
constructor(private readonly doFlush: () => Promise<void>) {
|
||||
this._flushPromise = this.doFlush().catch(() => {});
|
||||
}
|
||||
|
||||
waitForCompletion() {
|
||||
return this._flushPromise;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
export const sanitizeEnvVars = (obj: Record<string, string | undefined>) => {
|
||||
return Object.fromEntries(
|
||||
Object.entries(obj).filter(([, value]) =>
|
||||
typeof value === "string" ? !!value.trim() : !!value
|
||||
)
|
||||
);
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ResolvedConfig } from "@trigger.dev/core/v3/build";
|
||||
import type {
|
||||
BackgroundWorkerSourceFileMetadata,
|
||||
TaskFile,
|
||||
@@ -5,28 +6,70 @@ import type {
|
||||
} from "@trigger.dev/core/v3/schemas";
|
||||
import { createHash } from "node:crypto";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { join, relative } from "node:path";
|
||||
import * as zlib from "node:zlib";
|
||||
import { logger } from "./logger.js";
|
||||
|
||||
export async function resolveFileSources(files: TaskFile[], baseDir: string) {
|
||||
const sources: Record<string, { contents: string; contentHash: string }> = {};
|
||||
export type FileSource = { contents: string; contentHash: string };
|
||||
export type FileSources = Record<string, FileSource>;
|
||||
|
||||
export async function resolveFileSources(
|
||||
files: TaskFile[],
|
||||
resolvedConfig: ResolvedConfig
|
||||
): Promise<FileSources> {
|
||||
const sources: FileSources = {};
|
||||
|
||||
for (const file of files) {
|
||||
const fullPath = join(baseDir, file.entry);
|
||||
const content = await readFile(fullPath, "utf-8");
|
||||
const hasher = createHash("md5");
|
||||
hasher.update(content);
|
||||
const fullPath = join(resolvedConfig.workingDir, file.entry);
|
||||
const fileSource = await resolveFileSource(fullPath);
|
||||
|
||||
sources[file.entry] = {
|
||||
contents: compressContent(content),
|
||||
contentHash: hasher.digest("hex"),
|
||||
};
|
||||
if (!fileSource) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sources[file.entry] = fileSource;
|
||||
}
|
||||
|
||||
await resolveConfigSource(sources, resolvedConfig.workingDir, resolvedConfig.configFile);
|
||||
await resolveConfigSource(sources, resolvedConfig.workingDir, resolvedConfig.tsconfig);
|
||||
await resolveConfigSource(sources, resolvedConfig.workingDir, resolvedConfig.packageJsonPath);
|
||||
|
||||
return sources;
|
||||
}
|
||||
|
||||
export function resolveTaskSourceFiles(
|
||||
async function resolveConfigSource(sources: FileSources, workingDir: string, filePath?: string) {
|
||||
if (!filePath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const configSource = await resolveFileSource(filePath);
|
||||
|
||||
if (configSource) {
|
||||
sources[relative(workingDir, filePath)] = configSource;
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveFileSource(filePath: string): Promise<FileSource | undefined> {
|
||||
try {
|
||||
const content = await readFile(filePath, "utf-8");
|
||||
const hasher = createHash("md5");
|
||||
hasher.update(content);
|
||||
|
||||
return {
|
||||
contents: compressContent(content),
|
||||
contentHash: hasher.digest("hex"),
|
||||
};
|
||||
} catch (e) {
|
||||
logger.debug("Failed to read file", {
|
||||
filePath,
|
||||
error: e,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveSourceFiles(
|
||||
sources: Record<string, { contents: string; contentHash: string }>,
|
||||
tasks: TaskManifest[]
|
||||
): Array<BackgroundWorkerSourceFileMetadata> {
|
||||
@@ -42,12 +85,8 @@ export function resolveTaskSourceFiles(
|
||||
|
||||
const taskFiles: Array<BackgroundWorkerSourceFileMetadata> = [];
|
||||
|
||||
for (const [filePath, tasks] of Object.entries(tasksGroupedByFile)) {
|
||||
const source = sources[filePath];
|
||||
|
||||
if (!source) {
|
||||
continue;
|
||||
}
|
||||
for (const [filePath, source] of Object.entries(sources)) {
|
||||
const tasks = tasksGroupedByFile[filePath] ?? [];
|
||||
|
||||
const taskIds = tasks.map((task) => task.id);
|
||||
|
||||
|
||||
+112
-4
@@ -16,8 +16,8 @@
|
||||
],
|
||||
"tshy": {
|
||||
"selfLink": false,
|
||||
"main": false,
|
||||
"module": false,
|
||||
"main": true,
|
||||
"module": true,
|
||||
"project": "./tsconfig.src.json",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
@@ -60,6 +60,109 @@
|
||||
"@triggerdotdev/source"
|
||||
]
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"logger": [
|
||||
"dist/commonjs/logger.d.ts"
|
||||
],
|
||||
"bloom": [
|
||||
"dist/commonjs/bloom.d.ts"
|
||||
],
|
||||
"eventFilterMatches": [
|
||||
"dist/commonjs/eventFilterMatches.d.ts"
|
||||
],
|
||||
"replacements": [
|
||||
"dist/commonjs/replacements.d.ts"
|
||||
],
|
||||
"requestFilterMatches": [
|
||||
"dist/commonjs/requestFilterMatches.d.ts"
|
||||
],
|
||||
"retry": [
|
||||
"dist/commonjs/retry.d.ts"
|
||||
],
|
||||
"utils": [
|
||||
"dist/commonjs/utils.d.ts"
|
||||
],
|
||||
"schemas": [
|
||||
"dist/commonjs/schemas/index.d.ts"
|
||||
],
|
||||
"types": [
|
||||
"dist/commonjs/types.d.ts"
|
||||
],
|
||||
"versions": [
|
||||
"dist/commonjs/versions.d.ts"
|
||||
],
|
||||
"v3": [
|
||||
"dist/commonjs/v3/index.d.ts"
|
||||
],
|
||||
"v3/build": [
|
||||
"dist/commonjs/v3/build/index.d.ts"
|
||||
],
|
||||
"v3/apps": [
|
||||
"dist/commonjs/v3/apps/index.d.ts"
|
||||
],
|
||||
"v3/errors": [
|
||||
"dist/commonjs/v3/errors.d.ts"
|
||||
],
|
||||
"v3/logger-api": [
|
||||
"dist/commonjs/v3/logger-api.d.ts"
|
||||
],
|
||||
"v3/otel": [
|
||||
"dist/commonjs/v3/otel/index.d.ts"
|
||||
],
|
||||
"v3/semanticInternalAttributes": [
|
||||
"dist/commonjs/v3/semanticInternalAttributes.d.ts"
|
||||
],
|
||||
"v3/utils/durations": [
|
||||
"dist/commonjs/v3/utils/durations.d.ts"
|
||||
],
|
||||
"v3/utils/flattenAttributes": [
|
||||
"dist/commonjs/v3/utils/flattenAttributes.d.ts"
|
||||
],
|
||||
"v3/utils/ioSerialization": [
|
||||
"dist/commonjs/v3/utils/ioSerialization.d.ts"
|
||||
],
|
||||
"v3/utils/omit": [
|
||||
"dist/commonjs/v3/utils/omit.d.ts"
|
||||
],
|
||||
"v3/utils/retries": [
|
||||
"dist/commonjs/v3/utils/retries.d.ts"
|
||||
],
|
||||
"v3/utils/structuredLogger": [
|
||||
"dist/commonjs/v3/utils/structuredLogger.d.ts"
|
||||
],
|
||||
"v3/zodfetch": [
|
||||
"dist/commonjs/v3/zodfetch.d.ts"
|
||||
],
|
||||
"v3/zodMessageHandler": [
|
||||
"dist/commonjs/v3/zodMessageHandler.d.ts"
|
||||
],
|
||||
"v3/zodNamespace": [
|
||||
"dist/commonjs/v3/zodNamespace.d.ts"
|
||||
],
|
||||
"v3/zodSocket": [
|
||||
"dist/commonjs/v3/zodSocket.d.ts"
|
||||
],
|
||||
"v3/zodIpc": [
|
||||
"dist/commonjs/v3/zodIpc.d.ts"
|
||||
],
|
||||
"v3/utils/timers": [
|
||||
"dist/commonjs/v3/utils/timers.d.ts"
|
||||
],
|
||||
"v3/dev": [
|
||||
"dist/commonjs/v3/dev/index.d.ts"
|
||||
],
|
||||
"v3/prod": [
|
||||
"dist/commonjs/v3/prod/index.d.ts"
|
||||
],
|
||||
"v3/workers": [
|
||||
"dist/commonjs/v3/workers/index.d.ts"
|
||||
],
|
||||
"v3/schemas": [
|
||||
"dist/commonjs/v3/schemas/index.d.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -67,7 +170,8 @@
|
||||
"build": "tshy && pnpm run update-version",
|
||||
"dev": "tshy --watch",
|
||||
"typecheck": "tsc --noEmit -p tsconfig.src.json",
|
||||
"test": "vitest"
|
||||
"test": "vitest",
|
||||
"check-exports": "attw --pack ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@google-cloud/precise-date": "^4.0.0",
|
||||
@@ -91,6 +195,7 @@
|
||||
"zod-validation-error": "^1.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.15.4",
|
||||
"@types/humanize-duration": "^3.27.1",
|
||||
"@types/node": "20.14.14",
|
||||
"@types/readable-stream": "^4.0.14",
|
||||
@@ -484,5 +589,8 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "module"
|
||||
"type": "module",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"module": "./dist/esm/index.js"
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export const alwaysExternal = ["import-in-the-middle", "header-generator"];
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./extensions.js";
|
||||
export * from "./resolvedConfig.js"
|
||||
export * from "./runtime.js";
|
||||
export * from "./resolvedConfig.js";
|
||||
export * from "./runtime.js";
|
||||
export * from "./externals.js";
|
||||
|
||||
@@ -25,5 +25,6 @@ export type ResolvedConfig = Prettify<
|
||||
lockfilePath: string;
|
||||
configFile?: string;
|
||||
resolveEnvVars?: ResolveEnvironmentVariablesFunction;
|
||||
instrumentedPackageNames?: string[];
|
||||
}
|
||||
>;
|
||||
|
||||
@@ -184,6 +184,9 @@ export type InitializeDeploymentResponseBody = z.infer<typeof InitializeDeployme
|
||||
export const InitializeDeploymentRequestBody = z.object({
|
||||
contentHash: z.string(),
|
||||
userId: z.string().optional(),
|
||||
registryHost: z.string().optional(),
|
||||
selfHosted: z.boolean().optional(),
|
||||
namespace: z.string().optional(),
|
||||
});
|
||||
|
||||
export type InitializeDeploymentRequestBody = z.infer<typeof InitializeDeploymentRequestBody>;
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
"cronstrue": "^2.21.0",
|
||||
"debug": "^4.3.4",
|
||||
"evt": "^2.4.13",
|
||||
"msw": "^2.3.5",
|
||||
"slug": "^6.0.0",
|
||||
"terminal-link": "^3.0.0",
|
||||
"ulid": "^2.3.0",
|
||||
@@ -69,7 +68,6 @@
|
||||
"@types/uuid": "^9.0.0",
|
||||
"@types/ws": "^8.5.3",
|
||||
"encoding": "^0.1.13",
|
||||
"msw": "^2.2.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"tshy": "^3.0.2",
|
||||
"tsx": "4.17.0",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
API_VERSIONS,
|
||||
ConnectionAuth,
|
||||
DELIVER_WEBHOOK_REQUEST,
|
||||
DeserializedJson,
|
||||
EphemeralEventDispatcherRequestBody,
|
||||
ErrorWithStackSchema,
|
||||
@@ -47,7 +46,6 @@ import {
|
||||
import { LogLevel, Logger } from "@trigger.dev/core/logger";
|
||||
import EventEmitter from "node:events";
|
||||
import { env } from "node:process";
|
||||
import { version } from "../package.json";
|
||||
import { ApiClient } from "./apiClient.js";
|
||||
import { ConcurrencyLimit, ConcurrencyLimitOptions } from "./concurrencyLimit.js";
|
||||
import {
|
||||
@@ -83,6 +81,7 @@ import {
|
||||
type VerifyResult,
|
||||
} from "./types.js";
|
||||
import { formatSchemaErrors } from "./utils/formatSchemaErrors.js";
|
||||
import { VERSION } from "./version.js";
|
||||
|
||||
const parseRequestPayload = (rawPayload: any) => {
|
||||
const result = RequestWithRawBodySchema.safeParse(rawPayload);
|
||||
@@ -1795,7 +1794,7 @@ export class TriggerClient {
|
||||
#standardResponseHeaders(start: number): Record<string, string> {
|
||||
return {
|
||||
"Trigger-Version": API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|
||||
"Trigger-SDK-Version": version,
|
||||
"Trigger-SDK-Version": VERSION,
|
||||
"X-Trigger-Request-Timing": `dur=${performance.now() - start / 1000.0}`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,14 +16,12 @@ import {
|
||||
accessoryAttributes,
|
||||
calculateNextRetryDelay,
|
||||
calculateResetAt,
|
||||
defaultFetchRetryOptions,
|
||||
defaultRetryOptions,
|
||||
eventFilterMatches,
|
||||
flattenAttributes,
|
||||
runtime,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { defaultFetchRetryOptions } from "@trigger.dev/core/v3";
|
||||
import type { HttpHandler } from "msw";
|
||||
import { AsyncLocalStorage } from "node:async_hooks";
|
||||
import { tracer } from "./tracer.js";
|
||||
|
||||
export type { RetryOptions };
|
||||
@@ -140,34 +138,6 @@ const normalizeHttpMethod = (input: RequestInfo | URL | string, init?: RequestIn
|
||||
return (input.method ?? init?.method ?? "GET").toUpperCase();
|
||||
};
|
||||
|
||||
const fetchHttpHandlerStorage = new AsyncLocalStorage<Array<HttpHandler>>();
|
||||
|
||||
const fetchWithInterceptors = async (
|
||||
input: RequestInfo | URL,
|
||||
init?: RequestInit
|
||||
): Promise<Response> => {
|
||||
const handlers = fetchHttpHandlerStorage.getStore();
|
||||
|
||||
if (handlers) {
|
||||
try {
|
||||
const { getResponse } = await import("msw");
|
||||
|
||||
const request = new Request(input, init);
|
||||
|
||||
const response = await getResponse(handlers, request);
|
||||
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
} catch (e) {
|
||||
// Do nothing
|
||||
return fetch(input, init);
|
||||
}
|
||||
}
|
||||
|
||||
return fetch(input, init);
|
||||
};
|
||||
|
||||
class FetchErrorWithSpan extends Error {
|
||||
constructor(
|
||||
public readonly originalError: unknown,
|
||||
@@ -383,7 +353,7 @@ const doFetchRequest = async (
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await fetchWithInterceptors(input, {
|
||||
const response = await fetch(input, {
|
||||
...init,
|
||||
headers: {
|
||||
...init?.headers,
|
||||
@@ -570,21 +540,6 @@ const safeJsonParse = (json: string): unknown => {
|
||||
}
|
||||
};
|
||||
|
||||
const interceptFetch = (...handlers: Array<HttpHandler>) => {
|
||||
return {
|
||||
run: async <T>(fn: (...args: any[]) => Promise<T>): Promise<T> => {
|
||||
const current = fetchHttpHandlerStorage.getStore();
|
||||
|
||||
if (current) {
|
||||
current.push(...handlers);
|
||||
return fn();
|
||||
} else {
|
||||
return fetchHttpHandlerStorage.run(handlers, fn);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
// This function will resolve the defaults of a property within an options object.
|
||||
// If the options object is undefined, it will return the defaults for that property (passed in as the 3rd arg).
|
||||
// if the options object is defined, and the property exists, then it will return the defaults if the value of the property is undefined or null
|
||||
@@ -662,5 +617,4 @@ const createFetchRetryOptionsAttributes = (retry?: FetchRetryOptions): Attribute
|
||||
export const retry = {
|
||||
onThrow,
|
||||
fetch: retryFetch,
|
||||
interceptFetch,
|
||||
};
|
||||
|
||||
Generated
+122
-106
@@ -819,6 +819,9 @@ importers:
|
||||
tinyglobby:
|
||||
specifier: ^0.2.2
|
||||
version: 0.2.2
|
||||
tsconfck:
|
||||
specifier: 3.1.3
|
||||
version: 3.1.3(typescript@5.5.4)
|
||||
devDependencies:
|
||||
'@arethetypeswrong/cli':
|
||||
specifier: ^0.15.4
|
||||
@@ -1110,6 +1113,9 @@ importers:
|
||||
specifier: ^1.5.0
|
||||
version: 1.5.0(zod@3.22.3)
|
||||
devDependencies:
|
||||
'@arethetypeswrong/cli':
|
||||
specifier: ^0.15.4
|
||||
version: 0.15.4
|
||||
'@types/humanize-duration':
|
||||
specifier: ^3.27.1
|
||||
version: 3.27.1
|
||||
@@ -1242,9 +1248,6 @@ importers:
|
||||
evt:
|
||||
specifier: ^2.4.13
|
||||
version: 2.4.13
|
||||
msw:
|
||||
specifier: ^2.3.5
|
||||
version: 2.3.5(typescript@5.5.4)
|
||||
slug:
|
||||
specifier: ^6.0.0
|
||||
version: 6.1.0
|
||||
@@ -1360,8 +1363,8 @@ importers:
|
||||
specifier: 1.4.1
|
||||
version: 1.4.1
|
||||
'@prisma/client':
|
||||
specifier: 5.18.0
|
||||
version: 5.18.0(prisma@5.18.0)
|
||||
specifier: 5.19.0
|
||||
version: 5.19.0(prisma@5.19.0)
|
||||
'@react-email/components':
|
||||
specifier: 0.0.24
|
||||
version: 0.0.24(react-dom@18.2.0)(react@19.0.0-rc.0)
|
||||
@@ -1398,6 +1401,9 @@ importers:
|
||||
execa:
|
||||
specifier: ^8.0.1
|
||||
version: 8.0.1
|
||||
header-generator:
|
||||
specifier: ^2.1.55
|
||||
version: 2.1.55
|
||||
kysely:
|
||||
specifier: ^0.27.4
|
||||
version: 0.27.4
|
||||
@@ -1496,8 +1502,8 @@ importers:
|
||||
specifier: ^0.19.11
|
||||
version: 0.19.11
|
||||
prisma:
|
||||
specifier: 5.18.0
|
||||
version: 5.18.0
|
||||
specifier: 5.19.0
|
||||
version: 5.19.0
|
||||
prisma-kysely:
|
||||
specifier: ^1.8.0
|
||||
version: 1.8.0
|
||||
@@ -2302,7 +2308,7 @@ packages:
|
||||
dependencies:
|
||||
'@babel/compat-data': 7.22.9
|
||||
'@babel/helper-validator-option': 7.22.15
|
||||
browserslist: 4.21.10
|
||||
browserslist: 4.23.3
|
||||
lru-cache: 5.1.1
|
||||
semver: 6.3.1
|
||||
|
||||
@@ -4070,7 +4076,7 @@ packages:
|
||||
/@clack/core@0.3.3:
|
||||
resolution: {integrity: sha512-5ZGyb75BUBjlll6eOa1m/IZBxwk91dooBWhPSL67sWcLS0zt9SnswRL0l26TVdBhb0wnWORRxUn//uH6n4z7+A==}
|
||||
dependencies:
|
||||
picocolors: 1.0.0
|
||||
picocolors: 1.0.1
|
||||
sisteransi: 1.0.5
|
||||
dev: false
|
||||
|
||||
@@ -7914,8 +7920,8 @@ packages:
|
||||
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
|
||||
dev: false
|
||||
|
||||
/@prisma/client@5.18.0(prisma@5.18.0):
|
||||
resolution: {integrity: sha512-BWivkLh+af1kqC89zCJYkHsRcyWsM8/JHpsDMM76DjP3ZdEquJhXa4IeX+HkWPnwJ5FanxEJFZZDTWiDs/Kvyw==}
|
||||
/@prisma/client@5.19.0(prisma@5.19.0):
|
||||
resolution: {integrity: sha512-CzOpau+q1kEWQyoQMvlnXIHqPvwmWbh48xZ4n8KWbAql0p8PC0BIgSTYW5ncxXa4JSEff0tcoxSZB874wDstdg==}
|
||||
engines: {node: '>=16.13'}
|
||||
requiresBuild: true
|
||||
peerDependencies:
|
||||
@@ -7924,7 +7930,7 @@ packages:
|
||||
prisma:
|
||||
optional: true
|
||||
dependencies:
|
||||
prisma: 5.18.0
|
||||
prisma: 5.19.0
|
||||
dev: false
|
||||
|
||||
/@prisma/client@5.4.1(prisma@5.4.1):
|
||||
@@ -7941,8 +7947,8 @@ packages:
|
||||
prisma: 5.4.1
|
||||
dev: false
|
||||
|
||||
/@prisma/debug@5.18.0:
|
||||
resolution: {integrity: sha512-f+ZvpTLidSo3LMJxQPVgAxdAjzv5OpzAo/eF8qZqbwvgi2F5cTOI9XCpdRzJYA0iGfajjwjOKKrVq64vkxEfUw==}
|
||||
/@prisma/debug@5.19.0:
|
||||
resolution: {integrity: sha512-+b/G0ubAZlrS+JSiDhXnYV5DF/aTJ3pinktkiV/L4TtLRLZO6SVGyFELgxBsicCTWJ2ZMu5vEV/jTtYCdjFTRA==}
|
||||
|
||||
/@prisma/debug@5.3.1:
|
||||
resolution: {integrity: sha512-eYrxqslEKf+wpMFIIHgbcNYuZBXUdiJLA85Or3TwOhgPIN1ZoXT9CwJph3ynW8H1Xg0LkdYLwVmuULCwiMoU5A==}
|
||||
@@ -7954,21 +7960,21 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@prisma/engines-version@5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169:
|
||||
resolution: {integrity: sha512-a/+LpJj8vYU3nmtkg+N3X51ddbt35yYrRe8wqHTJtYQt7l1f8kjIBcCs6sHJvodW/EK5XGvboOiwm47fmNrbgg==}
|
||||
/@prisma/engines-version@5.19.0-31.5fe21811a6ba0b952a3bc71400666511fe3b902f:
|
||||
resolution: {integrity: sha512-GimI9aZIFy/yvvR11KfXRn3pliFn1QAkdebVlsXlnoh5uk0YhLblVmeYiHfsu+wDA7BeKqYT4sFfzg8mutzuWw==}
|
||||
|
||||
/@prisma/engines-version@5.4.1-1.2f302df92bd8945e20ad4595a73def5b96afa54f:
|
||||
resolution: {integrity: sha512-+nUQM/y8C+1GG5Ioeqcu6itFslCfxvQSAUVSMC9XM2G2Fcq0F4Afnp6m0pXF6X6iUBWen7jZBPmM9Qlq4Nr3/A==}
|
||||
dev: false
|
||||
|
||||
/@prisma/engines@5.18.0:
|
||||
resolution: {integrity: sha512-ofmpGLeJ2q2P0wa/XaEgTnX/IsLnvSp/gZts0zjgLNdBhfuj2lowOOPmDcfKljLQUXMvAek3lw5T01kHmCG8rg==}
|
||||
/@prisma/engines@5.19.0:
|
||||
resolution: {integrity: sha512-UtW+0m4HYoRSSR3LoDGKF3Ud4BSMWYlLEt4slTnuP1mI+vrV3zaDoiAPmejdAT76vCN5UqnWURbkXxf66nSylQ==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@prisma/debug': 5.18.0
|
||||
'@prisma/engines-version': 5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169
|
||||
'@prisma/fetch-engine': 5.18.0
|
||||
'@prisma/get-platform': 5.18.0
|
||||
'@prisma/debug': 5.19.0
|
||||
'@prisma/engines-version': 5.19.0-31.5fe21811a6ba0b952a3bc71400666511fe3b902f
|
||||
'@prisma/fetch-engine': 5.19.0
|
||||
'@prisma/get-platform': 5.19.0
|
||||
|
||||
/@prisma/engines@5.3.1:
|
||||
resolution: {integrity: sha512-6QkILNyfeeN67BNEPEtkgh3Xo2tm6D7V+UhrkBbRHqKw9CTaz/vvTP/ROwYSP/3JT2MtIutZm/EnhxUiuOPVDA==}
|
||||
@@ -7979,12 +7985,12 @@ packages:
|
||||
resolution: {integrity: sha512-vJTdY4la/5V3N7SFvWRmSMUh4mIQnyb/MNoDjzVbh9iLmEC+uEykj/1GPviVsorvfz7DbYSQC4RiwmlEpTEvGA==}
|
||||
requiresBuild: true
|
||||
|
||||
/@prisma/fetch-engine@5.18.0:
|
||||
resolution: {integrity: sha512-I/3u0x2n31rGaAuBRx2YK4eB7R/1zCuayo2DGwSpGyrJWsZesrV7QVw7ND0/Suxeo/vLkJ5OwuBqHoCxvTHpOg==}
|
||||
/@prisma/fetch-engine@5.19.0:
|
||||
resolution: {integrity: sha512-oOiPNtmJX0cP/ebu7BBEouJvCw8T84/MFD/Hf2zlqjxkK4ojl38bB9i9J5LAxotL6WlYVThKdxc7HqoWnPOhqQ==}
|
||||
dependencies:
|
||||
'@prisma/debug': 5.18.0
|
||||
'@prisma/engines-version': 5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169
|
||||
'@prisma/get-platform': 5.18.0
|
||||
'@prisma/debug': 5.19.0
|
||||
'@prisma/engines-version': 5.19.0-31.5fe21811a6ba0b952a3bc71400666511fe3b902f
|
||||
'@prisma/get-platform': 5.19.0
|
||||
|
||||
/@prisma/fetch-engine@5.3.1:
|
||||
resolution: {integrity: sha512-w1yk1YiK8N82Pobdq58b85l6e8akyrkxuzwV9DoiUTRf3gpsuhJJesHc4Yi0WzUC9/3znizl1UfCsI6dhkj3Vw==}
|
||||
@@ -8022,10 +8028,10 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@prisma/get-platform@5.18.0:
|
||||
resolution: {integrity: sha512-Tk+m7+uhqcKDgnMnFN0lRiH7Ewea0OEsZZs9pqXa7i3+7svS3FSCqDBCaM9x5fmhhkufiG0BtunJVDka+46DlA==}
|
||||
/@prisma/get-platform@5.19.0:
|
||||
resolution: {integrity: sha512-s9DWkZKnuP4Y8uy6yZfvqQ/9X3/+2KYf3IZUVZz5OstJdGBJrBlbmIuMl81917wp5TuK/1k2TpHNCEdpYLPKmg==}
|
||||
dependencies:
|
||||
'@prisma/debug': 5.18.0
|
||||
'@prisma/debug': 5.19.0
|
||||
|
||||
/@prisma/get-platform@5.3.1:
|
||||
resolution: {integrity: sha512-3IiZY2BUjKnAuZ0569zppZE6/rZbVAM09//c2nvPbbkGG9MqrirA8fbhhF7tfVmhyVfdmVCHnf/ujWPHJ8B46Q==}
|
||||
@@ -12141,7 +12147,6 @@ packages:
|
||||
/@sindresorhus/is@4.6.0:
|
||||
resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==}
|
||||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/@sindresorhus/slugify@2.2.1:
|
||||
resolution: {integrity: sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==}
|
||||
@@ -14336,6 +14341,11 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/adm-zip@0.5.16:
|
||||
resolution: {integrity: sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==}
|
||||
engines: {node: '>=12.0'}
|
||||
dev: false
|
||||
|
||||
/agent-base@6.0.2:
|
||||
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
||||
engines: {node: '>= 6.0.0'}
|
||||
@@ -14825,8 +14835,8 @@ packages:
|
||||
peerDependencies:
|
||||
postcss: ^8.1.0
|
||||
dependencies:
|
||||
browserslist: 4.23.0
|
||||
caniuse-lite: 1.0.30001593
|
||||
browserslist: 4.23.3
|
||||
caniuse-lite: 1.0.30001655
|
||||
fraction.js: 4.2.0
|
||||
normalize-range: 0.1.2
|
||||
picocolors: 1.0.1
|
||||
@@ -14838,8 +14848,8 @@ packages:
|
||||
resolution: {integrity: sha512-eM9d/swFopRt5gdJ7jrpCwgvEMIayITpojhkkSMRsFHYuH5bkSQ4p/9qTEHtmNudUZh22Tehu7I6CxAW0IXTKA==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
browserslist: 4.23.0
|
||||
caniuse-lite: 1.0.30001577
|
||||
browserslist: 4.23.3
|
||||
caniuse-lite: 1.0.30001655
|
||||
normalize-range: 0.1.2
|
||||
num2fraction: 1.2.2
|
||||
picocolors: 0.2.1
|
||||
@@ -15142,16 +15152,6 @@ packages:
|
||||
pako: 0.2.9
|
||||
dev: true
|
||||
|
||||
/browserslist@4.21.10:
|
||||
resolution: {integrity: sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==}
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001577
|
||||
electron-to-chromium: 1.4.513
|
||||
node-releases: 2.0.13
|
||||
update-browserslist-db: 1.0.11(browserslist@4.21.10)
|
||||
|
||||
/browserslist@4.21.4:
|
||||
resolution: {integrity: sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==}
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
@@ -15163,16 +15163,6 @@ packages:
|
||||
update-browserslist-db: 1.0.11(browserslist@4.21.4)
|
||||
dev: true
|
||||
|
||||
/browserslist@4.23.0:
|
||||
resolution: {integrity: sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==}
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001593
|
||||
electron-to-chromium: 1.4.690
|
||||
node-releases: 2.0.14
|
||||
update-browserslist-db: 1.0.13(browserslist@4.23.0)
|
||||
|
||||
/browserslist@4.23.3:
|
||||
resolution: {integrity: sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==}
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
@@ -15365,9 +15355,7 @@ packages:
|
||||
|
||||
/caniuse-lite@1.0.30001577:
|
||||
resolution: {integrity: sha512-rs2ZygrG1PNXMfmncM0B5H1hndY5ZCC9b5TkFaVNfZ+AUlyqcMyVIQtc3fsezi0NUCk5XZfDf9WS6WxMxnfdrg==}
|
||||
|
||||
/caniuse-lite@1.0.30001593:
|
||||
resolution: {integrity: sha512-UWM1zlo3cZfkpBysd7AS+z+v007q9G1+fLTUU42rQnY6t2axoogPW/xol6T7juU5EUoOhML4WgBIdG+9yYqAjQ==}
|
||||
dev: true
|
||||
|
||||
/caniuse-lite@1.0.30001655:
|
||||
resolution: {integrity: sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==}
|
||||
@@ -15905,13 +15893,13 @@ packages:
|
||||
/core-js-compat@3.27.1:
|
||||
resolution: {integrity: sha512-Dg91JFeCDA17FKnneN7oCMz4BkQ4TcffkgHP4OWwp9yx3pi7ubqMDXXSacfNak1PQqjc95skyt+YBLHQJnkJwA==}
|
||||
dependencies:
|
||||
browserslist: 4.23.0
|
||||
browserslist: 4.23.3
|
||||
dev: true
|
||||
|
||||
/core-js-compat@3.36.0:
|
||||
resolution: {integrity: sha512-iV9Pd/PsgjNWBXeq8XRtWVSgz2tKAfhfvBs7qxYty+RlRd+OCksaWmOnc4JKrTc1cToXL1N0s3l/vwlxPtdElw==}
|
||||
dependencies:
|
||||
browserslist: 4.23.0
|
||||
browserslist: 4.23.3
|
||||
dev: true
|
||||
|
||||
/core-util-is@1.0.2:
|
||||
@@ -16659,6 +16647,13 @@ packages:
|
||||
domhandler: 5.0.3
|
||||
dev: false
|
||||
|
||||
/dot-prop@6.0.1:
|
||||
resolution: {integrity: sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
is-obj: 2.0.0
|
||||
dev: false
|
||||
|
||||
/dotenv@16.0.3:
|
||||
resolution: {integrity: sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==}
|
||||
engines: {node: '>=12'}
|
||||
@@ -16724,12 +16719,6 @@ packages:
|
||||
resolution: {integrity: sha512-MGO1k0w1RgrfdbLVwmXcDhHHuxCn2qRgR7dYsJvWFKDttvYPx6FNzCGG0c/fBBvzK2LDh3UV7Tt9awnHnvAAUQ==}
|
||||
dev: true
|
||||
|
||||
/electron-to-chromium@1.4.513:
|
||||
resolution: {integrity: sha512-cOB0xcInjm+E5qIssHeXJ29BaUyWpMyFKT5RB3bsLENDheCja0wMkHJyiPl0NBE/VzDI7JDuNEQWhe6RitEUcw==}
|
||||
|
||||
/electron-to-chromium@1.4.690:
|
||||
resolution: {integrity: sha512-+2OAGjUx68xElQhydpcbqH50hE8Vs2K6TkAeLhICYfndb67CVH0UsZaijmRUE3rHlIxU1u0jxwhgVe6fK3YANA==}
|
||||
|
||||
/electron-to-chromium@1.5.13:
|
||||
resolution: {integrity: sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==}
|
||||
|
||||
@@ -17442,10 +17431,6 @@ packages:
|
||||
'@esbuild/win32-ia32': 0.23.0
|
||||
'@esbuild/win32-x64': 0.23.0
|
||||
|
||||
/escalade@3.1.1:
|
||||
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
/escalade@3.2.0:
|
||||
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -18646,6 +18631,13 @@ packages:
|
||||
/functions-have-names@1.2.3:
|
||||
resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==}
|
||||
|
||||
/generative-bayesian-network@2.1.55:
|
||||
resolution: {integrity: sha512-igqQZTtS4GFwkDWA5gFWQye9Lmkx184Y17+x9flFq8HC68RVuuQGPeQtBFdMMlnac7/2Bq1n+1rkp4S8ZAu7kA==}
|
||||
dependencies:
|
||||
adm-zip: 0.5.16
|
||||
tslib: 2.6.2
|
||||
dev: false
|
||||
|
||||
/generic-names@4.0.0:
|
||||
resolution: {integrity: sha512-ySFolZQfw9FoDb3ed9d80Cm9f0+r7qj+HJkWjeD9RBfpxEVTlVhol+gvaQB/78WbwYfbnNh8nWHHBSlg072y6A==}
|
||||
dependencies:
|
||||
@@ -19149,6 +19141,16 @@ packages:
|
||||
resolution: {integrity: sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==}
|
||||
dev: true
|
||||
|
||||
/header-generator@2.1.55:
|
||||
resolution: {integrity: sha512-UeR5q/hGY6o78wH9T5hBIdhTQ7kraw90jb+bhAuvcpEI6aEfzguYhNf33uxT2qbnOoSg8hFd0YCJtiEqujMPRg==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
dependencies:
|
||||
browserslist: 4.23.3
|
||||
generative-bayesian-network: 2.1.55
|
||||
ow: 0.28.2
|
||||
tslib: 2.6.2
|
||||
dev: false
|
||||
|
||||
/headers-polyfill@4.0.2:
|
||||
resolution: {integrity: sha512-EWGTfnTqAO2L/j5HZgoM/3z82L7necsJ0pO9Tp0X1wil3PDLrkypTBRgVO2ExehEEvUycejZD3FuRaXpZZc3kw==}
|
||||
dev: false
|
||||
@@ -19714,6 +19716,11 @@ packages:
|
||||
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
|
||||
engines: {node: '>=0.12.0'}
|
||||
|
||||
/is-obj@2.0.0:
|
||||
resolution: {integrity: sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==}
|
||||
engines: {node: '>=8'}
|
||||
dev: false
|
||||
|
||||
/is-path-cwd@2.2.0:
|
||||
resolution: {integrity: sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -20300,6 +20307,10 @@ packages:
|
||||
resolution: {integrity: sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==}
|
||||
dev: false
|
||||
|
||||
/lodash.isequal@4.5.0:
|
||||
resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==}
|
||||
dev: false
|
||||
|
||||
/lodash.isplainobject@4.0.6:
|
||||
resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==}
|
||||
dev: true
|
||||
@@ -21439,7 +21450,7 @@ packages:
|
||||
'@next/env': 14.1.0
|
||||
'@swc/helpers': 0.5.2
|
||||
busboy: 1.6.0
|
||||
caniuse-lite: 1.0.30001593
|
||||
caniuse-lite: 1.0.30001655
|
||||
graceful-fs: 4.2.11
|
||||
postcss: 8.4.31
|
||||
react: 18.2.0
|
||||
@@ -21483,7 +21494,7 @@ packages:
|
||||
'@playwright/test': 1.37.0
|
||||
'@swc/helpers': 0.5.5
|
||||
busboy: 1.6.0
|
||||
caniuse-lite: 1.0.30001593
|
||||
caniuse-lite: 1.0.30001655
|
||||
graceful-fs: 4.2.11
|
||||
postcss: 8.4.31
|
||||
react: 19.0.0-rc.0
|
||||
@@ -21604,12 +21615,6 @@ packages:
|
||||
resolution: {integrity: sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==}
|
||||
dev: true
|
||||
|
||||
/node-releases@2.0.13:
|
||||
resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==}
|
||||
|
||||
/node-releases@2.0.14:
|
||||
resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==}
|
||||
|
||||
/node-releases@2.0.18:
|
||||
resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==}
|
||||
|
||||
@@ -22067,6 +22072,17 @@ packages:
|
||||
resolution: {integrity: sha512-Ou3dJ6bA/UJ5GVHxah4LnqDwZRwAmWxrG3wtrHrbGnP4RnLCtA64A4F+ae7Y8ww660JaddSoArUR5HjipWSHAQ==}
|
||||
dev: false
|
||||
|
||||
/ow@0.28.2:
|
||||
resolution: {integrity: sha512-dD4UpyBh/9m4X2NVjA+73/ZPBRF+uF4zIMFvvQsabMiEK8x41L3rQ8EENOi35kyyoaJwNxEeJcP6Fj1H4U409Q==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
'@sindresorhus/is': 4.6.0
|
||||
callsites: 3.1.0
|
||||
dot-prop: 6.0.1
|
||||
lodash.isequal: 4.5.0
|
||||
vali-date: 1.0.0
|
||||
dev: false
|
||||
|
||||
/p-cancelable@1.1.0:
|
||||
resolution: {integrity: sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -23201,13 +23217,15 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/prisma@5.18.0:
|
||||
resolution: {integrity: sha512-+TrSIxZsh64OPOmaSgVPH7ALL9dfU0jceYaMJXsNrTkFHO7/3RANi5K2ZiPB1De9+KDxCWn7jvRq8y8pvk+o9g==}
|
||||
/prisma@5.19.0:
|
||||
resolution: {integrity: sha512-Pu7lUKpVyTx8cVwM26dYh8NdvMOkMnJXzE8L6cikFuR4JwyMU5NKofQkWyxJKlTT4fNjmcnibTvklV8oVMrn+g==}
|
||||
engines: {node: '>=16.13'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@prisma/engines': 5.18.0
|
||||
'@prisma/engines': 5.19.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
|
||||
/prisma@5.4.1:
|
||||
resolution: {integrity: sha512-op9PmU8Bcw5dNAas82wBYTG0yHnpq9/O3bhxbDBrNzwZTwBqsVCxxYRLf6wHNh9HVaDGhgjjHlu1+BcW8qdnBg==}
|
||||
@@ -25698,7 +25716,7 @@ packages:
|
||||
dependencies:
|
||||
'@fullhuman/postcss-purgecss': 2.3.0
|
||||
autoprefixer: 9.8.8
|
||||
browserslist: 4.21.10
|
||||
browserslist: 4.23.3
|
||||
bytes: 3.1.2
|
||||
chalk: 4.1.2
|
||||
color: 3.2.1
|
||||
@@ -26242,6 +26260,19 @@ packages:
|
||||
typescript: 5.5.4
|
||||
dev: true
|
||||
|
||||
/tsconfck@3.1.3(typescript@5.5.4):
|
||||
resolution: {integrity: sha512-ulNZP1SVpRDesxeMLON/LtWM8HIgAJEIVpVVhBM6gsmvQ8+Rh+ZG7FWGvHh7Ah3pRABwVJWklWCr/BTZSv0xnQ==}
|
||||
engines: {node: ^18 || >=20}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
typescript: ^5.0.0
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
typescript: 5.5.4
|
||||
dev: false
|
||||
|
||||
/tsconfig-paths@3.14.1:
|
||||
resolution: {integrity: sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==}
|
||||
dependencies:
|
||||
@@ -26842,16 +26873,6 @@ packages:
|
||||
webpack-virtual-modules: 0.5.0
|
||||
dev: false
|
||||
|
||||
/update-browserslist-db@1.0.11(browserslist@4.21.10):
|
||||
resolution: {integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
browserslist: '>= 4.21.0'
|
||||
dependencies:
|
||||
browserslist: 4.21.10
|
||||
escalade: 3.2.0
|
||||
picocolors: 1.0.1
|
||||
|
||||
/update-browserslist-db@1.0.11(browserslist@4.21.4):
|
||||
resolution: {integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==}
|
||||
hasBin: true
|
||||
@@ -26863,16 +26884,6 @@ packages:
|
||||
picocolors: 1.0.1
|
||||
dev: true
|
||||
|
||||
/update-browserslist-db@1.0.13(browserslist@4.23.0):
|
||||
resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
browserslist: '>= 4.21.0'
|
||||
dependencies:
|
||||
browserslist: 4.23.0
|
||||
escalade: 3.2.0
|
||||
picocolors: 1.0.1
|
||||
|
||||
/update-browserslist-db@1.1.0(browserslist@4.23.3):
|
||||
resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==}
|
||||
hasBin: true
|
||||
@@ -27042,6 +27053,11 @@ packages:
|
||||
/v8-compile-cache-lib@3.0.1:
|
||||
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
||||
|
||||
/vali-date@1.0.0:
|
||||
resolution: {integrity: sha512-sgECfZthyaCKW10N0fm27cg8HYTFK5qMWgypqkXMQ4Wbl/zZKx7xZICgcoxIIE+WFAP/MBL2EFwC/YvLxw3Zeg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/validate-npm-package-license@3.0.4:
|
||||
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
|
||||
dependencies:
|
||||
@@ -27193,7 +27209,7 @@ packages:
|
||||
cac: 6.7.14
|
||||
debug: 4.3.6
|
||||
pathe: 1.1.2
|
||||
picocolors: 1.0.0
|
||||
picocolors: 1.0.1
|
||||
vite: 5.2.7(@types/node@20.14.14)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
@@ -27760,7 +27776,7 @@ packages:
|
||||
'@webassemblyjs/wasm-parser': 1.11.5
|
||||
acorn: 8.12.1
|
||||
acorn-import-assertions: 1.9.0(acorn@8.12.1)
|
||||
browserslist: 4.23.0
|
||||
browserslist: 4.23.3
|
||||
chrome-trace-event: 1.0.3
|
||||
enhanced-resolve: 5.15.0
|
||||
es-module-lexer: 1.3.1
|
||||
@@ -27800,7 +27816,7 @@ packages:
|
||||
'@webassemblyjs/wasm-parser': 1.11.5
|
||||
acorn: 8.12.1
|
||||
acorn-import-assertions: 1.9.0(acorn@8.12.1)
|
||||
browserslist: 4.23.0
|
||||
browserslist: 4.23.3
|
||||
chrome-trace-event: 1.0.3
|
||||
enhanced-resolve: 5.15.0
|
||||
es-module-lexer: 1.3.1
|
||||
@@ -28225,7 +28241,7 @@ packages:
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
cliui: 8.0.1
|
||||
escalade: 3.1.1
|
||||
escalade: 3.2.0
|
||||
get-caller-file: 2.0.5
|
||||
require-directory: 2.1.1
|
||||
string-width: 4.2.3
|
||||
|
||||
@@ -1,14 +1,44 @@
|
||||
import { logger, task, wait } from "@trigger.dev/sdk/v3";
|
||||
import { setTimeout } from "timers/promises";
|
||||
|
||||
export const helloWorldTask = task({
|
||||
id: "hello-world",
|
||||
run: async (payload: any, { ctx }) => {
|
||||
logger.log("Hello, world!", { payload, ctx });
|
||||
logger.debug("debug: Hello, world!", { payload });
|
||||
logger.info("info: Hello, world!", { payload });
|
||||
logger.log("log: Hello, world!", { payload });
|
||||
logger.warn("warn: Hello, world!", { payload });
|
||||
logger.error("error: Hello, world!", { payload });
|
||||
|
||||
await wait.for({ seconds: 5 });
|
||||
|
||||
return {
|
||||
message: "Hello, world!",
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export const parentTask = task({
|
||||
id: "parent",
|
||||
run: async (payload: any, { ctx }) => {
|
||||
logger.log("Hello, world from the parent", { payload });
|
||||
await childTask.triggerAndWait({ message: "Hello, world!" });
|
||||
},
|
||||
});
|
||||
|
||||
export const childTask = task({
|
||||
id: "child",
|
||||
run: async (payload: any, { ctx }) => {
|
||||
logger.info("Hello, world from the child", { payload });
|
||||
|
||||
if (Math.random() > 0.5) {
|
||||
throw new Error("Random error at start");
|
||||
}
|
||||
|
||||
await setTimeout(10000);
|
||||
|
||||
if (Math.random() > 0.5) {
|
||||
throw new Error("Random error at end");
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,8 +11,5 @@
|
||||
"lib": ["DOM", "DOM.Iterable"],
|
||||
"noEmit": true
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*.ts",
|
||||
"trigger.config.ts"
|
||||
]
|
||||
"include": ["./src/**/*.ts", "trigger.config.ts"]
|
||||
}
|
||||
|
||||
@@ -13,15 +13,14 @@
|
||||
"build:client": "tsup-node ./src/clientUsage.ts --format esm,cjs",
|
||||
"client": "ts-node -r dotenv/config -r tsconfig-paths/register ./src/clientUsage.ts",
|
||||
"triggerWithLargePayload": "ts-node -r dotenv/config -r tsconfig-paths/register ./src/triggerWithLargePayload.ts",
|
||||
"generate": "prisma generate",
|
||||
"postinstall": "pnpm run generate"
|
||||
"generate:prisma": "prisma generate --sql"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
||||
"@ffprobe-installer/ffprobe": "^2.1.2",
|
||||
"@infisical/sdk": "^2.1.9",
|
||||
"@opentelemetry/api": "1.4.1",
|
||||
"@prisma/client": "5.18.0",
|
||||
"@prisma/client": "5.19.0",
|
||||
"@react-email/components": "0.0.24",
|
||||
"@react-email/render": "1.0.1",
|
||||
"@sentry/esbuild-plugin": "^2.22.2",
|
||||
@@ -34,6 +33,7 @@
|
||||
"dotenv": "^16.4.5",
|
||||
"email-reply-parser": "^1.8.0",
|
||||
"execa": "^8.0.1",
|
||||
"header-generator": "^2.1.55",
|
||||
"kysely": "^0.27.4",
|
||||
"msw": "^2.2.1",
|
||||
"openai": "^4.47.0",
|
||||
@@ -69,7 +69,7 @@
|
||||
"@types/node": "20.4.2",
|
||||
"@types/react": "^18.3.1",
|
||||
"esbuild": "^0.19.11",
|
||||
"prisma": "5.18.0",
|
||||
"prisma": "5.19.0",
|
||||
"prisma-kysely": "^1.8.0",
|
||||
"trigger.dev": "workspace:*",
|
||||
"ts-node": "^10.9.2",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
previewFeatures = ["prismaSchemaFolder"]
|
||||
previewFeatures = ["prismaSchemaFolder", "typedSql"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
SELECT
|
||||
u.id,
|
||||
u.name,
|
||||
COUNT(p.id) as "postCount"
|
||||
FROM
|
||||
"User" u
|
||||
LEFT JOIN "Post" p ON u.id = p."authorId"
|
||||
GROUP BY
|
||||
u.id,
|
||||
u.name;
|
||||
@@ -1,11 +1,9 @@
|
||||
import { tasks, runs, TaskOutput, TaskPayload, TaskIdentifier } from "@trigger.dev/sdk/v3";
|
||||
import { createJsonHeroDoc } from "./trigger/simple";
|
||||
import { TaskOutputHandle } from "@trigger.dev/sdk/v3/shared";
|
||||
import { createJsonHeroDoc } from "./trigger/simple.js";
|
||||
|
||||
type createJsonHeroDocPayload = TaskPayload<typeof createJsonHeroDoc>; // retrieves the payload type of the task
|
||||
type createJsonHeroDocOutput = TaskOutput<typeof createJsonHeroDoc>; // retrieves the output type of the task
|
||||
type createJsonHeroDocIdentifier = TaskIdentifier<typeof createJsonHeroDoc>; // retrieves the identifier of the task
|
||||
type createJsonHeroDocHandle = TaskOutputHandle<typeof createJsonHeroDoc>; // retrieves the handle of the task
|
||||
|
||||
async function main() {
|
||||
const anyHandle = await tasks.trigger(
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { getUsersWithPosts } from "@prisma/client/sql";
|
||||
|
||||
export const prisma = new PrismaClient();
|
||||
|
||||
export { getUsersWithPosts };
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { configure, envvars, runs, schedules, ApiError } from "@trigger.dev/sdk/v3";
|
||||
import { configure, envvars, runs, schedules } from "@trigger.dev/sdk/v3";
|
||||
import dotenv from "dotenv";
|
||||
import { createReadStream } from "node:fs";
|
||||
import { firstScheduledTask } from "./trigger/scheduled";
|
||||
import { simpleChildTask } from "./trigger/subtasks";
|
||||
import { taskThatErrors } from "./trigger/retries";
|
||||
import { unfriendlyIdTask } from "./trigger/other";
|
||||
import { spamRateLimiter } from "./trigger/retries";
|
||||
import { unfriendlyIdTask } from "./trigger/other.js";
|
||||
import { spamRateLimiter, taskThatErrors } from "./trigger/retries.js";
|
||||
import { firstScheduledTask } from "./trigger/scheduled.js";
|
||||
import { simpleChildTask } from "./trigger/subtasks.js";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import dotenv from "dotenv";
|
||||
import { simpleChildTask } from "./trigger/subtasks";
|
||||
import { wait } from "@trigger.dev/sdk/v3";
|
||||
import { setTimeout } from "timers/promises";
|
||||
import { simpleChildTask } from "./trigger/subtasks.js";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { prisma } from "@/db.js";
|
||||
import { task } from "@trigger.dev/sdk/v3";
|
||||
import { getUsersWithPosts, prisma } from "@/db.js";
|
||||
import { logger, task } from "@trigger.dev/sdk/v3";
|
||||
|
||||
export const prismaTask = task({
|
||||
id: "prisma-task",
|
||||
@@ -12,6 +12,10 @@ export const prismaTask = task({
|
||||
},
|
||||
});
|
||||
|
||||
const usersWithPosts = await prisma.$queryRawTyped(getUsersWithPosts());
|
||||
|
||||
logger.info("Users with posts", { usersWithPosts });
|
||||
|
||||
return users;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { logger, retry, runs, task, wait } from "@trigger.dev/sdk/v3";
|
||||
import { cache } from "./utils/cache.js";
|
||||
import { interceptor } from "./utils/interceptor.js";
|
||||
import { join } from "node:path";
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
|
||||
@@ -65,9 +64,6 @@ function initializeConnection() {
|
||||
|
||||
export const taskWithFetchRetries = task({
|
||||
id: "task-with-fetch-retries",
|
||||
middleware: (payload: any, { next }) => {
|
||||
return interceptor.run(next);
|
||||
},
|
||||
run: async (payload: any, { ctx }) => {
|
||||
logger.info("Fetching data", { foo: [1, 2, 3], bar: [{ hello: "world" }] });
|
||||
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
import "server-only";
|
||||
import { logger, task, tasks, wait } from "@trigger.dev/sdk/v3";
|
||||
import { traceAsync } from "@/telemetry.js";
|
||||
import { HeaderGenerator } from "header-generator";
|
||||
|
||||
let headerGenerator = new HeaderGenerator({
|
||||
browsers: [{ name: "firefox", minVersion: 90 }, { name: "chrome", minVersion: 110 }, "safari"],
|
||||
devices: ["desktop"],
|
||||
operatingSystems: ["windows"],
|
||||
});
|
||||
|
||||
export const fetchPostTask = task({
|
||||
id: "fetch-post-task",
|
||||
run: async (payload: { url: string }) => {
|
||||
const headers = headerGenerator.getHeaders({
|
||||
operatingSystems: ["linux"],
|
||||
locales: ["en-US", "en"],
|
||||
});
|
||||
|
||||
logger.log("fetch-post-task", { headers });
|
||||
|
||||
const response = await fetch(payload.url, {
|
||||
method: "GET",
|
||||
headers,
|
||||
});
|
||||
|
||||
return response.json() as Promise<{ url: string; method: string }>;
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
import { retry } from "@trigger.dev/sdk/v3";
|
||||
import { HttpResponse, delay, http } from "msw";
|
||||
|
||||
export const interceptor = retry.interceptFetch(
|
||||
http.get("http://my.host/test-headers", ({ request }) => {
|
||||
const retryCount = request.headers.get("x-retry-count");
|
||||
|
||||
if (retryCount === "1") {
|
||||
return new HttpResponse(null, {
|
||||
status: 429,
|
||||
headers: {
|
||||
"x-ratelimit-limit": "100",
|
||||
"x-ratelimit-remaining": "0",
|
||||
"x-ratelimit-reset": String(Date.now() + 1000 * 10), // 10 seconds
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return HttpResponse.json({ test: "headers" });
|
||||
}),
|
||||
http.get("http://my.host/test-backoff", ({ request }) => {
|
||||
const retryCount = request.headers.get("x-retry-count");
|
||||
|
||||
if (retryCount === "4") {
|
||||
return HttpResponse.json({ test: "backoff" });
|
||||
}
|
||||
|
||||
return new HttpResponse(null, {
|
||||
status: 500,
|
||||
});
|
||||
}),
|
||||
http.get("http://my.host/test-connection-errors", ({ request }) => {
|
||||
const retryCount = request.headers.get("x-retry-count");
|
||||
|
||||
if (retryCount === "2") {
|
||||
return HttpResponse.json({ test: "connection-errors" });
|
||||
}
|
||||
|
||||
return HttpResponse.error();
|
||||
})
|
||||
);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user