From 55aa89b4e2b069daed1b2dcf859de871b14134f5 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Tue, 2 Jun 2026 19:58:29 +0200 Subject: [PATCH 1/2] Align Biome formatting configuration --- biome.json | 13 +++------ package.json | 2 +- yarn.lock | 76 ++++++++++++++++++++++++++-------------------------- 3 files changed, 43 insertions(+), 48 deletions(-) diff --git a/biome.json b/biome.json index 082bf3d1..32d1a948 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.4.15/schema.json", + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, "files": { "ignoreUnknown": false, @@ -25,12 +25,7 @@ "indentWidth": 2, "lineEnding": "lf", "lineWidth": 100, - "attributePosition": "auto", - "bracketSameLine": false, - "bracketSpacing": true, - "expand": "auto", - "useEditorconfig": true, - "includes": ["**", "!**/package.json", "!**/lib/", "!**/node_modules/"] + "attributePosition": "auto" }, "linter": { "enabled": true, @@ -88,10 +83,10 @@ "trailingCommas": "all", "semicolons": "asNeeded", "arrowParentheses": "always", + "bracketSpacing": true, "bracketSameLine": false, "quoteStyle": "single", - "attributePosition": "auto", - "bracketSpacing": true + "attributePosition": "auto" } }, "assist": { diff --git a/package.json b/package.json index 7d787b19..ff955b0a 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "tsc:zod": "yarn workspace @transloadit/zod sync && node ./node_modules/typescript/bin/tsc -b packages/zod/tsconfig.build.json" }, "devDependencies": { - "@biomejs/biome": "^2.4.15", + "@biomejs/biome": "2.4.16", "@changesets/cli": "^2.31.0", "@types/node": "^25.8.0", "@vitest/coverage-v8": "^4.1.6", diff --git a/yarn.lock b/yarn.lock index b883c4c6..2c62a62d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -54,18 +54,18 @@ __metadata: languageName: node linkType: hard -"@biomejs/biome@npm:^2.4.15": - version: 2.4.15 - resolution: "@biomejs/biome@npm:2.4.15" - dependencies: - "@biomejs/cli-darwin-arm64": "npm:2.4.15" - "@biomejs/cli-darwin-x64": "npm:2.4.15" - "@biomejs/cli-linux-arm64": "npm:2.4.15" - "@biomejs/cli-linux-arm64-musl": "npm:2.4.15" - "@biomejs/cli-linux-x64": "npm:2.4.15" - "@biomejs/cli-linux-x64-musl": "npm:2.4.15" - "@biomejs/cli-win32-arm64": "npm:2.4.15" - "@biomejs/cli-win32-x64": "npm:2.4.15" +"@biomejs/biome@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/biome@npm:2.4.16" + dependencies: + "@biomejs/cli-darwin-arm64": "npm:2.4.16" + "@biomejs/cli-darwin-x64": "npm:2.4.16" + "@biomejs/cli-linux-arm64": "npm:2.4.16" + "@biomejs/cli-linux-arm64-musl": "npm:2.4.16" + "@biomejs/cli-linux-x64": "npm:2.4.16" + "@biomejs/cli-linux-x64-musl": "npm:2.4.16" + "@biomejs/cli-win32-arm64": "npm:2.4.16" + "@biomejs/cli-win32-x64": "npm:2.4.16" dependenciesMeta: "@biomejs/cli-darwin-arm64": optional: true @@ -85,62 +85,62 @@ __metadata: optional: true bin: biome: bin/biome - checksum: 10c0/46ac114b97f00e5fe0d22590337c80c7a2467d2aabf57d7f99b92356fd01cf76bb7d972782508e0f51c34e08a1a7f8e9eefec6fe72aa7b5f53b9161b7fe582e2 + checksum: 10c0/c52c4309daf241888b43912a43d1ba8bae7c2160751c33900088517da3e47d1428bb1c1f64f657efa5f42f5866e6400325b39fc41c3adf7cc7aa3f237f6fa286 languageName: node linkType: hard -"@biomejs/cli-darwin-arm64@npm:2.4.15": - version: 2.4.15 - resolution: "@biomejs/cli-darwin-arm64@npm:2.4.15" +"@biomejs/cli-darwin-arm64@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/cli-darwin-arm64@npm:2.4.16" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@biomejs/cli-darwin-x64@npm:2.4.15": - version: 2.4.15 - resolution: "@biomejs/cli-darwin-x64@npm:2.4.15" +"@biomejs/cli-darwin-x64@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/cli-darwin-x64@npm:2.4.16" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@biomejs/cli-linux-arm64-musl@npm:2.4.15": - version: 2.4.15 - resolution: "@biomejs/cli-linux-arm64-musl@npm:2.4.15" +"@biomejs/cli-linux-arm64-musl@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/cli-linux-arm64-musl@npm:2.4.16" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@biomejs/cli-linux-arm64@npm:2.4.15": - version: 2.4.15 - resolution: "@biomejs/cli-linux-arm64@npm:2.4.15" +"@biomejs/cli-linux-arm64@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/cli-linux-arm64@npm:2.4.16" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@biomejs/cli-linux-x64-musl@npm:2.4.15": - version: 2.4.15 - resolution: "@biomejs/cli-linux-x64-musl@npm:2.4.15" +"@biomejs/cli-linux-x64-musl@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/cli-linux-x64-musl@npm:2.4.16" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@biomejs/cli-linux-x64@npm:2.4.15": - version: 2.4.15 - resolution: "@biomejs/cli-linux-x64@npm:2.4.15" +"@biomejs/cli-linux-x64@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/cli-linux-x64@npm:2.4.16" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@biomejs/cli-win32-arm64@npm:2.4.15": - version: 2.4.15 - resolution: "@biomejs/cli-win32-arm64@npm:2.4.15" +"@biomejs/cli-win32-arm64@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/cli-win32-arm64@npm:2.4.16" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@biomejs/cli-win32-x64@npm:2.4.15": - version: 2.4.15 - resolution: "@biomejs/cli-win32-x64@npm:2.4.15" +"@biomejs/cli-win32-x64@npm:2.4.16": + version: 2.4.16 + resolution: "@biomejs/cli-win32-x64@npm:2.4.16" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -5522,7 +5522,7 @@ __metadata: version: 0.0.0-use.local resolution: "transloadit-node-sdk@workspace:." dependencies: - "@biomejs/biome": "npm:^2.4.15" + "@biomejs/biome": "npm:2.4.16" "@changesets/cli": "npm:^2.31.0" "@types/node": "npm:^25.8.0" "@vitest/coverage-v8": "npm:^4.1.6" From 1253cb817919718d24f9d411c63518f167ab1603 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Tue, 2 Jun 2026 20:29:44 +0200 Subject: [PATCH 2/2] Apply shared Biome import ordering --- biome.json | 81 +++++++++++++++++-- packages/mcp-server/src/cli.ts | 2 + packages/mcp-server/src/express.ts | 4 +- packages/mcp-server/src/http-helpers.ts | 3 +- .../mcp-server/src/http-request-handler.ts | 2 + packages/mcp-server/src/http.ts | 8 +- packages/mcp-server/src/index.ts | 5 +- packages/mcp-server/src/server-card.ts | 1 + packages/mcp-server/src/server.ts | 4 +- .../mcp-server/test/e2e/base64-limit.test.ts | 2 + .../mcp-server/test/e2e/bearer-auth.test.ts | 2 + .../e2e/builtin-template-not-found.test.ts | 2 + .../test/e2e/builtin-templates.test.ts | 2 + .../test/e2e/concurrent-sessions.test.ts | 1 + .../test/e2e/create-assembly.test.ts | 2 + packages/mcp-server/test/e2e/http-server.ts | 5 +- .../mcp-server/test/e2e/lint-assembly.test.ts | 2 + .../test/e2e/list-templates.test.ts | 2 + packages/mcp-server/test/e2e/mcp-client.ts | 1 + packages/mcp-server/test/e2e/metrics.test.ts | 1 + .../test/e2e/non-sticky-routing.test.ts | 5 +- .../test/e2e/resume-assembly.test.ts | 2 + packages/mcp-server/test/e2e/robots.test.ts | 2 + .../mcp-server/test/e2e/server-card.test.ts | 1 + packages/mcp-server/test/e2e/stdio.test.ts | 2 + .../test/e2e/streamable-http-auth.test.ts | 1 + .../test/e2e/streamable-http.test.ts | 1 + .../test/e2e/template-inputs.test.ts | 2 + .../mcp-server/test/e2e/url-import.test.ts | 2 + .../mcp-server/test/e2e/wait-assembly.test.ts | 2 + .../mcp-server/test/unit/http-handler.test.ts | 1 + packages/mcp-server/test/unit/robots.test.ts | 2 + .../test/unit/server-card-express.test.ts | 5 +- packages/node/examples/credentials.ts | 1 + .../node/examples/face_detect_download.ts | 1 + packages/node/examples/template_api.ts | 1 + packages/node/src/ApiError.ts | 1 + packages/node/src/PaginationStream.ts | 3 +- packages/node/src/Transloadit.ts | 79 +++++++++--------- packages/node/src/apiTypes.ts | 3 +- packages/node/src/cli.ts | 1 + packages/node/src/cli/commands/BaseCommand.ts | 4 +- packages/node/src/cli/commands/assemblies.ts | 20 +++-- packages/node/src/cli/commands/auth.ts | 12 ++- packages/node/src/cli/commands/bills.ts | 6 +- packages/node/src/cli/commands/docs.ts | 1 + .../node/src/cli/commands/notifications.ts | 6 +- packages/node/src/cli/commands/templates.ts | 11 ++- packages/node/src/cli/commands/upload.ts | 7 +- packages/node/src/cli/generateIntentDocs.ts | 8 +- packages/node/src/cli/helpers.ts | 5 +- packages/node/src/cli/intentCommandSpecs.ts | 1 + packages/node/src/cli/intentCommands.ts | 18 +++-- packages/node/src/cli/intentFields.ts | 3 +- packages/node/src/cli/intentRuntime.ts | 13 +-- packages/node/src/cli/resultUrls.ts | 1 + .../src/cli/semanticIntents/imageDescribe.ts | 3 +- .../src/cli/semanticIntents/imageGenerate.ts | 4 +- .../node/src/cli/semanticIntents/index.ts | 1 + .../src/cli/semanticIntents/markdownPdf.ts | 1 + .../cli/semanticIntents/speechTranscribe.ts | 1 + packages/node/src/cli/stepsInput.ts | 3 +- .../node/src/cli/template-last-modified.ts | 1 + packages/node/src/cli/types.ts | 4 +- packages/node/src/inputFiles.ts | 15 ++-- packages/node/src/lintAssemblyInput.ts | 5 +- packages/node/src/lintAssemblyInstructions.ts | 5 +- packages/node/src/robots.ts | 1 + packages/node/src/tus.ts | 12 ++- packages/node/test/e2e/cli/OutputCtl.ts | 1 + .../test/e2e/cli/assemblies-create.test.ts | 5 +- .../node/test/e2e/cli/assemblies-list.test.ts | 4 +- packages/node/test/e2e/cli/assemblies.test.ts | 5 +- packages/node/test/e2e/cli/bills.test.ts | 4 +- packages/node/test/e2e/cli/cli.test.ts | 1 + packages/node/test/e2e/cli/templates.test.ts | 7 +- packages/node/test/e2e/cli/test-utils.ts | 2 + packages/node/test/e2e/cli/upload.test.ts | 2 + packages/node/test/e2e/live-api.test.ts | 22 ++--- .../node/test/e2e/resume-assembly.test.ts | 5 +- packages/node/test/generate-coverage-badge.ts | 1 + packages/node/test/test-env.ts | 1 + packages/node/test/testserver.ts | 6 +- packages/node/test/tunnel.ts | 4 +- .../test/unit/assembly-status-helpers.test.ts | 3 +- .../test/unit/cli/assemblies-create.test.ts | 1 + .../node/test/unit/cli/auth-token.test.ts | 2 + .../unit/cli/credentials-resolution.test.ts | 2 + .../node/test/unit/cli/intent-docs.test.ts | 1 + packages/node/test/unit/cli/intents.test.ts | 1 + .../node/test/unit/cli/templates-list.test.ts | 1 + packages/node/test/unit/cli/test-cli.test.ts | 2 + .../test/unit/ensure-unique-counter.test.ts | 1 + packages/node/test/unit/input-files.test.ts | 2 + packages/node/test/unit/lint-assembly.test.ts | 1 + .../node/test/unit/mint-bearer-token.test.ts | 1 + packages/node/test/unit/mock-http.test.ts | 5 +- .../node/test/unit/resume-assembly.test.ts | 5 +- packages/node/test/unit/robots.test.ts | 1 + .../test/unit/test-transloadit-client.test.ts | 2 + .../test/unit/transloadit-advanced.test.ts | 3 +- packages/node/test/unit/tus.test.ts | 6 +- packages/node/test/util.ts | 1 + packages/node/vitest.config.ts | 1 + packages/notify-url-relay/src/cli.ts | 9 ++- packages/notify-url-relay/src/index.ts | 10 ++- packages/notify-url-relay/test/chaos.test.ts | 4 +- packages/notify-url-relay/test/helpers.ts | 5 +- .../notify-url-relay/test/real.e2e.test.ts | 1 + packages/notify-url-relay/vitest.config.ts | 1 + packages/types/scripts/emit-types.ts | 1 + packages/utils/src/node.ts | 4 +- .../zod/test/patch-ai-chat-schema.test.ts | 1 + packages/zod/test/type-equality-v3.ts | 1 + packages/zod/test/type-equality-v4.ts | 1 + scripts/prepare-transloadit.ts | 1 + 116 files changed, 425 insertions(+), 148 deletions(-) diff --git a/biome.json b/biome.json index 32d1a948..21460c51 100644 --- a/biome.json +++ b/biome.json @@ -1,6 +1,10 @@ { "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", - "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, "files": { "ignoreUnknown": false, "includes": [ @@ -91,25 +95,88 @@ }, "assist": { "enabled": true, - "actions": { "source": { "organizeImports": "on" } } + "actions": { + "source": { + "organizeImports": { + "level": "on", + "options": { + "groups": [ + { + "type": true, + "source": [":NODE:"] + }, + ":BLANK_LINE:", + { + "type": true, + "source": [":PACKAGE:"] + }, + ":BLANK_LINE:", + { + "type": true, + "source": [":ALIAS:", ":/**", "\\{*\\}/**"] + }, + ":BLANK_LINE:", + { + "type": true, + "source": [":PATH:"] + }, + ":BLANK_LINE:", + { + "type": false, + "source": [":NODE:"] + }, + ":BLANK_LINE:", + { + "type": false, + "source": [":PACKAGE:"] + }, + ":BLANK_LINE:", + { + "type": false, + "source": [":ALIAS:", ":/**", "\\{*\\}/**"] + }, + ":BLANK_LINE:", + { + "type": false, + "source": [":PATH:"] + } + ] + } + } + } + } }, "overrides": [ { "includes": ["**/package.json"], - "formatter": { "expand": "always" } + "formatter": { + "expand": "always" + } }, { "includes": ["docs/fingerprint/*.package.json"], - "formatter": { "expand": "always" } + "formatter": { + "expand": "always" + } }, { "includes": ["*.html"], - "javascript": { "formatter": { "quoteStyle": "double" } } + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } }, { "includes": ["*.scss", "*.css"], - "javascript": { "formatter": { "quoteStyle": "double" } }, - "formatter": { "lineWidth": 80 } + "javascript": { + "formatter": { + "quoteStyle": "double" + } + }, + "formatter": { + "lineWidth": 80 + } } ] } diff --git a/packages/mcp-server/src/cli.ts b/packages/mcp-server/src/cli.ts index 206c537b..2352ac0e 100644 --- a/packages/mcp-server/src/cli.ts +++ b/packages/mcp-server/src/cli.ts @@ -2,7 +2,9 @@ import { readFile } from 'node:fs/promises' import { createServer } from 'node:http' + import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js' + import { createTransloaditMcpHttpHandler, createTransloaditMcpServer } from './index.ts' import { buildRedactor, getLogger } from './logger.ts' diff --git a/packages/mcp-server/src/express.ts b/packages/mcp-server/src/express.ts index 46443c7e..b53d90af 100644 --- a/packages/mcp-server/src/express.ts +++ b/packages/mcp-server/src/express.ts @@ -1,6 +1,8 @@ +import type { TransloaditMcpHttpOptions } from './http.ts' + import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js' import express from 'express' -import type { TransloaditMcpHttpOptions } from './http.ts' + import { isBasicAuthorized } from './http-helpers.ts' import { getMetrics, getMetricsContentType } from './metrics.ts' import { createTransloaditMcpServer } from './server.ts' diff --git a/packages/mcp-server/src/http-helpers.ts b/packages/mcp-server/src/http-helpers.ts index 89b83810..6c3f62dc 100644 --- a/packages/mcp-server/src/http-helpers.ts +++ b/packages/mcp-server/src/http-helpers.ts @@ -1,6 +1,7 @@ -import { timingSafeEqual } from 'node:crypto' import type { IncomingMessage, ServerResponse } from 'node:http' +import { timingSafeEqual } from 'node:crypto' + export const parsePathname = (url: string | undefined, fallback: string): string => { try { return new URL(url ?? fallback, 'http://localhost').pathname diff --git a/packages/mcp-server/src/http-request-handler.ts b/packages/mcp-server/src/http-request-handler.ts index 49eddffa..793d28f6 100644 --- a/packages/mcp-server/src/http-request-handler.ts +++ b/packages/mcp-server/src/http-request-handler.ts @@ -1,6 +1,8 @@ import type { IncomingMessage, ServerResponse } from 'node:http' + import type { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js' import type { SevLogger } from '@transloadit/sev-logger' + import { applyCorsHeaders, isAuthorized, normalizePath, parsePathname } from './http-helpers.ts' import { buildRedactor, getLogger } from './logger.ts' diff --git a/packages/mcp-server/src/http.ts b/packages/mcp-server/src/http.ts index e4054d86..e3f551bd 100644 --- a/packages/mcp-server/src/http.ts +++ b/packages/mcp-server/src/http.ts @@ -1,6 +1,11 @@ import type { IncomingMessage, ServerResponse } from 'node:http' -import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js' + import type { SevLogger } from '@transloadit/sev-logger' + +import type { TransloaditMcpServerOptions } from './server.ts' + +import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js' + import { applyCorsHeaders, isAuthorized, @@ -9,7 +14,6 @@ import { parsePathname, } from './http-helpers.ts' import { getMetrics, getMetricsContentType } from './metrics.ts' -import type { TransloaditMcpServerOptions } from './server.ts' import { createTransloaditMcpServer } from './server.ts' import { buildServerCard, serverCardPath } from './server-card.ts' diff --git a/packages/mcp-server/src/index.ts b/packages/mcp-server/src/index.ts index e4448564..3e84e317 100644 --- a/packages/mcp-server/src/index.ts +++ b/packages/mcp-server/src/index.ts @@ -1,6 +1,7 @@ export type { TransloaditMcpExpressOptions } from './express.ts' -export { createTransloaditMcpExpressRouter } from './express.ts' export type { TransloaditMcpHttpHandler, TransloaditMcpHttpOptions } from './http.ts' -export { createTransloaditMcpHttpHandler } from './http.ts' export type { TransloaditMcpServerOptions } from './server.ts' + +export { createTransloaditMcpExpressRouter } from './express.ts' +export { createTransloaditMcpHttpHandler } from './http.ts' export { createTransloaditMcpServer } from './server.ts' diff --git a/packages/mcp-server/src/server-card.ts b/packages/mcp-server/src/server-card.ts index d29acf29..56b846d1 100644 --- a/packages/mcp-server/src/server-card.ts +++ b/packages/mcp-server/src/server-card.ts @@ -1,4 +1,5 @@ import { LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/sdk/types.js' + import packageJson from '../package.json' with { type: 'json' } export const serverCardPath = '/.well-known/mcp/server-card.json' diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index 3fa55f1e..32140b70 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -1,10 +1,11 @@ -import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' import type { CallToolResult, TextContent } from '@modelcontextprotocol/sdk/types.js' import type { AssemblyInstructionsInput, CreateAssemblyParams, LintAssemblyInstructionsResult, } from '@transloadit/node' + +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' import { ApiError, extractFieldNamesFromTemplate, @@ -16,6 +17,7 @@ import { Transloadit, } from '@transloadit/node' import { z } from 'zod' + import packageJson from '../package.json' with { type: 'json' } import { extractBearerToken } from './http-helpers.ts' diff --git a/packages/mcp-server/test/e2e/base64-limit.test.ts b/packages/mcp-server/test/e2e/base64-limit.test.ts index 21ed24a0..601cf5ee 100644 --- a/packages/mcp-server/test/e2e/base64-limit.test.ts +++ b/packages/mcp-server/test/e2e/base64-limit.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, parseToolPayload } from './mcp-client.ts' const shouldRun = process.env.TRANSLOADIT_KEY != null && process.env.TRANSLOADIT_SECRET != null diff --git a/packages/mcp-server/test/e2e/bearer-auth.test.ts b/packages/mcp-server/test/e2e/bearer-auth.test.ts index 8fb0970d..623fa74a 100644 --- a/packages/mcp-server/test/e2e/bearer-auth.test.ts +++ b/packages/mcp-server/test/e2e/bearer-auth.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createHttpClient, startHttpServer } from './http-server.ts' import { parseToolPayload } from './mcp-client.ts' diff --git a/packages/mcp-server/test/e2e/builtin-template-not-found.test.ts b/packages/mcp-server/test/e2e/builtin-template-not-found.test.ts index 0a6396cf..ac2676f4 100644 --- a/packages/mcp-server/test/e2e/builtin-template-not-found.test.ts +++ b/packages/mcp-server/test/e2e/builtin-template-not-found.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, parseToolPayload } from './mcp-client.ts' const shouldRun = process.env.TRANSLOADIT_KEY != null && process.env.TRANSLOADIT_SECRET != null diff --git a/packages/mcp-server/test/e2e/builtin-templates.test.ts b/packages/mcp-server/test/e2e/builtin-templates.test.ts index f59b1baf..9e0922e3 100644 --- a/packages/mcp-server/test/e2e/builtin-templates.test.ts +++ b/packages/mcp-server/test/e2e/builtin-templates.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' const shouldRun = process.env.TRANSLOADIT_KEY != null && process.env.TRANSLOADIT_SECRET != null diff --git a/packages/mcp-server/test/e2e/concurrent-sessions.test.ts b/packages/mcp-server/test/e2e/concurrent-sessions.test.ts index 7e7b37ee..5756fcc1 100644 --- a/packages/mcp-server/test/e2e/concurrent-sessions.test.ts +++ b/packages/mcp-server/test/e2e/concurrent-sessions.test.ts @@ -1,4 +1,5 @@ import { expect, test } from 'vitest' + import { createHttpClient, startHttpServer } from './http-server.ts' import { parseToolPayload } from './mcp-client.ts' diff --git a/packages/mcp-server/test/e2e/create-assembly.test.ts b/packages/mcp-server/test/e2e/create-assembly.test.ts index b6db3e78..bdf7c809 100644 --- a/packages/mcp-server/test/e2e/create-assembly.test.ts +++ b/packages/mcp-server/test/e2e/create-assembly.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' const shouldRun = process.env.TRANSLOADIT_KEY != null && process.env.TRANSLOADIT_SECRET != null diff --git a/packages/mcp-server/test/e2e/http-server.ts b/packages/mcp-server/test/e2e/http-server.ts index 777a8131..ce68fd7b 100644 --- a/packages/mcp-server/test/e2e/http-server.ts +++ b/packages/mcp-server/test/e2e/http-server.ts @@ -1,7 +1,10 @@ -import { createServer } from 'node:http' import type { AddressInfo } from 'node:net' + +import { createServer } from 'node:http' + import { Client } from '@modelcontextprotocol/sdk/client' import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js' + import { createTransloaditMcpHttpHandler } from '../../src/index.ts' type HeadersInit = Record diff --git a/packages/mcp-server/test/e2e/lint-assembly.test.ts b/packages/mcp-server/test/e2e/lint-assembly.test.ts index 0b8d3c18..5a761337 100644 --- a/packages/mcp-server/test/e2e/lint-assembly.test.ts +++ b/packages/mcp-server/test/e2e/lint-assembly.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { lintAssemblyInstructions } from '../../../node/src/lintAssemblyInstructions.ts' import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' diff --git a/packages/mcp-server/test/e2e/list-templates.test.ts b/packages/mcp-server/test/e2e/list-templates.test.ts index 1aeaddc6..ec513f5e 100644 --- a/packages/mcp-server/test/e2e/list-templates.test.ts +++ b/packages/mcp-server/test/e2e/list-templates.test.ts @@ -1,6 +1,8 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { Transloadit } from '@transloadit/node' import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' const authKey = process.env.TRANSLOADIT_KEY diff --git a/packages/mcp-server/test/e2e/mcp-client.ts b/packages/mcp-server/test/e2e/mcp-client.ts index a1e1ddcb..77795820 100644 --- a/packages/mcp-server/test/e2e/mcp-client.ts +++ b/packages/mcp-server/test/e2e/mcp-client.ts @@ -1,4 +1,5 @@ import { fileURLToPath } from 'node:url' + import { Client } from '@modelcontextprotocol/sdk/client' import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js' diff --git a/packages/mcp-server/test/e2e/metrics.test.ts b/packages/mcp-server/test/e2e/metrics.test.ts index 3bc8cc6b..aca5f15d 100644 --- a/packages/mcp-server/test/e2e/metrics.test.ts +++ b/packages/mcp-server/test/e2e/metrics.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' + import { startHttpServer } from './http-server.ts' describe('metrics', () => { diff --git a/packages/mcp-server/test/e2e/non-sticky-routing.test.ts b/packages/mcp-server/test/e2e/non-sticky-routing.test.ts index f29829cd..f97a8b78 100644 --- a/packages/mcp-server/test/e2e/non-sticky-routing.test.ts +++ b/packages/mcp-server/test/e2e/non-sticky-routing.test.ts @@ -1,6 +1,9 @@ -import { createServer, request as httpRequest } from 'node:http' import type { AddressInfo } from 'node:net' + +import { createServer, request as httpRequest } from 'node:http' + import { expect, test } from 'vitest' + import { createHttpClient, startHttpServer } from './http-server.ts' import { parseToolPayload } from './mcp-client.ts' diff --git a/packages/mcp-server/test/e2e/resume-assembly.test.ts b/packages/mcp-server/test/e2e/resume-assembly.test.ts index 85d0553b..e6533ea6 100644 --- a/packages/mcp-server/test/e2e/resume-assembly.test.ts +++ b/packages/mcp-server/test/e2e/resume-assembly.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' const shouldRun = process.env.TRANSLOADIT_KEY != null && process.env.TRANSLOADIT_SECRET != null diff --git a/packages/mcp-server/test/e2e/robots.test.ts b/packages/mcp-server/test/e2e/robots.test.ts index 695a4b07..fece27ed 100644 --- a/packages/mcp-server/test/e2e/robots.test.ts +++ b/packages/mcp-server/test/e2e/robots.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' describe('mcp-server robots (stdio)', { timeout: 20000 }, () => { diff --git a/packages/mcp-server/test/e2e/server-card.test.ts b/packages/mcp-server/test/e2e/server-card.test.ts index 49e67b52..5294260e 100644 --- a/packages/mcp-server/test/e2e/server-card.test.ts +++ b/packages/mcp-server/test/e2e/server-card.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' + import { startHttpServer } from './http-server.ts' describe('server card', () => { diff --git a/packages/mcp-server/test/e2e/stdio.test.ts b/packages/mcp-server/test/e2e/stdio.test.ts index 892a560d..b2ded9bc 100644 --- a/packages/mcp-server/test/e2e/stdio.test.ts +++ b/packages/mcp-server/test/e2e/stdio.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, parseToolPayload } from './mcp-client.ts' describe('mcp-server stdio', { timeout: 20000 }, () => { diff --git a/packages/mcp-server/test/e2e/streamable-http-auth.test.ts b/packages/mcp-server/test/e2e/streamable-http-auth.test.ts index a5a16584..d1af5943 100644 --- a/packages/mcp-server/test/e2e/streamable-http-auth.test.ts +++ b/packages/mcp-server/test/e2e/streamable-http-auth.test.ts @@ -1,4 +1,5 @@ import { expect, test } from 'vitest' + import { createHttpClient, startHttpServer } from './http-server.ts' import { parseToolPayload } from './mcp-client.ts' diff --git a/packages/mcp-server/test/e2e/streamable-http.test.ts b/packages/mcp-server/test/e2e/streamable-http.test.ts index d07d5170..70855217 100644 --- a/packages/mcp-server/test/e2e/streamable-http.test.ts +++ b/packages/mcp-server/test/e2e/streamable-http.test.ts @@ -1,4 +1,5 @@ import { expect, test } from 'vitest' + import { createHttpClient, startHttpServer } from './http-server.ts' import { parseToolPayload } from './mcp-client.ts' diff --git a/packages/mcp-server/test/e2e/template-inputs.test.ts b/packages/mcp-server/test/e2e/template-inputs.test.ts index 7b3adec2..7d46f53a 100644 --- a/packages/mcp-server/test/e2e/template-inputs.test.ts +++ b/packages/mcp-server/test/e2e/template-inputs.test.ts @@ -1,6 +1,8 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { Transloadit } from '@transloadit/node' import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' const authKey = process.env.TRANSLOADIT_KEY diff --git a/packages/mcp-server/test/e2e/url-import.test.ts b/packages/mcp-server/test/e2e/url-import.test.ts index 38042e06..3fd00b58 100644 --- a/packages/mcp-server/test/e2e/url-import.test.ts +++ b/packages/mcp-server/test/e2e/url-import.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' const shouldRun = process.env.TRANSLOADIT_KEY != null && process.env.TRANSLOADIT_SECRET != null diff --git a/packages/mcp-server/test/e2e/wait-assembly.test.ts b/packages/mcp-server/test/e2e/wait-assembly.test.ts index 309a36c6..10693674 100644 --- a/packages/mcp-server/test/e2e/wait-assembly.test.ts +++ b/packages/mcp-server/test/e2e/wait-assembly.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from './mcp-client.ts' const shouldRun = process.env.TRANSLOADIT_KEY != null && process.env.TRANSLOADIT_SECRET != null diff --git a/packages/mcp-server/test/unit/http-handler.test.ts b/packages/mcp-server/test/unit/http-handler.test.ts index bf828f0a..da945d47 100644 --- a/packages/mcp-server/test/unit/http-handler.test.ts +++ b/packages/mcp-server/test/unit/http-handler.test.ts @@ -1,5 +1,6 @@ import { once } from 'node:events' import { createServer, request as httpRequest } from 'node:http' + import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest' const transportInstances: MockTransport[] = [] diff --git a/packages/mcp-server/test/unit/robots.test.ts b/packages/mcp-server/test/unit/robots.test.ts index 26077f32..99f8b545 100644 --- a/packages/mcp-server/test/unit/robots.test.ts +++ b/packages/mcp-server/test/unit/robots.test.ts @@ -1,5 +1,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' + import { createMcpClient, isRecord, parseToolPayload } from '../e2e/mcp-client.ts' describe('mcp-server robots (unit)', { timeout: 20000 }, () => { diff --git a/packages/mcp-server/test/unit/server-card-express.test.ts b/packages/mcp-server/test/unit/server-card-express.test.ts index c91bf9ae..85be3d42 100644 --- a/packages/mcp-server/test/unit/server-card-express.test.ts +++ b/packages/mcp-server/test/unit/server-card-express.test.ts @@ -1,7 +1,10 @@ -import { createServer } from 'node:http' import type { AddressInfo } from 'node:net' + +import { createServer } from 'node:http' + import express from 'express' import { afterEach, describe, expect, it } from 'vitest' + import { createTransloaditMcpExpressRouter } from '../../src/express.ts' type RunningServer = { close: () => Promise; baseUrl: URL } diff --git a/packages/node/examples/credentials.ts b/packages/node/examples/credentials.ts index 6f8dc5a0..86c09bb8 100644 --- a/packages/node/examples/credentials.ts +++ b/packages/node/examples/credentials.ts @@ -7,6 +7,7 @@ // yarn prepack // import type { CreateTemplateCredentialParams } from 'transloadit' + import { Transloadit } from 'transloadit' const { TRANSLOADIT_KEY, TRANSLOADIT_SECRET } = process.env diff --git a/packages/node/examples/face_detect_download.ts b/packages/node/examples/face_detect_download.ts index 04ad68a2..6d720f9e 100644 --- a/packages/node/examples/face_detect_download.ts +++ b/packages/node/examples/face_detect_download.ts @@ -12,6 +12,7 @@ import assert from 'node:assert' import { createWriteStream } from 'node:fs' + import got from 'got' import { Transloadit } from 'transloadit' diff --git a/packages/node/examples/template_api.ts b/packages/node/examples/template_api.ts index fd17e7c7..95f25b3e 100644 --- a/packages/node/examples/template_api.ts +++ b/packages/node/examples/template_api.ts @@ -7,6 +7,7 @@ // yarn prepack // import type { TemplateContent } from 'transloadit' + import { Transloadit } from 'transloadit' const { TRANSLOADIT_KEY, TRANSLOADIT_SECRET } = process.env diff --git a/packages/node/src/ApiError.ts b/packages/node/src/ApiError.ts index 9719a678..eaf1ddfb 100644 --- a/packages/node/src/ApiError.ts +++ b/packages/node/src/ApiError.ts @@ -1,4 +1,5 @@ import type { RequestError } from 'got' + import { HTTPError } from 'got' export interface TransloaditErrorResponseBody { diff --git a/packages/node/src/PaginationStream.ts b/packages/node/src/PaginationStream.ts index 223f7561..ea9195ec 100644 --- a/packages/node/src/PaginationStream.ts +++ b/packages/node/src/PaginationStream.ts @@ -1,6 +1,7 @@ -import { Readable } from 'node:stream' import type { PaginationList, PaginationListWithCount } from './apiTypes.ts' +import { Readable } from 'node:stream' + type FetchPage = ( pageno: number, ) => diff --git a/packages/node/src/Transloadit.ts b/packages/node/src/Transloadit.ts index 18ad3ef8..74a4ffeb 100644 --- a/packages/node/src/Transloadit.ts +++ b/packages/node/src/Transloadit.ts @@ -1,28 +1,13 @@ -import * as assert from 'node:assert' -import { randomUUID } from 'node:crypto' -import { constants, createReadStream } from 'node:fs' -import { access, stat } from 'node:fs/promises' -import { basename } from 'node:path' import type { Readable } from 'node:stream' -import { setTimeout as delay } from 'node:timers/promises' -import { getSignedSmartCdnUrl, signParamsSync } from '@transloadit/utils/node' -import debug from 'debug' -import FormData from 'form-data' + import type { Delays, Headers, OptionsOfJSONResponseBody, RetryOptions } from 'got' -import got, { HTTPError, RequestError } from 'got' -import intoStream, { type Input as IntoStreamInput } from 'into-stream' -import { isReadableStream, isStream } from 'is-stream' -import pMap from 'p-map' -import packageJson from '../package.json' with { type: 'json' } + import type { TransloaditErrorResponseBody } from './ApiError.ts' -import { ApiError } from './ApiError.ts' import type { AssemblyIndex, AssemblyIndexItem, AssemblyStatus, } from './alphalib/types/assemblyStatus.ts' -import { assemblyIndexSchema, assemblyStatusSchema } from './alphalib/types/assemblyStatus.ts' -import { zodParseWithContext } from './alphalib/zodParseWithContext.ts' import type { BaseResponse, BillResponse, @@ -45,34 +30,39 @@ import type { TemplateResponse, } from './apiTypes.ts' import type { BearerTokenResponse, MintBearerTokenOptions } from './bearerToken.ts' -import { mintBearerTokenWithCredentials } from './bearerToken.ts' -import InconsistentResponseError from './InconsistentResponseError.ts' import type { LintAssemblyInstructionsInput, LintAssemblyInstructionsResult, } from './lintAssemblyInstructions.ts' +import type { Stream, UploadBehavior } from './tus.ts' + +import * as assert from 'node:assert' +import { randomUUID } from 'node:crypto' +import { constants, createReadStream } from 'node:fs' +import { access, stat } from 'node:fs/promises' +import { basename } from 'node:path' +import { setTimeout as delay } from 'node:timers/promises' + +import { getSignedSmartCdnUrl, signParamsSync } from '@transloadit/utils/node' +import debug from 'debug' +import FormData from 'form-data' +import got, { HTTPError, RequestError } from 'got' +import intoStream, { type Input as IntoStreamInput } from 'into-stream' +import { isReadableStream, isStream } from 'is-stream' +import pMap from 'p-map' + +import packageJson from '../package.json' with { type: 'json' } +import { ApiError } from './ApiError.ts' +import { assemblyIndexSchema, assemblyStatusSchema } from './alphalib/types/assemblyStatus.ts' +import { zodParseWithContext } from './alphalib/zodParseWithContext.ts' +import { mintBearerTokenWithCredentials } from './bearerToken.ts' +import InconsistentResponseError from './InconsistentResponseError.ts' import { lintAssemblyInstructions as lintAssemblyInstructionsInternal } from './lintAssemblyInstructions.ts' import PaginationStream from './PaginationStream.ts' import PollingTimeoutError from './PollingTimeoutError.ts' -import type { Stream, UploadBehavior } from './tus.ts' import { sendTusRequest } from './tus.ts' -// See https://github.com/sindresorhus/got/tree/v11.8.6?tab=readme-ov-file#errors -// Expose relevant errors -export { - HTTPError, - MaxRedirectsError, - ParseError, - ReadError, - RequestError, - TimeoutError, - UploadError, -} from 'got' -export { extractFieldNamesFromTemplate } from './alphalib/stepParsing.ts' -// Builtin templates replace the legacy golden template helpers. -export { mergeTemplateContent } from './alphalib/templateMerge.ts' export type { AssemblyStatus } from './alphalib/types/assemblyStatus.ts' -export * from './apiTypes.ts' export type { Base64Strategy, InputFile, @@ -81,7 +71,6 @@ export type { UploadInput, UrlStrategy, } from './inputFiles.ts' -export { prepareInputFiles } from './inputFiles.ts' export type { LintAssemblyInstructionsResult, LintFatalLevel } from './lintAssemblyInstructions.ts' export type { RobotHelp, @@ -91,6 +80,24 @@ export type { RobotListResult, RobotParamHelp, } from './robots.ts' + +// See https://github.com/sindresorhus/got/tree/v11.8.6?tab=readme-ov-file#errors +// Expose relevant errors +export { + HTTPError, + MaxRedirectsError, + ParseError, + ReadError, + RequestError, + TimeoutError, + UploadError, +} from 'got' + +export { extractFieldNamesFromTemplate } from './alphalib/stepParsing.ts' +// Builtin templates replace the legacy golden template helpers. +export { mergeTemplateContent } from './alphalib/templateMerge.ts' +export * from './apiTypes.ts' +export { prepareInputFiles } from './inputFiles.ts' export { getRobotHelp, isKnownRobot, listRobots } from './robots.ts' export { ApiError, InconsistentResponseError } diff --git a/packages/node/src/apiTypes.ts b/packages/node/src/apiTypes.ts index 702e42e2..675d6c20 100644 --- a/packages/node/src/apiTypes.ts +++ b/packages/node/src/apiTypes.ts @@ -1,11 +1,12 @@ import type { AssemblyInstructions, AssemblyInstructionsInput } from './alphalib/types/template.ts' +export type { AssemblyInstructions, AssemblyInstructionsInput } from './alphalib/types/template.ts' + export { type AssemblyIndexItem, assemblyIndexItemSchema, assemblyStatusSchema, } from './alphalib/types/assemblyStatus.ts' -export type { AssemblyInstructions, AssemblyInstructionsInput } from './alphalib/types/template.ts' export { assemblyInstructionsSchema } from './alphalib/types/template.ts' export interface OptionalAuthParams { diff --git a/packages/node/src/cli.ts b/packages/node/src/cli.ts index d1b73197..fdb073ae 100644 --- a/packages/node/src/cli.ts +++ b/packages/node/src/cli.ts @@ -4,6 +4,7 @@ import { realpathSync } from 'node:fs' import path from 'node:path' import process from 'node:process' import { fileURLToPath } from 'node:url' + import { loadProjectDotenvIntoProcessEnv } from './cli/helpers.ts' import { ensureError } from './cli/types.ts' diff --git a/packages/node/src/cli/commands/BaseCommand.ts b/packages/node/src/cli/commands/BaseCommand.ts index 00af3e31..17688cd8 100644 --- a/packages/node/src/cli/commands/BaseCommand.ts +++ b/packages/node/src/cli/commands/BaseCommand.ts @@ -1,7 +1,9 @@ +import type { IOutputCtl } from '../OutputCtl.ts' + import { Command, Option } from 'clipanion' + import { Transloadit as TransloaditClient } from '../../Transloadit.ts' import { buildMissingAuthMessage, resolveCliConfig } from '../helpers.ts' -import type { IOutputCtl } from '../OutputCtl.ts' import OutputCtl, { LOG_LEVEL_DEFAULT, LOG_LEVEL_NAMES, parseLogLevel } from '../OutputCtl.ts' abstract class BaseCommand extends Command { diff --git a/packages/node/src/cli/commands/assemblies.ts b/packages/node/src/cli/commands/assemblies.ts index ed0fd410..9cd96375 100644 --- a/packages/node/src/cli/commands/assemblies.ts +++ b/packages/node/src/cli/commands/assemblies.ts @@ -1,27 +1,34 @@ +import type { Readable } from 'node:stream' + +import type { StepsInput } from '../../alphalib/types/template.ts' +import type { CreateAssemblyParams, ReplayAssemblyParams } from '../../apiTypes.ts' +import type { LintFatalLevel } from '../../lintAssemblyInstructions.ts' +import type { CreateAssemblyOptions, Transloadit } from '../../Transloadit.ts' +import type { IOutputCtl } from '../OutputCtl.ts' +import type { NormalizedAssemblyResultFile, NormalizedAssemblyResults } from '../resultFiles.ts' +import type { ResultUrlRow } from '../resultUrls.ts' + import { randomUUID } from 'node:crypto' import EventEmitter from 'node:events' import fs from 'node:fs' import fsp from 'node:fs/promises' import path from 'node:path' import process from 'node:process' -import type { Readable } from 'node:stream' import { Writable } from 'node:stream' import { pipeline } from 'node:stream/promises' import { setTimeout as delay } from 'node:timers/promises' import { promisify } from 'node:util' + import { Command, Option } from 'clipanion' import got from 'got' import PQueue from 'p-queue' import * as t from 'typanion' import { z } from 'zod' + import { formatLintIssue } from '../../alphalib/assembly-linter.lang.en.ts' import { tryCatch } from '../../alphalib/tryCatch.ts' -import type { StepsInput } from '../../alphalib/types/template.ts' -import type { CreateAssemblyParams, ReplayAssemblyParams } from '../../apiTypes.ts' import { ensureUniqueCounterValue } from '../../ensureUniqueCounter.ts' -import type { LintFatalLevel } from '../../lintAssemblyInstructions.ts' import { lintAssemblyInstructions } from '../../lintAssemblyInstructions.ts' -import type { CreateAssemblyOptions, Transloadit } from '../../Transloadit.ts' import { lintingExamples } from '../docs/assemblyLintingExamples.ts' import { concurrencyOption, @@ -35,10 +42,7 @@ import { watchOption, } from '../fileProcessingOptions.ts' import { formatAPIError, readCliInput } from '../helpers.ts' -import type { IOutputCtl } from '../OutputCtl.ts' -import type { NormalizedAssemblyResultFile, NormalizedAssemblyResults } from '../resultFiles.ts' import { normalizeAssemblyResults } from '../resultFiles.ts' -import type { ResultUrlRow } from '../resultUrls.ts' import { collectNormalizedResultUrlRows, printResultUrls } from '../resultUrls.ts' import { readStepsInputFile } from '../stepsInput.ts' import { ensureError, isErrnoException } from '../types.ts' diff --git a/packages/node/src/cli/commands/auth.ts b/packages/node/src/cli/commands/auth.ts index 2147f029..31da34d8 100644 --- a/packages/node/src/cli/commands/auth.ts +++ b/packages/node/src/cli/commands/auth.ts @@ -1,22 +1,26 @@ +import type { ZodIssue } from 'zod' + +import type { OptionalAuthParams } from '../../apiTypes.ts' +import type { CliKeySecretCredentials, ResolvedCliConfig } from '../helpers.ts' +import type { IOutputCtl } from '../OutputCtl.ts' + import process from 'node:process' + import { Command, Option } from 'clipanion' -import type { ZodIssue } from 'zod' import { z } from 'zod' + import { assemblyAuthInstructionsSchema, assemblyInstructionsSchema, } from '../../alphalib/types/template.ts' -import type { OptionalAuthParams } from '../../apiTypes.ts' import { mintBearerTokenWithCredentials } from '../../bearerToken.ts' import { Transloadit } from '../../Transloadit.ts' -import type { CliKeySecretCredentials, ResolvedCliConfig } from '../helpers.ts' import { buildMissingCredentialsMessage, readCliInput, requireCliCredentials, resolveCliConfig, } from '../helpers.ts' -import type { IOutputCtl } from '../OutputCtl.ts' import { UnauthenticatedCommand } from './BaseCommand.ts' type UrlParamPrimitive = string | number | boolean diff --git a/packages/node/src/cli/commands/bills.ts b/packages/node/src/cli/commands/bills.ts index 03d0a998..bf001fa4 100644 --- a/packages/node/src/cli/commands/bills.ts +++ b/packages/node/src/cli/commands/bills.ts @@ -1,9 +1,11 @@ +import type { Transloadit } from '../../Transloadit.ts' +import type { IOutputCtl } from '../OutputCtl.ts' + import { Command, Option } from 'clipanion' import { z } from 'zod' + import { tryCatch } from '../../alphalib/tryCatch.ts' -import type { Transloadit } from '../../Transloadit.ts' import { formatAPIError } from '../helpers.ts' -import type { IOutputCtl } from '../OutputCtl.ts' import { AuthenticatedCommand } from './BaseCommand.ts' // --- Types and business logic --- diff --git a/packages/node/src/cli/commands/docs.ts b/packages/node/src/cli/commands/docs.ts index 4634eaab..3bf5857d 100644 --- a/packages/node/src/cli/commands/docs.ts +++ b/packages/node/src/cli/commands/docs.ts @@ -1,4 +1,5 @@ import { Option } from 'clipanion' + import { getRobotHelp, isKnownRobot, listRobots } from '../../robots.ts' import { UnauthenticatedCommand } from './BaseCommand.ts' diff --git a/packages/node/src/cli/commands/notifications.ts b/packages/node/src/cli/commands/notifications.ts index e65ba452..0dc59d66 100644 --- a/packages/node/src/cli/commands/notifications.ts +++ b/packages/node/src/cli/commands/notifications.ts @@ -1,7 +1,9 @@ -import { Command, Option } from 'clipanion' -import { tryCatch } from '../../alphalib/tryCatch.ts' import type { Transloadit } from '../../Transloadit.ts' import type { IOutputCtl } from '../OutputCtl.ts' + +import { Command, Option } from 'clipanion' + +import { tryCatch } from '../../alphalib/tryCatch.ts' import { ensureError } from '../types.ts' import { AuthenticatedCommand } from './BaseCommand.ts' diff --git a/packages/node/src/cli/commands/templates.ts b/packages/node/src/cli/commands/templates.ts index 031649b1..1e3f9cd2 100644 --- a/packages/node/src/cli/commands/templates.ts +++ b/packages/node/src/cli/commands/templates.ts @@ -1,17 +1,20 @@ +import type { TemplateContent } from '../../apiTypes.ts' +import type { Transloadit } from '../../Transloadit.ts' +import type { IOutputCtl } from '../OutputCtl.ts' +import type { TemplateFile } from '../types.ts' + import fsp from 'node:fs/promises' import path from 'node:path' import { promisify } from 'node:util' + import { Command, Option } from 'clipanion' import rreaddir from 'recursive-readdir' import { z } from 'zod' + import { tryCatch } from '../../alphalib/tryCatch.ts' -import type { TemplateContent } from '../../apiTypes.ts' -import type { Transloadit } from '../../Transloadit.ts' import { createReadStream, formatAPIError, streamToBuffer } from '../helpers.ts' -import type { IOutputCtl } from '../OutputCtl.ts' import { parseStepsInputJson } from '../stepsInput.ts' import ModifiedLookup from '../template-last-modified.ts' -import type { TemplateFile } from '../types.ts' import { ensureError, isTransloaditAPIError, TemplateFileDataSchema } from '../types.ts' import { AuthenticatedCommand } from './BaseCommand.ts' diff --git a/packages/node/src/cli/commands/upload.ts b/packages/node/src/cli/commands/upload.ts index 9c1e63c5..8bcef78e 100644 --- a/packages/node/src/cli/commands/upload.ts +++ b/packages/node/src/cli/commands/upload.ts @@ -1,8 +1,11 @@ +import type { AssemblyStatus } from '../../alphalib/types/assemblyStatus.ts' +import type { IOutputCtl } from '../OutputCtl.ts' + import fs from 'node:fs' + import { Command, Option } from 'clipanion' -import type { AssemblyStatus } from '../../alphalib/types/assemblyStatus.ts' + import { sendTusRequest } from '../../tus.ts' -import type { IOutputCtl } from '../OutputCtl.ts' import { UnauthenticatedCommand } from './BaseCommand.ts' export interface UploadOptions { diff --git a/packages/node/src/cli/generateIntentDocs.ts b/packages/node/src/cli/generateIntentDocs.ts index f820f7c6..efab8877 100644 --- a/packages/node/src/cli/generateIntentDocs.ts +++ b/packages/node/src/cli/generateIntentDocs.ts @@ -1,6 +1,11 @@ +import type { IntentDefinition } from './intentCommandSpecs.ts' +import type { ResolvedIntentCommandDefinition } from './intentCommands.ts' +import type { IntentOptionDefinition } from './intentRuntime.ts' + import { mkdir, readFile, writeFile } from 'node:fs/promises' import { dirname } from 'node:path' import { pathToFileURL } from 'node:url' + import { getConcurrencyOptionDocumentation, getDeleteAfterProcessingOptionDocumentation, @@ -11,10 +16,7 @@ import { getSingleAssemblyOptionDocumentation, getWatchOptionDocumentation, } from './fileProcessingOptions.ts' -import type { IntentDefinition } from './intentCommandSpecs.ts' -import type { ResolvedIntentCommandDefinition } from './intentCommands.ts' import { resolveIntentCommandDefinitions } from './intentCommands.ts' -import type { IntentOptionDefinition } from './intentRuntime.ts' import { getInputBase64OptionDocumentation, getIntentOptionDefinitions } from './intentRuntime.ts' interface DocOptionRow { diff --git a/packages/node/src/cli/helpers.ts b/packages/node/src/cli/helpers.ts index e9fa0670..2876794d 100644 --- a/packages/node/src/cli/helpers.ts +++ b/packages/node/src/cli/helpers.ts @@ -1,9 +1,12 @@ +import type { Readable } from 'node:stream' + import fs from 'node:fs' import fsp from 'node:fs/promises' import { homedir } from 'node:os' import path from 'node:path' -import type { Readable } from 'node:stream' + import { parse as parseDotenv } from 'dotenv' + import { isAPIError } from './types.ts' export type CliKeySecretCredentials = { authKey: string; authSecret: string } diff --git a/packages/node/src/cli/intentCommandSpecs.ts b/packages/node/src/cli/intentCommandSpecs.ts index 551f0b4a..5ed21791 100644 --- a/packages/node/src/cli/intentCommandSpecs.ts +++ b/packages/node/src/cli/intentCommandSpecs.ts @@ -1,6 +1,7 @@ import type { z } from 'zod' import type { RobotMetaInput } from '../alphalib/types/robots/_instructions-primitives.ts' + import { robotAudioWaveformInstructionsSchema, meta as robotAudioWaveformMeta, diff --git a/packages/node/src/cli/intentCommands.ts b/packages/node/src/cli/intentCommands.ts index 6ad1be11..660115cf 100644 --- a/packages/node/src/cli/intentCommands.ts +++ b/packages/node/src/cli/intentCommands.ts @@ -1,5 +1,4 @@ import type { CommandClass } from 'clipanion' -import { Command } from 'clipanion' import type { ZodObject, ZodRawShape, ZodTypeAny } from 'zod' import type { RobotMetaInput } from '../alphalib/types/robots/_instructions-primitives.ts' @@ -10,14 +9,7 @@ import type { RobotIntentDefinition, SemanticIntentDefinition, } from './intentCommandSpecs.ts' -import { getIntentPaths, getIntentResultStepName, intentCatalog } from './intentCommandSpecs.ts' import type { IntentFieldKind, IntentFieldSpec } from './intentFields.ts' -import { - createIntentOption, - inferIntentExampleValue, - inferIntentFieldKind, - unwrapIntentSchema, -} from './intentFields.ts' import type { IntentInputPolicy } from './intentInputPolicy.ts' import type { IntentCommandDefinition, @@ -25,6 +17,16 @@ import type { IntentNoInputCommandDefinition, IntentSingleStepExecutionDefinition, } from './intentRuntime.ts' + +import { Command } from 'clipanion' + +import { getIntentPaths, getIntentResultStepName, intentCatalog } from './intentCommandSpecs.ts' +import { + createIntentOption, + inferIntentExampleValue, + inferIntentFieldKind, + unwrapIntentSchema, +} from './intentFields.ts' import { GeneratedBundledFileIntentCommand, GeneratedNoInputIntentCommand, diff --git a/packages/node/src/cli/intentFields.ts b/packages/node/src/cli/intentFields.ts index df5c2f8e..a875b2d5 100644 --- a/packages/node/src/cli/intentFields.ts +++ b/packages/node/src/cli/intentFields.ts @@ -1,6 +1,7 @@ +import type { z } from 'zod' + import { Option } from 'clipanion' import * as t from 'typanion' -import type { z } from 'zod' import { ZodArray, ZodBoolean, diff --git a/packages/node/src/cli/intentRuntime.ts b/packages/node/src/cli/intentRuntime.ts index 568bbb71..1d8e120a 100644 --- a/packages/node/src/cli/intentRuntime.ts +++ b/packages/node/src/cli/intentRuntime.ts @@ -1,13 +1,18 @@ +import type { z } from 'zod' + +import type { AssembliesCreateOptions } from './commands/assemblies.ts' +import type { SharedCliOptionDocumentation } from './fileProcessingOptions.ts' +import type { IntentFieldSpec } from './intentFields.ts' +import type { IntentInputPolicy } from './intentInputPolicy.ts' + import { statSync } from 'node:fs' import { basename, dirname, join, parse, resolve } from 'node:path' + import { Option } from 'clipanion' -import type { z } from 'zod' import { prepareInputFiles } from '../inputFiles.ts' -import type { AssembliesCreateOptions } from './commands/assemblies.ts' import * as assembliesCommands from './commands/assemblies.ts' import { AuthenticatedCommand } from './commands/BaseCommand.ts' -import type { SharedCliOptionDocumentation } from './fileProcessingOptions.ts' import { concurrencyOption, countProvidedInputs, @@ -20,9 +25,7 @@ import { validateSharedFileProcessingOptions, watchOption, } from './fileProcessingOptions.ts' -import type { IntentFieldSpec } from './intentFields.ts' import { coerceIntentFieldValue } from './intentFields.ts' -import type { IntentInputPolicy } from './intentInputPolicy.ts' import { printResultUrls } from './resultUrls.ts' import { getSemanticIntentDescriptor } from './semanticIntents/index.ts' diff --git a/packages/node/src/cli/resultUrls.ts b/packages/node/src/cli/resultUrls.ts index 5b6a97ef..0d97f426 100644 --- a/packages/node/src/cli/resultUrls.ts +++ b/packages/node/src/cli/resultUrls.ts @@ -1,5 +1,6 @@ import type { IOutputCtl } from './OutputCtl.ts' import type { NormalizedAssemblyResults } from './resultFiles.ts' + import { normalizeAssemblyResults } from './resultFiles.ts' export interface ResultUrlRow { diff --git a/packages/node/src/cli/semanticIntents/imageDescribe.ts b/packages/node/src/cli/semanticIntents/imageDescribe.ts index b08d3c4f..c0262f41 100644 --- a/packages/node/src/cli/semanticIntents/imageDescribe.ts +++ b/packages/node/src/cli/semanticIntents/imageDescribe.ts @@ -1,9 +1,10 @@ -import { parseStringArrayValue } from '../intentFields.ts' import type { IntentDynamicStepExecutionDefinition, IntentOptionDefinition, } from '../intentRuntime.ts' import type { SemanticIntentDescriptor, SemanticIntentPresentation } from './index.ts' + +import { parseStringArrayValue } from '../intentFields.ts' import { parseOptionalEnumValue, parseUniqueEnumArray } from './parsing.ts' const imageDescribeFields = ['labels', 'altText', 'title', 'caption', 'description'] as const diff --git a/packages/node/src/cli/semanticIntents/imageGenerate.ts b/packages/node/src/cli/semanticIntents/imageGenerate.ts index f1fa5e56..5c4769de 100644 --- a/packages/node/src/cli/semanticIntents/imageGenerate.ts +++ b/packages/node/src/cli/semanticIntents/imageGenerate.ts @@ -1,6 +1,8 @@ -import { basename } from 'node:path' import type { IntentOptionDefinition, PreparedIntentInputs } from '../intentRuntime.ts' import type { SemanticIntentDescriptor, SemanticIntentPresentation } from './index.ts' + +import { basename } from 'node:path' + import { parseOptionalEnumValue } from './parsing.ts' const defaultImageGenerateModel = 'google/nano-banana-2' diff --git a/packages/node/src/cli/semanticIntents/index.ts b/packages/node/src/cli/semanticIntents/index.ts index 6400239e..2be54876 100644 --- a/packages/node/src/cli/semanticIntents/index.ts +++ b/packages/node/src/cli/semanticIntents/index.ts @@ -4,6 +4,7 @@ import type { IntentRunnerKind, PreparedIntentInputs, } from '../intentRuntime.ts' + import { imageDescribeSemanticIntentDescriptor } from './imageDescribe.ts' import { imageGenerateSemanticIntentDescriptor } from './imageGenerate.ts' import { diff --git a/packages/node/src/cli/semanticIntents/markdownPdf.ts b/packages/node/src/cli/semanticIntents/markdownPdf.ts index 8d40191c..45fe15eb 100644 --- a/packages/node/src/cli/semanticIntents/markdownPdf.ts +++ b/packages/node/src/cli/semanticIntents/markdownPdf.ts @@ -1,5 +1,6 @@ import type { IntentOptionDefinition } from '../intentRuntime.ts' import type { SemanticIntentDescriptor, SemanticIntentPresentation } from './index.ts' + import { parseOptionalEnumValue } from './parsing.ts' const defaultMarkdownFormat = 'gfm' diff --git a/packages/node/src/cli/semanticIntents/speechTranscribe.ts b/packages/node/src/cli/semanticIntents/speechTranscribe.ts index 997d2bad..f5b5c534 100644 --- a/packages/node/src/cli/semanticIntents/speechTranscribe.ts +++ b/packages/node/src/cli/semanticIntents/speechTranscribe.ts @@ -3,6 +3,7 @@ import type { IntentOptionDefinition, } from '../intentRuntime.ts' import type { SemanticIntentDescriptor, SemanticIntentPresentation } from './index.ts' + import { parseOptionalEnumValue } from './parsing.ts' const speechTranscribeProviders = ['aws', 'gcp', 'replicate'] as const diff --git a/packages/node/src/cli/stepsInput.ts b/packages/node/src/cli/stepsInput.ts index c3daf224..0721a5a0 100644 --- a/packages/node/src/cli/stepsInput.ts +++ b/packages/node/src/cli/stepsInput.ts @@ -1,6 +1,7 @@ +import type { StepsInput } from '../alphalib/types/template.ts' + import fsp from 'node:fs/promises' -import type { StepsInput } from '../alphalib/types/template.ts' import { stepsSchema } from '../alphalib/types/template.ts' export function parseStepsInputJson(content: string): StepsInput { diff --git a/packages/node/src/cli/template-last-modified.ts b/packages/node/src/cli/template-last-modified.ts index 1a9759cc..ab314f71 100644 --- a/packages/node/src/cli/template-last-modified.ts +++ b/packages/node/src/cli/template-last-modified.ts @@ -1,4 +1,5 @@ import type { Transloadit } from '../Transloadit.ts' + import { ensureError } from './types.ts' interface TemplateItem { diff --git a/packages/node/src/cli/types.ts b/packages/node/src/cli/types.ts index b0a59177..618a4d06 100644 --- a/packages/node/src/cli/types.ts +++ b/packages/node/src/cli/types.ts @@ -1,5 +1,7 @@ -import { z } from 'zod' import type { Steps } from '../alphalib/types/template.ts' + +import { z } from 'zod' + import { optionalStepsSchema } from '../alphalib/types/template.ts' // Zod schemas for runtime validation diff --git a/packages/node/src/inputFiles.ts b/packages/node/src/inputFiles.ts index 74d83cad..14ea9d94 100644 --- a/packages/node/src/inputFiles.ts +++ b/packages/node/src/inputFiles.ts @@ -1,17 +1,22 @@ import type { LookupAddress, LookupOptions } from 'node:dns' +import type { LookupFunction } from 'node:net' +import type { Readable } from 'node:stream' + +import type { EntryObject, IPFamily } from 'cacheable-lookup' +import type { Input as IntoStreamInput } from 'into-stream' + +import type { CreateAssemblyParams } from './apiTypes.ts' + import * as dnsPromises from 'node:dns/promises' import { createWriteStream } from 'node:fs' import { mkdtemp, rm, writeFile } from 'node:fs/promises' -import type { LookupFunction } from 'node:net' import { isIP } from 'node:net' import { tmpdir } from 'node:os' import { basename, join, parse } from 'node:path' -import type { Readable } from 'node:stream' import { pipeline } from 'node:stream/promises' -import type { EntryObject, IPFamily } from 'cacheable-lookup' + import got from 'got' -import type { Input as IntoStreamInput } from 'into-stream' -import type { CreateAssemblyParams } from './apiTypes.ts' + import { ensureUniqueCounterValue } from './ensureUniqueCounter.ts' export type InputFile = diff --git a/packages/node/src/lintAssemblyInput.ts b/packages/node/src/lintAssemblyInput.ts index baa08b15..055af865 100644 --- a/packages/node/src/lintAssemblyInput.ts +++ b/packages/node/src/lintAssemblyInput.ts @@ -1,8 +1,9 @@ -import { getIndentation } from './alphalib/stepParsing.ts' -import { mergeTemplateContent } from './alphalib/templateMerge.ts' import type { AssemblyInstructionsInput, StepsInput } from './alphalib/types/template.ts' import type { ResponseTemplateContent, TemplateContent } from './apiTypes.ts' +import { getIndentation } from './alphalib/stepParsing.ts' +import { mergeTemplateContent } from './alphalib/templateMerge.ts' + const DEFAULT_INDENT = ' ' const isRecord = (value: unknown): value is Record => diff --git a/packages/node/src/lintAssemblyInstructions.ts b/packages/node/src/lintAssemblyInstructions.ts index e8f1b388..5e728314 100644 --- a/packages/node/src/lintAssemblyInstructions.ts +++ b/packages/node/src/lintAssemblyInstructions.ts @@ -1,8 +1,9 @@ import type { HydratedLintIssue } from './alphalib/assembly-linter.lang.en.ts' -import { hydrateLintIssues } from './alphalib/assembly-linter.lang.en.ts' -import { applyFix, parseAndLint } from './alphalib/assembly-linter.ts' import type { AssemblyInstructionsInput, StepsInput } from './alphalib/types/template.ts' import type { ResponseTemplateContent, TemplateContent } from './apiTypes.ts' + +import { hydrateLintIssues } from './alphalib/assembly-linter.lang.en.ts' +import { applyFix, parseAndLint } from './alphalib/assembly-linter.ts' import { buildLintInput, unwrapStepsOnly } from './lintAssemblyInput.ts' export type LintFatalLevel = 'error' | 'warning' diff --git a/packages/node/src/robots.ts b/packages/node/src/robots.ts index 9b57e13c..988cc945 100644 --- a/packages/node/src/robots.ts +++ b/packages/node/src/robots.ts @@ -1,4 +1,5 @@ import type { z } from 'zod' + import { getRobotSchemaOptions, robotsMeta } from './alphalib/types/robots/_index.ts' export type RobotListOptions = { diff --git a/packages/node/src/tus.ts b/packages/node/src/tus.ts index 172913f0..aef6627c 100644 --- a/packages/node/src/tus.ts +++ b/packages/node/src/tus.ts @@ -1,12 +1,16 @@ +import type { Readable } from 'node:stream' + +import type { OnSuccessPayload, UploadOptions } from 'tus-js-client' + +import type { AssemblyStatus } from './alphalib/types/assemblyStatus.ts' +import type { UploadProgress } from './Transloadit.ts' + import { stat } from 'node:fs/promises' import { basename } from 'node:path' -import type { Readable } from 'node:stream' + import debug from 'debug' import pMap from 'p-map' -import type { OnSuccessPayload, UploadOptions } from 'tus-js-client' import { Upload } from 'tus-js-client' -import type { AssemblyStatus } from './alphalib/types/assemblyStatus.ts' -import type { UploadProgress } from './Transloadit.ts' const log = debug('transloadit') const logWarn = debug('transloadit:warn') diff --git a/packages/node/test/e2e/cli/OutputCtl.ts b/packages/node/test/e2e/cli/OutputCtl.ts index 1962c541..10162519 100644 --- a/packages/node/test/e2e/cli/OutputCtl.ts +++ b/packages/node/test/e2e/cli/OutputCtl.ts @@ -1,4 +1,5 @@ import type { LogLevelValue, OutputCtlOptions } from '../../../src/cli/OutputCtl.ts' + import { LOG_LEVEL_DEFAULT } from '../../../src/cli/OutputCtl.ts' interface OutputEntry { diff --git a/packages/node/test/e2e/cli/assemblies-create.test.ts b/packages/node/test/e2e/cli/assemblies-create.test.ts index 242345bf..45380d6f 100644 --- a/packages/node/test/e2e/cli/assemblies-create.test.ts +++ b/packages/node/test/e2e/cli/assemblies-create.test.ts @@ -1,15 +1,18 @@ +import type { OutputEntry } from './test-utils.ts' + import crypto from 'node:crypto' import fsp from 'node:fs/promises' import path from 'node:path' import process from 'node:process' import { fileURLToPath } from 'node:url' import { promisify } from 'node:util' + import { imageSize } from 'image-size' import rreaddir from 'recursive-readdir' import { describe, expect, it } from 'vitest' + import { create as assembliesCreate } from '../../../src/cli/commands/assemblies.ts' import OutputCtl from './OutputCtl.ts' -import type { OutputEntry } from './test-utils.ts' import { hasTransloaditCredentials, testCase } from './test-utils.ts' const rreaddirAsync = promisify(rreaddir) diff --git a/packages/node/test/e2e/cli/assemblies-list.test.ts b/packages/node/test/e2e/cli/assemblies-list.test.ts index 970009ef..691203f9 100644 --- a/packages/node/test/e2e/cli/assemblies-list.test.ts +++ b/packages/node/test/e2e/cli/assemblies-list.test.ts @@ -1,7 +1,9 @@ +import type { OutputEntry } from './test-utils.ts' + import { describe, expect, it } from 'vitest' + import * as assemblies from '../../../src/cli/commands/assemblies.ts' import OutputCtl from './OutputCtl.ts' -import type { OutputEntry } from './test-utils.ts' import { hasTransloaditCredentials, testCase } from './test-utils.ts' const describeLive = hasTransloaditCredentials ? describe : describe.skip diff --git a/packages/node/test/e2e/cli/assemblies.test.ts b/packages/node/test/e2e/cli/assemblies.test.ts index 8896015a..b29d25dd 100644 --- a/packages/node/test/e2e/cli/assemblies.test.ts +++ b/packages/node/test/e2e/cli/assemblies.test.ts @@ -1,9 +1,12 @@ +import type { OutputEntry } from './test-utils.ts' + import fsp from 'node:fs/promises' + import { describe, expect, it } from 'vitest' + import * as assemblies from '../../../src/cli/commands/assemblies.ts' import { zip } from '../../../src/cli/helpers.ts' import OutputCtl from './OutputCtl.ts' -import type { OutputEntry } from './test-utils.ts' import { hasTransloaditCredentials, testCase } from './test-utils.ts' const describeLive = hasTransloaditCredentials ? describe : describe.skip diff --git a/packages/node/test/e2e/cli/bills.test.ts b/packages/node/test/e2e/cli/bills.test.ts index 327c3d17..63dfe967 100644 --- a/packages/node/test/e2e/cli/bills.test.ts +++ b/packages/node/test/e2e/cli/bills.test.ts @@ -1,7 +1,9 @@ +import type { OutputEntry } from './test-utils.ts' + import { describe, expect, it } from 'vitest' + import * as bills from '../../../src/cli/commands/bills.ts' import OutputCtl from './OutputCtl.ts' -import type { OutputEntry } from './test-utils.ts' import { hasTransloaditCredentials, testCase } from './test-utils.ts' const describeLive = hasTransloaditCredentials ? describe : describe.skip diff --git a/packages/node/test/e2e/cli/cli.test.ts b/packages/node/test/e2e/cli/cli.test.ts index 6fd84ba8..6997d2b0 100644 --- a/packages/node/test/e2e/cli/cli.test.ts +++ b/packages/node/test/e2e/cli/cli.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' + import { hasTransloaditCredentials, runCli } from './test-utils.ts' const describeLive = hasTransloaditCredentials ? describe : describe.skip diff --git a/packages/node/test/e2e/cli/templates.test.ts b/packages/node/test/e2e/cli/templates.test.ts index 5b4c2588..145a8d42 100644 --- a/packages/node/test/e2e/cli/templates.test.ts +++ b/packages/node/test/e2e/cli/templates.test.ts @@ -1,12 +1,15 @@ +import type { TemplateContent } from '../../../src/apiTypes.ts' +import type { OutputEntry } from './test-utils.ts' + import fsp from 'node:fs/promises' import path from 'node:path' + import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import type { TemplateContent } from '../../../src/apiTypes.ts' + import * as templates from '../../../src/cli/commands/templates.ts' import { zip } from '../../../src/cli/helpers.ts' import { Transloadit as TransloaditClient } from '../../../src/Transloadit.ts' import OutputCtl from './OutputCtl.ts' -import type { OutputEntry } from './test-utils.ts' import { authKey, authSecret, delay, hasTransloaditCredentials, testCase } from './test-utils.ts' const describeLive = hasTransloaditCredentials ? describe : describe.skip diff --git a/packages/node/test/e2e/cli/test-utils.ts b/packages/node/test/e2e/cli/test-utils.ts index 50551ced..0122ad30 100644 --- a/packages/node/test/e2e/cli/test-utils.ts +++ b/packages/node/test/e2e/cli/test-utils.ts @@ -4,7 +4,9 @@ import path from 'node:path' import process from 'node:process' import { fileURLToPath } from 'node:url' import { promisify } from 'node:util' + import { rimraf } from 'rimraf' + import { Transloadit as TransloaditClient } from '../../../src/Transloadit.ts' import { hasLiveCredentials, loadRepoRootDotenv } from '../../test-env.ts' diff --git a/packages/node/test/e2e/cli/upload.test.ts b/packages/node/test/e2e/cli/upload.test.ts index 896a92d8..5fea69e2 100644 --- a/packages/node/test/e2e/cli/upload.test.ts +++ b/packages/node/test/e2e/cli/upload.test.ts @@ -1,6 +1,8 @@ import { writeFile } from 'node:fs/promises' import path from 'node:path' + import { describe, expect, it } from 'vitest' + import { hasTransloaditCredentials, runCli, testCase } from './test-utils.ts' const describeLive = hasTransloaditCredentials ? describe : describe.skip diff --git a/packages/node/test/e2e/live-api.test.ts b/packages/node/test/e2e/live-api.test.ts index 6c317cbb..55bf0962 100644 --- a/packages/node/test/e2e/live-api.test.ts +++ b/packages/node/test/e2e/live-api.test.ts @@ -1,26 +1,30 @@ +import type { IncomingMessage, RequestListener } from 'node:http' + +import type { InterpolatableRobotFileFilterInstructionsInput } from '../../src/alphalib/types/robots/file-filter.ts' +import type { InterpolatableRobotImageResizeInstructionsInput } from '../../src/alphalib/types/robots/image-resize.ts' +import type { + CreateAssemblyOptions, + CreateAssemblyParams, + UploadProgress, +} from '../../src/Transloadit.ts' +import type { TestServer } from '../testserver.ts' + import { randomUUID } from 'node:crypto' import { createWriteStream, existsSync } from 'node:fs' import { mkdtemp } from 'node:fs/promises' -import type { IncomingMessage, RequestListener } from 'node:http' import { tmpdir } from 'node:os' import { join } from 'node:path' import { parse } from 'node:querystring' import { pipeline } from 'node:stream/promises' import { setTimeout } from 'node:timers/promises' + import debug from 'debug' import got, { type RetryOptions } from 'got' import intoStream from 'into-stream' import { describe } from 'vitest' -import type { InterpolatableRobotFileFilterInstructionsInput } from '../../src/alphalib/types/robots/file-filter.ts' -import type { InterpolatableRobotImageResizeInstructionsInput } from '../../src/alphalib/types/robots/image-resize.ts' -import type { - CreateAssemblyOptions, - CreateAssemblyParams, - UploadProgress, -} from '../../src/Transloadit.ts' + import { Transloadit } from '../../src/Transloadit.ts' import { hasLiveCredentials, loadRepoRootDotenv } from '../test-env.ts' -import type { TestServer } from '../testserver.ts' import { createTestServer } from '../testserver.ts' import { createProxy } from '../util.ts' diff --git a/packages/node/test/e2e/resume-assembly.test.ts b/packages/node/test/e2e/resume-assembly.test.ts index d7af6a5b..a13ae1a6 100644 --- a/packages/node/test/e2e/resume-assembly.test.ts +++ b/packages/node/test/e2e/resume-assembly.test.ts @@ -1,11 +1,14 @@ +import type { IncomingMessage } from 'node:http' + import { randomUUID } from 'node:crypto' import { once } from 'node:events' import { mkdtemp, writeFile } from 'node:fs/promises' -import type { IncomingMessage } from 'node:http' import { createServer } from 'node:http' import { tmpdir } from 'node:os' import { basename, join } from 'node:path' + import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest' + import { Transloadit } from '../../src/Transloadit.ts' type TusUpload = { diff --git a/packages/node/test/generate-coverage-badge.ts b/packages/node/test/generate-coverage-badge.ts index a2f3b5e1..498b7393 100644 --- a/packages/node/test/generate-coverage-badge.ts +++ b/packages/node/test/generate-coverage-badge.ts @@ -1,6 +1,7 @@ #!/usr/bin/env node import fs from 'node:fs/promises' + import { makeBadge } from 'badge-maker' const json = JSON.parse(await fs.readFile(process.argv[2], 'utf-8')) diff --git a/packages/node/test/test-env.ts b/packages/node/test/test-env.ts index 638e8661..c85de6a1 100644 --- a/packages/node/test/test-env.ts +++ b/packages/node/test/test-env.ts @@ -1,6 +1,7 @@ import { existsSync } from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' + import { config as dotenvConfig } from 'dotenv' const __dirname = path.dirname(fileURLToPath(import.meta.url)) diff --git a/packages/node/test/testserver.ts b/packages/node/test/testserver.ts index 5368c5ad..e762f2b3 100644 --- a/packages/node/test/testserver.ts +++ b/packages/node/test/testserver.ts @@ -1,9 +1,13 @@ import type { RequestListener, Server } from 'node:http' + +import type { CreateTunnelResult } from './tunnel.ts' + import { createServer } from 'node:http' import { setTimeout } from 'node:timers/promises' + import debug from 'debug' import got from 'got' -import type { CreateTunnelResult } from './tunnel.ts' + import { createTunnel } from './tunnel.ts' const log = debug('transloadit:testserver') diff --git a/packages/node/test/tunnel.ts b/packages/node/test/tunnel.ts index 41c6327a..1c10eeaa 100644 --- a/packages/node/test/tunnel.ts +++ b/packages/node/test/tunnel.ts @@ -1,8 +1,10 @@ +import type { ResultPromise } from 'execa' + import { Resolver } from 'node:dns/promises' import { createInterface } from 'node:readline' import * as timers from 'node:timers/promises' + import debug from 'debug' -import type { ResultPromise } from 'execa' import { ExecaError, execa } from 'execa' import pRetry from 'p-retry' diff --git a/packages/node/test/unit/assembly-status-helpers.test.ts b/packages/node/test/unit/assembly-status-helpers.test.ts index 51d2ee4a..cc6d65a5 100644 --- a/packages/node/test/unit/assembly-status-helpers.test.ts +++ b/packages/node/test/unit/assembly-status-helpers.test.ts @@ -1,6 +1,7 @@ +import type { AssemblyStatus } from '../../src/alphalib/types/assemblyStatus.ts' + import { describe, expect, it } from 'vitest' -import type { AssemblyStatus } from '../../src/alphalib/types/assemblyStatus.ts' import { isAssemblySysError, isAssemblyTerminal, diff --git a/packages/node/test/unit/cli/assemblies-create.test.ts b/packages/node/test/unit/cli/assemblies-create.test.ts index 4b6c1088..b0aba410 100644 --- a/packages/node/test/unit/cli/assemblies-create.test.ts +++ b/packages/node/test/unit/cli/assemblies-create.test.ts @@ -4,6 +4,7 @@ import { tmpdir } from 'node:os' import path from 'node:path' import { setTimeout as delay } from 'node:timers/promises' import tty from 'node:tty' + import nock from 'nock' import { afterEach, describe, expect, it, vi } from 'vitest' diff --git a/packages/node/test/unit/cli/auth-token.test.ts b/packages/node/test/unit/cli/auth-token.test.ts index 85582ce6..9281c304 100644 --- a/packages/node/test/unit/cli/auth-token.test.ts +++ b/packages/node/test/unit/cli/auth-token.test.ts @@ -1,7 +1,9 @@ import { mkdtempSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import path from 'node:path' + import { afterEach, describe, expect, it, vi } from 'vitest' + import { main } from '../../../src/cli.ts' const resetExitCode = () => { diff --git a/packages/node/test/unit/cli/credentials-resolution.test.ts b/packages/node/test/unit/cli/credentials-resolution.test.ts index 2cc36696..a590a282 100644 --- a/packages/node/test/unit/cli/credentials-resolution.test.ts +++ b/packages/node/test/unit/cli/credentials-resolution.test.ts @@ -1,7 +1,9 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import path from 'node:path' + import { afterEach, describe, expect, it, vi } from 'vitest' + import { runSig } from '../../../src/cli/commands/auth.ts' import OutputCtl from '../../../src/cli/OutputCtl.ts' import { main } from '../../../src/cli.ts' diff --git a/packages/node/test/unit/cli/intent-docs.test.ts b/packages/node/test/unit/cli/intent-docs.test.ts index 1c8dee02..11ececee 100644 --- a/packages/node/test/unit/cli/intent-docs.test.ts +++ b/packages/node/test/unit/cli/intent-docs.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' + import { renderIntentDocsBody } from '../../../src/cli/generateIntentDocs.ts' import { resolveIntentCommandDefinitions } from '../../../src/cli/intentCommands.ts' diff --git a/packages/node/test/unit/cli/intents.test.ts b/packages/node/test/unit/cli/intents.test.ts index 44aba29b..525d3f8f 100644 --- a/packages/node/test/unit/cli/intents.test.ts +++ b/packages/node/test/unit/cli/intents.test.ts @@ -1,6 +1,7 @@ import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import path from 'node:path' + import nock from 'nock' import { afterEach, describe, expect, it, vi } from 'vitest' import { z } from 'zod' diff --git a/packages/node/test/unit/cli/templates-list.test.ts b/packages/node/test/unit/cli/templates-list.test.ts index 20659247..d6aaca1b 100644 --- a/packages/node/test/unit/cli/templates-list.test.ts +++ b/packages/node/test/unit/cli/templates-list.test.ts @@ -1,4 +1,5 @@ import { afterEach, describe, expect, it, vi } from 'vitest' + import OutputCtl from '../../../src/cli/OutputCtl.ts' import { main } from '../../../src/cli.ts' import { Transloadit } from '../../../src/Transloadit.ts' diff --git a/packages/node/test/unit/cli/test-cli.test.ts b/packages/node/test/unit/cli/test-cli.test.ts index 088d05ea..f735994e 100644 --- a/packages/node/test/unit/cli/test-cli.test.ts +++ b/packages/node/test/unit/cli/test-cli.test.ts @@ -2,7 +2,9 @@ import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node import { tmpdir } from 'node:os' import path from 'node:path' import { fileURLToPath } from 'node:url' + import { afterEach, describe, expect, it, vi } from 'vitest' + import { lint as lintAssemblies } from '../../../src/cli/commands/assemblies.ts' import { runSig, runSmartSig } from '../../../src/cli/commands/auth.ts' import OutputCtl from '../../../src/cli/OutputCtl.ts' diff --git a/packages/node/test/unit/ensure-unique-counter.test.ts b/packages/node/test/unit/ensure-unique-counter.test.ts index 28c4ff31..95eb1925 100644 --- a/packages/node/test/unit/ensure-unique-counter.test.ts +++ b/packages/node/test/unit/ensure-unique-counter.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' + import { ensureUniqueCounterValue } from '../../src/ensureUniqueCounter.ts' describe('ensureUniqueCounterValue', () => { diff --git a/packages/node/test/unit/input-files.test.ts b/packages/node/test/unit/input-files.test.ts index afacfca6..1a8b5f47 100644 --- a/packages/node/test/unit/input-files.test.ts +++ b/packages/node/test/unit/input-files.test.ts @@ -1,8 +1,10 @@ import { mkdtemp, rm } from 'node:fs/promises' import { tmpdir } from 'node:os' import { basename, join } from 'node:path' + import nock from 'nock' import { afterEach, describe, expect, it, vi } from 'vitest' + import { createPinnedDnsLookup, prepareInputFiles, diff --git a/packages/node/test/unit/lint-assembly.test.ts b/packages/node/test/unit/lint-assembly.test.ts index 239a19d5..23d2906b 100644 --- a/packages/node/test/unit/lint-assembly.test.ts +++ b/packages/node/test/unit/lint-assembly.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' + import { lintAssemblyInstructions } from '../../src/lintAssemblyInstructions.ts' describe('lintAssemblyInstructions', () => { diff --git a/packages/node/test/unit/mint-bearer-token.test.ts b/packages/node/test/unit/mint-bearer-token.test.ts index ac05a027..a5482f3a 100644 --- a/packages/node/test/unit/mint-bearer-token.test.ts +++ b/packages/node/test/unit/mint-bearer-token.test.ts @@ -1,4 +1,5 @@ import { afterEach, describe, expect, it, vi } from 'vitest' + import { Transloadit } from '../../src/Transloadit.ts' afterEach(() => { diff --git a/packages/node/test/unit/mock-http.test.ts b/packages/node/test/unit/mock-http.test.ts index 42bffb01..8e76dd4c 100644 --- a/packages/node/test/unit/mock-http.test.ts +++ b/packages/node/test/unit/mock-http.test.ts @@ -1,6 +1,9 @@ +import type { AssemblyStatus, Options } from '../../src/Transloadit.ts' + import { inspect } from 'node:util' + import nock from 'nock' -import type { AssemblyStatus, Options } from '../../src/Transloadit.ts' + import { ApiError, assemblyInstructionsSchema, diff --git a/packages/node/test/unit/resume-assembly.test.ts b/packages/node/test/unit/resume-assembly.test.ts index a42c0065..5eee1bd4 100644 --- a/packages/node/test/unit/resume-assembly.test.ts +++ b/packages/node/test/unit/resume-assembly.test.ts @@ -1,10 +1,13 @@ +import type { AssemblyStatus } from '../../src/alphalib/types/assemblyStatus.ts' + import { createReadStream } from 'node:fs' import { mkdtemp, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' import { Readable } from 'node:stream' + import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { AssemblyStatus } from '../../src/alphalib/types/assemblyStatus.ts' + import { Transloadit } from '../../src/Transloadit.ts' import { sendTusRequest } from '../../src/tus.ts' diff --git a/packages/node/test/unit/robots.test.ts b/packages/node/test/unit/robots.test.ts index 88df4207..27936e6c 100644 --- a/packages/node/test/unit/robots.test.ts +++ b/packages/node/test/unit/robots.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' + import { getRobotHelp, listRobots } from '../../src/Transloadit.ts' describe('robot catalog helpers', () => { diff --git a/packages/node/test/unit/test-transloadit-client.test.ts b/packages/node/test/unit/test-transloadit-client.test.ts index 2fc7066a..b38aac3a 100644 --- a/packages/node/test/unit/test-transloadit-client.test.ts +++ b/packages/node/test/unit/test-transloadit-client.test.ts @@ -1,5 +1,7 @@ import type { Readable } from 'node:stream' + import { PassThrough } from 'node:stream' + import FormData from 'form-data' import got, { type CancelableRequest } from 'got' diff --git a/packages/node/test/unit/transloadit-advanced.test.ts b/packages/node/test/unit/transloadit-advanced.test.ts index 712db296..a21d9de9 100644 --- a/packages/node/test/unit/transloadit-advanced.test.ts +++ b/packages/node/test/unit/transloadit-advanced.test.ts @@ -47,8 +47,9 @@ vi.mock('got', () => { } }) -import { ApiError } from '../../src/ApiError.ts' import type { AssemblyStatus } from '../../src/alphalib/types/assemblyStatus.ts' + +import { ApiError } from '../../src/ApiError.ts' import PaginationStream from '../../src/PaginationStream.ts' import PollingTimeoutError from '../../src/PollingTimeoutError.ts' import { Transloadit } from '../../src/Transloadit.ts' diff --git a/packages/node/test/unit/tus.test.ts b/packages/node/test/unit/tus.test.ts index 0e0b7d69..c7b35479 100644 --- a/packages/node/test/unit/tus.test.ts +++ b/packages/node/test/unit/tus.test.ts @@ -1,6 +1,9 @@ import type { stat as NodeStat } from 'node:fs/promises' -import { PassThrough } from 'node:stream' + import type { OnSuccessPayload, UploadOptions } from 'tus-js-client' + +import { PassThrough } from 'node:stream' + import { beforeEach, describe, expect, it, vi } from 'vitest' let startBehavior: (options: UploadOptions) => void @@ -64,6 +67,7 @@ vi.mock('p-map', () => ({ })) import type { AssemblyStatus } from '../../src/alphalib/types/assemblyStatus.ts' + import { sendTusRequest } from '../../src/tus.ts' const baseAssembly = { diff --git a/packages/node/test/util.ts b/packages/node/test/util.ts index ed71d0f8..c1c1460d 100644 --- a/packages/node/test/util.ts +++ b/packages/node/test/util.ts @@ -1,4 +1,5 @@ import type { Transloadit } from '../src/Transloadit.ts' + import { RequestError } from '../src/Transloadit.ts' export const createProxy = (transloaditInstance: Transloadit) => { diff --git a/packages/node/vitest.config.ts b/packages/node/vitest.config.ts index 73142c83..7c2acf5a 100644 --- a/packages/node/vitest.config.ts +++ b/packages/node/vitest.config.ts @@ -1,4 +1,5 @@ import { fileURLToPath } from 'node:url' + import { defineConfig } from 'vitest/config' const utilsIndexPath = fileURLToPath(new URL('../utils/src/index.ts', import.meta.url)) diff --git a/packages/notify-url-relay/src/cli.ts b/packages/notify-url-relay/src/cli.ts index d5e8b316..58686e57 100755 --- a/packages/notify-url-relay/src/cli.ts +++ b/packages/notify-url-relay/src/cli.ts @@ -1,8 +1,5 @@ #!/usr/bin/env node -import { parseArgs } from 'node:util' -import { SevLogger } from '@transloadit/sev-logger' -import { config as loadDotEnv } from 'dotenv' import type { CounterMetricEvent, GaugeMetricEvent, @@ -11,6 +8,12 @@ import type { ProxySettings, TimingMetricEvent, } from './index.ts' + +import { parseArgs } from 'node:util' + +import { SevLogger } from '@transloadit/sev-logger' +import { config as loadDotEnv } from 'dotenv' + import { TransloaditNotifyUrlProxy } from './index.ts' loadDotEnv({ quiet: true }) diff --git a/packages/notify-url-relay/src/index.ts b/packages/notify-url-relay/src/index.ts index 490c7331..3015b761 100644 --- a/packages/notify-url-relay/src/index.ts +++ b/packages/notify-url-relay/src/index.ts @@ -1,13 +1,16 @@ -import { once } from 'node:events' import type { IncomingMessage, Server, ServerResponse } from 'node:http' +import type { ReadableStream as NodeReadableStream } from 'node:stream/web' + +import type { AssemblyStatus, assemblyStatusOkCodeSchema } from '@transloadit/zod/v4' +import type { RetryContext } from 'p-retry' + +import { once } from 'node:events' import { createServer } from 'node:http' import { Readable } from 'node:stream' import { pipeline } from 'node:stream/promises' -import type { ReadableStream as NodeReadableStream } from 'node:stream/web' import { SevLogger } from '@transloadit/sev-logger' import { signParamsSync } from '@transloadit/utils/node' -import type { AssemblyStatus, assemblyStatusOkCodeSchema } from '@transloadit/zod/v4' import { assemblyStatusSchema, getAssemblyStage, @@ -19,7 +22,6 @@ import { isAssemblyTerminalOk, parseAssemblyUrls, } from '@transloadit/zod/v4' -import type { RetryContext } from 'p-retry' import pRetry, { AbortError } from 'p-retry' const HOP_BY_HOP_HEADERS = new Set([ diff --git a/packages/notify-url-relay/test/chaos.test.ts b/packages/notify-url-relay/test/chaos.test.ts index 3ece394a..d27392aa 100644 --- a/packages/notify-url-relay/test/chaos.test.ts +++ b/packages/notify-url-relay/test/chaos.test.ts @@ -1,8 +1,10 @@ +import type { CounterMetricEvent } from '../src/index.ts' + import { createServer } from 'node:http' import { setTimeout as delay } from 'node:timers/promises' import { describe, expect, it } from 'vitest' -import type { CounterMetricEvent } from '../src/index.ts' + import { TransloaditNotifyUrlProxy } from '../src/index.ts' import { closeServer, json, listen, readBody, startRelay, waitFor } from './helpers.ts' diff --git a/packages/notify-url-relay/test/helpers.ts b/packages/notify-url-relay/test/helpers.ts index 8319c309..cbd5d0e7 100644 --- a/packages/notify-url-relay/test/helpers.ts +++ b/packages/notify-url-relay/test/helpers.ts @@ -1,9 +1,10 @@ -import { once } from 'node:events' import type { IncomingMessage, Server, ServerResponse } from 'node:http' -import { setTimeout as delay } from 'node:timers/promises' import type { ProxySettings } from '../src/index.ts' +import { once } from 'node:events' +import { setTimeout as delay } from 'node:timers/promises' + type RelayLike = { run: (opts?: Partial) => void waitForListenPort: () => Promise diff --git a/packages/notify-url-relay/test/real.e2e.test.ts b/packages/notify-url-relay/test/real.e2e.test.ts index 13f89272..6bdd17d2 100644 --- a/packages/notify-url-relay/test/real.e2e.test.ts +++ b/packages/notify-url-relay/test/real.e2e.test.ts @@ -1,6 +1,7 @@ import { existsSync } from 'node:fs' import { createServer } from 'node:http' import { setTimeout as delay } from 'node:timers/promises' + import { Transloadit } from 'transloadit' import { describe, expect, it } from 'vitest' diff --git a/packages/notify-url-relay/vitest.config.ts b/packages/notify-url-relay/vitest.config.ts index 55d181b3..8a298c3c 100644 --- a/packages/notify-url-relay/vitest.config.ts +++ b/packages/notify-url-relay/vitest.config.ts @@ -1,4 +1,5 @@ import { fileURLToPath } from 'node:url' + import { defineConfig } from 'vitest/config' const includeRealE2E = process.env.RUN_REAL_E2E === '1' diff --git a/packages/types/scripts/emit-types.ts b/packages/types/scripts/emit-types.ts index 1d719baf..abc76ba6 100644 --- a/packages/types/scripts/emit-types.ts +++ b/packages/types/scripts/emit-types.ts @@ -1,6 +1,7 @@ import { mkdir, readdir, rm, stat, writeFile } from 'node:fs/promises' import { dirname, join, relative, resolve, sep } from 'node:path' import { fileURLToPath } from 'node:url' + import ts from 'typescript' const filePath = fileURLToPath(import.meta.url) diff --git a/packages/utils/src/node.ts b/packages/utils/src/node.ts index 07bd9936..258d3e4f 100644 --- a/packages/utils/src/node.ts +++ b/packages/utils/src/node.ts @@ -1,7 +1,7 @@ -import { createHmac } from 'node:crypto' - import type { SignatureAlgorithm } from './index.ts' +import { createHmac } from 'node:crypto' + export type { SignatureAlgorithm } from './index.ts' export type SignatureAlgorithmInput = SignatureAlgorithm | (string & {}) diff --git a/packages/zod/test/patch-ai-chat-schema.test.ts b/packages/zod/test/patch-ai-chat-schema.test.ts index ceb2b7e7..3650158b 100644 --- a/packages/zod/test/patch-ai-chat-schema.test.ts +++ b/packages/zod/test/patch-ai-chat-schema.test.ts @@ -1,4 +1,5 @@ import assert from 'node:assert/strict' + import { patchAiChatSchema } from '../scripts/sync-v4.ts' const source = ` diff --git a/packages/zod/test/type-equality-v3.ts b/packages/zod/test/type-equality-v3.ts index 77502a41..2e3a31b0 100644 --- a/packages/zod/test/type-equality-v3.ts +++ b/packages/zod/test/type-equality-v3.ts @@ -1,6 +1,7 @@ import type { AssemblyStatus } from '@transloadit/types/assemblyStatus' import type { AssemblyInstructions } from '@transloadit/types/template' import type { z } from 'zod/v3' + import type { assemblyStatusSchema } from '../src/v3/assemblyStatus.ts' import type { assemblyInstructionsSchema } from '../src/v3/template.ts' diff --git a/packages/zod/test/type-equality-v4.ts b/packages/zod/test/type-equality-v4.ts index 590681de..2f33725a 100644 --- a/packages/zod/test/type-equality-v4.ts +++ b/packages/zod/test/type-equality-v4.ts @@ -1,6 +1,7 @@ import type { AssemblyStatus } from '@transloadit/types/assemblyStatus' import type { AssemblyInstructions } from '@transloadit/types/template' import type { z } from 'zod/v4' + import type { assemblyStatusSchema } from '../src/v4/assemblyStatus.ts' import type { assemblyInstructionsSchema } from '../src/v4/template.ts' diff --git a/scripts/prepare-transloadit.ts b/scripts/prepare-transloadit.ts index 65edca5e..9bed049b 100644 --- a/scripts/prepare-transloadit.ts +++ b/scripts/prepare-transloadit.ts @@ -1,6 +1,7 @@ import { chmod, cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises' import { dirname, resolve } from 'node:path' import { fileURLToPath } from 'node:url' + import { ensureNodePackagePrepared } from './prepare-node-package.ts' const filePath = fileURLToPath(import.meta.url)