@chainpatrol/sdk 1.6.0 → 1.7.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,32 @@
1
1
  # @chainpatrol/sdk
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f98f547: Expose asset scan IDs and creation timestamps in asset search results.
8
+ - 9f19c88: Adds time-to-takedown metrics: `client.getMetricsTakedownTime()` in the SDK and
9
+ `chainpatrol metrics takedown-time --org <slug>` in the CLI, both backed by the
10
+ new `POST /metrics/takedown-time` endpoint. Returns the median time from
11
+ takedown start to completion per asset type, over an optional date range.
12
+
13
+ Also adds `parseIsoDateEndOfDay` to `@chainpatrol/sdk/api`: a date-only bound
14
+ such as `2026-08-18` now covers that whole day instead of cutting off at
15
+ midnight UTC. Server-side work lives in @chainpatrol/external-trpc and
16
+ @chainpatrol/validation; both are private packages and don't need version bumps.
17
+
18
+ - b037a0b: `GET /organization/assets` now accepts an optional `slug`, so callers whose
19
+ credentials reach more than one organization (user-scoped API keys, staff and
20
+ member sessions) can pick one instead of getting a flat 401. Organization-scoped
21
+ keys keep working unchanged when they omit it.
22
+
23
+ In the SDK, `client.listOrganizationAssets()` takes a `slug`. In the CLI,
24
+ `chainpatrol orgs assets list` forwards `--org <slug>` when one is set — the
25
+ existing no-flag invocation still resolves the org from an org-scoped key.
26
+
27
+ Server-side work lives in @chainpatrol/external-trpc and @chainpatrol/validation;
28
+ both are private packages and don't need version bumps.
29
+
3
30
  ## 1.6.0
4
31
 
5
32
  ### Minor Changes
@@ -65,6 +65,7 @@ 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>;
68
69
  createReport: (input: ReportCreateInput) => Promise<ReportCreateResult>;
69
70
  listOrganizationReports: (input: OrganizationReportsListInput) => Promise<OrganizationReportsListResult>;
70
71
  reviewOrganizationProposal: (input: OrganizationProposalsReviewInput) => Promise<OrganizationProposalsReviewResult>;
@@ -130,6 +131,11 @@ interface AssetSearchResultItem {
130
131
  status: string;
131
132
  createdAt: string;
132
133
  }>;
134
+ scans: Array<{
135
+ id: number;
136
+ /** When the asset scan was created (ISO 8601, UTC). */
137
+ createdAt: string;
138
+ }>;
133
139
  takedown: {
134
140
  id: number;
135
141
  status: string;
@@ -416,6 +422,24 @@ interface MetricsBreakdownResult {
416
422
  brandName?: string;
417
423
  }>;
418
424
  }
