@chainpatrol/sdk 1.6.0 → 1.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # @chainpatrol/sdk
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 33ba556: Adds time-to-takedown trends: `client.getMetricsTakedownTimeTrend()` in the SDK
8
+ and `chainpatrol metrics takedown-time-trend --org <slug>` in the CLI, both
9
+ backed by the new `POST /metrics/takedown-time/trend` endpoint. Returns the
10
+ median time from takedown start to completion bucketed by the month a takedown
11
+ completed, over a trailing window of whole months, plus the month-over-month
12
+ change for each series. Pass `assetTypes` (max 5) to get one series per asset
13
+ type instead of a single pooled series.
14
+
15
+ The month-over-month comparison uses the two most recent months that actually
16
+ had completed takedowns, so a quiet month in between doesn't read as "no
17
+ change", and `direction` reads lower-is-better: `"improved"` means the median
18
+ fell. Months with no completed takedowns carry a `null` median rather than zero.
19
+
20
+ Server-side work lives in @chainpatrol/external-trpc, @chainpatrol/validation
21
+ and @chainpatrol/metrics; all three are private packages and don't need version
22
+ bumps. The endpoint is gated on the new `median-time-to-takedown-trends-api`
23
+ feature flag, separate from the flag on `POST /metrics/takedown-time`.
24
+
25
+ ## 1.7.0
26
+
27
+ ### Minor Changes
28
+
29
+ - f98f547: Expose asset scan IDs and creation timestamps in asset search results.
30
+ - 9f19c88: Adds time-to-takedown metrics: `client.getMetricsTakedownTime()` in the SDK and
31
+ `chainpatrol metrics takedown-time --org <slug>` in the CLI, both backed by the
32
+ new `POST /metrics/takedown-time` endpoint. Returns the median time from
33
+ takedown start to completion per asset type, over an optional date range.
34
+
35
+ Also adds `parseIsoDateEndOfDay` to `@chainpatrol/sdk/api`: a date-only bound
36
+ such as `2026-08-18` now covers that whole day instead of cutting off at
37
+ midnight UTC. Server-side work lives in @chainpatrol/external-trpc and
38
+ @chainpatrol/validation; both are private packages and don't need version bumps.
39
+
40
+ - b037a0b: `GET /organization/assets` now accepts an optional `slug`, so callers whose
41
+ credentials reach more than one organization (user-scoped API keys, staff and
42
+ member sessions) can pick one instead of getting a flat 401. Organization-scoped
43
+ keys keep working unchanged when they omit it.
44
+
45
+ In the SDK, `client.listOrganizationAssets()` takes a `slug`. In the CLI,
46
+ `chainpatrol orgs assets list` forwards `--org <slug>` when one is set — the
47
+ existing no-flag invocation still resolves the org from an org-scoped key.
48
+
49
+ Server-side work lives in @chainpatrol/external-trpc and @chainpatrol/validation;
50
+ both are private packages and don't need version bumps.
51
+
3
52
  ## 1.6.0
4
53
 
5
54
  ### Minor Changes
