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