@comfyorg/sdk 0.1.2 → 0.1.3

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.
@@ -27,13 +27,9 @@
27
27
  */
28
28
  import { errorFromEnvelope } from "./errors.js";
29
29
  import { iterateSse } from "./sse.js";
30
+ import { SDK_VERSION } from "./version.js";
30
31
  const API_PREFIX = "/api/v2";
31
32
  const DEFAULT_TIMEOUT_MS = 30_000;
32
- // Mirrors `version` in package.json. Hand-kept in sync: this package builds
33
- // with plain `tsc` (no bundler/codegen step to inline it), and importing
34
- // `../../package.json` directly would step outside `tsc`'s configured
35
- // `rootDir`.
36
- const SDK_VERSION = "0.1.0";
37
33
  function looksLikePath(value) {
38
34
  return value.startsWith("http") || value.startsWith("/");
39
35
  }
@@ -102,8 +98,17 @@ export class ComfyLow {
102
98
  urlFor(path) {
103
99
  if (path.startsWith("http"))
104
100
  return path;
105
- if (path.startsWith("/api/"))
106
- return this.baseUrl + path;
101
+ // A server link (job.urls.*, marked by containing /api/) already carries
102
+ // the server's mount prefix, so it resolves against the origin — joining
103
+ // it to baseUrl would double the prefix on a prefix-mounted surface.
104
+ if (path.startsWith("/") && path.includes("/api/")) {
105
+ try {
106
+ return new URL(this.baseUrl).origin + path;
107
+ }
108
+ catch {
109
+ return this.baseUrl + path;
110
+ }
111
+ }
107
112
  return this.baseUrl + API_PREFIX + path;
108
113
  }
109
114
  /**
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "0.1.3";
@@ -0,0 +1,2 @@
1
+ // GENERATED by scripts/gen-version.mjs from package.json — do not edit.
2
+ export const SDK_VERSION = "0.1.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfyorg/sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "description": "TypeScript SDK for running ComfyUI workflows via the Comfy API v2 (self-hosted, Comfy Cloud, serverless).",
6
6
  "homepage": "https://github.com/Comfy-Org/ComfyTypeScriptSDK#readme",
@@ -46,7 +46,7 @@
46
46
  "node": ">=22"
47
47
  },
48
48
  "scripts": {
49
- "build": "tsc",
49
+ "build": "node scripts/gen-version.mjs && tsc",
50
50
  "generate": "openapi-ts",
51
51
  "lint": "oxlint .",
52
52
  "format": "oxfmt --write .",