@@ -65,6 +65,8 @@ interface ApiClient {
65
65
  getMetricsSummary: (input: MetricsSummaryInput) => Promise<MetricsSummaryResult>;
66
66
  getMetricsFound: (input: MetricsFoundInput) => Promise<MetricsFoundResult>;
67
67
  getMetricsBreakdown: (input: MetricsBreakdownInput) => Promise<MetricsBreakdownResult>;
68
+ getMetricsTakedownTime: (input: MetricsTakedownTimeInput) => Promise<MetricsTakedownTimeResult>;
69
+ getMetricsTakedownTimeTrend: (input: MetricsTakedownTimeTrendInput) => Promise<MetricsTakedownTimeTrendResult>;
68
70
  createReport: (input: ReportCreateInput) => Promise<ReportCreateResult>;
69
71
  listOrganizationReports: (input: OrganizationReportsListInput) => Promise<OrganizationReportsListResult>;
70
72
  reviewOrganizationProposal: (input: OrganizationProposalsReviewInput) => Promise<OrganizationProposalsReviewResult>;
@@ -130,6 +132,11 @@ interface AssetSearchResultItem {
130
132
  status: string;
131
133
  createdAt: string;
132
134
  }>;
135
+ scans: Array<{
136
+ id: number;
137
+ /** When the asset scan was created (ISO 8601, UTC). */
138
+ createdAt: string;
139
+ }>;
133
140
  takedown: {
134
141
  id: number;
135
142
  status: string;
@@ -416,6 +423,54 @@ interface MetricsBreakdownResult {
416
423
  brandName?: string;
417
424
  }>;
418
425
  }
426
+ interface MetricsTakedownTimeInput {
427
+ slug: string;
428
+ startDate?: string;
429
+ endDate?: string;
430
+ blockLabel?: string;
431
+ brandType?: "INDIVIDUAL" | "ORGANIZATION" | "PRODUCT";
432
+ countryCodes?: string[];
433
+ brandIds?: number[];
434
+ }
435
+ interface MetricsTakedownTimeResult {
436
+ byAssetType: Array<{
437
+ assetType: string;
438
+ medianTakedownMinutes: number;
439
+ medianTakedownHours: number;
440
+ medianTakedownDays: number;
441
+ count: number;
442
+ }>;
443
+ }
444
+ interface MetricsTakedownTimeTrendInput {
445
+ slug: string;
446
+ months?: number;
447
+ assetTypes?: string[];
448
+ blockLabel?: string;
449
+ brandType?: "INDIVIDUAL" | "ORGANIZATION" | "PRODUCT";
450
+ countryCodes?: string[];
451
+ brandIds?: number[];
452
+ }
453
+ interface MetricsTakedownTimeTrendPoint {
454
+ period: string;
455
+ medianTakedownMinutes: number | null;
456
+ medianTakedownHours: number | null;
457
+ medianTakedownDays: number | null;
458
+ count: number;
459
+ }
460
+ interface MetricsTakedownTimeTrendResult {
461
+ months: number;
462
+ periods: string[];
463
+ series: Array<{
464
+ assetType: string | null;
465
+ points: MetricsTakedownTimeTrendPoint[];
466
+ change: {
467
+ latest: MetricsTakedownTimeTrendPoint | null;
468
+ previous: MetricsTakedownTimeTrendPoint | null;
469
+ percentChange: number | null;
470
+ direction: "improved" | "worsened" | "unchanged" | null;
471
+ };
472
+ }>;
473
+ }
419
474
  interface ReportAssetInput {
420
475
  content: string;
421
476
  status?: "BLOCKED" | "ALLOWED" | "UNKNOWN";
@@ -752,6 +807,7 @@ interface ThreatsListResult {
752
807
  next_page: string | null;
753
808
  }
754
809
  interface OrganizationAssetsListInput {
810
+ slug?: string;
755
811
  type?: string;
756
812
  groupId?: number;
757
813
  query?: string;
@@ -1316,6 +1372,8 @@ declare class ChainPatrolApiClient implements ApiClient {
1316
1372
  getMetricsSummary(input: MetricsSummaryInput): Promise<MetricsSummaryResult>;
1317
1373
  getMetricsFound(input: MetricsFoundInput): Promise<MetricsFoundResult>;
1318
1374
  getMetricsBreakdown(input: MetricsBreakdownInput): Promise<MetricsBreakdownResult>;
1375
+ getMetricsTakedownTime(input: MetricsTakedownTimeInput): Promise<MetricsTakedownTimeResult>;
1376
+ getMetricsTakedownTimeTrend(input: MetricsTakedownTimeTrendInput): Promise<MetricsTakedownTimeTrendResult>;
1319
1377
  createReport(input: ReportCreateInput): Promise<ReportCreateResult>;
1320
1378
  listOrganizationReports(input: OrganizationReportsListInput): Promise<OrganizationReportsListResult>;
1321
1379
  reviewOrganizationProposal(input: OrganizationProposalsReviewInput): Promise<OrganizationProposalsReviewResult>;
@@ -1338,5 +1396,12 @@ declare class ChainPatrolApiClient implements ApiClient {
1338
1396
 
1339
1397
  declare function parseIsoDate(value: string | undefined): Date | undefined;
1340
1398
  declare function parseIsoDateString(value: string | undefined): string | undefined;
1399
+ /**
1400
+ * Same validation as `parseIsoDate`, but a date-only value covers the whole day
1401
+ * rather than collapsing to its first instant. An endpoint filtering on "up to
1402
+ * and including this date" would otherwise cut off at midnight UTC and drop
1403
+ * everything recorded on the day the caller asked for.
1404
+ */
1405
+ declare function parseIsoDateEndOfDay(value: string | undefined): Date | undefined;
1341
1406
 
1342
- export { ACTOR_KINDS, type ActorKind, type ApiClient, type ApiCredential, type AssetCheckInput, type AssetCheckResult, type AssetCheckSourceEntry, type AssetCheckStatus, type AssetGroupItem, type AssetListInput, type AssetListItem, type AssetListResult, type AssetSearchInput, type AssetSearchResult, type AssetSearchResultItem, type BrandItem, type BrandLegalDocument, type BrandLegalDocuments, type BrandTrademarkRegistrationItem, type BrandType, ChainPatrolApiClient, type ChainPatrolApiClientOptions, type ConfigEntry, type CredentialProvider, type CustomerReviewDecision, DETECTION_CONFIDENCE_LEVELS, DETECTION_REPORTED_FILTERS, type DetectionBrand, type DetectionConfidence, type DetectionConfigRunInput, type DetectionConfigRunResult, type DetectionConfigUpdateInput, type DetectionConfigUpdateResult, type DetectionConfigValidateInput, type DetectionConfigValidateResult, type DetectionDriftInput, type DetectionDriftResult, type DetectionListInput, type DetectionListItem, type DetectionListResult, type DetectionReportStatus, type DetectionReportedFilter, type DetectionSource, type HealthcheckCategory, type HealthcheckFinding, type HealthcheckRegistryEntry, type HealthcheckResult, type HealthcheckSeverity, type HealthchecksListResult, LIVENESS_FILTER_VALUES, LIVENESS_STATUSES, type LivenessFilterValue, type LivenessStatus, type MetricsBreakdownInput, type MetricsBreakdownResult, type MetricsFoundInput, type MetricsFoundResult, type MetricsSummaryInput, type MetricsSummaryResult, ORGANIZATION_METRICS_INCLUDE_FIELDS, type OperationsQueuesSnapshotInput, type OperationsQueuesSnapshotResult, type OrganizationAssetGroupsListResult, type OrganizationAssetItem, type OrganizationAssetsListInput, type OrganizationAssetsListResult, type OrganizationBrandsListResult, type OrganizationMetricsIncludeField, type OrganizationMetricsInput, type OrganizationMetricsResult, type OrganizationMetricsResultMetrics, type OrganizationMetricsServicesFilter, type OrganizationMetricsVisibility, type OrganizationPortalVisibility, type OrganizationProposalsReviewInput, type OrganizationProposalsReviewResult, type OrganizationReportAssetScan, type OrganizationReportAssetScanEnrichment, type OrganizationReportAttachment, type OrganizationReportVisibility, type OrganizationReportsListInput, type OrganizationReportsListResult, PROPOSAL_REJECT_REASONS, PROPOSAL_WATCHLIST_REASONS, type PendingApprovalService, type PendingServiceApproval, type ProposalRejectReason, type ProposalWatchlistReason, REPORT_REVIEW_DECISIONS, REPORT_STATUSES, type ReportAssetInput, type ReportCreateInput, type ReportCreateResult, type ReportReviewDecision, type ReportStatus, type ReportsSearchInput, type ReportsSearchResult, type ReportsSearchResultItem, TAKEDOWN_SORT_KEYS, TAKEDOWN_STATUSES, type TakedownItem, type TakedownProviderRef, type TakedownSortKey, type TakedownStatus, type TakedownsListInput, type TakedownsListResult, type ThreatItem, type ThreatsListInput, type ThreatsListResult, type UserMeResult, type UserOrg, type UserOrgBrandMetadata, type UserOrgGetInput, type UserOrgGetResult, type UserOrgIntegrations, type UserOrgLegalDocument, type UserOrgLegalDocuments, type UserOrgPortalCustomization, type UserOrgTrademarkRegistration, type UserOrgsInput, type UserOrgsObligatoryAdminApprovalFilter, type UserOrgsPendingServiceApprovalFilter, type UserOrgsResult, type UserOrgsServiceFilters, type UserOrgsSubscriptionStatus, type ValidateApiKeyResult, WATCHLIST_FILTER_VALUES, type WatchlistFilterValue, parseIsoDate, parseIsoDateString, staticApiKey, staticBearerToken };
1407
+ export { ACTOR_KINDS, type ActorKind, type ApiClient, type ApiCredential, type AssetCheckInput, type AssetCheckResult, type AssetCheckSourceEntry, type AssetCheckStatus, type AssetGroupItem, type AssetListInput, type AssetListItem, type AssetListResult, type AssetSearchInput, type AssetSearchResult, type AssetSearchResultItem, type BrandItem, type BrandLegalDocument, type BrandLegalDocuments, type BrandTrademarkRegistrationItem, type BrandType, ChainPatrolApiClient, type ChainPatrolApiClientOptions, type ConfigEntry, type CredentialProvider, type CustomerReviewDecision, DETECTION_CONFIDENCE_LEVELS, DETECTION_REPORTED_FILTERS, type DetectionBrand, type DetectionConfidence, type DetectionConfigRunInput, type DetectionConfigRunResult, type DetectionConfigUpdateInput, type DetectionConfigUpdateResult, type DetectionConfigValidateInput, type DetectionConfigValidateResult, type DetectionDriftInput, type DetectionDriftResult, type DetectionListInput, type DetectionListItem, type DetectionListResult, type DetectionReportStatus, type DetectionReportedFilter, type DetectionSource, type HealthcheckCategory, type HealthcheckFinding, type HealthcheckRegistryEntry, type HealthcheckResult, type HealthcheckSeverity, type HealthchecksListResult, LIVENESS_FILTER_VALUES, LIVENESS_STATUSES, type LivenessFilterValue, type LivenessStatus, type MetricsBreakdownInput, type MetricsBreakdownResult, type MetricsFoundInput, type MetricsFoundResult, type MetricsSummaryInput, type MetricsSummaryResult, type MetricsTakedownTimeInput, type MetricsTakedownTimeResult, type MetricsTakedownTimeTrendInput, type MetricsTakedownTimeTrendPoint, type MetricsTakedownTimeTrendResult, ORGANIZATION_METRICS_INCLUDE_FIELDS, type OperationsQueuesSnapshotInput, type OperationsQueuesSnapshotResult, type OrganizationAssetGroupsListResult, type OrganizationAssetItem, type OrganizationAssetsListInput, type OrganizationAssetsListResult, type OrganizationBrandsListResult, type OrganizationMetricsIncludeField, type OrganizationMetricsInput, type OrganizationMetricsResult, type OrganizationMetricsResultMetrics, type OrganizationMetricsServicesFilter, type OrganizationMetricsVisibility, type OrganizationPortalVisibility, type OrganizationProposalsReviewInput, type OrganizationProposalsReviewResult, type OrganizationReportAssetScan, type OrganizationReportAssetScanEnrichment, type OrganizationReportAttachment, type OrganizationReportVisibility, type OrganizationReportsListInput, type OrganizationReportsListResult, PROPOSAL_REJECT_REASONS, PROPOSAL_WATCHLIST_REASONS, type PendingApprovalService, type PendingServiceApproval, type ProposalRejectReason, type ProposalWatchlistReason, REPORT_REVIEW_DECISIONS, REPORT_STATUSES, type ReportAssetInput, type ReportCreateInput, type ReportCreateResult, type ReportReviewDecision, type ReportStatus, type ReportsSearchInput, type ReportsSearchResult, type ReportsSearchResultItem, TAKEDOWN_SORT_KEYS, TAKEDOWN_STATUSES, type TakedownItem, type TakedownProviderRef, type TakedownSortKey, type TakedownStatus, type TakedownsListInput, type TakedownsListResult, type ThreatItem, type ThreatsListInput, type ThreatsListResult, type UserMeResult, type UserOrg, type UserOrgBrandMetadata, type UserOrgGetInput, type UserOrgGetResult, type UserOrgIntegrations, type UserOrgLegalDocument, type UserOrgLegalDocuments, type UserOrgPortalCustomization, type UserOrgTrademarkRegistration, type UserOrgsInput, type UserOrgsObligatoryAdminApprovalFilter, type UserOrgsPendingServiceApprovalFilter, type UserOrgsResult, type UserOrgsServiceFilters, type UserOrgsSubscriptionStatus, type ValidateApiKeyResult, WATCHLIST_FILTER_VALUES, type WatchlistFilterValue, parseIsoDate, parseIsoDateEndOfDay, parseIsoDateString, staticApiKey, staticBearerToken };
@@ -65,6 +65,8 @@ interface ApiClient {
65
65
  getMetricsSummary: (input: MetricsSummaryInput) => Promise<MetricsSummaryResult>;
66
66
  getMetricsFound: (input: MetricsFoundInput) => Promise<MetricsFoundResult>;
67
67
  getMetricsBreakdown: (input: MetricsBreakdownInput) => Promise<MetricsBreakdownResult>;
68
+ getMetricsTakedownTime: (input: MetricsTakedownTimeInput) => Promise<MetricsTakedownTimeResult>;
69
+ getMetricsTakedownTimeTrend: (input: MetricsTakedownTimeTrendInput) => Promise<MetricsTakedownTimeTrendResult>;
68
70
  createReport: (input: ReportCreateInput) => Promise<ReportCreateResult>;
69
71
  listOrganizationReports: (input: OrganizationReportsListInput) => Promise<OrganizationReportsListResult>;
70
72
  reviewOrganizationProposal: (input: OrganizationProposalsReviewInput) => Promise<OrganizationProposalsReviewResult>;
@@ -130,6 +132,11 @@ interface AssetSearchResultItem {
130
132
  status: string;
131
133
  createdAt: string;
132
134
  }>;
135
+ scans: Array<{
136
+ id: number;
137
+ /** When the asset scan was created (ISO 8601, UTC). */
138
+ createdAt: string;
139
+ }>;
133
140
  takedown: {
134
141
  id: number;
135
142
  status: string;
@@ -416,6 +423,54 @@ interface MetricsBreakdownResult {
416
423
  brandName?: string;
417
424
  }>;
418
425
  }
426
+ interface MetricsTakedownTimeInput {
427
+ slug: string;
428
+ startDate?: string;
429
+ endDate?: string;
430
+ blockLabel?: string;
431
+ brandType?: "INDIVIDUAL" | "ORGANIZATION" | "PRODUCT";
432
+ countryCodes?: string[];
433
+ brandIds?: number[];
434
+ }
435
+ interface MetricsTakedownTimeResult {
436
+ byAssetType: Array<{
437
+ assetType: string;
438
+ medianTakedownMinutes: number;
439
+ medianTakedownHours: number;
440
+ medianTakedownDays: number;
441
+ count: number;
442
+ }>;
443
+ }
444
+ interface MetricsTakedownTimeTrendInput {
445
+ slug: string;
446
+ months?: number;
447
+ assetTypes?: string[];
448
+ blockLabel?: string;
449
+ brandType?: "INDIVIDUAL" | "ORGANIZATION" | "PRODUCT";
450
+ countryCodes?: string[];
451
+ brandIds?: number[];
452
+ }
453
+ interface MetricsTakedownTimeTrendPoint {
454
+ period: string;
455
+ medianTakedownMinutes: number | null;
456
+ medianTakedownHours: number | null;
457
+ medianTakedownDays: number | null;
458
+ count: number;
459
+ }
460
+ interface MetricsTakedownTimeTrendResult {
461
+ months: number;
462
+ periods: string[];
463
+ series: Array<{
464
+ assetType: string | null;
465
+ points: MetricsTakedownTimeTrendPoint[];
466
+ change: {
467
+ latest: MetricsTakedownTimeTrendPoint | null;
468
+ previous: MetricsTakedownTimeTrendPoint | null;
469
+ percentChange: number | null;
470
+ direction: "improved" | "worsened" | "unchanged" | null;
471
+ };
472
+ }>;
473
+ }
419
474
  interface ReportAssetInput {
420
475
  content: string;
421
476
  status?: "BLOCKED" | "ALLOWED" | "UNKNOWN";
@@ -752,6 +807,7 @@ interface ThreatsListResult {
752
807
  next_page: string | null;
753
808
  }
754
809
  interface OrganizationAssetsListInput {
810
+ slug?: string;
755
811
  type?: string;
756
812
  groupId?: number;
757
813
  query?: string;
@@ -1316,6 +1372,8 @@ declare class ChainPatrolApiClient implements ApiClient {
1316
1372
  getMetricsSummary(input: MetricsSummaryInput): Promise<MetricsSummaryResult>;
1317
1373
  getMetricsFound(input: MetricsFoundInput): Promise<MetricsFoundResult>;
1318
1374
  getMetricsBreakdown(input: MetricsBreakdownInput): Promise<MetricsBreakdownResult>;
1375
+ getMetricsTakedownTime(input: MetricsTakedownTimeInput): Promise<MetricsTakedownTimeResult>;
1376
+ getMetricsTakedownTimeTrend(input: MetricsTakedownTimeTrendInput): Promise<MetricsTakedownTimeTrendResult>;
1319
1377
  createReport(input: ReportCreateInput): Promise<ReportCreateResult>;
1320
1378
  listOrganizationReports(input: OrganizationReportsListInput): Promise<OrganizationReportsListResult>;
1321
1379
  reviewOrganizationProposal(input: OrganizationProposalsReviewInput): Promise<OrganizationProposalsReviewResult>;
@@ -1338,5 +1396,12 @@ declare class ChainPatrolApiClient implements ApiClient {
1338
1396
 
1339
1397
  declare function parseIsoDate(value: string | undefined): Date | undefined;
1340
1398
  declare function parseIsoDateString(value: string | undefined): string | undefined;
1399
+ /**
1400
+ * Same validation as `parseIsoDate`, but a date-only value covers the whole day
1401
+ * rather than collapsing to its first instant. An endpoint filtering on "up to
1402
+ * and including this date" would otherwise cut off at midnight UTC and drop
1403
+ * everything recorded on the day the caller asked for.
1404
+ */
1405
+ declare function parseIsoDateEndOfDay(value: string | undefined): Date | undefined;
1341
1406
 
1342
- export { ACTOR_KINDS, type ActorKind, type ApiClient, type ApiCredential, type AssetCheckInput, type AssetCheckResult, type AssetCheckSourceEntry, type AssetCheckStatus, type AssetGroupItem, type AssetListInput, type AssetListItem, type AssetListResult, type AssetSearchInput, type AssetSearchResult, type AssetSearchResultItem, type BrandItem, type BrandLegalDocument, type BrandLegalDocuments, type BrandTrademarkRegistrationItem, type BrandType, ChainPatrolApiClient, type ChainPatrolApiClientOptions, type ConfigEntry, type CredentialProvider, type CustomerReviewDecision, DETECTION_CONFIDENCE_LEVELS, DETECTION_REPORTED_FILTERS, type DetectionBrand, type DetectionConfidence, type DetectionConfigRunInput, type DetectionConfigRunResult, type DetectionConfigUpdateInput, type DetectionConfigUpdateResult, type DetectionConfigValidateInput, type DetectionConfigValidateResult, type DetectionDriftInput, type DetectionDriftResult, type DetectionListInput, type DetectionListItem, type DetectionListResult, type DetectionReportStatus, type DetectionReportedFilter, type DetectionSource, type HealthcheckCategory, type HealthcheckFinding, type HealthcheckRegistryEntry, type HealthcheckResult, type HealthcheckSeverity, type HealthchecksListResult, LIVENESS_FILTER_VALUES, LIVENESS_STATUSES, type LivenessFilterValue, type LivenessStatus, type MetricsBreakdownInput, type MetricsBreakdownResult, type MetricsFoundInput, type MetricsFoundResult, type MetricsSummaryInput, type MetricsSummaryResult, ORGANIZATION_METRICS_INCLUDE_FIELDS, type OperationsQueuesSnapshotInput, type OperationsQueuesSnapshotResult, type OrganizationAssetGroupsListResult, type OrganizationAssetItem, type OrganizationAssetsListInput, type OrganizationAssetsListResult, type OrganizationBrandsListResult, type OrganizationMetricsIncludeField, type OrganizationMetricsInput, type OrganizationMetricsResult, type OrganizationMetricsResultMetrics, type OrganizationMetricsServicesFilter, type OrganizationMetricsVisibility, type OrganizationPortalVisibility, type OrganizationProposalsReviewInput, type OrganizationProposalsReviewResult, type OrganizationReportAssetScan, type OrganizationReportAssetScanEnrichment, type OrganizationReportAttachment, type OrganizationReportVisibility, type OrganizationReportsListInput, type OrganizationReportsListResult, PROPOSAL_REJECT_REASONS, PROPOSAL_WATCHLIST_REASONS, type PendingApprovalService, type PendingServiceApproval, type ProposalRejectReason, type ProposalWatchlistReason, REPORT_REVIEW_DECISIONS, REPORT_STATUSES, type ReportAssetInput, type ReportCreateInput, type ReportCreateResult, type ReportReviewDecision, type ReportStatus, type ReportsSearchInput, type ReportsSearchResult, type ReportsSearchResultItem, TAKEDOWN_SORT_KEYS, TAKEDOWN_STATUSES, type TakedownItem, type TakedownProviderRef, type TakedownSortKey, type TakedownStatus, type TakedownsListInput, type TakedownsListResult, type ThreatItem, type ThreatsListInput, type ThreatsListResult, type UserMeResult, type UserOrg, type UserOrgBrandMetadata, type UserOrgGetInput, type UserOrgGetResult, type UserOrgIntegrations, type UserOrgLegalDocument, type UserOrgLegalDocuments, type UserOrgPortalCustomization, type UserOrgTrademarkRegistration, type UserOrgsInput, type UserOrgsObligatoryAdminApprovalFilter, type UserOrgsPendingServiceApprovalFilter, type UserOrgsResult, type UserOrgsServiceFilters, type UserOrgsSubscriptionStatus, type ValidateApiKeyResult, WATCHLIST_FILTER_VALUES, type WatchlistFilterValue, parseIsoDate, parseIsoDateString, staticApiKey, staticBearerToken };
1407
+ export { ACTOR_KINDS, type ActorKind, type ApiClient, type ApiCredential, type AssetCheckInput, type AssetCheckResult, type AssetCheckSourceEntry, type AssetCheckStatus, type AssetGroupItem, type AssetListInput, type AssetListItem, type AssetListResult, type AssetSearchInput, type AssetSearchResult, type AssetSearchResultItem, type BrandItem, type BrandLegalDocument, type BrandLegalDocuments, type BrandTrademarkRegistrationItem, type BrandType, ChainPatrolApiClient, type ChainPatrolApiClientOptions, type ConfigEntry, type CredentialProvider, type CustomerReviewDecision, DETECTION_CONFIDENCE_LEVELS, DETECTION_REPORTED_FILTERS, type DetectionBrand, type DetectionConfidence, type DetectionConfigRunInput, type DetectionConfigRunResult, type DetectionConfigUpdateInput, type DetectionConfigUpdateResult, type DetectionConfigValidateInput, type DetectionConfigValidateResult, type DetectionDriftInput, type DetectionDriftResult, type DetectionListInput, type DetectionListItem, type DetectionListResult, type DetectionReportStatus, type DetectionReportedFilter, type DetectionSource, type HealthcheckCategory, type HealthcheckFinding, type HealthcheckRegistryEntry, type HealthcheckResult, type HealthcheckSeverity, type HealthchecksListResult, LIVENESS_FILTER_VALUES, LIVENESS_STATUSES, type LivenessFilterValue, type LivenessStatus, type MetricsBreakdownInput, type MetricsBreakdownResult, type MetricsFoundInput, type MetricsFoundResult, type MetricsSummaryInput, type MetricsSummaryResult, type MetricsTakedownTimeInput, type MetricsTakedownTimeResult, type MetricsTakedownTimeTrendInput, type MetricsTakedownTimeTrendPoint, type MetricsTakedownTimeTrendResult, ORGANIZATION_METRICS_INCLUDE_FIELDS, type OperationsQueuesSnapshotInput, type OperationsQueuesSnapshotResult, type OrganizationAssetGroupsListResult, type OrganizationAssetItem, type OrganizationAssetsListInput, type OrganizationAssetsListResult, type OrganizationBrandsListResult, type OrganizationMetricsIncludeField, type OrganizationMetricsInput, type OrganizationMetricsResult, type OrganizationMetricsResultMetrics, type OrganizationMetricsServicesFilter, type OrganizationMetricsVisibility, type OrganizationPortalVisibility, type OrganizationProposalsReviewInput, type OrganizationProposalsReviewResult, type OrganizationReportAssetScan, type OrganizationReportAssetScanEnrichment, type OrganizationReportAttachment, type OrganizationReportVisibility, type OrganizationReportsListInput, type OrganizationReportsListResult, PROPOSAL_REJECT_REASONS, PROPOSAL_WATCHLIST_REASONS, type PendingApprovalService, type PendingServiceApproval, type ProposalRejectReason, type ProposalWatchlistReason, REPORT_REVIEW_DECISIONS, REPORT_STATUSES, type ReportAssetInput, type ReportCreateInput, type ReportCreateResult, type ReportReviewDecision, type ReportStatus, type ReportsSearchInput, type ReportsSearchResult, type ReportsSearchResultItem, TAKEDOWN_SORT_KEYS, TAKEDOWN_STATUSES, type TakedownItem, type TakedownProviderRef, type TakedownSortKey, type TakedownStatus, type TakedownsListInput, type TakedownsListResult, type ThreatItem, type ThreatsListInput, type ThreatsListResult, type UserMeResult, type UserOrg, type UserOrgBrandMetadata, type UserOrgGetInput, type UserOrgGetResult, type UserOrgIntegrations, type UserOrgLegalDocument, type UserOrgLegalDocuments, type UserOrgPortalCustomization, type UserOrgTrademarkRegistration, type UserOrgsInput, type UserOrgsObligatoryAdminApprovalFilter, type UserOrgsPendingServiceApprovalFilter, type UserOrgsResult, type UserOrgsServiceFilters, type UserOrgsSubscriptionStatus, type ValidateApiKeyResult, WATCHLIST_FILTER_VALUES, type WatchlistFilterValue, parseIsoDate, parseIsoDateEndOfDay, parseIsoDateString, staticApiKey, staticBearerToken };
package/dist/api/index.js CHANGED
@@ -130,6 +130,15 @@ function parseIsoDateString(value) {
130
130
  var _a;
131
131
  return (_a = parseIsoDate(value)) == null ? void 0 : _a.toISOString();
132
132
  }
133
+ var DATE_ONLY_REGEX = /^\d{4}-\d{2}-\d{2}$/;
134
+ var MS_PER_DAY = 24 * 60 * 60 * 1e3;
135
+ function parseIsoDateEndOfDay(value) {
136
+ const parsed = parseIsoDate(value);
137
+ if (!parsed || !value || !DATE_ONLY_REGEX.test(value)) {
138
+ return parsed;
139
+ }
140
+ return new Date(parsed.getTime() + MS_PER_DAY - 1);
141
+ }
133
142
 
134
143
  // src/api/client.ts
135
144
  var DEFAULT_BASE_URL = "https://app.chainpatrol.io";
@@ -313,6 +322,21 @@ var ChainPatrolApiClient = class {
313
322
  endDate: parseIsoDate(input.endDate)
314
323
  }));
315
324
  }
325
+ getMetricsTakedownTime(input) {
326
+ return this.request("/metrics/takedown-time", __spreadProps(__spreadValues({}, input), {
327
+ startDate: parseIsoDate(input.startDate),
328
+ // Dates serialize as full timestamps, so a date-only `endDate` has to be
329
+ // widened here — the API can no longer tell it apart from an explicit
330
+ // midnight cut-off once it arrives.
331
+ endDate: parseIsoDateEndOfDay(input.endDate)
332
+ }));
333
+ }
334
+ getMetricsTakedownTimeTrend(input) {
335
+ return this.request(
336
+ "/metrics/takedown-time/trend",
337
+ input
338
+ );
339
+ }
316
340
  createReport(input) {
317
341
  return this.request("/report/create", input);
318
342
  }
@@ -475,6 +499,7 @@ var ChainPatrolApiClient = class {
475
499
  }
476
500
  listOrganizationAssets(input) {
477
501
  return this.requestGet("/organization/assets", {
502
+ slug: input.slug,
478
503
  type: input.type,
479
504
  groupId: input.groupId !== void 0 ? String(input.groupId) : void 0,
480
505
  query: input.query,
@@ -514,6 +539,7 @@ exports.TAKEDOWN_SORT_KEYS = TAKEDOWN_SORT_KEYS;
514
539
  exports.TAKEDOWN_STATUSES = TAKEDOWN_STATUSES;
515
540
  exports.WATCHLIST_FILTER_VALUES = WATCHLIST_FILTER_VALUES;
516
541
  exports.parseIsoDate = parseIsoDate;
542
+ exports.parseIsoDateEndOfDay = parseIsoDateEndOfDay;
517
543
  exports.parseIsoDateString = parseIsoDateString;
518
544
  exports.staticApiKey = staticApiKey;
519
545
  exports.staticBearerToken = staticBearerToken;