@sortlist/cli 0.31.0 → 0.33.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sortlist/cli",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "Sortlist platform CLI — GraphQL federation client",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -11,11 +11,27 @@ import { error, hint, info, success, warn } from '../lib/output.ts';
11
11
 
12
12
  // TODO: fetch the set of available API scopes dynamically (e.g. from Hermes'
13
13
  // resource server) once the backend exposes them. For now the CLI requests a
14
- // fixed superset so users can exercise every subgraph. Scope strings must match
15
- // the Auth0 resource-server format `<service>/<resource>:<action>` exactly — RBAC
16
- // silently drops any requested scope that isn't a defined permission, which is why
17
- // the delimiters are `/` then `:` (e.g. `atlas/*:*`, not `atlas:*/*`).
18
- const DEFAULT_SCOPE = 'openid profile email offline_access atlas/*:* core/*:* max/*:* signals/*:* billing/*:*';
14
+ // fixed superset so users can exercise every subgraph. Auth0 RBAC grants the
15
+ // intersection of requested scopes and the user's assigned permissions by EXACT
16
+ // string match — wildcards are not expanded, and unmatched scopes are dropped
17
+ // silently. The list below must therefore contain every permission name the
18
+ // terraform-auth0 roles can hold (superadmin `*:*`, admin `*:read`, sales
19
+ // granular grants), not just the broadest wildcard per service.
20
+ const API_SCOPES = [
21
+ 'atlas/*:*',
22
+ 'atlas/*:read',
23
+ 'core/*:*',
24
+ 'core/*:read',
25
+ 'max/*:*',
26
+ 'max/*:read',
27
+ 'max/company:write',
28
+ 'signals/*:*',
29
+ 'signals/*:read',
30
+ 'billing/*:*',
31
+ 'billing/*:read',
32
+ 'billing/offer:*',
33
+ ];
34
+ const DEFAULT_SCOPE = `openid profile email offline_access ${API_SCOPES.join(' ')}`;
19
35
 
20
36
  function sleep(ms: number): Promise<void> {
21
37
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
 
3
- import { graphql } from '../graphql/client.ts';
3
+ import { graphql, GraphQLRequestError } from '../graphql/client.ts';
4
4
  import { Me } from '../graphql/operations/common.ts';
5
5
  import { loadConfig } from '../lib/config.ts';
6
6
  import { error, hint, info, isJsonMode, printJson } from '../lib/output.ts';
@@ -17,14 +17,34 @@ export const whoamiCommand = new Command('whoami')
17
17
  )
