@withgateway/sdk 0.1.18 → 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/index.js CHANGED
@@ -513,7 +513,7 @@ async function push(dir, opts = {}) {
513
513
  if (!fs.statSync(dir).isDirectory()) throw new Error(`Not a directory: ${dir}`);
514
514
  const localMeta = readLocalMeta(dir) ?? {};
515
515
  const branch = opts.branch ?? localMeta.branch ?? DEFAULT_BRANCH;
516
- const baseVersionId = localMeta.versionId ?? null;
516
+ const baseVersionId = opts.baseVersionId ?? localMeta.versionId ?? null;
517
517
  const contentHash = computeContentHash(dir);
518
518
  const pyproject = readPyproject(dir);
519
519
  const slug = opts.slug ?? pyproject.name ?? path.basename(path.resolve(dir));
@@ -752,9 +752,24 @@ async function validateWorld(dir, opts) {
752
752
  "No branch to validate on: pass --branch or run inside a git checkout / GitHub Actions."
753
753
  );
754
754
  progress(`pushing ${dir} as ${opts.slug ?? "(pyproject name)"}@${branch}\u2026`);
755
+ let tipVersionId = null;
756
+ if (opts.slug) {
757
+ try {
758
+ const tip = await apiRequest(
759
+ options,
760
+ "POST",
761
+ "/api/public/benchmark-containers/resolve-version",
762
+ { slug: opts.slug, ref: branch }
763
+ );
764
+ tipVersionId = tip.versionId ?? null;
765
+ } catch {
766
+ tipVersionId = null;
767
+ }
768
+ }
755
769
  const pushed = await push(dir, {
756
770
  slug: opts.slug,
757
771
  branch,
772
+ baseVersionId: tipVersionId,
758
773
  message: `PR validation push (${provenance.commit?.slice(0, 12) ?? "local"})`,
759
774
  ...provenance.actor?.name ? { author: provenance.actor.name } : {},
760
775
  options
@@ -1111,7 +1126,7 @@ var require_package = __commonJS({
1111
1126
  "package.json"(exports2, module2) {
1112
1127
  module2.exports = {
1113
1128
  name: "@withgateway/sdk",
1114
- version: "0.1.18",
1129
+ version: "0.1.19",
1115
1130
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
1116
1131
  main: "./dist/index.js",
1117
1132
  module: "./dist/index.mjs",