@hyperframes/gcp-cloud-run 0.8.176 → 0.8.178
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/gcsTransport.d.ts +1 -1
- package/dist/index.js +9 -5
- package/dist/sdk/index.js +9 -5
- package/dist/server.js +5 -2
- package/package.json +2 -2
package/dist/gcsTransport.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare function sha256File(path: string): Promise<string>;
|
|
|
54
54
|
* package (pure JS over `node:zlib`) rather than spawning a system tar
|
|
55
55
|
* binary so the archive format is independent of the container's userland.
|
|
56
56
|
*/
|
|
57
|
-
export declare function tarDirectory(sourceDir: string, destTarball: string): Promise<void>;
|
|
57
|
+
export declare function tarDirectory(sourceDir: string, destTarball: string, files?: string[]): Promise<void>;
|
|
58
58
|
/**
|
|
59
59
|
* Extract a `.tar.gz` produced by {@link tarDirectory} into `destDir`.
|
|
60
60
|
* The directory is created (or cleared) before extraction so a retried
|
package/dist/index.js
CHANGED
|
@@ -212,12 +212,15 @@ function isGcsPreconditionFailed(error) {
|
|
|
212
212
|
if (!error || typeof error !== "object") return false;
|
|
213
213
|
return error.code === 412;
|
|
214
214
|
}
|
|
215
|
-
async function tarDirectory(sourceDir, destTarball) {
|
|
215
|
+
async function tarDirectory(sourceDir, destTarball, files) {
|
|
216
216
|
if (!existsSync2(sourceDir) || !statSync(sourceDir).isDirectory()) {
|
|
217
217
|
throw new Error(`[gcsTransport] tar source must be an existing directory: ${sourceDir}`);
|
|
218
218
|
}
|
|
219
219
|
mkdirSync(dirname(destTarball), { recursive: true });
|
|
220
|
-
await tar.create(
|
|
220
|
+
await tar.create(
|
|
221
|
+
{ gzip: true, file: destTarball, cwd: sourceDir, follow: files !== void 0 },
|
|
222
|
+
files ?? ["."]
|
|
223
|
+
);
|
|
221
224
|
}
|
|
222
225
|
async function untarDirectory(tarballPath, destDir) {
|
|
223
226
|
if (!existsSync2(tarballPath)) {
|
|
@@ -949,12 +952,13 @@ import { mkdtempSync as mkdtempSync3, rmSync as rmSync4, statSync as statSync4 }
|
|
|
949
952
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
950
953
|
import { join as join3 } from "node:path";
|
|
951
954
|
import { Storage as Storage2 } from "@google-cloud/storage";
|
|
952
|
-
import { hashProjectDir } from "@hyperframes/producer/distributed";
|
|
955
|
+
import { hashProjectDir, listSiteFiles } from "@hyperframes/producer/distributed";
|
|
953
956
|
async function deploySite(opts) {
|
|
954
957
|
if (!statSync4(opts.projectDir).isDirectory()) {
|
|
955
958
|
throw new Error(`[deploySite] projectDir is not a directory: ${opts.projectDir}`);
|
|
956
959
|
}
|
|
957
|
-
const
|
|
960
|
+
const files = listSiteFiles(opts.projectDir);
|
|
961
|
+
const siteId = opts.siteId ?? hashProjectDir(opts.projectDir, files);
|
|
958
962
|
const key = `sites/${siteId}/project.tar.gz`;
|
|
959
963
|
const projectGcsUri = formatGcsUri({ bucket: opts.bucketName, key });
|
|
960
964
|
const storage = opts.storage ?? new Storage2();
|
|
@@ -973,7 +977,7 @@ async function deploySite(opts) {
|
|
|
973
977
|
const workdir = mkdtempSync3(join3(tmpdir3(), "hf-deploy-site-"));
|
|
974
978
|
try {
|
|
975
979
|
const tarball = join3(workdir, "project.tar.gz");
|
|
976
|
-
await tarDirectory(opts.projectDir, tarball);
|
|
980
|
+
await tarDirectory(opts.projectDir, tarball, files);
|
|
977
981
|
const size = statSync4(tarball).size;
|
|
978
982
|
await uploadFileToGcs(storage, tarball, projectGcsUri, "application/gzip");
|
|
979
983
|
return {
|
package/dist/sdk/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { mkdtempSync, rmSync as rmSync2, statSync as statSync2 } from "node:fs";
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { Storage } from "@google-cloud/storage";
|
|
6
|
-
import { hashProjectDir } from "@hyperframes/producer/distributed";
|
|
6
|
+
import { hashProjectDir, listSiteFiles } from "@hyperframes/producer/distributed";
|
|
7
7
|
|
|
8
8
|
// src/gcsTransport.ts
|
|
9
9
|
import {
|
|
@@ -49,12 +49,15 @@ async function uploadFileToGcs(storage, localPath, uri, contentType) {
|
|
|
49
49
|
contentType
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
async function tarDirectory(sourceDir, destTarball) {
|
|
52
|
+
async function tarDirectory(sourceDir, destTarball, files) {
|
|
53
53
|
if (!existsSync(sourceDir) || !statSync(sourceDir).isDirectory()) {
|
|
54
54
|
throw new Error(`[gcsTransport] tar source must be an existing directory: ${sourceDir}`);
|
|
55
55
|
}
|
|
56
56
|
mkdirSync(dirname(destTarball), { recursive: true });
|
|
57
|
-
await tar.create(
|
|
57
|
+
await tar.create(
|
|
58
|
+
{ gzip: true, file: destTarball, cwd: sourceDir, follow: files !== void 0 },
|
|
59
|
+
files ?? ["."]
|
|
60
|
+
);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
// src/sdk/deploySite.ts
|
|
@@ -62,7 +65,8 @@ async function deploySite(opts) {
|
|
|
62
65
|
if (!statSync2(opts.projectDir).isDirectory()) {
|
|
63
66
|
throw new Error(`[deploySite] projectDir is not a directory: ${opts.projectDir}`);
|
|
64
67
|
}
|
|
65
|
-
const
|
|
68
|
+
const files = listSiteFiles(opts.projectDir);
|
|
69
|
+
const siteId = opts.siteId ?? hashProjectDir(opts.projectDir, files);
|
|
66
70
|
const key = `sites/${siteId}/project.tar.gz`;
|
|
67
71
|
const projectGcsUri = formatGcsUri({ bucket: opts.bucketName, key });
|
|
68
72
|
const storage = opts.storage ?? new Storage();
|
|
@@ -81,7 +85,7 @@ async function deploySite(opts) {
|
|
|
81
85
|
const workdir = mkdtempSync(join(tmpdir(), "hf-deploy-site-"));
|
|
82
86
|
try {
|
|
83
87
|
const tarball = join(workdir, "project.tar.gz");
|
|
84
|
-
await tarDirectory(opts.projectDir, tarball);
|
|
88
|
+
await tarDirectory(opts.projectDir, tarball, files);
|
|
85
89
|
const size = statSync2(tarball).size;
|
|
86
90
|
await uploadFileToGcs(storage, tarball, projectGcsUri, "application/gzip");
|
|
87
91
|
return {
|
package/dist/server.js
CHANGED
|
@@ -209,12 +209,15 @@ function isGcsPreconditionFailed(error) {
|
|
|
209
209
|
if (!error || typeof error !== "object") return false;
|
|
210
210
|
return error.code === 412;
|
|
211
211
|
}
|
|
212
|
-
async function tarDirectory(sourceDir, destTarball) {
|
|
212
|
+
async function tarDirectory(sourceDir, destTarball, files) {
|
|
213
213
|
if (!existsSync2(sourceDir) || !statSync(sourceDir).isDirectory()) {
|
|
214
214
|
throw new Error(`[gcsTransport] tar source must be an existing directory: ${sourceDir}`);
|
|
215
215
|
}
|
|
216
216
|
mkdirSync(dirname(destTarball), { recursive: true });
|
|
217
|
-
await tar.create(
|
|
217
|
+
await tar.create(
|
|
218
|
+
{ gzip: true, file: destTarball, cwd: sourceDir, follow: files !== void 0 },
|
|
219
|
+
files ?? ["."]
|
|
220
|
+
);
|
|
218
221
|
}
|
|
219
222
|
async function untarDirectory(tarballPath, destDir) {
|
|
220
223
|
if (!existsSync2(tarballPath)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/gcp-cloud-run",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.178",
|
|
4
4
|
"description": "Google Cloud Run + Workflows adapter for HyperFrames distributed rendering — request handler, client-side SDK, and Terraform module.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"hono": "^4.6.0",
|
|
46
46
|
"puppeteer-core": "^25.8.0",
|
|
47
47
|
"tar": "^7.4.3",
|
|
48
|
-
"@hyperframes/producer": "^0.8.
|
|
48
|
+
"@hyperframes/producer": "^0.8.178"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^25.0.10",
|