@prisma/compute-sdk 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +24 -8
- package/dist/api-client.js.map +1 -1
- package/dist/archive.d.ts +1 -1
- package/dist/archive.d.ts.map +1 -1
- package/dist/archive.js +34 -15
- package/dist/archive.js.map +1 -1
- package/dist/artifact-postprocess.d.ts +7 -0
- package/dist/artifact-postprocess.d.ts.map +1 -0
- package/dist/artifact-postprocess.js +54 -0
- package/dist/artifact-postprocess.js.map +1 -0
- package/dist/astro-build.d.ts +2 -2
- package/dist/astro-build.d.ts.map +1 -1
- package/dist/astro-build.js +6 -4
- package/dist/astro-build.js.map +1 -1
- package/dist/auto-build.d.ts +2 -2
- package/dist/auto-build.d.ts.map +1 -1
- package/dist/auto-build.js +7 -5
- package/dist/auto-build.js.map +1 -1
- package/dist/build-strategy.d.ts +7 -6
- package/dist/build-strategy.d.ts.map +1 -1
- package/dist/build-strategy.js +11 -7
- package/dist/build-strategy.js.map +1 -1
- package/dist/bun-build.d.ts +2 -2
- package/dist/bun-build.d.ts.map +1 -1
- package/dist/bun-build.js +9 -7
- package/dist/bun-build.js.map +1 -1
- package/dist/compute-client.d.ts.map +1 -1
- package/dist/compute-client.js +17 -29
- package/dist/compute-client.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/nextjs-build.d.ts +2 -2
- package/dist/nextjs-build.d.ts.map +1 -1
- package/dist/nextjs-build.js +8 -4
- package/dist/nextjs-build.js.map +1 -1
- package/dist/nuxt-build.d.ts +2 -2
- package/dist/nuxt-build.d.ts.map +1 -1
- package/dist/nuxt-build.js +6 -4
- package/dist/nuxt-build.js.map +1 -1
- package/dist/tanstack-start-build.d.ts +2 -2
- package/dist/tanstack-start-build.d.ts.map +1 -1
- package/dist/tanstack-start-build.js +5 -3
- package/dist/tanstack-start-build.js.map +1 -1
- package/dist/upload-artifact.d.ts +5 -0
- package/dist/upload-artifact.d.ts.map +1 -0
- package/dist/upload-artifact.js +27 -0
- package/dist/upload-artifact.js.map +1 -0
- package/package.json +1 -1
- package/src/api-client.ts +24 -8
- package/src/archive.ts +42 -10
- package/src/artifact-postprocess.ts +74 -0
- package/src/astro-build.ts +6 -4
- package/src/auto-build.ts +7 -5
- package/src/build-strategy.ts +14 -6
- package/src/bun-build.ts +13 -6
- package/src/compute-client.ts +21 -31
- package/src/index.ts +3 -0
- package/src/nextjs-build.ts +9 -4
- package/src/nuxt-build.ts +6 -4
- package/src/tanstack-start-build.ts +5 -3
- package/src/upload-artifact.ts +30 -0
package/src/nextjs-build.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cp, mkdtemp, readdir, rm, stat } from "node:fs/promises";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { normalizeArtifactSymlinks } from "./artifact-postprocess.ts";
|
|
4
5
|
import type { BuildArtifact, BuildStrategy } from "./build-strategy.ts";
|
|
5
6
|
import {
|
|
6
7
|
hasPackageDependency,
|
|
@@ -26,14 +27,15 @@ export class NextjsBuild implements BuildStrategy {
|
|
|
26
27
|
this.#appPath = options.appPath;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
async canBuild(): Promise<boolean> {
|
|
30
|
+
async canBuild(signal?: AbortSignal): Promise<boolean> {
|
|
30
31
|
return (
|
|
31
|
-
(await hasRootFile(this.#appPath, NEXT_CONFIG_FILENAMES)) ||
|
|
32
|
-
(await hasPackageDependency(this.#appPath, ["next"]))
|
|
32
|
+
(await hasRootFile(this.#appPath, NEXT_CONFIG_FILENAMES, signal)) ||
|
|
33
|
+
(await hasPackageDependency(this.#appPath, ["next"], signal))
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
async execute(): Promise<BuildArtifact> {
|
|
37
|
+
async execute(signal?: AbortSignal): Promise<BuildArtifact> {
|
|
38
|
+
signal?.throwIfAborted();
|
|
37
39
|
await runPackageCli({
|
|
38
40
|
appPath: this.#appPath,
|
|
39
41
|
cliName: "next",
|
|
@@ -41,6 +43,7 @@ export class NextjsBuild implements BuildStrategy {
|
|
|
41
43
|
failurePrefix: "Next.js",
|
|
42
44
|
missingMessage:
|
|
43
45
|
"Could not find the Next.js CLI. Install it with `npm install next` or ensure npx/bunx is available.",
|
|
46
|
+
signal,
|
|
44
47
|
});
|
|
45
48
|
|
|
46
49
|
const standaloneDir = path.join(this.#appPath, ".next", "standalone");
|
|
@@ -93,6 +96,8 @@ export class NextjsBuild implements BuildStrategy {
|
|
|
93
96
|
? "server.js"
|
|
94
97
|
: path.posix.join(serverSubpath, "server.js");
|
|
95
98
|
|
|
99
|
+
await normalizeArtifactSymlinks(artifactDir, this.#appPath, signal);
|
|
100
|
+
|
|
96
101
|
return {
|
|
97
102
|
directory: artifactDir,
|
|
98
103
|
entrypoint,
|
package/src/nuxt-build.ts
CHANGED
|
@@ -27,14 +27,15 @@ export class NuxtBuild implements BuildStrategy {
|
|
|
27
27
|
this.#appPath = options.appPath;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
async canBuild(): Promise<boolean> {
|
|
30
|
+
async canBuild(signal?: AbortSignal): Promise<boolean> {
|
|
31
31
|
return (
|
|
32
|
-
(await hasRootFile(this.#appPath, NUXT_CONFIG_FILENAMES)) ||
|
|
33
|
-
(await hasPackageDependency(this.#appPath, ["nuxt"]))
|
|
32
|
+
(await hasRootFile(this.#appPath, NUXT_CONFIG_FILENAMES, signal)) ||
|
|
33
|
+
(await hasPackageDependency(this.#appPath, ["nuxt"], signal))
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
async execute(): Promise<BuildArtifact> {
|
|
37
|
+
async execute(signal?: AbortSignal): Promise<BuildArtifact> {
|
|
38
|
+
signal?.throwIfAborted();
|
|
38
39
|
await runPackageCli({
|
|
39
40
|
appPath: this.#appPath,
|
|
40
41
|
cliName: "nuxt",
|
|
@@ -42,6 +43,7 @@ export class NuxtBuild implements BuildStrategy {
|
|
|
42
43
|
failurePrefix: "Nuxt",
|
|
43
44
|
missingMessage:
|
|
44
45
|
"Could not find the Nuxt CLI. Install it with `npm install nuxt` or ensure npx/bunx is available.",
|
|
46
|
+
signal,
|
|
45
47
|
});
|
|
46
48
|
|
|
47
49
|
const outputDir = path.join(this.#appPath, ".output");
|
|
@@ -20,11 +20,12 @@ export class TanstackStartBuild implements BuildStrategy {
|
|
|
20
20
|
this.#appPath = options.appPath;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async canBuild(): Promise<boolean> {
|
|
24
|
-
return hasPackageDependency(this.#appPath, TANSTACK_START_PACKAGES);
|
|
23
|
+
async canBuild(signal?: AbortSignal): Promise<boolean> {
|
|
24
|
+
return hasPackageDependency(this.#appPath, TANSTACK_START_PACKAGES, signal);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
async execute(): Promise<BuildArtifact> {
|
|
27
|
+
async execute(signal?: AbortSignal): Promise<BuildArtifact> {
|
|
28
|
+
signal?.throwIfAborted();
|
|
28
29
|
await runPackageCli({
|
|
29
30
|
appPath: this.#appPath,
|
|
30
31
|
cliName: "vite",
|
|
@@ -32,6 +33,7 @@ export class TanstackStartBuild implements BuildStrategy {
|
|
|
32
33
|
failurePrefix: "TanStack Start",
|
|
33
34
|
missingMessage:
|
|
34
35
|
"Could not find the Vite CLI. Install it with `npm install vite` or ensure npx/bunx is available.",
|
|
36
|
+
signal,
|
|
35
37
|
});
|
|
36
38
|
|
|
37
39
|
const outputDir = path.join(this.#appPath, ".output");
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PUT a gzipped compute artifact to a Foundry-minted presigned upload URL.
|
|
3
|
+
*/
|
|
4
|
+
export async function uploadArtifact(
|
|
5
|
+
uploadUrl: string,
|
|
6
|
+
body: Uint8Array,
|
|
7
|
+
signal?: AbortSignal,
|
|
8
|
+
): Promise<void> {
|
|
9
|
+
signal?.throwIfAborted();
|
|
10
|
+
// Intentionally do not pass AbortSignal to this mutating upload request.
|
|
11
|
+
// Aborting transport can leave completion ambiguous server-side.
|
|
12
|
+
const response = await fetch(uploadUrl, {
|
|
13
|
+
method: "PUT",
|
|
14
|
+
headers: { "content-type": "application/gzip" },
|
|
15
|
+
body,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
let message = `Artifact upload failed with HTTP ${response.status}`;
|
|
20
|
+
try {
|
|
21
|
+
const json = (await response.json()) as { error?: unknown };
|
|
22
|
+
if (typeof json.error === "string" && json.error.length > 0) {
|
|
23
|
+
message = `Artifact upload failed: ${json.error}`;
|
|
24
|
+
}
|
|
25
|
+
} catch {
|
|
26
|
+
// ignore body parse failures
|
|
27
|
+
}
|
|
28
|
+
throw new Error(message);
|
|
29
|
+
}
|
|
30
|
+
}
|