@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.mjs
CHANGED
|
@@ -327,7 +327,7 @@ function isIncludedInContentHash(relPath, includeAllRootFiles) {
|
|
|
327
327
|
if (name.startsWith(".")) return false;
|
|
328
328
|
if (parts.includes("__pycache__")) return false;
|
|
329
329
|
if (dirParts.length === 0) {
|
|
330
|
-
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || name
|
|
330
|
+
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || BROAD_ROOT_MARKERS.includes(name) || name.endsWith(".py");
|
|
331
331
|
}
|
|
332
332
|
return !dirParts.some(isExcludedDirComponent);
|
|
333
333
|
}
|
|
@@ -338,7 +338,9 @@ function collectArchiveRelPaths(dir) {
|
|
|
338
338
|
);
|
|
339
339
|
}
|
|
340
340
|
const out = [];
|
|
341
|
-
const includeAllRootFiles =
|
|
341
|
+
const includeAllRootFiles = BROAD_ROOT_MARKERS.some(
|
|
342
|
+
(marker) => fs.existsSync(path.join(dir, marker))
|
|
343
|
+
);
|
|
342
344
|
const walk = (rel) => {
|
|
343
345
|
const abs = rel ? path.join(dir, rel) : dir;
|
|
344
346
|
for (const entry of fs.readdirSync(abs, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -499,7 +501,7 @@ async function push(dir, opts = {}) {
|
|
|
499
501
|
if (!fs.statSync(dir).isDirectory()) throw new Error(`Not a directory: ${dir}`);
|
|
500
502
|
const localMeta = readLocalMeta(dir) ?? {};
|
|
501
503
|
const branch = opts.branch ?? localMeta.branch ?? DEFAULT_BRANCH;
|
|
502
|
-
const baseVersionId = localMeta.versionId ?? null;
|
|
504
|
+
const baseVersionId = opts.baseVersionId ?? localMeta.versionId ?? null;
|
|
503
505
|
const contentHash = computeContentHash(dir);
|
|
504
506
|
const pyproject = readPyproject(dir);
|
|
505
507
|
const slug = opts.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
|
|
@@ -652,7 +654,7 @@ async function createRef(slug, name, kind, versionId, options = {}) {
|
|
|
652
654
|
...versionId ? { versionId } : {}
|
|
653
655
|
});
|
|
654
656
|
}
|
|
655
|
-
var DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, sha256b64;
|
|
657
|
+
var DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, BROAD_ROOT_MARKERS, sha256b64;
|
|
656
658
|
var init_hub = __esm({
|
|
657
659
|
"src/worlds/hub.ts"() {
|
|
658
660
|
"use strict";
|
|
@@ -670,6 +672,7 @@ var init_hub = __esm({
|
|
|
670
672
|
"outputs"
|
|
671
673
|
]);
|
|
672
674
|
ROOT_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["dist", "build", "outputs", "__pycache__"]);
|
|
675
|
+
BROAD_ROOT_MARKERS = ["gateway-env.toml", "gateway-api-world.toml"];
|
|
673
676
|
sha256b64 = (data) => createHash("sha256").update(data).digest("base64");
|
|
674
677
|
}
|
|
675
678
|
});
|
|
@@ -733,9 +736,24 @@ async function validateWorld(dir, opts) {
|
|
|
733
736
|
"No branch to validate on: pass --branch or run inside a git checkout / GitHub Actions."
|
|
734
737
|
);
|
|
735
738
|
progress(`pushing ${dir} as ${opts.slug ?? "(pyproject name)"}@${branch}\u2026`);
|
|
739
|
+
let tipVersionId = null;
|
|
740
|
+
if (opts.slug) {
|
|
741
|
+
try {
|
|
742
|
+
const tip = await apiRequest(
|
|
743
|
+
options,
|
|
744
|
+
"POST",
|
|
745
|
+
"/api/public/benchmark-containers/resolve-version",
|
|
746
|
+
{ slug: opts.slug, ref: branch }
|
|
747
|
+
);
|
|
748
|
+
tipVersionId = tip.versionId ?? null;
|
|
749
|
+
} catch {
|
|
750
|
+
tipVersionId = null;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
736
753
|
const pushed = await push(dir, {
|
|
737
754
|
slug: opts.slug,
|
|
738
755
|
branch,
|
|
756
|
+
baseVersionId: tipVersionId,
|
|
739
757
|
message: `PR validation push (${provenance.commit?.slice(0, 12) ?? "local"})`,
|
|
740
758
|
...provenance.actor?.name ? { author: provenance.actor.name } : {},
|
|
741
759
|
options
|