@withpica/mcp-sdk 3.7.0 → 3.7.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.js CHANGED
@@ -432,8 +432,12 @@ class WorksResource extends BaseResource {
432
432
  * release-context, not physical-asset provenance.
433
433
  */
434
434
  async listReleases(workId) {
435
+ // request() already unwraps the route's { success, data } envelope to the
436
+ // array, so reading `.data` again yielded undefined → `[]` on every call —
437
+ // the work→releases view looked empty even when the work was attached.
438
+ // Mirrors the recordings-side fix (cea22b5e); FIX_LOG 2026-07-16 sweep.
435
439
  const result = await this.request("GET", `/admin/works/${workId}/releases`);
436
- return result?.data || [];
440
+ return Array.isArray(result) ? result : (result?.data ?? []);
437
441
  }
438
442
  /**
439
443
  * Assemble the full song dossier for one work — everything PICA holds about
@@ -1235,8 +1239,20 @@ class RecordingsResource extends BaseResource {
1235
1239
  if (prefix.length < 5)
1236
1240
  return null;
1237
1241
  try {
1238
- const result = await this.request("GET", `/admin/isrc/prefix/${prefix}`);
1239
- return result.data ?? null;
1242
+ // request() unwraps {success,data} to the registry ROW on a hit, but
1243
+ // on a MISS the route returns data:null (falsy) and `data.data || data`
1244
+ // falls back to the FULL envelope — so discriminate the shape instead
1245
+ // of retyping (FIX_LOG 2026-07-16 double-unwrap sweep; same guard as
1246
+ // AccessSimulateResource.simulate). Reading `.data` unconditionally
1247
+ // made every hit return null, silently killing prefix_intel.
1248
+ const result = (await this.request("GET", `/admin/isrc/prefix/${prefix}`));
1249
+ if (result &&
1250
+ typeof result === "object" &&
1251
+ "success" in result &&
1252
+ "data" in result) {
1253
+ return (result.data ?? null);
1254
+ }
1255
+ return result ?? null;
1240
1256
  }
1241
1257
  catch {
1242
1258
  return null;
@@ -2174,11 +2190,12 @@ class BulkResource extends BaseResource {
2174
2190
  tags,
2175
2191
  });
2176
2192
  }
2177
- async linkArtist(workIds, personId, artistName) {
2193
+ async linkArtist(workIds, personId, artistName, dryRun) {
2178
2194
  return this.request("POST", "/admin/works/bulk-link-artist", {
2179
2195
  workIds,
2180
2196
  personId,
2181
2197
  artistName,
2198
+ dryRun: dryRun === true,
2182
2199
  });
2183
2200
  }
2184
2201
  /**
@@ -2712,6 +2729,12 @@ class CollaborationsResource extends BaseResource {
2712
2729
  * Cross-org discovery surface that lets the sender's agent invite a
2713
2730
  * collaborator by `@handle` without ever learning the recipient's
2714
2731
  * email (resolution happens server-side).
2732
+ *
2733
+ * Typed against the UNWRAPPED reality (ADR-265 lesson): BaseResource.request
2734
+ * auto-unwraps the `{success,data}` envelope, so methods see `data` itself.
2735
+ * Declaring `T = { data: X }` and returning `res.data` double-unwraps and
2736
+ * resolves `undefined` on the live wire (FIX_LOG 2026-07-16 — the
2737
+ * get_my_profile "reading 'public_handle'" crash).
2715
2738
  */
2716
2739
  class UsersResource extends BaseResource {
2717
2740
  /**
@@ -2722,27 +2745,26 @@ class UsersResource extends BaseResource {
2722
2745
  * proceed with an invite.
2723
2746
  */
2724
2747
  async findByHandle(handle) {
2725
- const res = await this.request("POST", "/admin/users/find-by-handle", { handle });
2726
- return res.data;
2748
+ return this.request("POST", "/admin/users/find-by-handle", { handle });
2727
2749
  }
2728
2750
  async setHandle(handle) {
2729
- const res = await this.request("POST", "/admin/users/handle", { handle });
2730
- return res.data;
2751
+ return this.request("POST", "/admin/users/handle", {
2752
+ handle,
2753
+ });
2731
2754
  }
2732
2755
  async clearHandle() {
2733
2756
  await this.request("DELETE", "/admin/users/handle");
2734
2757
  }
2735
2758
  async getMyProfile() {
2736
- const res = await this.request("GET", "/admin/users/profile");
2737
- return res.data;
2759
+ return this.request("GET", "/admin/users/profile");
2738
2760
  }
2739
2761
  async setBio(bio) {
2740
- const res = await this.request("POST", "/admin/users/bio", { bio });
2741
- return res.data;
2762
+ return this.request("POST", "/admin/users/bio", {
2763
+ bio,
2764
+ });
2742
2765
  }
2743
2766
  async setAvatarUrl(avatarUrl) {
2744
- const res = await this.request("POST", "/admin/users/avatar", { avatar_url: avatarUrl });
2745
- return res.data;
2767
+ return this.request("POST", "/admin/users/avatar", { avatar_url: avatarUrl });
2746
2768
  }
2747
2769
  /**
2748
2770
  * Copy `people.biography` into `user_profiles.bio`. Returns the new
@@ -2752,8 +2774,7 @@ class UsersResource extends BaseResource {
2752
2774
  * `overwrite: true`.
2753
2775
  */
2754
2776
  async importBioFromPerson(params) {
2755
- const res = await this.request("POST", "/admin/users/import-bio-from-person", params ?? {});
2756
- return res.data;
2777
+ return this.request("POST", "/admin/users/import-bio-from-person", params ?? {});
2757
2778
  }
2758
2779
  }
2759
2780
  class DirectoryResource extends BaseResource {