@graph8/sdk 0.12.0 → 0.12.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.d.mts CHANGED
@@ -578,6 +578,29 @@ interface IntentCompany {
578
578
  visit_count: number;
579
579
  last_seen: string | null;
580
580
  }
581
+ /** One company row from `intent.urlCompanies()`. Richer than {@link IntentCompany},
582
+ * which describes the keyword-companies surface. */
583
+ interface IntentUrlCompany {
584
+ company_id: number | null;
585
+ name: string | null;
586
+ domain: string | null;
587
+ industry: string | null;
588
+ employee_count: number | null;
589
+ logo_url: string | null;
590
+ audience: string;
591
+ visit_count: number;
592
+ contacts_seen: number;
593
+ last_seen: string | null;
594
+ }
595
+ /** Response of `intent.urlCompanies()`. This endpoint returns a bare aggregate,
596
+ * not the `{ data }` envelope the rest of the Developer API uses. */
597
+ interface IntentUrlCompaniesResponse {
598
+ url: string;
599
+ total_companies: number;
600
+ b2b_count: number;
601
+ b2c_count: number;
602
+ companies: IntentUrlCompany[];
603
+ }
581
604
  interface IntentContact {
582
605
  contact_id: number | null;
583
606
  email: string | null;
@@ -612,7 +635,7 @@ interface IntentStats {
612
635
  * POST /api/v1/intent/pages/visitors
613
636
  * POST /api/v1/intent/pages/contacts
614
637
  * POST /api/v1/intent/pages/visitor-counts
615
- * POST /intent-search/url-companies (note: bare host, no /api/v1 prefix)
638
+ * POST /api/v1/intent/url-companies
616
639
  */
617
640
  declare const createIntentClient: (apiKey: string, apiUrl?: string) => {
618
641
  /** Org-level intent stats (totals over the last 30 days). */
@@ -695,16 +718,24 @@ declare const createIntentClient: (apiKey: string, apiUrl?: string) => {
695
718
  /**
696
719
  * Find companies whose users visited a specific URL (intent search).
697
720
  *
698
- * Note: this endpoint lives at the bare host (no `/api/v1` prefix), unlike the rest
699
- * of the intent surface we call it directly here instead of through the shared `post()` helper.
721
+ * Previously posted to the bare-host `/intent-search/url-companies`, bypassing
722
+ * the shared `post()` helper. That route is JWT-only, so this method could
723
+ * never actually work with an API key. It now goes through
724
+ * `/api/v1/intent/url-companies` like the rest of the intent surface (g8 issue
725
+ * #16536).
726
+ *
727
+ * Returns a bare aggregate, NOT the `{ data }` envelope — the previous
728
+ * `{ data: IntentCompany[] }` signature never matched what the API sends.
729
+ *
730
+ * `date_from` / `date_to` are accepted for backwards compatibility but have
731
+ * never been read by this endpoint; use `days` to set the lookback window.
700
732
  */
701
733
  urlCompanies(url: string, params?: {
702
734
  limit?: number;
735
+ days?: number;
703
736
  date_from?: string;
704
737
  date_to?: string;
705
- }): Promise<{
706
- data: IntentCompany[];
707
- }>;
738
+ }): Promise<IntentUrlCompaniesResponse>;
708
739
  };
709
740
 
710
741
  type SkillType = "llm" | "api";
@@ -1553,14 +1584,28 @@ interface DealCreateParams {
1553
1584
  */
1554
1585
  company_id?: number;
1555
1586
  description?: string;
1587
+ /**
1588
+ * Monetary value. Required (HTTP 400, marker `amount_required_for_won_stage`)
1589
+ * when creating directly in a Closed Won stage; 0 is a valid amount.
1590
+ */
1556
1591
  amount?: number;
1557
1592
  /** Default: "USD". */
1558
1593
  currency?: string;
1559
- /** Stage ID from the org's pipelines. Defaults to first stage of default pipeline if omitted. */
1594
+ /**
1595
+ * Stage ID from the org's pipelines. Must exist and belong to `pipeline_id`
1596
+ * when both are sent (HTTP 422 otherwise). Defaults to the default
1597
+ * pipeline's first non-closed stage if omitted. Creating directly in a
1598
+ * closed stage triggers the closed-stage rules (HTTP 400 with marker
1599
+ * `close_date_required_for_won_stage` / `close_date_required_for_lost_stage`
1600
+ * / `amount_required_for_won_stage` / `owner_required_for_closed_stage`).
1601
+ */
1560
1602
  stage_id?: string;
1561
- /** Pipeline ID. Defaults to org's default pipeline if omitted. */
1603
+ /** Pipeline ID. Must exist (HTTP 422 otherwise). Defaults to org's default pipeline if omitted. */
1562
1604
  pipeline_id?: string;
1563
- /** ISO 8601 close date. */
1605
+ /**
1606
+ * ISO 8601 close date. Required when creating directly in a Closed Won or
1607
+ * Closed Lost stage; past dates are allowed (backdating is supported).
1608
+ */
1564
1609
  close_date?: string;
1565
1610
  /**
1566
1611
  * Set true to create a deal even if one already exists for the company.
@@ -1573,10 +1618,28 @@ interface DealUpdateParams {
1573
1618
  description?: string;
1574
1619
  amount?: number;
1575
1620
  currency?: string;
1621
+ /**
1622
+ * New stage ID. Must be an existing stage in the deal's pipeline (HTTP 422
1623
+ * otherwise). Moving a deal INTO a Closed Won stage requires an effective
1624
+ * close_date AND amount; Closed Lost requires an effective close_date;
1625
+ * either requires an owner ("effective" = the value in this call, else the
1626
+ * deal's existing value). Violations return HTTP 400 with a marker-prefixed
1627
+ * detail: `close_date_required_for_won_stage`,
1628
+ * `close_date_required_for_lost_stage`, `amount_required_for_won_stage`,
1629
+ * `owner_required_for_closed_stage`. Re-submitting the deal's current stage
1630
+ * is never gated.
1631
+ */
1576
1632
  stage_id?: string;
1577
- /** ISO 8601 close date. */
1578
- close_date?: string;
1579
- /** Reassign the deal owner (user id or email). Pass null to clear. */
1633
+ /**
1634
+ * ISO 8601 close date. Explicit null clears it, except on a deal sitting in
1635
+ * a closed stage (HTTP 400, closed-stage markers above).
1636
+ */
1637
+ close_date?: string | null;
1638
+ /**
1639
+ * Reassign the deal owner (user id or email). Pass null to clear, except on
1640
+ * a deal sitting in a closed stage (HTTP 400, marker
1641
+ * `owner_required_for_closed_stage`).
1642
+ */
1580
1643
  owner_id?: string | null;
1581
1644
  /**
1582
1645
  * mashup_contact_ids to link. Must belong to the deal's company (if the deal
@@ -3717,7 +3780,7 @@ declare class G8 {
3717
3780
  data: IntentCompany[];
3718
3781
  }>;
3719
3782
  keywordContacts(keywordId: string, params?: {
3720
- limit? /** @internal */: number;
3783
+ limit?: number;
3721
3784
  date_from?: string;
3722
3785
  date_to?: string;
3723
3786
  }): Promise<{
@@ -3758,11 +3821,10 @@ declare class G8 {
3758
3821
  }>;
3759
3822
  urlCompanies(url: string, params?: {
3760
3823
  limit?: number;
3824
+ days?: number;
3761
3825
  date_from?: string;
3762
3826
  date_to?: string;
3763
- }): Promise<{
3764
- data: IntentCompany[];
3765
- }>;
3827
+ }): Promise<IntentUrlCompaniesResponse>;
3766
3828
  };
