@honest-pitches/pitch-sdk 0.5.1 → 0.5.2

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.mjs CHANGED
@@ -16823,10 +16823,34 @@ var PitchesApi = class {
16823
16823
  intendedAudience: input.intendedAudience ?? "",
16824
16824
  visibility: input.visibility ?? "private"
16825
16825
  };
16826
+ if (input.honestyDisclosure != null && input.honestyDisclosure !== "") {
16827
+ payload.honestyDisclosure = String(input.honestyDisclosure).slice(0, 2e3);
16828
+ }
16826
16829
  if (input.categorySlug != null) payload.categorySlug = input.categorySlug;
16827
16830
  if (input.priceNote != null && input.priceNote !== "") {
16828
16831
  payload.priceNote = String(input.priceNote).slice(0, 64);
16829
16832
  }
16833
+ if (input.videoSource != null && input.videoSource !== "") {
16834
+ payload.videoSource = input.videoSource;
16835
+ }
16836
+ if (input.videoExternalId != null && input.videoExternalId !== "") {
16837
+ payload.videoExternalId = String(input.videoExternalId);
16838
+ }
16839
+ if (input.videoExternalUrl != null && input.videoExternalUrl !== "") {
16840
+ payload.videoExternalUrl = String(input.videoExternalUrl);
16841
+ }
16842
+ if (input.bunnyVideoId != null && input.bunnyVideoId !== "") {
16843
+ payload.bunnyVideoId = String(input.bunnyVideoId);
16844
+ }
16845
+ if (input.primaryVideo != null && input.primaryVideo !== "") {
16846
+ payload.primaryVideo = String(input.primaryVideo);
16847
+ }
16848
+ if (input.primaryVideoId != null && input.primaryVideoId !== "") {
16849
+ payload.primaryVideoId = String(input.primaryVideoId);
16850
+ }
16851
+ if (input.honestyDisclosure != null && input.honestyDisclosure !== "") {
16852
+ payload.honestyDisclosure = String(input.honestyDisclosure).slice(0, 2e3);
16853
+ }
16830
16854
  const doc = await fetchPitches(this.config, {
16831
16855
  method: "POST",
16832
16856
  path: "/pitches",
@@ -16844,7 +16868,9 @@ var PitchesApi = class {
16844
16868
  async find(opts = {}) {
16845
16869
  const params = new URLSearchParams();
16846
16870
  if (opts.status) params.set("status", opts.status);
16871
+ if (opts.creatorId) params.set("creatorId", opts.creatorId);
16847
16872
  if (typeof opts.limit === "number") params.set("limit", String(opts.limit));
16873
+ if (opts.cursor) params.set("cursor", opts.cursor);
16848
16874
  const qs = params.toString();
16849
16875
  const docs = await fetchPitches(this.config, {
16850
16876
  method: "GET",
@@ -16852,6 +16878,20 @@ var PitchesApi = class {
16852
16878
  });
16853
16879
  return docs.map((d) => rowToPitch(d));
16854
16880
  }
16881
+ /**
16882
+ * Public alias for {@link PitchesApi.find}. Stable on the public
16883
+ * npm registry since `@honest-pitches/pitch-sdk@0.5.2` (2026-07-28).
16884
+ * If you see "client.pitches.list is not a function" you are on
16885
+ * an older SDK — bump to `>=0.5.2`. (The 0.5.1 tarball on npmjs
16886
+ * never shipped this alias even though the source landed under
16887
+ * that version number locally; 0.5.2 is the first published cut.)
16888
+ *
16889
+ * (Added 2026-07-27; published 2026-07-28 after the agent bug
16890
+ * report against CLI 0.5.1 / hosted MCP `list_pitches`.)
16891
+ */
16892
+ async list(opts = {}) {
16893
+ return this.find(opts);
16894
+ }
16855
16895
  async update(id, input) {
16856
16896
  const doc = await fetchPitches(this.config, {
16857
16897
  method: "PATCH",
@@ -16860,6 +16900,43 @@ var PitchesApi = class {
16860
16900
  });
16861
16901
  return rowToPitch(doc);
16862
16902
  }
16903
+ /**
16904
+ * Move a pitch through its lifecycle. The returned row carries BOTH
16905
+ * `status` (row-level persisted) and `lifecycle` (computed from
16906
+ * `status + previewToken` server-side).
16907
+ *
16908
+ * Status vs lifecycle (2026-07-28 FlexTape retest doc bundle):
16909
+ * `lifecycle` is the canonical, computed view of where the row sits
16910
+ * (`draft | preview | live | expired | archived`). It is derived
16911
+ * from `status + previewToken` server-side in
16912
+ * `honest-pitches-studio-api/legacy/pitch-write/src/handler.ts`.
16913
+ * Branch on `lifecycle` for terminal-state checks.
16914
+ *
16915
+ * The mapping is:
16916
+ * - `lifecycle: "draft"` ⟷ `status: "draft"` (no previewToken)
16917
+ * - `lifecycle: "preview"` ⟷ `status: "draft"` (previewToken set)
16918
+ * - `lifecycle: "live"` ⟷ `status: "live"`
16919
+ * - `lifecycle: "expired"` ⟷ `status: "expired"`
16920
+ * - `lifecycle: "archived"` ⟷ `status: "removed"` (intentional vocab split)
16921
+ *
16922
+ * Token gate (Finding #17, FlexTape retest):
16923
+ * `to: "preview"` requires a `previewToken` that matches the row's
16924
+ * stored token. The server returns
16925
+ * `400 previewToken is required to transition to preview`
16926
+ * when the token is missing or wrong.
16927
+ *
16928
+ * `to: "draft"` from an `archived` row ALSO requires the same
16929
+ * `previewToken` (the token is the only proof the caller owns the
16930
+ * unarchive). There is NO `archived → preview` single-step path —
16931
+ * the supported path is `archived → draft` (token required) and
16932
+ * then `draft → preview` (which may issue a NEW token).
16933
+ *
16934
+ * Visibility on archive (Finding #17, FlexTape retest):
16935
+ * `to: "archived"` does NOT touch `visibility` — the row keeps
16936
+ * whatever visibility it had at the time of the archive (usually
16937
+ * `"public"`, but `"unlisted"` is preserved too). Only `to: "live"`
16938
+ * assigns `visibility: "public"`.
16939
+ */
16863
16940
  async transition(id, input) {
16864
16941
  const doc = await fetchPitches(this.config, {
16865
16942
  method: "POST",
@@ -16887,11 +16964,56 @@ var PitchesApi = class {
16887
16964
  });
16888
16965
  return doc;
16889
16966
  }
16967
+ /**
16968
+ * List every media asset for a pitch, joining two server-side sources:
16969
+ *
16970
+ * - `pitch_assets` rows with `pitchId === id` (the explicit
16971
+ * uploads via `POST /pitcher/pitches/:id/media`).
16972
+ * - The auto-generated `thumbnailFileId` and `ogImageFileId` fields
16973
+ * on the pitch row itself (synthesised by `pitch-write`'s
16974
+ * `to=live` path; they live on the row, NOT in `pitch_assets`).
16975
+ *
16976
+ * Each result carries a `source: "pitch_assets" | "pitch_row"`
16977
+ * discriminator so consumers can tell the two apart. The server
16978
+ * may synthesise `pitch_row` rows with `sizeBytes: 0` (the auto
16979
+ * images don't carry an upload byte count — the `cdnUrl` is the
16980
+ * canonical handle).
16981
+ *
16982
+ * Added 2026-07-28 to address Bug #12 of the FlexTape retest brief
16983
+ * (`testing-feedback/2026-07-27-flextape-rerun-3surface-retest.md`).
16984
+ * Prior to this, `hp pitches media list <id>` returned `[]` for
16985
+ * every pitch whose only assets were auto-generated.
16986
+ */
16987
+ async listMedia(id) {
16988
+ return fetchPitches(this.config, {
16989
+ method: "GET",
16990
+ path: `/pitches/${encodeURIComponent(id)}/media`
16991
+ });
16992
+ }
16890
16993
  /**
16891
16994
  * Restore an archived pitch to `draft`. Same as `transition(id, {
16892
16995
  * to: "draft", previewToken })` but with a placeholder previewToken
16893
16996
  * if the caller didn't pass one. The server's "to=draft" path
16894
16997
  * mirrors the existing "to=preview" pre-condition.
16998
+ *
16999
+ * Status vs lifecycle (2026-07-28 FlexTape retest doc bundle):
17000
+ * `pitches.lifecycle` is the canonical, computed view of where
17001
+ * the row sits (`draft, preview, live, expired, archived`). It is
17002
+ * derived from `status + previewToken` server-side
17003
+ * (`honest-pitches-studio-api/legacy/pitch-write/src/handler.ts`).
17004
+ * Branch on `lifecycle` for terminal-state checks.
17005
+ *
17006
+ * The mapping is:
17007
+ * - `lifecycle: "preview"` ⟷ `status: "draft"` (previewToken set)
17008
+ * - `lifecycle: "live"` ⟷ `status: "live"`
17009
+ * - `lifecycle: "archived"` ⟷ `status: "removed"` (intentional vocab split)
17010
+ *
17011
+ * There is NO direct `archived → preview` path — the server only
17012
+ * exposes `archived → draft`. To resume preview after a draft,
17013
+ * transition twice (`archived → draft` then `draft → preview` with
17014
+ * a new preview token), or use `transition(id, { to: "preview",
17015
+ * previewToken })` directly if your `lifecycle` is `draft` (NOT
17016
+ * `archived`).
16895
17017
  */
16896
17018
  async unarchive(id, opts = {}) {
16897
17019
  return this.transition(id, {