@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 +49 -0
- package/dist/api/index.d.mts +66 -1
- package/dist/api/index.d.ts +66 -1
- package/dist/api/index.js +26 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/index.mjs +26 -1
- package/dist/api/index.mjs.map +1 -1
- package/dist/index.js +2054 -1809
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2054 -1809
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1313,17 +1313,17 @@ var PolyDateFormatter = class {
|
|
|
1313
1313
|
constructor(dt, intl, opts) {
|
|
1314
1314
|
this.opts = opts;
|
|
1315
1315
|
this.originalZone = void 0;
|
|
1316
|
-
let
|
|
1316
|
+
let z55 = void 0;
|
|
1317
1317
|
if (this.opts.timeZone) {
|
|
1318
1318
|
this.dt = dt;
|
|
1319
1319
|
} else if (dt.zone.type === "fixed") {
|
|
1320
1320
|
const gmtOffset = -1 * (dt.offset / 60);
|
|
1321
1321
|
const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
|
|
1322
1322
|
if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
|
|
1323
|
-
|
|
1323
|
+
z55 = offsetZ;
|
|
1324
1324
|
this.dt = dt;
|
|
1325
1325
|
} else {
|
|
1326
|
-
|
|
1326
|
+
z55 = "UTC";
|
|
1327
1327
|
this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ minutes: dt.offset });
|
|
1328
1328
|
this.originalZone = dt.zone;
|
|
1329
1329
|
}
|
|
@@ -1331,14 +1331,14 @@ var PolyDateFormatter = class {
|
|
|
1331
1331
|
this.dt = dt;
|
|
1332
1332
|
} else if (dt.zone.type === "iana") {
|
|
1333
1333
|
this.dt = dt;
|
|
1334
|
-
|
|
1334
|
+
z55 = dt.zone.name;
|
|
1335
1335
|
} else {
|
|
1336
|
-
|
|
1336
|
+
z55 = "UTC";
|
|
1337
1337
|
this.dt = dt.setZone("UTC").plus({ minutes: dt.offset });
|
|
1338
1338
|
this.originalZone = dt.zone;
|
|
1339
1339
|
}
|
|
1340
1340
|
const intlOpts = __spreadValues({}, this.opts);
|
|
1341
|
-
intlOpts.timeZone = intlOpts.timeZone ||
|
|
1341
|
+
intlOpts.timeZone = intlOpts.timeZone || z55;
|
|
1342
1342
|
this.dtf = getCachedDTF(intl, intlOpts);
|
|
1343
1343
|
}
|
|
1344
1344
|
format() {
|
|
@@ -7464,868 +7464,78 @@ zod.z.object({
|
|
|
7464
7464
|
zod.z.object({
|
|
7465
7465
|
result: zod.z.string()
|
|
7466
7466
|
});
|
|
7467
|
-
zod.z.object({
|
|
7468
|
-
slug: zod.z.string().min(1),
|
|
7469
|
-
configId: zod.z.number().int().positive(),
|
|
7470
|
-
status: zod.z.nativeEnum(ThreatDetectionConfigStatus).optional(),
|
|
7471
|
-
title: zod.z.string().trim().optional(),
|
|
7472
|
-
description: zod.z.string().trim().nullable().optional(),
|
|
7473
|
-
cron: zod.z.string().trim().nullable().optional(),
|
|
7474
|
-
config: zod.z.record(zod.z.unknown()).optional(),
|
|
7475
|
-
mergeConfig: zod.z.boolean().default(false),
|
|
7476
|
-
brandId: zod.z.number().int().positive().nullable().optional().describe(
|
|
7477
|
-
"Optional brand connection for this detection config. Pass null to clear the link. Only valid for org-scoped configs; the brand must belong to the same organization."
|
|
7478
|
-
)
|
|
7479
|
-
});
|
|
7480
|
-
zod.z.object({
|
|
7481
|
-
config: zod.z.object({
|
|
7482
|
-
id: zod.z.number(),
|
|
7483
|
-
source: zod.z.string(),
|
|
7484
|
-
status: zod.z.nativeEnum(ThreatDetectionConfigStatus),
|
|
7485
|
-
title: zod.z.string(),
|
|
7486
|
-
description: zod.z.string().nullable(),
|
|
7487
|
-
cron: zod.z.string().nullable(),
|
|
7488
|
-
config: zod.z.record(zod.z.unknown()),
|
|
7489
|
-
updatedAt: zod.z.date(),
|
|
7490
|
-
brandId: zod.z.number().nullable()
|
|
7491
|
-
})
|
|
7492
|
-
});
|
|
7493
|
-
zod.z.object({
|
|
7494
|
-
slug: zod.z.string().min(1),
|
|
7495
|
-
source: zod.z.string().optional(),
|
|
7496
|
-
minResults: zod.z.number().int().min(0).default(1),
|
|
7497
|
-
lookbackHours: zod.z.number().int().min(1).default(24 * 7),
|
|
7498
|
-
runBeforeValidate: zod.z.boolean().default(false),
|
|
7499
|
-
includeDisabled: zod.z.boolean().default(false)
|
|
7500
|
-
});
|
|
7501
|
-
zod.z.object({
|
|
7502
|
-
ok: zod.z.boolean(),
|
|
7503
|
-
summary: zod.z.object({
|
|
7504
|
-
checkedConfigs: zod.z.number(),
|
|
7505
|
-
passingConfigs: zod.z.number(),
|
|
7506
|
-
failingConfigs: zod.z.number(),
|
|
7507
|
-
lookbackHours: zod.z.number(),
|
|
7508
|
-
minResults: zod.z.number()
|
|
7509
|
-
}),
|
|
7510
|
-
validations: zod.z.array(
|
|
7511
|
-
zod.z.object({
|
|
7512
|
-
configId: zod.z.number(),
|
|
7513
|
-
source: zod.z.string(),
|
|
7514
|
-
status: zod.z.nativeEnum(ThreatDetectionConfigStatus),
|
|
7515
|
-
ran: zod.z.boolean(),
|
|
7516
|
-
runOk: zod.z.boolean(),
|
|
7517
|
-
runMessage: zod.z.string().nullable(),
|
|
7518
|
-
recentResultCount: zod.z.number(),
|
|
7519
|
-
valid: zod.z.boolean()
|
|
7520
|
-
})
|
|
7521
|
-
)
|
|
7522
|
-
});
|
|
7523
|
-
zod.z.object({
|
|
7524
|
-
slug: zod.z.string().min(1),
|
|
7525
|
-
configId: zod.z.number().int().positive().optional(),
|
|
7526
|
-
source: zod.z.string().min(1).optional(),
|
|
7527
|
-
includeDisabled: zod.z.boolean().default(false)
|
|
7528
|
-
});
|
|
7529
|
-
zod.z.object({
|
|
7530
|
-
ranCount: zod.z.number(),
|
|
7531
|
-
successCount: zod.z.number(),
|
|
7532
|
-
failedCount: zod.z.number(),
|
|
7533
|
-
results: zod.z.array(
|
|
7534
|
-
zod.z.object({
|
|
7535
|
-
configId: zod.z.number(),
|
|
7536
|
-
source: zod.z.string(),
|
|
7537
|
-
ok: zod.z.boolean(),
|
|
7538
|
-
message: zod.z.string().nullable(),
|
|
7539
|
-
assetsCount: zod.z.number()
|
|
7540
|
-
})
|
|
7541
|
-
)
|
|
7542
|
-
});
|
|
7543
|
-
var DetectionDriftThresholdsSchema = zod.z.object({
|
|
7544
|
-
zeroResultsMaxHours: zod.z.number().int().positive().default(72),
|
|
7545
|
-
noisyResultsPerDay: zod.z.number().positive().default(100),
|
|
7546
|
-
noisyAllowedRatioThreshold: zod.z.number().min(0).max(1).default(0.6),
|
|
7547
|
-
staleConfigDays: zod.z.number().int().positive().default(30)
|
|
7548
|
-
});
|
|
7549
|
-
zod.z.object({
|
|
7550
|
-
slug: zod.z.string().min(1),
|
|
7551
|
-
lookbackHours: zod.z.number().int().positive().default(168),
|
|
7552
|
-
startDate: zod.z.date().optional(),
|
|
7553
|
-
endDate: zod.z.date().optional(),
|
|
7554
|
-
source: zod.z.string().min(1).optional(),
|
|
7555
|
-
configIds: zod.z.array(zod.z.number().int().positive()).optional(),
|
|
7556
|
-
includeDisabled: zod.z.boolean().default(false),
|
|
7557
|
-
thresholds: DetectionDriftThresholdsSchema.optional()
|
|
7558
|
-
}).refine(
|
|
7559
|
-
(value) => !value.startDate && !value.endDate || Boolean(value.startDate) && Boolean(value.endDate),
|
|
7560
|
-
{
|
|
7561
|
-
message: "Provide both startDate and endDate when using explicit date range",
|
|
7562
|
-
path: ["startDate"]
|
|
7563
|
-
}
|
|
7564
|
-
);
|
|
7565
|
-
var DetectionDriftSignalSchema = zod.z.object({
|
|
7566
|
-
signal: zod.z.enum(["zero_results_too_long", "noisy_source", "stale_query"]),
|
|
7567
|
-
configId: zod.z.number().int().positive(),
|
|
7568
|
-
source: zod.z.string(),
|
|
7569
|
-
title: zod.z.string().nullable(),
|
|
7570
|
-
status: zod.z.string(),
|
|
7571
|
-
severity: zod.z.enum(["low", "medium", "high"]),
|
|
7572
|
-
details: zod.z.record(zod.z.unknown())
|
|
7573
|
-
});
|
|
7574
|
-
zod.z.object({
|
|
7575
|
-
ok: zod.z.boolean(),
|
|
7576
|
-
range: zod.z.object({
|
|
7577
|
-
startDate: zod.z.date(),
|
|
7578
|
-
endDate: zod.z.date(),
|
|
7579
|
-
lookbackHours: zod.z.number().int().positive()
|
|
7580
|
-
}),
|
|
7581
|
-
thresholds: DetectionDriftThresholdsSchema,
|
|
7582
|
-
summary: zod.z.object({
|
|
7583
|
-
checkedConfigs: zod.z.number().int().nonnegative(),
|
|
7584
|
-
signalCount: zod.z.number().int().nonnegative(),
|
|
7585
|
-
zeroResultsCount: zod.z.number().int().nonnegative(),
|
|
7586
|
-
noisyCount: zod.z.number().int().nonnegative(),
|
|
7587
|
-
staleCount: zod.z.number().int().nonnegative()
|
|
7588
|
-
}),
|
|
7589
|
-
signals: zod.z.array(DetectionDriftSignalSchema)
|
|
7590
|
-
});
|
|
7591
|
-
var BucketsSchema = zod.z.object({
|
|
7592
|
-
lt24h: zod.z.number().int().nonnegative(),
|
|
7593
|
-
h24to72: zod.z.number().int().nonnegative(),
|
|
7594
|
-
h72to168: zod.z.number().int().nonnegative(),
|
|
7595
|
-
gte168h: zod.z.number().int().nonnegative()
|
|
7596
|
-
});
|
|
7597
|
-
zod.z.object({
|
|
7598
|
-
slug: zod.z.string().min(1).optional(),
|
|
7599
|
-
all: zod.z.boolean().default(false),
|
|
7600
|
-
windowHours: zod.z.number().int().positive().default(168)
|
|
7601
|
-
});
|
|
7602
|
-
zod.z.object({
|
|
7603
|
-
generatedAt: zod.z.date(),
|
|
7604
|
-
scope: zod.z.object({
|
|
7605
|
-
slug: zod.z.string().nullable(),
|
|
7606
|
-
all: zod.z.boolean()
|
|
7607
|
-
}),
|
|
7608
|
-
reviewQueue: zod.z.object({
|
|
7609
|
-
totalPendingProposals: zod.z.number().int().nonnegative(),
|
|
7610
|
-
distinctReports: zod.z.number().int().nonnegative(),
|
|
7611
|
-
ageBuckets: BucketsSchema,
|
|
7612
|
-
slaBuckets: zod.z.object({
|
|
7613
|
-
breached: zod.z.number().int().nonnegative(),
|
|
7614
|
-
dueWithin24h: zod.z.number().int().nonnegative(),
|
|
7615
|
-
dueWithin72h: zod.z.number().int().nonnegative(),
|
|
7616
|
-
beyond72h: zod.z.number().int().nonnegative(),
|
|
7617
|
-
missingSla: zod.z.number().int().nonnegative()
|
|
7618
|
-
}),
|
|
7619
|
-
byOrg: zod.z.array(
|
|
7620
|
-
zod.z.object({
|
|
7621
|
-
slug: zod.z.string(),
|
|
7622
|
-
pendingProposals: zod.z.number().int().nonnegative()
|
|
7623
|
-
})
|
|
7624
|
-
)
|
|
7625
|
-
}),
|
|
7626
|
-
takedownQueue: zod.z.object({
|
|
7627
|
-
totalOpen: zod.z.number().int().nonnegative(),
|
|
7628
|
-
statusCounts: zod.z.object({
|
|
7629
|
-
todo: zod.z.number().int().nonnegative(),
|
|
7630
|
-
inProgress: zod.z.number().int().nonnegative(),
|
|
7631
|
-
pendingInput: zod.z.number().int().nonnegative()
|
|
7632
|
-
}),
|
|
7633
|
-
ageBuckets: BucketsSchema,
|
|
7634
|
-
staleInProgress: zod.z.number().int().nonnegative(),
|
|
7635
|
-
byOrg: zod.z.array(
|
|
7636
|
-
zod.z.object({
|
|
7637
|
-
slug: zod.z.string(),
|
|
7638
|
-
openTakedowns: zod.z.number().int().nonnegative()
|
|
7639
|
-
})
|
|
7640
|
-
)
|
|
7641
|
-
})
|
|
7642
|
-
});
|
|
7643
|
-
var HealthcheckCategorySchema = zod.z.enum([
|
|
7644
|
-
"detection",
|
|
7645
|
-
"reviewing",
|
|
7646
|
-
"blocklisting",
|
|
7647
|
-
"takedowns",
|
|
7648
|
-
"assets",
|
|
7649
|
-
"organization"
|
|
7650
|
-
]);
|
|
7651
|
-
var HealthcheckSeveritySchema = zod.z.enum(["ok", "warn", "fail"]);
|
|
7652
|
-
var HealthcheckFindingSchema = zod.z.object({
|
|
7653
|
-
kind: zod.z.string(),
|
|
7654
|
-
ref: zod.z.string().nullable(),
|
|
7655
|
-
message: zod.z.string(),
|
|
7656
|
-
severity: zod.z.enum(["warn", "fail"])
|
|
7657
|
-
});
|
|
7658
|
-
zod.z.object({
|
|
7659
|
-
id: zod.z.string(),
|
|
7660
|
-
title: zod.z.string(),
|
|
7661
|
-
category: HealthcheckCategorySchema,
|
|
7662
|
-
generatedAt: zod.z.date(),
|
|
7663
|
-
scope: zod.z.object({
|
|
7664
|
-
slug: zod.z.string().nullable()
|
|
7665
|
-
}),
|
|
7666
|
-
ok: zod.z.boolean(),
|
|
7667
|
-
severity: HealthcheckSeveritySchema,
|
|
7668
|
-
observed: zod.z.record(zod.z.union([zod.z.number(), zod.z.string(), zod.z.boolean()]).nullable()),
|
|
7669
|
-
threshold: zod.z.record(zod.z.union([zod.z.number(), zod.z.string(), zod.z.boolean()]).nullable()),
|
|
7670
|
-
findings: zod.z.array(HealthcheckFindingSchema),
|
|
7671
|
-
suggestedAction: zod.z.string().nullable(),
|
|
7672
|
-
appUrl: zod.z.string().nullable()
|
|
7673
|
-
});
|
|
7674
7467
|
|
|
7675
|
-
// ../../internal/
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
zod.z.object({
|
|
7747
|
-
by: BreakdownBySchema,
|
|
7748
|
-
points: zod.z.array(
|
|
7749
|
-
zod.z.object({
|
|
7750
|
-
key: zod.z.string(),
|
|
7751
|
-
count: zod.z.number(),
|
|
7752
|
-
date: zod.z.string().optional(),
|
|
7753
|
-
type: zod.z.string().optional(),
|
|
7754
|
-
brandId: zod.z.number().optional(),
|
|
7755
|
-
brandSlug: zod.z.string().optional(),
|
|
7756
|
-
brandName: zod.z.string().optional()
|
|
7757
|
-
})
|
|
7758
|
-
)
|
|
7759
|
-
});
|
|
7760
|
-
zod.z.object({
|
|
7761
|
-
slug: zod.z.string().min(1),
|
|
7762
|
-
startDate: zod.z.date(),
|
|
7763
|
-
endDate: zod.z.date(),
|
|
7764
|
-
brandIds: zod.z.array(zod.z.number().int().positive()).optional()
|
|
7765
|
-
});
|
|
7766
|
-
zod.z.object({
|
|
7767
|
-
metric: zod.z.literal("new_threats"),
|
|
7768
|
-
found: zod.z.number(),
|
|
7769
|
-
range: zod.z.object({
|
|
7770
|
-
startDate: zod.z.date(),
|
|
7771
|
-
endDate: zod.z.date()
|
|
7772
|
-
})
|
|
7773
|
-
});
|
|
7774
|
-
zod.z.object({
|
|
7775
|
-
slug: zod.z.string().min(1),
|
|
7776
|
-
startDate: zod.z.date().optional(),
|
|
7777
|
-
endDate: zod.z.date().optional(),
|
|
7778
|
-
brandIds: zod.z.array(zod.z.number().int().positive()).optional()
|
|
7779
|
-
});
|
|
7780
|
-
zod.z.object({
|
|
7781
|
-
metrics: zod.z.object({
|
|
7782
|
-
reports: zod.z.number(),
|
|
7783
|
-
newThreats: zod.z.number(),
|
|
7784
|
-
threatsWatchlisted: zod.z.number(),
|
|
7785
|
-
takedownsFiled: zod.z.number(),
|
|
7786
|
-
takedownsCompleted: zod.z.number(),
|
|
7787
|
-
domainThreats: zod.z.number(),
|
|
7788
|
-
twitterThreats: zod.z.number(),
|
|
7789
|
-
telegramThreats: zod.z.number(),
|
|
7790
|
-
otherThreats: zod.z.number()
|
|
7791
|
-
}),
|
|
7792
|
-
blockedByDay: zod.z.array(
|
|
7793
|
-
zod.z.object({
|
|
7794
|
-
date: zod.z.string(),
|
|
7795
|
-
count: zod.z.number()
|
|
7796
|
-
})
|
|
7797
|
-
),
|
|
7798
|
-
blockedByType: zod.z.array(
|
|
7799
|
-
zod.z.object({
|
|
7800
|
-
type: zod.z.string(),
|
|
7801
|
-
count: zod.z.number()
|
|
7802
|
-
})
|
|
7803
|
-
)
|
|
7804
|
-
});
|
|
7805
|
-
zod.z.object({
|
|
7806
|
-
type: zod.z.nativeEnum(AssetType).optional().describe("Filter by asset type (URL, ADDRESS, etc.)"),
|
|
7807
|
-
groupId: zod.z.number().int().optional().describe(
|
|
7808
|
-
"Filter by group ID. Use -1 for ungrouped assets only. Omit for all assets."
|
|
7809
|
-
),
|
|
7810
|
-
query: zod.z.string().optional().describe("Search query to filter assets by content"),
|
|
7811
|
-
per_page: zod.z.number().int().min(1).max(1e3).optional().default(100).describe("The number of assets to return per page (max 1000)"),
|
|
7812
|
-
next_page: zod.z.string().optional().nullable().describe("Cursor for fetching the next page of results")
|
|
7813
|
-
}).describe(
|
|
7814
|
-
`List organization assets request body
|
|
7815
|
-
|
|
7816
|
-
Returns all assets belonging to the organization associated with your API key.
|
|
7817
|
-
Supports filtering by type, group, and search query.`
|
|
7818
|
-
);
|
|
7819
|
-
var organizationAssetItemSchema = zod.z.object({
|
|
7820
|
-
id: zod.z.number().describe("Asset ID"),
|
|
7821
|
-
content: zod.z.string().describe("Asset content (URL, address, handle, etc.)"),
|
|
7822
|
-
type: zod.z.nativeEnum(AssetType).describe("Asset type"),
|
|
7823
|
-
status: zod.z.nativeEnum(AssetStatus).describe("Asset status"),
|
|
7824
|
-
name: zod.z.string().nullable().describe("Asset display name"),
|
|
7825
|
-
description: zod.z.string().nullable().describe("Asset description"),
|
|
7826
|
-
group: zod.z.object({
|
|
7827
|
-
id: zod.z.number().describe("Group ID"),
|
|
7828
|
-
name: zod.z.string().describe("Group name")
|
|
7829
|
-
}).nullable().describe("Asset group information"),
|
|
7830
|
-
livenessStatus: zod.z.nativeEnum(LivenessStatus).nullable().describe(
|
|
7831
|
-
"Whether the asset is currently reachable (`ALIVE`), gone (`DEAD`), or hasn't been checked (`UNKNOWN`). `null` when liveness has never been evaluated."
|
|
7832
|
-
),
|
|
7833
|
-
blockedAt: zod.z.date().nullable().describe(
|
|
7834
|
-
"When the asset transitioned to BLOCKED status. `null` for non-blocked assets. Distinct from `updatedAt`."
|
|
7835
|
-
),
|
|
7836
|
-
createdAt: zod.z.date().describe("When the asset was created"),
|
|
7837
|
-
updatedAt: zod.z.date().describe("When the asset was last updated")
|
|
7838
|
-
});
|
|
7839
|
-
zod.z.object({
|
|
7840
|
-
assets: zod.z.array(organizationAssetItemSchema).describe("List of assets"),
|
|
7841
|
-
next_page: zod.z.string().nullable().optional().describe("Cursor for fetching the next page of results")
|
|
7842
|
-
}).describe("Successful operation");
|
|
7843
|
-
var addAssetItemSchema = zod.z.object({
|
|
7844
|
-
content: zod.z.string().describe("Asset content (URL, address, handle, etc.)"),
|
|
7845
|
-
name: zod.z.string().optional().describe("Optional display name for the asset"),
|
|
7846
|
-
description: zod.z.string().optional().describe("Optional description for the asset"),
|
|
7847
|
-
groupId: zod.z.number().int().positive().optional().describe("Optional group ID to assign the asset to")
|
|
7848
|
-
});
|
|
7849
|
-
zod.z.object({
|
|
7850
|
-
assets: zod.z.array(addAssetItemSchema).min(1).max(1e3).describe("Array of assets to add (max 1000 per request)")
|
|
7851
|
-
}).describe(
|
|
7852
|
-
`Add assets to organization allowlist
|
|
7853
|
-
|
|
7854
|
-
Batch add multiple assets to your organization's allowlist.
|
|
7855
|
-
Each asset will be automatically parsed and classified.
|
|
7856
|
-
Assets will be auto-approved as ALLOWED status.`
|
|
7857
|
-
);
|
|
7858
|
-
var addAssetResultSchema = zod.z.object({
|
|
7859
|
-
content: zod.z.string().describe("Asset content"),
|
|
7860
|
-
success: zod.z.boolean().describe("Whether the asset was added successfully"),
|
|
7861
|
-
id: zod.z.number().optional().describe("Asset ID if successful"),
|
|
7862
|
-
error: zod.z.string().optional().describe("Error message if failed")
|
|
7863
|
-
});
|
|
7864
|
-
zod.z.object({
|
|
7865
|
-
results: zod.z.array(addAssetResultSchema).describe("Results for each asset"),
|
|
7866
|
-
successCount: zod.z.number().describe("Number of assets successfully added"),
|
|
7867
|
-
errorCount: zod.z.number().describe("Number of assets that failed to add")
|
|
7868
|
-
}).describe("Batch add operation results");
|
|
7869
|
-
zod.z.object({
|
|
7870
|
-
assetId: zod.z.number().int().positive().describe("ID of the asset to update"),
|
|
7871
|
-
name: zod.z.string().optional().describe("New display name for the asset"),
|
|
7872
|
-
description: zod.z.string().nullable().optional().describe("New description for the asset"),
|
|
7873
|
-
groupId: zod.z.number().int().positive().nullable().optional().describe("New group ID (null to ungroup)")
|
|
7874
|
-
}).describe(
|
|
7875
|
-
`Update an organization asset
|
|
7876
|
-
|
|
7877
|
-
Update the name, description, or group assignment of an asset.`
|
|
7878
|
-
);
|
|
7879
|
-
zod.z.object({
|
|
7880
|
-
id: zod.z.number().describe("Asset ID"),
|
|
7881
|
-
content: zod.z.string().describe("Asset content"),
|
|
7882
|
-
name: zod.z.string().nullable().describe("Asset display name"),
|
|
7883
|
-
description: zod.z.string().nullable().describe("Asset description"),
|
|
7884
|
-
groupId: zod.z.number().nullable().describe("Group ID")
|
|
7885
|
-
}).describe("Updated asset");
|
|
7886
|
-
zod.z.object({
|
|
7887
|
-
assetId: zod.z.number().int().positive().describe("ID of the asset to remove")
|
|
7888
|
-
}).describe(
|
|
7889
|
-
`Remove an asset from the organization
|
|
7890
|
-
|
|
7891
|
-
This removes the asset from the organization's allowlist.`
|
|
7892
|
-
);
|
|
7893
|
-
zod.z.object({
|
|
7894
|
-
success: zod.z.boolean().describe("Whether the asset was removed successfully"),
|
|
7895
|
-
id: zod.z.number().describe("Asset ID that was removed")
|
|
7896
|
-
}).describe("Delete operation result");
|
|
7897
|
-
zod.z.object({}).describe(
|
|
7898
|
-
`List organization asset groups
|
|
7899
|
-
|
|
7900
|
-
Returns all asset groups belonging to the organization associated with your API key.`
|
|
7901
|
-
);
|
|
7902
|
-
var assetGroupItemSchema = zod.z.object({
|
|
7903
|
-
id: zod.z.number().describe("Group ID"),
|
|
7904
|
-
name: zod.z.string().describe("Group name"),
|
|
7905
|
-
assetCount: zod.z.number().describe("Number of assets in this group")
|
|
7906
|
-
});
|
|
7907
|
-
zod.z.object({
|
|
7908
|
-
groups: zod.z.array(assetGroupItemSchema).describe("List of asset groups")
|
|
7909
|
-
}).describe("Successful operation");
|
|
7910
|
-
zod.z.object({
|
|
7911
|
-
name: zod.z.string().min(1).max(255).describe("Name for the new group")
|
|
7912
|
-
}).describe(
|
|
7913
|
-
`Create a new asset group
|
|
7914
|
-
|
|
7915
|
-
Creates a new asset group for organizing your organization's assets.`
|
|
7916
|
-
);
|
|
7917
|
-
zod.z.object({
|
|
7918
|
-
id: zod.z.number().describe("Created group ID"),
|
|
7919
|
-
name: zod.z.string().describe("Group name")
|
|
7920
|
-
}).describe("Created group");
|
|
7921
|
-
zod.z.object({
|
|
7922
|
-
groupId: zod.z.number().int().positive().describe("ID of the group to update"),
|
|
7923
|
-
name: zod.z.string().min(1).max(255).describe("New name for the group")
|
|
7924
|
-
}).describe(
|
|
7925
|
-
`Update an asset group
|
|
7926
|
-
|
|
7927
|
-
Rename an existing asset group.`
|
|
7928
|
-
);
|
|
7929
|
-
zod.z.object({
|
|
7930
|
-
id: zod.z.number().describe("Group ID"),
|
|
7931
|
-
name: zod.z.string().describe("Updated group name")
|
|
7932
|
-
}).describe("Updated group");
|
|
7933
|
-
zod.z.object({
|
|
7934
|
-
groupId: zod.z.number().int().positive().describe("ID of the group to delete")
|
|
7935
|
-
}).describe(
|
|
7936
|
-
`Delete an asset group
|
|
7937
|
-
|
|
7938
|
-
Deletes an asset group. Assets in this group will become ungrouped.`
|
|
7939
|
-
);
|
|
7940
|
-
zod.z.object({
|
|
7941
|
-
success: zod.z.boolean().describe("Whether the group was deleted successfully"),
|
|
7942
|
-
id: zod.z.number().describe("Group ID that was deleted"),
|
|
7943
|
-
unassignedAssetCount: zod.z.number().describe("Number of assets that were unassigned from this group")
|
|
7944
|
-
}).describe("Delete operation result");
|
|
7945
|
-
zod.z.object({}).describe(
|
|
7946
|
-
`List organization brands
|
|
7947
|
-
|
|
7948
|
-
Returns all brands belonging to the organization associated with your API key,
|
|
7949
|
-
including sub-brands (\`ORGANIZATION\`), individual / employee brands
|
|
7950
|
-
(\`INDIVIDUAL\`), and product brands (\`PRODUCT\`). Soft-deleted brands are
|
|
7951
|
-
excluded.`
|
|
7952
|
-
);
|
|
7953
|
-
var brandLegalDocumentSchema = zod.z.object({
|
|
7954
|
-
present: zod.z.boolean().describe("Whether the brand has this document attached"),
|
|
7955
|
-
fileName: zod.z.string().nullable().describe("Original filename of the uploaded document (null when not present)"),
|
|
7956
|
-
fileUrl: zod.z.string().nullable().describe("Direct URL to view or download the document (null when not present)")
|
|
7957
|
-
});
|
|
7958
|
-
var brandTrademarkRegistrationSchema = zod.z.object({
|
|
7959
|
-
id: zod.z.number().describe("Trademark registration ID"),
|
|
7960
|
-
brandName: zod.z.string().describe("Trademarked brand name as it appears on the registration"),
|
|
7961
|
-
trademarkOffice: zod.z.string().describe("Issuing trademark office (e.g. `USPTO`, `EUIPO`)"),
|
|
7962
|
-
registrationNumber: zod.z.string().describe("Registration number assigned by the office"),
|
|
7963
|
-
goodsAndServicesClass: zod.z.string().describe("Nice Classification class(es) the registration covers"),
|
|
7964
|
-
rightsOwnerName: zod.z.string().nullable().describe("Legal entity the trademark is registered to, if recorded"),
|
|
7965
|
-
registrationPageUrl: zod.z.string().nullable().describe("Public URL on the trademark office's site, if recorded"),
|
|
7966
|
-
certificateFileName: zod.z.string().nullable().describe(
|
|
7967
|
-
"Original filename of the uploaded certificate PDF (null when no certificate is attached)"
|
|
7968
|
-
),
|
|
7969
|
-
certificateFileUrl: zod.z.string().nullable().describe(
|
|
7970
|
-
"Direct URL to view or download the certificate PDF (null when no certificate is attached)"
|
|
7971
|
-
)
|
|
7972
|
-
});
|
|
7973
|
-
var brandItemSchema = zod.z.object({
|
|
7974
|
-
id: zod.z.number().describe("Brand ID"),
|
|
7975
|
-
slug: zod.z.string().describe("Brand slug (stable, URL-safe identifier)"),
|
|
7976
|
-
name: zod.z.string().describe("Display name"),
|
|
7977
|
-
type: zod.z.nativeEnum(BrandType).describe(
|
|
7978
|
-
"Brand type: `ORGANIZATION` for parent brands, `INDIVIDUAL` for employee or person brands, `PRODUCT` for a specific product or service offering"
|
|
7979
|
-
),
|
|
7980
|
-
description: zod.z.string().nullable().describe("Free-form description, if set"),
|
|
7981
|
-
avatarUrl: zod.z.string().nullable().describe("URL of the brand's avatar / logo image"),
|
|
7982
|
-
websiteUrl: zod.z.string().nullable().describe("Official brand website URL"),
|
|
7983
|
-
twitterHandle: zod.z.string().nullable().describe("Official Twitter / X handle (without @)"),
|
|
7984
|
-
brandColors: zod.z.array(zod.z.string()).describe("HEX color strings associated with the brand (e.g. `#FF0000`)"),
|
|
7985
|
-
includedTerms: zod.z.array(zod.z.string()).describe("Terms that should be included when matching this brand"),
|
|
7986
|
-
excludedTerms: zod.z.array(zod.z.string()).describe("Terms that should be excluded when matching this brand"),
|
|
7987
|
-
tickers: zod.z.array(zod.z.string()).describe("Ticker symbols associated with the brand (e.g. `$JUP`)"),
|
|
7988
|
-
brandGroupId: zod.z.number().nullable().describe(
|
|
7989
|
-
"Group this brand belongs to (only set for `INDIVIDUAL` and `PRODUCT` brands)"
|
|
7990
|
-
),
|
|
7991
|
-
createdAt: zod.z.date().describe("When the brand was created"),
|
|
7992
|
-
useOrganizationDocs: zod.z.boolean().describe(
|
|
7993
|
-
"When true, this brand inherits its Letter of Authorization and Power of Attorney from the organization rather than carrying its own. The `legalDocuments` block below always reflects the brand-level attachments \u2014 read `/user/orgs/{slug}` for the org-level fallbacks."
|
|
7994
|
-
),
|
|
7995
|
-
legalDocuments: zod.z.object({
|
|
7996
|
-
letterOfAuthorization: brandLegalDocumentSchema,
|
|
7997
|
-
powerOfAttorney: brandLegalDocumentSchema
|
|
7998
|
-
}).describe("Brand-level Letter of Authorization and Power of Attorney attachments"),
|
|
7999
|
-
trademarkRegistrations: zod.z.array(brandTrademarkRegistrationSchema).describe(
|
|
8000
|
-
"Trademark registrations attached to this brand. An empty array means no trademarks are on file for the brand \u2014 use this to identify brands that still need them added."
|
|
8001
|
-
)
|
|
8002
|
-
});
|
|
8003
|
-
zod.z.object({
|
|
8004
|
-
brands: zod.z.array(brandItemSchema).describe("List of brands")
|
|
8005
|
-
}).describe("Successful operation");
|
|
8006
|
-
var FILTERABLE_SUBSCRIPTION_STATUSES = [
|
|
8007
|
-
SubscriptionStatus.PROSPECT,
|
|
8008
|
-
SubscriptionStatus.POC,
|
|
8009
|
-
SubscriptionStatus.ACTIVE,
|
|
8010
|
-
SubscriptionStatus.INTEGRATION
|
|
8011
|
-
];
|
|
8012
|
-
var UserOrgsSubscriptionStatusSchema = zod.z.enum(
|
|
8013
|
-
FILTERABLE_SUBSCRIPTION_STATUSES
|
|
8014
|
-
);
|
|
8015
|
-
var takedownsServiceFilterSchema = zod.z.object({
|
|
8016
|
-
active: zod.z.boolean().optional(),
|
|
8017
|
-
automated: zod.z.boolean().optional()
|
|
8018
|
-
}).optional();
|
|
8019
|
-
var singleServiceFilterSchema = zod.z.object({
|
|
8020
|
-
active: zod.z.boolean().optional()
|
|
8021
|
-
}).optional();
|
|
8022
|
-
var userOrgsServicesFilterObjectSchema = zod.z.object({
|
|
8023
|
-
reporting: singleServiceFilterSchema,
|
|
8024
|
-
reviewing: singleServiceFilterSchema,
|
|
8025
|
-
protection: singleServiceFilterSchema,
|
|
8026
|
-
takedowns: takedownsServiceFilterSchema,
|
|
8027
|
-
detection: singleServiceFilterSchema,
|
|
8028
|
-
darkWebMonitoring: singleServiceFilterSchema
|
|
8029
|
-
});
|
|
8030
|
-
var userOrgsObligatoryAdminApprovalFilterSchema = zod.z.object({
|
|
8031
|
-
active: zod.z.boolean().optional(),
|
|
8032
|
-
assetTypes: zod.z.array(zod.z.nativeEnum(AssetType)).min(1).optional()
|
|
8033
|
-
}).optional();
|
|
8034
|
-
var PendingApprovalServiceSchema = zod.z.enum(["protection", "takedowns"]);
|
|
8035
|
-
var userOrgsPendingServiceApprovalFilterSchema = zod.z.object({
|
|
8036
|
-
active: zod.z.boolean().optional(),
|
|
8037
|
-
services: zod.z.array(PendingApprovalServiceSchema).min(1).optional()
|
|
8038
|
-
}).optional();
|
|
8039
|
-
zod.z.object({
|
|
8040
|
-
query: zod.z.string().default(""),
|
|
8041
|
-
subscriptionStatus: zod.z.array(UserOrgsSubscriptionStatusSchema).min(1).optional(),
|
|
8042
|
-
services: userOrgsServicesFilterObjectSchema.optional(),
|
|
8043
|
-
obligatoryAdminApproval: userOrgsObligatoryAdminApprovalFilterSchema,
|
|
8044
|
-
pendingServiceApproval: userOrgsPendingServiceApprovalFilterSchema
|
|
8045
|
-
});
|
|
8046
|
-
var takedownsServiceSchema = zod.z.object({
|
|
8047
|
-
active: zod.z.boolean(),
|
|
8048
|
-
automated: zod.z.boolean()
|
|
8049
|
-
});
|
|
8050
|
-
var singleServiceSchema = zod.z.object({
|
|
8051
|
-
active: zod.z.boolean()
|
|
8052
|
-
});
|
|
8053
|
-
var UserOrgObligatoryAdminApprovalSchema = zod.z.object({
|
|
8054
|
-
active: zod.z.boolean(),
|
|
8055
|
-
assetTypes: zod.z.array(zod.z.nativeEnum(AssetType))
|
|
8056
|
-
});
|
|
8057
|
-
var PendingServiceApprovalSchema = zod.z.object({
|
|
8058
|
-
// Friendly service family, matching a key in the `services` object.
|
|
8059
|
-
service: PendingApprovalServiceSchema,
|
|
8060
|
-
// Whether the request is for the automated variant of the service
|
|
8061
|
-
// (e.g. "Automated Wallet Blocking" rather than "Wallet Blocking").
|
|
8062
|
-
automated: zod.z.boolean(),
|
|
8063
|
-
// Raw `ServiceType` enum value, e.g. "isProtectionActive". Lets callers
|
|
8064
|
-
// distinguish the exact column without re-deriving it from `service` +
|
|
8065
|
-
// `automated`.
|
|
8066
|
-
serviceType: zod.z.nativeEnum(ServiceType),
|
|
8067
|
-
// Human-readable service label, e.g. "Wallet Blocking".
|
|
8068
|
-
serviceName: zod.z.string(),
|
|
8069
|
-
// When the enable request was submitted (ISO 8601, UTC).
|
|
8070
|
-
requestedAt: zod.z.string()
|
|
8071
|
-
});
|
|
8072
|
-
var UserOrgIntegrationsSchema = zod.z.object({
|
|
8073
|
-
slack: zod.z.boolean(),
|
|
8074
|
-
discord: zod.z.boolean(),
|
|
8075
|
-
telegram: zod.z.object({
|
|
8076
|
-
connected: zod.z.boolean(),
|
|
8077
|
-
groupCount: zod.z.number()
|
|
8078
|
-
}),
|
|
8079
|
-
vercel: zod.z.boolean(),
|
|
8080
|
-
intercom: zod.z.boolean(),
|
|
8081
|
-
moderation: zod.z.boolean()
|
|
8082
|
-
});
|
|
8083
|
-
var UserOrgLegalDocumentSchema = zod.z.object({
|
|
8084
|
-
present: zod.z.boolean().describe("Whether the organization has this document attached"),
|
|
8085
|
-
fileName: zod.z.string().nullable().describe("Original filename of the uploaded document (null when not present)"),
|
|
8086
|
-
fileUrl: zod.z.string().nullable().describe("Direct URL to view or download the document (null when not present)")
|
|
8087
|
-
});
|
|
8088
|
-
var UserOrgLegalDocumentsSchema = zod.z.object({
|
|
8089
|
-
letterOfAuthorization: UserOrgLegalDocumentSchema,
|
|
8090
|
-
powerOfAttorney: UserOrgLegalDocumentSchema
|
|
8091
|
-
});
|
|
8092
|
-
var UserOrgTrademarkRegistrationSchema = zod.z.object({
|
|
8093
|
-
id: zod.z.number().describe("Trademark registration ID"),
|
|
8094
|
-
brandName: zod.z.string().describe("Trademarked brand name as it appears on the registration"),
|
|
8095
|
-
trademarkOffice: zod.z.string().describe("Issuing trademark office (e.g. `USPTO`, `EUIPO`)"),
|
|
8096
|
-
registrationNumber: zod.z.string().describe("Registration number assigned by the office"),
|
|
8097
|
-
goodsAndServicesClass: zod.z.string().describe("Nice Classification class(es) the registration covers"),
|
|
8098
|
-
rightsOwnerName: zod.z.string().nullable().describe("Legal entity the trademark is registered to, if recorded"),
|
|
8099
|
-
registrationPageUrl: zod.z.string().nullable().describe("Public URL on the trademark office's site, if recorded"),
|
|
8100
|
-
certificateFileName: zod.z.string().nullable().describe(
|
|
8101
|
-
"Original filename of the uploaded certificate PDF (null when no certificate is attached)"
|
|
8102
|
-
),
|
|
8103
|
-
certificateFileUrl: zod.z.string().nullable().describe(
|
|
8104
|
-
"Direct URL to view or download the certificate PDF (null when no certificate is attached)"
|
|
8105
|
-
)
|
|
8106
|
-
});
|
|
8107
|
-
var UserOrgBrandMetadataSchema = zod.z.object({
|
|
8108
|
-
websiteUrl: zod.z.string().nullable().describe("Public website URL of the brand (linked from the portal header)"),
|
|
8109
|
-
twitterHandle: zod.z.string().nullable().describe(
|
|
8110
|
-
"Public Twitter/X handle of the brand, stored with the leading `@` (e.g. `@acme`)"
|
|
8111
|
-
),
|
|
8112
|
-
securityContactEmail: zod.z.string().nullable().describe(
|
|
8113
|
-
"Email address for security correspondence \u2014 used by takedown providers and researchers, distinct from the internal customer POC email"
|
|
8114
|
-
),
|
|
8115
|
-
industry: zod.z.string().nullable().describe('Free-form industry label (e.g. "DeFi", "CEX", "NFT", "Wallet")')
|
|
8116
|
-
});
|
|
8117
|
-
var UserOrgPortalCustomizationSchema = zod.z.object({
|
|
8118
|
-
useCustomDetails: zod.z.boolean().describe(
|
|
8119
|
-
"When true, the portal uses `name`/`slug`/`avatarUrl` from this object instead of the org's own name/slug/avatar"
|
|
8120
|
-
),
|
|
8121
|
-
name: zod.z.string().nullable().describe(
|
|
8122
|
-
"Custom display name shown on the portal (used only when `useCustomDetails=true`)"
|
|
8123
|
-
),
|
|
8124
|
-
slug: zod.z.string().nullable().describe(
|
|
8125
|
-
"Custom URL slug (`chainpatrol.io/<slug>`) \u2014 takes precedence over the org's own slug when set, regardless of `useCustomDetails`"
|
|
8126
|
-
),
|
|
8127
|
-
avatarUrl: zod.z.string().nullable().describe(
|
|
8128
|
-
"Custom avatar URL shown on the portal (used only when `useCustomDetails=true`)"
|
|
8129
|
-
),
|
|
8130
|
-
bannerEnabled: zod.z.boolean().describe(
|
|
8131
|
-
"When true, the portal renders `bannerContent` as a highlighted banner at the top of the page"
|
|
8132
|
-
),
|
|
8133
|
-
bannerContent: zod.z.string().nullable().describe(
|
|
8134
|
-
"Markdown body of the portal banner. Null (or empty) with `bannerEnabled=true` means the toggle is on but no content has been written yet"
|
|
8135
|
-
)
|
|
8136
|
-
});
|
|
8137
|
-
var UserOrgSchema = zod.z.object({
|
|
8138
|
-
id: zod.z.number(),
|
|
8139
|
-
name: zod.z.string(),
|
|
8140
|
-
slug: zod.z.string(),
|
|
8141
|
-
avatarUrl: zod.z.string().nullable(),
|
|
8142
|
-
contactUrl: zod.z.string().nullable(),
|
|
8143
|
-
subscriptionStatus: zod.z.nativeEnum(SubscriptionStatus),
|
|
8144
|
-
portalVisibility: zod.z.nativeEnum(OrganizationPortalVisibility).describe(
|
|
8145
|
-
"Visibility of the org's public security portal (chainpatrol.io/<slug>). `PUBLIC` is discoverable; `PRIVATE` renders only the report form (no metrics or listings); `DISABLED` returns a 404."
|
|
8146
|
-
),
|
|
8147
|
-
reportVisibility: zod.z.nativeEnum(ReportVisibility).describe(
|
|
8148
|
-
"Whether the report listings on the public portal are visible to visitors. `PUBLIC` shows the org's reports; `PRIVATE` hides the report list even when the portal is discoverable."
|
|
8149
|
-
),
|
|
8150
|
-
metricsVisibility: zod.z.nativeEnum(MetricsVisibility).describe(
|
|
8151
|
-
"Whether the metrics/threats-blocked stats render on the public portal. `PUBLIC` shows the metrics tab; `PRIVATE` hides it from anonymous visitors; `DISABLED` doesn't compute metrics at all."
|
|
8152
|
-
),
|
|
8153
|
-
brandMetadata: UserOrgBrandMetadataSchema.describe(
|
|
8154
|
-
"Public brand-facing metadata (website, twitter, security contact, industry) shown on the portal and used by staff for outbound"
|
|
8155
|
-
),
|
|
8156
|
-
portalCustomization: UserOrgPortalCustomizationSchema.describe(
|
|
8157
|
-
"Customer-configurable presentation of the public security portal \u2014 custom name/slug/avatar and the banner content"
|
|
8158
|
-
),
|
|
8159
|
-
services: zod.z.object({
|
|
8160
|
-
reporting: singleServiceSchema,
|
|
8161
|
-
reviewing: singleServiceSchema,
|
|
8162
|
-
protection: singleServiceSchema,
|
|
8163
|
-
takedowns: takedownsServiceSchema,
|
|
8164
|
-
detection: singleServiceSchema,
|
|
8165
|
-
darkWebMonitoring: singleServiceSchema
|
|
8166
|
-
}),
|
|
8167
|
-
integrations: UserOrgIntegrationsSchema,
|
|
8168
|
-
obligatoryAdminApproval: UserOrgObligatoryAdminApprovalSchema,
|
|
8169
|
-
pendingServiceApprovals: zod.z.array(PendingServiceApprovalSchema),
|
|
8170
|
-
legalDocuments: UserOrgLegalDocumentsSchema.describe(
|
|
8171
|
-
"Org-level Letter of Authorization and Power of Attorney attachments"
|
|
8172
|
-
),
|
|
8173
|
-
trademarkRegistrations: zod.z.array(UserOrgTrademarkRegistrationSchema).describe(
|
|
8174
|
-
"Org-level trademark registrations attached to the organization. An empty array means no trademarks are on file \u2014 use this to identify customers who still need to add them."
|
|
8175
|
-
)
|
|
8176
|
-
});
|
|
8177
|
-
zod.z.object({
|
|
8178
|
-
organizations: zod.z.array(UserOrgSchema)
|
|
8179
|
-
});
|
|
8180
|
-
|
|
8181
|
-
// ../../internal/validation/src/public/organization/metrics-get.ts
|
|
8182
|
-
var organizationMetricsIncludeFieldSchema = zod.z.enum([
|
|
8183
|
-
"reports",
|
|
8184
|
-
"newThreats",
|
|
8185
|
-
"threatsWatchlisted",
|
|
8186
|
-
"takedownsFiled",
|
|
8187
|
-
"takedownsCompleted",
|
|
8188
|
-
"domainThreats",
|
|
8189
|
-
"twitterThreats",
|
|
8190
|
-
"telegramThreats",
|
|
8191
|
-
"otherThreats",
|
|
8192
|
-
"blockedByType",
|
|
8193
|
-
"blockedByDay"
|
|
8194
|
-
]);
|
|
8195
|
-
organizationMetricsIncludeFieldSchema.options;
|
|
8196
|
-
var ORGANIZATION_METRICS_MAX_SLUGS = 500;
|
|
8197
|
-
var organizationMetricsServicesFilterSchema = zod.z.preprocess((value) => {
|
|
8198
|
-
if (typeof value !== "string") return value;
|
|
8199
|
-
try {
|
|
8200
|
-
return JSON.parse(value);
|
|
8201
|
-
} catch (e4) {
|
|
8202
|
-
return value;
|
|
8203
|
-
}
|
|
8204
|
-
}, userOrgsServicesFilterObjectSchema).optional();
|
|
8205
|
-
zod.z.object({
|
|
8206
|
-
organizationSlug: zod.z.string().optional().describe(
|
|
8207
|
-
"Organization slug. Required when authenticating with a user session (Bearer token) and `slugs`/`allMyOrgs` are not supplied; ignored when using an org-scoped API key (org is derived from the key). Mutually exclusive with `slugs` and `allMyOrgs`."
|
|
8208
|
-
),
|
|
8209
|
-
slugs: zod.z.array(zod.z.string()).max(ORGANIZATION_METRICS_MAX_SLUGS).optional().describe(
|
|
8210
|
-
"Multi-org form. Each slug is auth-checked individually (org-scoped API keys may only pass their own org; sessions and user API keys must have membership or staff role per slug). When supplied with more than one slug, the response includes a `perOrg` breakdown plus `metrics` rolled up across all of them. Capped at " + String(ORGANIZATION_METRICS_MAX_SLUGS) + " slugs per call. Mutually exclusive with `organizationSlug` and `allMyOrgs`."
|
|
8211
|
-
),
|
|
8212
|
-
allMyOrgs: zod.z.preprocess((value) => {
|
|
8213
|
-
if (value === "true") return true;
|
|
8214
|
-
if (value === "false") return false;
|
|
8215
|
-
return value;
|
|
8216
|
-
}, zod.z.boolean()).optional().describe(
|
|
8217
|
-
"Shortcut for 'every org the caller is authorized to read'. Reuses the same filter logic as `/user/orgs`: org-scoped API keys are rejected (they're pinned to one org \u2014 use the default form); user API keys / Bearer sessions resolve to the user's memberships (or every active org for staff). Combine with `subscriptionStatus` and `services` to narrow (e.g. only paying customers with takedowns enabled). The resolved org set is still capped at " + String(ORGANIZATION_METRICS_MAX_SLUGS) + " and a 413 is returned if exceeded. Mutually exclusive with `organizationSlug`, `slugs`, and `brandSlug`."
|
|
8218
|
-
),
|
|
8219
|
-
subscriptionStatus: zod.z.array(UserOrgsSubscriptionStatusSchema).min(1).optional().describe(
|
|
8220
|
-
"Only meaningful with `allMyOrgs: true`. Defaults to the same set `/user/orgs` uses (ACTIVE/POC/PROSPECT/INTEGRATION \u2014 INACTIVE is always excluded)."
|
|
8221
|
-
),
|
|
8222
|
-
services: organizationMetricsServicesFilterSchema.describe(
|
|
8223
|
-
"Only meaningful with `allMyOrgs: true`. Same shape as `/user/orgs`'s `services` filter \u2014 every service accepts `{ active }`, and **only `takedowns` additionally accepts `automated`** (the one service where manual-vs-automated changes real platform behavior). E.g. `{ takedowns: { active: true, automated: false } }` for 'orgs with takedowns enabled but automation off'."
|
|
8224
|
-
),
|
|
8225
|
-
brandSlug: zod.z.string().optional(),
|
|
8226
|
-
startDate: zod.z.coerce.date().optional(),
|
|
8227
|
-
endDate: zod.z.coerce.date().optional(),
|
|
8228
|
-
include: zod.z.array(organizationMetricsIncludeFieldSchema).optional().describe(
|
|
8229
|
-
"Subset of metrics to compute. When omitted or empty, every metric is computed (legacy behavior). Each value in `include` costs roughly one Prisma aggregate, so narrow the list when an agent only needs a couple of numbers \u2014 this is the main lever for keeping big-org calls inside the 30s function cap. Fields not in `include` come back as `null`."
|
|
8230
|
-
)
|
|
8231
|
-
}).refine(
|
|
8232
|
-
(value) => {
|
|
8233
|
-
const explicitForms = [
|
|
8234
|
-
Boolean(value.organizationSlug),
|
|
8235
|
-
Boolean(value.slugs && value.slugs.length > 0),
|
|
8236
|
-
Boolean(value.allMyOrgs)
|
|
8237
|
-
].filter(Boolean).length;
|
|
8238
|
-
return explicitForms <= 1;
|
|
8239
|
-
},
|
|
8240
|
-
{
|
|
8241
|
-
message: "Pass at most one of `organizationSlug`, `slugs`, or `allMyOrgs`.",
|
|
8242
|
-
path: ["allMyOrgs"]
|
|
8243
|
-
}
|
|
8244
|
-
).refine((value) => !(value.brandSlug && value.slugs && value.slugs.length > 1), {
|
|
8245
|
-
message: "`brandSlug` is only valid alongside a single organization, not `slugs`.",
|
|
8246
|
-
path: ["brandSlug"]
|
|
8247
|
-
}).refine((value) => !(value.brandSlug && value.allMyOrgs), {
|
|
8248
|
-
message: "`brandSlug` is only valid for a single org, not `allMyOrgs`.",
|
|
8249
|
-
path: ["brandSlug"]
|
|
8250
|
-
});
|
|
8251
|
-
var metricValue = zod.z.number().nullable();
|
|
8252
|
-
var metricsObjectSchema = zod.z.object({
|
|
8253
|
-
reports: metricValue,
|
|
8254
|
-
newThreats: metricValue,
|
|
8255
|
-
threatsWatchlisted: metricValue,
|
|
8256
|
-
takedownsFiled: metricValue,
|
|
8257
|
-
takedownsCompleted: metricValue,
|
|
8258
|
-
domainThreats: metricValue,
|
|
8259
|
-
twitterThreats: metricValue,
|
|
8260
|
-
telegramThreats: metricValue,
|
|
8261
|
-
otherThreats: metricValue
|
|
8262
|
-
});
|
|
8263
|
-
var blockedByTypeSchema = zod.z.array(
|
|
8264
|
-
zod.z.object({
|
|
8265
|
-
type: zod.z.string(),
|
|
8266
|
-
count: zod.z.number()
|
|
8267
|
-
})
|
|
8268
|
-
).nullable();
|
|
8269
|
-
var blockedByDaySchema = zod.z.array(
|
|
8270
|
-
zod.z.object({
|
|
8271
|
-
date: zod.z.string(),
|
|
8272
|
-
count: zod.z.number()
|
|
8273
|
-
})
|
|
8274
|
-
).nullable();
|
|
8275
|
-
zod.z.object({
|
|
8276
|
-
/**
|
|
8277
|
-
* Aggregate metrics. For single-org callers this is just that org's
|
|
8278
|
-
* numbers; for multi-org callers (`slugs.length > 1` or `allMyOrgs`)
|
|
8279
|
-
* it is the sum across all queried orgs.
|
|
8280
|
-
*/
|
|
8281
|
-
metrics: metricsObjectSchema,
|
|
8282
|
-
blockedByType: blockedByTypeSchema,
|
|
8283
|
-
blockedByDay: blockedByDaySchema,
|
|
8284
|
-
/**
|
|
8285
|
-
* Derived averages over the time window (and, in multi-org mode,
|
|
8286
|
-
* across orgs). `perDay = metrics / windowDays`. In multi-org mode
|
|
8287
|
-
* `perOrgPerDay = metrics / numOrgs / windowDays`; in single-org
|
|
8288
|
-
* mode it is `null`. Counts are floats here — the underlying
|
|
8289
|
-
* `metrics` fields stay integer counts.
|
|
8290
|
-
*/
|
|
8291
|
-
averages: zod.z.object({
|
|
8292
|
-
perDay: metricsObjectSchema.nullable(),
|
|
8293
|
-
perOrgPerDay: metricsObjectSchema.nullable(),
|
|
8294
|
-
windowDays: zod.z.number().nullable()
|
|
8295
|
-
}),
|
|
8296
|
-
/**
|
|
8297
|
-
* Per-org breakdown. Only populated in multi-org mode; `null` for
|
|
8298
|
-
* single-org callers.
|
|
8299
|
-
*/
|
|
8300
|
-
perOrg: zod.z.record(
|
|
8301
|
-
zod.z.string(),
|
|
8302
|
-
zod.z.object({
|
|
8303
|
-
metrics: metricsObjectSchema,
|
|
8304
|
-
blockedByType: blockedByTypeSchema,
|
|
8305
|
-
blockedByDay: blockedByDaySchema
|
|
8306
|
-
})
|
|
8307
|
-
).nullable(),
|
|
8308
|
-
/**
|
|
8309
|
-
* Echoes the actual orgs the response covers, in the order they
|
|
8310
|
-
* were resolved. Single-org responses always have length 1. The
|
|
8311
|
-
* `resolvedFrom` field distinguishes how the caller asked for the
|
|
8312
|
-
* scope (useful for agent reporting).
|
|
8313
|
-
*/
|
|
8314
|
-
scope: zod.z.object({
|
|
8315
|
-
mode: zod.z.enum(["single", "multi"]),
|
|
8316
|
-
orgs: zod.z.array(zod.z.string()),
|
|
8317
|
-
resolvedFrom: zod.z.enum(["api-key", "organizationSlug", "slugs", "allMyOrgs"])
|
|
8318
|
-
})
|
|
8319
|
-
});
|
|
8320
|
-
|
|
8321
|
-
// ../../internal/utils/src/enrichments.ts
|
|
8322
|
-
var enrichments_exports = {};
|
|
8323
|
-
__export(enrichments_exports, {
|
|
8324
|
-
ASSET_SCAN_ENRICHMENT_SOURCE_LABELS: () => ASSET_SCAN_ENRICHMENT_SOURCE_LABELS,
|
|
8325
|
-
ASSET_SCAN_ENRICHMENT_SOURCE_TO_TYPES: () => ASSET_SCAN_ENRICHMENT_SOURCE_TO_TYPES,
|
|
8326
|
-
ASSET_SCAN_ENRICHMENT_TYPE_LABELS: () => ASSET_SCAN_ENRICHMENT_TYPE_LABELS,
|
|
8327
|
-
AssetScanEnrichmentSource: () => AssetScanEnrichmentSource,
|
|
8328
|
-
AssetScanEnrichmentType: () => AssetScanEnrichmentType
|
|
7468
|
+
// ../../internal/utils/src/detection.ts
|
|
7469
|
+
var ThreatDetectionSourceKey = /* @__PURE__ */ ((ThreatDetectionSourceKey2) => {
|
|
7470
|
+
ThreatDetectionSourceKey2["META_ADS_SEARCH"] = "meta_ads_search";
|
|
7471
|
+
ThreatDetectionSourceKey2["TELEGRAM_CHANNELS_SEARCH"] = "telegram_channels_search";
|
|
7472
|
+
ThreatDetectionSourceKey2["TELEGRAM_USER_SEARCH"] = "telegram_user_search";
|
|
7473
|
+
ThreatDetectionSourceKey2["TELEGRAM_CHANNELS_SEARCH_VETRIC"] = "telegram_channels_search_vetric";
|
|
7474
|
+
ThreatDetectionSourceKey2["TELEGRAM_USER_SEARCH_VETRIC"] = "telegram_user_search_vetric";
|
|
7475
|
+
ThreatDetectionSourceKey2["FACEBOOK_PAGE_SEARCH_VETRIC"] = "facebook_page_search_vetric";
|
|
7476
|
+
ThreatDetectionSourceKey2["INSTAGRAM_ACCOUNT_SEARCH_VETRIC"] = "instagram_account_search_vetric";
|
|
7477
|
+
ThreatDetectionSourceKey2["TWITTER_SEARCH_VETRIC"] = "twitter_search_vetric";
|
|
7478
|
+
ThreatDetectionSourceKey2["LINKEDIN_PEOPLE_SEARCH_VETRIC"] = "linkedin_people_search_vetric";
|
|
7479
|
+
ThreatDetectionSourceKey2["LINKEDIN_COMPANY_SEARCH_VETRIC"] = "linkedin_company_search_vetric";
|
|
7480
|
+
ThreatDetectionSourceKey2["META_ADS_SEARCH_VETRIC"] = "meta_ads_search_vetric";
|
|
7481
|
+
ThreatDetectionSourceKey2["TIK_TOK_VIDEO_SEARCH"] = "tik_tok_video_search";
|
|
7482
|
+
ThreatDetectionSourceKey2["TIK_TOK_USER_SEARCH"] = "tik_tok_user_search";
|
|
7483
|
+
ThreatDetectionSourceKey2["TIK_TOK_USER_SEARCH_VETRIC"] = "tik_tok_user_search_vetric";
|
|
7484
|
+
ThreatDetectionSourceKey2["TIK_TOK_VIDEO_SEARCH_VETRIC"] = "tik_tok_video_search_vetric";
|
|
7485
|
+
ThreatDetectionSourceKey2["BLOCKLIST"] = "blocklist";
|
|
7486
|
+
ThreatDetectionSourceKey2["APPLE_APP_STORE"] = "apple_app_store";
|
|
7487
|
+
ThreatDetectionSourceKey2["GOOGLE_ADS_SEARCH"] = "google_ads_search";
|
|
7488
|
+
ThreatDetectionSourceKey2["MOZILLA_ADDON_SEARCH"] = "mozilla_addon_search";
|
|
7489
|
+
ThreatDetectionSourceKey2["REDDIT_SUBREDDIT_SEARCH"] = "reddit_subreddit_search";
|
|
7490
|
+
ThreatDetectionSourceKey2["ASSET_CHECK"] = "asset_check";
|
|
7491
|
+
ThreatDetectionSourceKey2["TWITTER_POST_SEARCH"] = "twitter_post_search";
|
|
7492
|
+
ThreatDetectionSourceKey2["MEDIUM_TAG_RSS"] = "medium_tag_rss";
|
|
7493
|
+
ThreatDetectionSourceKey2["TWITTER_SEARCH"] = "twitter_search";
|
|
7494
|
+
ThreatDetectionSourceKey2["YAHOO_SEARCH"] = "yahoo_search";
|
|
7495
|
+
ThreatDetectionSourceKey2["DUCK_DUCK_GO_SEARCH"] = "duck_duck_go_search";
|
|
7496
|
+
ThreatDetectionSourceKey2["BING_SEARCH"] = "bing_search";
|
|
7497
|
+
ThreatDetectionSourceKey2["GUESTBOOK"] = "guestbook";
|
|
7498
|
+
ThreatDetectionSourceKey2["CERTSTREAM"] = "certstream";
|
|
7499
|
+
ThreatDetectionSourceKey2["EXTERNAL"] = "external";
|
|
7500
|
+
ThreatDetectionSourceKey2["GOOGLE_SEARCH"] = "google_search";
|
|
7501
|
+
ThreatDetectionSourceKey2["DNS_TWIST"] = "dns_twist";
|
|
7502
|
+
ThreatDetectionSourceKey2["TWITTER"] = "twitter";
|
|
7503
|
+
ThreatDetectionSourceKey2["TWITTER_USERNAME_MONITOR"] = "twitter_username_monitor";
|
|
7504
|
+
ThreatDetectionSourceKey2["URLSCAN"] = "urlscan";
|
|
7505
|
+
ThreatDetectionSourceKey2["URLSCAN_HOSTNAME_SEARCH"] = "urlscan_hostname_search";
|
|
7506
|
+
ThreatDetectionSourceKey2["YOUTUBE_SEARCH"] = "youtube_search";
|
|
7507
|
+
ThreatDetectionSourceKey2["GOOGLE_PLAY_SEARCH"] = "google_play_search";
|
|
7508
|
+
ThreatDetectionSourceKey2["DEXSCREENER_SEARCH"] = "dexscreener_search";
|
|
7509
|
+
ThreatDetectionSourceKey2["BLOCKED_IP_SCAN"] = "blocked_ip_scan";
|
|
7510
|
+
ThreatDetectionSourceKey2["BLOCKED_BILIBILI_SUGGESTED"] = "blocked_bilibili_suggested";
|
|
7511
|
+
ThreatDetectionSourceKey2["GROK_POST_SEARCH"] = "grok_post_search";
|
|
7512
|
+
ThreatDetectionSourceKey2["GROK_USER_SEARCH"] = "grok_user_search";
|
|
7513
|
+
ThreatDetectionSourceKey2["GOOGLE_LENS_IMAGE_SEARCH"] = "google_lens_image_search";
|
|
7514
|
+
ThreatDetectionSourceKey2["YANDEX_SEARCH"] = "yandex_search";
|
|
7515
|
+
ThreatDetectionSourceKey2["LINKEDIN_EMPLOYEE_DETECTION"] = "linkedin_employee_detection";
|
|
7516
|
+
ThreatDetectionSourceKey2["LINKEDIN_POST_SEARCH"] = "linkedin_post_search";
|
|
7517
|
+
ThreatDetectionSourceKey2["LINKEDIN_COMPANY_SEARCH"] = "linkedin_company_search";
|
|
7518
|
+
ThreatDetectionSourceKey2["BING_ADS_SEARCH"] = "bing_ads_search";
|
|
7519
|
+
ThreatDetectionSourceKey2["TIK_TOK_ADS_SEARCH"] = "tik_tok_ads_search";
|
|
7520
|
+
ThreatDetectionSourceKey2["DNSDB"] = "dnsdb";
|
|
7521
|
+
ThreatDetectionSourceKey2["DAILY_MOTION_SEARCH"] = "daily_motion_search";
|
|
7522
|
+
ThreatDetectionSourceKey2["WATCHLIST"] = "watchlist";
|
|
7523
|
+
return ThreatDetectionSourceKey2;
|
|
7524
|
+
})(ThreatDetectionSourceKey || {});
|
|
7525
|
+
var ThreatDetectionScope = /* @__PURE__ */ ((ThreatDetectionScope2) => {
|
|
7526
|
+
ThreatDetectionScope2["ORGANIZATION"] = "organization";
|
|
7527
|
+
ThreatDetectionScope2["GLOBAL"] = "global";
|
|
7528
|
+
return ThreatDetectionScope2;
|
|
7529
|
+
})(ThreatDetectionScope || {});
|
|
7530
|
+
|
|
7531
|
+
// ../../internal/utils/src/enrichments.ts
|
|
7532
|
+
var enrichments_exports = {};
|
|
7533
|
+
__export(enrichments_exports, {
|
|
7534
|
+
ASSET_SCAN_ENRICHMENT_SOURCE_LABELS: () => ASSET_SCAN_ENRICHMENT_SOURCE_LABELS,
|
|
7535
|
+
ASSET_SCAN_ENRICHMENT_SOURCE_TO_TYPES: () => ASSET_SCAN_ENRICHMENT_SOURCE_TO_TYPES,
|
|
7536
|
+
ASSET_SCAN_ENRICHMENT_TYPE_LABELS: () => ASSET_SCAN_ENRICHMENT_TYPE_LABELS,
|
|
7537
|
+
AssetScanEnrichmentSource: () => AssetScanEnrichmentSource,
|
|
7538
|
+
AssetScanEnrichmentType: () => AssetScanEnrichmentType
|
|
8329
7539
|
});
|
|
8330
7540
|
var AssetScanEnrichmentType = /* @__PURE__ */ ((AssetScanEnrichmentType2) => {
|
|
8331
7541
|
AssetScanEnrichmentType2["CONTENT_AND_METADATA"] = "content_and_metadata";
|
|
@@ -10910,977 +10120,2012 @@ var doCustomReplacements = (string, replacements2) => {
|
|
|
10910
10120
|
for (const [key, value] of replacements2) {
|
|
10911
10121
|
string = string.replace(new RegExp(escapeStringRegexp2(key), "g"), value);
|
|
10912
10122
|
}
|
|
10913
|
-
return string;
|
|
10123
|
+
return string;
|
|
10124
|
+
};
|
|
10125
|
+
function transliterate(string, options) {
|
|
10126
|
+
if (typeof string !== "string") {
|
|
10127
|
+
throw new TypeError(`Expected a string, got \`${typeof string}\``);
|
|
10128
|
+
}
|
|
10129
|
+
options = __spreadValues({
|
|
10130
|
+
customReplacements: []
|
|
10131
|
+
}, options);
|
|
10132
|
+
const customReplacements = new Map([
|
|
10133
|
+
...replacements_default,
|
|
10134
|
+
...options.customReplacements
|
|
10135
|
+
]);
|
|
10136
|
+
string = string.normalize();
|
|
10137
|
+
string = doCustomReplacements(string, customReplacements);
|
|
10138
|
+
string = string.normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "").normalize();
|
|
10139
|
+
return string;
|
|
10140
|
+
}
|
|
10141
|
+
|
|
10142
|
+
// ../../node_modules/@sindresorhus/slugify/overridable-replacements.js
|
|
10143
|
+
var overridableReplacements = [
|
|
10144
|
+
["&", " and "],
|
|
10145
|
+
["\u{1F984}", " unicorn "],
|
|
10146
|
+
["\u2665", " love "]
|
|
10147
|
+
];
|
|
10148
|
+
var overridable_replacements_default = overridableReplacements;
|
|
10149
|
+
|
|
10150
|
+
// ../../node_modules/@sindresorhus/slugify/index.js
|
|
10151
|
+
var decamelize = (string) => {
|
|
10152
|
+
return string.replace(/([A-Z]{2,})(\d+)/g, "$1 $2").replace(/([a-z\d]+)([A-Z]{2,})/g, "$1 $2").replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-rt-z\d]+)/g, "$1 $2");
|
|
10153
|
+
};
|
|
10154
|
+
var removeMootSeparators = (string, separator) => {
|
|
10155
|
+
const escapedSeparator = escapeStringRegexp(separator);
|
|
10156
|
+
return string.replace(new RegExp(`${escapedSeparator}{2,}`, "g"), separator).replace(new RegExp(`^${escapedSeparator}|${escapedSeparator}$`, "g"), "");
|
|
10157
|
+
};
|
|
10158
|
+
var buildPatternSlug = (options) => {
|
|
10159
|
+
let negationSetPattern = "a-z\\d";
|
|
10160
|
+
negationSetPattern += options.lowercase ? "" : "A-Z";
|
|
10161
|
+
if (options.preserveCharacters.length > 0) {
|
|
10162
|
+
for (const character of options.preserveCharacters) {
|
|
10163
|
+
if (character === options.separator) {
|
|
10164
|
+
throw new Error(`The separator character \`${options.separator}\` cannot be included in preserved characters: ${options.preserveCharacters}`);
|
|
10165
|
+
}
|
|
10166
|
+
negationSetPattern += escapeStringRegexp(character);
|
|
10167
|
+
}
|
|
10168
|
+
}
|
|
10169
|
+
return new RegExp(`[^${negationSetPattern}]+`, "g");
|
|
10170
|
+
};
|
|
10171
|
+
function slugify(string, options) {
|
|
10172
|
+
if (typeof string !== "string") {
|
|
10173
|
+
throw new TypeError(`Expected a string, got \`${typeof string}\``);
|
|
10174
|
+
}
|
|
10175
|
+
options = __spreadValues({
|
|
10176
|
+
separator: "-",
|
|
10177
|
+
lowercase: true,
|
|
10178
|
+
decamelize: true,
|
|
10179
|
+
customReplacements: [],
|
|
10180
|
+
preserveLeadingUnderscore: false,
|
|
10181
|
+
preserveTrailingDash: false,
|
|
10182
|
+
preserveCharacters: []
|
|
10183
|
+
}, options);
|
|
10184
|
+
const shouldPrependUnderscore = options.preserveLeadingUnderscore && string.startsWith("_");
|
|
10185
|
+
const shouldAppendDash = options.preserveTrailingDash && string.endsWith("-");
|
|
10186
|
+
const customReplacements = new Map([
|
|
10187
|
+
...overridable_replacements_default,
|
|
10188
|
+
...options.customReplacements
|
|
10189
|
+
]);
|
|
10190
|
+
string = transliterate(string, { customReplacements });
|
|
10191
|
+
if (options.decamelize) {
|
|
10192
|
+
string = decamelize(string);
|
|
10193
|
+
}
|
|
10194
|
+
const patternSlug = buildPatternSlug(options);
|
|
10195
|
+
if (options.lowercase) {
|
|
10196
|
+
string = string.toLowerCase();
|
|
10197
|
+
}
|
|
10198
|
+
string = string.replace(/([a-zA-Z\d]+)'([ts])(\s|$)/g, "$1$2$3");
|
|
10199
|
+
string = string.replace(patternSlug, options.separator);
|
|
10200
|
+
string = string.replace(/\\/g, "");
|
|
10201
|
+
if (options.separator) {
|
|
10202
|
+
string = removeMootSeparators(string, options.separator);
|
|
10203
|
+
}
|
|
10204
|
+
if (shouldPrependUnderscore) {
|
|
10205
|
+
string = `_${string}`;
|
|
10206
|
+
}
|
|
10207
|
+
if (shouldAppendDash) {
|
|
10208
|
+
string = `${string}-`;
|
|
10209
|
+
}
|
|
10210
|
+
return string;
|
|
10211
|
+
}
|
|
10212
|
+
|
|
10213
|
+
// ../asset-parse/src/model.ts
|
|
10214
|
+
var AssetModel = /* @__PURE__ */ ((AssetModel2) => {
|
|
10215
|
+
AssetModel2["Addon"] = "addon";
|
|
10216
|
+
AssetModel2["App"] = "app";
|
|
10217
|
+
AssetModel2["Bot"] = "bot";
|
|
10218
|
+
AssetModel2["BusinessProfile"] = "business-profile";
|
|
10219
|
+
AssetModel2["Catalog"] = "catalog";
|
|
10220
|
+
AssetModel2["Collection"] = "collection";
|
|
10221
|
+
AssetModel2["Channel"] = "channel";
|
|
10222
|
+
AssetModel2["Group"] = "group";
|
|
10223
|
+
AssetModel2["Post"] = "post";
|
|
10224
|
+
AssetModel2["Profile"] = "profile";
|
|
10225
|
+
AssetModel2["Short"] = "short";
|
|
10226
|
+
AssetModel2["Video"] = "video";
|
|
10227
|
+
AssetModel2["Space"] = "space";
|
|
10228
|
+
AssetModel2["Issue"] = "issue";
|
|
10229
|
+
AssetModel2["PullRequest"] = "pull-request";
|
|
10230
|
+
AssetModel2["Discussion"] = "discussion";
|
|
10231
|
+
AssetModel2["Repository"] = "repository";
|
|
10232
|
+
AssetModel2["Article"] = "Article";
|
|
10233
|
+
AssetModel2["Comment"] = "comment";
|
|
10234
|
+
AssetModel2["List"] = "list";
|
|
10235
|
+
AssetModel2["Subreddit"] = "subreddit";
|
|
10236
|
+
AssetModel2["Community"] = "community";
|
|
10237
|
+
AssetModel2["MiniApp"] = "mini-app";
|
|
10238
|
+
AssetModel2["Developer"] = "developer";
|
|
10239
|
+
return AssetModel2;
|
|
10240
|
+
})(AssetModel || {});
|
|
10241
|
+
function isUrl(input) {
|
|
10242
|
+
if (input.trim() === "") {
|
|
10243
|
+
return false;
|
|
10244
|
+
}
|
|
10245
|
+
if (input.startsWith("/") || input.startsWith("#") || input.startsWith("?") || input.startsWith(".") || !input.includes(".")) {
|
|
10246
|
+
return false;
|
|
10247
|
+
}
|
|
10248
|
+
return URL.canParse(input) || URL.canParse(`https://${input}`);
|
|
10249
|
+
}
|
|
10250
|
+
function getNormalizedUrl(input) {
|
|
10251
|
+
if (!isUrl(input)) {
|
|
10252
|
+
throw new Error(`Invalid URL: ${input}`);
|
|
10253
|
+
}
|
|
10254
|
+
let url;
|
|
10255
|
+
try {
|
|
10256
|
+
url = new URL(input);
|
|
10257
|
+
} catch (e4) {
|
|
10258
|
+
try {
|
|
10259
|
+
url = new URL(`https://${input}`);
|
|
10260
|
+
} catch (e5) {
|
|
10261
|
+
throw new Error(`Invalid URL: ${input}`);
|
|
10262
|
+
}
|
|
10263
|
+
}
|
|
10264
|
+
const normalizedUrl = normalizeUrl(url.toString(), {
|
|
10265
|
+
defaultProtocol: "https"
|
|
10266
|
+
});
|
|
10267
|
+
try {
|
|
10268
|
+
return new URL(normalizedUrl);
|
|
10269
|
+
} catch (e4) {
|
|
10270
|
+
throw new Error(`Invalid URL: ${input}`);
|
|
10271
|
+
}
|
|
10272
|
+
}
|
|
10273
|
+
var ensureHttpsPrefix = (url) => {
|
|
10274
|
+
if (!url.startsWith("http")) {
|
|
10275
|
+
return `https://${url}`;
|
|
10276
|
+
}
|
|
10277
|
+
return url.replace(/^https?:\/{1,2}/, "https://");
|
|
10914
10278
|
};
|
|
10915
|
-
function
|
|
10916
|
-
|
|
10917
|
-
|
|
10279
|
+
function getHostname(input) {
|
|
10280
|
+
try {
|
|
10281
|
+
return getNormalizedUrl(input).hostname;
|
|
10282
|
+
} catch (e4) {
|
|
10283
|
+
return null;
|
|
10918
10284
|
}
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10285
|
+
}
|
|
10286
|
+
function getParentDomains(input) {
|
|
10287
|
+
const domain = getHostname(input);
|
|
10288
|
+
if (!domain) {
|
|
10289
|
+
return [];
|
|
10290
|
+
}
|
|
10291
|
+
const subdomain = tldts.getSubdomain(domain, { mixedInputs: false });
|
|
10292
|
+
if (!subdomain) {
|
|
10293
|
+
return [domain];
|
|
10294
|
+
}
|
|
10295
|
+
const domainWithSuffix = tldts.getDomain(domain, { mixedInputs: false });
|
|
10296
|
+
if (!domainWithSuffix) {
|
|
10297
|
+
return [];
|
|
10298
|
+
}
|
|
10299
|
+
const parentDomains = [domainWithSuffix];
|
|
10300
|
+
const parentDomainParts = subdomain.split(".");
|
|
10301
|
+
for (let i = parentDomainParts.length - 1; i >= 0; i--) {
|
|
10302
|
+
const parentDomainPart = parentDomainParts.slice(i).join(".");
|
|
10303
|
+
parentDomains.push(`${parentDomainPart}.${domainWithSuffix}`);
|
|
10304
|
+
}
|
|
10305
|
+
return parentDomains.reverse();
|
|
10306
|
+
}
|
|
10307
|
+
function trimDomainToLevels(domain, options = { levels: 4 }) {
|
|
10308
|
+
var _a;
|
|
10309
|
+
const parsed = tldts.parse(domain);
|
|
10310
|
+
const eTLDPlusOne = (_a = parsed.domain) != null ? _a : "";
|
|
10311
|
+
const subdomains = domain.replace(/https?:\/\/(www\.)?/, "").split(".");
|
|
10312
|
+
const eTLDPlusOneIndex = subdomains.findIndex(
|
|
10313
|
+
(_, i) => subdomains.slice(i).join(".") === eTLDPlusOne
|
|
10314
|
+
);
|
|
10315
|
+
const trimmedSubdomains = subdomains.slice(Math.max(eTLDPlusOneIndex - (options.levels - 1), 0)).join(".");
|
|
10316
|
+
return trimmedSubdomains;
|
|
10930
10317
|
}
|
|
10931
10318
|
|
|
10932
|
-
//
|
|
10933
|
-
var
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10319
|
+
// ../asset-parse/src/phone.ts
|
|
10320
|
+
var phone_exports = {};
|
|
10321
|
+
__export(phone_exports, {
|
|
10322
|
+
PHONE_NUMBER_REGEX: () => PHONE_NUMBER_REGEX,
|
|
10323
|
+
isPhoneNumber: () => isPhoneNumber,
|
|
10324
|
+
normalizePhoneNumber: () => normalizePhoneNumber
|
|
10325
|
+
});
|
|
10326
|
+
var PHONE_NUMBER_REGEX = /(?:\+?\d{1,4}[\s.-]?)?(?:\(\d{1,4}\)|\d{1,4})[\s.-]?\d{1,4}[\s.-]?\d{1,4}[\s.-]?\d{0,4}(?:\s*(?:ext|x|extension)[\s.]*\d{1,6})?/gi;
|
|
10327
|
+
function preparePhoneInput(input) {
|
|
10328
|
+
let s2 = input.trim();
|
|
10329
|
+
s2 = s2.replace(/^\s*tel:\s*(?:\/\/)?\s*/i, "");
|
|
10330
|
+
s2 = s2.trim();
|
|
10331
|
+
s2 = s2.replace(/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g, " ");
|
|
10332
|
+
s2 = s2.replace(/[\u2010\u2011\u2012\u2013\u2014\u2015\u2212\uFE58\uFE63\uFF0D]/g, "-");
|
|
10333
|
+
s2 = s2.replace(/\uFF0B/g, "+");
|
|
10334
|
+
s2 = s2.replace(/\uFF08/g, "(");
|
|
10335
|
+
s2 = s2.replace(/\uFF09/g, ")");
|
|
10336
|
+
return s2.trim();
|
|
10337
|
+
}
|
|
10338
|
+
function isAllSameDigit(digits2) {
|
|
10339
|
+
return /^(\d)\1+$/.test(digits2);
|
|
10340
|
+
}
|
|
10341
|
+
function isStrictlyMonotonicStep1(digits2) {
|
|
10342
|
+
if (digits2.length < 8) {
|
|
10343
|
+
return false;
|
|
10344
|
+
}
|
|
10345
|
+
let increasing = true;
|
|
10346
|
+
let decreasing = true;
|
|
10347
|
+
for (let i = 1; i < digits2.length; i++) {
|
|
10348
|
+
const curr = digits2.charCodeAt(i) - 48;
|
|
10349
|
+
const prev = digits2.charCodeAt(i - 1) - 48;
|
|
10350
|
+
if (curr !== prev + 1) {
|
|
10351
|
+
increasing = false;
|
|
10352
|
+
}
|
|
10353
|
+
if (curr !== prev - 1) {
|
|
10354
|
+
decreasing = false;
|
|
10355
|
+
}
|
|
10356
|
+
}
|
|
10357
|
+
return increasing || decreasing;
|
|
10358
|
+
}
|
|
10359
|
+
function isValidNanpNational10(d10) {
|
|
10360
|
+
if (d10.length !== 10) {
|
|
10361
|
+
return false;
|
|
10362
|
+
}
|
|
10363
|
+
const npaFirst = d10.charCodeAt(0) - 48;
|
|
10364
|
+
const nxxFirst = d10.charCodeAt(3) - 48;
|
|
10365
|
+
if (npaFirst < 2 || npaFirst > 9) {
|
|
10366
|
+
return false;
|
|
10367
|
+
}
|
|
10368
|
+
if (nxxFirst < 2 || nxxFirst > 9) {
|
|
10369
|
+
return false;
|
|
10370
|
+
}
|
|
10371
|
+
return true;
|
|
10372
|
+
}
|
|
10373
|
+
function isPlausiblePhoneDigits(withoutExt) {
|
|
10374
|
+
const hasPlus = withoutExt.startsWith("+");
|
|
10375
|
+
const d = withoutExt.replace(/\D/g, "");
|
|
10376
|
+
if (d.length < 8 || d.length > 15) {
|
|
10377
|
+
return false;
|
|
10378
|
+
}
|
|
10379
|
+
if (isAllSameDigit(d) || isStrictlyMonotonicStep1(d)) {
|
|
10380
|
+
return false;
|
|
10381
|
+
}
|
|
10382
|
+
const onlyDigits = /^\d+$/.test(withoutExt);
|
|
10383
|
+
if (hasPlus) {
|
|
10384
|
+
if (d.length === 11 && d.startsWith("1")) {
|
|
10385
|
+
return isValidNanpNational10(d.slice(1));
|
|
10386
|
+
}
|
|
10387
|
+
return true;
|
|
10388
|
+
}
|
|
10389
|
+
if (onlyDigits) {
|
|
10390
|
+
if (d.length === 10) {
|
|
10391
|
+
return isValidNanpNational10(d);
|
|
10392
|
+
}
|
|
10393
|
+
if (d.length === 11 && d.startsWith("1")) {
|
|
10394
|
+
return isValidNanpNational10(d.slice(1));
|
|
10395
|
+
}
|
|
10396
|
+
if (d.length === 11 && d.startsWith("0")) {
|
|
10397
|
+
return true;
|
|
10398
|
+
}
|
|
10399
|
+
return false;
|
|
10400
|
+
}
|
|
10401
|
+
if (d.length === 10) {
|
|
10402
|
+
return isValidNanpNational10(d);
|
|
10403
|
+
}
|
|
10404
|
+
if (d.length === 11 && d.startsWith("1")) {
|
|
10405
|
+
return isValidNanpNational10(d.slice(1));
|
|
10406
|
+
}
|
|
10407
|
+
if (d.length === 11 && d.startsWith("0")) {
|
|
10408
|
+
return true;
|
|
10409
|
+
}
|
|
10410
|
+
if (d.length >= 12 && d.length <= 15) {
|
|
10411
|
+
return true;
|
|
10412
|
+
}
|
|
10413
|
+
return false;
|
|
10414
|
+
}
|
|
10415
|
+
function isPhoneNumber(input) {
|
|
10416
|
+
const trimmed = preparePhoneInput(input);
|
|
10417
|
+
if (trimmed === "") {
|
|
10418
|
+
return false;
|
|
10419
|
+
}
|
|
10420
|
+
if (!/^[+\d(]/.test(trimmed)) {
|
|
10421
|
+
return false;
|
|
10422
|
+
}
|
|
10423
|
+
const withoutExt = trimmed.replace(/\s*(ext|extension|x)\s*\d+$/i, "");
|
|
10424
|
+
if (/[a-zA-Z]/.test(withoutExt)) {
|
|
10425
|
+
return false;
|
|
10426
|
+
}
|
|
10427
|
+
const hasPhoneMarker = /[+()\s-]/.test(trimmed);
|
|
10428
|
+
const isPureDotSeparated = /^\d+(\.\d+)+$/.test(trimmed);
|
|
10429
|
+
if (isPureDotSeparated && !hasPhoneMarker) {
|
|
10430
|
+
return false;
|
|
10431
|
+
}
|
|
10432
|
+
const phoneRegex = /^(?:\+?\d{1,4}[\s.-]?)?(?:\(\d{1,4}\)|\d{1,4})[\s.-]?\d{1,4}[\s.-]?\d{1,4}[\s.-]?\d{0,4}(?:\s*(?:ext|x|extension)[\s.]*\d{1,6})?$/i;
|
|
10433
|
+
if (!phoneRegex.test(trimmed)) {
|
|
10434
|
+
return false;
|
|
10435
|
+
}
|
|
10436
|
+
return isPlausiblePhoneDigits(withoutExt);
|
|
10437
|
+
}
|
|
10438
|
+
function normalizePhoneNumber(phone) {
|
|
10439
|
+
const trimmed = preparePhoneInput(phone);
|
|
10440
|
+
const withoutExt = trimmed.replace(/\s*(ext|extension|x)\s*\d+$/i, "");
|
|
10441
|
+
const hasPlus = withoutExt.startsWith("+");
|
|
10442
|
+
const digitsOnly = withoutExt.replace(/\D/g, "");
|
|
10443
|
+
return hasPlus ? `+${digitsOnly}` : digitsOnly;
|
|
10444
|
+
}
|
|
10939
10445
|
|
|
10940
|
-
// ../../
|
|
10941
|
-
var
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
var
|
|
10945
|
-
|
|
10946
|
-
|
|
10446
|
+
// ../../internal/utils/src/punycode.ts
|
|
10447
|
+
var maxInt = 2147483647;
|
|
10448
|
+
var base = 36;
|
|
10449
|
+
var tMin = 1;
|
|
10450
|
+
var tMax = 26;
|
|
10451
|
+
var skew = 38;
|
|
10452
|
+
var damp = 700;
|
|
10453
|
+
var initialBias = 72;
|
|
10454
|
+
var initialN = 128;
|
|
10455
|
+
var delimiter = "-";
|
|
10456
|
+
var regexPunycode = /^xn--/;
|
|
10457
|
+
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
|
|
10458
|
+
var errors = {
|
|
10459
|
+
overflow: "Overflow: input needs wider integers to process",
|
|
10460
|
+
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
10461
|
+
"invalid-input": "Invalid input"
|
|
10947
10462
|
};
|
|
10948
|
-
var
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10463
|
+
var baseMinusTMin = base - tMin;
|
|
10464
|
+
var floor = Math.floor;
|
|
10465
|
+
function error(type) {
|
|
10466
|
+
throw new RangeError(errors[type]);
|
|
10467
|
+
}
|
|
10468
|
+
function mapDomain(domain, callback) {
|
|
10469
|
+
const parts = domain.split("@");
|
|
10470
|
+
let result = "";
|
|
10471
|
+
if (parts.length > 1) {
|
|
10472
|
+
result = parts[0] + "@";
|
|
10473
|
+
domain = parts[1];
|
|
10958
10474
|
}
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10475
|
+
domain = domain.replace(regexSeparators, ".");
|
|
10476
|
+
const labels = domain.split(".");
|
|
10477
|
+
const encoded = labels.map(callback).join(".");
|
|
10478
|
+
return result + encoded;
|
|
10479
|
+
}
|
|
10480
|
+
function basicToDigit(codePoint) {
|
|
10481
|
+
if (codePoint >= 48 && codePoint < 58) {
|
|
10482
|
+
return 26 + (codePoint - 48);
|
|
10964
10483
|
}
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
lowercase: true,
|
|
10968
|
-
decamelize: true,
|
|
10969
|
-
customReplacements: [],
|
|
10970
|
-
preserveLeadingUnderscore: false,
|
|
10971
|
-
preserveTrailingDash: false,
|
|
10972
|
-
preserveCharacters: []
|
|
10973
|
-
}, options);
|
|
10974
|
-
const shouldPrependUnderscore = options.preserveLeadingUnderscore && string.startsWith("_");
|
|
10975
|
-
const shouldAppendDash = options.preserveTrailingDash && string.endsWith("-");
|
|
10976
|
-
const customReplacements = new Map([
|
|
10977
|
-
...overridable_replacements_default,
|
|
10978
|
-
...options.customReplacements
|
|
10979
|
-
]);
|
|
10980
|
-
string = transliterate(string, { customReplacements });
|
|
10981
|
-
if (options.decamelize) {
|
|
10982
|
-
string = decamelize(string);
|
|
10484
|
+
if (codePoint >= 65 && codePoint < 91) {
|
|
10485
|
+
return codePoint - 65;
|
|
10983
10486
|
}
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
string = string.toLowerCase();
|
|
10487
|
+
if (codePoint >= 97 && codePoint < 123) {
|
|
10488
|
+
return codePoint - 97;
|
|
10987
10489
|
}
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10490
|
+
return base;
|
|
10491
|
+
}
|
|
10492
|
+
function adapt(delta, numPoints, firstTime) {
|
|
10493
|
+
let k4 = 0;
|
|
10494
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
10495
|
+
delta += floor(delta / numPoints);
|
|
10496
|
+
for (
|
|
10497
|
+
;
|
|
10498
|
+
/* no initialization */
|
|
10499
|
+
delta > baseMinusTMin * tMax >> 1;
|
|
10500
|
+
k4 += base
|
|
10501
|
+
) {
|
|
10502
|
+
delta = floor(delta / baseMinusTMin);
|
|
10993
10503
|
}
|
|
10994
|
-
|
|
10995
|
-
|
|
10504
|
+
return floor(k4 + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
10505
|
+
}
|
|
10506
|
+
function decode(input) {
|
|
10507
|
+
const output = [];
|
|
10508
|
+
const inputLength = input.length;
|
|
10509
|
+
let i = 0;
|
|
10510
|
+
let n2 = initialN;
|
|
10511
|
+
let bias2 = initialBias;
|
|
10512
|
+
let basic = input.lastIndexOf(delimiter);
|
|
10513
|
+
if (basic < 0) {
|
|
10514
|
+
basic = 0;
|
|
10996
10515
|
}
|
|
10997
|
-
|
|
10998
|
-
|
|
10516
|
+
for (let j = 0; j < basic; ++j) {
|
|
10517
|
+
if (input.charCodeAt(j) >= 128) {
|
|
10518
|
+
error("not-basic");
|
|
10519
|
+
}
|
|
10520
|
+
output.push(input.charCodeAt(j));
|
|
10999
10521
|
}
|
|
11000
|
-
|
|
10522
|
+
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
|
|
10523
|
+
const oldi = i;
|
|
10524
|
+
for (let w = 1, k4 = base; ; k4 += base) {
|
|
10525
|
+
if (index >= inputLength) {
|
|
10526
|
+
error("invalid-input");
|
|
10527
|
+
}
|
|
10528
|
+
const digit = basicToDigit(input.charCodeAt(index++));
|
|
10529
|
+
if (digit >= base) {
|
|
10530
|
+
error("invalid-input");
|
|
10531
|
+
}
|
|
10532
|
+
if (digit > floor((maxInt - i) / w)) {
|
|
10533
|
+
error("overflow");
|
|
10534
|
+
}
|
|
10535
|
+
i += digit * w;
|
|
10536
|
+
const t = k4 <= bias2 ? tMin : k4 >= bias2 + tMax ? tMax : k4 - bias2;
|
|
10537
|
+
if (digit < t) {
|
|
10538
|
+
break;
|
|
10539
|
+
}
|
|
10540
|
+
const baseMinusT = base - t;
|
|
10541
|
+
if (w > floor(maxInt / baseMinusT)) {
|
|
10542
|
+
error("overflow");
|
|
10543
|
+
}
|
|
10544
|
+
w *= baseMinusT;
|
|
10545
|
+
}
|
|
10546
|
+
const out = output.length + 1;
|
|
10547
|
+
bias2 = adapt(i - oldi, out, oldi == 0);
|
|
10548
|
+
if (floor(i / out) > maxInt - n2) {
|
|
10549
|
+
error("overflow");
|
|
10550
|
+
}
|
|
10551
|
+
n2 += floor(i / out);
|
|
10552
|
+
i %= out;
|
|
10553
|
+
output.splice(i++, 0, n2);
|
|
10554
|
+
}
|
|
10555
|
+
return String.fromCodePoint(...output);
|
|
10556
|
+
}
|
|
10557
|
+
function toUnicode(input) {
|
|
10558
|
+
return mapDomain(input, function(string) {
|
|
10559
|
+
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
10560
|
+
});
|
|
11001
10561
|
}
|
|
11002
10562
|
|
|
11003
|
-
//
|
|
11004
|
-
|
|
11005
|
-
AssetModel2["Addon"] = "addon";
|
|
11006
|
-
AssetModel2["App"] = "app";
|
|
11007
|
-
AssetModel2["Bot"] = "bot";
|
|
11008
|
-
AssetModel2["BusinessProfile"] = "business-profile";
|
|
11009
|
-
AssetModel2["Catalog"] = "catalog";
|
|
11010
|
-
AssetModel2["Collection"] = "collection";
|
|
11011
|
-
AssetModel2["Channel"] = "channel";
|
|
11012
|
-
AssetModel2["Group"] = "group";
|
|
11013
|
-
AssetModel2["Post"] = "post";
|
|
11014
|
-
AssetModel2["Profile"] = "profile";
|
|
11015
|
-
AssetModel2["Short"] = "short";
|
|
11016
|
-
AssetModel2["Video"] = "video";
|
|
11017
|
-
AssetModel2["Space"] = "space";
|
|
11018
|
-
AssetModel2["Issue"] = "issue";
|
|
11019
|
-
AssetModel2["PullRequest"] = "pull-request";
|
|
11020
|
-
AssetModel2["Discussion"] = "discussion";
|
|
11021
|
-
AssetModel2["Repository"] = "repository";
|
|
11022
|
-
AssetModel2["Article"] = "Article";
|
|
11023
|
-
AssetModel2["Comment"] = "comment";
|
|
11024
|
-
AssetModel2["List"] = "list";
|
|
11025
|
-
AssetModel2["Subreddit"] = "subreddit";
|
|
11026
|
-
AssetModel2["Community"] = "community";
|
|
11027
|
-
AssetModel2["MiniApp"] = "mini-app";
|
|
11028
|
-
AssetModel2["Developer"] = "developer";
|
|
11029
|
-
return AssetModel2;
|
|
11030
|
-
})(AssetModel || {});
|
|
11031
|
-
function isUrl(input) {
|
|
10563
|
+
// ../../internal/utils/src/url.ts
|
|
10564
|
+
function isEmail(input) {
|
|
11032
10565
|
if (input.trim() === "") {
|
|
11033
10566
|
return false;
|
|
11034
10567
|
}
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
}
|
|
11038
|
-
return URL.canParse(input) || URL.canParse(`https://${input}`);
|
|
10568
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
10569
|
+
return emailRegex.test(input);
|
|
11039
10570
|
}
|
|
11040
|
-
function
|
|
10571
|
+
function removeHttpProtocol(input) {
|
|
10572
|
+
return input.replace(/^https?:\/\//, "");
|
|
10573
|
+
}
|
|
10574
|
+
function stripDomainWildcardPrefix(domain) {
|
|
10575
|
+
const trimmedDomain = domain.trim();
|
|
10576
|
+
const strippedDomain = trimmedDomain.startsWith("*.") ? trimmedDomain.slice(2) : trimmedDomain;
|
|
10577
|
+
return strippedDomain.length > 0 ? strippedDomain : null;
|
|
10578
|
+
}
|
|
10579
|
+
function getDefangedUrl(input) {
|
|
11041
10580
|
if (!isUrl(input)) {
|
|
11042
|
-
|
|
10581
|
+
console.warn(`[getDefangedUrl] Invalid URL: ${input}, returning input as-is`);
|
|
10582
|
+
return input;
|
|
10583
|
+
}
|
|
10584
|
+
return input.replace(/\./g, "[.]").replace(/(https:\/\/)/g, "hxxps://").replace(/(http:\/\/)/g, "hxxp://").replace(/:\/\//g, "[://]");
|
|
10585
|
+
}
|
|
10586
|
+
function getRefangedUrl(input) {
|
|
10587
|
+
return input.replace(/hxxps/gi, "https").replace(/hxxp/gi, "http").replace(/\[:\/{2}\]/g, "://").replace(/\[\.\]/g, ".");
|
|
10588
|
+
}
|
|
10589
|
+
function containsPunycode(url) {
|
|
10590
|
+
return url.indexOf("xn--") !== -1;
|
|
10591
|
+
}
|
|
10592
|
+
function toUnicode2(url) {
|
|
10593
|
+
return toUnicode(url);
|
|
10594
|
+
}
|
|
10595
|
+
function convertHttpsToHttp(url) {
|
|
10596
|
+
if (url.startsWith("https://")) {
|
|
10597
|
+
const httpUrl = new URL(url);
|
|
10598
|
+
httpUrl.protocol = "http:";
|
|
10599
|
+
return httpUrl.toString();
|
|
10600
|
+
}
|
|
10601
|
+
throw new Error(`URL is not HTTPS: ${url}`);
|
|
10602
|
+
}
|
|
10603
|
+
function generateCanonicalIPFSUrl(content) {
|
|
10604
|
+
if (!content) {
|
|
10605
|
+
return content;
|
|
10606
|
+
}
|
|
10607
|
+
if (content.includes("ipfs.io")) {
|
|
10608
|
+
return content;
|
|
10609
|
+
}
|
|
10610
|
+
if (content.startsWith("Qm") || content.startsWith("bafy")) {
|
|
10611
|
+
return `ipfs.io/ipfs/${content}`;
|
|
10612
|
+
}
|
|
10613
|
+
return content;
|
|
10614
|
+
}
|
|
10615
|
+
function isWalrusSite(content) {
|
|
10616
|
+
return content.includes(".walrus.site") || content.includes(".walrus.host") || content.includes(".wal.app") || content.includes(".wal.site");
|
|
10617
|
+
}
|
|
10618
|
+
function getFaviconUrl(content) {
|
|
10619
|
+
const normalizedUrl = getNormalizedUrl(content);
|
|
10620
|
+
return `https://icons.duckduckgo.com/ip3/${normalizedUrl.hostname}.ico`;
|
|
10621
|
+
}
|
|
10622
|
+
function sanitizeHttpUrl(value) {
|
|
10623
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
10624
|
+
return null;
|
|
11043
10625
|
}
|
|
11044
|
-
let url;
|
|
11045
10626
|
try {
|
|
11046
|
-
|
|
10627
|
+
const parsed = new URL(value);
|
|
10628
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
10629
|
+
return null;
|
|
10630
|
+
}
|
|
10631
|
+
return parsed.toString();
|
|
11047
10632
|
} catch (e4) {
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
10633
|
+
return null;
|
|
10634
|
+
}
|
|
10635
|
+
}
|
|
10636
|
+
var URL_REGEX = /https?:\/\/[^\s"'<>\])]*/g;
|
|
10637
|
+
|
|
10638
|
+
// ../../internal/utils/src/email.ts
|
|
10639
|
+
var email_exports = {};
|
|
10640
|
+
__export(email_exports, {
|
|
10641
|
+
extractTextFromGmailPayload: () => extractTextFromGmailPayload,
|
|
10642
|
+
getDomainFromEmail: () => getDomainFromEmail,
|
|
10643
|
+
getNameFromEmail: () => getNameFromEmail
|
|
10644
|
+
});
|
|
10645
|
+
function getDomainFromEmail(email) {
|
|
10646
|
+
return email.split("@")[1];
|
|
10647
|
+
}
|
|
10648
|
+
function getNameFromEmail(email) {
|
|
10649
|
+
return email.split("@")[0];
|
|
10650
|
+
}
|
|
10651
|
+
function extractTextFromGmailPayload(payload) {
|
|
10652
|
+
var _a;
|
|
10653
|
+
if (!payload) return "";
|
|
10654
|
+
if ((_a = payload.body) == null ? void 0 : _a.data) {
|
|
10655
|
+
if (payload.mimeType === "text/plain" || payload.mimeType === "text/html") {
|
|
10656
|
+
return Buffer.from(payload.body.data, "base64url").toString("utf-8");
|
|
10657
|
+
}
|
|
10658
|
+
}
|
|
10659
|
+
if (payload.parts) {
|
|
10660
|
+
if (payload.mimeType === "multipart/alternative") {
|
|
10661
|
+
const plainTextPart = payload.parts.find((part) => part.mimeType === "text/plain");
|
|
10662
|
+
if (plainTextPart) {
|
|
10663
|
+
return extractTextFromGmailPayload(plainTextPart);
|
|
10664
|
+
}
|
|
10665
|
+
const htmlPart = payload.parts.find((part) => part.mimeType === "text/html");
|
|
10666
|
+
if (htmlPart) {
|
|
10667
|
+
return extractTextFromGmailPayload(htmlPart);
|
|
10668
|
+
}
|
|
10669
|
+
for (const part of payload.parts) {
|
|
10670
|
+
const text = extractTextFromGmailPayload(part);
|
|
10671
|
+
if (text) return text;
|
|
10672
|
+
}
|
|
11052
10673
|
}
|
|
10674
|
+
return payload.parts.map((part) => extractTextFromGmailPayload(part)).join("\n");
|
|
11053
10675
|
}
|
|
11054
|
-
|
|
11055
|
-
defaultProtocol: "https"
|
|
11056
|
-
});
|
|
11057
|
-
try {
|
|
11058
|
-
return new URL(normalizedUrl);
|
|
11059
|
-
} catch (e4) {
|
|
11060
|
-
throw new Error(`Invalid URL: ${input}`);
|
|
11061
|
-
}
|
|
10676
|
+
return "";
|
|
11062
10677
|
}
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
10678
|
+
|
|
10679
|
+
// ../../internal/utils/src/vercel.ts
|
|
10680
|
+
var vercel_exports = {};
|
|
10681
|
+
__export(vercel_exports, {
|
|
10682
|
+
checkVercelEnv: () => checkVercelEnv
|
|
10683
|
+
});
|
|
10684
|
+
var checkVercelEnv = ({ envs }) => {
|
|
10685
|
+
var _a;
|
|
10686
|
+
const vercelEnv = (_a = process.env.VERCEL_ENV) != null ? _a : "development";
|
|
10687
|
+
if (!envs.includes(vercelEnv)) {
|
|
10688
|
+
return {
|
|
10689
|
+
ok: false,
|
|
10690
|
+
message: `Vercel environment is ${vercelEnv}, but expected ${envs.join(" or ")}`
|
|
10691
|
+
};
|
|
11066
10692
|
}
|
|
11067
|
-
return
|
|
10693
|
+
return { ok: true, message: "" };
|
|
11068
10694
|
};
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
10695
|
+
|
|
10696
|
+
// ../../internal/utils/src/delay.ts
|
|
10697
|
+
var delay_exports = {};
|
|
10698
|
+
__export(delay_exports, {
|
|
10699
|
+
delay: () => delay
|
|
10700
|
+
});
|
|
10701
|
+
var delay = (ms) => {
|
|
10702
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
10703
|
+
};
|
|
10704
|
+
|
|
10705
|
+
// ../../internal/utils/src/whois.ts
|
|
10706
|
+
var whois_exports = {};
|
|
10707
|
+
__export(whois_exports, {
|
|
10708
|
+
extractWhoisCountry: () => extractWhoisCountry,
|
|
10709
|
+
extractWhoisPayload: () => extractWhoisPayload,
|
|
10710
|
+
normalizeRegistrar: () => normalizeRegistrar
|
|
10711
|
+
});
|
|
10712
|
+
function extractWhoisPayload(raw) {
|
|
10713
|
+
var _a;
|
|
10714
|
+
const first = Array.isArray(raw) ? (_a = raw.find((entry) => entry !== null && typeof entry === "object")) != null ? _a : {} : raw;
|
|
10715
|
+
if (!first || typeof first !== "object") {
|
|
10716
|
+
return {};
|
|
11074
10717
|
}
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
if (!domain) {
|
|
11079
|
-
return [];
|
|
10718
|
+
const maybeData = first.data;
|
|
10719
|
+
if (maybeData && typeof maybeData === "object" && !Array.isArray(maybeData)) {
|
|
10720
|
+
return maybeData;
|
|
11080
10721
|
}
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
|
|
10722
|
+
return first;
|
|
10723
|
+
}
|
|
10724
|
+
var WHOIS_EMPTY_VALUES = /* @__PURE__ */ new Set(["", "none", "null"]);
|
|
10725
|
+
var WHOIS_COUNTRY_CODE_KEY_ALIASES = /* @__PURE__ */ new Set(["countrycode", "registrantcountrycode"]);
|
|
10726
|
+
var WHOIS_COUNTRY_KEY_ALIASES = /* @__PURE__ */ new Set([
|
|
10727
|
+
"country",
|
|
10728
|
+
"countryname",
|
|
10729
|
+
"registrantcountry",
|
|
10730
|
+
"registrantcountryname"
|
|
10731
|
+
]);
|
|
10732
|
+
function normalizeWhoisKey(key) {
|
|
10733
|
+
return key.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
10734
|
+
}
|
|
10735
|
+
function normalizeRegistrar(value) {
|
|
10736
|
+
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
10737
|
+
}
|
|
10738
|
+
function parseWhoisString(value) {
|
|
10739
|
+
if (typeof value !== "string") {
|
|
10740
|
+
return void 0;
|
|
11084
10741
|
}
|
|
11085
|
-
const
|
|
11086
|
-
if (
|
|
11087
|
-
return
|
|
10742
|
+
const trimmedValue = value.trim();
|
|
10743
|
+
if (WHOIS_EMPTY_VALUES.has(trimmedValue.toLowerCase())) {
|
|
10744
|
+
return void 0;
|
|
11088
10745
|
}
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
11092
|
-
|
|
11093
|
-
|
|
10746
|
+
return trimmedValue;
|
|
10747
|
+
}
|
|
10748
|
+
function extractWhoisFieldByAliases(payload, aliases) {
|
|
10749
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
10750
|
+
if (!aliases.has(normalizeWhoisKey(key))) {
|
|
10751
|
+
continue;
|
|
10752
|
+
}
|
|
10753
|
+
const parsedValue = parseWhoisString(value);
|
|
10754
|
+
if (parsedValue) {
|
|
10755
|
+
return parsedValue;
|
|
10756
|
+
}
|
|
11094
10757
|
}
|
|
11095
|
-
return
|
|
10758
|
+
return void 0;
|
|
11096
10759
|
}
|
|
11097
|
-
function
|
|
11098
|
-
|
|
11099
|
-
const
|
|
11100
|
-
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
);
|
|
11105
|
-
const trimmedSubdomains = subdomains.slice(Math.max(eTLDPlusOneIndex - (options.levels - 1), 0)).join(".");
|
|
11106
|
-
return trimmedSubdomains;
|
|
10760
|
+
function extractWhoisCountry(payload) {
|
|
10761
|
+
const countryCode = extractWhoisFieldByAliases(payload, WHOIS_COUNTRY_CODE_KEY_ALIASES);
|
|
10762
|
+
const country = extractWhoisFieldByAliases(payload, WHOIS_COUNTRY_KEY_ALIASES);
|
|
10763
|
+
return {
|
|
10764
|
+
countryCode: countryCode != null ? countryCode : void 0,
|
|
10765
|
+
country: country != null ? country : void 0
|
|
10766
|
+
};
|
|
11107
10767
|
}
|
|
11108
10768
|
|
|
11109
|
-
//
|
|
11110
|
-
var
|
|
11111
|
-
__export(
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
normalizePhoneNumber: () => normalizePhoneNumber
|
|
10769
|
+
// ../../internal/utils/src/safe-preview.ts
|
|
10770
|
+
var safe_preview_exports = {};
|
|
10771
|
+
__export(safe_preview_exports, {
|
|
10772
|
+
buildSafePreviewUrl: () => buildSafePreviewUrl,
|
|
10773
|
+
normalizeSafeNavigationTarget: () => normalizeSafeNavigationTarget
|
|
11115
10774
|
});
|
|
11116
|
-
var
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
s2 = s2.replace(/\uFF0B/g, "+");
|
|
11124
|
-
s2 = s2.replace(/\uFF08/g, "(");
|
|
11125
|
-
s2 = s2.replace(/\uFF09/g, ")");
|
|
11126
|
-
return s2.trim();
|
|
11127
|
-
}
|
|
11128
|
-
function isAllSameDigit(digits2) {
|
|
11129
|
-
return /^(\d)\1+$/.test(digits2);
|
|
11130
|
-
}
|
|
11131
|
-
function isStrictlyMonotonicStep1(digits2) {
|
|
11132
|
-
if (digits2.length < 8) {
|
|
11133
|
-
return false;
|
|
11134
|
-
}
|
|
11135
|
-
let increasing = true;
|
|
11136
|
-
let decreasing = true;
|
|
11137
|
-
for (let i = 1; i < digits2.length; i++) {
|
|
11138
|
-
const curr = digits2.charCodeAt(i) - 48;
|
|
11139
|
-
const prev = digits2.charCodeAt(i - 1) - 48;
|
|
11140
|
-
if (curr !== prev + 1) {
|
|
11141
|
-
increasing = false;
|
|
11142
|
-
}
|
|
11143
|
-
if (curr !== prev - 1) {
|
|
11144
|
-
decreasing = false;
|
|
11145
|
-
}
|
|
10775
|
+
var SAFE_NAVIGATION_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
10776
|
+
var PREVIEW_PATH = "/preview";
|
|
10777
|
+
var URL_BASE = "https://app.chainpatrol.io";
|
|
10778
|
+
function normalizeSafeNavigationTarget(target) {
|
|
10779
|
+
const normalizedTarget = getNormalizedUrl(target);
|
|
10780
|
+
if (!SAFE_NAVIGATION_PROTOCOLS.has(normalizedTarget.protocol)) {
|
|
10781
|
+
throw new Error(`Unsupported URL protocol: ${normalizedTarget.protocol}`);
|
|
11146
10782
|
}
|
|
11147
|
-
return
|
|
10783
|
+
return normalizedTarget;
|
|
11148
10784
|
}
|
|
11149
|
-
function
|
|
11150
|
-
|
|
11151
|
-
|
|
10785
|
+
function buildSafePreviewUrl({
|
|
10786
|
+
target,
|
|
10787
|
+
assetId,
|
|
10788
|
+
policy
|
|
10789
|
+
}) {
|
|
10790
|
+
const normalizedTarget = normalizeSafeNavigationTarget(target);
|
|
10791
|
+
const previewUrl = new URL(PREVIEW_PATH, URL_BASE);
|
|
10792
|
+
previewUrl.searchParams.set("target", normalizedTarget.toString());
|
|
10793
|
+
if (Number.isInteger(assetId) && assetId && assetId >= 1) {
|
|
10794
|
+
previewUrl.searchParams.set("asset_id", String(assetId));
|
|
11152
10795
|
}
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
if (npaFirst < 2 || npaFirst > 9) {
|
|
11156
|
-
return false;
|
|
10796
|
+
if (policy) {
|
|
10797
|
+
previewUrl.searchParams.set("policy", policy);
|
|
11157
10798
|
}
|
|
11158
|
-
|
|
11159
|
-
|
|
10799
|
+
return `${previewUrl.pathname}?${previewUrl.searchParams.toString()}`;
|
|
10800
|
+
}
|
|
10801
|
+
|
|
10802
|
+
// ../../internal/utils/src/parse.ts
|
|
10803
|
+
var parse_exports = {};
|
|
10804
|
+
__export(parse_exports, {
|
|
10805
|
+
parseTerms: () => parseTerms,
|
|
10806
|
+
stringifyTerms: () => stringifyTerms
|
|
10807
|
+
});
|
|
10808
|
+
function parseTerms(terms, {
|
|
10809
|
+
forceExact = false
|
|
10810
|
+
} = {}) {
|
|
10811
|
+
if (!terms) return [];
|
|
10812
|
+
return terms.split(",").map((term) => {
|
|
10813
|
+
const trimmed = term.trim();
|
|
10814
|
+
if (!trimmed) return null;
|
|
10815
|
+
const isWrappedExact = trimmed.startsWith("*") && trimmed.endsWith("*") && trimmed.length > 2;
|
|
10816
|
+
if (isWrappedExact) {
|
|
10817
|
+
return {
|
|
10818
|
+
value: trimmed.slice(1, -1).toLowerCase(),
|
|
10819
|
+
type: "exact"
|
|
10820
|
+
};
|
|
10821
|
+
} else {
|
|
10822
|
+
return {
|
|
10823
|
+
value: trimmed.toLowerCase(),
|
|
10824
|
+
type: forceExact ? "exact" : "loose"
|
|
10825
|
+
};
|
|
10826
|
+
}
|
|
10827
|
+
}).filter((term) => term !== null);
|
|
10828
|
+
}
|
|
10829
|
+
function stringifyTerms(parsedTerms) {
|
|
10830
|
+
return parsedTerms.map((term) => term.type === "exact" ? `*${term.value}*` : term.value).join(", ");
|
|
10831
|
+
}
|
|
10832
|
+
|
|
10833
|
+
// ../../internal/utils/src/brand-pattern.ts
|
|
10834
|
+
var brand_pattern_exports = {};
|
|
10835
|
+
__export(brand_pattern_exports, {
|
|
10836
|
+
anyPatternMatches: () => anyPatternMatches,
|
|
10837
|
+
compileBrandPattern: () => compileBrandPattern,
|
|
10838
|
+
countPatternMatches: () => countPatternMatches,
|
|
10839
|
+
findMatchingPatterns: () => findMatchingPatterns
|
|
10840
|
+
});
|
|
10841
|
+
var DEFAULT_MAX_MATCHES = 50;
|
|
10842
|
+
function compileBrandPattern(input) {
|
|
10843
|
+
var _a;
|
|
10844
|
+
try {
|
|
10845
|
+
return new RegExp(input.pattern, (_a = input.flags) != null ? _a : void 0);
|
|
10846
|
+
} catch (e4) {
|
|
10847
|
+
return null;
|
|
11160
10848
|
}
|
|
11161
|
-
return true;
|
|
11162
10849
|
}
|
|
11163
|
-
function
|
|
11164
|
-
const
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
if (isAllSameDigit(d) || isStrictlyMonotonicStep1(d)) {
|
|
11170
|
-
return false;
|
|
11171
|
-
}
|
|
11172
|
-
const onlyDigits = /^\d+$/.test(withoutExt);
|
|
11173
|
-
if (hasPlus) {
|
|
11174
|
-
if (d.length === 11 && d.startsWith("1")) {
|
|
11175
|
-
return isValidNanpNational10(d.slice(1));
|
|
11176
|
-
}
|
|
11177
|
-
return true;
|
|
11178
|
-
}
|
|
11179
|
-
if (onlyDigits) {
|
|
11180
|
-
if (d.length === 10) {
|
|
11181
|
-
return isValidNanpNational10(d);
|
|
11182
|
-
}
|
|
11183
|
-
if (d.length === 11 && d.startsWith("1")) {
|
|
11184
|
-
return isValidNanpNational10(d.slice(1));
|
|
11185
|
-
}
|
|
11186
|
-
if (d.length === 11 && d.startsWith("0")) {
|
|
10850
|
+
function anyPatternMatches(content, patterns, kind) {
|
|
10851
|
+
for (const input of patterns) {
|
|
10852
|
+
if (input.kind !== kind) continue;
|
|
10853
|
+
const regex = compileBrandPattern(input);
|
|
10854
|
+
if (!regex) continue;
|
|
10855
|
+
if (regex.test(content)) {
|
|
11187
10856
|
return true;
|
|
11188
10857
|
}
|
|
11189
|
-
return false;
|
|
11190
|
-
}
|
|
11191
|
-
if (d.length === 10) {
|
|
11192
|
-
return isValidNanpNational10(d);
|
|
11193
|
-
}
|
|
11194
|
-
if (d.length === 11 && d.startsWith("1")) {
|
|
11195
|
-
return isValidNanpNational10(d.slice(1));
|
|
11196
|
-
}
|
|
11197
|
-
if (d.length === 11 && d.startsWith("0")) {
|
|
11198
|
-
return true;
|
|
11199
|
-
}
|
|
11200
|
-
if (d.length >= 12 && d.length <= 15) {
|
|
11201
|
-
return true;
|
|
11202
10858
|
}
|
|
11203
10859
|
return false;
|
|
11204
10860
|
}
|
|
11205
|
-
function
|
|
11206
|
-
const
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
if (/[a-zA-Z]/.test(withoutExt)) {
|
|
11215
|
-
return false;
|
|
11216
|
-
}
|
|
11217
|
-
const hasPhoneMarker = /[+()\s-]/.test(trimmed);
|
|
11218
|
-
const isPureDotSeparated = /^\d+(\.\d+)+$/.test(trimmed);
|
|
11219
|
-
if (isPureDotSeparated && !hasPhoneMarker) {
|
|
11220
|
-
return false;
|
|
11221
|
-
}
|
|
11222
|
-
const phoneRegex = /^(?:\+?\d{1,4}[\s.-]?)?(?:\(\d{1,4}\)|\d{1,4})[\s.-]?\d{1,4}[\s.-]?\d{1,4}[\s.-]?\d{0,4}(?:\s*(?:ext|x|extension)[\s.]*\d{1,6})?$/i;
|
|
11223
|
-
if (!phoneRegex.test(trimmed)) {
|
|
11224
|
-
return false;
|
|
10861
|
+
function findMatchingPatterns(content, patterns, kind) {
|
|
10862
|
+
const matched = [];
|
|
10863
|
+
for (const input of patterns) {
|
|
10864
|
+
if (input.kind !== kind) continue;
|
|
10865
|
+
const regex = compileBrandPattern(input);
|
|
10866
|
+
if (!regex) continue;
|
|
10867
|
+
if (regex.test(content)) {
|
|
10868
|
+
matched.push(input);
|
|
10869
|
+
}
|
|
11225
10870
|
}
|
|
11226
|
-
return
|
|
10871
|
+
return matched;
|
|
11227
10872
|
}
|
|
11228
|
-
function
|
|
11229
|
-
const
|
|
11230
|
-
|
|
11231
|
-
const
|
|
11232
|
-
const
|
|
11233
|
-
|
|
10873
|
+
function countPatternMatches(content, pattern, maxMatches = DEFAULT_MAX_MATCHES) {
|
|
10874
|
+
const compiled = compileBrandPattern(pattern);
|
|
10875
|
+
if (!compiled) return 0;
|
|
10876
|
+
const flags = compiled.flags.includes("g") ? compiled.flags : `${compiled.flags}g`;
|
|
10877
|
+
const globalRegex = new RegExp(compiled.source, flags);
|
|
10878
|
+
let count = 0;
|
|
10879
|
+
let match2;
|
|
10880
|
+
while ((match2 = globalRegex.exec(content)) !== null) {
|
|
10881
|
+
count += 1;
|
|
10882
|
+
if (count >= maxMatches) break;
|
|
10883
|
+
if (match2[0].length === 0) globalRegex.lastIndex += 1;
|
|
10884
|
+
}
|
|
10885
|
+
return count;
|
|
11234
10886
|
}
|
|
11235
10887
|
|
|
11236
|
-
// ../../internal/utils/src/
|
|
11237
|
-
var
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
var
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
"
|
|
11251
|
-
"
|
|
10888
|
+
// ../../internal/utils/src/text.ts
|
|
10889
|
+
var text_exports = {};
|
|
10890
|
+
__export(text_exports, {
|
|
10891
|
+
HOMOGLYPH_MAPPINGS: () => HOMOGLYPH_MAPPINGS,
|
|
10892
|
+
LETTER_TO_HOMOGLYPH_MAPPINGS: () => LETTER_TO_HOMOGLYPH_MAPPINGS,
|
|
10893
|
+
generateHomoglyphSearchTerms: () => generateHomoglyphSearchTerms,
|
|
10894
|
+
normalizeHomoglyphs: () => normalizeHomoglyphs
|
|
10895
|
+
});
|
|
10896
|
+
var HOMOGLYPH_MAPPINGS = {
|
|
10897
|
+
"0": "o",
|
|
10898
|
+
"1": "i",
|
|
10899
|
+
"3": "e",
|
|
10900
|
+
"4": "a",
|
|
10901
|
+
"5": "s",
|
|
10902
|
+
"7": "t",
|
|
10903
|
+
"8": "b"
|
|
11252
10904
|
};
|
|
11253
|
-
var
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
10905
|
+
var LETTER_TO_HOMOGLYPH_MAPPINGS = {
|
|
10906
|
+
a: ["4", "\u0430"],
|
|
10907
|
+
b: ["8", "6"],
|
|
10908
|
+
c: ["\u0441"],
|
|
10909
|
+
e: ["3", "\u0435"],
|
|
10910
|
+
g: ["9"],
|
|
10911
|
+
i: ["1", "l", "\u0456"],
|
|
10912
|
+
l: ["1"],
|
|
10913
|
+
o: ["0", "\u043E"],
|
|
10914
|
+
s: ["5", "\u0455"],
|
|
10915
|
+
t: ["7"],
|
|
10916
|
+
x: ["\u0445"],
|
|
10917
|
+
z: ["2"]
|
|
10918
|
+
};
|
|
10919
|
+
var DEFAULT_MAX_HOMOGLYPH_VARIANTS = 20;
|
|
10920
|
+
function isCyrillic(char) {
|
|
10921
|
+
return char.charCodeAt(0) > 127;
|
|
11257
10922
|
}
|
|
11258
|
-
function
|
|
11259
|
-
const
|
|
11260
|
-
let
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
10923
|
+
function buildReplacementOps(term) {
|
|
10924
|
+
const ops = [];
|
|
10925
|
+
for (let i = 0; i < term.length; i++) {
|
|
10926
|
+
const homoglyphs = LETTER_TO_HOMOGLYPH_MAPPINGS[term[i]];
|
|
10927
|
+
if (!homoglyphs) continue;
|
|
10928
|
+
for (const replacement of homoglyphs) {
|
|
10929
|
+
ops.push({ index: i, replacement });
|
|
10930
|
+
}
|
|
11264
10931
|
}
|
|
11265
|
-
|
|
11266
|
-
const labels = domain.split(".");
|
|
11267
|
-
const encoded = labels.map(callback).join(".");
|
|
11268
|
-
return result + encoded;
|
|
10932
|
+
return ops;
|
|
11269
10933
|
}
|
|
11270
|
-
function
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
if (codePoint >= 65 && codePoint < 91) {
|
|
11275
|
-
return codePoint - 65;
|
|
11276
|
-
}
|
|
11277
|
-
if (codePoint >= 97 && codePoint < 123) {
|
|
11278
|
-
return codePoint - 97;
|
|
10934
|
+
function applyOps(term, ops, selected) {
|
|
10935
|
+
const chars = Array.from(term);
|
|
10936
|
+
for (const idx of selected) {
|
|
10937
|
+
chars[ops[idx].index] = ops[idx].replacement;
|
|
11279
10938
|
}
|
|
11280
|
-
return
|
|
10939
|
+
return chars.join("");
|
|
11281
10940
|
}
|
|
11282
|
-
function
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
10941
|
+
function generateCombinations(ops, opIndices, term, maxVariants, addFn, variants) {
|
|
10942
|
+
const generate = (startIdx, depth, selected, usedPositions) => {
|
|
10943
|
+
if (selected.length === depth) return addFn(applyOps(term, ops, selected));
|
|
10944
|
+
for (let i = startIdx; i < opIndices.length && variants.length < maxVariants; i++) {
|
|
10945
|
+
const opIdx = opIndices[i];
|
|
10946
|
+
if (usedPositions.has(ops[opIdx].index)) continue;
|
|
10947
|
+
selected.push(opIdx);
|
|
10948
|
+
usedPositions.add(ops[opIdx].index);
|
|
10949
|
+
if (generate(i + 1, depth, selected, usedPositions)) return true;
|
|
10950
|
+
selected.pop();
|
|
10951
|
+
usedPositions.delete(ops[opIdx].index);
|
|
10952
|
+
}
|
|
10953
|
+
return false;
|
|
10954
|
+
};
|
|
10955
|
+
for (let depth = 2; depth <= opIndices.length && variants.length < maxVariants; depth++) {
|
|
10956
|
+
if (generate(0, depth, [], /* @__PURE__ */ new Set())) break;
|
|
11293
10957
|
}
|
|
11294
|
-
return floor(k4 + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
11295
10958
|
}
|
|
11296
|
-
function
|
|
11297
|
-
|
|
11298
|
-
const
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
10959
|
+
function generateHomoglyphSearchTerms(term, maxVariants = DEFAULT_MAX_HOMOGLYPH_VARIANTS) {
|
|
10960
|
+
if (term.length === 0 || maxVariants <= 0) return [];
|
|
10961
|
+
const lowerTerm = term.toLowerCase();
|
|
10962
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10963
|
+
const variants = [];
|
|
10964
|
+
const add = (v) => {
|
|
10965
|
+
if (v === lowerTerm || seen.has(v)) return false;
|
|
10966
|
+
seen.add(v);
|
|
10967
|
+
variants.push(v);
|
|
10968
|
+
return variants.length >= maxVariants;
|
|
10969
|
+
};
|
|
10970
|
+
const allOps = buildReplacementOps(lowerTerm);
|
|
10971
|
+
for (let i = 0; i < allOps.length && variants.length < maxVariants; i++) {
|
|
10972
|
+
add(applyOps(lowerTerm, allOps, [i]));
|
|
11305
10973
|
}
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
10974
|
+
if (variants.length < maxVariants) {
|
|
10975
|
+
const cyrillicComposite = lowerTerm.split("").map((char) => {
|
|
10976
|
+
var _a;
|
|
10977
|
+
const homoglyphs = LETTER_TO_HOMOGLYPH_MAPPINGS[char];
|
|
10978
|
+
return (_a = homoglyphs == null ? void 0 : homoglyphs.find((h) => isCyrillic(h))) != null ? _a : char;
|
|
10979
|
+
}).join("");
|
|
10980
|
+
add(cyrillicComposite);
|
|
10981
|
+
}
|
|
10982
|
+
const cyrillicOpIndices = allOps.map((op, i) => isCyrillic(op.replacement) ? i : -1).filter((i) => i >= 0);
|
|
10983
|
+
if (variants.length < maxVariants && cyrillicOpIndices.length >= 2) {
|
|
10984
|
+
generateCombinations(
|
|
10985
|
+
allOps,
|
|
10986
|
+
cyrillicOpIndices,
|
|
10987
|
+
lowerTerm,
|
|
10988
|
+
maxVariants,
|
|
10989
|
+
add,
|
|
10990
|
+
variants
|
|
10991
|
+
);
|
|
11311
10992
|
}
|
|
11312
|
-
|
|
11313
|
-
const
|
|
11314
|
-
|
|
11315
|
-
if (index >= inputLength) {
|
|
11316
|
-
error("invalid-input");
|
|
11317
|
-
}
|
|
11318
|
-
const digit = basicToDigit(input.charCodeAt(index++));
|
|
11319
|
-
if (digit >= base) {
|
|
11320
|
-
error("invalid-input");
|
|
11321
|
-
}
|
|
11322
|
-
if (digit > floor((maxInt - i) / w)) {
|
|
11323
|
-
error("overflow");
|
|
11324
|
-
}
|
|
11325
|
-
i += digit * w;
|
|
11326
|
-
const t = k4 <= bias2 ? tMin : k4 >= bias2 + tMax ? tMax : k4 - bias2;
|
|
11327
|
-
if (digit < t) {
|
|
11328
|
-
break;
|
|
11329
|
-
}
|
|
11330
|
-
const baseMinusT = base - t;
|
|
11331
|
-
if (w > floor(maxInt / baseMinusT)) {
|
|
11332
|
-
error("overflow");
|
|
11333
|
-
}
|
|
11334
|
-
w *= baseMinusT;
|
|
11335
|
-
}
|
|
11336
|
-
const out = output.length + 1;
|
|
11337
|
-
bias2 = adapt(i - oldi, out, oldi == 0);
|
|
11338
|
-
if (floor(i / out) > maxInt - n2) {
|
|
11339
|
-
error("overflow");
|
|
11340
|
-
}
|
|
11341
|
-
n2 += floor(i / out);
|
|
11342
|
-
i %= out;
|
|
11343
|
-
output.splice(i++, 0, n2);
|
|
10993
|
+
if (variants.length < maxVariants) {
|
|
10994
|
+
const allOpIndices = allOps.map((_, i) => i);
|
|
10995
|
+
generateCombinations(allOps, allOpIndices, lowerTerm, maxVariants, add, variants);
|
|
11344
10996
|
}
|
|
11345
|
-
return
|
|
10997
|
+
return variants;
|
|
11346
10998
|
}
|
|
11347
|
-
function
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
});
|
|
10999
|
+
function normalizeHomoglyphs(text, customMappings = {}) {
|
|
11000
|
+
const mappings = __spreadValues(__spreadValues({}, HOMOGLYPH_MAPPINGS), customMappings);
|
|
11001
|
+
return text.toLowerCase().split("").map((char) => mappings[char] || char).join("");
|
|
11351
11002
|
}
|
|
11352
11003
|
|
|
11353
|
-
// ../../internal/utils/src/
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11004
|
+
// ../../internal/utils/src/format.ts
|
|
11005
|
+
var format_exports = {};
|
|
11006
|
+
__export(format_exports, {
|
|
11007
|
+
formatCompactNumber: () => formatCompactNumber,
|
|
11008
|
+
formatFileSize: () => formatFileSize
|
|
11009
|
+
});
|
|
11010
|
+
function formatCompactNumber(num3, options = {}) {
|
|
11011
|
+
const { decimals = 1, fallback = "-" } = options;
|
|
11012
|
+
if (num3 === void 0 || num3 === null) {
|
|
11013
|
+
return fallback;
|
|
11357
11014
|
}
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
}
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
}
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
return
|
|
11015
|
+
if (num3 >= 1e9) {
|
|
11016
|
+
return `${(num3 / 1e9).toFixed(decimals)}B`;
|
|
11017
|
+
}
|
|
11018
|
+
if (num3 >= 1e6) {
|
|
11019
|
+
return `${(num3 / 1e6).toFixed(decimals)}M`;
|
|
11020
|
+
}
|
|
11021
|
+
if (num3 >= 1e3) {
|
|
11022
|
+
return `${(num3 / 1e3).toFixed(decimals)}K`;
|
|
11023
|
+
}
|
|
11024
|
+
return num3.toString();
|
|
11368
11025
|
}
|
|
11369
|
-
function
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
return
|
|
11026
|
+
function formatFileSize(bytes, options = {}) {
|
|
11027
|
+
const { decimals = 1, binary = true, showUnknown = true } = options;
|
|
11028
|
+
if (bytes === null || bytes === void 0 || bytes === "") {
|
|
11029
|
+
return showUnknown ? "Unknown" : "0 B";
|
|
11373
11030
|
}
|
|
11374
|
-
|
|
11031
|
+
const size = typeof bytes === "string" ? parseInt(bytes, 10) : bytes;
|
|
11032
|
+
if (isNaN(size) || size < 0) {
|
|
11033
|
+
return showUnknown ? "Unknown" : "0 B";
|
|
11034
|
+
}
|
|
11035
|
+
if (size === 0) {
|
|
11036
|
+
return "0 B";
|
|
11037
|
+
}
|
|
11038
|
+
const unit = binary ? 1024 : 1e3;
|
|
11039
|
+
const units = binary ? ["B", "KB", "MB", "GB", "TB", "PB"] : ["B", "kB", "MB", "GB", "TB", "PB"];
|
|
11040
|
+
const unitIndex = Math.floor(Math.log(size) / Math.log(unit));
|
|
11041
|
+
const finalUnitIndex = Math.min(unitIndex, units.length - 1);
|
|
11042
|
+
const value = size / Math.pow(unit, finalUnitIndex);
|
|
11043
|
+
if (finalUnitIndex === 0) {
|
|
11044
|
+
return `${size} B`;
|
|
11045
|
+
}
|
|
11046
|
+
return `${value.toFixed(decimals)} ${units[finalUnitIndex]}`;
|
|
11375
11047
|
}
|
|
11376
|
-
|
|
11377
|
-
|
|
11048
|
+
|
|
11049
|
+
// ../../internal/utils/src/social-profile-url.ts
|
|
11050
|
+
var social_profile_url_exports = {};
|
|
11051
|
+
__export(social_profile_url_exports, {
|
|
11052
|
+
LINKEDIN_PROFILE_URL_PATTERN: () => LINKEDIN_PROFILE_URL_PATTERN,
|
|
11053
|
+
TWITTER_PROFILE_URL_PATTERN: () => TWITTER_PROFILE_URL_PATTERN,
|
|
11054
|
+
isLinkedInProfileUrl: () => isLinkedInProfileUrl,
|
|
11055
|
+
isSupportedSocialProfileUrl: () => isSupportedSocialProfileUrl,
|
|
11056
|
+
isTwitterProfileUrl: () => isTwitterProfileUrl,
|
|
11057
|
+
parseLinkedInProfileUrl: () => parseLinkedInProfileUrl
|
|
11058
|
+
});
|
|
11059
|
+
var TWITTER_PROFILE_URL_PATTERN = /^https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/[^/?#]+\/?(?:[?#].*)?$/i;
|
|
11060
|
+
var LINKEDIN_PROFILE_URL_PATTERN = /^https?:\/\/(?:[a-z]{2,3}\.)?linkedin\.com\/(in|company|school)\/([^/?#]+)/i;
|
|
11061
|
+
function isTwitterProfileUrl(url) {
|
|
11062
|
+
return TWITTER_PROFILE_URL_PATTERN.test(url);
|
|
11378
11063
|
}
|
|
11379
|
-
function
|
|
11380
|
-
return
|
|
11064
|
+
function isLinkedInProfileUrl(url) {
|
|
11065
|
+
return LINKEDIN_PROFILE_URL_PATTERN.test(url);
|
|
11381
11066
|
}
|
|
11382
|
-
function
|
|
11383
|
-
return
|
|
11067
|
+
function isSupportedSocialProfileUrl(url) {
|
|
11068
|
+
return isTwitterProfileUrl(url) || isLinkedInProfileUrl(url);
|
|
11384
11069
|
}
|
|
11385
|
-
function
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
httpUrl.protocol = "http:";
|
|
11389
|
-
return httpUrl.toString();
|
|
11390
|
-
}
|
|
11391
|
-
throw new Error(`URL is not HTTPS: ${url}`);
|
|
11070
|
+
function humanizeLinkedInHandle(handle) {
|
|
11071
|
+
const withoutTrailingDigits = handle.replace(/-[0-9a-f]{6,}$/i, "");
|
|
11072
|
+
return withoutTrailingDigits.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
11392
11073
|
}
|
|
11393
|
-
function
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11074
|
+
function parseLinkedInProfileUrl(url) {
|
|
11075
|
+
var _a;
|
|
11076
|
+
const match2 = url.match(LINKEDIN_PROFILE_URL_PATTERN);
|
|
11077
|
+
if (!match2) return null;
|
|
11078
|
+
const pathSegment = (_a = match2[1]) == null ? void 0 : _a.toLowerCase();
|
|
11079
|
+
const rawHandle = match2[2];
|
|
11080
|
+
if (!pathSegment || !rawHandle) return null;
|
|
11081
|
+
let handle;
|
|
11082
|
+
try {
|
|
11083
|
+
handle = decodeURIComponent(rawHandle).trim();
|
|
11084
|
+
} catch (e4) {
|
|
11085
|
+
return null;
|
|
11399
11086
|
}
|
|
11400
|
-
if (
|
|
11401
|
-
|
|
11087
|
+
if (!handle) return null;
|
|
11088
|
+
const name = humanizeLinkedInHandle(handle) || handle;
|
|
11089
|
+
const profileUrl = `https://www.linkedin.com/${pathSegment}/${handle}`;
|
|
11090
|
+
return { pathSegment, handle, name, profileUrl };
|
|
11091
|
+
}
|
|
11092
|
+
|
|
11093
|
+
// ../../internal/validation/src/public/detection/configs-create.ts
|
|
11094
|
+
zod.z.object({
|
|
11095
|
+
slug: zod.z.string().min(1).optional().describe(
|
|
11096
|
+
"Organization slug. Defaults to the organization your API key is scoped to, so you only need this when authenticating with a key that spans organizations."
|
|
11097
|
+
),
|
|
11098
|
+
source: zod.z.nativeEnum(ThreatDetectionSourceKey).describe(
|
|
11099
|
+
"Detection source key, from `GET /detection/sources`. The source must support the `organization` scope; global-only sources cannot be configured per organization."
|
|
11100
|
+
),
|
|
11101
|
+
status: zod.z.nativeEnum(ThreatDetectionConfigStatus).default(ThreatDetectionConfigStatus.ENABLED).describe("Status to create the config with. Defaults to `ENABLED`."),
|
|
11102
|
+
title: zod.z.string().trim().optional().describe("Optional label for this config"),
|
|
11103
|
+
description: zod.z.string().trim().nullable().optional().describe("Optional human-readable description of what the config does"),
|
|
11104
|
+
cron: zod.z.string().trim().nullable().optional().describe(
|
|
11105
|
+
"Optional custom CRON schedule. Only accepted for sources that run on a schedule; the source's default schedule is used when omitted."
|
|
11106
|
+
),
|
|
11107
|
+
config: zod.z.record(zod.z.unknown()).optional().describe(
|
|
11108
|
+
"Source-specific configuration, validated against that source's `configSchema` from `GET /detection/sources`. When omitted the source's schema defaults are applied."
|
|
11109
|
+
),
|
|
11110
|
+
brandId: zod.z.number().int().positive().nullable().optional().describe(
|
|
11111
|
+
"Optional brand to scope this config to. The brand must belong to the same organization. Omit for an organization-wide config."
|
|
11112
|
+
)
|
|
11113
|
+
}).describe(
|
|
11114
|
+
`Create a threat detection config
|
|
11115
|
+
|
|
11116
|
+
Creates the config row that makes a detection source run for your organization. Sources that are disabled by default have no config row, so they cannot be enabled through \`/detection/configs/update\` until one exists.
|
|
11117
|
+
|
|
11118
|
+
A source can have several configs, each scanning with its own query, schedule or brand. Use \`title\` to tell them apart.`
|
|
11119
|
+
);
|
|
11120
|
+
zod.z.object({
|
|
11121
|
+
config: zod.z.object({
|
|
11122
|
+
id: zod.z.number(),
|
|
11123
|
+
source: zod.z.string(),
|
|
11124
|
+
status: zod.z.nativeEnum(ThreatDetectionConfigStatus),
|
|
11125
|
+
title: zod.z.string(),
|
|
11126
|
+
description: zod.z.string().nullable(),
|
|
11127
|
+
cron: zod.z.string().nullable(),
|
|
11128
|
+
config: zod.z.record(zod.z.unknown()),
|
|
11129
|
+
updatedAt: zod.z.date(),
|
|
11130
|
+
brandId: zod.z.number().nullable()
|
|
11131
|
+
})
|
|
11132
|
+
}).describe("Created detection config");
|
|
11133
|
+
zod.z.object({
|
|
11134
|
+
slug: zod.z.string().min(1).optional().describe(
|
|
11135
|
+
"Organization slug. Defaults to the organization your API key is scoped to, so you only need this when authenticating with a key that spans organizations."
|
|
11136
|
+
),
|
|
11137
|
+
configId: zod.z.number().int().positive().describe("ID of the config to delete, from `/detection/configs/list`")
|
|
11138
|
+
}).describe(
|
|
11139
|
+
`Delete a threat detection config
|
|
11140
|
+
|
|
11141
|
+
Deletes one detection config so it stops scanning. Deleting a config that shares a source with others leaves the others running.
|
|
11142
|
+
|
|
11143
|
+
Deleting the *last* config for a source that is enabled by default for your organization is not permanent: automation re-creates a default config for that source on its next run. To stop such a source durably, set \`status\` to \`DISABLED\` through \`/detection/configs/update\` instead, which automation will not override.`
|
|
11144
|
+
);
|
|
11145
|
+
zod.z.object({
|
|
11146
|
+
success: zod.z.boolean(),
|
|
11147
|
+
id: zod.z.number().describe("ID of the deleted config")
|
|
11148
|
+
}).describe("Deleted detection config");
|
|
11149
|
+
zod.z.object({
|
|
11150
|
+
slug: zod.z.string().min(1),
|
|
11151
|
+
configId: zod.z.number().int().positive(),
|
|
11152
|
+
status: zod.z.nativeEnum(ThreatDetectionConfigStatus).optional(),
|
|
11153
|
+
title: zod.z.string().trim().optional(),
|
|
11154
|
+
description: zod.z.string().trim().nullable().optional(),
|
|
11155
|
+
cron: zod.z.string().trim().nullable().optional(),
|
|
11156
|
+
config: zod.z.record(zod.z.unknown()).optional(),
|
|
11157
|
+
mergeConfig: zod.z.boolean().default(false),
|
|
11158
|
+
brandId: zod.z.number().int().positive().nullable().optional().describe(
|
|
11159
|
+
"Optional brand connection for this detection config. Pass null to clear the link. Only valid for org-scoped configs; the brand must belong to the same organization."
|
|
11160
|
+
)
|
|
11161
|
+
});
|
|
11162
|
+
zod.z.object({
|
|
11163
|
+
config: zod.z.object({
|
|
11164
|
+
id: zod.z.number(),
|
|
11165
|
+
source: zod.z.string(),
|
|
11166
|
+
status: zod.z.nativeEnum(ThreatDetectionConfigStatus),
|
|
11167
|
+
title: zod.z.string(),
|
|
11168
|
+
description: zod.z.string().nullable(),
|
|
11169
|
+
cron: zod.z.string().nullable(),
|
|
11170
|
+
config: zod.z.record(zod.z.unknown()),
|
|
11171
|
+
updatedAt: zod.z.date(),
|
|
11172
|
+
brandId: zod.z.number().nullable()
|
|
11173
|
+
})
|
|
11174
|
+
});
|
|
11175
|
+
zod.z.object({
|
|
11176
|
+
slug: zod.z.string().min(1),
|
|
11177
|
+
source: zod.z.string().optional(),
|
|
11178
|
+
minResults: zod.z.number().int().min(0).default(1),
|
|
11179
|
+
lookbackHours: zod.z.number().int().min(1).default(24 * 7),
|
|
11180
|
+
runBeforeValidate: zod.z.boolean().default(false),
|
|
11181
|
+
includeDisabled: zod.z.boolean().default(false)
|
|
11182
|
+
});
|
|
11183
|
+
zod.z.object({
|
|
11184
|
+
ok: zod.z.boolean(),
|
|
11185
|
+
summary: zod.z.object({
|
|
11186
|
+
checkedConfigs: zod.z.number(),
|
|
11187
|
+
passingConfigs: zod.z.number(),
|
|
11188
|
+
failingConfigs: zod.z.number(),
|
|
11189
|
+
lookbackHours: zod.z.number(),
|
|
11190
|
+
minResults: zod.z.number()
|
|
11191
|
+
}),
|
|
11192
|
+
validations: zod.z.array(
|
|
11193
|
+
zod.z.object({
|
|
11194
|
+
configId: zod.z.number(),
|
|
11195
|
+
source: zod.z.string(),
|
|
11196
|
+
status: zod.z.nativeEnum(ThreatDetectionConfigStatus),
|
|
11197
|
+
ran: zod.z.boolean(),
|
|
11198
|
+
runOk: zod.z.boolean(),
|
|
11199
|
+
runMessage: zod.z.string().nullable(),
|
|
11200
|
+
recentResultCount: zod.z.number(),
|
|
11201
|
+
valid: zod.z.boolean()
|
|
11202
|
+
})
|
|
11203
|
+
)
|
|
11204
|
+
});
|
|
11205
|
+
zod.z.object({
|
|
11206
|
+
slug: zod.z.string().min(1),
|
|
11207
|
+
configId: zod.z.number().int().positive().optional(),
|
|
11208
|
+
source: zod.z.string().min(1).optional(),
|
|
11209
|
+
includeDisabled: zod.z.boolean().default(false)
|
|
11210
|
+
});
|
|
11211
|
+
zod.z.object({
|
|
11212
|
+
ranCount: zod.z.number(),
|
|
11213
|
+
successCount: zod.z.number(),
|
|
11214
|
+
failedCount: zod.z.number(),
|
|
11215
|
+
results: zod.z.array(
|
|
11216
|
+
zod.z.object({
|
|
11217
|
+
configId: zod.z.number(),
|
|
11218
|
+
source: zod.z.string(),
|
|
11219
|
+
ok: zod.z.boolean(),
|
|
11220
|
+
message: zod.z.string().nullable(),
|
|
11221
|
+
assetsCount: zod.z.number()
|
|
11222
|
+
})
|
|
11223
|
+
)
|
|
11224
|
+
});
|
|
11225
|
+
zod.z.object({
|
|
11226
|
+
slug: zod.z.string().min(1).optional().describe(
|
|
11227
|
+
"Organization slug. Defaults to the organization your API key is scoped to, so you only need this when authenticating with a key that spans organizations. Sources that do not apply to the organization's industry are omitted."
|
|
11228
|
+
)
|
|
11229
|
+
}).describe(
|
|
11230
|
+
`List available threat detection sources
|
|
11231
|
+
|
|
11232
|
+
Returns the catalog of detection sources ChainPatrol can run, including the scopes each source supports and the JSON Schema its \`config\` object must satisfy. Use this to discover valid \`source\` keys before creating or updating a detection config.`
|
|
11233
|
+
);
|
|
11234
|
+
var detectionSourceSchema = zod.z.object({
|
|
11235
|
+
key: zod.z.string().describe("Detection source key (e.g. google_search, certstream, dns_twist)"),
|
|
11236
|
+
label: zod.z.string().describe("Human-readable source name"),
|
|
11237
|
+
description: zod.z.string().describe("What this source detects"),
|
|
11238
|
+
scopes: zod.z.array(zod.z.nativeEnum(ThreatDetectionScope)).describe(
|
|
11239
|
+
"Scopes this source supports. A source without `organization` cannot be configured per-org and runs globally for all organizations."
|
|
11240
|
+
),
|
|
11241
|
+
isPullBased: zod.z.boolean().describe(
|
|
11242
|
+
"Whether the source runs on a schedule (pull-based). Push-based sources such as webhooks ignore `cron` and cannot be run on demand."
|
|
11243
|
+
),
|
|
11244
|
+
brandScope: zod.z.enum(["organization_only", "all_brands"]).describe(
|
|
11245
|
+
"Which brands this source fans out to. `organization_only` sources only use brands of type `ORGANIZATION`; `all_brands` sources use every brand in the organization."
|
|
11246
|
+
),
|
|
11247
|
+
industries: zod.z.array(zod.z.string()).describe(
|
|
11248
|
+
"Industries this source applies to. Empty means it applies to every industry."
|
|
11249
|
+
),
|
|
11250
|
+
protectedAssetTypes: zod.z.array(zod.z.string()).describe(
|
|
11251
|
+
"Asset types this source monitors. Empty when the source does not key off protected assets."
|
|
11252
|
+
),
|
|
11253
|
+
configSchema: zod.z.record(zod.z.unknown()).nullable().describe(
|
|
11254
|
+
"JSON Schema for this source's `config` object, for use with `/detection/configs/update`. `null` when the source takes no configuration."
|
|
11255
|
+
)
|
|
11256
|
+
});
|
|
11257
|
+
zod.z.object({
|
|
11258
|
+
sources: zod.z.array(detectionSourceSchema).describe("Available detection sources")
|
|
11259
|
+
}).describe("Successful operation");
|
|
11260
|
+
var DetectionDriftThresholdsSchema = zod.z.object({
|
|
11261
|
+
zeroResultsMaxHours: zod.z.number().int().positive().default(72),
|
|
11262
|
+
noisyResultsPerDay: zod.z.number().positive().default(100),
|
|
11263
|
+
noisyAllowedRatioThreshold: zod.z.number().min(0).max(1).default(0.6),
|
|
11264
|
+
staleConfigDays: zod.z.number().int().positive().default(30)
|
|
11265
|
+
});
|
|
11266
|
+
zod.z.object({
|
|
11267
|
+
slug: zod.z.string().min(1),
|
|
11268
|
+
lookbackHours: zod.z.number().int().positive().default(168),
|
|
11269
|
+
startDate: zod.z.date().optional(),
|
|
11270
|
+
endDate: zod.z.date().optional(),
|
|
11271
|
+
source: zod.z.string().min(1).optional(),
|
|
11272
|
+
configIds: zod.z.array(zod.z.number().int().positive()).optional(),
|
|
11273
|
+
includeDisabled: zod.z.boolean().default(false),
|
|
11274
|
+
thresholds: DetectionDriftThresholdsSchema.optional()
|
|
11275
|
+
}).refine(
|
|
11276
|
+
(value) => !value.startDate && !value.endDate || Boolean(value.startDate) && Boolean(value.endDate),
|
|
11277
|
+
{
|
|
11278
|
+
message: "Provide both startDate and endDate when using explicit date range",
|
|
11279
|
+
path: ["startDate"]
|
|
11402
11280
|
}
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11281
|
+
);
|
|
11282
|
+
var DetectionDriftSignalSchema = zod.z.object({
|
|
11283
|
+
signal: zod.z.enum(["zero_results_too_long", "noisy_source", "stale_query"]),
|
|
11284
|
+
configId: zod.z.number().int().positive(),
|
|
11285
|
+
source: zod.z.string(),
|
|
11286
|
+
title: zod.z.string().nullable(),
|
|
11287
|
+
status: zod.z.string(),
|
|
11288
|
+
severity: zod.z.enum(["low", "medium", "high"]),
|
|
11289
|
+
details: zod.z.record(zod.z.unknown())
|
|
11290
|
+
});
|
|
11291
|
+
zod.z.object({
|
|
11292
|
+
ok: zod.z.boolean(),
|
|
11293
|
+
range: zod.z.object({
|
|
11294
|
+
startDate: zod.z.date(),
|
|
11295
|
+
endDate: zod.z.date(),
|
|
11296
|
+
lookbackHours: zod.z.number().int().positive()
|
|
11297
|
+
}),
|
|
11298
|
+
thresholds: DetectionDriftThresholdsSchema,
|
|
11299
|
+
summary: zod.z.object({
|
|
11300
|
+
checkedConfigs: zod.z.number().int().nonnegative(),
|
|
11301
|
+
signalCount: zod.z.number().int().nonnegative(),
|
|
11302
|
+
zeroResultsCount: zod.z.number().int().nonnegative(),
|
|
11303
|
+
noisyCount: zod.z.number().int().nonnegative(),
|
|
11304
|
+
staleCount: zod.z.number().int().nonnegative()
|
|
11305
|
+
}),
|
|
11306
|
+
signals: zod.z.array(DetectionDriftSignalSchema)
|
|
11307
|
+
});
|
|
11308
|
+
var BucketsSchema = zod.z.object({
|
|
11309
|
+
lt24h: zod.z.number().int().nonnegative(),
|
|
11310
|
+
h24to72: zod.z.number().int().nonnegative(),
|
|
11311
|
+
h72to168: zod.z.number().int().nonnegative(),
|
|
11312
|
+
gte168h: zod.z.number().int().nonnegative()
|
|
11313
|
+
});
|
|
11314
|
+
zod.z.object({
|
|
11315
|
+
slug: zod.z.string().min(1).optional(),
|
|
11316
|
+
all: zod.z.boolean().default(false),
|
|
11317
|
+
windowHours: zod.z.number().int().positive().default(168)
|
|
11318
|
+
});
|
|
11319
|
+
zod.z.object({
|
|
11320
|
+
generatedAt: zod.z.date(),
|
|
11321
|
+
scope: zod.z.object({
|
|
11322
|
+
slug: zod.z.string().nullable(),
|
|
11323
|
+
all: zod.z.boolean()
|
|
11324
|
+
}),
|
|
11325
|
+
reviewQueue: zod.z.object({
|
|
11326
|
+
totalPendingProposals: zod.z.number().int().nonnegative(),
|
|
11327
|
+
distinctReports: zod.z.number().int().nonnegative(),
|
|
11328
|
+
ageBuckets: BucketsSchema,
|
|
11329
|
+
slaBuckets: zod.z.object({
|
|
11330
|
+
breached: zod.z.number().int().nonnegative(),
|
|
11331
|
+
dueWithin24h: zod.z.number().int().nonnegative(),
|
|
11332
|
+
dueWithin72h: zod.z.number().int().nonnegative(),
|
|
11333
|
+
beyond72h: zod.z.number().int().nonnegative(),
|
|
11334
|
+
missingSla: zod.z.number().int().nonnegative()
|
|
11335
|
+
}),
|
|
11336
|
+
byOrg: zod.z.array(
|
|
11337
|
+
zod.z.object({
|
|
11338
|
+
slug: zod.z.string(),
|
|
11339
|
+
pendingProposals: zod.z.number().int().nonnegative()
|
|
11340
|
+
})
|
|
11341
|
+
)
|
|
11342
|
+
}),
|
|
11343
|
+
takedownQueue: zod.z.object({
|
|
11344
|
+
totalOpen: zod.z.number().int().nonnegative(),
|
|
11345
|
+
statusCounts: zod.z.object({
|
|
11346
|
+
todo: zod.z.number().int().nonnegative(),
|
|
11347
|
+
inProgress: zod.z.number().int().nonnegative(),
|
|
11348
|
+
pendingInput: zod.z.number().int().nonnegative()
|
|
11349
|
+
}),
|
|
11350
|
+
ageBuckets: BucketsSchema,
|
|
11351
|
+
staleInProgress: zod.z.number().int().nonnegative(),
|
|
11352
|
+
byOrg: zod.z.array(
|
|
11353
|
+
zod.z.object({
|
|
11354
|
+
slug: zod.z.string(),
|
|
11355
|
+
openTakedowns: zod.z.number().int().nonnegative()
|
|
11356
|
+
})
|
|
11357
|
+
)
|
|
11358
|
+
})
|
|
11359
|
+
});
|
|
11360
|
+
var HealthcheckCategorySchema = zod.z.enum([
|
|
11361
|
+
"detection",
|
|
11362
|
+
"reviewing",
|
|
11363
|
+
"blocklisting",
|
|
11364
|
+
"takedowns",
|
|
11365
|
+
"assets",
|
|
11366
|
+
"organization"
|
|
11367
|
+
]);
|
|
11368
|
+
var HealthcheckSeveritySchema = zod.z.enum(["ok", "warn", "fail"]);
|
|
11369
|
+
var HealthcheckFindingSchema = zod.z.object({
|
|
11370
|
+
kind: zod.z.string(),
|
|
11371
|
+
ref: zod.z.string().nullable(),
|
|
11372
|
+
message: zod.z.string(),
|
|
11373
|
+
severity: zod.z.enum(["warn", "fail"])
|
|
11374
|
+
});
|
|
11375
|
+
zod.z.object({
|
|
11376
|
+
id: zod.z.string(),
|
|
11377
|
+
title: zod.z.string(),
|
|
11378
|
+
category: HealthcheckCategorySchema,
|
|
11379
|
+
generatedAt: zod.z.date(),
|
|
11380
|
+
scope: zod.z.object({
|
|
11381
|
+
slug: zod.z.string().nullable()
|
|
11382
|
+
}),
|
|
11383
|
+
ok: zod.z.boolean(),
|
|
11384
|
+
severity: HealthcheckSeveritySchema,
|
|
11385
|
+
observed: zod.z.record(zod.z.union([zod.z.number(), zod.z.string(), zod.z.boolean()]).nullable()),
|
|
11386
|
+
threshold: zod.z.record(zod.z.union([zod.z.number(), zod.z.string(), zod.z.boolean()]).nullable()),
|
|
11387
|
+
findings: zod.z.array(HealthcheckFindingSchema),
|
|
11388
|
+
suggestedAction: zod.z.string().nullable(),
|
|
11389
|
+
appUrl: zod.z.string().nullable()
|
|
11390
|
+
});
|
|
11391
|
+
|
|
11392
|
+
// ../../internal/validation/src/public/healthchecks/assets-dead-asset-spike.ts
|
|
11393
|
+
zod.z.object({
|
|
11394
|
+
slug: zod.z.string().min(1),
|
|
11395
|
+
windowHours: zod.z.number().int().positive().default(24),
|
|
11396
|
+
baselineDays: zod.z.number().int().positive().default(7),
|
|
11397
|
+
warnMultiplier: zod.z.number().positive().default(2),
|
|
11398
|
+
failMultiplier: zod.z.number().positive().default(4),
|
|
11399
|
+
minSpikeCount: zod.z.number().int().min(1).default(10)
|
|
11400
|
+
});
|
|
11401
|
+
zod.z.object({});
|
|
11402
|
+
var HealthcheckRegistryEntrySchema = zod.z.object({
|
|
11403
|
+
id: zod.z.string(),
|
|
11404
|
+
title: zod.z.string(),
|
|
11405
|
+
description: zod.z.string(),
|
|
11406
|
+
category: HealthcheckCategorySchema,
|
|
11407
|
+
implemented: zod.z.boolean(),
|
|
11408
|
+
endpoint: zod.z.string().nullable(),
|
|
11409
|
+
defaultThreshold: zod.z.record(zod.z.union([zod.z.number(), zod.z.string()])).optional(),
|
|
11410
|
+
notImplementedReason: zod.z.string().optional()
|
|
11411
|
+
});
|
|
11412
|
+
zod.z.object({
|
|
11413
|
+
checks: zod.z.array(HealthcheckRegistryEntrySchema)
|
|
11414
|
+
});
|
|
11415
|
+
zod.z.object({
|
|
11416
|
+
slug: zod.z.string().min(1)
|
|
11417
|
+
});
|
|
11418
|
+
zod.z.object({
|
|
11419
|
+
slug: zod.z.string().min(1),
|
|
11420
|
+
warnThreshold: zod.z.number().int().nonnegative().default(50),
|
|
11421
|
+
failThreshold: zod.z.number().int().nonnegative().default(100)
|
|
11422
|
+
});
|
|
11423
|
+
zod.z.object({
|
|
11424
|
+
slug: zod.z.string().min(1),
|
|
11425
|
+
warnAgeHours: zod.z.number().int().positive().default(24 * 7),
|
|
11426
|
+
failAgeHours: zod.z.number().int().positive().default(24 * 14)
|
|
11427
|
+
});
|
|
11428
|
+
zod.z.object({
|
|
11429
|
+
slug: zod.z.string().min(1),
|
|
11430
|
+
warnAgeHours: zod.z.number().int().nonnegative().default(24 * 30),
|
|
11431
|
+
failAgeHours: zod.z.number().int().nonnegative().default(24 * 60)
|
|
11432
|
+
});
|
|
11433
|
+
zod.z.object({
|
|
11434
|
+
slug: zod.z.string().min(1),
|
|
11435
|
+
lookbackHours: zod.z.number().int().positive().default(24 * 7),
|
|
11436
|
+
warnThreshold: zod.z.number().int().nonnegative().default(3),
|
|
11437
|
+
failThreshold: zod.z.number().int().nonnegative().default(10)
|
|
11438
|
+
});
|
|
11439
|
+
zod.z.object({
|
|
11440
|
+
slug: zod.z.string().min(1),
|
|
11441
|
+
warnThreshold: zod.z.number().int().nonnegative().default(30),
|
|
11442
|
+
failThreshold: zod.z.number().int().nonnegative().default(75)
|
|
11443
|
+
});
|
|
11444
|
+
zod.z.object({
|
|
11445
|
+
slug: zod.z.string().min(1),
|
|
11446
|
+
staleThresholdHours: zod.z.number().int().positive().default(24 * 7),
|
|
11447
|
+
warnThreshold: zod.z.number().int().nonnegative().default(1),
|
|
11448
|
+
failThreshold: zod.z.number().int().nonnegative().default(5)
|
|
11449
|
+
});
|
|
11450
|
+
zod.z.object({
|
|
11451
|
+
slug: zod.z.string().min(1),
|
|
11452
|
+
warnThreshold: zod.z.number().int().nonnegative().default(50),
|
|
11453
|
+
failThreshold: zod.z.number().int().nonnegative().default(100)
|
|
11454
|
+
});
|
|
11455
|
+
var BreakdownBySchema = zod.z.enum(["day", "type", "brand"]);
|
|
11456
|
+
zod.z.object({
|
|
11457
|
+
slug: zod.z.string().min(1),
|
|
11458
|
+
by: BreakdownBySchema,
|
|
11459
|
+
startDate: zod.z.date().optional(),
|
|
11460
|
+
endDate: zod.z.date().optional(),
|
|
11461
|
+
brandIds: zod.z.array(zod.z.number().int().positive()).optional()
|
|
11462
|
+
});
|
|
11463
|
+
zod.z.object({
|
|
11464
|
+
by: BreakdownBySchema,
|
|
11465
|
+
points: zod.z.array(
|
|
11466
|
+
zod.z.object({
|
|
11467
|
+
key: zod.z.string(),
|
|
11468
|
+
count: zod.z.number(),
|
|
11469
|
+
date: zod.z.string().optional(),
|
|
11470
|
+
type: zod.z.string().optional(),
|
|
11471
|
+
brandId: zod.z.number().optional(),
|
|
11472
|
+
brandSlug: zod.z.string().optional(),
|
|
11473
|
+
brandName: zod.z.string().optional()
|
|
11474
|
+
})
|
|
11475
|
+
)
|
|
11476
|
+
});
|
|
11477
|
+
zod.z.object({
|
|
11478
|
+
slug: zod.z.string().min(1),
|
|
11479
|
+
startDate: zod.z.date(),
|
|
11480
|
+
endDate: zod.z.date(),
|
|
11481
|
+
brandIds: zod.z.array(zod.z.number().int().positive()).optional()
|
|
11482
|
+
});
|
|
11483
|
+
zod.z.object({
|
|
11484
|
+
metric: zod.z.literal("new_threats"),
|
|
11485
|
+
found: zod.z.number(),
|
|
11486
|
+
range: zod.z.object({
|
|
11487
|
+
startDate: zod.z.date(),
|
|
11488
|
+
endDate: zod.z.date()
|
|
11489
|
+
})
|
|
11490
|
+
});
|
|
11491
|
+
zod.z.object({
|
|
11492
|
+
slug: zod.z.string().min(1),
|
|
11493
|
+
startDate: zod.z.date().optional(),
|
|
11494
|
+
endDate: zod.z.date().optional(),
|
|
11495
|
+
brandIds: zod.z.array(zod.z.number().int().positive()).optional()
|
|
11496
|
+
});
|
|
11497
|
+
zod.z.object({
|
|
11498
|
+
metrics: zod.z.object({
|
|
11499
|
+
reports: zod.z.number(),
|
|
11500
|
+
newThreats: zod.z.number(),
|
|
11501
|
+
threatsWatchlisted: zod.z.number(),
|
|
11502
|
+
takedownsFiled: zod.z.number(),
|
|
11503
|
+
takedownsCompleted: zod.z.number(),
|
|
11504
|
+
domainThreats: zod.z.number(),
|
|
11505
|
+
twitterThreats: zod.z.number(),
|
|
11506
|
+
telegramThreats: zod.z.number(),
|
|
11507
|
+
otherThreats: zod.z.number()
|
|
11508
|
+
}),
|
|
11509
|
+
blockedByDay: zod.z.array(
|
|
11510
|
+
zod.z.object({
|
|
11511
|
+
date: zod.z.string(),
|
|
11512
|
+
count: zod.z.number()
|
|
11513
|
+
})
|
|
11514
|
+
),
|
|
11515
|
+
blockedByType: zod.z.array(
|
|
11516
|
+
zod.z.object({
|
|
11517
|
+
type: zod.z.string(),
|
|
11518
|
+
count: zod.z.number()
|
|
11519
|
+
})
|
|
11520
|
+
)
|
|
11521
|
+
});
|
|
11522
|
+
var DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
11523
|
+
var utcDateSchema = (endOfDay) => zod.z.preprocess((value) => {
|
|
11524
|
+
if (typeof value !== "string") {
|
|
11525
|
+
return value;
|
|
11415
11526
|
}
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
return null;
|
|
11420
|
-
}
|
|
11421
|
-
return parsed.toString();
|
|
11422
|
-
} catch (e4) {
|
|
11423
|
-
return null;
|
|
11527
|
+
const parsed = DateTime.fromISO(value, { zone: "utc" });
|
|
11528
|
+
if (!parsed.isValid) {
|
|
11529
|
+
return new Date(Number.NaN);
|
|
11424
11530
|
}
|
|
11425
|
-
|
|
11426
|
-
|
|
11531
|
+
return endOfDay && DATE_ONLY_PATTERN.test(value) ? parsed.endOf("day").toJSDate() : parsed.toJSDate();
|
|
11532
|
+
}, zod.z.coerce.date());
|
|
11533
|
+
zod.z.object({
|
|
11534
|
+
slug: zod.z.string().min(1).describe("Organization slug"),
|
|
11535
|
+
startDate: utcDateSchema(false).optional().describe(
|
|
11536
|
+
"Only include takedowns completed on or after this date. A date-only value (YYYY-MM-DD) starts at midnight UTC"
|
|
11537
|
+
),
|
|
11538
|
+
endDate: utcDateSchema(true).optional().describe(
|
|
11539
|
+
"Only include takedowns completed on or before this date. A date-only value (YYYY-MM-DD) covers the whole day in UTC; pass a full timestamp for a precise cut-off"
|
|
11540
|
+
),
|
|
11541
|
+
blockLabel: zod.z.string().optional().describe(
|
|
11542
|
+
'Only include assets blocked with this review label, e.g. "Brand Impersonation", "Employee Impersonation" or "Targeting Org Users"'
|
|
11543
|
+
),
|
|
11544
|
+
brandType: zod.z.nativeEnum(BrandType).optional().describe("Only include assets belonging to brands of this type"),
|
|
11545
|
+
countryCodes: zod.z.array(zod.z.string().length(2)).optional().describe("Only include assets scanned from these ISO 3166-1 alpha-2 countries"),
|
|
11546
|
+
brandIds: zod.z.array(zod.z.number().int().positive()).optional().describe("Only include assets belonging to these brands")
|
|
11547
|
+
});
|
|
11548
|
+
zod.z.object({
|
|
11549
|
+
byAssetType: zod.z.array(
|
|
11550
|
+
zod.z.object({
|
|
11551
|
+
assetType: zod.z.nativeEnum(AssetType).describe("Asset type the median is computed over"),
|
|
11552
|
+
medianTakedownMinutes: zod.z.number(),
|
|
11553
|
+
medianTakedownHours: zod.z.number(),
|
|
11554
|
+
medianTakedownDays: zod.z.number(),
|
|
11555
|
+
count: zod.z.number().describe("Number of completed takedowns behind the median")
|
|
11556
|
+
})
|
|
11557
|
+
).describe(
|
|
11558
|
+
"Median time from takedown start to completion, one entry per asset type, ascending by median"
|
|
11559
|
+
)
|
|
11560
|
+
});
|
|
11561
|
+
zod.z.object({
|
|
11562
|
+
slug: zod.z.string().min(1).describe("Organization slug"),
|
|
11563
|
+
months: zod.z.number().int().min(2).max(36).default(12).describe("Size of the trailing window in whole months, including the current month"),
|
|
11564
|
+
assetTypes: zod.z.array(zod.z.nativeEnum(AssetType)).max(5).optional().describe(
|
|
11565
|
+
"Break the trend down by these asset types, one series each. Omit for a single series pooled across every asset type"
|
|
11566
|
+
),
|
|
11567
|
+
blockLabel: zod.z.string().optional().describe(
|
|
11568
|
+
'Only include assets blocked with this review label, e.g. "Brand Impersonation", "Employee Impersonation" or "Targeting Org Users"'
|
|
11569
|
+
),
|
|
11570
|
+
brandType: zod.z.nativeEnum(BrandType).optional().describe("Only include assets belonging to brands of this type"),
|
|
11571
|
+
countryCodes: zod.z.array(zod.z.string().length(2)).optional().describe("Only include assets scanned from these ISO 3166-1 alpha-2 countries"),
|
|
11572
|
+
brandIds: zod.z.array(zod.z.number().int().positive()).optional().describe("Only include assets belonging to these brands")
|
|
11573
|
+
});
|
|
11574
|
+
var MetricsTakedownTimeTrendPointSchema = zod.z.object({
|
|
11575
|
+
period: zod.z.string().describe("Month the takedowns completed in, as a yyyy-MM key"),
|
|
11576
|
+
medianTakedownMinutes: zod.z.number().nullable().describe("Null when no takedowns completed in this month"),
|
|
11577
|
+
medianTakedownHours: zod.z.number().nullable(),
|
|
11578
|
+
medianTakedownDays: zod.z.number().nullable(),
|
|
11579
|
+
count: zod.z.number().describe("Number of completed takedowns behind the median")
|
|
11580
|
+
});
|
|
11581
|
+
var MetricsTakedownTimeTrendChangeSchema = zod.z.object({
|
|
11582
|
+
latest: MetricsTakedownTimeTrendPointSchema.nullable().describe(
|
|
11583
|
+
"Most recent month in the window that had completed takedowns"
|
|
11584
|
+
),
|
|
11585
|
+
previous: MetricsTakedownTimeTrendPointSchema.nullable().describe(
|
|
11586
|
+
"Month with completed takedowns immediately before `latest`, skipping empty months"
|
|
11587
|
+
),
|
|
11588
|
+
percentChange: zod.z.number().nullable().describe(
|
|
11589
|
+
"Change in the median from `previous` to `latest`, as a percentage. Negative means takedowns got faster. Null when there is no comparable earlier month"
|
|
11590
|
+
),
|
|
11591
|
+
direction: zod.z.enum(["improved", "worsened", "unchanged"]).nullable().describe("Sign of `percentChange`, read as lower-is-better. Null when it is null")
|
|
11592
|
+
});
|
|
11593
|
+
zod.z.object({
|
|
11594
|
+
months: zod.z.number().describe("Size of the trailing window that was used"),
|
|
11595
|
+
periods: zod.z.array(zod.z.string()).describe("Every yyyy-MM key in the window, oldest first"),
|
|
11596
|
+
series: zod.z.array(
|
|
11597
|
+
zod.z.object({
|
|
11598
|
+
assetType: zod.z.nativeEnum(AssetType).nullable().describe("Null for the series pooled across every asset type"),
|
|
11599
|
+
points: zod.z.array(MetricsTakedownTimeTrendPointSchema).describe(
|
|
11600
|
+
"One point per month in the window, oldest first. Months with no completed takedowns carry a null median"
|
|
11601
|
+
),
|
|
11602
|
+
change: MetricsTakedownTimeTrendChangeSchema.describe(
|
|
11603
|
+
"Month-over-month comparison for this series"
|
|
11604
|
+
)
|
|
11605
|
+
})
|
|
11606
|
+
).describe(
|
|
11607
|
+
"One series per requested asset type, in the order requested, or a single pooled series when no asset types were given"
|
|
11608
|
+
)
|
|
11609
|
+
});
|
|
11610
|
+
zod.z.object({
|
|
11611
|
+
slug: zod.z.string().optional().describe(
|
|
11612
|
+
"Organization slug. Optional for organization-scoped API keys, which resolve the organization from the key itself. Required when your credentials can reach more than one organization."
|
|
11613
|
+
),
|
|
11614
|
+
type: zod.z.nativeEnum(AssetType).optional().describe("Filter by asset type (URL, ADDRESS, etc.)"),
|
|
11615
|
+
groupId: zod.z.number().int().optional().describe(
|
|
11616
|
+
"Filter by group ID. Use -1 for ungrouped assets only. Omit for all assets."
|
|
11617
|
+
),
|
|
11618
|
+
query: zod.z.string().optional().describe("Search query to filter assets by content"),
|
|
11619
|
+
per_page: zod.z.number().int().min(1).max(1e3).optional().default(100).describe("The number of assets to return per page (max 1000)"),
|
|
11620
|
+
next_page: zod.z.string().optional().nullable().describe("Cursor for fetching the next page of results")
|
|
11621
|
+
}).describe(
|
|
11622
|
+
`List organization assets request body
|
|
11427
11623
|
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11624
|
+
Returns all assets belonging to the organization identified by \`slug\`, or \u2014
|
|
11625
|
+
when \`slug\` is omitted \u2014 the organization associated with your API key.
|
|
11626
|
+
Supports filtering by type, group, and search query.`
|
|
11627
|
+
);
|
|
11628
|
+
var organizationAssetItemSchema = zod.z.object({
|
|
11629
|
+
id: zod.z.number().describe("Asset ID"),
|
|
11630
|
+
content: zod.z.string().describe("Asset content (URL, address, handle, etc.)"),
|
|
11631
|
+
type: zod.z.nativeEnum(AssetType).describe("Asset type"),
|
|
11632
|
+
status: zod.z.nativeEnum(AssetStatus).describe("Asset status"),
|
|
11633
|
+
name: zod.z.string().nullable().describe("Asset display name"),
|
|
11634
|
+
description: zod.z.string().nullable().describe("Asset description"),
|
|
11635
|
+
group: zod.z.object({
|
|
11636
|
+
id: zod.z.number().describe("Group ID"),
|
|
11637
|
+
name: zod.z.string().describe("Group name")
|
|
11638
|
+
}).nullable().describe("Asset group information"),
|
|
11639
|
+
livenessStatus: zod.z.nativeEnum(LivenessStatus).nullable().describe(
|
|
11640
|
+
"Whether the asset is currently reachable (`ALIVE`), gone (`DEAD`), or hasn't been checked (`UNKNOWN`). `null` when liveness has never been evaluated."
|
|
11641
|
+
),
|
|
11642
|
+
blockedAt: zod.z.date().nullable().describe(
|
|
11643
|
+
"When the asset transitioned to BLOCKED status. `null` for non-blocked assets. Distinct from `updatedAt`."
|
|
11644
|
+
),
|
|
11645
|
+
createdAt: zod.z.date().describe("When the asset was created"),
|
|
11646
|
+
updatedAt: zod.z.date().describe("When the asset was last updated")
|
|
11434
11647
|
});
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11648
|
+
zod.z.object({
|
|
11649
|
+
assets: zod.z.array(organizationAssetItemSchema).describe("List of assets"),
|
|
11650
|
+
next_page: zod.z.string().nullable().optional().describe("Cursor for fetching the next page of results")
|
|
11651
|
+
}).describe("Successful operation");
|
|
11652
|
+
var addAssetItemSchema = zod.z.object({
|
|
11653
|
+
content: zod.z.string().describe("Asset content (URL, address, handle, etc.)"),
|
|
11654
|
+
name: zod.z.string().optional().describe("Optional display name for the asset"),
|
|
11655
|
+
description: zod.z.string().optional().describe("Optional description for the asset"),
|
|
11656
|
+
groupId: zod.z.number().int().positive().optional().describe("Optional group ID to assign the asset to")
|
|
11657
|
+
});
|
|
11658
|
+
zod.z.object({
|
|
11659
|
+
assets: zod.z.array(addAssetItemSchema).min(1).max(1e3).describe("Array of assets to add (max 1000 per request)")
|
|
11660
|
+
}).describe(
|
|
11661
|
+
`Add assets to organization allowlist
|
|
11662
|
+
|
|
11663
|
+
Batch add multiple assets to your organization's allowlist.
|
|
11664
|
+
Each asset will be automatically parsed and classified.
|
|
11665
|
+
Assets will be auto-approved as ALLOWED status.`
|
|
11666
|
+
);
|
|
11667
|
+
var addAssetResultSchema = zod.z.object({
|
|
11668
|
+
content: zod.z.string().describe("Asset content"),
|
|
11669
|
+
success: zod.z.boolean().describe("Whether the asset was added successfully"),
|
|
11670
|
+
id: zod.z.number().optional().describe("Asset ID if successful"),
|
|
11671
|
+
error: zod.z.string().optional().describe("Error message if failed")
|
|
11672
|
+
});
|
|
11673
|
+
zod.z.object({
|
|
11674
|
+
results: zod.z.array(addAssetResultSchema).describe("Results for each asset"),
|
|
11675
|
+
successCount: zod.z.number().describe("Number of assets successfully added"),
|
|
11676
|
+
errorCount: zod.z.number().describe("Number of assets that failed to add")
|
|
11677
|
+
}).describe("Batch add operation results");
|
|
11678
|
+
zod.z.object({
|
|
11679
|
+
assetId: zod.z.number().int().positive().describe("ID of the asset to update"),
|
|
11680
|
+
name: zod.z.string().optional().describe("New display name for the asset"),
|
|
11681
|
+
description: zod.z.string().nullable().optional().describe("New description for the asset"),
|
|
11682
|
+
groupId: zod.z.number().int().positive().nullable().optional().describe("New group ID (null to ungroup)")
|
|
11683
|
+
}).describe(
|
|
11684
|
+
`Update an organization asset
|
|
11685
|
+
|
|
11686
|
+
Update the name, description, or group assignment of an asset.`
|
|
11687
|
+
);
|
|
11688
|
+
zod.z.object({
|
|
11689
|
+
id: zod.z.number().describe("Asset ID"),
|
|
11690
|
+
content: zod.z.string().describe("Asset content"),
|
|
11691
|
+
name: zod.z.string().nullable().describe("Asset display name"),
|
|
11692
|
+
description: zod.z.string().nullable().describe("Asset description"),
|
|
11693
|
+
groupId: zod.z.number().nullable().describe("Group ID")
|
|
11694
|
+
}).describe("Updated asset");
|
|
11695
|
+
zod.z.object({
|
|
11696
|
+
assetId: zod.z.number().int().positive().describe("ID of the asset to remove")
|
|
11697
|
+
}).describe(
|
|
11698
|
+
`Remove an asset from the organization
|
|
11699
|
+
|
|
11700
|
+
This removes the asset from the organization's allowlist.`
|
|
11701
|
+
);
|
|
11702
|
+
zod.z.object({
|
|
11703
|
+
success: zod.z.boolean().describe("Whether the asset was removed successfully"),
|
|
11704
|
+
id: zod.z.number().describe("Asset ID that was removed")
|
|
11705
|
+
}).describe("Delete operation result");
|
|
11706
|
+
zod.z.object({}).describe(
|
|
11707
|
+
`List organization asset groups
|
|
11708
|
+
|
|
11709
|
+
Returns all asset groups belonging to the organization associated with your API key.`
|
|
11710
|
+
);
|
|
11711
|
+
var assetGroupItemSchema = zod.z.object({
|
|
11712
|
+
id: zod.z.number().describe("Group ID"),
|
|
11713
|
+
name: zod.z.string().describe("Group name"),
|
|
11714
|
+
assetCount: zod.z.number().describe("Number of assets in this group")
|
|
11715
|
+
});
|
|
11716
|
+
zod.z.object({
|
|
11717
|
+
groups: zod.z.array(assetGroupItemSchema).describe("List of asset groups")
|
|
11718
|
+
}).describe("Successful operation");
|
|
11719
|
+
zod.z.object({
|
|
11720
|
+
name: zod.z.string().min(1).max(255).describe("Name for the new group")
|
|
11721
|
+
}).describe(
|
|
11722
|
+
`Create a new asset group
|
|
11723
|
+
|
|
11724
|
+
Creates a new asset group for organizing your organization's assets.`
|
|
11725
|
+
);
|
|
11726
|
+
zod.z.object({
|
|
11727
|
+
id: zod.z.number().describe("Created group ID"),
|
|
11728
|
+
name: zod.z.string().describe("Group name")
|
|
11729
|
+
}).describe("Created group");
|
|
11730
|
+
zod.z.object({
|
|
11731
|
+
groupId: zod.z.number().int().positive().describe("ID of the group to update"),
|
|
11732
|
+
name: zod.z.string().min(1).max(255).describe("New name for the group")
|
|
11733
|
+
}).describe(
|
|
11734
|
+
`Update an asset group
|
|
11735
|
+
|
|
11736
|
+
Rename an existing asset group.`
|
|
11737
|
+
);
|
|
11738
|
+
zod.z.object({
|
|
11739
|
+
id: zod.z.number().describe("Group ID"),
|
|
11740
|
+
name: zod.z.string().describe("Updated group name")
|
|
11741
|
+
}).describe("Updated group");
|
|
11742
|
+
zod.z.object({
|
|
11743
|
+
groupId: zod.z.number().int().positive().describe("ID of the group to delete")
|
|
11744
|
+
}).describe(
|
|
11745
|
+
`Delete an asset group
|
|
11746
|
+
|
|
11747
|
+
Deletes an asset group. Assets in this group will become ungrouped.`
|
|
11748
|
+
);
|
|
11749
|
+
zod.z.object({
|
|
11750
|
+
success: zod.z.boolean().describe("Whether the group was deleted successfully"),
|
|
11751
|
+
id: zod.z.number().describe("Group ID that was deleted"),
|
|
11752
|
+
unassignedAssetCount: zod.z.number().describe("Number of assets that were unassigned from this group")
|
|
11753
|
+
}).describe("Delete operation result");
|
|
11754
|
+
zod.z.object({}).describe(
|
|
11755
|
+
`List organization brands
|
|
11468
11756
|
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11757
|
+
Returns all brands belonging to the organization associated with your API key,
|
|
11758
|
+
including sub-brands (\`ORGANIZATION\`), individual / employee brands
|
|
11759
|
+
(\`INDIVIDUAL\`), and product brands (\`PRODUCT\`). Soft-deleted brands are
|
|
11760
|
+
excluded.`
|
|
11761
|
+
);
|
|
11762
|
+
var brandLegalDocumentSchema = zod.z.object({
|
|
11763
|
+
present: zod.z.boolean().describe("Whether the brand has this document attached"),
|
|
11764
|
+
fileName: zod.z.string().nullable().describe("Original filename of the uploaded document (null when not present)"),
|
|
11765
|
+
fileUrl: zod.z.string().nullable().describe("Direct URL to view or download the document (null when not present)")
|
|
11473
11766
|
});
|
|
11474
|
-
var
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
__export(delay_exports, {
|
|
11489
|
-
delay: () => delay
|
|
11767
|
+
var brandTrademarkRegistrationSchema = zod.z.object({
|
|
11768
|
+
id: zod.z.number().describe("Trademark registration ID"),
|
|
11769
|
+
brandName: zod.z.string().describe("Trademarked brand name as it appears on the registration"),
|
|
11770
|
+
trademarkOffice: zod.z.string().describe("Issuing trademark office (e.g. `USPTO`, `EUIPO`)"),
|
|
11771
|
+
registrationNumber: zod.z.string().describe("Registration number assigned by the office"),
|
|
11772
|
+
goodsAndServicesClass: zod.z.string().describe("Nice Classification class(es) the registration covers"),
|
|
11773
|
+
rightsOwnerName: zod.z.string().nullable().describe("Legal entity the trademark is registered to, if recorded"),
|
|
11774
|
+
registrationPageUrl: zod.z.string().nullable().describe("Public URL on the trademark office's site, if recorded"),
|
|
11775
|
+
certificateFileName: zod.z.string().nullable().describe(
|
|
11776
|
+
"Original filename of the uploaded certificate PDF (null when no certificate is attached)"
|
|
11777
|
+
),
|
|
11778
|
+
certificateFileUrl: zod.z.string().nullable().describe(
|
|
11779
|
+
"Direct URL to view or download the certificate PDF (null when no certificate is attached)"
|
|
11780
|
+
)
|
|
11490
11781
|
});
|
|
11491
|
-
var
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11782
|
+
var brandItemSchema = zod.z.object({
|
|
11783
|
+
id: zod.z.number().describe("Brand ID"),
|
|
11784
|
+
slug: zod.z.string().describe("Brand slug (stable, URL-safe identifier)"),
|
|
11785
|
+
name: zod.z.string().describe("Display name"),
|
|
11786
|
+
type: zod.z.nativeEnum(BrandType).describe(
|
|
11787
|
+
"Brand type: `ORGANIZATION` for parent brands, `INDIVIDUAL` for employee or person brands, `PRODUCT` for a specific product or service offering"
|
|
11788
|
+
),
|
|
11789
|
+
description: zod.z.string().nullable().describe("Free-form description, if set"),
|
|
11790
|
+
avatarUrl: zod.z.string().nullable().describe("URL of the brand's avatar / logo image"),
|
|
11791
|
+
websiteUrl: zod.z.string().nullable().describe("Official brand website URL"),
|
|
11792
|
+
twitterHandle: zod.z.string().nullable().describe("Official Twitter / X handle (without @)"),
|
|
11793
|
+
brandColors: zod.z.array(zod.z.string()).describe("HEX color strings associated with the brand (e.g. `#FF0000`)"),
|
|
11794
|
+
includedTerms: zod.z.array(zod.z.string()).describe("Terms that should be included when matching this brand"),
|
|
11795
|
+
excludedTerms: zod.z.array(zod.z.string()).describe("Terms that should be excluded when matching this brand"),
|
|
11796
|
+
tickers: zod.z.array(zod.z.string()).describe("Ticker symbols associated with the brand (e.g. `$JUP`)"),
|
|
11797
|
+
brandGroupId: zod.z.number().nullable().describe(
|
|
11798
|
+
"Group this brand belongs to (only set for `INDIVIDUAL` and `PRODUCT` brands)"
|
|
11799
|
+
),
|
|
11800
|
+
createdAt: zod.z.date().describe("When the brand was created"),
|
|
11801
|
+
useOrganizationDocs: zod.z.boolean().describe(
|
|
11802
|
+
"When true, this brand inherits its Letter of Authorization and Power of Attorney from the organization rather than carrying its own. The `legalDocuments` block below always reflects the brand-level attachments \u2014 read `/user/orgs/{slug}` for the org-level fallbacks."
|
|
11803
|
+
),
|
|
11804
|
+
legalDocuments: zod.z.object({
|
|
11805
|
+
letterOfAuthorization: brandLegalDocumentSchema,
|
|
11806
|
+
powerOfAttorney: brandLegalDocumentSchema
|
|
11807
|
+
}).describe("Brand-level Letter of Authorization and Power of Attorney attachments"),
|
|
11808
|
+
trademarkRegistrations: zod.z.array(brandTrademarkRegistrationSchema).describe(
|
|
11809
|
+
"Trademark registrations attached to this brand. An empty array means no trademarks are on file for the brand \u2014 use this to identify brands that still need them added."
|
|
11810
|
+
)
|
|
11501
11811
|
});
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
var
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
function parseWhoisString(value) {
|
|
11529
|
-
if (typeof value !== "string") {
|
|
11530
|
-
return void 0;
|
|
11531
|
-
}
|
|
11532
|
-
const trimmedValue = value.trim();
|
|
11533
|
-
if (WHOIS_EMPTY_VALUES.has(trimmedValue.toLowerCase())) {
|
|
11534
|
-
return void 0;
|
|
11535
|
-
}
|
|
11536
|
-
return trimmedValue;
|
|
11537
|
-
}
|
|
11538
|
-
function extractWhoisFieldByAliases(payload, aliases) {
|
|
11539
|
-
for (const [key, value] of Object.entries(payload)) {
|
|
11540
|
-
if (!aliases.has(normalizeWhoisKey(key))) {
|
|
11541
|
-
continue;
|
|
11542
|
-
}
|
|
11543
|
-
const parsedValue = parseWhoisString(value);
|
|
11544
|
-
if (parsedValue) {
|
|
11545
|
-
return parsedValue;
|
|
11546
|
-
}
|
|
11547
|
-
}
|
|
11548
|
-
return void 0;
|
|
11549
|
-
}
|
|
11550
|
-
function extractWhoisCountry(payload) {
|
|
11551
|
-
const countryCode = extractWhoisFieldByAliases(payload, WHOIS_COUNTRY_CODE_KEY_ALIASES);
|
|
11552
|
-
const country = extractWhoisFieldByAliases(payload, WHOIS_COUNTRY_KEY_ALIASES);
|
|
11553
|
-
return {
|
|
11554
|
-
countryCode: countryCode != null ? countryCode : void 0,
|
|
11555
|
-
country: country != null ? country : void 0
|
|
11556
|
-
};
|
|
11557
|
-
}
|
|
11558
|
-
|
|
11559
|
-
// ../../internal/utils/src/safe-preview.ts
|
|
11560
|
-
var safe_preview_exports = {};
|
|
11561
|
-
__export(safe_preview_exports, {
|
|
11562
|
-
buildSafePreviewUrl: () => buildSafePreviewUrl,
|
|
11563
|
-
normalizeSafeNavigationTarget: () => normalizeSafeNavigationTarget
|
|
11812
|
+
zod.z.object({
|
|
11813
|
+
brands: zod.z.array(brandItemSchema).describe("List of brands")
|
|
11814
|
+
}).describe("Successful operation");
|
|
11815
|
+
var FILTERABLE_SUBSCRIPTION_STATUSES = [
|
|
11816
|
+
SubscriptionStatus.PROSPECT,
|
|
11817
|
+
SubscriptionStatus.POC,
|
|
11818
|
+
SubscriptionStatus.ACTIVE,
|
|
11819
|
+
SubscriptionStatus.INTEGRATION
|
|
11820
|
+
];
|
|
11821
|
+
var UserOrgsSubscriptionStatusSchema = zod.z.enum(
|
|
11822
|
+
FILTERABLE_SUBSCRIPTION_STATUSES
|
|
11823
|
+
);
|
|
11824
|
+
var takedownsServiceFilterSchema = zod.z.object({
|
|
11825
|
+
active: zod.z.boolean().optional(),
|
|
11826
|
+
automated: zod.z.boolean().optional()
|
|
11827
|
+
}).optional();
|
|
11828
|
+
var singleServiceFilterSchema = zod.z.object({
|
|
11829
|
+
active: zod.z.boolean().optional()
|
|
11830
|
+
}).optional();
|
|
11831
|
+
var userOrgsServicesFilterObjectSchema = zod.z.object({
|
|
11832
|
+
reporting: singleServiceFilterSchema,
|
|
11833
|
+
reviewing: singleServiceFilterSchema,
|
|
11834
|
+
protection: singleServiceFilterSchema,
|
|
11835
|
+
takedowns: takedownsServiceFilterSchema,
|
|
11836
|
+
detection: singleServiceFilterSchema,
|
|
11837
|
+
darkWebMonitoring: singleServiceFilterSchema
|
|
11564
11838
|
});
|
|
11565
|
-
var
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11839
|
+
var userOrgsObligatoryAdminApprovalFilterSchema = zod.z.object({
|
|
11840
|
+
active: zod.z.boolean().optional(),
|
|
11841
|
+
assetTypes: zod.z.array(zod.z.nativeEnum(AssetType)).min(1).optional()
|
|
11842
|
+
}).optional();
|
|
11843
|
+
var PendingApprovalServiceSchema = zod.z.enum(["protection", "takedowns"]);
|
|
11844
|
+
var userOrgsPendingServiceApprovalFilterSchema = zod.z.object({
|
|
11845
|
+
active: zod.z.boolean().optional(),
|
|
11846
|
+
services: zod.z.array(PendingApprovalServiceSchema).min(1).optional()
|
|
11847
|
+
}).optional();
|
|
11848
|
+
zod.z.object({
|
|
11849
|
+
query: zod.z.string().default(""),
|
|
11850
|
+
subscriptionStatus: zod.z.array(UserOrgsSubscriptionStatusSchema).min(1).optional(),
|
|
11851
|
+
services: userOrgsServicesFilterObjectSchema.optional(),
|
|
11852
|
+
obligatoryAdminApproval: userOrgsObligatoryAdminApprovalFilterSchema,
|
|
11853
|
+
pendingServiceApproval: userOrgsPendingServiceApprovalFilterSchema
|
|
11854
|
+
});
|
|
11855
|
+
var takedownsServiceSchema = zod.z.object({
|
|
11856
|
+
active: zod.z.boolean(),
|
|
11857
|
+
automated: zod.z.boolean()
|
|
11858
|
+
});
|
|
11859
|
+
var singleServiceSchema = zod.z.object({
|
|
11860
|
+
active: zod.z.boolean()
|
|
11861
|
+
});
|
|
11862
|
+
var UserOrgObligatoryAdminApprovalSchema = zod.z.object({
|
|
11863
|
+
active: zod.z.boolean(),
|
|
11864
|
+
assetTypes: zod.z.array(zod.z.nativeEnum(AssetType))
|
|
11865
|
+
});
|
|
11866
|
+
var PendingServiceApprovalSchema = zod.z.object({
|
|
11867
|
+
// Friendly service family, matching a key in the `services` object.
|
|
11868
|
+
service: PendingApprovalServiceSchema,
|
|
11869
|
+
// Whether the request is for the automated variant of the service
|
|
11870
|
+
// (e.g. "Automated Wallet Blocking" rather than "Wallet Blocking").
|
|
11871
|
+
automated: zod.z.boolean(),
|
|
11872
|
+
// Raw `ServiceType` enum value, e.g. "isProtectionActive". Lets callers
|
|
11873
|
+
// distinguish the exact column without re-deriving it from `service` +
|
|
11874
|
+
// `automated`.
|
|
11875
|
+
serviceType: zod.z.nativeEnum(ServiceType),
|
|
11876
|
+
// Human-readable service label, e.g. "Wallet Blocking".
|
|
11877
|
+
serviceName: zod.z.string(),
|
|
11878
|
+
// When the enable request was submitted (ISO 8601, UTC).
|
|
11879
|
+
requestedAt: zod.z.string()
|
|
11880
|
+
});
|
|
11881
|
+
var UserOrgIntegrationsSchema = zod.z.object({
|
|
11882
|
+
slack: zod.z.boolean(),
|
|
11883
|
+
discord: zod.z.boolean(),
|
|
11884
|
+
telegram: zod.z.object({
|
|
11885
|
+
connected: zod.z.boolean(),
|
|
11886
|
+
groupCount: zod.z.number()
|
|
11887
|
+
}),
|
|
11888
|
+
vercel: zod.z.boolean(),
|
|
11889
|
+
intercom: zod.z.boolean(),
|
|
11890
|
+
moderation: zod.z.boolean()
|
|
11597
11891
|
});
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
return terms.split(",").map((term) => {
|
|
11603
|
-
const trimmed = term.trim();
|
|
11604
|
-
if (!trimmed) return null;
|
|
11605
|
-
const isWrappedExact = trimmed.startsWith("*") && trimmed.endsWith("*") && trimmed.length > 2;
|
|
11606
|
-
if (isWrappedExact) {
|
|
11607
|
-
return {
|
|
11608
|
-
value: trimmed.slice(1, -1).toLowerCase(),
|
|
11609
|
-
type: "exact"
|
|
11610
|
-
};
|
|
11611
|
-
} else {
|
|
11612
|
-
return {
|
|
11613
|
-
value: trimmed.toLowerCase(),
|
|
11614
|
-
type: forceExact ? "exact" : "loose"
|
|
11615
|
-
};
|
|
11616
|
-
}
|
|
11617
|
-
}).filter((term) => term !== null);
|
|
11618
|
-
}
|
|
11619
|
-
function stringifyTerms(parsedTerms) {
|
|
11620
|
-
return parsedTerms.map((term) => term.type === "exact" ? `*${term.value}*` : term.value).join(", ");
|
|
11621
|
-
}
|
|
11622
|
-
|
|
11623
|
-
// ../../internal/utils/src/brand-pattern.ts
|
|
11624
|
-
var brand_pattern_exports = {};
|
|
11625
|
-
__export(brand_pattern_exports, {
|
|
11626
|
-
anyPatternMatches: () => anyPatternMatches,
|
|
11627
|
-
compileBrandPattern: () => compileBrandPattern,
|
|
11628
|
-
countPatternMatches: () => countPatternMatches,
|
|
11629
|
-
findMatchingPatterns: () => findMatchingPatterns
|
|
11892
|
+
var UserOrgLegalDocumentSchema = zod.z.object({
|
|
11893
|
+
present: zod.z.boolean().describe("Whether the organization has this document attached"),
|
|
11894
|
+
fileName: zod.z.string().nullable().describe("Original filename of the uploaded document (null when not present)"),
|
|
11895
|
+
fileUrl: zod.z.string().nullable().describe("Direct URL to view or download the document (null when not present)")
|
|
11630
11896
|
});
|
|
11631
|
-
var
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
try {
|
|
11635
|
-
return new RegExp(input.pattern, (_a = input.flags) != null ? _a : void 0);
|
|
11636
|
-
} catch (e4) {
|
|
11637
|
-
return null;
|
|
11638
|
-
}
|
|
11639
|
-
}
|
|
11640
|
-
function anyPatternMatches(content, patterns, kind) {
|
|
11641
|
-
for (const input of patterns) {
|
|
11642
|
-
if (input.kind !== kind) continue;
|
|
11643
|
-
const regex = compileBrandPattern(input);
|
|
11644
|
-
if (!regex) continue;
|
|
11645
|
-
if (regex.test(content)) {
|
|
11646
|
-
return true;
|
|
11647
|
-
}
|
|
11648
|
-
}
|
|
11649
|
-
return false;
|
|
11650
|
-
}
|
|
11651
|
-
function findMatchingPatterns(content, patterns, kind) {
|
|
11652
|
-
const matched = [];
|
|
11653
|
-
for (const input of patterns) {
|
|
11654
|
-
if (input.kind !== kind) continue;
|
|
11655
|
-
const regex = compileBrandPattern(input);
|
|
11656
|
-
if (!regex) continue;
|
|
11657
|
-
if (regex.test(content)) {
|
|
11658
|
-
matched.push(input);
|
|
11659
|
-
}
|
|
11660
|
-
}
|
|
11661
|
-
return matched;
|
|
11662
|
-
}
|
|
11663
|
-
function countPatternMatches(content, pattern, maxMatches = DEFAULT_MAX_MATCHES) {
|
|
11664
|
-
const compiled = compileBrandPattern(pattern);
|
|
11665
|
-
if (!compiled) return 0;
|
|
11666
|
-
const flags = compiled.flags.includes("g") ? compiled.flags : `${compiled.flags}g`;
|
|
11667
|
-
const globalRegex = new RegExp(compiled.source, flags);
|
|
11668
|
-
let count = 0;
|
|
11669
|
-
let match2;
|
|
11670
|
-
while ((match2 = globalRegex.exec(content)) !== null) {
|
|
11671
|
-
count += 1;
|
|
11672
|
-
if (count >= maxMatches) break;
|
|
11673
|
-
if (match2[0].length === 0) globalRegex.lastIndex += 1;
|
|
11674
|
-
}
|
|
11675
|
-
return count;
|
|
11676
|
-
}
|
|
11677
|
-
|
|
11678
|
-
// ../../internal/utils/src/text.ts
|
|
11679
|
-
var text_exports = {};
|
|
11680
|
-
__export(text_exports, {
|
|
11681
|
-
HOMOGLYPH_MAPPINGS: () => HOMOGLYPH_MAPPINGS,
|
|
11682
|
-
LETTER_TO_HOMOGLYPH_MAPPINGS: () => LETTER_TO_HOMOGLYPH_MAPPINGS,
|
|
11683
|
-
generateHomoglyphSearchTerms: () => generateHomoglyphSearchTerms,
|
|
11684
|
-
normalizeHomoglyphs: () => normalizeHomoglyphs
|
|
11897
|
+
var UserOrgLegalDocumentsSchema = zod.z.object({
|
|
11898
|
+
letterOfAuthorization: UserOrgLegalDocumentSchema,
|
|
11899
|
+
powerOfAttorney: UserOrgLegalDocumentSchema
|
|
11685
11900
|
});
|
|
11686
|
-
var
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
}
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
add(cyrillicComposite);
|
|
11771
|
-
}
|
|
11772
|
-
const cyrillicOpIndices = allOps.map((op, i) => isCyrillic(op.replacement) ? i : -1).filter((i) => i >= 0);
|
|
11773
|
-
if (variants.length < maxVariants && cyrillicOpIndices.length >= 2) {
|
|
11774
|
-
generateCombinations(
|
|
11775
|
-
allOps,
|
|
11776
|
-
cyrillicOpIndices,
|
|
11777
|
-
lowerTerm,
|
|
11778
|
-
maxVariants,
|
|
11779
|
-
add,
|
|
11780
|
-
variants
|
|
11781
|
-
);
|
|
11782
|
-
}
|
|
11783
|
-
if (variants.length < maxVariants) {
|
|
11784
|
-
const allOpIndices = allOps.map((_, i) => i);
|
|
11785
|
-
generateCombinations(allOps, allOpIndices, lowerTerm, maxVariants, add, variants);
|
|
11786
|
-
}
|
|
11787
|
-
return variants;
|
|
11788
|
-
}
|
|
11789
|
-
function normalizeHomoglyphs(text, customMappings = {}) {
|
|
11790
|
-
const mappings = __spreadValues(__spreadValues({}, HOMOGLYPH_MAPPINGS), customMappings);
|
|
11791
|
-
return text.toLowerCase().split("").map((char) => mappings[char] || char).join("");
|
|
11792
|
-
}
|
|
11793
|
-
|
|
11794
|
-
// ../../internal/utils/src/format.ts
|
|
11795
|
-
var format_exports = {};
|
|
11796
|
-
__export(format_exports, {
|
|
11797
|
-
formatCompactNumber: () => formatCompactNumber,
|
|
11798
|
-
formatFileSize: () => formatFileSize
|
|
11901
|
+
var UserOrgTrademarkRegistrationSchema = zod.z.object({
|
|
11902
|
+
id: zod.z.number().describe("Trademark registration ID"),
|
|
11903
|
+
brandName: zod.z.string().describe("Trademarked brand name as it appears on the registration"),
|
|
11904
|
+
trademarkOffice: zod.z.string().describe("Issuing trademark office (e.g. `USPTO`, `EUIPO`)"),
|
|
11905
|
+
registrationNumber: zod.z.string().describe("Registration number assigned by the office"),
|
|
11906
|
+
goodsAndServicesClass: zod.z.string().describe("Nice Classification class(es) the registration covers"),
|
|
11907
|
+
rightsOwnerName: zod.z.string().nullable().describe("Legal entity the trademark is registered to, if recorded"),
|
|
11908
|
+
registrationPageUrl: zod.z.string().nullable().describe("Public URL on the trademark office's site, if recorded"),
|
|
11909
|
+
certificateFileName: zod.z.string().nullable().describe(
|
|
11910
|
+
"Original filename of the uploaded certificate PDF (null when no certificate is attached)"
|
|
11911
|
+
),
|
|
11912
|
+
certificateFileUrl: zod.z.string().nullable().describe(
|
|
11913
|
+
"Direct URL to view or download the certificate PDF (null when no certificate is attached)"
|
|
11914
|
+
)
|
|
11915
|
+
});
|
|
11916
|
+
var UserOrgBrandMetadataSchema = zod.z.object({
|
|
11917
|
+
websiteUrl: zod.z.string().nullable().describe("Public website URL of the brand (linked from the portal header)"),
|
|
11918
|
+
twitterHandle: zod.z.string().nullable().describe(
|
|
11919
|
+
"Public Twitter/X handle of the brand, stored with the leading `@` (e.g. `@acme`)"
|
|
11920
|
+
),
|
|
11921
|
+
securityContactEmail: zod.z.string().nullable().describe(
|
|
11922
|
+
"Email address for security correspondence \u2014 used by takedown providers and researchers, distinct from the internal customer POC email"
|
|
11923
|
+
),
|
|
11924
|
+
industry: zod.z.string().nullable().describe('Free-form industry label (e.g. "DeFi", "CEX", "NFT", "Wallet")')
|
|
11925
|
+
});
|
|
11926
|
+
var UserOrgPortalCustomizationSchema = zod.z.object({
|
|
11927
|
+
useCustomDetails: zod.z.boolean().describe(
|
|
11928
|
+
"When true, the portal uses `name`/`slug`/`avatarUrl` from this object instead of the org's own name/slug/avatar"
|
|
11929
|
+
),
|
|
11930
|
+
name: zod.z.string().nullable().describe(
|
|
11931
|
+
"Custom display name shown on the portal (used only when `useCustomDetails=true`)"
|
|
11932
|
+
),
|
|
11933
|
+
slug: zod.z.string().nullable().describe(
|
|
11934
|
+
"Custom URL slug (`chainpatrol.io/<slug>`) \u2014 takes precedence over the org's own slug when set, regardless of `useCustomDetails`"
|
|
11935
|
+
),
|
|
11936
|
+
avatarUrl: zod.z.string().nullable().describe(
|
|
11937
|
+
"Custom avatar URL shown on the portal (used only when `useCustomDetails=true`)"
|
|
11938
|
+
),
|
|
11939
|
+
bannerEnabled: zod.z.boolean().describe(
|
|
11940
|
+
"When true, the portal renders `bannerContent` as a highlighted banner at the top of the page"
|
|
11941
|
+
),
|
|
11942
|
+
bannerContent: zod.z.string().nullable().describe(
|
|
11943
|
+
"Markdown body of the portal banner. Null (or empty) with `bannerEnabled=true` means the toggle is on but no content has been written yet"
|
|
11944
|
+
)
|
|
11945
|
+
});
|
|
11946
|
+
var UserOrgSchema = zod.z.object({
|
|
11947
|
+
id: zod.z.number(),
|
|
11948
|
+
name: zod.z.string(),
|
|
11949
|
+
slug: zod.z.string(),
|
|
11950
|
+
avatarUrl: zod.z.string().nullable(),
|
|
11951
|
+
contactUrl: zod.z.string().nullable(),
|
|
11952
|
+
subscriptionStatus: zod.z.nativeEnum(SubscriptionStatus),
|
|
11953
|
+
portalVisibility: zod.z.nativeEnum(OrganizationPortalVisibility).describe(
|
|
11954
|
+
"Visibility of the org's public security portal (chainpatrol.io/<slug>). `PUBLIC` is discoverable; `PRIVATE` renders only the report form (no metrics or listings); `DISABLED` returns a 404."
|
|
11955
|
+
),
|
|
11956
|
+
reportVisibility: zod.z.nativeEnum(ReportVisibility).describe(
|
|
11957
|
+
"Whether the report listings on the public portal are visible to visitors. `PUBLIC` shows the org's reports; `PRIVATE` hides the report list even when the portal is discoverable."
|
|
11958
|
+
),
|
|
11959
|
+
metricsVisibility: zod.z.nativeEnum(MetricsVisibility).describe(
|
|
11960
|
+
"Whether the metrics/threats-blocked stats render on the public portal. `PUBLIC` shows the metrics tab; `PRIVATE` hides it from anonymous visitors; `DISABLED` doesn't compute metrics at all."
|
|
11961
|
+
),
|
|
11962
|
+
brandMetadata: UserOrgBrandMetadataSchema.describe(
|
|
11963
|
+
"Public brand-facing metadata (website, twitter, security contact, industry) shown on the portal and used by staff for outbound"
|
|
11964
|
+
),
|
|
11965
|
+
portalCustomization: UserOrgPortalCustomizationSchema.describe(
|
|
11966
|
+
"Customer-configurable presentation of the public security portal \u2014 custom name/slug/avatar and the banner content"
|
|
11967
|
+
),
|
|
11968
|
+
services: zod.z.object({
|
|
11969
|
+
reporting: singleServiceSchema,
|
|
11970
|
+
reviewing: singleServiceSchema,
|
|
11971
|
+
protection: singleServiceSchema,
|
|
11972
|
+
takedowns: takedownsServiceSchema,
|
|
11973
|
+
detection: singleServiceSchema,
|
|
11974
|
+
darkWebMonitoring: singleServiceSchema
|
|
11975
|
+
}),
|
|
11976
|
+
integrations: UserOrgIntegrationsSchema,
|
|
11977
|
+
obligatoryAdminApproval: UserOrgObligatoryAdminApprovalSchema,
|
|
11978
|
+
pendingServiceApprovals: zod.z.array(PendingServiceApprovalSchema),
|
|
11979
|
+
legalDocuments: UserOrgLegalDocumentsSchema.describe(
|
|
11980
|
+
"Org-level Letter of Authorization and Power of Attorney attachments"
|
|
11981
|
+
),
|
|
11982
|
+
trademarkRegistrations: zod.z.array(UserOrgTrademarkRegistrationSchema).describe(
|
|
11983
|
+
"Org-level trademark registrations attached to the organization. An empty array means no trademarks are on file \u2014 use this to identify customers who still need to add them."
|
|
11984
|
+
)
|
|
11799
11985
|
});
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
if (num3 === void 0 || num3 === null) {
|
|
11803
|
-
return fallback;
|
|
11804
|
-
}
|
|
11805
|
-
if (num3 >= 1e9) {
|
|
11806
|
-
return `${(num3 / 1e9).toFixed(decimals)}B`;
|
|
11807
|
-
}
|
|
11808
|
-
if (num3 >= 1e6) {
|
|
11809
|
-
return `${(num3 / 1e6).toFixed(decimals)}M`;
|
|
11810
|
-
}
|
|
11811
|
-
if (num3 >= 1e3) {
|
|
11812
|
-
return `${(num3 / 1e3).toFixed(decimals)}K`;
|
|
11813
|
-
}
|
|
11814
|
-
return num3.toString();
|
|
11815
|
-
}
|
|
11816
|
-
function formatFileSize(bytes, options = {}) {
|
|
11817
|
-
const { decimals = 1, binary = true, showUnknown = true } = options;
|
|
11818
|
-
if (bytes === null || bytes === void 0 || bytes === "") {
|
|
11819
|
-
return showUnknown ? "Unknown" : "0 B";
|
|
11820
|
-
}
|
|
11821
|
-
const size = typeof bytes === "string" ? parseInt(bytes, 10) : bytes;
|
|
11822
|
-
if (isNaN(size) || size < 0) {
|
|
11823
|
-
return showUnknown ? "Unknown" : "0 B";
|
|
11824
|
-
}
|
|
11825
|
-
if (size === 0) {
|
|
11826
|
-
return "0 B";
|
|
11827
|
-
}
|
|
11828
|
-
const unit = binary ? 1024 : 1e3;
|
|
11829
|
-
const units = binary ? ["B", "KB", "MB", "GB", "TB", "PB"] : ["B", "kB", "MB", "GB", "TB", "PB"];
|
|
11830
|
-
const unitIndex = Math.floor(Math.log(size) / Math.log(unit));
|
|
11831
|
-
const finalUnitIndex = Math.min(unitIndex, units.length - 1);
|
|
11832
|
-
const value = size / Math.pow(unit, finalUnitIndex);
|
|
11833
|
-
if (finalUnitIndex === 0) {
|
|
11834
|
-
return `${size} B`;
|
|
11835
|
-
}
|
|
11836
|
-
return `${value.toFixed(decimals)} ${units[finalUnitIndex]}`;
|
|
11837
|
-
}
|
|
11838
|
-
|
|
11839
|
-
// ../../internal/utils/src/social-profile-url.ts
|
|
11840
|
-
var social_profile_url_exports = {};
|
|
11841
|
-
__export(social_profile_url_exports, {
|
|
11842
|
-
LINKEDIN_PROFILE_URL_PATTERN: () => LINKEDIN_PROFILE_URL_PATTERN,
|
|
11843
|
-
TWITTER_PROFILE_URL_PATTERN: () => TWITTER_PROFILE_URL_PATTERN,
|
|
11844
|
-
isLinkedInProfileUrl: () => isLinkedInProfileUrl,
|
|
11845
|
-
isSupportedSocialProfileUrl: () => isSupportedSocialProfileUrl,
|
|
11846
|
-
isTwitterProfileUrl: () => isTwitterProfileUrl,
|
|
11847
|
-
parseLinkedInProfileUrl: () => parseLinkedInProfileUrl
|
|
11986
|
+
zod.z.object({
|
|
11987
|
+
organizations: zod.z.array(UserOrgSchema)
|
|
11848
11988
|
});
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
if (
|
|
11868
|
-
const pathSegment = (_a = match2[1]) == null ? void 0 : _a.toLowerCase();
|
|
11869
|
-
const rawHandle = match2[2];
|
|
11870
|
-
if (!pathSegment || !rawHandle) return null;
|
|
11871
|
-
let handle;
|
|
11989
|
+
|
|
11990
|
+
// ../../internal/validation/src/public/organization/metrics-get.ts
|
|
11991
|
+
var organizationMetricsIncludeFieldSchema = zod.z.enum([
|
|
11992
|
+
"reports",
|
|
11993
|
+
"newThreats",
|
|
11994
|
+
"threatsWatchlisted",
|
|
11995
|
+
"takedownsFiled",
|
|
11996
|
+
"takedownsCompleted",
|
|
11997
|
+
"domainThreats",
|
|
11998
|
+
"twitterThreats",
|
|
11999
|
+
"telegramThreats",
|
|
12000
|
+
"otherThreats",
|
|
12001
|
+
"blockedByType",
|
|
12002
|
+
"blockedByDay"
|
|
12003
|
+
]);
|
|
12004
|
+
organizationMetricsIncludeFieldSchema.options;
|
|
12005
|
+
var ORGANIZATION_METRICS_MAX_SLUGS = 500;
|
|
12006
|
+
var organizationMetricsServicesFilterSchema = zod.z.preprocess((value) => {
|
|
12007
|
+
if (typeof value !== "string") return value;
|
|
11872
12008
|
try {
|
|
11873
|
-
|
|
12009
|
+
return JSON.parse(value);
|
|
11874
12010
|
} catch (e4) {
|
|
11875
|
-
return
|
|
12011
|
+
return value;
|
|
11876
12012
|
}
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
12013
|
+
}, userOrgsServicesFilterObjectSchema).optional();
|
|
12014
|
+
zod.z.object({
|
|
12015
|
+
organizationSlug: zod.z.string().optional().describe(
|
|
12016
|
+
"Organization slug. Required when authenticating with a user session (Bearer token) and `slugs`/`allMyOrgs` are not supplied; ignored when using an org-scoped API key (org is derived from the key). Mutually exclusive with `slugs` and `allMyOrgs`."
|
|
12017
|
+
),
|
|
12018
|
+
slugs: zod.z.array(zod.z.string()).max(ORGANIZATION_METRICS_MAX_SLUGS).optional().describe(
|
|
12019
|
+
"Multi-org form. Each slug is auth-checked individually (org-scoped API keys may only pass their own org; sessions and user API keys must have membership or staff role per slug). When supplied with more than one slug, the response includes a `perOrg` breakdown plus `metrics` rolled up across all of them. Capped at " + String(ORGANIZATION_METRICS_MAX_SLUGS) + " slugs per call. Mutually exclusive with `organizationSlug` and `allMyOrgs`."
|
|
12020
|
+
),
|
|
12021
|
+
allMyOrgs: zod.z.preprocess((value) => {
|
|
12022
|
+
if (value === "true") return true;
|
|
12023
|
+
if (value === "false") return false;
|
|
12024
|
+
return value;
|
|
12025
|
+
}, zod.z.boolean()).optional().describe(
|
|
12026
|
+
"Shortcut for 'every org the caller is authorized to read'. Reuses the same filter logic as `/user/orgs`: org-scoped API keys are rejected (they're pinned to one org \u2014 use the default form); user API keys / Bearer sessions resolve to the user's memberships (or every active org for staff). Combine with `subscriptionStatus` and `services` to narrow (e.g. only paying customers with takedowns enabled). The resolved org set is still capped at " + String(ORGANIZATION_METRICS_MAX_SLUGS) + " and a 413 is returned if exceeded. Mutually exclusive with `organizationSlug`, `slugs`, and `brandSlug`."
|
|
12027
|
+
),
|
|
12028
|
+
subscriptionStatus: zod.z.array(UserOrgsSubscriptionStatusSchema).min(1).optional().describe(
|
|
12029
|
+
"Only meaningful with `allMyOrgs: true`. Defaults to the same set `/user/orgs` uses (ACTIVE/POC/PROSPECT/INTEGRATION \u2014 INACTIVE is always excluded)."
|
|
12030
|
+
),
|
|
12031
|
+
services: organizationMetricsServicesFilterSchema.describe(
|
|
12032
|
+
"Only meaningful with `allMyOrgs: true`. Same shape as `/user/orgs`'s `services` filter \u2014 every service accepts `{ active }`, and **only `takedowns` additionally accepts `automated`** (the one service where manual-vs-automated changes real platform behavior). E.g. `{ takedowns: { active: true, automated: false } }` for 'orgs with takedowns enabled but automation off'."
|
|
12033
|
+
),
|
|
12034
|
+
brandSlug: zod.z.string().optional(),
|
|
12035
|
+
startDate: zod.z.coerce.date().optional(),
|
|
12036
|
+
endDate: zod.z.coerce.date().optional(),
|
|
12037
|
+
include: zod.z.array(organizationMetricsIncludeFieldSchema).optional().describe(
|
|
12038
|
+
"Subset of metrics to compute. When omitted or empty, every metric is computed (legacy behavior). Each value in `include` costs roughly one Prisma aggregate, so narrow the list when an agent only needs a couple of numbers \u2014 this is the main lever for keeping big-org calls inside the 30s function cap. Fields not in `include` come back as `null`."
|
|
12039
|
+
)
|
|
12040
|
+
}).refine(
|
|
12041
|
+
(value) => {
|
|
12042
|
+
const explicitForms = [
|
|
12043
|
+
Boolean(value.organizationSlug),
|
|
12044
|
+
Boolean(value.slugs && value.slugs.length > 0),
|
|
12045
|
+
Boolean(value.allMyOrgs)
|
|
12046
|
+
].filter(Boolean).length;
|
|
12047
|
+
return explicitForms <= 1;
|
|
12048
|
+
},
|
|
12049
|
+
{
|
|
12050
|
+
message: "Pass at most one of `organizationSlug`, `slugs`, or `allMyOrgs`.",
|
|
12051
|
+
path: ["allMyOrgs"]
|
|
12052
|
+
}
|
|
12053
|
+
).refine((value) => !(value.brandSlug && value.slugs && value.slugs.length > 1), {
|
|
12054
|
+
message: "`brandSlug` is only valid alongside a single organization, not `slugs`.",
|
|
12055
|
+
path: ["brandSlug"]
|
|
12056
|
+
}).refine((value) => !(value.brandSlug && value.allMyOrgs), {
|
|
12057
|
+
message: "`brandSlug` is only valid for a single org, not `allMyOrgs`.",
|
|
12058
|
+
path: ["brandSlug"]
|
|
12059
|
+
});
|
|
12060
|
+
var metricValue = zod.z.number().nullable();
|
|
12061
|
+
var metricsObjectSchema = zod.z.object({
|
|
12062
|
+
reports: metricValue,
|
|
12063
|
+
newThreats: metricValue,
|
|
12064
|
+
threatsWatchlisted: metricValue,
|
|
12065
|
+
takedownsFiled: metricValue,
|
|
12066
|
+
takedownsCompleted: metricValue,
|
|
12067
|
+
domainThreats: metricValue,
|
|
12068
|
+
twitterThreats: metricValue,
|
|
12069
|
+
telegramThreats: metricValue,
|
|
12070
|
+
otherThreats: metricValue
|
|
12071
|
+
});
|
|
12072
|
+
var blockedByTypeSchema = zod.z.array(
|
|
12073
|
+
zod.z.object({
|
|
12074
|
+
type: zod.z.string(),
|
|
12075
|
+
count: zod.z.number()
|
|
12076
|
+
})
|
|
12077
|
+
).nullable();
|
|
12078
|
+
var blockedByDaySchema = zod.z.array(
|
|
12079
|
+
zod.z.object({
|
|
12080
|
+
date: zod.z.string(),
|
|
12081
|
+
count: zod.z.number()
|
|
12082
|
+
})
|
|
12083
|
+
).nullable();
|
|
12084
|
+
zod.z.object({
|
|
12085
|
+
/**
|
|
12086
|
+
* Aggregate metrics. For single-org callers this is just that org's
|
|
12087
|
+
* numbers; for multi-org callers (`slugs.length > 1` or `allMyOrgs`)
|
|
12088
|
+
* it is the sum across all queried orgs.
|
|
12089
|
+
*/
|
|
12090
|
+
metrics: metricsObjectSchema,
|
|
12091
|
+
blockedByType: blockedByTypeSchema,
|
|
12092
|
+
blockedByDay: blockedByDaySchema,
|
|
12093
|
+
/**
|
|
12094
|
+
* Derived averages over the time window (and, in multi-org mode,
|
|
12095
|
+
* across orgs). `perDay = metrics / windowDays`. In multi-org mode
|
|
12096
|
+
* `perOrgPerDay = metrics / numOrgs / windowDays`; in single-org
|
|
12097
|
+
* mode it is `null`. Counts are floats here — the underlying
|
|
12098
|
+
* `metrics` fields stay integer counts.
|
|
12099
|
+
*/
|
|
12100
|
+
averages: zod.z.object({
|
|
12101
|
+
perDay: metricsObjectSchema.nullable(),
|
|
12102
|
+
perOrgPerDay: metricsObjectSchema.nullable(),
|
|
12103
|
+
windowDays: zod.z.number().nullable()
|
|
12104
|
+
}),
|
|
12105
|
+
/**
|
|
12106
|
+
* Per-org breakdown. Only populated in multi-org mode; `null` for
|
|
12107
|
+
* single-org callers.
|
|
12108
|
+
*/
|
|
12109
|
+
perOrg: zod.z.record(
|
|
12110
|
+
zod.z.string(),
|
|
12111
|
+
zod.z.object({
|
|
12112
|
+
metrics: metricsObjectSchema,
|
|
12113
|
+
blockedByType: blockedByTypeSchema,
|
|
12114
|
+
blockedByDay: blockedByDaySchema
|
|
12115
|
+
})
|
|
12116
|
+
).nullable(),
|
|
12117
|
+
/**
|
|
12118
|
+
* Echoes the actual orgs the response covers, in the order they
|
|
12119
|
+
* were resolved. Single-org responses always have length 1. The
|
|
12120
|
+
* `resolvedFrom` field distinguishes how the caller asked for the
|
|
12121
|
+
* scope (useful for agent reporting).
|
|
12122
|
+
*/
|
|
12123
|
+
scope: zod.z.object({
|
|
12124
|
+
mode: zod.z.enum(["single", "multi"]),
|
|
12125
|
+
orgs: zod.z.array(zod.z.string()),
|
|
12126
|
+
resolvedFrom: zod.z.enum(["api-key", "organizationSlug", "slugs", "allMyOrgs"])
|
|
12127
|
+
})
|
|
12128
|
+
});
|
|
11884
12129
|
var BASE_64_PATTERN = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
11885
12130
|
var PHONE_COUNTRY_CODE_ERROR_MESSAGE = "Phone numbers must include a country code in E.164 format (for example, +14155552671).";
|
|
11886
12131
|
function isPhoneNumberMissingCountryCode(value) {
|
|
@@ -13201,20 +13446,20 @@ var convertA98ToXyz65_default = convertA98ToXyz65;
|
|
|
13201
13446
|
|
|
13202
13447
|
// ../../node_modules/culori/src/a98/convertXyz65ToA98.js
|
|
13203
13448
|
var gamma = (v) => Math.pow(Math.abs(v), 256 / 563) * Math.sign(v);
|
|
13204
|
-
var convertXyz65ToA98 = ({ x, y, z:
|
|
13449
|
+
var convertXyz65ToA98 = ({ x, y, z: z55, alpha }) => {
|
|
13205
13450
|
if (x === void 0) x = 0;
|
|
13206
13451
|
if (y === void 0) y = 0;
|
|
13207
|
-
if (
|
|
13452
|
+
if (z55 === void 0) z55 = 0;
|
|
13208
13453
|
let res = {
|
|
13209
13454
|
mode: "a98",
|
|
13210
13455
|
r: gamma(
|
|
13211
|
-
x * 2.0415879038107465 - y * 0.5650069742788597 - 0.3447313507783297 *
|
|
13456
|
+
x * 2.0415879038107465 - y * 0.5650069742788597 - 0.3447313507783297 * z55
|
|
13212
13457
|
),
|
|
13213
13458
|
g: gamma(
|
|
13214
|
-
x * -0.9692436362808798 + y * 1.8759675015077206 + 0.0415550574071756 *
|
|
13459
|
+
x * -0.9692436362808798 + y * 1.8759675015077206 + 0.0415550574071756 * z55
|
|
13215
13460
|
),
|
|
13216
13461
|
b: gamma(
|
|
13217
|
-
x * 0.0134442806320312 - y * 0.1183623922310184 + 1.0151749943912058 *
|
|
13462
|
+
x * 0.0134442806320312 - y * 0.1183623922310184 + 1.0151749943912058 * z55
|
|
13218
13463
|
)
|
|
13219
13464
|
};
|
|
13220
13465
|
if (alpha !== void 0) {
|
|
@@ -13281,14 +13526,14 @@ var convertLrgbToRgb = ({ r, g, b, alpha }, mode = "rgb") => {
|
|
|
13281
13526
|
var convertLrgbToRgb_default = convertLrgbToRgb;
|
|
13282
13527
|
|
|
13283
13528
|
// ../../node_modules/culori/src/xyz65/convertXyz65ToRgb.js
|
|
13284
|
-
var convertXyz65ToRgb = ({ x, y, z:
|
|
13529
|
+
var convertXyz65ToRgb = ({ x, y, z: z55, alpha }) => {
|
|
13285
13530
|
if (x === void 0) x = 0;
|
|
13286
13531
|
if (y === void 0) y = 0;
|
|
13287
|
-
if (
|
|
13532
|
+
if (z55 === void 0) z55 = 0;
|
|
13288
13533
|
let res = convertLrgbToRgb_default({
|
|
13289
|
-
r: x * 3.2409699419045226 - y * 1.537383177570094 - 0.4986107602930034 *
|
|
13290
|
-
g: x * -0.9692436362808796 + y * 1.8759675015077204 + 0.0415550574071756 *
|
|
13291
|
-
b: x * 0.0556300796969936 - y * 0.2039769588889765 + 1.0569715142428784 *
|
|
13534
|
+
r: x * 3.2409699419045226 - y * 1.537383177570094 - 0.4986107602930034 * z55,
|
|
13535
|
+
g: x * -0.9692436362808796 + y * 1.8759675015077204 + 0.0415550574071756 * z55,
|
|
13536
|
+
b: x * 0.0556300796969936 - y * 0.2039769588889765 + 1.0569715142428784 * z55
|
|
13292
13537
|
});
|
|
13293
13538
|
if (alpha !== void 0) {
|
|
13294
13539
|
res.alpha = alpha;
|
|
@@ -13538,13 +13783,13 @@ var convertLab65ToRgb_default = convertLab65ToRgb;
|
|
|
13538
13783
|
|
|
13539
13784
|
// ../../node_modules/culori/src/lab65/convertXyz65ToLab65.js
|
|
13540
13785
|
var f = (value) => value > e ? Math.cbrt(value) : (k * value + 16) / 116;
|
|
13541
|
-
var convertXyz65ToLab65 = ({ x, y, z:
|
|
13786
|
+
var convertXyz65ToLab65 = ({ x, y, z: z55, alpha }) => {
|
|
13542
13787
|
if (x === void 0) x = 0;
|
|
13543
13788
|
if (y === void 0) y = 0;
|
|
13544
|
-
if (
|
|
13789
|
+
if (z55 === void 0) z55 = 0;
|
|
13545
13790
|
let f0 = f(x / D65.X);
|
|
13546
13791
|
let f1 = f(y / D65.Y);
|
|
13547
|
-
let f22 = f(
|
|
13792
|
+
let f22 = f(z55 / D65.Z);
|
|
13548
13793
|
let res = {
|
|
13549
13794
|
mode: "lab65",
|
|
13550
13795
|
l: 116 * f1 - 16,
|
|
@@ -14201,10 +14446,10 @@ var convertItpToXyz65_default = convertItpToXyz65;
|
|
|
14201
14446
|
|
|
14202
14447
|
// ../../node_modules/culori/src/itp/convertXyz65ToItp.js
|
|
14203
14448
|
var toAbs = (c2 = 0) => Math.max(c2 * YW, 0);
|
|
14204
|
-
var convertXyz65ToItp = ({ x, y, z:
|
|
14449
|
+
var convertXyz65ToItp = ({ x, y, z: z55, alpha }) => {
|
|
14205
14450
|
const absX = toAbs(x);
|
|
14206
14451
|
const absY = toAbs(y);
|
|
14207
|
-
const absZ = toAbs(
|
|
14452
|
+
const absZ = toAbs(z55);
|
|
14208
14453
|
const l2 = transferPqEncode(
|
|
14209
14454
|
0.3592832590121217 * absX + 0.6976051147779502 * absY - 0.0358915932320289 * absZ
|
|
14210
14455
|
);
|
|
@@ -14262,15 +14507,15 @@ var jabPqEncode = (v) => {
|
|
|
14262
14507
|
return Math.pow((C1 + C2 * vn3) / (1 + C3 * vn3), p);
|
|
14263
14508
|
};
|
|
14264
14509
|
var abs = (v = 0) => Math.max(v * 203, 0);
|
|
14265
|
-
var convertXyz65ToJab = ({ x, y, z:
|
|
14510
|
+
var convertXyz65ToJab = ({ x, y, z: z55, alpha }) => {
|
|
14266
14511
|
x = abs(x);
|
|
14267
14512
|
y = abs(y);
|
|
14268
|
-
|
|
14269
|
-
let xp = 1.15 * x - 0.15 *
|
|
14513
|
+
z55 = abs(z55);
|
|
14514
|
+
let xp = 1.15 * x - 0.15 * z55;
|
|
14270
14515
|
let yp = 0.66 * y + 0.34 * x;
|
|
14271
|
-
let l2 = jabPqEncode(0.41478972 * xp + 0.579999 * yp + 0.014648 *
|
|
14272
|
-
let m = jabPqEncode(-0.20151 * xp + 1.120649 * yp + 0.0531008 *
|
|
14273
|
-
let s2 = jabPqEncode(-0.0166008 * xp + 0.2648 * yp + 0.6684799 *
|
|
14516
|
+
let l2 = jabPqEncode(0.41478972 * xp + 0.579999 * yp + 0.014648 * z55);
|
|
14517
|
+
let m = jabPqEncode(-0.20151 * xp + 1.120649 * yp + 0.0531008 * z55);
|
|
14518
|
+
let s2 = jabPqEncode(-0.0166008 * xp + 0.2648 * yp + 0.6684799 * z55);
|
|
14274
14519
|
let i = (l2 + m) / 2;
|
|
14275
14520
|
let res = {
|
|
14276
14521
|
mode: "jab",
|
|
@@ -14456,14 +14701,14 @@ var convertLabToXyz50 = ({ l: l2, a, b, alpha }) => {
|
|
|
14456
14701
|
var convertLabToXyz50_default = convertLabToXyz50;
|
|
14457
14702
|
|
|
14458
14703
|
// ../../node_modules/culori/src/xyz50/convertXyz50ToRgb.js
|
|
14459
|
-
var convertXyz50ToRgb = ({ x, y, z:
|
|
14704
|
+
var convertXyz50ToRgb = ({ x, y, z: z55, alpha }) => {
|
|
14460
14705
|
if (x === void 0) x = 0;
|
|
14461
14706
|
if (y === void 0) y = 0;
|
|
14462
|
-
if (
|
|
14707
|
+
if (z55 === void 0) z55 = 0;
|
|
14463
14708
|
let res = convertLrgbToRgb_default({
|
|
14464
|
-
r: x * 3.1341359569958707 - y * 1.6173863321612538 - 0.4906619460083532 *
|
|
14465
|
-
g: x * -0.978795502912089 + y * 1.916254567259524 + 0.03344273116131949 *
|
|
14466
|
-
b: x * 0.07195537988411677 - y * 0.2289768264158322 + 1.405386058324125 *
|
|
14709
|
+
r: x * 3.1341359569958707 - y * 1.6173863321612538 - 0.4906619460083532 * z55,
|
|
14710
|
+
g: x * -0.978795502912089 + y * 1.916254567259524 + 0.03344273116131949 * z55,
|
|
14711
|
+
b: x * 0.07195537988411677 - y * 0.2289768264158322 + 1.405386058324125 * z55
|
|
14467
14712
|
});
|
|
14468
14713
|
if (alpha !== void 0) {
|
|
14469
14714
|
res.alpha = alpha;
|
|
@@ -14494,13 +14739,13 @@ var convertRgbToXyz50_default = convertRgbToXyz50;
|
|
|
14494
14739
|
|
|
14495
14740
|
// ../../node_modules/culori/src/lab/convertXyz50ToLab.js
|
|
14496
14741
|
var f2 = (value) => value > e3 ? Math.cbrt(value) : (k3 * value + 16) / 116;
|
|
14497
|
-
var convertXyz50ToLab = ({ x, y, z:
|
|
14742
|
+
var convertXyz50ToLab = ({ x, y, z: z55, alpha }) => {
|
|
14498
14743
|
if (x === void 0) x = 0;
|
|
14499
14744
|
if (y === void 0) y = 0;
|
|
14500
|
-
if (
|
|
14745
|
+
if (z55 === void 0) z55 = 0;
|
|
14501
14746
|
let f0 = f2(x / D50.X);
|
|
14502
14747
|
let f1 = f2(y / D50.Y);
|
|
14503
|
-
let f22 = f2(
|
|
14748
|
+
let f22 = f2(z55 / D50.Z);
|
|
14504
14749
|
let res = {
|
|
14505
14750
|
mode: "lab",
|
|
14506
14751
|
l: 116 * f1 - 16,
|
|
@@ -14735,18 +14980,18 @@ var convertLchuvToLuv = ({ l: l2, c: c2, h, alpha }) => {
|
|
|
14735
14980
|
var convertLchuvToLuv_default = convertLchuvToLuv;
|
|
14736
14981
|
|
|
14737
14982
|
// ../../node_modules/culori/src/luv/convertXyz50ToLuv.js
|
|
14738
|
-
var u_fn = (x, y,
|
|
14739
|
-
var v_fn = (x, y,
|
|
14983
|
+
var u_fn = (x, y, z55) => 4 * x / (x + 15 * y + 3 * z55);
|
|
14984
|
+
var v_fn = (x, y, z55) => 9 * y / (x + 15 * y + 3 * z55);
|
|
14740
14985
|
var un = u_fn(D50.X, D50.Y, D50.Z);
|
|
14741
14986
|
var vn = v_fn(D50.X, D50.Y, D50.Z);
|
|
14742
14987
|
var l_fn = (value) => value <= e3 ? k3 * value : 116 * Math.cbrt(value) - 16;
|
|
14743
|
-
var convertXyz50ToLuv = ({ x, y, z:
|
|
14988
|
+
var convertXyz50ToLuv = ({ x, y, z: z55, alpha }) => {
|
|
14744
14989
|
if (x === void 0) x = 0;
|
|
14745
14990
|
if (y === void 0) y = 0;
|
|
14746
|
-
if (
|
|
14991
|
+
if (z55 === void 0) z55 = 0;
|
|
14747
14992
|
let l2 = l_fn(y / D50.Y);
|
|
14748
|
-
let u = u_fn(x, y,
|
|
14749
|
-
let v = v_fn(x, y,
|
|
14993
|
+
let u = u_fn(x, y, z55);
|
|
14994
|
+
let v = v_fn(x, y, z55);
|
|
14750
14995
|
if (!isFinite(u) || !isFinite(v)) {
|
|
14751
14996
|
l2 = u = v = 0;
|
|
14752
14997
|
} else {
|
|
@@ -14767,8 +15012,8 @@ var convertXyz50ToLuv = ({ x, y, z: z50, alpha }) => {
|
|
|
14767
15012
|
var convertXyz50ToLuv_default = convertXyz50ToLuv;
|
|
14768
15013
|
|
|
14769
15014
|
// ../../node_modules/culori/src/luv/convertLuvToXyz50.js
|
|
14770
|
-
var u_fn2 = (x, y,
|
|
14771
|
-
var v_fn2 = (x, y,
|
|
15015
|
+
var u_fn2 = (x, y, z55) => 4 * x / (x + 15 * y + 3 * z55);
|
|
15016
|
+
var v_fn2 = (x, y, z55) => 9 * y / (x + 15 * y + 3 * z55);
|
|
14772
15017
|
var un2 = u_fn2(D50.X, D50.Y, D50.Z);
|
|
14773
15018
|
var vn2 = v_fn2(D50.X, D50.Y, D50.Z);
|
|
14774
15019
|
var convertLuvToXyz50 = ({ l: l2, u, v, alpha }) => {
|
|
@@ -14782,8 +15027,8 @@ var convertLuvToXyz50 = ({ l: l2, u, v, alpha }) => {
|
|
|
14782
15027
|
let vp = v / (13 * l2) + vn2;
|
|
14783
15028
|
let y = D50.Y * (l2 <= 8 ? l2 / k3 : Math.pow((l2 + 16) / 116, 3));
|
|
14784
15029
|
let x = y * (9 * up) / (4 * vp);
|
|
14785
|
-
let
|
|
14786
|
-
let res = { mode: "xyz50", x, y, z:
|
|
15030
|
+
let z55 = y * (12 - 3 * up - 20 * vp) / (4 * vp);
|
|
15031
|
+
let res = { mode: "xyz50", x, y, z: z55 };
|
|
14787
15032
|
if (alpha !== void 0) {
|
|
14788
15033
|
res.alpha = alpha;
|
|
14789
15034
|
}
|
|
@@ -15400,15 +15645,15 @@ var convertP3ToXyz65 = (rgb2) => {
|
|
|
15400
15645
|
var convertP3ToXyz65_default = convertP3ToXyz65;
|
|
15401
15646
|
|
|
15402
15647
|
// ../../node_modules/culori/src/p3/convertXyz65ToP3.js
|
|
15403
|
-
var convertXyz65ToP3 = ({ x, y, z:
|
|
15648
|
+
var convertXyz65ToP3 = ({ x, y, z: z55, alpha }) => {
|
|
15404
15649
|
if (x === void 0) x = 0;
|
|
15405
15650
|
if (y === void 0) y = 0;
|
|
15406
|
-
if (
|
|
15651
|
+
if (z55 === void 0) z55 = 0;
|
|
15407
15652
|
let res = convertLrgbToRgb_default(
|
|
15408
15653
|
{
|
|
15409
|
-
r: x * 2.4934969119414263 - y * 0.9313836179191242 - 0.402710784450717 *
|
|
15410
|
-
g: x * -0.8294889695615749 + y * 1.7626640603183465 + 0.0236246858419436 *
|
|
15411
|
-
b: x * 0.0358458302437845 - y * 0.0761723892680418 + 0.9568845240076871 *
|
|
15654
|
+
r: x * 2.4934969119414263 - y * 0.9313836179191242 - 0.402710784450717 * z55,
|
|
15655
|
+
g: x * -0.8294889695615749 + y * 1.7626640603183465 + 0.0236246858419436 * z55,
|
|
15656
|
+
b: x * 0.0358458302437845 - y * 0.0761723892680418 + 0.9568845240076871 * z55
|
|
15412
15657
|
},
|
|
15413
15658
|
"p3"
|
|
15414
15659
|
);
|
|
@@ -15443,19 +15688,19 @@ var gamma2 = (v) => {
|
|
|
15443
15688
|
}
|
|
15444
15689
|
return 16 * v;
|
|
15445
15690
|
};
|
|
15446
|
-
var convertXyz50ToProphoto = ({ x, y, z:
|
|
15691
|
+
var convertXyz50ToProphoto = ({ x, y, z: z55, alpha }) => {
|
|
15447
15692
|
if (x === void 0) x = 0;
|
|
15448
15693
|
if (y === void 0) y = 0;
|
|
15449
|
-
if (
|
|
15694
|
+
if (z55 === void 0) z55 = 0;
|
|
15450
15695
|
let res = {
|
|
15451
15696
|
mode: "prophoto",
|
|
15452
15697
|
r: gamma2(
|
|
15453
|
-
x * 1.3457868816471585 - y * 0.2555720873797946 - 0.0511018649755453 *
|
|
15698
|
+
x * 1.3457868816471585 - y * 0.2555720873797946 - 0.0511018649755453 * z55
|
|
15454
15699
|
),
|
|
15455
15700
|
g: gamma2(
|
|
15456
|
-
x * -0.5446307051249019 + y * 1.5082477428451466 + 0.0205274474364214 *
|
|
15701
|
+
x * -0.5446307051249019 + y * 1.5082477428451466 + 0.0205274474364214 * z55
|
|
15457
15702
|
),
|
|
15458
|
-
b: gamma2(x * 0 + y * 0 + 1.2119675456389452 *
|
|
15703
|
+
b: gamma2(x * 0 + y * 0 + 1.2119675456389452 * z55)
|
|
15459
15704
|
};
|
|
15460
15705
|
if (alpha !== void 0) {
|
|
15461
15706
|
res.alpha = alpha;
|
|
@@ -15515,20 +15760,20 @@ var gamma3 = (v) => {
|
|
|
15515
15760
|
}
|
|
15516
15761
|
return 4.5 * v;
|
|
15517
15762
|
};
|
|
15518
|
-
var convertXyz65ToRec2020 = ({ x, y, z:
|
|
15763
|
+
var convertXyz65ToRec2020 = ({ x, y, z: z55, alpha }) => {
|
|
15519
15764
|
if (x === void 0) x = 0;
|
|
15520
15765
|
if (y === void 0) y = 0;
|
|
15521
|
-
if (
|
|
15766
|
+
if (z55 === void 0) z55 = 0;
|
|
15522
15767
|
let res = {
|
|
15523
15768
|
mode: "rec2020",
|
|
15524
15769
|
r: gamma3(
|
|
15525
|
-
x * 1.7166511879712683 - y * 0.3556707837763925 - 0.2533662813736599 *
|
|
15770
|
+
x * 1.7166511879712683 - y * 0.3556707837763925 - 0.2533662813736599 * z55
|
|
15526
15771
|
),
|
|
15527
15772
|
g: gamma3(
|
|
15528
|
-
x * -0.6666843518324893 + y * 1.6164812366349395 + 0.0157685458139111 *
|
|
15773
|
+
x * -0.6666843518324893 + y * 1.6164812366349395 + 0.0157685458139111 * z55
|
|
15529
15774
|
),
|
|
15530
15775
|
b: gamma3(
|
|
15531
|
-
x * 0.0176398574453108 - y * 0.0427706132578085 + 0.9421031212354739 *
|
|
15776
|
+
x * 0.0176398574453108 - y * 0.0427706132578085 + 0.9421031212354739 * z55
|
|
15532
15777
|
)
|
|
15533
15778
|
};
|
|
15534
15779
|
if (alpha !== void 0) {
|
|
@@ -15681,15 +15926,15 @@ var definition_default26 = definition26;
|
|
|
15681
15926
|
|
|
15682
15927
|
// ../../node_modules/culori/src/xyz65/convertXyz65ToXyz50.js
|
|
15683
15928
|
var convertXyz65ToXyz50 = (xyz652) => {
|
|
15684
|
-
let { x, y, z:
|
|
15929
|
+
let { x, y, z: z55, alpha } = xyz652;
|
|
15685
15930
|
if (x === void 0) x = 0;
|
|
15686
15931
|
if (y === void 0) y = 0;
|
|
15687
|
-
if (
|
|
15932
|
+
if (z55 === void 0) z55 = 0;
|
|
15688
15933
|
let res = {
|
|
15689
15934
|
mode: "xyz50",
|
|
15690
|
-
x: 1.0479298208405488 * x + 0.0229467933410191 * y - 0.0501922295431356 *
|
|
15691
|
-
y: 0.0296278156881593 * x + 0.990434484573249 * y - 0.0170738250293851 *
|
|
15692
|
-
z: -0.0092430581525912 * x + 0.0150551448965779 * y + 0.7518742899580008 *
|
|
15935
|
+
x: 1.0479298208405488 * x + 0.0229467933410191 * y - 0.0501922295431356 * z55,
|
|
15936
|
+
y: 0.0296278156881593 * x + 0.990434484573249 * y - 0.0170738250293851 * z55,
|
|
15937
|
+
z: -0.0092430581525912 * x + 0.0150551448965779 * y + 0.7518742899580008 * z55
|
|
15693
15938
|
};
|
|
15694
15939
|
if (alpha !== void 0) {
|
|
15695
15940
|
res.alpha = alpha;
|
|
@@ -15700,15 +15945,15 @@ var convertXyz65ToXyz50_default = convertXyz65ToXyz50;
|
|
|
15700
15945
|
|
|
15701
15946
|
// ../../node_modules/culori/src/xyz65/convertXyz50ToXyz65.js
|
|
15702
15947
|
var convertXyz50ToXyz65 = (xyz502) => {
|
|
15703
|
-
let { x, y, z:
|
|
15948
|
+
let { x, y, z: z55, alpha } = xyz502;
|
|
15704
15949
|
if (x === void 0) x = 0;
|
|
15705
15950
|
if (y === void 0) y = 0;
|
|
15706
|
-
if (
|
|
15951
|
+
if (z55 === void 0) z55 = 0;
|
|
15707
15952
|
let res = {
|
|
15708
15953
|
mode: "xyz65",
|
|
15709
|
-
x: 0.9554734527042182 * x - 0.0230985368742614 * y + 0.0632593086610217 *
|
|
15710
|
-
y: -0.0283697069632081 * x + 1.0099954580058226 * y + 0.021041398966943 *
|
|
15711
|
-
z: 0.0123140016883199 * x - 0.0205076964334779 * y + 1.3303659366080753 *
|
|
15954
|
+
x: 0.9554734527042182 * x - 0.0230985368742614 * y + 0.0632593086610217 * z55,
|
|
15955
|
+
y: -0.0283697069632081 * x + 1.0099954580058226 * y + 0.021041398966943 * z55,
|
|
15956
|
+
z: 0.0123140016883199 * x - 0.0205076964334779 * y + 1.3303659366080753 * z55
|
|
15712
15957
|
};
|
|
15713
15958
|
if (alpha !== void 0) {
|
|
15714
15959
|
res.alpha = alpha;
|