@chainpatrol/sdk 0.3.0 → 0.4.1
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 +11 -3
- package/dist/index.js +75 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -464,6 +464,24 @@ function normalizeUrl(urlString, options) {
|
|
|
464
464
|
}
|
|
465
465
|
return urlString;
|
|
466
466
|
}
|
|
467
|
+
z.object({
|
|
468
|
+
assetId: z.number()
|
|
469
|
+
});
|
|
470
|
+
z.object({
|
|
471
|
+
id: z.number().optional(),
|
|
472
|
+
assetId: z.number().optional(),
|
|
473
|
+
active: z.boolean()
|
|
474
|
+
});
|
|
475
|
+
z.object({
|
|
476
|
+
// Required
|
|
477
|
+
content: z.string().min(1, {
|
|
478
|
+
message: "Content is required"
|
|
479
|
+
}).max(1e3, {
|
|
480
|
+
message: "Content cannot be longer than 1000 characters"
|
|
481
|
+
}).describe("Asset content"),
|
|
482
|
+
name: z.string().optional().describe("Asset name"),
|
|
483
|
+
description: z.string().nullish().optional().describe("Asset description")
|
|
484
|
+
});
|
|
467
485
|
z.object({
|
|
468
486
|
slug: z.string(),
|
|
469
487
|
assetId: z.number(),
|
|
@@ -477,7 +495,7 @@ z.object({
|
|
|
477
495
|
description: z.string().optional().default("")
|
|
478
496
|
});
|
|
479
497
|
|
|
480
|
-
// ../../node_modules/luxon/src/errors.js
|
|
498
|
+
// ../../internal/validation/node_modules/luxon/src/errors.js
|
|
481
499
|
var LuxonError = class extends Error {
|
|
482
500
|
};
|
|
483
501
|
var InvalidDateTimeError = class extends LuxonError {
|
|
@@ -510,7 +528,7 @@ var ZoneIsAbstractError = class extends LuxonError {
|
|
|
510
528
|
}
|
|
511
529
|
};
|
|
512
530
|
|
|
513
|
-
// ../../node_modules/luxon/src/impl/formats.js
|
|
531
|
+
// ../../internal/validation/node_modules/luxon/src/impl/formats.js
|
|
514
532
|
var n = "numeric";
|
|
515
533
|
var s = "short";
|
|
516
534
|
var l = "long";
|
|
@@ -662,7 +680,7 @@ var DATETIME_HUGE_WITH_SECONDS = {
|
|
|
662
680
|
timeZoneName: l
|
|
663
681
|
};
|
|
664
682
|
|
|
665
|
-
// ../../node_modules/luxon/src/impl/util.js
|
|
683
|
+
// ../../internal/validation/node_modules/luxon/src/impl/util.js
|
|
666
684
|
function isUndefined(o) {
|
|
667
685
|
return typeof o === "undefined";
|
|
668
686
|
}
|
|
@@ -854,7 +872,7 @@ function timeObject(obj) {
|
|
|
854
872
|
}
|
|
855
873
|
var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
|
|
856
874
|
|
|
857
|
-
// ../../node_modules/luxon/src/impl/english.js
|
|
875
|
+
// ../../internal/validation/node_modules/luxon/src/impl/english.js
|
|
858
876
|
var monthsLong = [
|
|
859
877
|
"January",
|
|
860
878
|
"February",
|
|
@@ -980,7 +998,7 @@ function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
|
|
|
980
998
|
return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
|
|
981
999
|
}
|
|
982
1000
|
|
|
983
|
-
// ../../node_modules/luxon/src/impl/formatter.js
|
|
1001
|
+
// ../../internal/validation/node_modules/luxon/src/impl/formatter.js
|
|
984
1002
|
function stringifyTokens(splits, tokenToString) {
|
|
985
1003
|
let s2 = "";
|
|
986
1004
|
for (const token of splits) {
|
|
@@ -1258,7 +1276,7 @@ var Formatter = class _Formatter {
|
|
|
1258
1276
|
}
|
|
1259
1277
|
};
|
|
1260
1278
|
|
|
1261
|
-
// ../../node_modules/luxon/src/impl/invalid.js
|
|
1279
|
+
// ../../internal/validation/node_modules/luxon/src/impl/invalid.js
|
|
1262
1280
|
var Invalid = class {
|
|
1263
1281
|
constructor(reason, explanation) {
|
|
1264
1282
|
this.reason = reason;
|
|
@@ -1273,7 +1291,7 @@ var Invalid = class {
|
|
|
1273
1291
|
}
|
|
1274
1292
|
};
|
|
1275
1293
|
|
|
1276
|
-
// ../../node_modules/luxon/src/zone.js
|
|
1294
|
+
// ../../internal/validation/node_modules/luxon/src/zone.js
|
|
1277
1295
|
var Zone = class {
|
|
1278
1296
|
/**
|
|
1279
1297
|
* The type of zone
|
|
@@ -1353,7 +1371,7 @@ var Zone = class {
|
|
|
1353
1371
|
}
|
|
1354
1372
|
};
|
|
1355
1373
|
|
|
1356
|
-
// ../../node_modules/luxon/src/zones/systemZone.js
|
|
1374
|
+
// ../../internal/validation/node_modules/luxon/src/zones/systemZone.js
|
|
1357
1375
|
var singleton = null;
|
|
1358
1376
|
var SystemZone = class _SystemZone extends Zone {
|
|
1359
1377
|
/**
|
|
@@ -1400,7 +1418,7 @@ var SystemZone = class _SystemZone extends Zone {
|
|
|
1400
1418
|
}
|
|
1401
1419
|
};
|
|
1402
1420
|
|
|
1403
|
-
// ../../node_modules/luxon/src/zones/IANAZone.js
|
|
1421
|
+
// ../../internal/validation/node_modules/luxon/src/zones/IANAZone.js
|
|
1404
1422
|
var dtfCache = {};
|
|
1405
1423
|
function makeDTF(zone) {
|
|
1406
1424
|
if (!dtfCache[zone]) {
|
|
@@ -1555,7 +1573,7 @@ var IANAZone = class _IANAZone extends Zone {
|
|
|
1555
1573
|
}
|
|
1556
1574
|
};
|
|
1557
1575
|
|
|
1558
|
-
// ../../node_modules/luxon/src/zones/fixedOffsetZone.js
|
|
1576
|
+
// ../../internal/validation/node_modules/luxon/src/zones/fixedOffsetZone.js
|
|
1559
1577
|
var singleton2 = null;
|
|
1560
1578
|
var FixedOffsetZone = class _FixedOffsetZone extends Zone {
|
|
1561
1579
|
/**
|
|
@@ -1638,7 +1656,7 @@ var FixedOffsetZone = class _FixedOffsetZone extends Zone {
|
|
|
1638
1656
|
}
|
|
1639
1657
|
};
|
|
1640
1658
|
|
|
1641
|
-
// ../../node_modules/luxon/src/zones/invalidZone.js
|
|
1659
|
+
// ../../internal/validation/node_modules/luxon/src/zones/invalidZone.js
|
|
1642
1660
|
var InvalidZone = class extends Zone {
|
|
1643
1661
|
constructor(zoneName) {
|
|
1644
1662
|
super();
|
|
@@ -1678,7 +1696,7 @@ var InvalidZone = class extends Zone {
|
|
|
1678
1696
|
}
|
|
1679
1697
|
};
|
|
1680
1698
|
|
|
1681
|
-
// ../../node_modules/luxon/src/impl/zoneUtil.js
|
|
1699
|
+
// ../../internal/validation/node_modules/luxon/src/impl/zoneUtil.js
|
|
1682
1700
|
function normalizeZone(input, defaultZone2) {
|
|
1683
1701
|
if (isUndefined(input) || input === null) {
|
|
1684
1702
|
return defaultZone2;
|
|
@@ -1703,7 +1721,7 @@ function normalizeZone(input, defaultZone2) {
|
|
|
1703
1721
|
}
|
|
1704
1722
|
}
|
|
1705
1723
|
|
|
1706
|
-
// ../../node_modules/luxon/src/settings.js
|
|
1724
|
+
// ../../internal/validation/node_modules/luxon/src/settings.js
|
|
1707
1725
|
var now = () => Date.now();
|
|
1708
1726
|
var defaultZone = "system";
|
|
1709
1727
|
var defaultLocale = null;
|
|
@@ -1810,7 +1828,7 @@ var Settings = class {
|
|
|
1810
1828
|
}
|
|
1811
1829
|
};
|
|
1812
1830
|
|
|
1813
|
-
// ../../node_modules/luxon/src/impl/locale.js
|
|
1831
|
+
// ../../internal/validation/node_modules/luxon/src/impl/locale.js
|
|
1814
1832
|
var intlLFCache = {};
|
|
1815
1833
|
function getCachedLF(locString, opts = {}) {
|
|
1816
1834
|
const key = JSON.stringify([locString, opts]);
|
|
@@ -1949,15 +1967,15 @@ var PolyNumberFormatter = class {
|
|
|
1949
1967
|
var PolyDateFormatter = class {
|
|
1950
1968
|
constructor(dt, intl, opts) {
|
|
1951
1969
|
this.opts = opts;
|
|
1952
|
-
let
|
|
1970
|
+
let z12;
|
|
1953
1971
|
if (dt.zone.isUniversal) {
|
|
1954
1972
|
const gmtOffset = -1 * (dt.offset / 60);
|
|
1955
1973
|
const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
|
|
1956
1974
|
if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
|
|
1957
|
-
|
|
1975
|
+
z12 = offsetZ;
|
|
1958
1976
|
this.dt = dt;
|
|
1959
1977
|
} else {
|
|
1960
|
-
|
|
1978
|
+
z12 = "UTC";
|
|
1961
1979
|
if (opts.timeZoneName) {
|
|
1962
1980
|
this.dt = dt;
|
|
1963
1981
|
} else {
|
|
@@ -1968,11 +1986,11 @@ var PolyDateFormatter = class {
|
|
|
1968
1986
|
this.dt = dt;
|
|
1969
1987
|
} else {
|
|
1970
1988
|
this.dt = dt;
|
|
1971
|
-
|
|
1989
|
+
z12 = dt.zone.name;
|
|
1972
1990
|
}
|
|
1973
1991
|
const intlOpts = __spreadValues({}, this.opts);
|
|
1974
|
-
if (
|
|
1975
|
-
intlOpts.timeZone =
|
|
1992
|
+
if (z12) {
|
|
1993
|
+
intlOpts.timeZone = z12;
|
|
1976
1994
|
}
|
|
1977
1995
|
this.dtf = getCachedDTF(intl, intlOpts);
|
|
1978
1996
|
}
|
|
@@ -2142,7 +2160,7 @@ var Locale = class _Locale {
|
|
|
2142
2160
|
}
|
|
2143
2161
|
};
|
|
2144
2162
|
|
|
2145
|
-
// ../../node_modules/luxon/src/impl/regexParser.js
|
|
2163
|
+
// ../../internal/validation/node_modules/luxon/src/impl/regexParser.js
|
|
2146
2164
|
function combineRegexes(...regexes) {
|
|
2147
2165
|
const full = regexes.reduce((f, r) => f + r.source, "");
|
|
2148
2166
|
return RegExp(`^${full}$`);
|
|
@@ -2377,7 +2395,7 @@ function parseSQL(s2) {
|
|
|
2377
2395
|
);
|
|
2378
2396
|
}
|
|
2379
2397
|
|
|
2380
|
-
// ../../node_modules/luxon/src/duration.js
|
|
2398
|
+
// ../../internal/validation/node_modules/luxon/src/duration.js
|
|
2381
2399
|
var INVALID = "Invalid Duration";
|
|
2382
2400
|
var lowOrderMatrix = {
|
|
2383
2401
|
weeks: {
|
|
@@ -3172,7 +3190,7 @@ var Duration = class _Duration {
|
|
|
3172
3190
|
}
|
|
3173
3191
|
};
|
|
3174
3192
|
|
|
3175
|
-
// ../../node_modules/luxon/src/interval.js
|
|
3193
|
+
// ../../internal/validation/node_modules/luxon/src/interval.js
|
|
3176
3194
|
var INVALID2 = "Invalid Interval";
|
|
3177
3195
|
function validateStartEnd(start, end) {
|
|
3178
3196
|
if (!start || !start.isValid) {
|
|
@@ -3685,7 +3703,7 @@ var Interval = class _Interval {
|
|
|
3685
3703
|
}
|
|
3686
3704
|
};
|
|
3687
3705
|
|
|
3688
|
-
// ../../node_modules/luxon/src/info.js
|
|
3706
|
+
// ../../internal/validation/node_modules/luxon/src/info.js
|
|
3689
3707
|
var Info = class {
|
|
3690
3708
|
/**
|
|
3691
3709
|
* Return whether the specified zone contains a DST.
|
|
@@ -3826,7 +3844,7 @@ var Info = class {
|
|
|
3826
3844
|
}
|
|
3827
3845
|
};
|
|
3828
3846
|
|
|
3829
|
-
// ../../node_modules/luxon/src/impl/diff.js
|
|
3847
|
+
// ../../internal/validation/node_modules/luxon/src/impl/diff.js
|
|
3830
3848
|
function dayDiff(earlier, later) {
|
|
3831
3849
|
const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier);
|
|
3832
3850
|
return Math.floor(Duration.fromMillis(ms).as("days"));
|
|
@@ -3885,7 +3903,7 @@ function diff_default(earlier, later, units, opts) {
|
|
|
3885
3903
|
}
|
|
3886
3904
|
}
|
|
3887
3905
|
|
|
3888
|
-
// ../../node_modules/luxon/src/impl/digits.js
|
|
3906
|
+
// ../../internal/validation/node_modules/luxon/src/impl/digits.js
|
|
3889
3907
|
var numberingSystems = {
|
|
3890
3908
|
arab: "[\u0660-\u0669]",
|
|
3891
3909
|
arabext: "[\u06F0-\u06F9]",
|
|
@@ -3957,7 +3975,7 @@ function digitRegex({ numberingSystem }, append = "") {
|
|
|
3957
3975
|
return new RegExp(`${numberingSystems[numberingSystem || "latn"]}${append}`);
|
|
3958
3976
|
}
|
|
3959
3977
|
|
|
3960
|
-
// ../../node_modules/luxon/src/impl/tokenParser.js
|
|
3978
|
+
// ../../internal/validation/node_modules/luxon/src/impl/tokenParser.js
|
|
3961
3979
|
var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
|
|
3962
3980
|
function intUnit(regex, post = (i) => i) {
|
|
3963
3981
|
return { regex, deser: ([s2]) => post(parseDigits(s2)) };
|
|
@@ -4302,7 +4320,7 @@ function formatOptsToTokens(formatOpts, locale) {
|
|
|
4302
4320
|
return parts.map((p) => tokenForPart(p, locale, formatOpts));
|
|
4303
4321
|
}
|
|
4304
4322
|
|
|
4305
|
-
// ../../node_modules/luxon/src/impl/conversions.js
|
|
4323
|
+
// ../../internal/validation/node_modules/luxon/src/impl/conversions.js
|
|
4306
4324
|
var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
|
4307
4325
|
var leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
4308
4326
|
function unitOutOfRange(unit, value) {
|
|
@@ -4411,7 +4429,7 @@ function hasInvalidTimeData(obj) {
|
|
|
4411
4429
|
return false;
|
|
4412
4430
|
}
|
|
4413
4431
|
|
|
4414
|
-
// ../../node_modules/luxon/src/datetime.js
|
|
4432
|
+
// ../../internal/validation/node_modules/luxon/src/datetime.js
|
|
4415
4433
|
var INVALID3 = "Invalid DateTime";
|
|
4416
4434
|
var MAX_DATE = 864e13;
|
|
4417
4435
|
function unsupportedZone(zone) {
|
|
@@ -6243,8 +6261,12 @@ var AssetType = {
|
|
|
6243
6261
|
MEDIUM: "MEDIUM",
|
|
6244
6262
|
CHROME_WEB_STORE: "CHROME_WEB_STORE",
|
|
6245
6263
|
MOZILLA_ADDONS: "MOZILLA_ADDONS",
|
|
6264
|
+
OPERA_ADDONS: "OPERA_ADDONS",
|
|
6246
6265
|
EMAIL: "EMAIL",
|
|
6247
|
-
PATREON: "PATREON"
|
|
6266
|
+
PATREON: "PATREON",
|
|
6267
|
+
OPENSEA: "OPENSEA",
|
|
6268
|
+
FARCASTER: "FARCASTER",
|
|
6269
|
+
IPFS: "IPFS"
|
|
6248
6270
|
};
|
|
6249
6271
|
var AssetStatus = {
|
|
6250
6272
|
UNKNOWN: "UNKNOWN",
|
|
@@ -6253,6 +6275,7 @@ var AssetStatus = {
|
|
|
6253
6275
|
};
|
|
6254
6276
|
|
|
6255
6277
|
// ../../internal/validation/src/public/asset/changelog.ts
|
|
6278
|
+
var DateString = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Must be in the format `YYYY-MM-DD`").pipe(z.coerce.date());
|
|
6256
6279
|
z.object({
|
|
6257
6280
|
/** The type of asset to retrieve. */
|
|
6258
6281
|
type: z.nativeEnum(AssetType).optional().describe("Asset type"),
|
|
@@ -6267,7 +6290,7 @@ z.object({
|
|
|
6267
6290
|
* Transformed into JavaScript Date objects from strings.
|
|
6268
6291
|
* If the startDate is after the endDate, a validation error will occur.
|
|
6269
6292
|
*/
|
|
6270
|
-
startDate:
|
|
6293
|
+
startDate: DateString.optional().describe(
|
|
6271
6294
|
"The start date to list items from. This should be in the format `YYYY-MM-DD` and is inclusive."
|
|
6272
6295
|
),
|
|
6273
6296
|
/**
|
|
@@ -6276,7 +6299,7 @@ z.object({
|
|
|
6276
6299
|
* Transformed into JavaScript Date objects from strings.
|
|
6277
6300
|
* If the startDate is after the endDate, a validation error will occur.
|
|
6278
6301
|
*/
|
|
6279
|
-
endDate:
|
|
6302
|
+
endDate: DateString.optional().describe(
|
|
6280
6303
|
"The end date to list items from. This should be in the format `YYYY-MM-DD` and is inclusive."
|
|
6281
6304
|
)
|
|
6282
6305
|
}).describe(
|
|
@@ -6292,15 +6315,13 @@ for parsing the dates.`
|
|
|
6292
6315
|
data.endDate = DateTime.now().toJSDate();
|
|
6293
6316
|
}
|
|
6294
6317
|
return data;
|
|
6295
|
-
}).refine(
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
};
|
|
6318
|
+
}).refine(
|
|
6319
|
+
(data) => data.startDate !== void 0 && data.endDate !== void 0 && data.startDate <= data.endDate,
|
|
6320
|
+
{
|
|
6321
|
+
path: ["startDate"],
|
|
6322
|
+
message: "startDate must be before endDate"
|
|
6301
6323
|
}
|
|
6302
|
-
|
|
6303
|
-
});
|
|
6324
|
+
);
|
|
6304
6325
|
z.object({
|
|
6305
6326
|
/** An array of asset change with their content, type, status, and update timestamp. */
|
|
6306
6327
|
changelog: z.array(
|
|
@@ -6396,6 +6417,8 @@ var reportCreateInputSchema = z.object({
|
|
|
6396
6417
|
organizationSlug: z.string().describe("Organization slug used to identify the organization on ChainPatrol").optional(),
|
|
6397
6418
|
/** Optional Discord Guild ID associated with the organization. */
|
|
6398
6419
|
discordGuildId: z.string().describe("Discord Guild (Server) ID linked to the organization on ChainPatrol").optional(),
|
|
6420
|
+
/** Optional Telegram Group ID associated with the organization. */
|
|
6421
|
+
telegramGroupId: z.string().describe("Telegram Group ID linked to the organization on ChainPatrol").optional(),
|
|
6399
6422
|
/** Title of the report. */
|
|
6400
6423
|
title: z.string().min(3).describe("Title of the report"),
|
|
6401
6424
|
/** Description of the report, supporting markdown syntax. */
|
|
@@ -6474,11 +6497,19 @@ var ChainPatrolClientError = class extends Error {
|
|
|
6474
6497
|
this.code = code;
|
|
6475
6498
|
}
|
|
6476
6499
|
};
|
|
6500
|
+
var ChainPatrolClientErrorCodes = /* @__PURE__ */ ((ChainPatrolClientErrorCodes2) => {
|
|
6501
|
+
ChainPatrolClientErrorCodes2["MISSING_API_KEY"] = "MISSING_API_KEY";
|
|
6502
|
+
ChainPatrolClientErrorCodes2["API_ERROR"] = "API_ERROR";
|
|
6503
|
+
return ChainPatrolClientErrorCodes2;
|
|
6504
|
+
})(ChainPatrolClientErrorCodes || {});
|
|
6477
6505
|
var ChainPatrolClient = class {
|
|
6478
6506
|
constructor(options) {
|
|
6479
6507
|
var _a;
|
|
6480
6508
|
if (!options.apiKey) {
|
|
6481
|
-
throw new ChainPatrolClientError(
|
|
6509
|
+
throw new ChainPatrolClientError(
|
|
6510
|
+
"Missing API key",
|
|
6511
|
+
"MISSING_API_KEY" /* MISSING_API_KEY */
|
|
6512
|
+
);
|
|
6482
6513
|
}
|
|
6483
6514
|
this.baseUrl = (_a = options.baseUrl) != null ? _a : "https://app.chainpatrol.io/api/";
|
|
6484
6515
|
this.logger = new Logger({ component: "ChainPatrolClient" });
|
|
@@ -6500,7 +6531,7 @@ var ChainPatrolClient = class {
|
|
|
6500
6531
|
if (!res.ok) {
|
|
6501
6532
|
const text = yield res.text();
|
|
6502
6533
|
this.logger.error("fetch", { url, req, res: { status: res.status, text } });
|
|
6503
|
-
throw new ChainPatrolClientError(text, "API_ERROR");
|
|
6534
|
+
throw new ChainPatrolClientError(text, "API_ERROR" /* API_ERROR */);
|
|
6504
6535
|
}
|
|
6505
6536
|
return res.json();
|
|
6506
6537
|
});
|
|
@@ -6946,6 +6977,6 @@ _ThreatDetector.Schema = z.object({
|
|
|
6946
6977
|
});
|
|
6947
6978
|
var ThreatDetector = _ThreatDetector;
|
|
6948
6979
|
|
|
6949
|
-
export { ChainPatrolClient, DomainParseError, Events, Relay, storage_exports as Storage, ThreatDetector };
|
|
6980
|
+
export { ChainPatrolClient, ChainPatrolClientError, ChainPatrolClientErrorCodes, DomainParseError, Events, Relay, storage_exports as Storage, ThreatDetector };
|
|
6950
6981
|
//# sourceMappingURL=out.js.map
|
|
6951
6982
|
//# sourceMappingURL=index.mjs.map
|