@ourofoundation/ouro-js 3.8.2 → 3.8.3
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/chunk-64ZUBBP7.js +2 -0
- package/dist/chunk-64ZUBBP7.js.map +1 -0
- package/dist/chunk-ADLJ3UUW.cjs +2 -0
- package/dist/chunk-ADLJ3UUW.cjs.map +1 -0
- package/dist/{chunk-T6UO42TO.cjs → chunk-CIEATF7M.cjs} +2 -2
- package/dist/{chunk-T6UO42TO.cjs.map → chunk-CIEATF7M.cjs.map} +1 -1
- package/dist/chunk-GUEHIQ6T.cjs +2 -0
- package/dist/chunk-GUEHIQ6T.cjs.map +1 -0
- package/dist/chunk-LMRFVO4I.cjs +2 -0
- package/dist/chunk-LMRFVO4I.cjs.map +1 -0
- package/dist/chunk-MRUJUIPN.js +2 -0
- package/dist/chunk-MRUJUIPN.js.map +1 -0
- package/dist/chunk-XXFKHRNE.js +2 -0
- package/dist/chunk-XXFKHRNE.js.map +1 -0
- package/dist/{chunk-5CPECQKN.js → chunk-ZFARY5F4.js} +2 -2
- package/dist/{chunk-5CPECQKN.js.map → chunk-ZFARY5F4.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/schema/asset-filters.cjs +1 -1
- package/dist/schema/asset-filters.d.cts +2 -0
- package/dist/schema/asset-filters.d.ts +2 -0
- package/dist/schema/asset-filters.js +1 -1
- package/dist/schema/notifications.cjs +1 -1
- package/dist/schema/notifications.d.cts +128 -1
- package/dist/schema/notifications.d.ts +128 -1
- package/dist/schema/notifications.js +1 -1
- package/dist/schema/quests.cjs +1 -1
- package/dist/schema/quests.js +1 -1
- package/dist/utils/quest-submission.cjs +1 -1
- package/dist/utils/quest-submission.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5SC4M4E3.cjs +0 -2
- package/dist/chunk-5SC4M4E3.cjs.map +0 -1
- package/dist/chunk-EC376C5T.js +0 -2
- package/dist/chunk-EC376C5T.js.map +0 -1
- package/dist/chunk-KMENBGAB.js +0 -2
- package/dist/chunk-KMENBGAB.js.map +0 -1
- package/dist/chunk-LHCGBWFP.cjs +0 -2
- package/dist/chunk-LHCGBWFP.cjs.map +0 -1
- package/dist/chunk-O4LSX56P.js +0 -2
- package/dist/chunk-O4LSX56P.js.map +0 -1
- package/dist/chunk-U6XOT6XH.cjs +0 -2
- package/dist/chunk-U6XOT6XH.cjs.map +0 -1
|
@@ -18,6 +18,7 @@ declare const NotificationTypeSchema: z.ZodEnum<{
|
|
|
18
18
|
"action-failed": "action-failed";
|
|
19
19
|
"quest-entry": "quest-entry";
|
|
20
20
|
"quest-entry-accepted": "quest-entry-accepted";
|
|
21
|
+
"quest-entry-eval-failed": "quest-entry-eval-failed";
|
|
21
22
|
"onboarding-complete": "onboarding-complete";
|
|
22
23
|
"onboarding-action-required": "onboarding-action-required";
|
|
23
24
|
"route-earnings-milestone": "route-earnings-milestone";
|
|
@@ -663,12 +664,34 @@ declare const QuestEntryAcceptedContentSchema: z.ZodObject<{
|
|
|
663
664
|
asset_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
664
665
|
asset_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
665
666
|
}, z.core.$strip>>;
|
|
667
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
668
|
+
review: "review";
|
|
669
|
+
eval: "eval";
|
|
670
|
+
}>>;
|
|
666
671
|
reviewer: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
667
672
|
id: z.ZodString;
|
|
668
673
|
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
669
674
|
}, z.core.$strip>>>;
|
|
670
675
|
text: z.ZodOptional<z.ZodString>;
|
|
671
676
|
}, z.core.$strip>;
|
|
677
|
+
declare const QuestEntryEvalFailedContentSchema: z.ZodObject<{
|
|
678
|
+
quest: z.ZodOptional<z.ZodObject<{
|
|
679
|
+
id: z.ZodString;
|
|
680
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
681
|
+
}, z.core.$strip>>;
|
|
682
|
+
entry: z.ZodOptional<z.ZodObject<{
|
|
683
|
+
id: z.ZodString;
|
|
684
|
+
asset_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
685
|
+
asset_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
686
|
+
asset_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
687
|
+
}, z.core.$strip>>;
|
|
688
|
+
eval_status: z.ZodOptional<z.ZodEnum<{
|
|
689
|
+
failed: "failed";
|
|
690
|
+
errored: "errored";
|
|
691
|
+
}>>;
|
|
692
|
+
eval_score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
693
|
+
text: z.ZodOptional<z.ZodString>;
|
|
694
|
+
}, z.core.$strip>;
|
|
672
695
|
declare const OnboardingCompleteContentSchema: z.ZodObject<{
|
|
673
696
|
text: z.ZodOptional<z.ZodString>;
|
|
674
697
|
}, z.core.$strip>;
|
|
@@ -2682,12 +2705,116 @@ declare const NotificationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2682
2705
|
asset_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2683
2706
|
asset_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2684
2707
|
}, z.core.$strip>>;
|
|
2708
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
2709
|
+
review: "review";
|
|
2710
|
+
eval: "eval";
|
|
2711
|
+
}>>;
|
|
2685
2712
|
reviewer: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2686
2713
|
id: z.ZodString;
|
|
2687
2714
|
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2688
2715
|
}, z.core.$strip>>>;
|
|
2689
2716
|
text: z.ZodOptional<z.ZodString>;
|
|
2690
2717
|
}, z.core.$strip>;
|
|
2718
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2719
|
+
id: z.ZodUUID;
|
|
2720
|
+
source_user_id: z.ZodUUID;
|
|
2721
|
+
destination_user_id: z.ZodUUID;
|
|
2722
|
+
org_id: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
2723
|
+
asset_id: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
2724
|
+
reaction_id: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
2725
|
+
action_id: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
2726
|
+
parent_asset_id: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
2727
|
+
root_asset_id: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
2728
|
+
viewed: z.ZodBoolean;
|
|
2729
|
+
created_at: z.ZodString;
|
|
2730
|
+
last_updated: z.ZodString;
|
|
2731
|
+
source_user: z.ZodOptional<z.ZodObject<{
|
|
2732
|
+
id: z.ZodOptional<z.ZodUUID>;
|
|
2733
|
+
user_id: z.ZodOptional<z.ZodUUID>;
|
|
2734
|
+
username: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
2735
|
+
name: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
2736
|
+
first_name: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
2737
|
+
last_name: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
2738
|
+
avatar_path: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
2739
|
+
bio: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
2740
|
+
is_provisioned: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
2741
|
+
claimed_at: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
2742
|
+
urls: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2743
|
+
value: z.ZodString;
|
|
2744
|
+
}, z.core.$strip>>>>;
|
|
2745
|
+
post_id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodUUID>>>;
|
|
2746
|
+
actor_type: z.ZodOptional<z.ZodEnum<{
|
|
2747
|
+
base: "base";
|
|
2748
|
+
agent: "agent";
|
|
2749
|
+
verified: "verified";
|
|
2750
|
+
}>>;
|
|
2751
|
+
plan_type: z.ZodOptional<z.ZodEnum<{
|
|
2752
|
+
free: "free";
|
|
2753
|
+
gold: "gold";
|
|
2754
|
+
}>>;
|
|
2755
|
+
last_active: z.ZodOptional<z.ZodString>;
|
|
2756
|
+
}, z.core.$strip>>;
|
|
2757
|
+
asset: z.ZodOptional<z.ZodObject<{
|
|
2758
|
+
assetId: z.ZodOptional<z.ZodString>;
|
|
2759
|
+
assetType: z.ZodOptional<z.ZodEnum<{
|
|
2760
|
+
user: "user";
|
|
2761
|
+
organization: "organization";
|
|
2762
|
+
team: "team";
|
|
2763
|
+
dataset: "dataset";
|
|
2764
|
+
file: "file";
|
|
2765
|
+
service: "service";
|
|
2766
|
+
route: "route";
|
|
2767
|
+
post: "post";
|
|
2768
|
+
quest: "quest";
|
|
2769
|
+
comment: "comment";
|
|
2770
|
+
conversation: "conversation";
|
|
2771
|
+
}>>;
|
|
2772
|
+
id: z.ZodOptional<z.ZodString>;
|
|
2773
|
+
asset_type: z.ZodOptional<z.ZodEnum<{
|
|
2774
|
+
user: "user";
|
|
2775
|
+
organization: "organization";
|
|
2776
|
+
team: "team";
|
|
2777
|
+
dataset: "dataset";
|
|
2778
|
+
file: "file";
|
|
2779
|
+
service: "service";
|
|
2780
|
+
route: "route";
|
|
2781
|
+
post: "post";
|
|
2782
|
+
quest: "quest";
|
|
2783
|
+
comment: "comment";
|
|
2784
|
+
conversation: "conversation";
|
|
2785
|
+
}>>;
|
|
2786
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2787
|
+
user_id: z.ZodOptional<z.ZodString>;
|
|
2788
|
+
preview: z.ZodOptional<z.ZodAny>;
|
|
2789
|
+
description: z.ZodOptional<z.ZodAny>;
|
|
2790
|
+
slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2791
|
+
name_url_slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2792
|
+
org_id: z.ZodOptional<z.ZodString>;
|
|
2793
|
+
parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2794
|
+
parent: z.ZodOptional<z.ZodAny>;
|
|
2795
|
+
user: z.ZodOptional<z.ZodAny>;
|
|
2796
|
+
organization: z.ZodOptional<z.ZodAny>;
|
|
2797
|
+
team: z.ZodOptional<z.ZodAny>;
|
|
2798
|
+
}, z.core.$strip>>;
|
|
2799
|
+
type: z.ZodLiteral<"quest-entry-eval-failed">;
|
|
2800
|
+
content: z.ZodObject<{
|
|
2801
|
+
quest: z.ZodOptional<z.ZodObject<{
|
|
2802
|
+
id: z.ZodString;
|
|
2803
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2804
|
+
}, z.core.$strip>>;
|
|
2805
|
+
entry: z.ZodOptional<z.ZodObject<{
|
|
2806
|
+
id: z.ZodString;
|
|
2807
|
+
asset_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2808
|
+
asset_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2809
|
+
asset_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2810
|
+
}, z.core.$strip>>;
|
|
2811
|
+
eval_status: z.ZodOptional<z.ZodEnum<{
|
|
2812
|
+
failed: "failed";
|
|
2813
|
+
errored: "errored";
|
|
2814
|
+
}>>;
|
|
2815
|
+
eval_score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2816
|
+
text: z.ZodOptional<z.ZodString>;
|
|
2817
|
+
}, z.core.$strip>;
|
|
2691
2818
|
}, z.core.$strip>, z.ZodObject<{
|
|
2692
2819
|
id: z.ZodUUID;
|
|
2693
2820
|
source_user_id: z.ZodUUID;
|
|
@@ -3448,4 +3575,4 @@ type NotificationOfType<T extends NotificationType> = Extract<Notification, {
|
|
|
3448
3575
|
type NotificationContentAsset = z.infer<typeof NotificationContentAssetSchema>;
|
|
3449
3576
|
type NotificationAssetRef = z.infer<typeof NotificationAssetRefSchema>;
|
|
3450
3577
|
|
|
3451
|
-
export { ActionCompleteContentSchema, BadgeContentSchema, CommentContentSchema, ContentDeletedContentSchema, ContentMovedContentSchema, DepositContentSchema, EventContentSchema, FollowContentSchema, InviteContentSchema, MentionContentSchema, type Notification, type NotificationAssetRef, NotificationAssetRefSchema, type NotificationContentAsset, NotificationContentAssetSchema, type NotificationOfType, NotificationParentRefSchema, NotificationRootInfoSchema, NotificationSchema, type NotificationType, NotificationTypeSchema, OnboardingActionRequiredContentSchema, OnboardingCompleteContentSchema, OwnershipTransferContentSchema, PaymentContentSchema, QuestEntryAcceptedContentSchema, QuestEntryContentSchema, ReactionContentSchema, ReferenceContentSchema, ReplyContentSchema, RouteEarningsMilestoneContentSchema, RoutePayoutContentSchema, ShareContentSchema };
|
|
3578
|
+
export { ActionCompleteContentSchema, BadgeContentSchema, CommentContentSchema, ContentDeletedContentSchema, ContentMovedContentSchema, DepositContentSchema, EventContentSchema, FollowContentSchema, InviteContentSchema, MentionContentSchema, type Notification, type NotificationAssetRef, NotificationAssetRefSchema, type NotificationContentAsset, NotificationContentAssetSchema, type NotificationOfType, NotificationParentRefSchema, NotificationRootInfoSchema, NotificationSchema, type NotificationType, NotificationTypeSchema, OnboardingActionRequiredContentSchema, OnboardingCompleteContentSchema, OwnershipTransferContentSchema, PaymentContentSchema, QuestEntryAcceptedContentSchema, QuestEntryContentSchema, QuestEntryEvalFailedContentSchema, ReactionContentSchema, ReferenceContentSchema, ReplyContentSchema, RouteEarningsMilestoneContentSchema, RoutePayoutContentSchema, ShareContentSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{r as ActionCompleteContentSchema,q as BadgeContentSchema,g as CommentContentSchema,
|
|
1
|
+
export{r as ActionCompleteContentSchema,q as BadgeContentSchema,g as CommentContentSchema,A as ContentDeletedContentSchema,z as ContentMovedContentSchema,p as DepositContentSchema,B as EventContentSchema,m as FollowContentSchema,n as InviteContentSchema,f as MentionContentSchema,b as NotificationAssetRefSchema,c as NotificationContentAssetSchema,d as NotificationParentRefSchema,e as NotificationRootInfoSchema,C as NotificationSchema,a as NotificationTypeSchema,w as OnboardingActionRequiredContentSchema,v as OnboardingCompleteContentSchema,l as OwnershipTransferContentSchema,o as PaymentContentSchema,t as QuestEntryAcceptedContentSchema,s as QuestEntryContentSchema,u as QuestEntryEvalFailedContentSchema,j as ReactionContentSchema,i as ReferenceContentSchema,h as ReplyContentSchema,x as RouteEarningsMilestoneContentSchema,y as RoutePayoutContentSchema,k as ShareContentSchema}from'../chunk-XXFKHRNE.js';import'../chunk-CDJH4OT5.js';import'../chunk-33C7IDRP.js';//# sourceMappingURL=notifications.js.map
|
|
2
2
|
//# sourceMappingURL=notifications.js.map
|
package/dist/schema/quests.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCIEATF7M_cjs=require('../chunk-CIEATF7M.cjs'),chunkADLJ3UUW_cjs=require('../chunk-ADLJ3UUW.cjs');require('../chunk-XEA4DDOE.cjs'),require('../chunk-KHERHT26.cjs'),require('../chunk-RMMMRN4X.cjs'),require('../chunk-3JPOAQ2M.cjs'),require('../chunk-KU5AWMS5.cjs'),require('../chunk-YTCAK2AH.cjs'),require('../chunk-YFEGRZXL.cjs'),require('../chunk-7HF5VHUN.cjs'),require('../chunk-JRBBNFFI.cjs');Object.defineProperty(exports,"CreateEntrySchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.q}});Object.defineProperty(exports,"CreateQuestItemObjectSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.j}});Object.defineProperty(exports,"CreateQuestItemSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.k}});Object.defineProperty(exports,"CreateQuestSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.m}});Object.defineProperty(exports,"EntryEvalStatusSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.e}});Object.defineProperty(exports,"EntrySchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.p}});Object.defineProperty(exports,"EntryStatusSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.f}});Object.defineProperty(exports,"LeaderboardOrderSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.g}});Object.defineProperty(exports,"QuestItemBaseSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.h}});Object.defineProperty(exports,"QuestItemSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.i}});Object.defineProperty(exports,"QuestItemStatusSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.c}});Object.defineProperty(exports,"QuestSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.l}});Object.defineProperty(exports,"QuestStatusSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.b}});Object.defineProperty(exports,"QuestTypeSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.a}});Object.defineProperty(exports,"ReviewEntrySchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.r}});Object.defineProperty(exports,"RewardCurrencySchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.d}});Object.defineProperty(exports,"UpdateQuestItemSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.o}});Object.defineProperty(exports,"UpdateQuestSchema",{enumerable:true,get:function(){return chunkCIEATF7M_cjs.n}});Object.defineProperty(exports,"KeyedAssetInputSchema",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.c}});Object.defineProperty(exports,"KeyedAssetRefsSchema",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.a}});Object.defineProperty(exports,"QuestSubmissionAssetDeclarationSchema",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.d}});//# sourceMappingURL=quests.cjs.map
|
|
2
2
|
//# sourceMappingURL=quests.cjs.map
|
package/dist/schema/quests.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{q as CreateEntrySchema,j as CreateQuestItemObjectSchema,k as CreateQuestItemSchema,m as CreateQuestSchema,e as EntryEvalStatusSchema,p as EntrySchema,f as EntryStatusSchema,g as LeaderboardOrderSchema,h as QuestItemBaseSchema,i as QuestItemSchema,c as QuestItemStatusSchema,l as QuestSchema,b as QuestStatusSchema,a as QuestTypeSchema,r as ReviewEntrySchema,d as RewardCurrencySchema,o as UpdateQuestItemSchema,n as UpdateQuestSchema}from'../chunk-
|
|
1
|
+
export{q as CreateEntrySchema,j as CreateQuestItemObjectSchema,k as CreateQuestItemSchema,m as CreateQuestSchema,e as EntryEvalStatusSchema,p as EntrySchema,f as EntryStatusSchema,g as LeaderboardOrderSchema,h as QuestItemBaseSchema,i as QuestItemSchema,c as QuestItemStatusSchema,l as QuestSchema,b as QuestStatusSchema,a as QuestTypeSchema,r as ReviewEntrySchema,d as RewardCurrencySchema,o as UpdateQuestItemSchema,n as UpdateQuestSchema}from'../chunk-ZFARY5F4.js';export{c as KeyedAssetInputSchema,a as KeyedAssetRefsSchema,d as QuestSubmissionAssetDeclarationSchema}from'../chunk-64ZUBBP7.js';import'../chunk-RS5H4XDK.js';import'../chunk-OU4JKY4M.js';import'../chunk-PGCNGDPK.js';import'../chunk-Y6BK75KP.js';import'../chunk-OCG3P3PJ.js';import'../chunk-CDJH4OT5.js';import'../chunk-33C7IDRP.js';import'../chunk-DUBPWSCA.js';import'../chunk-42ADEGDM.js';//# sourceMappingURL=quests.js.map
|
|
2
2
|
//# sourceMappingURL=quests.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkADLJ3UUW_cjs=require('../chunk-ADLJ3UUW.cjs');require('../chunk-XEA4DDOE.cjs'),require('../chunk-KHERHT26.cjs'),require('../chunk-RMMMRN4X.cjs'),require('../chunk-3JPOAQ2M.cjs'),require('../chunk-KU5AWMS5.cjs'),require('../chunk-YTCAK2AH.cjs'),require('../chunk-YFEGRZXL.cjs'),require('../chunk-7HF5VHUN.cjs'),require('../chunk-JRBBNFFI.cjs');Object.defineProperty(exports,"KeyedAssetInputSchema",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.c}});Object.defineProperty(exports,"KeyedAssetInputValueSchema",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.b}});Object.defineProperty(exports,"KeyedAssetRefsSchema",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.a}});Object.defineProperty(exports,"QuestSubmissionAssetDeclarationSchema",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.d}});Object.defineProperty(exports,"assetMatchesDeclaration",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.k}});Object.defineProperty(exports,"declarationToPickerFilters",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.j}});Object.defineProperty(exports,"declarationToSubmissionDeclaration",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.f}});Object.defineProperty(exports,"getPrimaryAssetRef",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.l}});Object.defineProperty(exports,"getPrimaryDeclarationKey",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.h}});Object.defineProperty(exports,"getRouteInputDeclarationsFromRoute",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.e}});Object.defineProperty(exports,"getSubmissionAssetShape",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.i}});Object.defineProperty(exports,"materializeContributorSubmissionAssets",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.g}});Object.defineProperty(exports,"toRouteInputAssets",{enumerable:true,get:function(){return chunkADLJ3UUW_cjs.m}});//# sourceMappingURL=quest-submission.cjs.map
|
|
2
2
|
//# sourceMappingURL=quest-submission.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{c as KeyedAssetInputSchema,b as KeyedAssetInputValueSchema,a as KeyedAssetRefsSchema,d as QuestSubmissionAssetDeclarationSchema,k as assetMatchesDeclaration,j as declarationToPickerFilters,f as declarationToSubmissionDeclaration,l as getPrimaryAssetRef,h as getPrimaryDeclarationKey,e as getRouteInputDeclarationsFromRoute,i as getSubmissionAssetShape,g as materializeContributorSubmissionAssets,m as toRouteInputAssets}from'../chunk-
|
|
1
|
+
export{c as KeyedAssetInputSchema,b as KeyedAssetInputValueSchema,a as KeyedAssetRefsSchema,d as QuestSubmissionAssetDeclarationSchema,k as assetMatchesDeclaration,j as declarationToPickerFilters,f as declarationToSubmissionDeclaration,l as getPrimaryAssetRef,h as getPrimaryDeclarationKey,e as getRouteInputDeclarationsFromRoute,i as getSubmissionAssetShape,g as materializeContributorSubmissionAssets,m as toRouteInputAssets}from'../chunk-64ZUBBP7.js';import'../chunk-RS5H4XDK.js';import'../chunk-OU4JKY4M.js';import'../chunk-PGCNGDPK.js';import'../chunk-Y6BK75KP.js';import'../chunk-OCG3P3PJ.js';import'../chunk-CDJH4OT5.js';import'../chunk-33C7IDRP.js';import'../chunk-DUBPWSCA.js';import'../chunk-42ADEGDM.js';//# sourceMappingURL=quest-submission.js.map
|
|
2
2
|
//# sourceMappingURL=quest-submission.js.map
|
package/package.json
CHANGED
package/dist/chunk-5SC4M4E3.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkYFEGRZXL_cjs=require('./chunk-YFEGRZXL.cjs'),zod=require('zod');var n=zod.enum(["public","private","organization","monetized"]),h=zod.enum(["image","video","audio"]),u=zod.object({user:zod.optional(zod.uuid()),team:zod.optional(zod.uuid()),visibility:zod.optional(n),top_level_only:zod.optional(zod.boolean()),asset_type:zod.optional(zod.enum(["file","dataset"])),file_type:zod.optional(h),extension:zod.optional(zod.string()),license:zod.optional(zod.string()),method:zod.optional(chunkYFEGRZXL_cjs.l),status:zod.optional(chunkYFEGRZXL_cjs.j),source:zod.optional(chunkYFEGRZXL_cjs.k),has_reactions:zod.optional(zod.boolean()),has_comments:zod.optional(zod.boolean())}),F=zod.object({asset_type:zod.optional(zod.union([chunkYFEGRZXL_cjs.a,zod.array(chunkYFEGRZXL_cjs.a)])),user_id:zod.optional(zod.uuid()),org_id:zod.optional(zod.uuid()),team_id:zod.optional(zod.uuid()),visibility:zod.optional(zod.union([n,zod.array(n)])),license_id:zod.optional(zod.string()),source:zod.optional(chunkYFEGRZXL_cjs.k),top_level_only:zod.optional(zod.boolean()),method:zod.optional(chunkYFEGRZXL_cjs.l),status:zod.optional(chunkYFEGRZXL_cjs.j),exclude_user_id:zod.optional(zod.uuid()),exclude_org_ids:zod.optional(zod.array(zod.uuid()))}),_=zod.object({file_type:zod.optional(zod.string()),extension:zod.optional(zod.union([zod.string(),zod.array(zod.string())]))}).catchall(zod.optional(zod.union([zod.string(),zod.array(zod.string()),zod.boolean()])));exports.a=n;exports.b=h;exports.c=u;exports.d=F;exports.e=_;//# sourceMappingURL=chunk-5SC4M4E3.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-5SC4M4E3.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema/asset-filters.ts"],"names":["AssetFilterVisibilitySchema","zodEnum","AssetFilterFileTypeSchema","AssetFiltersSchema","object","optional","uuid","boolean","string","HttpMethodSchema","StatusSchema","SourceSchema","AssetSearchFiltersSchema","union","AssetTypeSchema","array","AssetMetadataFiltersSchema"],"mappings":"sFAoBA,IAAMA,EAA8BC,QAAQ,CAAA,CAC1C,QACA,CAAA,SAAA,CACA,cACA,CAAA,WACF,CAAC,CAGKC,CAAAA,CAAAA,CAA4BD,QAAQ,CAAA,CAAC,OAAS,CAAA,OAAA,CAAS,OAAO,CAAC,CAAA,CAO/DE,CAAqBC,CAAAA,UAAAA,CAAO,CAChC,IAAA,CAAMC,aAASC,QAAK,EAAC,CACrB,CAAA,IAAA,CAAMD,YAASC,CAAAA,QAAAA,EAA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AK,EAAC,EAChC,eAAiBD,CAAAA,YAAAA,CAASU,SAAMT,CAAAA,QAAAA,EAAM,CAAC,CACzC,CAAC,CAAA,CAMKU,CAA6BZ,CAAAA,UAAAA,CAAO,CACxC,SAAA,CAAWC,aAASG,UAAO,EAAC,CAC5B,CAAA,SAAA,CAAWH,YAASQ,CAAAA,SAAAA,CAAM,CAACL,UAAO,EAAA,CAAGO,SAAMP,CAAAA,UAAAA,EAAQ,CAAC,CAAC,CAAC,CACxD,CAAC,CAAA,CAAE,QAASH,CAAAA,YAAAA,CAASQ,UAAM,CAACL,UAAAA,EAAUO,CAAAA,SAAAA,CAAMP,UAAO,EAAC,EAAGD,WAAQ,EAAC,CAAC,CAAC,CAAC","file":"chunk-5SC4M4E3.cjs","sourcesContent":["import {\n object,\n string,\n uuid,\n boolean,\n array,\n union,\n enum as zodEnum,\n optional,\n type z,\n} from \"zod\";\n\nimport {\n AssetTypeSchema,\n HttpMethodSchema,\n SourceSchema,\n StatusSchema,\n} from \"./common\";\n\n/** Filterable visibilities — excludes `inherit` (not a browse/search value). */\nconst AssetFilterVisibilitySchema = zodEnum([\n \"public\",\n \"private\",\n \"organization\",\n \"monetized\",\n]);\n\n/** UI file-category chips used in the assets filter bar. */\nconst AssetFilterFileTypeSchema = zodEnum([\"image\", \"video\", \"audio\"]);\n\n/**\n * Client/UI filter state for asset lists and the filter bar.\n * Short keys (`user`, `team`, `license`) map to API columns via\n * {@link toAssetSearchFilters}.\n */\nconst AssetFiltersSchema = object({\n user: optional(uuid()),\n team: optional(uuid()),\n visibility: optional(AssetFilterVisibilitySchema),\n top_level_only: optional(boolean()),\n /** Data-list subtype chip (file vs dataset). */\n asset_type: optional(zodEnum([\"file\", \"dataset\"])),\n file_type: optional(AssetFilterFileTypeSchema),\n extension: optional(string()),\n license: optional(string()),\n method: optional(HttpMethodSchema),\n status: optional(StatusSchema),\n source: optional(SourceSchema),\n has_reactions: optional(boolean()),\n has_comments: optional(boolean()),\n});\n\n/**\n * Wire-format `filters` object for `/search/assets` and related RPCs.\n * Uses DB/API column names (`user_id`, `team_id`, `license_id`).\n */\nconst AssetSearchFiltersSchema = object({\n asset_type: optional(union([AssetTypeSchema, array(AssetTypeSchema)])),\n user_id: optional(uuid()),\n org_id: optional(uuid()),\n team_id: optional(uuid()),\n visibility: optional(\n union([AssetFilterVisibilitySchema, array(AssetFilterVisibilitySchema)])\n ),\n license_id: optional(string()),\n source: optional(SourceSchema),\n top_level_only: optional(boolean()),\n method: optional(HttpMethodSchema),\n status: optional(StatusSchema),\n /** Server-side personal/global scoping helper. */\n exclude_user_id: optional(uuid()),\n exclude_org_ids: optional(array(uuid())),\n});\n\n/**\n * Wire-format `metadata_filters` for file-oriented search\n * (`file_type`, `extension`, and arbitrary metadata keys).\n */\nconst AssetMetadataFiltersSchema = object({\n file_type: optional(string()),\n extension: optional(union([string(), array(string())])),\n}).catchall(optional(union([string(), array(string()), boolean()])));\n\nexport {\n AssetFilterVisibilitySchema,\n AssetFilterFileTypeSchema,\n AssetFiltersSchema,\n AssetSearchFiltersSchema,\n AssetMetadataFiltersSchema,\n};\n\nexport type AssetFilterVisibility = z.infer<typeof AssetFilterVisibilitySchema>;\nexport type AssetFilterFileType = z.infer<typeof AssetFilterFileTypeSchema>;\nexport type AssetFilters = z.infer<typeof AssetFiltersSchema>;\nexport type AssetSearchFilters = z.infer<typeof AssetSearchFiltersSchema>;\nexport type AssetMetadataFilters = z.infer<typeof AssetMetadataFiltersSchema>;\n"]}
|
package/dist/chunk-EC376C5T.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b}from'./chunk-CDJH4OT5.js';import {a,e}from'./chunk-33C7IDRP.js';import {enum as _enum,object,string,optional,any,nullable,number,array,boolean,uuid,discriminatedUnion,literal}from'zod';var te=_enum(["follow","like","comment","reply","mention","reference","invite","payment","event","share","badge","reaction","deposit","action-complete","action-failed","quest-entry","quest-entry-accepted","onboarding-complete","onboarding-action-required","route-earnings-milestone","route-payout","ownership-transfer","content-moved","content-deleted","other"]),w=object({assetId:string(),assetType:a}),r=object({assetId:optional(string()),assetType:optional(a),id:optional(string()),asset_type:optional(a),name:optional(nullable(string())),user_id:optional(string()),preview:optional(any()),description:optional(any()),slug:optional(nullable(string())),name_url_slug:optional(nullable(string())),org_id:optional(string()),parent_id:optional(nullable(string())),parent:optional(any()),user:optional(any()),organization:optional(any()),team:optional(any())}),h=object({assetId:string(),assetType:a}),l=object({slug:string(),assetType:a}),z=object({name:string(),description:optional(nullable(string())),slug:optional(nullable(string()))}),S=object({id:string(),name:optional(nullable(string()))}),_=object({id:string(),asset_id:optional(nullable(string())),asset_type:optional(nullable(string())),asset_name:optional(nullable(string()))}),i={text:optional(string())},x=object({...i,asset:optional(r),parent:optional(h),root:optional(l)}),C=object({...i,asset:optional(r),parent:optional(h),root:optional(l)}),E=C,I=object({...i,asset:optional(r),referencedAssetIds:optional(array(string())),referencedAssets:optional(array(w)),referenceCount:optional(number())}),O=object({...i,asset:optional(r),reaction_label:optional(string()),reaction_verb:optional(string()),aggregate_count:optional(number())}),g=object({...i,asset:optional(r)}),P=g,B=object({...i}),Q=object({...i,organization:optional(object({id:string(),name:string()}))}),k=object({...i,asset:optional(r),currency:optional(e),value:optional(number())}),M=object({...i,value:optional(number())}),D=object({...i,badge:optional(z)}),N=object({...i,status:optional(_enum(["success","error","timed-out"])),duration:optional(number()),route:optional(object({id:string(),name:optional(nullable(string()))}))}),F=N,j=object({...i,quest:optional(S),entry:optional(_)}),L=object({...i,quest:optional(S),entry:optional(_),reviewer:optional(nullable(object({id:string(),username:optional(nullable(string()))})))}),U=object({...i}),V=object({...i,requirements:optional(array(string()))}),Z=object({...i,milestone_cents:optional(number()),total_earnings_cents:optional(number())}),G=object({...i,payout_cents:optional(number()),gross_cents:optional(number()),platform_fee_cents:optional(number()),assets:optional(any()),asset_names:optional(array(string())),invoice_id:optional(string())}),T=object({...i,team_id:optional(string()),team_name:optional(nullable(string())),asset_name:optional(nullable(string())),asset_type:optional(nullable(string())),action:optional(string()),reason:optional(nullable(string())),moderator_scope:optional(_enum(["platform","team"]))}),H=T,J=object({...i,event:optional(object({type:_enum(["success","error"])}))}),K=object({...i,asset:optional(r)}),W=object({...i}),X=object({id:uuid(),source_user_id:uuid(),destination_user_id:uuid(),org_id:optional(nullable(uuid())),asset_id:optional(nullable(uuid())),reaction_id:optional(nullable(uuid())),action_id:optional(nullable(uuid())),parent_asset_id:optional(nullable(uuid())),root_asset_id:optional(nullable(uuid())),viewed:boolean(),created_at:string(),last_updated:string(),source_user:optional(b.partial()),asset:optional(r)}),o=(v,b)=>X.extend({type:literal(v),content:b}),ne=discriminatedUnion("type",[o("follow",B),o("like",K),o("comment",C),o("reply",E),o("mention",x),o("reference",I),o("invite",Q),o("payment",k),o("event",J),o("share",g),o("badge",D),o("reaction",O),o("deposit",M),o("action-complete",N),o("action-failed",F),o("quest-entry",j),o("quest-entry-accepted",L),o("onboarding-complete",U),o("onboarding-action-required",V),o("route-earnings-milestone",Z),o("route-payout",G),o("ownership-transfer",P),o("content-moved",T),o("content-deleted",H),o("other",W)]);export{J as A,ne as B,te as a,w as b,r as c,h as d,l as e,x as f,C as g,E as h,I as i,O as j,g as k,P as l,B as m,Q as n,k as o,M as p,D as q,N as r,j as s,L as t,U as u,V as v,Z as w,G as x,T as y,H as z};//# sourceMappingURL=chunk-EC376C5T.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-EC376C5T.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema/notifications.ts"],"names":["NotificationTypeSchema","zodEnum","NotificationAssetRefSchema","object","string","AssetTypeSchema","NotificationContentAssetSchema","optional","nullable","any","NotificationParentRefSchema","NotificationRootInfoSchema","NotificationBadgeContentSchema","NotificationQuestRefSchema","NotificationQuestEntryRefSchema","NotificationContentBase","MentionContentSchema","CommentContentSchema","ReplyContentSchema","ReferenceContentSchema","array","number","ReactionContentSchema","ShareContentSchema","OwnershipTransferContentSchema","FollowContentSchema","InviteContentSchema","PaymentContentSchema","PriceCurrencySchema","DepositContentSchema","BadgeContentSchema","ActionCompleteContentSchema","ActionFailedContentSchema","QuestEntryContentSchema","QuestEntryAcceptedContentSchema","OnboardingCompleteContentSchema","OnboardingActionRequiredContentSchema","RouteEarningsMilestoneContentSchema","RoutePayoutContentSchema","ContentMovedContentSchema","ContentDeletedContentSchema","EventContentSchema","LikeContentSchema","OtherContentSchema","NotificationRowBaseSchema","uuid","boolean","ProfileSchema","notificationVariant","type","content","literal","NotificationSchema","discriminatedUnion"],"mappings":"uMAmBMA,EAAyBC,CAAAA,KAAAA,CAAQ,CACrC,QAAA,CACA,MACA,CAAA,SAAA,CACA,QACA,SACA,CAAA,WAAA,CACA,QACA,CAAA,SAAA,CACA,OACA,CAAA,OAAA,CACA,QACA,UACA,CAAA,SAAA,CACA,iBACA,CAAA,eAAA,CACA,aACA,CAAA,sBAAA,CACA,sBACA,4BACA,CAAA,0BAAA,CACA,cACA,CAAA,oBAAA,CACA,eACA,CAAA,iBAAA,CACA,OACF,CAAC,CAAA,CAGKC,CAA6BC,CAAAA,MAAAA,CAAO,CACxC,OAAA,CAASC,QACT,CAAA,SAAA,CAAWC,CACb,CAAC,CAMKC,CAAAA,CAAAA,CAAiCH,OAAO,CAC5C,OAAA,CAASI,QAASH,CAAAA,MAAAA,EAAQ,CAAA,CAC1B,UAAWG,QAASF,CAAAA,CAAe,CACnC,CAAA,EAAA,CAAIE,QAASH,CAAAA,MAAAA,EAAQ,CACrB,CAAA,UAAA,CAAYG,QAASF,CAAAA,CAAe,CACpC,CAAA,IAAA,CAAME,SAASC,QAASJ,CAAAA,MAAAA,EAAQ,CAAC,CACjC,CAAA,OAAA,CAASG,SAASH,MAAO,EAAC,CAC1B,CAAA,OAAA,CAASG,QAASE,CAAAA,GAAAA,EAAK,CACvB,CAAA,WAAA,CAAaF,QAASE,CAAAA,GAAAA,EAAK,CAAA,CAC3B,KAAMF,QAASC,CAAAA,QAAAA,CAASJ,QAAQ,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AA,4BAAA,CACAZ,CACF,CACAY,CAAAA,CAAAA,CACE,0BACAX,CAAAA,CACF,CACAW,CAAAA,CAAAA,CAAoB,eAAgBV,CAAwB,CAAA,CAC5DU,CAAoB,CAAA,oBAAA,CAAsBxB,CAA8B,CAAA,CACxEwB,EAAoB,eAAiBT,CAAAA,CAAyB,CAC9DS,CAAAA,CAAAA,CAAoB,iBAAmBR,CAAAA,CAA2B,EAClEQ,CAAoB,CAAA,OAAA,CAASL,CAAkB,CACjD,CAAC","file":"chunk-EC376C5T.js","sourcesContent":["import {\n object,\n string,\n boolean,\n number,\n array,\n any,\n type z,\n enum as zodEnum,\n optional,\n nullable,\n uuid,\n literal,\n discriminatedUnion,\n} from \"zod\";\n\nimport { AssetTypeSchema, PriceCurrencySchema } from \"./common\";\nimport { ProfileSchema } from \"./users\";\n\nconst NotificationTypeSchema = zodEnum([\n \"follow\",\n \"like\",\n \"comment\",\n \"reply\",\n \"mention\",\n \"reference\",\n \"invite\",\n \"payment\",\n \"event\",\n \"share\",\n \"badge\",\n \"reaction\",\n \"deposit\",\n \"action-complete\",\n \"action-failed\",\n \"quest-entry\",\n \"quest-entry-accepted\",\n \"onboarding-complete\",\n \"onboarding-action-required\",\n \"route-earnings-milestone\",\n \"route-payout\",\n \"ownership-transfer\",\n \"content-moved\",\n \"content-deleted\",\n \"other\",\n]);\n\n/** Stored pointer written when creating a notification. */\nconst NotificationAssetRefSchema = object({\n assetId: string(),\n assetType: AssetTypeSchema,\n});\n\n/**\n * `content.asset` is a ref at write time and a list-row asset after API\n * hydration (which replaces the ref and may attach `parent`).\n */\nconst NotificationContentAssetSchema = object({\n assetId: optional(string()),\n assetType: optional(AssetTypeSchema),\n id: optional(string()),\n asset_type: optional(AssetTypeSchema),\n name: optional(nullable(string())),\n user_id: optional(string()),\n preview: optional(any()),\n description: optional(any()),\n slug: optional(nullable(string())),\n name_url_slug: optional(nullable(string())),\n org_id: optional(string()),\n parent_id: optional(nullable(string())),\n parent: optional(any()),\n user: optional(any()),\n organization: optional(any()),\n team: optional(any()),\n});\n\nconst NotificationParentRefSchema = object({\n assetId: string(),\n assetType: AssetTypeSchema,\n});\n\nconst NotificationRootInfoSchema = object({\n slug: string(),\n assetType: AssetTypeSchema,\n});\n\nconst NotificationBadgeContentSchema = object({\n name: string(),\n description: optional(nullable(string())),\n slug: optional(nullable(string())),\n});\n\nconst NotificationQuestRefSchema = object({\n id: string(),\n name: optional(nullable(string())),\n});\n\nconst NotificationQuestEntryRefSchema = object({\n id: string(),\n asset_id: optional(nullable(string())),\n asset_type: optional(nullable(string())),\n asset_name: optional(nullable(string())),\n});\n\nconst NotificationContentBase = {\n text: optional(string()),\n};\n\nconst MentionContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n parent: optional(NotificationParentRefSchema),\n root: optional(NotificationRootInfoSchema),\n});\n\nconst CommentContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n parent: optional(NotificationParentRefSchema),\n root: optional(NotificationRootInfoSchema),\n});\n\nconst ReplyContentSchema = CommentContentSchema;\n\nconst ReferenceContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n referencedAssetIds: optional(array(string())),\n referencedAssets: optional(array(NotificationAssetRefSchema)),\n referenceCount: optional(number()),\n});\n\nconst ReactionContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n reaction_label: optional(string()),\n reaction_verb: optional(string()),\n aggregate_count: optional(number()),\n});\n\nconst ShareContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n});\n\nconst OwnershipTransferContentSchema = ShareContentSchema;\n\nconst FollowContentSchema = object({\n ...NotificationContentBase,\n});\n\nconst InviteContentSchema = object({\n ...NotificationContentBase,\n organization: optional(\n object({\n id: string(),\n name: string(),\n })\n ),\n});\n\nconst PaymentContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n currency: optional(PriceCurrencySchema),\n value: optional(number()),\n});\n\nconst DepositContentSchema = object({\n ...NotificationContentBase,\n value: optional(number()),\n});\n\nconst BadgeContentSchema = object({\n ...NotificationContentBase,\n badge: optional(NotificationBadgeContentSchema),\n});\n\nconst ActionCompleteContentSchema = object({\n ...NotificationContentBase,\n status: optional(zodEnum([\"success\", \"error\", \"timed-out\"])),\n duration: optional(number()),\n route: optional(\n object({\n id: string(),\n name: optional(nullable(string())),\n })\n ),\n});\n\nconst ActionFailedContentSchema = ActionCompleteContentSchema;\n\nconst QuestEntryContentSchema = object({\n ...NotificationContentBase,\n quest: optional(NotificationQuestRefSchema),\n entry: optional(NotificationQuestEntryRefSchema),\n});\n\nconst QuestEntryAcceptedContentSchema = object({\n ...NotificationContentBase,\n quest: optional(NotificationQuestRefSchema),\n entry: optional(NotificationQuestEntryRefSchema),\n reviewer: optional(\n nullable(\n object({\n id: string(),\n username: optional(nullable(string())),\n })\n )\n ),\n});\n\nconst OnboardingCompleteContentSchema = object({\n ...NotificationContentBase,\n});\n\nconst OnboardingActionRequiredContentSchema = object({\n ...NotificationContentBase,\n requirements: optional(array(string())),\n});\n\nconst RouteEarningsMilestoneContentSchema = object({\n ...NotificationContentBase,\n milestone_cents: optional(number()),\n total_earnings_cents: optional(number()),\n});\n\nconst RoutePayoutContentSchema = object({\n ...NotificationContentBase,\n payout_cents: optional(number()),\n gross_cents: optional(number()),\n platform_fee_cents: optional(number()),\n assets: optional(any()),\n asset_names: optional(array(string())),\n invoice_id: optional(string()),\n});\n\nconst ContentMovedContentSchema = object({\n ...NotificationContentBase,\n team_id: optional(string()),\n team_name: optional(nullable(string())),\n asset_name: optional(nullable(string())),\n asset_type: optional(nullable(string())),\n action: optional(string()),\n reason: optional(nullable(string())),\n moderator_scope: optional(zodEnum([\"platform\", \"team\"])),\n});\n\nconst ContentDeletedContentSchema = ContentMovedContentSchema;\n\nconst EventContentSchema = object({\n ...NotificationContentBase,\n event: optional(\n object({\n type: zodEnum([\"success\", \"error\"]),\n })\n ),\n});\n\nconst LikeContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n});\n\nconst OtherContentSchema = object({\n ...NotificationContentBase,\n});\n\nconst NotificationRowBaseSchema = object({\n id: uuid(),\n source_user_id: uuid(),\n destination_user_id: uuid(),\n org_id: optional(nullable(uuid())),\n asset_id: optional(nullable(uuid())),\n reaction_id: optional(nullable(uuid())),\n action_id: optional(nullable(uuid())),\n parent_asset_id: optional(nullable(uuid())),\n root_asset_id: optional(nullable(uuid())),\n viewed: boolean(),\n created_at: string(),\n last_updated: string(),\n /** Joined on list/read responses. */\n source_user: optional(ProfileSchema.partial()),\n /** Joined `assets` row for `asset_id` (not `content.asset`). */\n asset: optional(NotificationContentAssetSchema),\n});\n\nconst notificationVariant = <\n T extends z.infer<typeof NotificationTypeSchema>,\n C extends z.ZodType,\n>(\n type: T,\n content: C\n) =>\n NotificationRowBaseSchema.extend({\n type: literal(type),\n content,\n });\n\nconst NotificationSchema = discriminatedUnion(\"type\", [\n notificationVariant(\"follow\", FollowContentSchema),\n notificationVariant(\"like\", LikeContentSchema),\n notificationVariant(\"comment\", CommentContentSchema),\n notificationVariant(\"reply\", ReplyContentSchema),\n notificationVariant(\"mention\", MentionContentSchema),\n notificationVariant(\"reference\", ReferenceContentSchema),\n notificationVariant(\"invite\", InviteContentSchema),\n notificationVariant(\"payment\", PaymentContentSchema),\n notificationVariant(\"event\", EventContentSchema),\n notificationVariant(\"share\", ShareContentSchema),\n notificationVariant(\"badge\", BadgeContentSchema),\n notificationVariant(\"reaction\", ReactionContentSchema),\n notificationVariant(\"deposit\", DepositContentSchema),\n notificationVariant(\"action-complete\", ActionCompleteContentSchema),\n notificationVariant(\"action-failed\", ActionFailedContentSchema),\n notificationVariant(\"quest-entry\", QuestEntryContentSchema),\n notificationVariant(\"quest-entry-accepted\", QuestEntryAcceptedContentSchema),\n notificationVariant(\"onboarding-complete\", OnboardingCompleteContentSchema),\n notificationVariant(\n \"onboarding-action-required\",\n OnboardingActionRequiredContentSchema\n ),\n notificationVariant(\n \"route-earnings-milestone\",\n RouteEarningsMilestoneContentSchema\n ),\n notificationVariant(\"route-payout\", RoutePayoutContentSchema),\n notificationVariant(\"ownership-transfer\", OwnershipTransferContentSchema),\n notificationVariant(\"content-moved\", ContentMovedContentSchema),\n notificationVariant(\"content-deleted\", ContentDeletedContentSchema),\n notificationVariant(\"other\", OtherContentSchema),\n]);\n\ntype Notification = z.infer<typeof NotificationSchema>;\ntype NotificationType = z.infer<typeof NotificationTypeSchema>;\ntype NotificationOfType<T extends NotificationType> = Extract<\n Notification,\n { type: T }\n>;\ntype NotificationContentAsset = z.infer<typeof NotificationContentAssetSchema>;\ntype NotificationAssetRef = z.infer<typeof NotificationAssetRefSchema>;\n\nexport {\n NotificationSchema,\n NotificationTypeSchema,\n NotificationAssetRefSchema,\n NotificationContentAssetSchema,\n NotificationParentRefSchema,\n NotificationRootInfoSchema,\n MentionContentSchema,\n CommentContentSchema,\n ReplyContentSchema,\n ReferenceContentSchema,\n ReactionContentSchema,\n ShareContentSchema,\n OwnershipTransferContentSchema,\n FollowContentSchema,\n InviteContentSchema,\n PaymentContentSchema,\n DepositContentSchema,\n BadgeContentSchema,\n ActionCompleteContentSchema,\n QuestEntryContentSchema,\n QuestEntryAcceptedContentSchema,\n OnboardingCompleteContentSchema,\n OnboardingActionRequiredContentSchema,\n RouteEarningsMilestoneContentSchema,\n RoutePayoutContentSchema,\n ContentMovedContentSchema,\n ContentDeletedContentSchema,\n EventContentSchema,\n};\nexport type {\n Notification,\n NotificationType,\n NotificationOfType,\n NotificationContentAsset,\n NotificationAssetRef,\n};\n"]}
|
package/dist/chunk-KMENBGAB.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {k,j,l,a}from'./chunk-33C7IDRP.js';import {enum as _enum,object,optional,boolean,string,uuid,array,union}from'zod';var n=_enum(["public","private","organization","monetized"]),h=_enum(["image","video","audio"]),u=object({user:optional(uuid()),team:optional(uuid()),visibility:optional(n),top_level_only:optional(boolean()),asset_type:optional(_enum(["file","dataset"])),file_type:optional(h),extension:optional(string()),license:optional(string()),method:optional(l),status:optional(j),source:optional(k),has_reactions:optional(boolean()),has_comments:optional(boolean())}),F=object({asset_type:optional(union([a,array(a)])),user_id:optional(uuid()),org_id:optional(uuid()),team_id:optional(uuid()),visibility:optional(union([n,array(n)])),license_id:optional(string()),source:optional(k),top_level_only:optional(boolean()),method:optional(l),status:optional(j),exclude_user_id:optional(uuid()),exclude_org_ids:optional(array(uuid()))}),_=object({file_type:optional(string()),extension:optional(union([string(),array(string())]))}).catchall(optional(union([string(),array(string()),boolean()])));export{n as a,h as b,u as c,F as d,_ as e};//# sourceMappingURL=chunk-KMENBGAB.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-KMENBGAB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema/asset-filters.ts"],"names":["AssetFilterVisibilitySchema","zodEnum","AssetFilterFileTypeSchema","AssetFiltersSchema","object","optional","uuid","boolean","string","HttpMethodSchema","StatusSchema","SourceSchema","AssetSearchFiltersSchema","union","AssetTypeSchema","array","AssetMetadataFiltersSchema"],"mappings":"0HAoBA,IAAMA,EAA8BC,KAAQ,CAAA,CAC1C,QACA,CAAA,SAAA,CACA,cACA,CAAA,WACF,CAAC,CAGKC,CAAAA,CAAAA,CAA4BD,KAAQ,CAAA,CAAC,OAAS,CAAA,OAAA,CAAS,OAAO,CAAC,CAAA,CAO/DE,CAAqBC,CAAAA,MAAAA,CAAO,CAChC,IAAA,CAAMC,SAASC,IAAK,EAAC,CACrB,CAAA,IAAA,CAAMD,QAASC,CAAAA,IAAAA,EAAM,CACrB,CAAA,UAAA,CAAYD,QAASL,CAAAA,CAA2B,CAChD,CAAA,cAAA,CAAgBK,SAASE,OAAQ,EAAC,EAElC,UAAYF,CAAAA,QAAAA,CAASJ,MAAQ,CAAC,MAAA,CAAQ,SAAS,CAAC,CAAC,CAAA,CACj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AWH,QAASQ,CAAAA,KAAAA,CAAM,CAACL,MAAO,EAAA,CAAGO,KAAMP,CAAAA,MAAAA,EAAQ,CAAC,CAAC,CAAC,CACxD,CAAC,CAAA,CAAE,QAASH,CAAAA,QAAAA,CAASQ,MAAM,CAACL,MAAAA,EAAUO,CAAAA,KAAAA,CAAMP,MAAO,EAAC,EAAGD,OAAQ,EAAC,CAAC,CAAC,CAAC","file":"chunk-KMENBGAB.js","sourcesContent":["import {\n object,\n string,\n uuid,\n boolean,\n array,\n union,\n enum as zodEnum,\n optional,\n type z,\n} from \"zod\";\n\nimport {\n AssetTypeSchema,\n HttpMethodSchema,\n SourceSchema,\n StatusSchema,\n} from \"./common\";\n\n/** Filterable visibilities — excludes `inherit` (not a browse/search value). */\nconst AssetFilterVisibilitySchema = zodEnum([\n \"public\",\n \"private\",\n \"organization\",\n \"monetized\",\n]);\n\n/** UI file-category chips used in the assets filter bar. */\nconst AssetFilterFileTypeSchema = zodEnum([\"image\", \"video\", \"audio\"]);\n\n/**\n * Client/UI filter state for asset lists and the filter bar.\n * Short keys (`user`, `team`, `license`) map to API columns via\n * {@link toAssetSearchFilters}.\n */\nconst AssetFiltersSchema = object({\n user: optional(uuid()),\n team: optional(uuid()),\n visibility: optional(AssetFilterVisibilitySchema),\n top_level_only: optional(boolean()),\n /** Data-list subtype chip (file vs dataset). */\n asset_type: optional(zodEnum([\"file\", \"dataset\"])),\n file_type: optional(AssetFilterFileTypeSchema),\n extension: optional(string()),\n license: optional(string()),\n method: optional(HttpMethodSchema),\n status: optional(StatusSchema),\n source: optional(SourceSchema),\n has_reactions: optional(boolean()),\n has_comments: optional(boolean()),\n});\n\n/**\n * Wire-format `filters` object for `/search/assets` and related RPCs.\n * Uses DB/API column names (`user_id`, `team_id`, `license_id`).\n */\nconst AssetSearchFiltersSchema = object({\n asset_type: optional(union([AssetTypeSchema, array(AssetTypeSchema)])),\n user_id: optional(uuid()),\n org_id: optional(uuid()),\n team_id: optional(uuid()),\n visibility: optional(\n union([AssetFilterVisibilitySchema, array(AssetFilterVisibilitySchema)])\n ),\n license_id: optional(string()),\n source: optional(SourceSchema),\n top_level_only: optional(boolean()),\n method: optional(HttpMethodSchema),\n status: optional(StatusSchema),\n /** Server-side personal/global scoping helper. */\n exclude_user_id: optional(uuid()),\n exclude_org_ids: optional(array(uuid())),\n});\n\n/**\n * Wire-format `metadata_filters` for file-oriented search\n * (`file_type`, `extension`, and arbitrary metadata keys).\n */\nconst AssetMetadataFiltersSchema = object({\n file_type: optional(string()),\n extension: optional(union([string(), array(string())])),\n}).catchall(optional(union([string(), array(string()), boolean()])));\n\nexport {\n AssetFilterVisibilitySchema,\n AssetFilterFileTypeSchema,\n AssetFiltersSchema,\n AssetSearchFiltersSchema,\n AssetMetadataFiltersSchema,\n};\n\nexport type AssetFilterVisibility = z.infer<typeof AssetFilterVisibilitySchema>;\nexport type AssetFilterFileType = z.infer<typeof AssetFilterFileTypeSchema>;\nexport type AssetFilters = z.infer<typeof AssetFiltersSchema>;\nexport type AssetSearchFilters = z.infer<typeof AssetSearchFiltersSchema>;\nexport type AssetMetadataFilters = z.infer<typeof AssetMetadataFiltersSchema>;\n"]}
|
package/dist/chunk-LHCGBWFP.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkYTCAK2AH_cjs=require('./chunk-YTCAK2AH.cjs'),chunkYFEGRZXL_cjs=require('./chunk-YFEGRZXL.cjs'),zod=require('zod');var te=zod.enum(["follow","like","comment","reply","mention","reference","invite","payment","event","share","badge","reaction","deposit","action-complete","action-failed","quest-entry","quest-entry-accepted","onboarding-complete","onboarding-action-required","route-earnings-milestone","route-payout","ownership-transfer","content-moved","content-deleted","other"]),w=zod.object({assetId:zod.string(),assetType:chunkYFEGRZXL_cjs.a}),r=zod.object({assetId:zod.optional(zod.string()),assetType:zod.optional(chunkYFEGRZXL_cjs.a),id:zod.optional(zod.string()),asset_type:zod.optional(chunkYFEGRZXL_cjs.a),name:zod.optional(zod.nullable(zod.string())),user_id:zod.optional(zod.string()),preview:zod.optional(zod.any()),description:zod.optional(zod.any()),slug:zod.optional(zod.nullable(zod.string())),name_url_slug:zod.optional(zod.nullable(zod.string())),org_id:zod.optional(zod.string()),parent_id:zod.optional(zod.nullable(zod.string())),parent:zod.optional(zod.any()),user:zod.optional(zod.any()),organization:zod.optional(zod.any()),team:zod.optional(zod.any())}),h=zod.object({assetId:zod.string(),assetType:chunkYFEGRZXL_cjs.a}),l=zod.object({slug:zod.string(),assetType:chunkYFEGRZXL_cjs.a}),z=zod.object({name:zod.string(),description:zod.optional(zod.nullable(zod.string())),slug:zod.optional(zod.nullable(zod.string()))}),S=zod.object({id:zod.string(),name:zod.optional(zod.nullable(zod.string()))}),_=zod.object({id:zod.string(),asset_id:zod.optional(zod.nullable(zod.string())),asset_type:zod.optional(zod.nullable(zod.string())),asset_name:zod.optional(zod.nullable(zod.string()))}),i={text:zod.optional(zod.string())},x=zod.object({...i,asset:zod.optional(r),parent:zod.optional(h),root:zod.optional(l)}),C=zod.object({...i,asset:zod.optional(r),parent:zod.optional(h),root:zod.optional(l)}),E=C,I=zod.object({...i,asset:zod.optional(r),referencedAssetIds:zod.optional(zod.array(zod.string())),referencedAssets:zod.optional(zod.array(w)),referenceCount:zod.optional(zod.number())}),O=zod.object({...i,asset:zod.optional(r),reaction_label:zod.optional(zod.string()),reaction_verb:zod.optional(zod.string()),aggregate_count:zod.optional(zod.number())}),g=zod.object({...i,asset:zod.optional(r)}),P=g,B=zod.object({...i}),Q=zod.object({...i,organization:zod.optional(zod.object({id:zod.string(),name:zod.string()}))}),k=zod.object({...i,asset:zod.optional(r),currency:zod.optional(chunkYFEGRZXL_cjs.e),value:zod.optional(zod.number())}),M=zod.object({...i,value:zod.optional(zod.number())}),D=zod.object({...i,badge:zod.optional(z)}),N=zod.object({...i,status:zod.optional(zod.enum(["success","error","timed-out"])),duration:zod.optional(zod.number()),route:zod.optional(zod.object({id:zod.string(),name:zod.optional(zod.nullable(zod.string()))}))}),F=N,j=zod.object({...i,quest:zod.optional(S),entry:zod.optional(_)}),L=zod.object({...i,quest:zod.optional(S),entry:zod.optional(_),reviewer:zod.optional(zod.nullable(zod.object({id:zod.string(),username:zod.optional(zod.nullable(zod.string()))})))}),U=zod.object({...i}),V=zod.object({...i,requirements:zod.optional(zod.array(zod.string()))}),Z=zod.object({...i,milestone_cents:zod.optional(zod.number()),total_earnings_cents:zod.optional(zod.number())}),G=zod.object({...i,payout_cents:zod.optional(zod.number()),gross_cents:zod.optional(zod.number()),platform_fee_cents:zod.optional(zod.number()),assets:zod.optional(zod.any()),asset_names:zod.optional(zod.array(zod.string())),invoice_id:zod.optional(zod.string())}),T=zod.object({...i,team_id:zod.optional(zod.string()),team_name:zod.optional(zod.nullable(zod.string())),asset_name:zod.optional(zod.nullable(zod.string())),asset_type:zod.optional(zod.nullable(zod.string())),action:zod.optional(zod.string()),reason:zod.optional(zod.nullable(zod.string())),moderator_scope:zod.optional(zod.enum(["platform","team"]))}),H=T,J=zod.object({...i,event:zod.optional(zod.object({type:zod.enum(["success","error"])}))}),K=zod.object({...i,asset:zod.optional(r)}),W=zod.object({...i}),X=zod.object({id:zod.uuid(),source_user_id:zod.uuid(),destination_user_id:zod.uuid(),org_id:zod.optional(zod.nullable(zod.uuid())),asset_id:zod.optional(zod.nullable(zod.uuid())),reaction_id:zod.optional(zod.nullable(zod.uuid())),action_id:zod.optional(zod.nullable(zod.uuid())),parent_asset_id:zod.optional(zod.nullable(zod.uuid())),root_asset_id:zod.optional(zod.nullable(zod.uuid())),viewed:zod.boolean(),created_at:zod.string(),last_updated:zod.string(),source_user:zod.optional(chunkYTCAK2AH_cjs.b.partial()),asset:zod.optional(r)}),o=(v,b)=>X.extend({type:zod.literal(v),content:b}),ne=zod.discriminatedUnion("type",[o("follow",B),o("like",K),o("comment",C),o("reply",E),o("mention",x),o("reference",I),o("invite",Q),o("payment",k),o("event",J),o("share",g),o("badge",D),o("reaction",O),o("deposit",M),o("action-complete",N),o("action-failed",F),o("quest-entry",j),o("quest-entry-accepted",L),o("onboarding-complete",U),o("onboarding-action-required",V),o("route-earnings-milestone",Z),o("route-payout",G),o("ownership-transfer",P),o("content-moved",T),o("content-deleted",H),o("other",W)]);exports.A=J;exports.B=ne;exports.a=te;exports.b=w;exports.c=r;exports.d=h;exports.e=l;exports.f=x;exports.g=C;exports.h=E;exports.i=I;exports.j=O;exports.k=g;exports.l=P;exports.m=B;exports.n=Q;exports.o=k;exports.p=M;exports.q=D;exports.r=N;exports.s=j;exports.t=L;exports.u=U;exports.v=V;exports.w=Z;exports.x=G;exports.y=T;exports.z=H;//# sourceMappingURL=chunk-LHCGBWFP.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-LHCGBWFP.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema/notifications.ts"],"names":["NotificationTypeSchema","zodEnum","NotificationAssetRefSchema","object","string","AssetTypeSchema","NotificationContentAssetSchema","optional","nullable","any","NotificationParentRefSchema","NotificationRootInfoSchema","NotificationBadgeContentSchema","NotificationQuestRefSchema","NotificationQuestEntryRefSchema","NotificationContentBase","MentionContentSchema","CommentContentSchema","ReplyContentSchema","ReferenceContentSchema","array","number","ReactionContentSchema","ShareContentSchema","OwnershipTransferContentSchema","FollowContentSchema","InviteContentSchema","PaymentContentSchema","PriceCurrencySchema","DepositContentSchema","BadgeContentSchema","ActionCompleteContentSchema","ActionFailedContentSchema","QuestEntryContentSchema","QuestEntryAcceptedContentSchema","OnboardingCompleteContentSchema","OnboardingActionRequiredContentSchema","RouteEarningsMilestoneContentSchema","RoutePayoutContentSchema","ContentMovedContentSchema","ContentDeletedContentSchema","EventContentSchema","LikeContentSchema","OtherContentSchema","NotificationRowBaseSchema","uuid","boolean","ProfileSchema","notificationVariant","type","content","literal","NotificationSchema","discriminatedUnion"],"mappings":"4IAmBMA,EAAyBC,CAAAA,QAAAA,CAAQ,CACrC,QAAA,CACA,MACA,CAAA,SAAA,CACA,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AQN,CAAAA,CAAiB,CAC7CM,CAAAA,CAAAA,CAAoB,SAAW/B,CAAAA,CAAoB,EACnD+B,CAAoB,CAAA,OAAA,CAAS9B,CAAkB,CAAA,CAC/C8B,CAAoB,CAAA,SAAA,CAAWhC,CAAoB,CACnDgC,CAAAA,CAAAA,CAAoB,WAAa7B,CAAAA,CAAsB,CACvD6B,CAAAA,CAAAA,CAAoB,SAAUtB,CAAmB,CAAA,CACjDsB,CAAoB,CAAA,SAAA,CAAWrB,CAAoB,CAAA,CACnDqB,EAAoB,OAASP,CAAAA,CAAkB,CAC/CO,CAAAA,CAAAA,CAAoB,OAASzB,CAAAA,CAAkB,EAC/CyB,CAAoB,CAAA,OAAA,CAASlB,CAAkB,CAAA,CAC/CkB,CAAoB,CAAA,UAAA,CAAY1B,CAAqB,CACrD0B,CAAAA,CAAAA,CAAoB,SAAWnB,CAAAA,CAAoB,CACnDmB,CAAAA,CAAAA,CAAoB,kBAAmBjB,CAA2B,CAAA,CAClEiB,CAAoB,CAAA,eAAA,CAAiBhB,CAAyB,CAAA,CAC9DgB,EAAoB,aAAef,CAAAA,CAAuB,CAC1De,CAAAA,CAAAA,CAAoB,sBAAwBd,CAAAA,CAA+B,EAC3Ec,CAAoB,CAAA,qBAAA,CAAuBb,CAA+B,CAAA,CAC1Ea,CACE,CAAA,4BAAA,CACAZ,CACF,CACAY,CAAAA,CAAAA,CACE,0BACAX,CAAAA,CACF,CACAW,CAAAA,CAAAA,CAAoB,eAAgBV,CAAwB,CAAA,CAC5DU,CAAoB,CAAA,oBAAA,CAAsBxB,CAA8B,CAAA,CACxEwB,EAAoB,eAAiBT,CAAAA,CAAyB,CAC9DS,CAAAA,CAAAA,CAAoB,iBAAmBR,CAAAA,CAA2B,EAClEQ,CAAoB,CAAA,OAAA,CAASL,CAAkB,CACjD,CAAC","file":"chunk-LHCGBWFP.cjs","sourcesContent":["import {\n object,\n string,\n boolean,\n number,\n array,\n any,\n type z,\n enum as zodEnum,\n optional,\n nullable,\n uuid,\n literal,\n discriminatedUnion,\n} from \"zod\";\n\nimport { AssetTypeSchema, PriceCurrencySchema } from \"./common\";\nimport { ProfileSchema } from \"./users\";\n\nconst NotificationTypeSchema = zodEnum([\n \"follow\",\n \"like\",\n \"comment\",\n \"reply\",\n \"mention\",\n \"reference\",\n \"invite\",\n \"payment\",\n \"event\",\n \"share\",\n \"badge\",\n \"reaction\",\n \"deposit\",\n \"action-complete\",\n \"action-failed\",\n \"quest-entry\",\n \"quest-entry-accepted\",\n \"onboarding-complete\",\n \"onboarding-action-required\",\n \"route-earnings-milestone\",\n \"route-payout\",\n \"ownership-transfer\",\n \"content-moved\",\n \"content-deleted\",\n \"other\",\n]);\n\n/** Stored pointer written when creating a notification. */\nconst NotificationAssetRefSchema = object({\n assetId: string(),\n assetType: AssetTypeSchema,\n});\n\n/**\n * `content.asset` is a ref at write time and a list-row asset after API\n * hydration (which replaces the ref and may attach `parent`).\n */\nconst NotificationContentAssetSchema = object({\n assetId: optional(string()),\n assetType: optional(AssetTypeSchema),\n id: optional(string()),\n asset_type: optional(AssetTypeSchema),\n name: optional(nullable(string())),\n user_id: optional(string()),\n preview: optional(any()),\n description: optional(any()),\n slug: optional(nullable(string())),\n name_url_slug: optional(nullable(string())),\n org_id: optional(string()),\n parent_id: optional(nullable(string())),\n parent: optional(any()),\n user: optional(any()),\n organization: optional(any()),\n team: optional(any()),\n});\n\nconst NotificationParentRefSchema = object({\n assetId: string(),\n assetType: AssetTypeSchema,\n});\n\nconst NotificationRootInfoSchema = object({\n slug: string(),\n assetType: AssetTypeSchema,\n});\n\nconst NotificationBadgeContentSchema = object({\n name: string(),\n description: optional(nullable(string())),\n slug: optional(nullable(string())),\n});\n\nconst NotificationQuestRefSchema = object({\n id: string(),\n name: optional(nullable(string())),\n});\n\nconst NotificationQuestEntryRefSchema = object({\n id: string(),\n asset_id: optional(nullable(string())),\n asset_type: optional(nullable(string())),\n asset_name: optional(nullable(string())),\n});\n\nconst NotificationContentBase = {\n text: optional(string()),\n};\n\nconst MentionContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n parent: optional(NotificationParentRefSchema),\n root: optional(NotificationRootInfoSchema),\n});\n\nconst CommentContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n parent: optional(NotificationParentRefSchema),\n root: optional(NotificationRootInfoSchema),\n});\n\nconst ReplyContentSchema = CommentContentSchema;\n\nconst ReferenceContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n referencedAssetIds: optional(array(string())),\n referencedAssets: optional(array(NotificationAssetRefSchema)),\n referenceCount: optional(number()),\n});\n\nconst ReactionContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n reaction_label: optional(string()),\n reaction_verb: optional(string()),\n aggregate_count: optional(number()),\n});\n\nconst ShareContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n});\n\nconst OwnershipTransferContentSchema = ShareContentSchema;\n\nconst FollowContentSchema = object({\n ...NotificationContentBase,\n});\n\nconst InviteContentSchema = object({\n ...NotificationContentBase,\n organization: optional(\n object({\n id: string(),\n name: string(),\n })\n ),\n});\n\nconst PaymentContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n currency: optional(PriceCurrencySchema),\n value: optional(number()),\n});\n\nconst DepositContentSchema = object({\n ...NotificationContentBase,\n value: optional(number()),\n});\n\nconst BadgeContentSchema = object({\n ...NotificationContentBase,\n badge: optional(NotificationBadgeContentSchema),\n});\n\nconst ActionCompleteContentSchema = object({\n ...NotificationContentBase,\n status: optional(zodEnum([\"success\", \"error\", \"timed-out\"])),\n duration: optional(number()),\n route: optional(\n object({\n id: string(),\n name: optional(nullable(string())),\n })\n ),\n});\n\nconst ActionFailedContentSchema = ActionCompleteContentSchema;\n\nconst QuestEntryContentSchema = object({\n ...NotificationContentBase,\n quest: optional(NotificationQuestRefSchema),\n entry: optional(NotificationQuestEntryRefSchema),\n});\n\nconst QuestEntryAcceptedContentSchema = object({\n ...NotificationContentBase,\n quest: optional(NotificationQuestRefSchema),\n entry: optional(NotificationQuestEntryRefSchema),\n reviewer: optional(\n nullable(\n object({\n id: string(),\n username: optional(nullable(string())),\n })\n )\n ),\n});\n\nconst OnboardingCompleteContentSchema = object({\n ...NotificationContentBase,\n});\n\nconst OnboardingActionRequiredContentSchema = object({\n ...NotificationContentBase,\n requirements: optional(array(string())),\n});\n\nconst RouteEarningsMilestoneContentSchema = object({\n ...NotificationContentBase,\n milestone_cents: optional(number()),\n total_earnings_cents: optional(number()),\n});\n\nconst RoutePayoutContentSchema = object({\n ...NotificationContentBase,\n payout_cents: optional(number()),\n gross_cents: optional(number()),\n platform_fee_cents: optional(number()),\n assets: optional(any()),\n asset_names: optional(array(string())),\n invoice_id: optional(string()),\n});\n\nconst ContentMovedContentSchema = object({\n ...NotificationContentBase,\n team_id: optional(string()),\n team_name: optional(nullable(string())),\n asset_name: optional(nullable(string())),\n asset_type: optional(nullable(string())),\n action: optional(string()),\n reason: optional(nullable(string())),\n moderator_scope: optional(zodEnum([\"platform\", \"team\"])),\n});\n\nconst ContentDeletedContentSchema = ContentMovedContentSchema;\n\nconst EventContentSchema = object({\n ...NotificationContentBase,\n event: optional(\n object({\n type: zodEnum([\"success\", \"error\"]),\n })\n ),\n});\n\nconst LikeContentSchema = object({\n ...NotificationContentBase,\n asset: optional(NotificationContentAssetSchema),\n});\n\nconst OtherContentSchema = object({\n ...NotificationContentBase,\n});\n\nconst NotificationRowBaseSchema = object({\n id: uuid(),\n source_user_id: uuid(),\n destination_user_id: uuid(),\n org_id: optional(nullable(uuid())),\n asset_id: optional(nullable(uuid())),\n reaction_id: optional(nullable(uuid())),\n action_id: optional(nullable(uuid())),\n parent_asset_id: optional(nullable(uuid())),\n root_asset_id: optional(nullable(uuid())),\n viewed: boolean(),\n created_at: string(),\n last_updated: string(),\n /** Joined on list/read responses. */\n source_user: optional(ProfileSchema.partial()),\n /** Joined `assets` row for `asset_id` (not `content.asset`). */\n asset: optional(NotificationContentAssetSchema),\n});\n\nconst notificationVariant = <\n T extends z.infer<typeof NotificationTypeSchema>,\n C extends z.ZodType,\n>(\n type: T,\n content: C\n) =>\n NotificationRowBaseSchema.extend({\n type: literal(type),\n content,\n });\n\nconst NotificationSchema = discriminatedUnion(\"type\", [\n notificationVariant(\"follow\", FollowContentSchema),\n notificationVariant(\"like\", LikeContentSchema),\n notificationVariant(\"comment\", CommentContentSchema),\n notificationVariant(\"reply\", ReplyContentSchema),\n notificationVariant(\"mention\", MentionContentSchema),\n notificationVariant(\"reference\", ReferenceContentSchema),\n notificationVariant(\"invite\", InviteContentSchema),\n notificationVariant(\"payment\", PaymentContentSchema),\n notificationVariant(\"event\", EventContentSchema),\n notificationVariant(\"share\", ShareContentSchema),\n notificationVariant(\"badge\", BadgeContentSchema),\n notificationVariant(\"reaction\", ReactionContentSchema),\n notificationVariant(\"deposit\", DepositContentSchema),\n notificationVariant(\"action-complete\", ActionCompleteContentSchema),\n notificationVariant(\"action-failed\", ActionFailedContentSchema),\n notificationVariant(\"quest-entry\", QuestEntryContentSchema),\n notificationVariant(\"quest-entry-accepted\", QuestEntryAcceptedContentSchema),\n notificationVariant(\"onboarding-complete\", OnboardingCompleteContentSchema),\n notificationVariant(\n \"onboarding-action-required\",\n OnboardingActionRequiredContentSchema\n ),\n notificationVariant(\n \"route-earnings-milestone\",\n RouteEarningsMilestoneContentSchema\n ),\n notificationVariant(\"route-payout\", RoutePayoutContentSchema),\n notificationVariant(\"ownership-transfer\", OwnershipTransferContentSchema),\n notificationVariant(\"content-moved\", ContentMovedContentSchema),\n notificationVariant(\"content-deleted\", ContentDeletedContentSchema),\n notificationVariant(\"other\", OtherContentSchema),\n]);\n\ntype Notification = z.infer<typeof NotificationSchema>;\ntype NotificationType = z.infer<typeof NotificationTypeSchema>;\ntype NotificationOfType<T extends NotificationType> = Extract<\n Notification,\n { type: T }\n>;\ntype NotificationContentAsset = z.infer<typeof NotificationContentAssetSchema>;\ntype NotificationAssetRef = z.infer<typeof NotificationAssetRefSchema>;\n\nexport {\n NotificationSchema,\n NotificationTypeSchema,\n NotificationAssetRefSchema,\n NotificationContentAssetSchema,\n NotificationParentRefSchema,\n NotificationRootInfoSchema,\n MentionContentSchema,\n CommentContentSchema,\n ReplyContentSchema,\n ReferenceContentSchema,\n ReactionContentSchema,\n ShareContentSchema,\n OwnershipTransferContentSchema,\n FollowContentSchema,\n InviteContentSchema,\n PaymentContentSchema,\n DepositContentSchema,\n BadgeContentSchema,\n ActionCompleteContentSchema,\n QuestEntryContentSchema,\n QuestEntryAcceptedContentSchema,\n OnboardingCompleteContentSchema,\n OnboardingActionRequiredContentSchema,\n RouteEarningsMilestoneContentSchema,\n RoutePayoutContentSchema,\n ContentMovedContentSchema,\n ContentDeletedContentSchema,\n EventContentSchema,\n};\nexport type {\n Notification,\n NotificationType,\n NotificationOfType,\n NotificationContentAsset,\n NotificationAssetRef,\n};\n"]}
|
package/dist/chunk-O4LSX56P.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {e}from'./chunk-RS5H4XDK.js';import {a}from'./chunk-33C7IDRP.js';import {record,string,object,uuid,union,optional,boolean}from'zod';function m(e){return !!e&&typeof e=="object"&&!Array.isArray(e)}function k(e){if(!e)return null;let t=e.replace(/^\.+/,"").trim().toLowerCase().replace(/[^a-z0-9]/g,"");return !t||/^\d+$/.test(t)||t.length>12?null:t}function I(e){let s=Array.isArray(e)?e:typeof e=="string"?e.split(/[\s,]+/):[];return Array.from(new Set(s.map(t=>k(t)).filter(t=>!!t)))}var P=record(string(),object({asset_id:uuid(),asset_type:a})),K=union([uuid(),object({asset_id:uuid(),asset_type:optional(a)})]),E=record(string(),K),q=e.extend({required:optional(boolean()).default(true)});function S(e){return I([...Array.isArray(e.file_extensions)?e.file_extensions:[],...Array.isArray(e.input_file_extensions)?e.input_file_extensions:[]].join(","))}function R(e){return e.input_filter||e.filter||void 0}function T(e){var n;let s=e==null?void 0:e.route;if(!s)return {};let t=s.input_assets;if(m(t)){let i=Object.entries(t).filter(([,r])=>m(r));if(i.length>0)return Object.fromEntries(i)}return s.input_type?{[s.input_type]:{asset_type:s.input_type,primary:true,input_filter:s.input_filter,input_file_extensions:(n=s.input_file_extensions)!=null?n:null}}:{}}function j(e){let s=S(e),t=R(e);return {asset_type:e.asset_type,primary:e.primary,input_filter:t!=null?t:null,file_extensions:s.length>0?s:null,required:true}}function Q(e,s){let t=new Set(s),n={};for(let[i,r]of Object.entries(e))t.has(i)||(n[i]=j(r));return n}function L(e){let s=Object.entries(e);if(!s.length)return null;let t=s.find(([,n])=>n.primary===true);return t?t[0]:(s.length===1,s[0][0])}function B(e,s){var i,r;let t=(i=e.eval_static_inputs)!=null?i:{};if(e.eval_route_id&&s){let a=T(s),l=Object.keys(t),u=e.submission_assets&&Object.keys(e.submission_assets).length>0?e.submission_assets:Q(a,l);return {contributorKeys:Object.keys(u),declarations:u,pinned:t}}let n=(r=e.submission_assets)!=null?r:{};return {contributorKeys:Object.keys(n),declarations:n,pinned:t}}function F(e){if(!e)return null;let s=e.asset_type||void 0;if(!s)return null;let t={assetType:s,hasConstraints:false};if(s==="file"){let n=S(e);n.length>0&&(t.extensions=n,t.hasConstraints=true);let i=R(e);i&&(t.fileType=i,t.hasConstraints=true);}return t}function V(e,s){var i,r,a,l,u,p;if(!s||!e)return true;let t=F(s);if(!t)return true;let n=(i=e.assetType)!=null?i:e.asset_type;if(t.assetType&&n!==t.assetType)return false;if(t.assetType==="file"){let c=(a=(r=e.asset)==null?void 0:r.metadata)!=null?a:{};if(t.extensions&&t.extensions.length>0){let o=String((l=c.extension)!=null?l:"").toLowerCase();if(!o||!t.extensions.includes(o))return false}if(t.fileType){let o=String((p=(u=c.file_type)!=null?u:c.type)!=null?p:"").toLowerCase().split("/")[0],f=t.fileType.toLowerCase();if(o&&f&&!o.includes(f)&&o!==f)return false}}return true}function M(e,s){if(!e||!Object.keys(e).length)return null;let t=s&&L(s)||Object.keys(e)[0],n=e[t];return n?{key:t,asset_id:n.asset_id,asset_type:n.asset_type}:null}function $(e){return e?Object.fromEntries(Object.entries(e).map(([s,t])=>[s,{assetId:t.asset_id,assetType:t.asset_type}])):{}}export{P as a,K as b,E as c,q as d,T as e,j as f,Q as g,L as h,B as i,F as j,V as k,M as l,$ as m};//# sourceMappingURL=chunk-O4LSX56P.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-O4LSX56P.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/quest-submission.ts"],"names":["isPlainObject","value","normalizeFileExtension","safe","normalizeFileExtensions","rawValues","entry","KeyedAssetRefsSchema","record","string","object","uuid","AssetTypeSchema","KeyedAssetInputValueSchema","union","optional","KeyedAssetInputSchema","QuestSubmissionAssetDeclarationSchema","RouteInputAssetDeclarationSchema","boolean","readDeclarationExtensions","declaration","readDeclarationFilter","getRouteInputDeclarationsFromRoute","route","_a","detail","inputs","entries","declarationToSubmissionDeclaration","extensions","filter","materializeContributorSubmissionAssets","routeInputs","pinnedKeys","pinned","out","key","getPrimaryDeclarationKey","declarations","primary","d","getSubmissionAssetShape","item","_b","materialized","declarationToPickerFilters","assetType","filters","fileType","assetMatchesDeclaration","asset","_c","_d","_e","_f","metadata","ext","type","expected","getPrimaryAssetRef","refs","ref","toRouteInputAssets"],"mappings":"2IAeA,SAASA,EAAcC,CAAkD,CAAA,CACvE,OAAO,CAAQA,CAAAA,CAAAA,EAAU,OAAOA,CAAU,EAAA,QAAA,EAAY,CAAC,KAAM,CAAA,OAAA,CAAQA,CAAK,CAC5E,CAEA,SAASC,CAAuBD,CAAAA,CAAAA,CAAiD,CAC/E,GAAI,CAACA,EAAO,OAAO,IAAA,CAEnB,IAAME,CADaF,CAAAA,CAAAA,CAAM,QAAQ,MAAQ,CAAA,EAAE,EAAE,IAAK,EAAA,CAAE,aAC5B,CAAA,OAAA,CAAQ,aAAc,EAAE,CAAA,CAChD,OAAI,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AAAA,CAAG,EACpB,OAAKyB,CAAAA,CACE,CAAE,GAAAzB,CAAAA,CAAAA,CAAK,SAAUyB,CAAI,CAAA,QAAA,CAAU,WAAYA,CAAI,CAAA,UAAW,EADhD,IAEnB,CAEO,SAASC,CACdF,CAAAA,CAAAA,CACwD,CACxD,OAAKA,CAAAA,CACE,OAAO,WACZ,CAAA,MAAA,CAAO,QAAQA,CAAI,CAAA,CAAE,IAAI,CAAC,CAACxB,EAAKyB,CAAG,CAAA,GAAM,CACvCzB,CACA,CAAA,CAAE,QAASyB,CAAI,CAAA,QAAA,CAAU,UAAWA,CAAI,CAAA,UAAW,CACrD,CAAC,CACH,CANkB,CAAA,EAOpB","file":"chunk-O4LSX56P.js","sourcesContent":["import {\n object,\n string,\n record,\n optional,\n boolean,\n array,\n uuid,\n union,\n type z,\n} from \"zod\";\n\nimport { AssetTypeSchema } from \"../schema/common\";\nimport { RouteInputAssetDeclarationSchema } from \"../schema/services\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction normalizeFileExtension(value: string | null | undefined): string | null {\n if (!value) return null;\n const normalized = value.replace(/^\\.+/, \"\").trim().toLowerCase();\n const safe = normalized.replace(/[^a-z0-9]/g, \"\");\n if (!safe || /^\\d+$/.test(safe) || safe.length > 12) return null;\n return safe;\n}\n\nfunction normalizeFileExtensions(\n value: string | string[] | null | undefined\n): string[] {\n const rawValues = Array.isArray(value)\n ? value\n : typeof value === \"string\"\n ? value.split(/[\\s,]+/)\n : [];\n return Array.from(\n new Set(\n rawValues\n .map((entry) => normalizeFileExtension(entry))\n .filter((entry): entry is string => Boolean(entry))\n )\n );\n}\n\n/** Stored on entries and eval_static_inputs after server normalization. */\nexport const KeyedAssetRefsSchema = record(\n string(),\n object({\n asset_id: uuid(),\n asset_type: AssetTypeSchema,\n })\n);\n\n/** Accepted on POST /quests/:id/entries/create — server fills asset_type. */\nexport const KeyedAssetInputValueSchema = union([\n uuid(),\n object({\n asset_id: uuid(),\n asset_type: optional(AssetTypeSchema),\n }),\n]);\n\nexport const KeyedAssetInputSchema = record(\n string(),\n KeyedAssetInputValueSchema\n);\n\nexport const QuestSubmissionAssetDeclarationSchema =\n RouteInputAssetDeclarationSchema.extend({\n required: optional(boolean()).default(true),\n });\n\nexport type KeyedAssetRefs = z.infer<typeof KeyedAssetRefsSchema>;\nexport type KeyedAssetInput = z.infer<typeof KeyedAssetInputSchema>;\nexport type QuestSubmissionAssetDeclaration = z.infer<\n typeof QuestSubmissionAssetDeclarationSchema\n>;\n\nexport type AssetDeclarationPickerFilters = {\n assetType?: string;\n fileType?: string;\n extensions?: string[];\n hasConstraints: boolean;\n};\n\nexport type QuestSubmissionItemInput = {\n eval_route_id?: string | null;\n submission_assets?: Record<string, QuestSubmissionAssetDeclaration> | null;\n eval_static_inputs?: KeyedAssetRefs | null;\n expected_asset_type?: string | null;\n};\n\nexport type RouteInputDeclarationLike = {\n asset_type?: string | null;\n primary?: boolean;\n input_filter?: string | null;\n filter?: string | null;\n file_extensions?: string[] | null;\n input_file_extensions?: string[] | null;\n};\n\nexport type RouteForSubmissionShape = {\n route?: {\n input_assets?: Record<string, RouteInputDeclarationLike> | null;\n input_type?: string | null;\n input_filter?: string | null;\n input_file_extensions?: string[] | null;\n } | null;\n} | null;\n\nfunction readDeclarationExtensions(\n declaration: RouteInputDeclarationLike\n): string[] {\n return normalizeFileExtensions([\n ...(Array.isArray(declaration.file_extensions)\n ? declaration.file_extensions\n : []),\n ...(Array.isArray(declaration.input_file_extensions)\n ? declaration.input_file_extensions\n : []),\n ].join(\",\"));\n}\n\nfunction readDeclarationFilter(\n declaration: RouteInputDeclarationLike\n): string | undefined {\n return declaration.input_filter || declaration.filter || undefined;\n}\n\n/** Route keyed inputs as a flat map (includes legacy input_type fallback). */\nexport function getRouteInputDeclarationsFromRoute(\n route: RouteForSubmissionShape\n): Record<string, RouteInputDeclarationLike> {\n const detail = route?.route;\n if (!detail) return {};\n\n const inputs = detail.input_assets;\n if (isPlainObject(inputs)) {\n const entries = Object.entries(inputs).filter(([, value]) =>\n isPlainObject(value)\n ) as [string, RouteInputDeclarationLike][];\n if (entries.length > 0) {\n return Object.fromEntries(entries);\n }\n }\n\n if (detail.input_type) {\n return {\n [detail.input_type]: {\n asset_type: detail.input_type,\n primary: true,\n input_filter: detail.input_filter,\n input_file_extensions: detail.input_file_extensions ?? null,\n },\n };\n }\n\n return {};\n}\n\nexport function declarationToSubmissionDeclaration(\n declaration: RouteInputDeclarationLike\n): QuestSubmissionAssetDeclaration {\n const extensions = readDeclarationExtensions(declaration);\n const filter = readDeclarationFilter(declaration);\n return {\n asset_type: declaration.asset_type as QuestSubmissionAssetDeclaration[\"asset_type\"],\n primary: declaration.primary,\n input_filter: (filter ?? null) as QuestSubmissionAssetDeclaration[\"input_filter\"],\n file_extensions: extensions.length > 0 ? extensions : null,\n required: true,\n };\n}\n\n/** Materialize contributor declarations from route inputs minus pinned keys. */\nexport function materializeContributorSubmissionAssets(\n routeInputs: Record<string, RouteInputDeclarationLike>,\n pinnedKeys: string[]\n): Record<string, QuestSubmissionAssetDeclaration> {\n const pinned = new Set(pinnedKeys);\n const out: Record<string, QuestSubmissionAssetDeclaration> = {};\n for (const [key, declaration] of Object.entries(routeInputs)) {\n if (pinned.has(key)) continue;\n out[key] = declarationToSubmissionDeclaration(declaration);\n }\n return out;\n}\n\nexport function getPrimaryDeclarationKey(\n declarations: Record<string, QuestSubmissionAssetDeclaration>\n): string | null {\n const entries = Object.entries(declarations);\n if (!entries.length) return null;\n const primary = entries.find(([, d]) => d.primary === true);\n if (primary) return primary[0];\n if (entries.length === 1) return entries[0][0];\n return entries[0][0];\n}\n\nexport function getSubmissionAssetShape(\n item: QuestSubmissionItemInput,\n route?: RouteForSubmissionShape | null\n): {\n contributorKeys: string[];\n declarations: Record<string, QuestSubmissionAssetDeclaration>;\n pinned: KeyedAssetRefs;\n} {\n const pinned: KeyedAssetRefs = item.eval_static_inputs ?? {};\n\n if (item.eval_route_id && route) {\n const routeInputs = getRouteInputDeclarationsFromRoute(route);\n const pinnedKeys = Object.keys(pinned);\n const materialized =\n item.submission_assets &&\n Object.keys(item.submission_assets).length > 0\n ? item.submission_assets\n : materializeContributorSubmissionAssets(routeInputs, pinnedKeys);\n const contributorKeys = Object.keys(materialized);\n return {\n contributorKeys,\n declarations: materialized,\n pinned,\n };\n }\n\n const declarations = item.submission_assets ?? {};\n return {\n contributorKeys: Object.keys(declarations),\n declarations,\n pinned,\n };\n}\n\nexport function declarationToPickerFilters(\n declaration: RouteInputDeclarationLike | QuestSubmissionAssetDeclaration | null | undefined\n): AssetDeclarationPickerFilters | null {\n if (!declaration) return null;\n const assetType = declaration.asset_type || undefined;\n if (!assetType) return null;\n\n const filters: AssetDeclarationPickerFilters = {\n assetType,\n hasConstraints: false,\n };\n\n if (assetType === \"file\") {\n const extensions = readDeclarationExtensions(declaration);\n if (extensions.length > 0) {\n filters.extensions = extensions;\n filters.hasConstraints = true;\n }\n const fileType = readDeclarationFilter(declaration);\n if (fileType) {\n filters.fileType = fileType;\n filters.hasConstraints = true;\n }\n }\n\n return filters;\n}\n\nexport function assetMatchesDeclaration(\n asset:\n | {\n assetType?: string | null;\n asset_type?: string | null;\n asset?: { metadata?: Record<string, unknown> } | null;\n }\n | null\n | undefined,\n declaration: RouteInputDeclarationLike | QuestSubmissionAssetDeclaration | null | undefined\n): boolean {\n if (!declaration || !asset) return true;\n const filters = declarationToPickerFilters(declaration);\n if (!filters) return true;\n\n const assetType = asset.assetType ?? asset.asset_type;\n if (filters.assetType && assetType !== filters.assetType) return false;\n\n if (filters.assetType === \"file\") {\n const metadata = asset.asset?.metadata ?? {};\n if (filters.extensions && filters.extensions.length > 0) {\n const ext = String(metadata.extension ?? \"\").toLowerCase();\n if (!ext || !filters.extensions.includes(ext)) return false;\n }\n if (filters.fileType) {\n const type = String(metadata.file_type ?? metadata.type ?? \"\")\n .toLowerCase()\n .split(\"/\")[0];\n const expected = filters.fileType.toLowerCase();\n if (type && expected && !type.includes(expected) && type !== expected) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nexport function getPrimaryAssetRef(\n refs: KeyedAssetRefs | null | undefined,\n declarations?: Record<string, QuestSubmissionAssetDeclaration> | null\n): { key: string; asset_id: string; asset_type: string } | null {\n if (!refs || !Object.keys(refs).length) return null;\n const key =\n (declarations && getPrimaryDeclarationKey(declarations)) ||\n Object.keys(refs)[0];\n const ref = refs[key];\n if (!ref) return null;\n return { key, asset_id: ref.asset_id, asset_type: ref.asset_type };\n}\n\nexport function toRouteInputAssets(\n refs: KeyedAssetRefs | null | undefined\n): Record<string, { assetId: string; assetType: string }> {\n if (!refs) return {};\n return Object.fromEntries(\n Object.entries(refs).map(([key, ref]) => [\n key,\n { assetId: ref.asset_id, assetType: ref.asset_type },\n ])\n );\n}\n\n/** @deprecated Use declarationToPickerFilters */\nexport type EvalSubmissionFilters = AssetDeclarationPickerFilters;\n"]}
|
package/dist/chunk-U6XOT6XH.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkXEA4DDOE_cjs=require('./chunk-XEA4DDOE.cjs'),chunkYFEGRZXL_cjs=require('./chunk-YFEGRZXL.cjs'),zod=require('zod');function m(e){return !!e&&typeof e=="object"&&!Array.isArray(e)}function k(e){if(!e)return null;let t=e.replace(/^\.+/,"").trim().toLowerCase().replace(/[^a-z0-9]/g,"");return !t||/^\d+$/.test(t)||t.length>12?null:t}function I(e){let s=Array.isArray(e)?e:typeof e=="string"?e.split(/[\s,]+/):[];return Array.from(new Set(s.map(t=>k(t)).filter(t=>!!t)))}var P=zod.record(zod.string(),zod.object({asset_id:zod.uuid(),asset_type:chunkYFEGRZXL_cjs.a})),K=zod.union([zod.uuid(),zod.object({asset_id:zod.uuid(),asset_type:zod.optional(chunkYFEGRZXL_cjs.a)})]),E=zod.record(zod.string(),K),q=chunkXEA4DDOE_cjs.e.extend({required:zod.optional(zod.boolean()).default(true)});function S(e){return I([...Array.isArray(e.file_extensions)?e.file_extensions:[],...Array.isArray(e.input_file_extensions)?e.input_file_extensions:[]].join(","))}function R(e){return e.input_filter||e.filter||void 0}function T(e){var n;let s=e==null?void 0:e.route;if(!s)return {};let t=s.input_assets;if(m(t)){let i=Object.entries(t).filter(([,r])=>m(r));if(i.length>0)return Object.fromEntries(i)}return s.input_type?{[s.input_type]:{asset_type:s.input_type,primary:true,input_filter:s.input_filter,input_file_extensions:(n=s.input_file_extensions)!=null?n:null}}:{}}function j(e){let s=S(e),t=R(e);return {asset_type:e.asset_type,primary:e.primary,input_filter:t!=null?t:null,file_extensions:s.length>0?s:null,required:true}}function Q(e,s){let t=new Set(s),n={};for(let[i,r]of Object.entries(e))t.has(i)||(n[i]=j(r));return n}function L(e){let s=Object.entries(e);if(!s.length)return null;let t=s.find(([,n])=>n.primary===true);return t?t[0]:(s.length===1,s[0][0])}function B(e,s){var i,r;let t=(i=e.eval_static_inputs)!=null?i:{};if(e.eval_route_id&&s){let a=T(s),l=Object.keys(t),u=e.submission_assets&&Object.keys(e.submission_assets).length>0?e.submission_assets:Q(a,l);return {contributorKeys:Object.keys(u),declarations:u,pinned:t}}let n=(r=e.submission_assets)!=null?r:{};return {contributorKeys:Object.keys(n),declarations:n,pinned:t}}function F(e){if(!e)return null;let s=e.asset_type||void 0;if(!s)return null;let t={assetType:s,hasConstraints:false};if(s==="file"){let n=S(e);n.length>0&&(t.extensions=n,t.hasConstraints=true);let i=R(e);i&&(t.fileType=i,t.hasConstraints=true);}return t}function V(e,s){var i,r,a,l,u,p;if(!s||!e)return true;let t=F(s);if(!t)return true;let n=(i=e.assetType)!=null?i:e.asset_type;if(t.assetType&&n!==t.assetType)return false;if(t.assetType==="file"){let c=(a=(r=e.asset)==null?void 0:r.metadata)!=null?a:{};if(t.extensions&&t.extensions.length>0){let o=String((l=c.extension)!=null?l:"").toLowerCase();if(!o||!t.extensions.includes(o))return false}if(t.fileType){let o=String((p=(u=c.file_type)!=null?u:c.type)!=null?p:"").toLowerCase().split("/")[0],f=t.fileType.toLowerCase();if(o&&f&&!o.includes(f)&&o!==f)return false}}return true}function M(e,s){if(!e||!Object.keys(e).length)return null;let t=s&&L(s)||Object.keys(e)[0],n=e[t];return n?{key:t,asset_id:n.asset_id,asset_type:n.asset_type}:null}function $(e){return e?Object.fromEntries(Object.entries(e).map(([s,t])=>[s,{assetId:t.asset_id,assetType:t.asset_type}])):{}}exports.a=P;exports.b=K;exports.c=E;exports.d=q;exports.e=T;exports.f=j;exports.g=Q;exports.h=L;exports.i=B;exports.j=F;exports.k=V;exports.l=M;exports.m=$;//# sourceMappingURL=chunk-U6XOT6XH.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-U6XOT6XH.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/quest-submission.ts"],"names":["isPlainObject","value","normalizeFileExtension","safe","normalizeFileExtensions","rawValues","entry","KeyedAssetRefsSchema","record","string","object","uuid","AssetTypeSchema","KeyedAssetInputValueSchema","union","optional","KeyedAssetInputSchema","QuestSubmissionAssetDeclarationSchema","RouteInputAssetDeclarationSchema","boolean","readDeclarationExtensions","declaration","readDeclarationFilter","getRouteInputDeclarationsFromRoute","route","_a","detail","inputs","entries","declarationToSubmissionDeclaration","extensions","filter","materializeContributorSubmissionAssets","routeInputs","pinnedKeys","pinned","out","key","getPrimaryDeclarationKey","declarations","primary","d","getSubmissionAssetShape","item","_b","materialized","declarationToPickerFilters","assetType","filters","fileType","assetMatchesDeclaration","asset","_c","_d","_e","_f","metadata","ext","type","expected","getPrimaryAssetRef","refs","ref","toRouteInputAssets"],"mappings":"wIAeA,SAASA,EAAcC,CAAkD,CAAA,CACvE,OAAO,CAAQA,CAAAA,CAAAA,EAAU,OAAOA,CAAU,EAAA,QAAA,EAAY,CAAC,KAAM,CAAA,OAAA,CAAQA,CAAK,CAC5E,CAEA,SAASC,CAAuBD,CAAAA,CAAAA,CAAiD,CAC/E,GAAI,C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I,CAAA,CAAE,OAAQ,OAAO,IAAA,CAC/C,IAAMxB,CACHE,CAAAA,CAAAA,EAAgBD,EAAyBC,CAAY,CAAA,EACtD,OAAO,IAAKsB,CAAAA,CAAI,EAAE,CAAC,CAAA,CACfC,EAAMD,CAAKxB,CAAAA,CAAG,EACpB,OAAKyB,CAAAA,CACE,CAAE,GAAAzB,CAAAA,CAAAA,CAAK,SAAUyB,CAAI,CAAA,QAAA,CAAU,WAAYA,CAAI,CAAA,UAAW,EADhD,IAEnB,CAEO,SAASC,CACdF,CAAAA,CAAAA,CACwD,CACxD,OAAKA,CAAAA,CACE,OAAO,WACZ,CAAA,MAAA,CAAO,QAAQA,CAAI,CAAA,CAAE,IAAI,CAAC,CAACxB,EAAKyB,CAAG,CAAA,GAAM,CACvCzB,CACA,CAAA,CAAE,QAASyB,CAAI,CAAA,QAAA,CAAU,UAAWA,CAAI,CAAA,UAAW,CACrD,CAAC,CACH,CANkB,CAAA,EAOpB","file":"chunk-U6XOT6XH.cjs","sourcesContent":["import {\n object,\n string,\n record,\n optional,\n boolean,\n array,\n uuid,\n union,\n type z,\n} from \"zod\";\n\nimport { AssetTypeSchema } from \"../schema/common\";\nimport { RouteInputAssetDeclarationSchema } from \"../schema/services\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction normalizeFileExtension(value: string | null | undefined): string | null {\n if (!value) return null;\n const normalized = value.replace(/^\\.+/, \"\").trim().toLowerCase();\n const safe = normalized.replace(/[^a-z0-9]/g, \"\");\n if (!safe || /^\\d+$/.test(safe) || safe.length > 12) return null;\n return safe;\n}\n\nfunction normalizeFileExtensions(\n value: string | string[] | null | undefined\n): string[] {\n const rawValues = Array.isArray(value)\n ? value\n : typeof value === \"string\"\n ? value.split(/[\\s,]+/)\n : [];\n return Array.from(\n new Set(\n rawValues\n .map((entry) => normalizeFileExtension(entry))\n .filter((entry): entry is string => Boolean(entry))\n )\n );\n}\n\n/** Stored on entries and eval_static_inputs after server normalization. */\nexport const KeyedAssetRefsSchema = record(\n string(),\n object({\n asset_id: uuid(),\n asset_type: AssetTypeSchema,\n })\n);\n\n/** Accepted on POST /quests/:id/entries/create — server fills asset_type. */\nexport const KeyedAssetInputValueSchema = union([\n uuid(),\n object({\n asset_id: uuid(),\n asset_type: optional(AssetTypeSchema),\n }),\n]);\n\nexport const KeyedAssetInputSchema = record(\n string(),\n KeyedAssetInputValueSchema\n);\n\nexport const QuestSubmissionAssetDeclarationSchema =\n RouteInputAssetDeclarationSchema.extend({\n required: optional(boolean()).default(true),\n });\n\nexport type KeyedAssetRefs = z.infer<typeof KeyedAssetRefsSchema>;\nexport type KeyedAssetInput = z.infer<typeof KeyedAssetInputSchema>;\nexport type QuestSubmissionAssetDeclaration = z.infer<\n typeof QuestSubmissionAssetDeclarationSchema\n>;\n\nexport type AssetDeclarationPickerFilters = {\n assetType?: string;\n fileType?: string;\n extensions?: string[];\n hasConstraints: boolean;\n};\n\nexport type QuestSubmissionItemInput = {\n eval_route_id?: string | null;\n submission_assets?: Record<string, QuestSubmissionAssetDeclaration> | null;\n eval_static_inputs?: KeyedAssetRefs | null;\n expected_asset_type?: string | null;\n};\n\nexport type RouteInputDeclarationLike = {\n asset_type?: string | null;\n primary?: boolean;\n input_filter?: string | null;\n filter?: string | null;\n file_extensions?: string[] | null;\n input_file_extensions?: string[] | null;\n};\n\nexport type RouteForSubmissionShape = {\n route?: {\n input_assets?: Record<string, RouteInputDeclarationLike> | null;\n input_type?: string | null;\n input_filter?: string | null;\n input_file_extensions?: string[] | null;\n } | null;\n} | null;\n\nfunction readDeclarationExtensions(\n declaration: RouteInputDeclarationLike\n): string[] {\n return normalizeFileExtensions([\n ...(Array.isArray(declaration.file_extensions)\n ? declaration.file_extensions\n : []),\n ...(Array.isArray(declaration.input_file_extensions)\n ? declaration.input_file_extensions\n : []),\n ].join(\",\"));\n}\n\nfunction readDeclarationFilter(\n declaration: RouteInputDeclarationLike\n): string | undefined {\n return declaration.input_filter || declaration.filter || undefined;\n}\n\n/** Route keyed inputs as a flat map (includes legacy input_type fallback). */\nexport function getRouteInputDeclarationsFromRoute(\n route: RouteForSubmissionShape\n): Record<string, RouteInputDeclarationLike> {\n const detail = route?.route;\n if (!detail) return {};\n\n const inputs = detail.input_assets;\n if (isPlainObject(inputs)) {\n const entries = Object.entries(inputs).filter(([, value]) =>\n isPlainObject(value)\n ) as [string, RouteInputDeclarationLike][];\n if (entries.length > 0) {\n return Object.fromEntries(entries);\n }\n }\n\n if (detail.input_type) {\n return {\n [detail.input_type]: {\n asset_type: detail.input_type,\n primary: true,\n input_filter: detail.input_filter,\n input_file_extensions: detail.input_file_extensions ?? null,\n },\n };\n }\n\n return {};\n}\n\nexport function declarationToSubmissionDeclaration(\n declaration: RouteInputDeclarationLike\n): QuestSubmissionAssetDeclaration {\n const extensions = readDeclarationExtensions(declaration);\n const filter = readDeclarationFilter(declaration);\n return {\n asset_type: declaration.asset_type as QuestSubmissionAssetDeclaration[\"asset_type\"],\n primary: declaration.primary,\n input_filter: (filter ?? null) as QuestSubmissionAssetDeclaration[\"input_filter\"],\n file_extensions: extensions.length > 0 ? extensions : null,\n required: true,\n };\n}\n\n/** Materialize contributor declarations from route inputs minus pinned keys. */\nexport function materializeContributorSubmissionAssets(\n routeInputs: Record<string, RouteInputDeclarationLike>,\n pinnedKeys: string[]\n): Record<string, QuestSubmissionAssetDeclaration> {\n const pinned = new Set(pinnedKeys);\n const out: Record<string, QuestSubmissionAssetDeclaration> = {};\n for (const [key, declaration] of Object.entries(routeInputs)) {\n if (pinned.has(key)) continue;\n out[key] = declarationToSubmissionDeclaration(declaration);\n }\n return out;\n}\n\nexport function getPrimaryDeclarationKey(\n declarations: Record<string, QuestSubmissionAssetDeclaration>\n): string | null {\n const entries = Object.entries(declarations);\n if (!entries.length) return null;\n const primary = entries.find(([, d]) => d.primary === true);\n if (primary) return primary[0];\n if (entries.length === 1) return entries[0][0];\n return entries[0][0];\n}\n\nexport function getSubmissionAssetShape(\n item: QuestSubmissionItemInput,\n route?: RouteForSubmissionShape | null\n): {\n contributorKeys: string[];\n declarations: Record<string, QuestSubmissionAssetDeclaration>;\n pinned: KeyedAssetRefs;\n} {\n const pinned: KeyedAssetRefs = item.eval_static_inputs ?? {};\n\n if (item.eval_route_id && route) {\n const routeInputs = getRouteInputDeclarationsFromRoute(route);\n const pinnedKeys = Object.keys(pinned);\n const materialized =\n item.submission_assets &&\n Object.keys(item.submission_assets).length > 0\n ? item.submission_assets\n : materializeContributorSubmissionAssets(routeInputs, pinnedKeys);\n const contributorKeys = Object.keys(materialized);\n return {\n contributorKeys,\n declarations: materialized,\n pinned,\n };\n }\n\n const declarations = item.submission_assets ?? {};\n return {\n contributorKeys: Object.keys(declarations),\n declarations,\n pinned,\n };\n}\n\nexport function declarationToPickerFilters(\n declaration: RouteInputDeclarationLike | QuestSubmissionAssetDeclaration | null | undefined\n): AssetDeclarationPickerFilters | null {\n if (!declaration) return null;\n const assetType = declaration.asset_type || undefined;\n if (!assetType) return null;\n\n const filters: AssetDeclarationPickerFilters = {\n assetType,\n hasConstraints: false,\n };\n\n if (assetType === \"file\") {\n const extensions = readDeclarationExtensions(declaration);\n if (extensions.length > 0) {\n filters.extensions = extensions;\n filters.hasConstraints = true;\n }\n const fileType = readDeclarationFilter(declaration);\n if (fileType) {\n filters.fileType = fileType;\n filters.hasConstraints = true;\n }\n }\n\n return filters;\n}\n\nexport function assetMatchesDeclaration(\n asset:\n | {\n assetType?: string | null;\n asset_type?: string | null;\n asset?: { metadata?: Record<string, unknown> } | null;\n }\n | null\n | undefined,\n declaration: RouteInputDeclarationLike | QuestSubmissionAssetDeclaration | null | undefined\n): boolean {\n if (!declaration || !asset) return true;\n const filters = declarationToPickerFilters(declaration);\n if (!filters) return true;\n\n const assetType = asset.assetType ?? asset.asset_type;\n if (filters.assetType && assetType !== filters.assetType) return false;\n\n if (filters.assetType === \"file\") {\n const metadata = asset.asset?.metadata ?? {};\n if (filters.extensions && filters.extensions.length > 0) {\n const ext = String(metadata.extension ?? \"\").toLowerCase();\n if (!ext || !filters.extensions.includes(ext)) return false;\n }\n if (filters.fileType) {\n const type = String(metadata.file_type ?? metadata.type ?? \"\")\n .toLowerCase()\n .split(\"/\")[0];\n const expected = filters.fileType.toLowerCase();\n if (type && expected && !type.includes(expected) && type !== expected) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nexport function getPrimaryAssetRef(\n refs: KeyedAssetRefs | null | undefined,\n declarations?: Record<string, QuestSubmissionAssetDeclaration> | null\n): { key: string; asset_id: string; asset_type: string } | null {\n if (!refs || !Object.keys(refs).length) return null;\n const key =\n (declarations && getPrimaryDeclarationKey(declarations)) ||\n Object.keys(refs)[0];\n const ref = refs[key];\n if (!ref) return null;\n return { key, asset_id: ref.asset_id, asset_type: ref.asset_type };\n}\n\nexport function toRouteInputAssets(\n refs: KeyedAssetRefs | null | undefined\n): Record<string, { assetId: string; assetType: string }> {\n if (!refs) return {};\n return Object.fromEntries(\n Object.entries(refs).map(([key, ref]) => [\n key,\n { assetId: ref.asset_id, assetType: ref.asset_type },\n ])\n );\n}\n\n/** @deprecated Use declarationToPickerFilters */\nexport type EvalSubmissionFilters = AssetDeclarationPickerFilters;\n"]}
|