@chainpatrol/sdk 0.3.0 → 0.4.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/dist/index.d.ts +9 -1
- package/dist/index.js +39 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,14 @@ type ApiRequest = {
|
|
|
54
54
|
};
|
|
55
55
|
type AssetType = "URL" | "PAGE" | "ADDRESS";
|
|
56
56
|
type AssetStatus = "ALLOWED" | "BLOCKED" | "UNKNOWN";
|
|
57
|
+
declare class ChainPatrolClientError extends Error {
|
|
58
|
+
readonly code: ChainPatrolClientErrorCodes;
|
|
59
|
+
constructor(message: string, code: ChainPatrolClientErrorCodes);
|
|
60
|
+
}
|
|
61
|
+
declare enum ChainPatrolClientErrorCodes {
|
|
62
|
+
MISSING_API_KEY = "MISSING_API_KEY",
|
|
63
|
+
API_ERROR = "API_ERROR"
|
|
64
|
+
}
|
|
57
65
|
declare class ChainPatrolClient {
|
|
58
66
|
readonly baseUrl: string;
|
|
59
67
|
private readonly apiKey;
|
|
@@ -208,4 +216,4 @@ declare namespace index {
|
|
|
208
216
|
};
|
|
209
217
|
}
|
|
210
218
|
|
|
211
|
-
export { AssetStatus, AssetType, ChainPatrolClient, ChainPatrolClientOptions, DetectorAssetStatus, DomainParseError, EventData, Events, Relay, index as Storage, ThreatDetector, URLResult };
|
|
219
|
+
export { AssetStatus, AssetType, ChainPatrolClient, ChainPatrolClientError, ChainPatrolClientErrorCodes, ChainPatrolClientOptions, DetectorAssetStatus, DomainParseError, EventData, Events, Relay, index as Storage, ThreatDetector, URLResult };
|
package/dist/index.js
CHANGED
|
@@ -479,7 +479,7 @@ zod.z.object({
|
|
|
479
479
|
description: zod.z.string().optional().default("")
|
|
480
480
|
});
|
|
481
481
|
|
|
482
|
-
// ../../node_modules/luxon/src/errors.js
|
|
482
|
+
// ../../internal/validation/node_modules/luxon/src/errors.js
|
|
483
483
|
var LuxonError = class extends Error {
|
|
484
484
|
};
|
|
485
485
|
var InvalidDateTimeError = class extends LuxonError {
|
|
@@ -512,7 +512,7 @@ var ZoneIsAbstractError = class extends LuxonError {
|
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
514
|
|
|
515
|
-
// ../../node_modules/luxon/src/impl/formats.js
|
|
515
|
+
// ../../internal/validation/node_modules/luxon/src/impl/formats.js
|
|
516
516
|
var n = "numeric";
|
|
517
517
|
var s = "short";
|
|
518
518
|
var l = "long";
|
|
@@ -664,7 +664,7 @@ var DATETIME_HUGE_WITH_SECONDS = {
|
|
|
664
664
|
timeZoneName: l
|
|
665
665
|
};
|
|
666
666
|
|
|
667
|
-
// ../../node_modules/luxon/src/impl/util.js
|
|
667
|
+
// ../../internal/validation/node_modules/luxon/src/impl/util.js
|
|
668
668
|
function isUndefined(o) {
|
|
669
669
|
return typeof o === "undefined";
|
|
670
670
|
}
|
|
@@ -856,7 +856,7 @@ function timeObject(obj) {
|
|
|
856
856
|
}
|
|
857
857
|
var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
|
|
858
858
|
|
|
859
|
-
// ../../node_modules/luxon/src/impl/english.js
|
|
859
|
+
// ../../internal/validation/node_modules/luxon/src/impl/english.js
|
|
860
860
|
var monthsLong = [
|
|
861
861
|
"January",
|
|
862
862
|
"February",
|
|
@@ -982,7 +982,7 @@ function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
|
|
|
982
982
|
return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
|
|
983
983
|
}
|
|
984
984
|
|
|
985
|
-
// ../../node_modules/luxon/src/impl/formatter.js
|
|
985
|
+
// ../../internal/validation/node_modules/luxon/src/impl/formatter.js
|
|
986
986
|
function stringifyTokens(splits, tokenToString) {
|
|
987
987
|
let s2 = "";
|
|
988
988
|
for (const token of splits) {
|
|
@@ -1260,7 +1260,7 @@ var Formatter = class _Formatter {
|
|
|
1260
1260
|
}
|
|
1261
1261
|
};
|
|
1262
1262
|
|
|
1263
|
-
// ../../node_modules/luxon/src/impl/invalid.js
|
|
1263
|
+
// ../../internal/validation/node_modules/luxon/src/impl/invalid.js
|
|
1264
1264
|
var Invalid = class {
|
|
1265
1265
|
constructor(reason, explanation) {
|
|
1266
1266
|
this.reason = reason;
|
|
@@ -1275,7 +1275,7 @@ var Invalid = class {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
};
|
|
1277
1277
|
|
|
1278
|
-
// ../../node_modules/luxon/src/zone.js
|
|
1278
|
+
// ../../internal/validation/node_modules/luxon/src/zone.js
|
|
1279
1279
|
var Zone = class {
|
|
1280
1280
|
/**
|
|
1281
1281
|
* The type of zone
|
|
@@ -1355,7 +1355,7 @@ var Zone = class {
|
|
|
1355
1355
|
}
|
|
1356
1356
|
};
|
|
1357
1357
|
|
|
1358
|
-
// ../../node_modules/luxon/src/zones/systemZone.js
|
|
1358
|
+
// ../../internal/validation/node_modules/luxon/src/zones/systemZone.js
|
|
1359
1359
|
var singleton = null;
|
|
1360
1360
|
var SystemZone = class _SystemZone extends Zone {
|
|
1361
1361
|
/**
|
|
@@ -1402,7 +1402,7 @@ var SystemZone = class _SystemZone extends Zone {
|
|
|
1402
1402
|
}
|
|
1403
1403
|
};
|
|
1404
1404
|
|
|
1405
|
-
// ../../node_modules/luxon/src/zones/IANAZone.js
|
|
1405
|
+
// ../../internal/validation/node_modules/luxon/src/zones/IANAZone.js
|
|
1406
1406
|
var dtfCache = {};
|
|
1407
1407
|
function makeDTF(zone) {
|
|
1408
1408
|
if (!dtfCache[zone]) {
|
|
@@ -1557,7 +1557,7 @@ var IANAZone = class _IANAZone extends Zone {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
};
|
|
1559
1559
|
|
|
1560
|
-
// ../../node_modules/luxon/src/zones/fixedOffsetZone.js
|
|
1560
|
+
// ../../internal/validation/node_modules/luxon/src/zones/fixedOffsetZone.js
|
|
1561
1561
|
var singleton2 = null;
|
|
1562
1562
|
var FixedOffsetZone = class _FixedOffsetZone extends Zone {
|
|
1563
1563
|
/**
|
|
@@ -1640,7 +1640,7 @@ var FixedOffsetZone = class _FixedOffsetZone extends Zone {
|
|
|
1640
1640
|
}
|
|
1641
1641
|
};
|
|
1642
1642
|
|
|
1643
|
-
// ../../node_modules/luxon/src/zones/invalidZone.js
|
|
1643
|
+
// ../../internal/validation/node_modules/luxon/src/zones/invalidZone.js
|
|
1644
1644
|
var InvalidZone = class extends Zone {
|
|
1645
1645
|
constructor(zoneName) {
|
|
1646
1646
|
super();
|
|
@@ -1680,7 +1680,7 @@ var InvalidZone = class extends Zone {
|
|
|
1680
1680
|
}
|
|
1681
1681
|
};
|
|
1682
1682
|
|
|
1683
|
-
// ../../node_modules/luxon/src/impl/zoneUtil.js
|
|
1683
|
+
// ../../internal/validation/node_modules/luxon/src/impl/zoneUtil.js
|
|
1684
1684
|
function normalizeZone(input, defaultZone2) {
|
|
1685
1685
|
if (isUndefined(input) || input === null) {
|
|
1686
1686
|
return defaultZone2;
|
|
@@ -1705,7 +1705,7 @@ function normalizeZone(input, defaultZone2) {
|
|
|
1705
1705
|
}
|
|
1706
1706
|
}
|
|
1707
1707
|
|
|
1708
|
-
// ../../node_modules/luxon/src/settings.js
|
|
1708
|
+
// ../../internal/validation/node_modules/luxon/src/settings.js
|
|
1709
1709
|
var now = () => Date.now();
|
|
1710
1710
|
var defaultZone = "system";
|
|
1711
1711
|
var defaultLocale = null;
|
|
@@ -1812,7 +1812,7 @@ var Settings = class {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
};
|
|
1814
1814
|
|
|
1815
|
-
// ../../node_modules/luxon/src/impl/locale.js
|
|
1815
|
+
// ../../internal/validation/node_modules/luxon/src/impl/locale.js
|
|
1816
1816
|
var intlLFCache = {};
|
|
1817
1817
|
function getCachedLF(locString, opts = {}) {
|
|
1818
1818
|
const key = JSON.stringify([locString, opts]);
|
|
@@ -2144,7 +2144,7 @@ var Locale = class _Locale {
|
|
|
2144
2144
|
}
|
|
2145
2145
|
};
|
|
2146
2146
|
|
|
2147
|
-
// ../../node_modules/luxon/src/impl/regexParser.js
|
|
2147
|
+
// ../../internal/validation/node_modules/luxon/src/impl/regexParser.js
|
|
2148
2148
|
function combineRegexes(...regexes) {
|
|
2149
2149
|
const full = regexes.reduce((f, r) => f + r.source, "");
|
|
2150
2150
|
return RegExp(`^${full}$`);
|
|
@@ -2379,7 +2379,7 @@ function parseSQL(s2) {
|
|
|
2379
2379
|
);
|
|
2380
2380
|
}
|
|
2381
2381
|
|
|
2382
|
-
// ../../node_modules/luxon/src/duration.js
|
|
2382
|
+
// ../../internal/validation/node_modules/luxon/src/duration.js
|
|
2383
2383
|
var INVALID = "Invalid Duration";
|
|
2384
2384
|
var lowOrderMatrix = {
|
|
2385
2385
|
weeks: {
|
|
@@ -3174,7 +3174,7 @@ var Duration = class _Duration {
|
|
|
3174
3174
|
}
|
|
3175
3175
|
};
|
|
3176
3176
|
|
|
3177
|
-
// ../../node_modules/luxon/src/interval.js
|
|
3177
|
+
// ../../internal/validation/node_modules/luxon/src/interval.js
|
|
3178
3178
|
var INVALID2 = "Invalid Interval";
|
|
3179
3179
|
function validateStartEnd(start, end) {
|
|
3180
3180
|
if (!start || !start.isValid) {
|
|
@@ -3687,7 +3687,7 @@ var Interval = class _Interval {
|
|
|
3687
3687
|
}
|
|
3688
3688
|
};
|
|
3689
3689
|
|
|
3690
|
-
// ../../node_modules/luxon/src/info.js
|
|
3690
|
+
// ../../internal/validation/node_modules/luxon/src/info.js
|
|
3691
3691
|
var Info = class {
|
|
3692
3692
|
/**
|
|
3693
3693
|
* Return whether the specified zone contains a DST.
|
|
@@ -3828,7 +3828,7 @@ var Info = class {
|
|
|
3828
3828
|
}
|
|
3829
3829
|
};
|
|
3830
3830
|
|
|
3831
|
-
// ../../node_modules/luxon/src/impl/diff.js
|
|
3831
|
+
// ../../internal/validation/node_modules/luxon/src/impl/diff.js
|
|
3832
3832
|
function dayDiff(earlier, later) {
|
|
3833
3833
|
const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier);
|
|
3834
3834
|
return Math.floor(Duration.fromMillis(ms).as("days"));
|
|
@@ -3887,7 +3887,7 @@ function diff_default(earlier, later, units, opts) {
|
|
|
3887
3887
|
}
|
|
3888
3888
|
}
|
|
3889
3889
|
|
|
3890
|
-
// ../../node_modules/luxon/src/impl/digits.js
|
|
3890
|
+
// ../../internal/validation/node_modules/luxon/src/impl/digits.js
|
|
3891
3891
|
var numberingSystems = {
|
|
3892
3892
|
arab: "[\u0660-\u0669]",
|
|
3893
3893
|
arabext: "[\u06F0-\u06F9]",
|
|
@@ -3959,7 +3959,7 @@ function digitRegex({ numberingSystem }, append = "") {
|
|
|
3959
3959
|
return new RegExp(`${numberingSystems[numberingSystem || "latn"]}${append}`);
|
|
3960
3960
|
}
|
|
3961
3961
|
|
|
3962
|
-
// ../../node_modules/luxon/src/impl/tokenParser.js
|
|
3962
|
+
// ../../internal/validation/node_modules/luxon/src/impl/tokenParser.js
|
|
3963
3963
|
var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
|
|
3964
3964
|
function intUnit(regex, post = (i) => i) {
|
|
3965
3965
|
return { regex, deser: ([s2]) => post(parseDigits(s2)) };
|
|
@@ -4304,7 +4304,7 @@ function formatOptsToTokens(formatOpts, locale) {
|
|
|
4304
4304
|
return parts.map((p) => tokenForPart(p, locale, formatOpts));
|
|
4305
4305
|
}
|
|
4306
4306
|
|
|
4307
|
-
// ../../node_modules/luxon/src/impl/conversions.js
|
|
4307
|
+
// ../../internal/validation/node_modules/luxon/src/impl/conversions.js
|
|
4308
4308
|
var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
|
4309
4309
|
var leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
4310
4310
|
function unitOutOfRange(unit, value) {
|
|
@@ -4413,7 +4413,7 @@ function hasInvalidTimeData(obj) {
|
|
|
4413
4413
|
return false;
|
|
4414
4414
|
}
|
|
4415
4415
|
|
|
4416
|
-
// ../../node_modules/luxon/src/datetime.js
|
|
4416
|
+
// ../../internal/validation/node_modules/luxon/src/datetime.js
|
|
4417
4417
|
var INVALID3 = "Invalid DateTime";
|
|
4418
4418
|
var MAX_DATE = 864e13;
|
|
4419
4419
|
function unsupportedZone(zone) {
|
|
@@ -6245,8 +6245,11 @@ var AssetType = {
|
|
|
6245
6245
|
MEDIUM: "MEDIUM",
|
|
6246
6246
|
CHROME_WEB_STORE: "CHROME_WEB_STORE",
|
|
6247
6247
|
MOZILLA_ADDONS: "MOZILLA_ADDONS",
|
|
6248
|
+
OPERA_ADDONS: "OPERA_ADDONS",
|
|
6248
6249
|
EMAIL: "EMAIL",
|
|
6249
|
-
PATREON: "PATREON"
|
|
6250
|
+
PATREON: "PATREON",
|
|
6251
|
+
OPENSEA: "OPENSEA",
|
|
6252
|
+
FARCASTER: "FARCASTER"
|
|
6250
6253
|
};
|
|
6251
6254
|
var AssetStatus = {
|
|
6252
6255
|
UNKNOWN: "UNKNOWN",
|
|
@@ -6476,11 +6479,19 @@ var ChainPatrolClientError = class extends Error {
|
|
|
6476
6479
|
this.code = code;
|
|
6477
6480
|
}
|
|
6478
6481
|
};
|
|
6482
|
+
var ChainPatrolClientErrorCodes = /* @__PURE__ */ ((ChainPatrolClientErrorCodes2) => {
|
|
6483
|
+
ChainPatrolClientErrorCodes2["MISSING_API_KEY"] = "MISSING_API_KEY";
|
|
6484
|
+
ChainPatrolClientErrorCodes2["API_ERROR"] = "API_ERROR";
|
|
6485
|
+
return ChainPatrolClientErrorCodes2;
|
|
6486
|
+
})(ChainPatrolClientErrorCodes || {});
|
|
6479
6487
|
var ChainPatrolClient = class {
|
|
6480
6488
|
constructor(options) {
|
|
6481
6489
|
var _a;
|
|
6482
6490
|
if (!options.apiKey) {
|
|
6483
|
-
throw new ChainPatrolClientError(
|
|
6491
|
+
throw new ChainPatrolClientError(
|
|
6492
|
+
"Missing API key",
|
|
6493
|
+
"MISSING_API_KEY" /* MISSING_API_KEY */
|
|
6494
|
+
);
|
|
6484
6495
|
}
|
|
6485
6496
|
this.baseUrl = (_a = options.baseUrl) != null ? _a : "https://app.chainpatrol.io/api/";
|
|
6486
6497
|
this.logger = new Logger({ component: "ChainPatrolClient" });
|
|
@@ -6502,7 +6513,7 @@ var ChainPatrolClient = class {
|
|
|
6502
6513
|
if (!res.ok) {
|
|
6503
6514
|
const text = yield res.text();
|
|
6504
6515
|
this.logger.error("fetch", { url, req, res: { status: res.status, text } });
|
|
6505
|
-
throw new ChainPatrolClientError(text, "API_ERROR");
|
|
6516
|
+
throw new ChainPatrolClientError(text, "API_ERROR" /* API_ERROR */);
|
|
6506
6517
|
}
|
|
6507
6518
|
return res.json();
|
|
6508
6519
|
});
|
|
@@ -6949,6 +6960,8 @@ _ThreatDetector.Schema = zod.z.object({
|
|
|
6949
6960
|
var ThreatDetector = _ThreatDetector;
|
|
6950
6961
|
|
|
6951
6962
|
exports.ChainPatrolClient = ChainPatrolClient;
|
|
6963
|
+
exports.ChainPatrolClientError = ChainPatrolClientError;
|
|
6964
|
+
exports.ChainPatrolClientErrorCodes = ChainPatrolClientErrorCodes;
|
|
6952
6965
|
exports.DomainParseError = DomainParseError;
|
|
6953
6966
|
exports.Events = Events;
|
|
6954
6967
|
exports.Relay = Relay;
|