425
+ interface MetricsTakedownTimeInput {
426
+ slug: string;
427
+ startDate?: string;
428
+ endDate?: string;
429
+ blockLabel?: string;
430
+ brandType?: "INDIVIDUAL" | "ORGANIZATION" | "PRODUCT";
431
+ countryCodes?: string[];
432
+ brandIds?: number[];
433
+ }
434
+ interface MetricsTakedownTimeResult {
435
+ byAssetType: Array<{
436
+ assetType: string;
437
+ medianTakedownMinutes: number;
438
+ medianTakedownHours: number;
439
+ medianTakedownDays: number;
440
+ count: number;
441
+ }>;
442
+ }
419
443
  interface ReportAssetInput {
420
444
  content: string;
421
445
  status?: "BLOCKED" | "ALLOWED" | "UNKNOWN";
@@ -752,6 +776,7 @@ interface ThreatsListResult {
752
776
  next_page: string | null;
753
777
  }
754
778
  interface OrganizationAssetsListInput {
779
+ slug?: string;
755
780
  type?: string;
756
781
  groupId?: number;
757
782
  query?: string;
@@ -1316,6 +1341,7 @@ declare class ChainPatrolApiClient implements ApiClient {
1316
1341
  getMetricsSummary(input: MetricsSummaryInput): Promise<MetricsSummaryResult>;
1317
1342
  getMetricsFound(input: MetricsFoundInput): Promise<MetricsFoundResult>;
1318
1343
  getMetricsBreakdown(input: MetricsBreakdownInput): Promise<MetricsBreakdownResult>;
1344
+ getMetricsTakedownTime(input: MetricsTakedownTimeInput): Promise<MetricsTakedownTimeResult>;
1319
1345
  createReport(input: ReportCreateInput): Promise<ReportCreateResult>;
1320
1346
  listOrganizationReports(input: OrganizationReportsListInput): Promise<OrganizationReportsListResult>;
1321
1347
  reviewOrganizationProposal(input: OrganizationProposalsReviewInput): Promise<OrganizationProposalsReviewResult>;
@@ -1338,5 +1364,12 @@ declare class ChainPatrolApiClient implements ApiClient {
1338
1364
 
1339
1365
  declare function parseIsoDate(value: string | undefined): Date | undefined;
1340
1366
  declare function parseIsoDateString(value: string | undefined): string | undefined;
1367
+ /**
1368
+ * Same validation as `parseIsoDate`, but a date-only value covers the whole day
1369
+ * rather than collapsing to its first instant. An endpoint filtering on "up to
1370
+ * and including this date" would otherwise cut off at midnight UTC and drop
1371
+ * everything recorded on the day the caller asked for.
1372
+ */
1373
+ declare function parseIsoDateEndOfDay(value: string | undefined): Date | undefined;
1341
1374
 
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 };
1375
+ 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, 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,7 @@ 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>;
68
69
  createReport: (input: ReportCreateInput) => Promise<ReportCreateResult>;
69
70
  listOrganizationReports: (input: OrganizationReportsListInput) => Promise<OrganizationReportsListResult>;
70
71
  reviewOrganizationProposal: (input: OrganizationProposalsReviewInput) => Promise<OrganizationProposalsReviewResult>;
@@ -130,6 +131,11 @@ interface AssetSearchResultItem {
130
131
  status: string;
131
132
  createdAt: string;
132
133
  }>;
134
+ scans: Array<{
135
+ id: number;
136
+ /** When the asset scan was created (ISO 8601, UTC). */
137
+ createdAt: string;
138
+ }>;
133
139
  takedown: {
134
140
  id: number;
135
141
  status: string;
@@ -416,6 +422,24 @@ interface MetricsBreakdownResult {
416
422
  brandName?: string;
417
423
  }>;
418
424
  }
425
+ interface MetricsTakedownTimeInput {
426
+ slug: string;
427
+ startDate?: string;
428
+ endDate?: string;
429
+ blockLabel?: string;
430
+ brandType?: "INDIVIDUAL" | "ORGANIZATION" | "PRODUCT";
431
+ countryCodes?: string[];
432
+ brandIds?: number[];
433
+ }
434
+ interface MetricsTakedownTimeResult {
435
+ byAssetType: Array<{
436
+ assetType: string;
437
+ medianTakedownMinutes: number;
438
+ medianTakedownHours: number;
439
+ medianTakedownDays: number;
440
+ count: number;
441
+ }>;
442
+ }
419
443
  interface ReportAssetInput {
420
444
  content: string;
421
445
  status?: "BLOCKED" | "ALLOWED" | "UNKNOWN";
@@ -752,6 +776,7 @@ interface ThreatsListResult {
752
776
  next_page: string | null;
753
777
  }
754
778
  interface OrganizationAssetsListInput {
779
+ slug?: string;
755
780
  type?: string;
756
781
  groupId?: number;
757
782
  query?: string;
@@ -1316,6 +1341,7 @@ declare class ChainPatrolApiClient implements ApiClient {
1316
1341
  getMetricsSummary(input: MetricsSummaryInput): Promise<MetricsSummaryResult>;
1317
1342
  getMetricsFound(input: MetricsFoundInput): Promise<MetricsFoundResult>;
1318
1343
  getMetricsBreakdown(input: MetricsBreakdownInput): Promise<MetricsBreakdownResult>;
1344
+ getMetricsTakedownTime(input: MetricsTakedownTimeInput): Promise<MetricsTakedownTimeResult>;
1319
1345
  createReport(input: ReportCreateInput): Promise<ReportCreateResult>;
1320
1346
  listOrganizationReports(input: OrganizationReportsListInput): Promise<OrganizationReportsListResult>;
1321
1347
  reviewOrganizationProposal(input: OrganizationProposalsReviewInput): Promise<OrganizationProposalsReviewResult>;
@@ -1338,5 +1364,12 @@ declare class ChainPatrolApiClient implements ApiClient {
1338
1364
 
1339
1365
  declare function parseIsoDate(value: string | undefined): Date | undefined;
1340
1366
  declare function parseIsoDateString(value: string | undefined): string | undefined;
1367
+ /**
1368
+ * Same validation as `parseIsoDate`, but a date-only value covers the whole day
1369
+ * rather than collapsing to its first instant. An endpoint filtering on "up to
1370
+ * and including this date" would otherwise cut off at midnight UTC and drop
1371
+ * everything recorded on the day the caller asked for.
1372
+ */
1373
+ declare function parseIsoDateEndOfDay(value: string | undefined): Date | undefined;
1341
1374
 
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 };
1375
+ 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, 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,15 @@ 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
+ }
316
334
  createReport(input) {
317
335
  return this.request("/report/create", input);
318
336
  }
@@ -475,6 +493,7 @@ var ChainPatrolApiClient = class {
475
493
  }
476
494
  listOrganizationAssets(input) {
477
495
  return this.requestGet("/organization/assets", {
496
+ slug: input.slug,
478
497
  type: input.type,
479
498
  groupId: input.groupId !== void 0 ? String(input.groupId) : void 0,
480
499
  query: input.query,
@@ -514,6 +533,7 @@ exports.TAKEDOWN_SORT_KEYS = TAKEDOWN_SORT_KEYS;
514
533
  exports.TAKEDOWN_STATUSES = TAKEDOWN_STATUSES;
515
534
  exports.WATCHLIST_FILTER_VALUES = WATCHLIST_FILTER_VALUES;
516
535
  exports.parseIsoDate = parseIsoDate;
536
+ exports.parseIsoDateEndOfDay = parseIsoDateEndOfDay;
517
537
  exports.parseIsoDateString = parseIsoDateString;
518
538
  exports.staticApiKey = staticApiKey;
519
539
  exports.staticBearerToken = staticBearerToken;