3767
3829
  /** Studio context — ICPs, personas, brand briefs, intelligence, AI research reports (requires API key). */
3768
3830
  get studio(): {
package/dist/index.d.ts CHANGED
@@ -578,6 +578,29 @@ interface IntentCompany {
578
578
  visit_count: number;
579
579
  last_seen: string | null;
580
580
  }
581
+ /** One company row from `intent.urlCompanies()`. Richer than {@link IntentCompany},
582
+ * which describes the keyword-companies surface. */
583
+ interface IntentUrlCompany {
584
+ company_id: number | null;
585
+ name: string | null;
586
+ domain: string | null;
587
+ industry: string | null;
588
+ employee_count: number | null;
589
+ logo_url: string | null;
590
+ audience: string;
591
+ visit_count: number;
592
+ contacts_seen: number;
593
+ last_seen: string | null;
594
+ }
595
+ /** Response of `intent.urlCompanies()`. This endpoint returns a bare aggregate,
596
+ * not the `{ data }` envelope the rest of the Developer API uses. */
597
+ interface IntentUrlCompaniesResponse {
598
+ url: string;
599
+ total_companies: number;
600
+ b2b_count: number;
601
+ b2c_count: number;
602
+ companies: IntentUrlCompany[];
603
+ }
581
604
  interface IntentContact {
582
605
  contact_id: number | null;
583
606
  email: string | null;
@@ -612,7 +635,7 @@ interface IntentStats {
612
635
  * POST /api/v1/intent/pages/visitors
613
636
  * POST /api/v1/intent/pages/contacts
614
637
  * POST /api/v1/intent/pages/visitor-counts
615
- * POST /intent-search/url-companies (note: bare host, no /api/v1 prefix)
638
+ * POST /api/v1/intent/url-companies
616
639
  */
617
640
  declare const createIntentClient: (apiKey: string, apiUrl?: string) => {
618
641
  /** Org-level intent stats (totals over the last 30 days). */
@@ -695,16 +718,24 @@ declare const createIntentClient: (apiKey: string, apiUrl?: string) => {
695
718
  /**
696
719
  * Find companies whose users visited a specific URL (intent search).
697
720
  *
698
- * Note: this endpoint lives at the bare host (no `/api/v1` prefix), unlike the rest
699
- * of the intent surface we call it directly here instead of through the shared `post()` helper.
721
+ * Previously posted to the bare-host `/intent-search/url-companies`, bypassing
722
+ * the shared `post()` helper. That route is JWT-only, so this method could
723
+ * never actually work with an API key. It now goes through
724
+ * `/api/v1/intent/url-companies` like the rest of the intent surface (g8 issue
725
+ * #16536).
726
+ *
727
+ * Returns a bare aggregate, NOT the `{ data }` envelope — the previous
728
+ * `{ data: IntentCompany[] }` signature never matched what the API sends.
729
+ *
730
+ * `date_from` / `date_to` are accepted for backwards compatibility but have
731
+ * never been read by this endpoint; use `days` to set the lookback window.
700
732
  */
701
733
  urlCompanies(url: string, params?: {
702
734
  limit?: number;
735
+ days?: number;
703
736
  date_from?: string;
704
737
  date_to?: string;
705
- }): Promise<{
706
- data: IntentCompany[];
707
- }>;
738
+ }): Promise<IntentUrlCompaniesResponse>;
708
739
  };
709
740
 
710
741
  type SkillType = "llm" | "api";
@@ -1553,14 +1584,28 @@ interface DealCreateParams {
1553
1584
  */
1554
1585
  company_id?: number;
1555
1586
  description?: string;
1587
+ /**
1588
+ * Monetary value. Required (HTTP 400, marker `amount_required_for_won_stage`)
1589
+ * when creating directly in a Closed Won stage; 0 is a valid amount.
1590
+ */
1556
1591
  amount?: number;
1557
1592
  /** Default: "USD". */
1558
1593
  currency?: string;
1559
- /** Stage ID from the org's pipelines. Defaults to first stage of default pipeline if omitted. */
1594
+ /**
1595
+ * Stage ID from the org's pipelines. Must exist and belong to `pipeline_id`
1596
+ * when both are sent (HTTP 422 otherwise). Defaults to the default
1597
+ * pipeline's first non-closed stage if omitted. Creating directly in a
1598
+ * closed stage triggers the closed-stage rules (HTTP 400 with marker
1599
+ * `close_date_required_for_won_stage` / `close_date_required_for_lost_stage`
1600
+ * / `amount_required_for_won_stage` / `owner_required_for_closed_stage`).
1601
+ */
1560
1602
  stage_id?: string;
1561
- /** Pipeline ID. Defaults to org's default pipeline if omitted. */
1603
+ /** Pipeline ID. Must exist (HTTP 422 otherwise). Defaults to org's default pipeline if omitted. */
1562
1604
  pipeline_id?: string;
1563
- /** ISO 8601 close date. */
1605
+ /**
1606
+ * ISO 8601 close date. Required when creating directly in a Closed Won or
1607
+ * Closed Lost stage; past dates are allowed (backdating is supported).
1608
+ */
1564
1609
  close_date?: string;
1565
1610
  /**
1566
1611
  * Set true to create a deal even if one already exists for the company.
@@ -1573,10 +1618,28 @@ interface DealUpdateParams {
1573
1618
  description?: string;
1574
1619
  amount?: number;
1575
1620
  currency?: string;
1621
+ /**
1622
+ * New stage ID. Must be an existing stage in the deal's pipeline (HTTP 422
1623
+ * otherwise). Moving a deal INTO a Closed Won stage requires an effective
1624
+ * close_date AND amount; Closed Lost requires an effective close_date;
1625
+ * either requires an owner ("effective" = the value in this call, else the
1626
+ * deal's existing value). Violations return HTTP 400 with a marker-prefixed
1627
+ * detail: `close_date_required_for_won_stage`,
1628
+ * `close_date_required_for_lost_stage`, `amount_required_for_won_stage`,
1629
+ * `owner_required_for_closed_stage`. Re-submitting the deal's current stage
1630
+ * is never gated.
1631
+ */
1576
1632
  stage_id?: string;
1577
- /** ISO 8601 close date. */
1578
- close_date?: string;
1579
- /** Reassign the deal owner (user id or email). Pass null to clear. */
1633
+ /**
1634
+ * ISO 8601 close date. Explicit null clears it, except on a deal sitting in
1635
+ * a closed stage (HTTP 400, closed-stage markers above).
1636
+ */
1637
+ close_date?: string | null;
1638
+ /**
1639
+ * Reassign the deal owner (user id or email). Pass null to clear, except on
1640
+ * a deal sitting in a closed stage (HTTP 400, marker
1641
+ * `owner_required_for_closed_stage`).
1642
+ */
1580
1643
  owner_id?: string | null;
1581
1644
  /**
1582
1645
  * mashup_contact_ids to link. Must belong to the deal's company (if the deal
@@ -3717,7 +3780,7 @@ declare class G8 {
3717
3780
  data: IntentCompany[];
3718
3781
  }>;
3719
3782
  keywordContacts(keywordId: string, params?: {
3720
- limit? /** @internal */: number;
3783
+ limit?: number;
3721
3784
  date_from?: string;
3722
3785
  date_to?: string;
3723
3786
  }): Promise<{
@@ -3758,11 +3821,10 @@ declare class G8 {
3758
3821
  }>;
3759
3822
  urlCompanies(url: string, params?: {
3760
3823
  limit?: number;
3824
+ days?: number;
3761
3825
  date_from?: string;
3762
3826
  date_to?: string;
3763
- }): Promise<{
3764
- data: IntentCompany[];
3765
- }>;
3827
+ }): Promise<IntentUrlCompaniesResponse>;
3766
3828
  };
