@withgateway/sdk 0.1.17 → 0.1.19
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/cli.js +22 -4
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +22 -4
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -5
- package/dist/index.mjs.map +1 -1
- package/dist/tracing/index.js +1 -1
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +1 -1
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +5 -0
- package/dist/worlds/index.d.ts +5 -0
- package/dist/worlds/index.js +22 -4
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +22 -4
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -336,7 +336,7 @@ function isIncludedInContentHash(relPath, includeAllRootFiles) {
|
|
|
336
336
|
if (name.startsWith(".")) return false;
|
|
337
337
|
if (parts.includes("__pycache__")) return false;
|
|
338
338
|
if (dirParts.length === 0) {
|
|
339
|
-
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || name
|
|
339
|
+
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || BROAD_ROOT_MARKERS.includes(name) || name.endsWith(".py");
|
|
340
340
|
}
|
|
341
341
|
return !dirParts.some(isExcludedDirComponent);
|
|
342
342
|
}
|
|
@@ -347,7 +347,9 @@ function collectArchiveRelPaths(dir) {
|
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
349
|
const out = [];
|
|
350
|
-
const includeAllRootFiles =
|
|
350
|
+
const includeAllRootFiles = BROAD_ROOT_MARKERS.some(
|
|
351
|
+
(marker) => fs.existsSync(path.join(dir, marker))
|
|
352
|
+
);
|
|
351
353
|
const walk = (rel) => {
|
|
352
354
|
const abs = rel ? path.join(dir, rel) : dir;
|
|
353
355
|
for (const entry of fs.readdirSync(abs, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -508,7 +510,7 @@ async function push(dir, opts = {}) {
|
|
|
508
510
|
if (!fs.statSync(dir).isDirectory()) throw new Error(`Not a directory: ${dir}`);
|
|
509
511
|
const localMeta = readLocalMeta(dir) ?? {};
|
|
510
512
|
const branch = opts.branch ?? localMeta.branch ?? DEFAULT_BRANCH;
|
|
511
|
-
const baseVersionId = localMeta.versionId ?? null;
|
|
513
|
+
const baseVersionId = opts.baseVersionId ?? localMeta.versionId ?? null;
|
|
512
514
|
const contentHash = computeContentHash(dir);
|
|
513
515
|
const pyproject = readPyproject(dir);
|
|
514
516
|
const slug = opts.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
|
|
@@ -661,7 +663,7 @@ async function createRef(slug, name, kind, versionId, options = {}) {
|
|
|
661
663
|
...versionId ? { versionId } : {}
|
|
662
664
|
});
|
|
663
665
|
}
|
|
664
|
-
var import_node_crypto, import_node_zlib, fs, path, DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, sha256b64;
|
|
666
|
+
var import_node_crypto, import_node_zlib, fs, path, DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, BROAD_ROOT_MARKERS, sha256b64;
|
|
665
667
|
var init_hub = __esm({
|
|
666
668
|
"src/worlds/hub.ts"() {
|
|
667
669
|
"use strict";
|
|
@@ -683,6 +685,7 @@ var init_hub = __esm({
|
|
|
683
685
|
"outputs"
|
|
684
686
|
]);
|
|
685
687
|
ROOT_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["dist", "build", "outputs", "__pycache__"]);
|
|
688
|
+
BROAD_ROOT_MARKERS = ["gateway-env.toml", "gateway-api-world.toml"];
|
|
686
689
|
sha256b64 = (data) => (0, import_node_crypto.createHash)("sha256").update(data).digest("base64");
|
|
687
690
|
}
|
|
688
691
|
});
|
|
@@ -746,9 +749,24 @@ async function validateWorld(dir, opts) {
|
|
|
746
749
|
"No branch to validate on: pass --branch or run inside a git checkout / GitHub Actions."
|
|
747
750
|
);
|
|
748
751
|
progress(`pushing ${dir} as ${opts.slug ?? "(pyproject name)"}@${branch}\u2026`);
|
|
752
|
+
let tipVersionId = null;
|
|
753
|
+
if (opts.slug) {
|
|
754
|
+
try {
|
|
755
|
+
const tip = await apiRequest(
|
|
756
|
+
options,
|
|
757
|
+
"POST",
|
|
758
|
+
"/api/public/benchmark-containers/resolve-version",
|
|
759
|
+
{ slug: opts.slug, ref: branch }
|
|
760
|
+
);
|
|
761
|
+
tipVersionId = tip.versionId ?? null;
|
|
762
|
+
} catch {
|
|
763
|
+
tipVersionId = null;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
749
766
|
const pushed = await push(dir, {
|
|
750
767
|
slug: opts.slug,
|
|
751
768
|
branch,
|
|
769
|
+
baseVersionId: tipVersionId,
|
|
752
770
|
message: `PR validation push (${provenance.commit?.slice(0, 12) ?? "local"})`,
|
|
753
771
|
...provenance.actor?.name ? { author: provenance.actor.name } : {},
|
|
754
772
|
options
|