@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/index.mjs
CHANGED
|
@@ -329,7 +329,7 @@ function isIncludedInContentHash(relPath, includeAllRootFiles) {
|
|
|
329
329
|
if (name.startsWith(".")) return false;
|
|
330
330
|
if (parts.includes("__pycache__")) return false;
|
|
331
331
|
if (dirParts.length === 0) {
|
|
332
|
-
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || name
|
|
332
|
+
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || BROAD_ROOT_MARKERS.includes(name) || name.endsWith(".py");
|
|
333
333
|
}
|
|
334
334
|
return !dirParts.some(isExcludedDirComponent);
|
|
335
335
|
}
|
|
@@ -340,7 +340,9 @@ function collectArchiveRelPaths(dir) {
|
|
|
340
340
|
);
|
|
341
341
|
}
|
|
342
342
|
const out = [];
|
|
343
|
-
const includeAllRootFiles =
|
|
343
|
+
const includeAllRootFiles = BROAD_ROOT_MARKERS.some(
|
|
344
|
+
(marker) => fs.existsSync(path.join(dir, marker))
|
|
345
|
+
);
|
|
344
346
|
const walk = (rel) => {
|
|
345
347
|
const abs = rel ? path.join(dir, rel) : dir;
|
|
346
348
|
for (const entry of fs.readdirSync(abs, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -501,7 +503,7 @@ async function push(dir, opts = {}) {
|
|
|
501
503
|
if (!fs.statSync(dir).isDirectory()) throw new Error(`Not a directory: ${dir}`);
|
|
502
504
|
const localMeta = readLocalMeta(dir) ?? {};
|
|
503
505
|
const branch = opts.branch ?? localMeta.branch ?? DEFAULT_BRANCH;
|
|
504
|
-
const baseVersionId = localMeta.versionId ?? null;
|
|
506
|
+
const baseVersionId = opts.baseVersionId ?? localMeta.versionId ?? null;
|
|
505
507
|
const contentHash = computeContentHash(dir);
|
|
506
508
|
const pyproject = readPyproject(dir);
|
|
507
509
|
const slug = opts.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
|
|
@@ -654,7 +656,7 @@ async function createRef(slug, name, kind, versionId, options = {}) {
|
|
|
654
656
|
...versionId ? { versionId } : {}
|
|
655
657
|
});
|
|
656
658
|
}
|
|
657
|
-
var DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, sha256b64;
|
|
659
|
+
var DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, BROAD_ROOT_MARKERS, sha256b64;
|
|
658
660
|
var init_hub = __esm({
|
|
659
661
|
"src/worlds/hub.ts"() {
|
|
660
662
|
"use strict";
|
|
@@ -672,6 +674,7 @@ var init_hub = __esm({
|
|
|
672
674
|
"outputs"
|
|
673
675
|
]);
|
|
674
676
|
ROOT_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["dist", "build", "outputs", "__pycache__"]);
|
|
677
|
+
BROAD_ROOT_MARKERS = ["gateway-env.toml", "gateway-api-world.toml"];
|
|
675
678
|
sha256b64 = (data) => createHash2("sha256").update(data).digest("base64");
|
|
676
679
|
}
|
|
677
680
|
});
|
|
@@ -735,9 +738,24 @@ async function validateWorld(dir, opts) {
|
|
|
735
738
|
"No branch to validate on: pass --branch or run inside a git checkout / GitHub Actions."
|
|
736
739
|
);
|
|
737
740
|
progress(`pushing ${dir} as ${opts.slug ?? "(pyproject name)"}@${branch}\u2026`);
|
|
741
|
+
let tipVersionId = null;
|
|
742
|
+
if (opts.slug) {
|
|
743
|
+
try {
|
|
744
|
+
const tip = await apiRequest(
|
|
745
|
+
options,
|
|
746
|
+
"POST",
|
|
747
|
+
"/api/public/benchmark-containers/resolve-version",
|
|
748
|
+
{ slug: opts.slug, ref: branch }
|
|
749
|
+
);
|
|
750
|
+
tipVersionId = tip.versionId ?? null;
|
|
751
|
+
} catch {
|
|
752
|
+
tipVersionId = null;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
738
755
|
const pushed = await push(dir, {
|
|
739
756
|
slug: opts.slug,
|
|
740
757
|
branch,
|
|
758
|
+
baseVersionId: tipVersionId,
|
|
741
759
|
message: `PR validation push (${provenance.commit?.slice(0, 12) ?? "local"})`,
|
|
742
760
|
...provenance.actor?.name ? { author: provenance.actor.name } : {},
|
|
743
761
|
options
|
|
@@ -1094,7 +1112,7 @@ var require_package = __commonJS({
|
|
|
1094
1112
|
"package.json"(exports, module) {
|
|
1095
1113
|
module.exports = {
|
|
1096
1114
|
name: "@withgateway/sdk",
|
|
1097
|
-
version: "0.1.
|
|
1115
|
+
version: "0.1.19",
|
|
1098
1116
|
description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
|
|
1099
1117
|
main: "./dist/index.js",
|
|
1100
1118
|
module: "./dist/index.mjs",
|