@crosspost/types 0.2.0 → 0.2.2
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.cjs +69 -33
- package/dist/index.d.cts +193 -86
- package/dist/index.d.ts +193 -86
- package/dist/index.js +66 -33
- package/package.json +1 -1
- package/src/activity.ts +87 -28
- package/src/auth.ts +4 -4
- package/src/response.ts +2 -7
package/dist/index.cjs
CHANGED
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
27
27
|
AccountPostsParamsSchema: () => AccountPostsParamsSchema,
|
28
28
|
AccountPostsQuerySchema: () => AccountPostsQuerySchema,
|
29
29
|
ActivityLeaderboardQuerySchema: () => ActivityLeaderboardQuerySchema,
|
30
|
+
ActivityType: () => ActivityType,
|
30
31
|
AllRateLimitsResponseSchema: () => AllRateLimitsResponseSchema,
|
31
32
|
ApiErrorCode: () => ApiErrorCode,
|
32
33
|
ApiErrorCodeSchema: () => ApiErrorCodeSchema,
|
@@ -48,6 +49,7 @@ __export(index_exports, {
|
|
48
49
|
DeleteResultSchema: () => DeleteResultSchema,
|
49
50
|
EndpointRateLimitResponseSchema: () => EndpointRateLimitResponseSchema,
|
50
51
|
ErrorDetailSchema: () => ErrorDetailSchema,
|
52
|
+
FilterSchema: () => FilterSchema,
|
51
53
|
HealthStatusSchema: () => HealthStatusSchema,
|
52
54
|
LikePostRequestSchema: () => LikePostRequestSchema,
|
53
55
|
LikePostResponseSchema: () => LikePostResponseSchema,
|
@@ -60,6 +62,7 @@ __export(index_exports, {
|
|
60
62
|
NearAuthorizationResponseSchema: () => NearAuthorizationResponseSchema,
|
61
63
|
NearAuthorizationStatusResponseSchema: () => NearAuthorizationStatusResponseSchema,
|
62
64
|
NearUnauthorizationResponseSchema: () => NearUnauthorizationResponseSchema,
|
65
|
+
PaginationSchema: () => PaginationSchema,
|
63
66
|
Platform: () => Platform,
|
64
67
|
PlatformActivitySchema: () => PlatformActivitySchema,
|
65
68
|
PlatformParamSchema: () => PlatformParamSchema,
|
@@ -188,14 +191,9 @@ var ResponseMetaSchema = import_zod3.z.object({
|
|
188
191
|
reset: import_zod3.z.number().int().positive().describe("Unix timestamp (seconds)")
|
189
192
|
}).optional().describe("Rate limit information if applicable"),
|
190
193
|
pagination: import_zod3.z.object({
|
191
|
-
page: import_zod3.z.number().int().positive().optional(),
|
192
|
-
perPage: import_zod3.z.number().int().positive().optional(),
|
193
|
-
total: import_zod3.z.number().int().nonnegative().optional(),
|
194
194
|
limit: import_zod3.z.number().int().nonnegative().optional(),
|
195
195
|
offset: import_zod3.z.number().int().nonnegative().optional(),
|
196
|
-
|
197
|
-
nextCursor: import_zod3.z.string().optional(),
|
198
|
-
prevCursor: import_zod3.z.string().optional()
|
196
|
+
total: import_zod3.z.number().int().nonnegative().optional()
|
199
197
|
}).optional().describe("Pagination information if applicable")
|
200
198
|
});
|
201
199
|
var SuccessDetailSchema = import_zod3.z.object({
|
@@ -307,12 +305,12 @@ var NearAuthorizationRequestSchema = import_zod5.z.object({
|
|
307
305
|
// No additional parameters needed, as the NEAR account ID is extracted from the signature
|
308
306
|
}).describe("NEAR authorization request");
|
309
307
|
var NearAuthorizationResponseSchema = import_zod5.z.object({
|
310
|
-
|
311
|
-
|
308
|
+
signerId: import_zod5.z.string().describe("NEAR account ID"),
|
309
|
+
isAuthorized: import_zod5.z.boolean().describe("Whether the account is authorized")
|
312
310
|
}).describe("NEAR authorization response");
|
313
311
|
var NearAuthorizationStatusResponseSchema = import_zod5.z.object({
|
314
|
-
|
315
|
-
|
312
|
+
signerId: import_zod5.z.string().describe("NEAR account ID"),
|
313
|
+
isAuthorized: import_zod5.z.boolean().describe("Whether the account is authorized"),
|
316
314
|
authorizedAt: import_zod5.z.string().optional().describe("When the account was authorized")
|
317
315
|
}).describe("NEAR authorization status response");
|
318
316
|
|
@@ -534,6 +532,16 @@ var EndpointRateLimitResponseSchema = import_zod7.z.object({
|
|
534
532
|
|
535
533
|
// src/activity.ts
|
536
534
|
var import_zod8 = require("zod");
|
535
|
+
var ActivityType = /* @__PURE__ */ ((ActivityType2) => {
|
536
|
+
ActivityType2["POST"] = "post";
|
537
|
+
ActivityType2["REPOST"] = "repost";
|
538
|
+
ActivityType2["REPLY"] = "reply";
|
539
|
+
ActivityType2["QUOTE"] = "quote";
|
540
|
+
ActivityType2["LIKE"] = "like";
|
541
|
+
ActivityType2["UNLIKE"] = "unlike";
|
542
|
+
ActivityType2["DELETE"] = "delete";
|
543
|
+
return ActivityType2;
|
544
|
+
})(ActivityType || {});
|
537
545
|
var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
|
538
546
|
TimePeriod2["ALL"] = "all";
|
539
547
|
TimePeriod2["YEARLY"] = "year";
|
@@ -542,13 +550,45 @@ var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
|
|
542
550
|
TimePeriod2["DAILY"] = "day";
|
543
551
|
return TimePeriod2;
|
544
552
|
})(TimePeriod || {});
|
545
|
-
var
|
546
|
-
|
547
|
-
|
548
|
-
|
553
|
+
var FilterSchema = import_zod8.z.object({
|
554
|
+
platforms: import_zod8.z.string().optional().transform((val) => {
|
555
|
+
if (!val) return void 0;
|
556
|
+
return val.split(",").map((p) => p.trim()).map((p) => {
|
557
|
+
try {
|
558
|
+
return Platform[p.toUpperCase()];
|
559
|
+
} catch (_e) {
|
560
|
+
return p;
|
561
|
+
}
|
562
|
+
});
|
563
|
+
}).pipe(
|
564
|
+
import_zod8.z.array(import_zod8.z.nativeEnum(Platform)).optional()
|
565
|
+
).describe("Filter by platforms (comma-separated list, optional)"),
|
566
|
+
types: import_zod8.z.string().optional().transform((val) => {
|
567
|
+
if (!val) return void 0;
|
568
|
+
return val.split(",").map((t) => t.trim()).map((t) => {
|
569
|
+
try {
|
570
|
+
return ActivityType[t.toUpperCase()];
|
571
|
+
} catch (_e) {
|
572
|
+
return t;
|
573
|
+
}
|
574
|
+
});
|
575
|
+
}).pipe(
|
576
|
+
import_zod8.z.array(import_zod8.z.nativeEnum(ActivityType)).optional()
|
577
|
+
).describe("Filter by activity types (comma-separated list, optional)"),
|
578
|
+
timeframe: import_zod8.z.nativeEnum(TimePeriod).optional().transform((val) => {
|
579
|
+
if (!val) return "all" /* ALL */;
|
580
|
+
return val;
|
581
|
+
}).describe(
|
582
|
+
"Timeframe for filtering (optional)"
|
583
|
+
)
|
584
|
+
}).describe("Filter parameters");
|
585
|
+
var PaginationSchema = import_zod8.z.object({
|
549
586
|
limit: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
|
550
587
|
offset: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(0).optional()).describe("Offset for pagination")
|
551
|
-
}).describe("
|
588
|
+
}).describe("Pagination parameters");
|
589
|
+
var ActivityLeaderboardQuerySchema = import_zod8.z.object({
|
590
|
+
filter: FilterSchema.optional()
|
591
|
+
}).describe("Account leaderboard query").merge(PaginationSchema);
|
552
592
|
var AccountActivityEntrySchema = import_zod8.z.object({
|
553
593
|
signerId: import_zod8.z.string().describe("NEAR account ID"),
|
554
594
|
totalPosts: import_zod8.z.number().describe("Total number of posts"),
|
@@ -558,22 +598,21 @@ var AccountActivityEntrySchema = import_zod8.z.object({
|
|
558
598
|
totalQuotes: import_zod8.z.number().describe("Total number of quote posts"),
|
559
599
|
totalScore: import_zod8.z.number().describe("Total activity score"),
|
560
600
|
rank: import_zod8.z.number().describe("Rank on the leaderboard"),
|
561
|
-
lastActive: import_zod8.z.string().datetime().describe("Timestamp of last activity")
|
601
|
+
lastActive: import_zod8.z.string().datetime().describe("Timestamp of last activity"),
|
602
|
+
firstPostTimestamp: import_zod8.z.string().datetime().describe("Timestamp of the first post")
|
562
603
|
}).describe("Account activity entry");
|
563
604
|
var ActivityLeaderboardResponseSchema = import_zod8.z.object({
|
564
605
|
timeframe: import_zod8.z.nativeEnum(TimePeriod).describe("Timeframe for the leaderboard"),
|
565
606
|
entries: import_zod8.z.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
|
566
607
|
generatedAt: import_zod8.z.string().datetime().describe("Timestamp when the leaderboard was generated"),
|
567
|
-
|
608
|
+
platforms: import_zod8.z.array(PlatformSchema).optional().describe("Platform filters (if applied)")
|
568
609
|
});
|
569
610
|
var AccountActivityParamsSchema = import_zod8.z.object({
|
570
611
|
signerId: import_zod8.z.string().describe("NEAR account ID")
|
571
612
|
}).describe("Account activity params");
|
572
613
|
var AccountActivityQuerySchema = import_zod8.z.object({
|
573
|
-
|
574
|
-
|
575
|
-
)
|
576
|
-
}).describe("Account activity query");
|
614
|
+
filter: FilterSchema.optional()
|
615
|
+
}).describe("Account activity query").merge(PaginationSchema);
|
577
616
|
var PlatformActivitySchema = import_zod8.z.object({
|
578
617
|
platform: PlatformSchema,
|
579
618
|
posts: import_zod8.z.number().describe("Number of posts on this platform"),
|
@@ -601,17 +640,13 @@ var AccountPostsParamsSchema = import_zod8.z.object({
|
|
601
640
|
signerId: import_zod8.z.string().describe("NEAR account ID")
|
602
641
|
}).describe("Account posts params");
|
603
642
|
var AccountPostsQuerySchema = import_zod8.z.object({
|
604
|
-
|
605
|
-
|
606
|
-
offset: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(0).optional()).describe("Offset for pagination"),
|
607
|
-
type: import_zod8.z.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
|
608
|
-
"Filter by post type (optional)"
|
609
|
-
)
|
610
|
-
}).describe("Account posts query");
|
643
|
+
filter: FilterSchema.optional()
|
644
|
+
}).describe("Account posts query").merge(PaginationSchema);
|
611
645
|
var AccountPostSchema = import_zod8.z.object({
|
612
646
|
id: import_zod8.z.string().describe("Post ID"),
|
613
647
|
platform: PlatformSchema,
|
614
|
-
|
648
|
+
userId: import_zod8.z.string().describe("User ID on the platform"),
|
649
|
+
type: import_zod8.z.nativeEnum(ActivityType).describe("Type of post"),
|
615
650
|
content: import_zod8.z.string().optional().describe("Post content (if available)"),
|
616
651
|
url: import_zod8.z.string().url().optional().describe("URL to the post on the platform (if available)"),
|
617
652
|
createdAt: import_zod8.z.string().datetime().describe("Timestamp when the post was created"),
|
@@ -627,10 +662,8 @@ var AccountPostSchema = import_zod8.z.object({
|
|
627
662
|
var AccountPostsResponseSchema = import_zod8.z.object({
|
628
663
|
signerId: import_zod8.z.string().describe("NEAR account ID"),
|
629
664
|
posts: import_zod8.z.array(AccountPostSchema).describe("List of posts"),
|
630
|
-
|
631
|
-
|
632
|
-
"Post type filter (if applied)"
|
633
|
-
)
|
665
|
+
platforms: import_zod8.z.array(import_zod8.z.string()).optional().describe("Platform filters (if applied)"),
|
666
|
+
types: import_zod8.z.array(import_zod8.z.string()).optional().describe("Post type filters (if applied)")
|
634
667
|
});
|
635
668
|
// Annotate the CommonJS export names for ESM import in node:
|
636
669
|
0 && (module.exports = {
|
@@ -641,6 +674,7 @@ var AccountPostsResponseSchema = import_zod8.z.object({
|
|
641
674
|
AccountPostsParamsSchema,
|
642
675
|
AccountPostsQuerySchema,
|
643
676
|
ActivityLeaderboardQuerySchema,
|
677
|
+
ActivityType,
|
644
678
|
AllRateLimitsResponseSchema,
|
645
679
|
ApiErrorCode,
|
646
680
|
ApiErrorCodeSchema,
|
@@ -662,6 +696,7 @@ var AccountPostsResponseSchema = import_zod8.z.object({
|
|
662
696
|
DeleteResultSchema,
|
663
697
|
EndpointRateLimitResponseSchema,
|
664
698
|
ErrorDetailSchema,
|
699
|
+
FilterSchema,
|
665
700
|
HealthStatusSchema,
|
666
701
|
LikePostRequestSchema,
|
667
702
|
LikePostResponseSchema,
|
@@ -674,6 +709,7 @@ var AccountPostsResponseSchema = import_zod8.z.object({
|
|
674
709
|
NearAuthorizationResponseSchema,
|
675
710
|
NearAuthorizationStatusResponseSchema,
|
676
711
|
NearUnauthorizationResponseSchema,
|
712
|
+
PaginationSchema,
|
677
713
|
Platform,
|
678
714
|
PlatformActivitySchema,
|
679
715
|
PlatformParamSchema,
|