3767
3829
  /** Studio context — ICPs, personas, brand briefs, intelligence, AI research reports (requires API key). */
3768
3830
  get studio(): {
package/dist/index.js CHANGED
@@ -1745,14 +1745,20 @@ var createIntentClient = (apiKey, apiUrl) => {
1745
1745
  /**
1746
1746
  * Find companies whose users visited a specific URL (intent search).
1747
1747
  *
1748
- * Note: this endpoint lives at the bare host (no `/api/v1` prefix), unlike the rest
1749
- * of the intent surface we call it directly here instead of through the shared `post()` helper.
1748
+ * Previously posted to the bare-host `/intent-search/url-companies`, bypassing
1749
+ * the shared `post()` helper. That route is JWT-only, so this method could
1750
+ * never actually work with an API key. It now goes through
1751
+ * `/api/v1/intent/url-companies` like the rest of the intent surface (g8 issue
1752
+ * #16536).
1753
+ *
1754
+ * Returns a bare aggregate, NOT the `{ data }` envelope — the previous
1755
+ * `{ data: IntentCompany[] }` signature never matched what the API sends.
1756
+ *
1757
+ * `date_from` / `date_to` are accepted for backwards compatibility but have
1758
+ * never been read by this endpoint; use `days` to set the lookback window.
1750
1759
  */
1751
1760
  async urlCompanies(url, params = {}) {
1752
- return request(baseUrl, "/intent-search/url-companies", apiKey, {
1753
- method: "POST",
1754
- body: { url, ...params }
1755
- });
1761
+ return post("/intent/url-companies", { url, ...params });
1756
1762
  }
1757
1763
  };
1758
1764
  };