@rankwrangler/http-client 0.9.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
 
@@ -1,5 +1,6 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
+ export type AmazonListingStatus = "active" | "deleted";
3
4
  declare const rankwranglerServiceAccounts: import("drizzle-orm/pg-core").PgTableWithColumns<{
4
5
  name: "rankwrangler_service_accounts";
5
6
  schema: undefined;
@@ -273,11 +274,19 @@ export interface KeywordHistoryResponse {
273
274
  points: KeywordHistoryPoint[];
274
275
  deltas: SearchTermsTrendDeltas;
275
276
  }
277
+ export type PublicCutoutThumbnail = {
278
+ status: "available";
279
+ url: string;
280
+ } | {
281
+ status: "unavailable";
282
+ };
276
283
  export interface Product {
277
284
  marketplaceId: string;
278
285
  asin: string;
279
286
  listing: {
280
287
  title: string | null;
288
+ shortName: string | null;
289
+ cutoutThumbnail: PublicCutoutThumbnail | null;
281
290
  brand: string | null;
282
291
  firstAvailableAt: string | null;
283
292
  bulletPoints: string[];
@@ -288,7 +297,7 @@ export interface Product {
288
297
  status: "unavailable";
289
298
  };
290
299
  isMerchListing: boolean | null;
291
- isUnavailable: boolean;
300
+ amazonListingStatus: AmazonListingStatus;
292
301
  };
293
302
  category: {
294
303
  id: number;
@@ -315,7 +324,7 @@ export interface Product {
315
324
  };
316
325
  };
317
326
  }
318
- export interface ProductSearchProduct {
327
+ export interface KeywordResultsProduct {
319
328
  marketplaceId: string;
320
329
  asin: string;
321
330
  title: string | null;
@@ -327,7 +336,7 @@ export interface ProductSearchProduct {
327
336
  status: "unavailable";
328
337
  };
329
338
  isMerchListing: boolean | null;
330
- isUnavailable: boolean;
339
+ amazonListingStatus: AmazonListingStatus;
331
340
  category: {
332
341
  id: number;
333
342
  name: string | null;
@@ -339,12 +348,12 @@ export interface ProductSearchProduct {
339
348
  } | null;
340
349
  boughtInPastMonth: number | null;
341
350
  }
342
- export interface ProductSearch {
351
+ export interface KeywordResults {
343
352
  keyword: string;
344
353
  searchedAt: string;
345
354
  results: Array<{
346
355
  organicSearchPlacement: number;
347
- product: ProductSearchProduct;
356
+ product: KeywordResultsProduct;
348
357
  }>;
349
358
  }
350
359
  export interface BasicProduct {
@@ -357,7 +366,7 @@ export interface BasicProduct {
357
366
  } | {
358
367
  status: "unavailable";
359
368
  };
360
- isUnavailable: boolean;
369
+ amazonListingStatus: AmazonListingStatus;
361
370
  }
362
371
  export interface ProductHistorySummary {
363
372
  first: number | null;
@@ -508,6 +517,14 @@ export declare const publicAppRouter: import("@trpc/server").TRPCBuiltRouter<{
508
517
  };
509
518
  meta: object;
510
519
  }>;
520
+ results: import("@trpc/server").TRPCMutationProcedure<{
521
+ input: {
522
+ term: string;
523
+ refresh?: boolean | undefined;
524
+ };
525
+ output: KeywordResults;
526
+ meta: object;
527
+ }>;
511
528
  history: import("@trpc/server").TRPCQueryProcedure<{
512
529
  input: {
513
530
  keyword: string;
@@ -563,6 +580,7 @@ export declare const publicAppRouter: import("@trpc/server").TRPCBuiltRouter<{
563
580
  input: {
564
581
  marketplaceId: string;
565
582
  asin: string;
583
+ include?: ("shortName" | "marketData" | "cutoutThumbnail")[] | undefined;
566
584
  };
567
585
  output: Product;
568
586
  meta: object;
@@ -585,18 +603,112 @@ export declare const publicAppRouter: import("@trpc/server").TRPCBuiltRouter<{
585
603
  days?: unknown;
586
604
  endAt?: unknown;
587
605
  limit?: unknown;
588
- metrics?: ("price" | "salesRank")[] | undefined;
606
+ metrics?: ("salesRank" | "price")[] | undefined;
589
607
  startAt?: unknown;
590
608
  };
591
609
  output: PublicProductHistory;
592
610
  meta: object;
593
611
  }>;
594
- search: import("@trpc/server").TRPCMutationProcedure<{
612
+ search: import("@trpc/server").TRPCQueryProcedure<{
595
613
  input: {
596
- term: string;
597
- 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;
598
711
  };
599
- output: ProductSearch;
600
712
  meta: object;
601
713
  }>;
602
714
  }>>;
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@rankwrangler/http-client",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Typed tRPC client for RankWrangler",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/merchbaseco/rankwrangler.git",
8
+ "directory": "packages/http-client"
9
+ },
5
10
  "type": "module",
6
11
  "main": "./dist/index.js",
7
12
  "types": "./dist/index.d.ts",