@telorun/cli 0.42.0 → 0.43.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/bundle/extract.d.ts +15 -8
- package/dist/bundle/extract.d.ts.map +1 -1
- package/dist/bundle/extract.js +32 -78
- package/dist/bundle/extract.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +6 -3
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/module.d.ts +3 -0
- package/dist/commands/module.d.ts.map +1 -0
- package/dist/commands/module.js +331 -0
- package/dist/commands/module.js.map +1 -0
- package/dist/commands/publish.d.ts +4 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +113 -128
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +6 -13
- package/dist/commands/upgrade.js.map +1 -1
- package/package.json +5 -5
- package/dist/bundle/files-integrity.d.ts +0 -19
- package/dist/bundle/files-integrity.d.ts.map +0 -1
- package/dist/bundle/files-integrity.js +0 -27
- package/dist/bundle/files-integrity.js.map +0 -1
- package/dist/bundle/tar.d.ts +0 -15
- package/dist/bundle/tar.d.ts.map +0 -1
- package/dist/bundle/tar.js +0 -54
- package/dist/bundle/tar.js.map +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { sha256Base64Url } from "@telorun/analyzer";
|
|
2
|
-
const MANIFEST_FILENAME = "telo.yaml";
|
|
3
|
-
/**
|
|
4
|
-
* Canonical per-file content digest of a module's `files:` payload — the value
|
|
5
|
-
* of `filesIntegrity` in a bundle's `telo.yaml`. SHA-256 over the sorted
|
|
6
|
-
* `<path>\0<sha256(content)>` lines of every payload file, `telo.yaml`
|
|
7
|
-
* excluded (the importer's `#sha256-...` hash already covers the manifest, and
|
|
8
|
-
* excluding it breaks the self-reference — the manifest embeds this value).
|
|
9
|
-
*
|
|
10
|
-
* Hashing file *contents* rather than the tar/gzip bytes makes the digest
|
|
11
|
-
* independent of archive framing, so publisher and client compute the same
|
|
12
|
-
* value from the same file set, and it can be re-derived from the extracted
|
|
13
|
-
* files on disk. Returns `sha256-<base64url>`.
|
|
14
|
-
*/
|
|
15
|
-
export async function computeFilesIntegrity(files) {
|
|
16
|
-
const lines = [];
|
|
17
|
-
for (const file of files) {
|
|
18
|
-
if (file.name === MANIFEST_FILENAME)
|
|
19
|
-
continue;
|
|
20
|
-
const bytes = file.content instanceof Uint8Array ? file.content : new Uint8Array(file.content);
|
|
21
|
-
lines.push(`${file.name}\0${await sha256Base64Url(bytes)}`);
|
|
22
|
-
}
|
|
23
|
-
lines.sort();
|
|
24
|
-
const canonical = new TextEncoder().encode(lines.join("\n"));
|
|
25
|
-
return `sha256-${await sha256Base64Url(canonical)}`;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=files-integrity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files-integrity.js","sourceRoot":"","sources":["../../src/bundle/files-integrity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAQtC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,KAAoB;IAC9D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB;YAAE,SAAS;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,YAAY,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/F,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,MAAM,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,KAAK,CAAC,IAAI,EAAE,CAAC;IACb,MAAM,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,OAAO,UAAU,MAAM,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
package/dist/bundle/tar.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface BundleEntry {
|
|
2
|
-
/** POSIX-relative path inside the archive (e.g. `telo.yaml`, `public/app.js`). */
|
|
3
|
-
name: string;
|
|
4
|
-
content: Buffer | string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Pack `entries` into a gzipped tar (`module.tar.gz`). The CLI's own writer —
|
|
8
|
-
* deliberately not the runner's `apps/k8s-runner/src/tar.ts`, which is coupled
|
|
9
|
-
* to `@telorun/runner-core`'s `RunBundle`. Artifacts are small (a manifest plus
|
|
10
|
-
* a built frontend), so buffering the whole archive before gzip is fine.
|
|
11
|
-
*/
|
|
12
|
-
export declare function makeTarGz(entries: BundleEntry[]): Promise<Buffer>;
|
|
13
|
-
/** Decompress + untar a `module.tar.gz` buffer into its file entries. */
|
|
14
|
-
export declare function readTarGz(buf: Buffer): Promise<BundleEntry[]>;
|
|
15
|
-
//# sourceMappingURL=tar.d.ts.map
|
package/dist/bundle/tar.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../src/bundle/tar.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBvE;AAED,yEAAyE;AACzE,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CA0BnE"}
|
package/dist/bundle/tar.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { extract as tarExtract, pack as tarPack } from "tar-stream";
|
|
2
|
-
import { gunzipSync, gzipSync } from "node:zlib";
|
|
3
|
-
import { Readable } from "node:stream";
|
|
4
|
-
/**
|
|
5
|
-
* Pack `entries` into a gzipped tar (`module.tar.gz`). The CLI's own writer —
|
|
6
|
-
* deliberately not the runner's `apps/k8s-runner/src/tar.ts`, which is coupled
|
|
7
|
-
* to `@telorun/runner-core`'s `RunBundle`. Artifacts are small (a manifest plus
|
|
8
|
-
* a built frontend), so buffering the whole archive before gzip is fine.
|
|
9
|
-
*/
|
|
10
|
-
export async function makeTarGz(entries) {
|
|
11
|
-
const pack = tarPack();
|
|
12
|
-
const chunks = [];
|
|
13
|
-
pack.on("data", (c) => chunks.push(c));
|
|
14
|
-
const done = new Promise((resolve, reject) => {
|
|
15
|
-
pack.on("end", resolve);
|
|
16
|
-
pack.on("error", reject);
|
|
17
|
-
});
|
|
18
|
-
for (const entry of entries) {
|
|
19
|
-
const buf = typeof entry.content === "string" ? Buffer.from(entry.content, "utf-8") : entry.content;
|
|
20
|
-
await new Promise((resolve, reject) => {
|
|
21
|
-
pack.entry({ name: entry.name }, buf, (err) => (err ? reject(err) : resolve()));
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
pack.finalize();
|
|
25
|
-
await done;
|
|
26
|
-
return gzipSync(Buffer.concat(chunks));
|
|
27
|
-
}
|
|
28
|
-
/** Decompress + untar a `module.tar.gz` buffer into its file entries. */
|
|
29
|
-
export async function readTarGz(buf) {
|
|
30
|
-
const tar = gunzipSync(buf);
|
|
31
|
-
const ex = tarExtract();
|
|
32
|
-
const entries = [];
|
|
33
|
-
await new Promise((resolve, reject) => {
|
|
34
|
-
ex.on("entry", (header, stream, next) => {
|
|
35
|
-
if (header.type !== "file") {
|
|
36
|
-
stream.on("end", next);
|
|
37
|
-
stream.resume();
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const chunks = [];
|
|
41
|
-
stream.on("data", (c) => chunks.push(c));
|
|
42
|
-
stream.on("end", () => {
|
|
43
|
-
entries.push({ name: header.name, content: Buffer.concat(chunks) });
|
|
44
|
-
next();
|
|
45
|
-
});
|
|
46
|
-
stream.on("error", reject);
|
|
47
|
-
});
|
|
48
|
-
ex.on("finish", resolve);
|
|
49
|
-
ex.on("error", reject);
|
|
50
|
-
Readable.from(tar).pipe(ex);
|
|
51
|
-
});
|
|
52
|
-
return entries;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=tar.js.map
|
package/dist/bundle/tar.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tar.js","sourceRoot":"","sources":["../../src/bundle/tar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAsB;IACpD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/C,MAAM,IAAI,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACjD,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACxB,IA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