@rankwrangler/http-client 0.10.0 → 0.11.0

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/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Typed tRPC client for the RankWrangler public agent API.
4
4
 
5
+ Unified search and `keyword.results` below describe prepared source changes. Database migration,
6
+ package release, and production deployment are pending.
7
+
5
8
  ```bash
6
9
  npm install @rankwrangler/http-client
7
10
  ```
@@ -19,7 +22,11 @@ const product = await client.product.get.mutate({
19
22
  asin: 'B0DV53VS61',
20
23
  });
21
24
 
22
- const search = await client.product.search.mutate({
25
+ const search = await client.product.search.query({
26
+ term: 'retro gardening shirt',
27
+ });
28
+
29
+ const observedResults = await client.keyword.results.mutate({
23
30
  term: 'retro gardening shirt',
24
31
  });
25
32
 
@@ -35,12 +42,14 @@ const keywords = await client.keyword.search.query({
35
42
  });
36
43
  ```
37
44
 
38
- The client is scoped to the public surface (`api.public.*`). It exposes Product
39
- `get/search/history` and keyword `get/search/history`; it does not expose Catalog, Operation,
40
- polling procedures. Product `get` and `history`, plus keyword reads, expose no refresh controls;
41
- Product search retains its separate search contract. Product `get` returns the provider-neutral
42
- current Product shape; Product `history` returns compact rank/price series. `NOT_FOUND` and retryable
43
- `TIMEOUT` errors are preserved from tRPC, with retry hints on temporary unavailability.
45
+ The client is scoped to `api.public.*`. Product `search` reads the stored catalog and returns
46
+ `{ items, nextCursor, coverage }` without provider calls. Its optional term, filters, and sorting
47
+ screen compact Products with market metrics. `keyword.results` preserves dated external search
48
+ evidence and can wait for collection under the existing 24-hour reuse policy.
49
+
50
+ Product `get` returns the current Product. `getMany` returns basic listing data, and `history`
51
+ returns compact rank and price series. Brand Analytics keyword `get`, `search`, and `history`
52
+ remain separate from observed search results. Retryable `TIMEOUT` errors preserve retry hints.
44
53
 
45
54
  ## Types
46
55
 
@@ -324,7 +324,7 @@ export interface Product {
324
324
  };
325
325
  };
326
326
  }
327
- export interface ProductSearchProduct {
327
+ export interface KeywordResultsProduct {
328
328
  marketplaceId: string;
329
329
  asin: string;
330
330
  title: string | null;
@@ -348,12 +348,12 @@ export interface ProductSearchProduct {
348
348
  } | null;
349
349
  boughtInPastMonth: number | null;
350
350
  }
351
- export interface ProductSearch {
351
+ export interface KeywordResults {
352
352
  keyword: string;
353
353
  searchedAt: string;
354
354
  results: Array<{
355
355
  organicSearchPlacement: number;
356
- product: ProductSearchProduct;
356
+ product: KeywordResultsProduct;
357
357
  }>;
358
358
  }
359
359
  export interface BasicProduct {
@@ -517,6 +517,14 @@ export declare const publicAppRouter: import("@trpc/server").TRPCBuiltRouter<{
517
517
  };
518
518
  meta: object;
519
519
  }>;
520
+ results: import("@trpc/server").TRPCMutationProcedure<{
521
+ input: {
522
+ term: string;
523
+ refresh?: boolean | undefined;
524
+ };
525
+ output: KeywordResults;
526
+ meta: object;
527
+ }>;
520
528
  history: import("@trpc/server").TRPCQueryProcedure<{
521
529
  input: {
522
530
  keyword: string;
@@ -601,12 +609,106 @@ export declare const publicAppRouter: import("@trpc/server").TRPCBuiltRouter<{
601
609
  output: PublicProductHistory;
602
610
  meta: object;
603
611
  }>;
604
- search: import("@trpc/server").TRPCMutationProcedure<{
612
+ search: import("@trpc/server").TRPCQueryProcedure<{
605
613
  input: {
606
- term: string;
607
- refresh?: boolean | undefined;
614
+ term?: string | undefined;
615
+ textFields?: "title" | "all" | undefined;
616
+ excludeWords?: string[] | undefined;
617
+ marketplaceIds?: string[] | undefined;
618
+ isMerchListing?: boolean | "unknown" | "all" | undefined;
619
+ amazonListingStatus?: "active" | "deleted" | "all" | undefined;
620
+ brands?: string[] | undefined;
621
+ excludeBrands?: string[] | undefined;
622
+ includeOfficialBrands?: boolean | undefined;
623
+ categoryIds?: number[] | undefined;
624
+ salesRank?: {
625
+ min?: number | undefined;
626
+ max?: number | undefined;
627
+ } | undefined;
628
+ price?: {
629
+ min?: number | undefined;
630
+ max?: number | undefined;
631
+ } | undefined;
632
+ monthlySold?: {
633
+ min?: number | undefined;
634
+ max?: number | undefined;
635
+ } | undefined;
636
+ firstAvailableAt?: {
637
+ after?: string | undefined;
638
+ before?: string | undefined;
639
+ } | undefined;
640
+ discoveredAt?: {
641
+ after?: string | undefined;
642
+ before?: string | undefined;
643
+ } | undefined;
644
+ updatedAt?: {
645
+ after?: string | undefined;
646
+ before?: string | undefined;
647
+ } | undefined;
648
+ facets?: {
649
+ facet: string;
650
+ name: string;
651
+ }[] | undefined;
652
+ sort?: "relevance" | "salesRankAsc" | "salesRankDesc" | "firstAvailableAtDesc" | "firstAvailableAtAsc" | "updatedAtAsc" | "updatedAtDesc" | "discoveredAtDesc" | "priceAsc" | "priceDesc" | "monthlySoldDesc" | undefined;
653
+ cursor?: string | null | undefined;
654
+ limit?: number | undefined;
655
+ };
656
+ output: {
657
+ coverage: {
658
+ keyword: string;
659
+ headCheckedAt: string | null;
660
+ exploration: {
661
+ source: "spapi";
662
+ pages: number;
663
+ observedAt: string | null;
664
+ budgetLimited: boolean;
665
+ } | null;
666
+ } | null;
667
+ items: {
668
+ marketplaceId: string;
669
+ asin: string;
670
+ title: string | null;
671
+ brand: string | null;
672
+ bullet1: string | null;
673
+ bullet2: string | null;
674
+ thumbnail: {
675
+ status: "available";
676
+ url: string;
677
+ } | {
678
+ status: "unavailable";
679
+ url?: undefined;
680
+ };
681
+ isMerchListing: boolean | null;
682
+ amazonListingStatus: AmazonListingStatus;
683
+ categoryId: number | null;
684
+ salesRank: number | null;
685
+ price: {
686
+ amountMinor: number;
687
+ currencyCode: string;
688
+ } | null;
689
+ firstAvailableAt: string | null;
690
+ discoveredAt: string;
691
+ updatedAt: string;
692
+ averages: {
693
+ last30Days: number | null;
694
+ last90Days: number | null;
695
+ };
696
+ demand: {
697
+ boughtInPastMonth: number | null;
698
+ salesRankDrops: {
699
+ last30Days: number | null;
700
+ last90Days: number | null;
701
+ last180Days: number | null;
702
+ last365Days: number | null;
703
+ };
704
+ };
705
+ facets: {
706
+ facet: string;
707
+ name: string;
708
+ }[];
709
+ }[];
710
+ nextCursor: string | null;
608
711
  };
609
- output: ProductSearch;
610
712
  meta: object;
611
713
  }>;
612
714
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rankwrangler/http-client",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Typed tRPC client for RankWrangler",
5
5
  "repository": {
6
6
  "type": "git",