18
18
  .action(async function (this: Command) {
19
19
  const opts = this.optsWithGlobals();
20
- const data = await graphql(Me, undefined, {
21
- endpoint: opts.endpoint,
22
- });
20
+
21
+ let data;
22
+ try {
23
+ data = await graphql(Me, undefined, {
24
+ endpoint: opts.endpoint,
25
+ throwOnError: true,
26
+ });
27
+ } catch (err) {
28
+ if (err instanceof GraphQLRequestError) {
29
+ error('Could not verify your identity — the API returned an error:');
30
+ const messages = err.graphqlErrors?.map((e) => e.message) ?? [err.message];
31
+ for (const message of messages) info(` ${message}`);
32
+ hint('This is a server-side or authorization error, not necessarily an expired session.');
33
+ hint('Retry in a moment; if it persists, re-run `sl login` or report it.');
34
+ process.exit(1);
35
+ }
36
+ throw err;
37
+ }
23
38
 
24
39
  const user = data.me;
25
40
  if (!user) {
26
- error('You are not authenticated.');
27
- hint('Run `sl login` to log in first.');
41
+ // A successful `me` for a logged-in user is never null — the resolver
42
+ // returns the calling user. Null here means the backend could not resolve
43
+ // the account (e.g. an upstream identity/profile lookup failed), not that
44
+ // the local session is invalid, so we do not tell the user to log in again.
45
+ error('The API did not return your user identity.');
46
+ hint('This is usually a temporary backend issue rather than an expired session.');
47
+ hint('Retry in a moment; if it persists, re-run `sl login` or report it.');
28
48
  process.exit(1);
29
49
  }
30
50
 
@@ -18,6 +18,8 @@ export type Scalars = {
18
18
  ISO8601Date: { input: any; output: any; }
19
19
  /** An ISO 8601-encoded datetime */
20
20
  ISO8601DateTime: { input: any; output: any; }
21
+ /** An ISO 8601-encoded duration */
22
+ ISO8601Duration: { input: any; output: any; }
21
23
  /** Represents untyped JSON */
22
24
  JSON: { input: any; output: any; }
23
25
  /** An integer range represented as a two-element array [min, max]. */
@@ -489,6 +491,11 @@ export type BillingCustomer = Node & {
489
491
  invoices: BillingInvoiceConnection;
490
492
  /** The customer's outstanding sales offer (a pre-negotiated custom plan awaiting checkout), or null when none is pending. */
491
493
  pendingOffer?: Maybe<Offer>;
494
+ /**
495
+ * Product this customer belongs to. Decides the Stripe account and plan catalog;
496
+ * credits and subscriptions never cross products.
497
+ */
498
+ product: BillingProduct;
492
499
  /** Total seats the customer is paying for: plan default + extras. */
493
500
  seats: Scalars['Int']['output'];
494
501
  /** Customer's VAT number for EU customers, captured by Stripe at Checkout. */
@@ -659,6 +666,17 @@ export type BillingPlanName =
659
666
  /** 1 seat, smallest credit allowance. */
660
667
  | 'STARTER';
661
668
 
669
+ /**
670
+ * Sortlist product a billing customer belongs to. Each product runs on its own
671
+ * Stripe account with its own plan catalog; credits, subscriptions, and invoices
672
+ * never cross products.
673
+ */
674
+ export type BillingProduct =
675
+ /** The original shared Stripe account — the old Max app's billing and the marketplace's Recurly payment-gateway traffic. */
676
+ | 'LEGACY'
677
+ /** The new Max product (rebuilt app replacing the old Max, keeping the name), on its own dedicated Stripe account. */
678
+ | 'MAX';
679
+
662
680
  /**
663
681
  * A mirrored Stripe subscription. Plan tier is identified by the subscription's
664
682
  * plan-item Price (`PlanCatalog.find_by_stripe_price_id`).
@@ -753,6 +771,77 @@ export type CancelConversationPayload = Node & {
753
771
  ok: Scalars['Boolean']['output'];
754
772
  };
755
773
 
774
+ /** A single entry in a contact's career history: a work-experience role, degree, certification, award, or publication. */
775
+ export type CareerEntry = Node & {
776
+ __typename?: 'CareerEntry';
777
+ /** Free-text description of the entry as provided by the source. */
778
+ description?: Maybe<Scalars['String']['output']>;
779
+ /** End date of the entry (upper bound of its period), or null when the entry is ongoing or the source gave no end date. */
780
+ endedOn?: Maybe<Scalars['ISO8601Date']['output']>;
781
+ id: Scalars['ID']['output'];
782
+ /** Which kind of career entry this is. */
783
+ kind: CareerEntryKind;
784
+ /**
785
+ * The organization this entry links to (e.g. the employer or school), or null
786
+ * when it could not be resolved to a known record.
787
+ */
788
+ organization?: Maybe<Organization>;
789
+ /** Start date of the entry (lower bound of its period), or null when the source gave no start date. */
790
+ startedOn?: Maybe<Scalars['ISO8601Date']['output']>;
791
+ /** The entry's headline — role title, degree, certification name, award title, or publication title depending on kind. */
792
+ title?: Maybe<Scalars['String']['output']>;
793
+ /** Source URL for the entry (e.g. the credential link), or null. */
794
+ url?: Maybe<Scalars['String']['output']>;
795
+ };
796
+
797
+ /** The connection type for CareerEntry. */
798
+ export type CareerEntryConnection = {
799
+ __typename?: 'CareerEntryConnection';
800
+ /** A list of edges. */
801
+ edges?: Maybe<Array<Maybe<CareerEntryEdge>>>;
802
+ /** A list of nodes. */
803
+ nodes?: Maybe<Array<Maybe<CareerEntry>>>;
804
+ /** Information to aid in pagination. */
805
+ pageInfo: PageInfo;
806
+ /** Total number of items across all pages. */
807
+ totalCount: Scalars['Int']['output'];
808
+ };
809
+
810
+ /** An edge in a connection. */
811
+ export type CareerEntryEdge = Node & {
812
+ __typename?: 'CareerEntryEdge';
813
+ /** A cursor for use in pagination. */
814
+ cursor: Scalars['String']['output'];
815
+ id: Scalars['ID']['output'];
816
+ /** The item at the end of the edge. */
817
+ node?: Maybe<CareerEntry>;
818
+ };
819
+
820
+ /** The kind of entry in a contact's career history. */
821
+ export type CareerEntryKind =
822
+ /** An award or honor received. */
823
+ | 'AWARD'
824
+ /** A professional certification. */
825
+ | 'CERTIFICATION'
826
+ /** A degree or course of study. */
827
+ | 'EDUCATION'
828
+ /** A past or current work-experience role. */
829
+ | 'EXPERIENCE'
830
+ /** An authored publication. */
831
+ | 'PUBLICATION';
832
+
833
+ /** Filter on career-entry kind with schema-validated enum values. */
834
+ export type CareerEntryKindFilterInput = {
835
+ /** Exact match. */
836
+ eq?: InputMaybe<CareerEntryKind>;
837
+ /** Match any of these values. */
838
+ in?: InputMaybe<Array<CareerEntryKind>>;
839
+ /** Exclude exact match. */
840
+ notEq?: InputMaybe<CareerEntryKind>;
841
+ /** Exclude any of these values. */
842
+ notIn?: InputMaybe<Array<CareerEntryKind>>;
843
+ };
844
+
756
845
  /** Autogenerated input type of ChangeBillingSubscription */
757
846
  export type ChangeBillingSubscriptionInput = {
758
847
  /** A unique identifier for the client performing the mutation. */
@@ -1193,6 +1282,8 @@ export type Contact = Node & {
1193
1282
  * source provides one or the contact has no public photo.
1194
1283
  */
1195
1284
  avatarUrl?: Maybe<Scalars['String']['output']>;
1285
+ /** Paginated career entries — experience, education, certifications, awards, and publications — most recent first. */
1286
+ careerEntries: CareerEntryConnection;
1196
1287
  /** City where the contact is located. */
1197
1288
  city?: Maybe<Scalars['String']['output']>;
1198
1289
  /** Confidence score (0.0-1.0) from source quality, freshness, and diversity. */
@@ -1209,7 +1300,7 @@ export type Contact = Node & {
1209
1300
  emailStatus?: Maybe<EmailStatus>;
1210
1301
  /** First name. */
1211
1302
  firstName?: Maybe<Scalars['String']['output']>;
1212
- /** GlobalID-encoded contact id. */
1303
+ /** GlobalID-encoded Contact id. */
1213
1304
  id: Scalars['ID']['output'];
1214
1305
  /** Functional department (e.g. marketing, sales, engineering). */
1215
1306
  jobFunction?: Maybe<Scalars['String']['output']>;
@@ -1221,12 +1312,39 @@ export type Contact = Node & {
1221
1312
  lastName?: Maybe<Scalars['String']['output']>;
1222
1313
  /** LinkedIn profile URL. */
1223
1314
  linkedinUrl?: Maybe<Scalars['String']['output']>;
1315
+ /** Mercator location divisions assigned to this contact's location. Empty until the background enrichment job runs. */
1316
+ locations: LocationConnection;
1224
1317
  /** The organization this contact belongs to. */
1225
1318
  organization: Organization;
1319
+ /**
1320
+ * Profile completeness score (0.0-1.0) from the presence of identity fields,
1321
+ * experience, and the merged confidence score. Consumers gate low-quality
1322
+ * records on this instead of counting raw history entries.
1323
+ */
1324
+ profileCompleteness: Scalars['Float']['output'];
1226
1325
  /** When the contact record was last modified. */
1227
1326
  updatedAt: Scalars['ISO8601DateTime']['output'];
1228
1327
  };
1229
1328
 
1329
+
1330
+ /** A business contact associated with an organization. */
1331
+ export type ContactCareerEntriesArgs = {
1332
+ after?: InputMaybe<Scalars['String']['input']>;
1333
+ before?: InputMaybe<Scalars['String']['input']>;
1334
+ first?: InputMaybe<Scalars['Int']['input']>;
1335
+ kind?: InputMaybe<CareerEntryKindFilterInput>;
1336
+ last?: InputMaybe<Scalars['Int']['input']>;
1337
+ };
1338
+
1339
+
1340
+ /** A business contact associated with an organization. */
1341
+ export type ContactLocationsArgs = {
1342
+ after?: InputMaybe<Scalars['String']['input']>;
1343
+ before?: InputMaybe<Scalars['String']['input']>;
1344
+ first?: InputMaybe<Scalars['Int']['input']>;
1345
+ last?: InputMaybe<Scalars['Int']['input']>;
1346
+ };
1347
+
1230
1348
  /** The connection type for Contact. */
1231
1349
  export type ContactConnection = {
1232
1350
  __typename?: 'ContactConnection';
@@ -1262,8 +1380,18 @@ export type ContactEnrichmentResultPayload = {
1262
1380
  export type ContactFilterInput = {
1263
1381
  /** Filter by confidence score (0.0–1.0). */
1264
1382
  confidenceScore?: InputMaybe<FloatFilterInput>;
1265
- /** Filter by ISO 3166-1 alpha-2 country code. */
1383
+ /**
1384
+ * Filter by ISO 3166-1 alpha-2 country code.
1385
+ * @deprecated Use divisionIds for geographic filtering. divisionIds supports cities, regions, and multi-country groups (DACH, BENELUX) via Mercator.
1386
+ */
1266
1387
  countryCode?: InputMaybe<StringFilterInput>;
1388
+ /**
1389
+ * Filter contacts that belong to any of the given Mercator location division
1390
+ * IDs. `eq`/`in` match contacts with at least one overlapping division;
1391
+ * `not_eq`/`not_in` exclude them. This is an array-overlap filter against
1392
+ * Mercator-encoded division IDs, not a scalar Atlas ID filter.
1393
+ */
1394
+ divisionIds?: InputMaybe<IdFilterInput>;
1267
1395
  /** Filter by email verification status (VALID, INVALID, CATCH_ALL, UNKNOWN). */
1268
1396
  emailStatus?: InputMaybe<EmailStatusFilterInput>;
1269
1397
  /** Filter by contact global id. */
@@ -1503,6 +1631,13 @@ export type CreateBillingCustomerInput = {
1503
1631
  email?: InputMaybe<Scalars['String']['input']>;
1504
1632
  /** Customer's display name (typically `first last`). Stored on the Stripe Customer for Dashboard readability. */
1505
1633
  name?: InputMaybe<Scalars['String']['input']>;
1634
+ /**
1635
+ * Product the customer belongs to — decides which Stripe account the customer is
1636
+ * created on and which plan catalog applies. Defaults to LEGACY for the old Max
1637
+ * app's callers; the account must be registered in the environment or the
1638
+ * mutation fails.
1639
+ */
1640
+ product?: InputMaybe<BillingProduct>;
1506
1641
  };
1507
1642
 
1508
1643
  /** Autogenerated return type of CreateBillingCustomer. */
@@ -1943,6 +2078,13 @@ export type CreateWatcherInput = {
1943
2078
  definitionSlug: Scalars['String']['input'];
1944
2079
  /** Version of the Definition to subscribe to. */
1945
2080
  definitionVersion: Scalars['Int']['input'];
2081
+ /**
2082
+ * Optional freshness-first per-period lead caps for this watcher. Omit or pass
2083
+ * an empty list to leave the watcher uncapped. Caps are a property of the
2084
+ * watcher (not the individual webhook), so they replace any caps already set on
2085
+ * a shared watcher.
2086
+ */
2087
+ leadCaps?: InputMaybe<Array<LeadCapInput>>;
1946
2088
  /** User-supplied watcher input validated against the Definition's `watcherInputSchema`. */
1947
2089
  watcherInput: Scalars['JSON']['input'];
1948
2090
  /** Delivery endpoint registered on this watcher. Multiple callers with the same definition and input share one watcher. */
@@ -3162,6 +3304,21 @@ export type LeadAcquisitionSourceEnum =
3162
3304
  | 'MAX'
3163
3305
  | 'SIGNALS';
3164
3306
 
3307
+ /**
3308
+ * A single freshness-first lead cap for a Watcher: at most `maximumLeads` events
3309
+ * are surfaced per `period`, counted from `startsAt` and reset at every period
3310
+ * boundary. Excess events are dropped, never buffered. Combine several caps to
3311
+ * constrain multiple periods at once — the most restrictive one wins.
3312
+ */
3313
+ export type LeadCapInput = {
3314
+ /** Maximum number of events surfaced per period. Must be greater than zero. */
3315
+ maximumLeads: Scalars['Int']['input'];
3316
+ /** Length of the accumulation window as an ISO-8601 duration, e.g. P1D (one day) or P1W (one week). */
3317
+ period: Scalars['ISO8601Duration']['input'];
3318
+ /** Anchor at which the first period begins. Defaults to the moment the cap is created. */
3319
+ startsAt?: InputMaybe<Scalars['ISO8601DateTime']['input']>;
3320
+ };
3321
+
3165
3322
  /** The connection type for Lead. */
3166
3323
  export type LeadConnection = {
3167
3324
  __typename?: 'LeadConnection';
@@ -3254,10 +3411,7 @@ export type LinkedinSendMessageStepConfig = {
3254
3411
  writingStyle?: Maybe<OutboundCampaignWritingStyle>;
3255
3412
  };
3256
3413
 
3257
- /**
3258
- * An administrative geographic division (country, region, city, etc.) sourced from
3259
- * Overture Maps, backed by PostGIS polygon boundaries.
3260
- */
3414
+ /** Federation reference to a Location owned by another subgraph. */
3261
3415
  export type Location = Node & {
3262
3416
  __typename?: 'Location';
3263
3417
  /** Numeric hierarchy depth. 0 = country, higher = more granular. */
@@ -3268,6 +3422,7 @@ export type Location = Node & {
3268
3422
  children: LocationConnection;
3269
3423
  /** ISO 3166-1 alpha-2 country code of the division. */
3270
3424
  countryCode?: Maybe<Scalars['String']['output']>;
3425
+ /** GlobalID-encoded Location id. */
3271
3426
  id: Scalars['ID']['output'];
3272
3427
  /** Primary English name of the division. */
3273
3428
  name: Scalars['String']['output'];
@@ -3278,10 +3433,7 @@ export type Location = Node & {
3278
3433
  };
3279
3434
 
3280
3435
 
3281
- /**
3282
- * An administrative geographic division (country, region, city, etc.) sourced from
3283
- * Overture Maps, backed by PostGIS polygon boundaries.
3284
- */
3436
+ /** Federation reference to a Location owned by another subgraph. */
3285
3437
  export type LocationChildrenArgs = {
3286
3438
  after?: InputMaybe<Scalars['String']['input']>;
3287
3439
  before?: InputMaybe<Scalars['String']['input']>;
@@ -3305,23 +3457,34 @@ export type LocationConnection = {
3305
3457
  };
3306
3458
 
3307
3459
  /** An edge in a connection. */
3308
- export type LocationEdge = Node & {
3460
+ export type LocationEdge = {
3309
3461
  __typename?: 'LocationEdge';
3310
3462
  /** A cursor for use in pagination. */
3311
3463
  cursor: Scalars['String']['output'];
3312
- id: Scalars['ID']['output'];
3313
3464
  /** The item at the end of the edge. */
3314
3465
  node?: Maybe<Location>;
3315
3466
  };
3316
3467
 
3317
3468
  /** Administrative subdivision level of a geographic location. */
3318
3469
  export type LocationSubtype =
3470
+ /** Borough or city district between the locality and neighborhood levels. */
3471
+ | 'BOROUGH'
3319
3472
  /** Sovereign nation (admin_level 0). */
3320
3473
  | 'COUNTRY'
3321
3474
  /** County, department, or second-level subdivision (admin_level 3-4). */
3322
3475
  | 'COUNTY'
3476
+ /** Dependent or overseas territory of a country. */
3477
+ | 'DEPENDENCY'
3478
+ /** Local administrative unit such as a commune or municipality, between the county and locality levels. */
3479
+ | 'LOCALADMIN'
3323
3480
  /** City, town, or municipality (admin_level 5-8). */
3324
3481
  | 'LOCALITY'
3482
+ /** Grouping of counties between the region and county levels. */
3483
+ | 'MACROCOUNTY'
3484
+ /** Large area grouping multiple neighborhoods within a locality. */
3485
+ | 'MACROHOOD'
3486
+ /** Grouping of regions between the country and region levels. */
3487
+ | 'MACROREGION'
3325
3488
  /** Neighborhood, district, or sub-municipal area (admin_level 9+). */
3326
3489
  | 'NEIGHBORHOOD'
3327
3490
  /** State, province, or first-level subdivision (admin_level 1-2). */
@@ -3867,13 +4030,6 @@ export type Mutation = {
3867
4030
  retrainToneOfVoice?: Maybe<RetrainToneOfVoicePayload>;
3868
4031
  /** Revoke a pending invitation so its link can no longer be claimed. */
3869
4032
  revokeInvitation?: Maybe<RevokeInvitationPayload>;
3870
- /**
3871
- * Merge rotated credential material into a RAW integration's data blob.
3872
- * M2M-only: gated on the max/company:write scope so consuming subgraphs (e.g.
3873
- * Outreach) can write back rotated session cookies through the federation
3874
- * gateway without knowing about Max internals.
3875
- */
3876
- rotateIntegrationCredential?: Maybe<RotateIntegrationCredentialPayload>;
3877
4033
  /** Run a background job inline. Admin-only, intended for E2E test orchestration. */
3878
4034
  runMaxSynchronousWorker?: Maybe<RunMaxSynchronousWorkerPayload>;
3879
4035
  /** Runs a background job inline. Admin-only, intended for E2E test orchestration. */
@@ -3978,6 +4134,12 @@ export type Mutation = {
3978
4134
  updateSource?: Maybe<Source>;
3979
4135
  /** Update the calling user's preferred UI locale. */
3980
4136
  updateUserLocale?: Maybe<UpdateUserLocalePayload>;
4137
+ /**
4138
+ * Replace the freshness-first per-period lead caps on a Watcher. The new caps
4139
+ * take effect in-house immediately and are propagated to Rodz-backed signals as
4140
+ * their per-day limit.
4141
+ */
4142
+ updateWatcherLeadCaps?: Maybe<UpdateWatcherLeadCapsPayload>;
3981
4143
  /**
3982
4144
  * Asynchronously validate that the supplied name, email, and phone are internally consistent
3983
4145
  * for a contact at the given organization.
@@ -4340,11 +4502,6 @@ export type MutationRevokeInvitationArgs = {
4340
4502
  };
4341
4503
 
4342
4504
 
4343
- export type MutationRotateIntegrationCredentialArgs = {
4344
- input: RotateIntegrationCredentialInput;
4345
- };
4346
-
4347
-
4348
4505
  export type MutationRunMaxSynchronousWorkerArgs = {
4349
4506
  input: RunMaxSynchronousWorkerInput;
4350
4507
  };
@@ -4470,6 +4627,11 @@ export type MutationUpdateUserLocaleArgs = {
4470
4627
  };
4471
4628
 
4472
4629
 
4630
+ export type MutationUpdateWatcherLeadCapsArgs = {
4631
+ input: UpdateWatcherLeadCapsInput;
4632
+ };
4633
+
4634
+
4473
4635
  export type MutationValidateContactArgs = {
4474
4636
  input: ValidateContactInput;
4475
4637
  };
@@ -4569,7 +4731,7 @@ export type Organization = Node & {
4569
4731
  domainReachableAt?: Maybe<Scalars['ISO8601DateTime']['output']>;
4570
4732
  /** Year the company was founded. */
4571
4733
  foundedYear?: Maybe<Scalars['Int']['output']>;
4572
- /** GlobalID-encoded organization id. */
4734
+ /** GlobalID-encoded Organization id. */
4573
4735
  id: Scalars['ID']['output'];
4574
4736
  /** Primary industry classification. */
4575
4737
  industry?: Maybe<Scalars['String']['output']>;
@@ -4616,6 +4778,7 @@ export type OrganizationOrganizationAddressesArgs = {
4616
4778
  before?: InputMaybe<Scalars['String']['input']>;
4617
4779
  first?: InputMaybe<Scalars['Int']['input']>;
4618
4780
  isHeadquarters?: InputMaybe<Scalars['Boolean']['input']>;
4781
+ kind?: InputMaybe<OrganizationAddressKind>;
4619
4782
  last?: InputMaybe<Scalars['Int']['input']>;
4620
4783
  };
4621
4784
 
@@ -4624,6 +4787,8 @@ export type OrganizationAddress = Node & {
4624
4787
  __typename?: 'OrganizationAddress';
4625
4788
  /** City where the office is located. */
4626
4789
  city?: Maybe<Scalars['String']['output']>;
4790
+ /** Geographic coordinates of the address as a GeoJSON Point. */
4791
+ coordinates?: Maybe<Coordinate>;
4627
4792
  /** ISO 3166-1 alpha-2 country code. */
4628
4793
  countryCode?: Maybe<Scalars['String']['output']>;
4629
4794
  /** Human-readable country name derived from country_code. */
@@ -4631,12 +4796,15 @@ export type OrganizationAddress = Node & {
4631
4796
  /** When the address was created. */
4632
4797
  createdAt: Scalars['ISO8601DateTime']['output'];
4633
4798
  id: Scalars['ID']['output'];
4634
- /** Whether this is the organization's headquarters. */
4799
+ /**
4800
+ * Whether this is the organization's headquarters.
4801
+ * @deprecated Use `kind == HEADQUARTERS` instead.
4802
+ */
4635
4803
  isHeadquarters: Scalars['Boolean']['output'];
4636
- /** Geographic latitude. */
4637
- latitude?: Maybe<Scalars['Float']['output']>;
4638
- /** Geographic longitude. */
4639
- longitude?: Maybe<Scalars['Float']['output']>;
4804
+ /** Classification of this address: headquarters, office, or unattended. */
4805
+ kind: OrganizationAddressKind;
4806
+ /** Mercator location divisions for this office address. Empty until the background enrichment job runs. */
4807
+ locations: LocationConnection;
4640
4808
  /** Postal or ZIP code. */
4641
4809
  postalCode?: Maybe<Scalars['String']['output']>;
4642
4810
  /** State or province. */
@@ -4647,6 +4815,15 @@ export type OrganizationAddress = Node & {
4647
4815
  updatedAt: Scalars['ISO8601DateTime']['output'];
4648
4816
  };
4649
4817
 
4818
+
4819
+ /** A physical address of an organization. */
4820
+ export type OrganizationAddressLocationsArgs = {
4821
+ after?: InputMaybe<Scalars['String']['input']>;
4822
+ before?: InputMaybe<Scalars['String']['input']>;
4823
+ first?: InputMaybe<Scalars['Int']['input']>;
4824
+ last?: InputMaybe<Scalars['Int']['input']>;
4825
+ };
4826
+
4650
4827
  /** The connection type for OrganizationAddress. */
4651
4828
  export type OrganizationAddressConnection = {
4652
4829
  __typename?: 'OrganizationAddressConnection';
@@ -4670,6 +4847,15 @@ export type OrganizationAddressEdge = Node & {
4670
4847
  node?: Maybe<OrganizationAddress>;
4671
4848
  };
4672
4849
 
4850
+ /** Classification of an organization address. */
4851
+ export type OrganizationAddressKind =
4852
+ /** The organization's elected headquarters. */
4853
+ | 'HEADQUARTERS'
4854
+ /** A staffed office or branch location. */
4855
+ | 'OFFICE'
4856
+ /** A location with no on-site staff (e.g. an ATM or EV charging station). */
4857
+ | 'UNATTENDED';
4858
+
4673
4859
  /** Parameters for an organization search by visitor IP address. */
4674
4860
  export type OrganizationByIpInput = {
4675
4861
  /** Visitor's ISO 3166-1 alpha-2 country code — boosts matching accuracy. */
@@ -4712,7 +4898,10 @@ export type OrganizationFilterInput = {
4712
4898
  companySize?: InputMaybe<RangeFilterInput>;
4713
4899
  /** Filter by confidence score (0.0–1.0). */
4714
4900
  confidenceScore?: InputMaybe<FloatFilterInput>;
4715
- /** Filter by ISO 3166-1 alpha-2 country code. */
4901
+ /**
4902
+ * Filter by ISO 3166-1 alpha-2 country code.
4903
+ * @deprecated Use divisionIds for geographic filtering. divisionIds supports cities, regions, and multi-country groups (DACH, BENELUX) via Mercator.
4904
+ */
4716
4905
  countryCode?: InputMaybe<StringFilterInput>;
4717
4906
  /**
4718
4907
  * Description embedding filters. Each entry matches organizations whose
@@ -4724,6 +4913,13 @@ export type OrganizationFilterInput = {
4724
4913
  * Threshold validated by the embedding_calibration test suite.
4725
4914
  */
4726
4915
  description?: InputMaybe<Array<EmbeddingFilterInput>>;
4916
+ /**
4917
+ * Filter organizations that have at least one address belonging to any of the
4918
+ * given Mercator location division IDs. `eq`/`in` match organizations with at
4919
+ * least one overlapping division; `not_eq`/`not_in` exclude them. This is an
4920
+ * array-overlap filter against Mercator-encoded division IDs, not a scalar Atlas ID filter.
4921
+ */
4922
+ divisionIds?: InputMaybe<IdFilterInput>;
4727
4923
  /** Filter by organization global id. */
4728
4924
  id?: InputMaybe<IdFilterInput>;
4729
4925
  /**
@@ -5476,8 +5672,8 @@ export type Query = {
5476
5672
  /** Liveness probe for the billing subgraph. */
5477
5673
  billingPing: Scalars['String']['output'];
5478
5674
  /**
5479
- * Static catalog of plans (Starter / Growth / Scale × monthly / annual). Drives
5480
- * the upgrade ladder UI without round-tripping Stripe.
5675
+ * Static catalog of plans (Starter / Growth / Scale × monthly / annual) for one
5676
+ * product. Drives the upgrade ladder UI without round-tripping Stripe.
5481
5677
  */
5482
5678
  billingPlanCatalog: Array<BillingPlanCatalogEntry>;
5483
5679
  /**
@@ -5564,6 +5760,11 @@ export type QueryBillingCustomerArgs = {
5564
5760
  };
5565
5761
 
5566
5762
 
5763
+ export type QueryBillingPlanCatalogArgs = {
5764
+ product?: InputMaybe<BillingProduct>;
5765
+ };
5766
+
5767
+
5567
5768
  export type QueryContactsArgs = {
5568
5769
  after?: InputMaybe<Scalars['String']['input']>;
5569
5770
  before?: InputMaybe<Scalars['String']['input']>;
@@ -5931,29 +6132,6 @@ export type RevokeInvitationPayload = Node & {
5931
6132
  invitation: Invitation;
5932
6133
  };
5933
6134
 
5934
- /** Autogenerated input type of RotateIntegrationCredential */
5935
- export type RotateIntegrationCredentialInput = {
5936
- /** A unique identifier for the client performing the mutation. */
5937
- clientMutationId?: InputMaybe<Scalars['String']['input']>;
5938
- /**
5939
- * Partial payload to merge into the integration's existing data blob (e.g. `{
5940
- * cookies: { li_at: "..." } }` for LinkedIn). Existing keys not present in the
5941
- * payload are preserved.
5942
- */
5943
- data: Scalars['JSON']['input'];
5944
- /** Global ID of the integration whose credential rotated. */
5945
- id: Scalars['ID']['input'];
5946
- };
5947
-
5948
- /** Autogenerated return type of RotateIntegrationCredential. */
5949
- export type RotateIntegrationCredentialPayload = Node & {
5950
- __typename?: 'RotateIntegrationCredentialPayload';
5951
- /** A unique identifier for the client performing the mutation. */
5952
- clientMutationId?: Maybe<Scalars['String']['output']>;
5953
- id: Scalars['ID']['output'];
5954
- integration: Integration;
5955
- };
5956
-
5957
6135
  /** Federation reference to a Routine owned by another subgraph. */
5958
6136
  export type Routine = Node & TrackableInterface & {
5959
6137
  __typename?: 'Routine';
@@ -7461,6 +7639,26 @@ export type UpdateUserLocalePayload = Node & {
7461
7639
  user: User;
7462
7640
  };
7463
7641
 
7642
+ /** Autogenerated input type of UpdateWatcherLeadCaps */
7643
+ export type UpdateWatcherLeadCapsInput = {
7644
+ /** A unique identifier for the client performing the mutation. */
7645
+ clientMutationId?: InputMaybe<Scalars['String']['input']>;
7646
+ /** Global id of the Watcher whose caps are being replaced. */
7647
+ id: Scalars['ID']['input'];
7648
+ /** The full set of caps for the Watcher. Pass an empty list to remove all caps (leaving the Watcher uncapped). */
7649
+ leadCaps: Array<LeadCapInput>;
7650
+ };
7651
+
7652
+ /** Autogenerated return type of UpdateWatcherLeadCaps. */
7653
+ export type UpdateWatcherLeadCapsPayload = Node & {
7654
+ __typename?: 'UpdateWatcherLeadCapsPayload';
7655
+ /** A unique identifier for the client performing the mutation. */
7656
+ clientMutationId?: Maybe<Scalars['String']['output']>;
7657
+ id: Scalars['ID']['output'];
7658
+ /** The updated Watcher. */
7659
+ watcher: Watcher;
7660
+ };
7661
+
7464
7662
  /** Federation reference to a User owned by another subgraph. */
7465
7663
  export type User = Node & {
7466
7664
  __typename?: 'User';
@@ -7715,6 +7913,8 @@ export type Watcher = AcquisitionerInterface & Node & {
7715
7913
  * provider requires client-side setup.
7716
7914
  */
7717
7915
  installations: Array<Scalars['JSON']['output']>;
7916
+ /** Freshness-first per-period lead caps applied to this Watcher. Empty when the Watcher is uncapped. */
7917
+ leadCaps: WatcherLeadCapConnection;
7718
7918
  /** Human-readable display name of the Watcher, derived from the signal Definition it tracks. */
7719
7919
  name: Scalars['String']['output'];
7720
7920
  /** Timestamp of the most recent change to this Watcher. */
@@ -7732,6 +7932,59 @@ export type WatcherEventsArgs = {
7732
7932
  last?: InputMaybe<Scalars['Int']['input']>;
7733
7933
  };
7734
7934
 
7935
+
7936
+ /** Federation reference to a Watcher owned by another subgraph. */
7937
+ export type WatcherLeadCapsArgs = {
7938
+ after?: InputMaybe<Scalars['String']['input']>;
7939
+ before?: InputMaybe<Scalars['String']['input']>;
7940
+ first?: InputMaybe<Scalars['Int']['input']>;
7941
+ last?: InputMaybe<Scalars['Int']['input']>;
7942
+ };
7943
+
7944
+ /**
7945
+ * A freshness-first lead cap on a Watcher: at most `maximumLeads` events are
7946
+ * surfaced per `period`, counted from `startsAt` and reset at every period boundary.
7947
+ */
7948
+ export type WatcherLeadCap = Node & {
7949
+ __typename?: 'WatcherLeadCap';
7950
+ /** Timestamp when the cap was created. */
7951
+ createdAt: Scalars['ISO8601DateTime']['output'];
7952
+ /** Start of the window currently accumulating; events are counted from here and the usage resets at the next boundary. */
7953
+ currentPeriodStartsAt: Scalars['ISO8601DateTime']['output'];
7954
+ /** Number of events already surfaced in the current window. The cap drops further events once this reaches `maximumLeads`. */
7955
+ currentUsage: Scalars['Int']['output'];
7956
+ id: Scalars['ID']['output'];
7957
+ /** Maximum number of events surfaced per period. */
7958
+ maximumLeads: Scalars['Int']['output'];
7959
+ /** Length of the accumulation window as an ISO-8601 duration, e.g. P1D or P1W. */
7960
+ period: Scalars['ISO8601Duration']['output'];
7961
+ /** Anchor at which the first period begins; each window is measured forward from here. */
7962
+ startsAt: Scalars['ISO8601DateTime']['output'];
7963
+ };
7964
+
7965
+ /** The connection type for WatcherLeadCap. */
7966
+ export type WatcherLeadCapConnection = {
7967
+ __typename?: 'WatcherLeadCapConnection';
7968
+ /** A list of edges. */
7969
+ edges?: Maybe<Array<Maybe<WatcherLeadCapEdge>>>;
7970
+ /** A list of nodes. */
7971
+ nodes?: Maybe<Array<Maybe<WatcherLeadCap>>>;
7972
+ /** Information to aid in pagination. */
7973
+ pageInfo: PageInfo;
7974
+ /** Total number of items across all pages. */
7975
+ totalCount: Scalars['Int']['output'];
7976
+ };
7977
+
7978
+ /** An edge in a connection. */
7979
+ export type WatcherLeadCapEdge = Node & {
7980
+ __typename?: 'WatcherLeadCapEdge';
7981
+ /** A cursor for use in pagination. */
7982
+ cursor: Scalars['String']['output'];
7983
+ id: Scalars['ID']['output'];
7984
+ /** The item at the end of the edge. */
7985
+ node?: Maybe<WatcherLeadCap>;
7986
+ };
7987
+
7735
7988
  /** Delivery endpoint registered on a Watcher. Secrets are write-only — they are never returned by the API. */
7736
7989
  export type WatcherWebhookInput = {
7737
7990
  /**
@@ -62,10 +62,13 @@ function buildSelections(
62
62
  const lines: string[] = [];
63
63
  const isPayload = PAYLOAD_TYPE_PATTERN.test(type.name);
64
64
 
65
- // Relay Connection pattern
65
+ // Relay Connection pattern. The connection/`nodes` wrapper is not a semantic
66
+ // nesting level, so the node type inherits the caller's `depth` unchanged —
67
+ // otherwise object fields on the node (e.g. Contact.organization) would never
68
+ // be selected regardless of --depth.
66
69
  if (type.name.endsWith('Connection') && fields.nodes && fields.pageInfo) {
67
70
  const nodesType = unwrap(fields.nodes.type);
68
- const nodeSelections = buildSelections(nodesType, schema, 0, exclude, `${prefix}nodes.`, new Set(visited));
71
+ const nodeSelections = buildSelections(nodesType, schema, depth, exclude, `${prefix}nodes.`, new Set(visited));
69
72
  if (nodeSelections.length === 0) return [];
70
73
  lines.push(`nodes {`);
71
74
  for (const sel of nodeSelections) lines.push(` ${sel}`);