an.era 0.3.0-beta.2 → 0.3.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +294 -33
- package/dist/index.js +1 -1
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
|
@@ -8,28 +8,6 @@ type Error = {
|
|
|
8
8
|
message?: string;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
type RateLimitError = {
|
|
12
|
-
error: {
|
|
13
|
-
type: string;
|
|
14
|
-
message: string;
|
|
15
|
-
tier: 'guest' | 'free' | 'premium' | 'supporter';
|
|
16
|
-
limit: number;
|
|
17
|
-
limit_window?: string;
|
|
18
|
-
retry_after: number;
|
|
19
|
-
current_status?: {
|
|
20
|
-
tier?: string;
|
|
21
|
-
limits?: {};
|
|
22
|
-
upgrade_path?: {
|
|
23
|
-
current?: string;
|
|
24
|
-
recommended?: string;
|
|
25
|
-
benefits?: string[];
|
|
26
|
-
action?: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
suggestions: string[];
|
|
30
|
-
headers_note?: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
11
|
type Link = {
|
|
34
12
|
href: string;
|
|
35
13
|
};
|
|
@@ -66,6 +44,10 @@ type GroupCounts = {
|
|
|
66
44
|
channels: number;
|
|
67
45
|
users: number;
|
|
68
46
|
};
|
|
47
|
+
type UserTier = 'guest' | 'free' | 'premium' | 'supporter';
|
|
48
|
+
type BlockState = 'processing' | 'available' | 'failed';
|
|
49
|
+
type BlockVisibility = 'public' | 'private' | 'orphan';
|
|
50
|
+
type ChannelState = 'available' | 'deleted';
|
|
69
51
|
type ContentTypeFilter = 'Text' | 'Image' | 'Link' | 'Attachment' | 'Embed' | 'Channel' | 'Block';
|
|
70
52
|
type SearchTypeFilter = 'All' | 'Text' | 'Image' | 'Link' | 'Attachment' | 'Embed' | 'Channel' | 'Block' | 'User' | 'Group';
|
|
71
53
|
type FileExtension = 'aac' | 'ai' | 'aiff' | 'avi' | 'avif' | 'bmp' | 'csv' | 'doc' | 'docx' | 'eps' | 'epub' | 'fla' | 'gif' | 'h264' | 'heic' | 'heif' | 'ind' | 'indd' | 'jpeg' | 'jpg' | 'key' | 'kml' | 'kmz' | 'latex' | 'm4a' | 'ma' | 'mb' | 'mid' | 'midi' | 'mov' | 'mp3' | 'mp4' | 'mp4v' | 'mpeg' | 'mpg' | 'mpg4' | 'numbers' | 'oga' | 'ogg' | 'ogv' | 'otf' | 'pages' | 'pdf' | 'pgp' | 'png' | 'ppt' | 'pptx' | 'psd' | 'svg' | 'swa' | 'swf' | 'tex' | 'texi' | 'texinfo' | 'tfm' | 'tif' | 'tiff' | 'torrent' | 'ttc' | 'ttf' | 'txt' | 'wav' | 'webm' | 'webp' | 'wma' | 'xls' | 'xlsx' | 'xlt';
|
|
@@ -143,6 +125,28 @@ type EmbeddedConnection = {
|
|
|
143
125
|
connected_by: EmbeddedUser | null;
|
|
144
126
|
};
|
|
145
127
|
type ChannelOwner = EmbeddedUser | EmbeddedGroup;
|
|
128
|
+
type RateLimitError = {
|
|
129
|
+
error: {
|
|
130
|
+
type: string;
|
|
131
|
+
message: string;
|
|
132
|
+
tier: UserTier;
|
|
133
|
+
limit: number;
|
|
134
|
+
limit_window?: string;
|
|
135
|
+
retry_after: number;
|
|
136
|
+
current_status?: {
|
|
137
|
+
tier?: string;
|
|
138
|
+
limits?: {};
|
|
139
|
+
upgrade_path?: {
|
|
140
|
+
current?: string;
|
|
141
|
+
recommended?: string;
|
|
142
|
+
benefits?: string[];
|
|
143
|
+
action?: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
suggestions: string[];
|
|
147
|
+
headers_note?: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
146
150
|
type BlockSource = {
|
|
147
151
|
url: string;
|
|
148
152
|
title?: string | null;
|
|
@@ -200,7 +204,7 @@ type Channel = {
|
|
|
200
204
|
slug: string;
|
|
201
205
|
title: string;
|
|
202
206
|
description?: MarkdownContent | null;
|
|
203
|
-
state:
|
|
207
|
+
state: ChannelState;
|
|
204
208
|
visibility: ChannelVisibility;
|
|
205
209
|
created_at: string;
|
|
206
210
|
updated_at: string;
|
|
@@ -215,8 +219,8 @@ type BaseBlockProperties = {
|
|
|
215
219
|
base_type: 'Block';
|
|
216
220
|
title?: string | null;
|
|
217
221
|
description?: MarkdownContent | null;
|
|
218
|
-
state:
|
|
219
|
-
visibility:
|
|
222
|
+
state: BlockState;
|
|
223
|
+
visibility: BlockVisibility;
|
|
220
224
|
comment_count: number;
|
|
221
225
|
created_at: string;
|
|
222
226
|
updated_at: string;
|
|
@@ -619,6 +623,95 @@ declare const operations$1: {
|
|
|
619
623
|
};
|
|
620
624
|
};
|
|
621
625
|
};
|
|
626
|
+
readonly createBlockComment: {
|
|
627
|
+
readonly path: "/v3/blocks/{id}/comments";
|
|
628
|
+
readonly method: "post";
|
|
629
|
+
readonly tags: readonly ["Blocks"];
|
|
630
|
+
readonly parameters: {
|
|
631
|
+
readonly path: {
|
|
632
|
+
__TYPE__: {
|
|
633
|
+
id: number;
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
readonly body: {
|
|
637
|
+
__TYPE__: {
|
|
638
|
+
body: string;
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
readonly response: {
|
|
643
|
+
readonly '201': {
|
|
644
|
+
readonly 'application/json': {
|
|
645
|
+
__TYPE__: Comment;
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
readonly '400': {
|
|
649
|
+
readonly 'application/json': {
|
|
650
|
+
__TYPE__: Error;
|
|
651
|
+
};
|
|
652
|
+
};
|
|
653
|
+
readonly '401': {
|
|
654
|
+
readonly 'application/json': {
|
|
655
|
+
__TYPE__: Error;
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
readonly '403': {
|
|
659
|
+
readonly 'application/json': {
|
|
660
|
+
__TYPE__: Error;
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
readonly '404': {
|
|
664
|
+
readonly 'application/json': {
|
|
665
|
+
__TYPE__: Error;
|
|
666
|
+
};
|
|
667
|
+
};
|
|
668
|
+
readonly '422': {
|
|
669
|
+
readonly 'application/json': {
|
|
670
|
+
__TYPE__: Error;
|
|
671
|
+
};
|
|
672
|
+
};
|
|
673
|
+
readonly '429': {
|
|
674
|
+
readonly 'application/json': {
|
|
675
|
+
__TYPE__: RateLimitError;
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
readonly deleteComment: {
|
|
681
|
+
readonly path: "/v3/comments/{id}";
|
|
682
|
+
readonly method: "delete";
|
|
683
|
+
readonly tags: readonly ["Comments"];
|
|
684
|
+
readonly parameters: {
|
|
685
|
+
readonly path: {
|
|
686
|
+
__TYPE__: {
|
|
687
|
+
id: number;
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
readonly response: {
|
|
692
|
+
readonly '204': {};
|
|
693
|
+
readonly '401': {
|
|
694
|
+
readonly 'application/json': {
|
|
695
|
+
__TYPE__: Error;
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
readonly '403': {
|
|
699
|
+
readonly 'application/json': {
|
|
700
|
+
__TYPE__: Error;
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
readonly '404': {
|
|
704
|
+
readonly 'application/json': {
|
|
705
|
+
__TYPE__: Error;
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
readonly '429': {
|
|
709
|
+
readonly 'application/json': {
|
|
710
|
+
__TYPE__: RateLimitError;
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
};
|
|
622
715
|
readonly createChannel: {
|
|
623
716
|
readonly path: "/v3/channels";
|
|
624
717
|
readonly method: "post";
|
|
@@ -796,6 +889,60 @@ declare const operations$1: {
|
|
|
796
889
|
};
|
|
797
890
|
};
|
|
798
891
|
};
|
|
892
|
+
readonly createConnection: {
|
|
893
|
+
readonly path: "/v3/connections";
|
|
894
|
+
readonly method: "post";
|
|
895
|
+
readonly tags: readonly ["Connections"];
|
|
896
|
+
readonly parameters: {
|
|
897
|
+
readonly body: {
|
|
898
|
+
__TYPE__: {
|
|
899
|
+
connectable_id: number;
|
|
900
|
+
connectable_type: "Block" | "Channel";
|
|
901
|
+
channel_ids: (number | string)[];
|
|
902
|
+
position?: number;
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
};
|
|
906
|
+
readonly response: {
|
|
907
|
+
readonly '201': {
|
|
908
|
+
readonly 'application/json': {
|
|
909
|
+
__TYPE__: {
|
|
910
|
+
data?: Connection[];
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
};
|
|
914
|
+
readonly '400': {
|
|
915
|
+
readonly 'application/json': {
|
|
916
|
+
__TYPE__: Error;
|
|
917
|
+
};
|
|
918
|
+
};
|
|
919
|
+
readonly '401': {
|
|
920
|
+
readonly 'application/json': {
|
|
921
|
+
__TYPE__: Error;
|
|
922
|
+
};
|
|
923
|
+
};
|
|
924
|
+
readonly '403': {
|
|
925
|
+
readonly 'application/json': {
|
|
926
|
+
__TYPE__: Error;
|
|
927
|
+
};
|
|
928
|
+
};
|
|
929
|
+
readonly '404': {
|
|
930
|
+
readonly 'application/json': {
|
|
931
|
+
__TYPE__: Error;
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
readonly '422': {
|
|
935
|
+
readonly 'application/json': {
|
|
936
|
+
__TYPE__: Error;
|
|
937
|
+
};
|
|
938
|
+
};
|
|
939
|
+
readonly '429': {
|
|
940
|
+
readonly 'application/json': {
|
|
941
|
+
__TYPE__: RateLimitError;
|
|
942
|
+
};
|
|
943
|
+
};
|
|
944
|
+
};
|
|
945
|
+
};
|
|
799
946
|
readonly getConnection: {
|
|
800
947
|
readonly path: "/v3/connections/{id}";
|
|
801
948
|
readonly method: "get";
|
|
@@ -870,6 +1017,61 @@ declare const operations$1: {
|
|
|
870
1017
|
};
|
|
871
1018
|
};
|
|
872
1019
|
};
|
|
1020
|
+
readonly moveConnection: {
|
|
1021
|
+
readonly path: "/v3/connections/{id}/move";
|
|
1022
|
+
readonly method: "post";
|
|
1023
|
+
readonly tags: readonly ["Connections"];
|
|
1024
|
+
readonly parameters: {
|
|
1025
|
+
readonly path: {
|
|
1026
|
+
__TYPE__: {
|
|
1027
|
+
id: number;
|
|
1028
|
+
};
|
|
1029
|
+
};
|
|
1030
|
+
readonly body: {
|
|
1031
|
+
__TYPE__: {
|
|
1032
|
+
movement?: "insert_at" | "move_to_top" | "move_to_bottom" | "move_up" | "move_down";
|
|
1033
|
+
position?: number;
|
|
1034
|
+
};
|
|
1035
|
+
};
|
|
1036
|
+
};
|
|
1037
|
+
readonly response: {
|
|
1038
|
+
readonly '200': {
|
|
1039
|
+
readonly 'application/json': {
|
|
1040
|
+
__TYPE__: Connection;
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
readonly '400': {
|
|
1044
|
+
readonly 'application/json': {
|
|
1045
|
+
__TYPE__: Error;
|
|
1046
|
+
};
|
|
1047
|
+
};
|
|
1048
|
+
readonly '401': {
|
|
1049
|
+
readonly 'application/json': {
|
|
1050
|
+
__TYPE__: Error;
|
|
1051
|
+
};
|
|
1052
|
+
};
|
|
1053
|
+
readonly '403': {
|
|
1054
|
+
readonly 'application/json': {
|
|
1055
|
+
__TYPE__: Error;
|
|
1056
|
+
};
|
|
1057
|
+
};
|
|
1058
|
+
readonly '404': {
|
|
1059
|
+
readonly 'application/json': {
|
|
1060
|
+
__TYPE__: Error;
|
|
1061
|
+
};
|
|
1062
|
+
};
|
|
1063
|
+
readonly '422': {
|
|
1064
|
+
readonly 'application/json': {
|
|
1065
|
+
__TYPE__: Error;
|
|
1066
|
+
};
|
|
1067
|
+
};
|
|
1068
|
+
readonly '429': {
|
|
1069
|
+
readonly 'application/json': {
|
|
1070
|
+
__TYPE__: RateLimitError;
|
|
1071
|
+
};
|
|
1072
|
+
};
|
|
1073
|
+
};
|
|
1074
|
+
};
|
|
873
1075
|
readonly getChannelContents: {
|
|
874
1076
|
readonly path: "/v3/channels/{id}/contents";
|
|
875
1077
|
readonly method: "get";
|
|
@@ -1350,10 +1552,12 @@ declare const operations$1: {
|
|
|
1350
1552
|
readonly parameters: {
|
|
1351
1553
|
readonly query: {
|
|
1352
1554
|
__TYPE__: {
|
|
1353
|
-
|
|
1555
|
+
query?: string;
|
|
1354
1556
|
type?: SearchTypeFilter[];
|
|
1355
|
-
scope?:
|
|
1356
|
-
|
|
1557
|
+
scope?: "all" | "my" | "following";
|
|
1558
|
+
user_id?: number;
|
|
1559
|
+
group_id?: number;
|
|
1560
|
+
channel_id?: number;
|
|
1357
1561
|
ext?: FileExtension[];
|
|
1358
1562
|
sort?: "score_desc" | "created_at_desc" | "created_at_asc" | "updated_at_desc" | "updated_at_asc" | "name_asc" | "name_desc" | "connections_count_desc" | "random";
|
|
1359
1563
|
after?: string;
|
|
@@ -1426,6 +1630,7 @@ type Operation = {
|
|
|
1426
1630
|
parameters: Record<string, MaybeValiSchema>;
|
|
1427
1631
|
response: Record<string, Record<string, MaybeValiSchema>>;
|
|
1428
1632
|
};
|
|
1633
|
+
type OperationFunction<TOperation extends Operation> = (...args: MakeTrailingOptional<PrettifyTuple<MapUniqueUnion<MapSchemaTupleToInput<ObjectValuesToTuple<TOperation['parameters']>>>>>) => Promise<Prettify<MapResponseToUnion<TOperation['response']>>>;
|
|
1429
1634
|
//#endregion
|
|
1430
1635
|
//#region src/api/operations/group.d.ts
|
|
1431
1636
|
type TransformedOperation = Operation & {
|
|
@@ -1492,22 +1697,78 @@ declare const SERVERS: readonly [{
|
|
|
1492
1697
|
//#endregion
|
|
1493
1698
|
//#region src/api/index.d.ts
|
|
1494
1699
|
type DefaultOperations = typeof operations$1;
|
|
1495
|
-
interface ApiOptions<TOperations extends Record<string, Operation
|
|
1700
|
+
interface ApiOptions<TOperations extends Record<string, Operation>, TPlain extends boolean> {
|
|
1496
1701
|
baseUrl?: (typeof SERVERS)[number]['url'];
|
|
1497
1702
|
requestInit?: RequestInit;
|
|
1498
1703
|
accessToken?: string;
|
|
1499
1704
|
operations?: TOperations;
|
|
1500
1705
|
ignoreValidation?: boolean;
|
|
1706
|
+
plain?: TPlain;
|
|
1501
1707
|
}
|
|
1502
1708
|
type OperationFn<TOperation extends Operation> = (...args: MakeTrailingOptional<PrettifyTuple<MapUniqueUnion<MapSchemaTupleToInput<ObjectValuesToTuple<TOperation['parameters']>>>>>) => Promise<Prettify<MapResponseToUnion<TOperation['response']>>>;
|
|
1503
1709
|
type GroupedOperationFn<TParams extends Record<string, MaybeValiSchema>, TOps extends Record<string, TransformedOperation>> = (...args: MakeTrailingOptional<PrettifyTuple<MapUniqueUnion<MapSchemaTupleToInput<ObjectValuesToTuple<TParams>>>>>) => { [K in keyof TOps]: OperationFn<TOps[K]> };
|
|
1504
1710
|
type CreateApiReturn<TOperations extends Record<string, Operation>> = { [K in keyof TransformOperations<TOperations>]: TransformOperations<TOperations>[K] extends GroupedOperation<infer TParams, infer TOps> ? TOps extends Record<string, TransformedOperation> ? GroupedOperationFn<TParams, TOps> : never : TransformOperations<TOperations>[K] extends TransformedOperation ? OperationFn<TransformOperations<TOperations>[K]> : never };
|
|
1505
|
-
declare const createApi: <const TOperations extends Record<string, Operation> = DefaultOperations>({
|
|
1711
|
+
declare const createApi: <const TOperations extends Record<string, Operation> = DefaultOperations, const TPlain extends boolean = false>({
|
|
1506
1712
|
baseUrl,
|
|
1507
1713
|
requestInit,
|
|
1508
1714
|
accessToken,
|
|
1509
1715
|
operations,
|
|
1510
|
-
ignoreValidation
|
|
1511
|
-
|
|
1716
|
+
ignoreValidation,
|
|
1717
|
+
plain
|
|
1718
|
+
}?: ApiOptions<TOperations, TPlain>) => TPlain extends true ? { [K in keyof TOperations]: OperationFunction<TOperations[K]> } : CreateApiReturn<TOperations>;
|
|
1719
|
+
//#endregion
|
|
1720
|
+
//#region src/schema.d.ts
|
|
1721
|
+
declare const isError: (input: unknown) => input is Error;
|
|
1722
|
+
declare const isRateLimitError: (input: unknown) => input is RateLimitError;
|
|
1723
|
+
declare const isLink: (input: unknown) => input is Link;
|
|
1724
|
+
declare const isMarkdownContent: (input: unknown) => input is MarkdownContent;
|
|
1725
|
+
declare const isEmbeddedUser: (input: unknown) => input is EmbeddedUser;
|
|
1726
|
+
declare const isConnectionAbilities: (input: unknown) => input is ConnectionAbilities;
|
|
1727
|
+
declare const isEmbeddedGroup: (input: unknown) => input is EmbeddedGroup;
|
|
1728
|
+
declare const isUserCounts: (input: unknown) => input is UserCounts;
|
|
1729
|
+
declare const isGroupCounts: (input: unknown) => input is GroupCounts;
|
|
1730
|
+
declare const isContentTypeFilter: (input: unknown) => input is ContentTypeFilter;
|
|
1731
|
+
declare const isSearchTypeFilter: (input: unknown) => input is SearchTypeFilter;
|
|
1732
|
+
declare const isFileExtension: (input: unknown) => input is FileExtension;
|
|
1733
|
+
declare const isConnectionSort: (input: unknown) => input is ConnectionSort;
|
|
1734
|
+
declare const isChannelContentSort: (input: unknown) => input is ChannelContentSort;
|
|
1735
|
+
declare const isContentSort: (input: unknown) => input is ContentSort;
|
|
1736
|
+
declare const isChannelVisibility: (input: unknown) => input is ChannelVisibility;
|
|
1737
|
+
declare const isBlockAbilities: (input: unknown) => input is BlockAbilities;
|
|
1738
|
+
declare const isBlockProvider: (input: unknown) => input is BlockProvider;
|
|
1739
|
+
declare const isImageVersion: (input: unknown) => input is ImageVersion;
|
|
1740
|
+
declare const isBlockEmbed: (input: unknown) => input is BlockEmbed;
|
|
1741
|
+
declare const isBlockAttachment: (input: unknown) => input is BlockAttachment;
|
|
1742
|
+
declare const isChannelAbilities: (input: unknown) => input is ChannelAbilities;
|
|
1743
|
+
declare const isChannelCounts: (input: unknown) => input is ChannelCounts;
|
|
1744
|
+
declare const isPaginationMeta: (input: unknown) => input is PaginationMeta;
|
|
1745
|
+
declare const isPingResponse: (input: unknown) => input is PingResponse;
|
|
1746
|
+
declare const isLinks: (input: unknown) => input is Links;
|
|
1747
|
+
declare const isEmbeddedConnection: (input: unknown) => input is EmbeddedConnection;
|
|
1748
|
+
declare const isChannelOwner: (input: unknown) => input is ChannelOwner;
|
|
1749
|
+
declare const isBlockSource: (input: unknown) => input is BlockSource;
|
|
1750
|
+
declare const isBlockImage: (input: unknown) => input is BlockImage;
|
|
1751
|
+
declare const isPaginatedResponse: (input: unknown) => input is PaginatedResponse;
|
|
1752
|
+
declare const isUser: (input: unknown) => input is User;
|
|
1753
|
+
declare const isGroup: (input: unknown) => input is Group;
|
|
1754
|
+
declare const isComment: (input: unknown) => input is Comment;
|
|
1755
|
+
declare const isConnection: (input: unknown) => input is Connection;
|
|
1756
|
+
declare const isChannel: (input: unknown) => input is Channel;
|
|
1757
|
+
declare const isBaseBlockProperties: (input: unknown) => input is BaseBlockProperties;
|
|
1758
|
+
declare const isUserList: (input: unknown) => input is UserList;
|
|
1759
|
+
declare const isCommentList: (input: unknown) => input is CommentList;
|
|
1760
|
+
declare const isChannelList: (input: unknown) => input is ChannelList;
|
|
1761
|
+
declare const isFollowableList: (input: unknown) => input is FollowableList;
|
|
1762
|
+
declare const isTextBlock: (input: unknown) => input is TextBlock;
|
|
1763
|
+
declare const isImageBlock: (input: unknown) => input is ImageBlock;
|
|
1764
|
+
declare const isLinkBlock: (input: unknown) => input is LinkBlock;
|
|
1765
|
+
declare const isAttachmentBlock: (input: unknown) => input is AttachmentBlock;
|
|
1766
|
+
declare const isEmbedBlock: (input: unknown) => input is EmbedBlock;
|
|
1767
|
+
declare const isPendingBlock: (input: unknown) => input is PendingBlock;
|
|
1768
|
+
declare const isConnectableList: (input: unknown) => input is ConnectableList;
|
|
1769
|
+
declare const isEverythingList: (input: unknown) => input is EverythingList;
|
|
1770
|
+
declare const isBlock: (input: unknown) => input is Block;
|
|
1771
|
+
declare const isConnectableListResponse: (input: unknown) => input is ConnectableListResponse;
|
|
1772
|
+
declare const isEverythingListResponse: (input: unknown) => input is EverythingListResponse;
|
|
1512
1773
|
//#endregion
|
|
1513
|
-
export { type AttachmentBlock, type BaseBlockProperties, type Block, type BlockAbilities, type BlockAttachment, type BlockEmbed, type BlockImage, type BlockProvider, type BlockSource, type Channel, type ChannelAbilities, type ChannelContentSort, type ChannelCounts, type ChannelList, type ChannelListResponse, type ChannelOwner, type ChannelVisibility, type Comment, type CommentList, type CommentListResponse, type ConnectableList, type ConnectableListResponse, type Connection, type ConnectionAbilities, type ConnectionSort, type ContentSort, type ContentTypeFilter, type EmbedBlock, type EmbeddedConnection, type EmbeddedGroup, type EmbeddedUser, type Error, type EverythingList, type EverythingListResponse, type FileExtension, type FollowableList, type FollowableListResponse, type Group, type GroupCounts, type ImageBlock, type ImageVersion, type Link, type LinkBlock, type Links, type MarkdownContent, type PaginatedResponse, type PaginationMeta, type PendingBlock, type PingResponse, type RateLimitError, type SearchTypeFilter, type TextBlock, type User, type UserCounts, type UserList, type UserListResponse, createApi as createArena };
|
|
1774
|
+
export { type AttachmentBlock, type BaseBlockProperties, type Block, type BlockAbilities, type BlockAttachment, type BlockEmbed, type BlockImage, type BlockProvider, type BlockSource, type Channel, type ChannelAbilities, type ChannelContentSort, type ChannelCounts, type ChannelList, type ChannelListResponse, type ChannelOwner, type ChannelVisibility, type Comment, type CommentList, type CommentListResponse, type ConnectableList, type ConnectableListResponse, type Connection, type ConnectionAbilities, type ConnectionSort, type ContentSort, type ContentTypeFilter, type EmbedBlock, type EmbeddedConnection, type EmbeddedGroup, type EmbeddedUser, type Error, type EverythingList, type EverythingListResponse, type FileExtension, type FollowableList, type FollowableListResponse, type Group, type GroupCounts, type ImageBlock, type ImageVersion, type Link, type LinkBlock, type Links, type MarkdownContent, type PaginatedResponse, type PaginationMeta, type PendingBlock, type PingResponse, type RateLimitError, type SearchTypeFilter, type TextBlock, type User, type UserCounts, type UserList, type UserListResponse, createApi as createArena, isAttachmentBlock, isBaseBlockProperties, isBlock, isBlockAbilities, isBlockAttachment, isBlockEmbed, isBlockImage, isBlockProvider, isBlockSource, isChannel, isChannelAbilities, isChannelContentSort, isChannelCounts, isChannelList, isChannelOwner, isChannelVisibility, isComment, isCommentList, isConnectableList, isConnectableListResponse, isConnection, isConnectionAbilities, isConnectionSort, isContentSort, isContentTypeFilter, isEmbedBlock, isEmbeddedConnection, isEmbeddedGroup, isEmbeddedUser, isError, isEverythingList, isEverythingListResponse, isFileExtension, isFollowableList, isGroup, isGroupCounts, isImageBlock, isImageVersion, isLink, isLinkBlock, isLinks, isMarkdownContent, isPaginatedResponse, isPaginationMeta, isPendingBlock, isPingResponse, isRateLimitError, isSearchTypeFilter, isTextBlock, isUser, isUserCounts, isUserList };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"valibot";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e));const u=e.object({error:e.string(),code:e.pipe(e.number(),e.integer()),details:e.optional(e.object({message:e.optional(e.string())}))}),d=e.object({error:e.object({type:e.string(),message:e.string(),tier:e.picklist([`guest`,`free`,`premium`,`supporter`]),limit:e.pipe(e.number(),e.integer()),limit_window:e.optional(e.string()),retry_after:e.pipe(e.number(),e.integer()),current_status:e.optional(e.object({tier:e.optional(e.string()),limits:e.optional(e.object({})),upgrade_path:e.optional(e.object({current:e.optional(e.string()),recommended:e.optional(e.string()),benefits:e.optional(e.array(e.string())),action:e.optional(e.string())}))})),suggestions:e.array(e.string()),headers_note:e.optional(e.string())})}),f=e.object({href:e.pipe(e.string(),e.url())}),p=e.object({markdown:e.string(),html:e.string(),plain:e.string()}),m=e.object({id:e.pipe(e.number(),e.integer()),type:e.literal(`User`),name:e.string(),slug:e.string(),avatar:e.union([e.pipe(e.string(),e.url()),e.null_()]),initials:e.string()}),ee=e.object({remove:e.boolean()}),h=e.object({id:e.pipe(e.number(),e.integer()),type:e.literal(`Group`),name:e.string(),slug:e.string(),avatar:e.union([e.pipe(e.string(),e.url()),e.null_()]),initials:e.string()}),te=e.object({channels:e.pipe(e.number(),e.integer()),followers:e.pipe(e.number(),e.integer()),following:e.pipe(e.number(),e.integer())}),ne=e.object({channels:e.pipe(e.number(),e.integer()),users:e.pipe(e.number(),e.integer())});e.picklist([`Text`,`Image`,`Link`,`Attachment`,`Embed`,`Channel`,`Block`]);const re=e.picklist([`All`,`Text`,`Image`,`Link`,`Attachment`,`Embed`,`Channel`,`Block`,`User`,`Group`]),ie=e.picklist(`aac.ai.aiff.avi.avif.bmp.csv.doc.docx.eps.epub.fla.gif.h264.heic.heif.ind.indd.jpeg.jpg.key.kml.kmz.latex.m4a.ma.mb.mid.midi.mov.mp3.mp4.mp4v.mpeg.mpg.mpg4.numbers.oga.ogg.ogv.otf.pages.pdf.pgp.png.ppt.pptx.psd.svg.swa.swf.tex.texi.texinfo.tfm.tif.tiff.torrent.ttc.ttf.txt.wav.webm.webp.wma.xls.xlsx.xlt`.split(`.`));e.picklist([`created_at_desc`,`created_at_asc`]),e.picklist([`position_asc`,`position_desc`,`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`]),e.picklist([`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`]);const ae=e.picklist([`public`,`private`,`closed`]),oe=e.object({manage:e.boolean(),comment:e.boolean(),connect:e.boolean()}),se=e.object({name:e.string(),url:e.pipe(e.string(),e.url())}),g=e.object({src:e.pipe(e.string(),e.url()),src_2x:e.pipe(e.string(),e.url()),width:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),height:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()]))}),ce=e.object({url:e.optional(e.union([e.pipe(e.string(),e.url()),e.null_()])),type:e.optional(e.union([e.string(),e.null_()])),title:e.optional(e.union([e.string(),e.null_()])),author_name:e.optional(e.union([e.string(),e.null_()])),author_url:e.optional(e.union([e.pipe(e.string(),e.url()),e.null_()])),source_url:e.optional(e.union([e.pipe(e.string(),e.url()),e.null_()])),width:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),height:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),html:e.optional(e.union([e.string(),e.null_()])),thumbnail_url:e.optional(e.union([e.pipe(e.string(),e.url()),e.null_()]))}),le=e.object({filename:e.optional(e.union([e.string(),e.null_()])),content_type:e.optional(e.union([e.string(),e.null_()])),file_size:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),file_extension:e.optional(e.union([e.string(),e.null_()])),updated_at:e.optional(e.union([e.pipe(e.string(),e.isoTimestamp()),e.null_()])),url:e.pipe(e.string(),e.url())}),ue=e.object({add_to:e.boolean(),update:e.boolean(),destroy:e.boolean(),manage_collaborators:e.boolean()}),_=e.object({blocks:e.pipe(e.number(),e.integer()),channels:e.pipe(e.number(),e.integer()),contents:e.pipe(e.number(),e.integer()),collaborators:e.pipe(e.number(),e.integer())}),de=e.object({current_page:e.pipe(e.number(),e.integer()),next_page:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),prev_page:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),per_page:e.pipe(e.number(),e.integer()),total_pages:e.pipe(e.number(),e.integer()),total_count:e.pipe(e.number(),e.integer()),has_more_pages:e.boolean()}),fe=e.object({status:e.literal(`ok`)}),v=e.objectWithRest({self:f},f),y=e.object({id:e.pipe(e.number(),e.integer()),position:e.pipe(e.number(),e.integer()),pinned:e.boolean(),connected_at:e.pipe(e.string(),e.isoTimestamp()),connected_by:e.union([m,e.null_()])}),pe=e.union([m,h]),me=e.object({url:e.pipe(e.string(),e.url()),title:e.optional(e.union([e.string(),e.null_()])),provider:e.optional(e.union([se,e.null_()]))}),b=e.object({alt_text:e.optional(e.union([e.string(),e.null_()])),blurhash:e.optional(e.union([e.string(),e.null_()])),width:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),height:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),aspect_ratio:e.optional(e.union([e.number(),e.null_()])),content_type:e.optional(e.string()),filename:e.optional(e.string()),file_size:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),updated_at:e.optional(e.pipe(e.string(),e.isoTimestamp())),small:g,medium:g,large:g,square:g}),x=e.object({meta:de}),S=e.intersect([m,e.object({created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),bio:e.optional(e.union([p,e.null_()])),counts:te,_links:v})]),C=e.intersect([h,e.object({bio:e.optional(e.union([p,e.null_()])),created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),user:m,counts:ne,_links:v})]),he=e.object({id:e.pipe(e.number(),e.integer()),type:e.literal(`Comment`),body:e.optional(e.union([p,e.null_()])),created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),user:m,_links:v}),ge=e.intersect([y,e.object({can:ee,_links:v})]),w=e.object({id:e.pipe(e.number(),e.integer()),type:e.literal(`Channel`),slug:e.string(),title:e.string(),description:e.optional(e.union([p,e.null_()])),state:e.picklist([`available`,`deleted`]),visibility:ae,created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),owner:pe,counts:_,_links:v,connection:e.optional(e.union([y,e.null_()])),can:e.optional(e.union([ue,e.null_()]))}),T=e.object({id:e.pipe(e.number(),e.integer()),base_type:e.literal(`Block`),title:e.optional(e.union([e.string(),e.null_()])),description:e.optional(e.union([p,e.null_()])),state:e.picklist([`processing`,`available`,`failed`]),visibility:e.picklist([`public`,`private`,`orphan`]),comment_count:e.pipe(e.number(),e.integer()),created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),user:m,source:e.optional(e.union([me,e.null_()])),_links:v,connection:e.optional(e.union([y,e.null_()])),can:e.optional(e.union([oe,e.null_()]))}),_e=e.object({data:e.array(S)}),ve=e.object({data:e.array(he)}),ye=e.object({data:e.array(w)}),be=e.object({data:e.array(e.union([S,w,C]))}),E=e.intersect([T,e.object({type:e.literal(`Text`),content:p})]),D=e.intersect([T,e.object({type:e.literal(`Image`),image:b})]),O=e.intersect([T,e.object({type:e.literal(`Link`),image:e.optional(e.union([b,e.null_()])),content:e.optional(e.union([p,e.null_()]))})]),k=e.intersect([T,e.object({type:e.literal(`Attachment`),attachment:le,image:e.optional(e.union([b,e.null_()]))})]),A=e.intersect([T,e.object({type:e.literal(`Embed`),embed:ce,image:e.optional(e.union([b,e.null_()]))})]),j=e.intersect([T,e.object({type:e.literal(`PendingBlock`)})]),M=e.intersect([_e,x]),N=e.intersect([ve,x]),P=e.intersect([ye,x]),xe=e.intersect([be,x]),Se=e.object({data:e.array(e.union([E,D,O,k,A,w]))}),Ce=e.object({data:e.array(e.union([E,D,O,k,A,w,S,C]))}),F=e.union([E,D,O,k,A,j]),I=e.intersect([Se,x]),we=e.intersect([Ce,x]),Te={createOAuthToken:{path:`/v3/oauth/token`,method:`post`,tags:[`Authentication`],parameters:{formData:e.object({grant_type:e.picklist([`authorization_code`,`client_credentials`]),client_id:e.optional(e.string()),client_secret:e.optional(e.string()),code:e.optional(e.string()),redirect_uri:e.optional(e.pipe(e.string(),e.url())),code_verifier:e.optional(e.string())})},response:{200:{"application/json":e.object({access_token:e.string(),token_type:e.literal(`Bearer`),scope:e.string(),created_at:e.pipe(e.number(),e.integer())})},400:{"application/json":e.object({error:e.optional(e.picklist([`invalid_request`,`invalid_client`,`invalid_grant`,`unauthorized_client`,`unsupported_grant_type`])),error_description:e.optional(e.string())})},401:{"application/json":e.object({error:e.optional(e.string()),error_description:e.optional(e.string())})}}},getOpenapiSpec:{path:`/v3/openapi`,method:`get`,tags:[`System`],parameters:{},response:{200:{"application/yaml":e.string()},404:{"application/json":u}}},getOpenapiSpecJson:{path:`/v3/openapi.json`,method:`get`,tags:[`System`],parameters:{},response:{200:{"application/json":e.object({})},404:{"application/json":u}}},getPing:{path:`/v3/ping`,method:`get`,tags:[`System`],parameters:{},response:{200:{"application/json":fe},429:{"application/json":d}}},createBlock:{path:`/v3/blocks`,method:`post`,tags:[`Blocks`],parameters:{body:e.object({value:e.string(),channel_ids:e.pipe(e.array(e.pipe(e.number(),e.integer())),e.minLength(1),e.maxLength(6)),title:e.optional(e.string()),description:e.optional(e.string()),original_source_url:e.optional(e.pipe(e.string(),e.url())),original_source_title:e.optional(e.string()),alt_text:e.optional(e.string()),insert_at:e.optional(e.pipe(e.number(),e.integer()))})},response:{201:{"application/json":F},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getBlock:{path:`/v3/blocks/{id}`,method:`get`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())})},response:{200:{"application/json":F},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},updateBlock:{path:`/v3/blocks/{id}`,method:`put`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())}),body:e.object({title:e.optional(e.string()),description:e.optional(e.string()),content:e.optional(e.string()),alt_text:e.optional(e.string())})},response:{200:{"application/json":F},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},422:{"application/json":u},429:{"application/json":d}}},getBlockConnections:{path:`/v3/blocks/{id}/connections`,method:`get`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`])),filter:e.optional(e.picklist([`ALL`,`OWN`,`EXCLUDE_OWN`]))})},response:{200:{"application/json":P},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getBlockComments:{path:`/v3/blocks/{id}/comments`,method:`get`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":N},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},createChannel:{path:`/v3/channels`,method:`post`,tags:[`Channels`],parameters:{body:e.object({title:e.string(),visibility:e.optional(e.picklist([`public`,`private`,`closed`])),description:e.optional(e.string()),group_id:e.optional(e.pipe(e.number(),e.integer()))})},response:{201:{"application/json":w},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},422:{"application/json":u},429:{"application/json":d}}},getChannel:{path:`/v3/channels/{id}`,method:`get`,tags:[`Channels`],parameters:{path:e.object({id:e.string()})},response:{200:{"application/json":w},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},updateChannel:{path:`/v3/channels/{id}`,method:`put`,tags:[`Channels`],parameters:{path:e.object({id:e.string()}),body:e.object({title:e.optional(e.string()),visibility:e.optional(e.picklist([`public`,`private`,`closed`])),description:e.optional(e.union([e.string(),e.null_()]))})},response:{200:{"application/json":w},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},422:{"application/json":u},429:{"application/json":d}}},deleteChannel:{path:`/v3/channels/{id}`,method:`delete`,tags:[`Channels`],parameters:{path:e.object({id:e.string()})},response:{204:{},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getConnection:{path:`/v3/connections/{id}`,method:`get`,tags:[`Connections`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())})},response:{200:{"application/json":ge},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},deleteConnection:{path:`/v3/connections/{id}`,method:`delete`,tags:[`Connections`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())})},response:{204:{},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getChannelContents:{path:`/v3/channels/{id}/contents`,method:`get`,tags:[`Channels`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`position_asc`,`position_desc`,`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`])),user_id:e.optional(e.pipe(e.number(),e.integer()))})},response:{200:{"application/json":I},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getChannelConnections:{path:`/v3/channels/{id}/connections`,method:`get`,tags:[`Channels`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":P},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getChannelFollowers:{path:`/v3/channels/{id}/followers`,method:`get`,tags:[`Channels`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":M},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getCurrentUser:{path:`/v3/me`,method:`get`,tags:[`Users`],parameters:{},response:{200:{"application/json":S},401:{"application/json":u},429:{"application/json":d}}},getUser:{path:`/v3/users/{id}`,method:`get`,tags:[`Users`],parameters:{path:e.object({id:e.string()})},response:{200:{"application/json":S},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getUserContents:{path:`/v3/users/{id}/contents`,method:`get`,tags:[`Users`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`])),type:e.optional(e.picklist([`Text`,`Image`,`Link`,`Attachment`,`Embed`,`Channel`,`Block`]))})},response:{200:{"application/json":I},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getUserFollowers:{path:`/v3/users/{id}/followers`,method:`get`,tags:[`Users`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":M},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getUserFollowing:{path:`/v3/users/{id}/following`,method:`get`,tags:[`Users`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`])),type:e.optional(e.picklist([`User`,`Channel`,`Group`]))})},response:{200:{"application/json":xe},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getGroup:{path:`/v3/groups/{id}`,method:`get`,tags:[`Groups`],parameters:{path:e.object({id:e.string()})},response:{200:{"application/json":C},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getGroupContents:{path:`/v3/groups/{id}/contents`,method:`get`,tags:[`Groups`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`])),type:e.optional(e.picklist([`Text`,`Image`,`Link`,`Attachment`,`Embed`,`Channel`,`Block`]))})},response:{200:{"application/json":I},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},getGroupFollowers:{path:`/v3/groups/{id}/followers`,method:`get`,tags:[`Groups`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":M},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":d}}},search:{path:`/v3/search`,method:`get`,tags:[`Search`],parameters:{query:e.object({q:e.optional(e.string()),type:e.optional(e.array(re)),scope:e.optional(e.string()),in:e.optional(e.array(e.picklist([`name`,`description`,`content`,`domain`,`url`]))),ext:e.optional(e.array(ie)),sort:e.optional(e.picklist([`score_desc`,`created_at_desc`,`created_at_asc`,`updated_at_desc`,`updated_at_asc`,`name_asc`,`name_desc`,`connections_count_desc`,`random`])),after:e.optional(e.pipe(e.string(),e.isoDateTime())),seed:e.optional(e.pipe(e.number(),e.integer())),page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100)))})},response:{200:{"application/json":we},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},429:{"application/json":d}}}},L=e=>{let t=[],n=``;for(let r of e)r===r.toUpperCase()&&r!==r.toLowerCase()?(n&&t.push(n),n=r):n+=r;return n&&t.push(n),t},R=(e,t)=>{let n=t.toUpperCase();if(e.slice(0,t.length).toUpperCase()===n){let n=e.slice(t.length);return n.charAt(0).toLowerCase()+n.slice(1)}return e.charAt(0).toLowerCase()+e.slice(1)},z=e=>L(e).map(e=>e.toLowerCase()),Ee=(e,t,n)=>{let r=L(e),i=r.findIndex(e=>e.toLowerCase()===t);if(i===-1)return n;let a=r.slice(0,i),o=r.slice(i+1),s=a[0];if(s)return s.toLowerCase()+a.slice(1).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);let c=o[0];return c?c.toLowerCase()+o.slice(1).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``):n},B=e=>{let t=e.split(`/`),n=``;for(let e of t){if(e.startsWith(`{`)&&e.endsWith(`}`))return n+=(n?`/`:``)+e,n;n+=(n?`/`:``)+e}return n},V=(e,t)=>B(e)===B(t),H=e=>Object.keys(e.parameters).length>0,U=e=>Object.keys(e.parameters).length,De=(e,t)=>e.some(e=>t.includes(e)),Oe=(e,t)=>{let n=Object.keys(e.parameters),r=Object.keys(t.parameters);return n.some(e=>r.includes(e))},ke=(e,t,n)=>{let r=e[t];if(!r)return[];let i=[];for(let[t,a]of Object.entries(e))H(a)&&z(R(t,a.method)).includes(n)&&De(r.tags,a.tags)&&V(r.path,a.path)&&i.push(a);return i},Ae=(e,t,n)=>{let r=e[t];if(!r)return!1;let i=ke(e,t,n).filter(e=>e!==r);if(i.length===0)return!1;let a=U(r),o=i.filter(e=>U(e)>a);if(o.length===0)return!0;for(let e of o)if(!Oe(r,e))return!1;return!0},je=e=>{if(e.length===0)return[];let t=e[0];if(!t)return[];let n=new Set(Object.keys(t.parameters));for(let t=1;t<e.length;t++){let r=e[t];if(!r)continue;let i=new Set(Object.keys(r.parameters));n=new Set([...n].filter(e=>i.has(e)))}return Array.from(n)},Me=e=>{let t=je(e),n={};for(let r of t)for(let t of e){let e=t.parameters[r];if(e){n[r]=e;break}}return n},Ne=(e,t,n)=>{let r={};for(let[n,i]of Object.entries(e.parameters))t.includes(n)||(r[n]=i);return{...e,id:n,parameters:r}},Pe=e=>{let t={},n=new Set,r=new Set;for(let[t,n]of Object.entries(e)){let e=R(t,n.method);for(let t of z(e))r.add(t)}for(let i of r){let r=[];for(let[t,n]of Object.entries(e)){if(!H(n))continue;let a=R(t,n.method);z(a).includes(i)&&Ae(e,t,i)&&r.push({key:t,op:n,processedKey:a})}if(r.length>0){let e=Me(r.map(e=>e.op)),a=Object.keys(e),o={};for(let{key:e,op:t,processedKey:s}of r){let r=Ee(s,i,t.method);o[r]=Ne(t,a,e),n.add(e)}t[i]={parameters:e,operations:o}}}for(let[r,i]of Object.entries(e)){if(n.has(r))continue;let e=R(r,i.method);t[e]={...i,id:r}}return t};var W=l(s(((e,t)=>{let n=function(){};n.prototype=Object.create(null);let r=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,i=/\\([\v\u0020-\u00ff])/gu,a=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,o={type:``,parameters:new n};Object.freeze(o.parameters),Object.freeze(o);function s(e){if(typeof e!=`string`)throw TypeError(`argument header is required and must be a string`);let t=e.indexOf(`;`),o=t===-1?e.trim():e.slice(0,t).trim();if(a.test(o)===!1)throw TypeError(`invalid media type`);let s={type:o.toLowerCase(),parameters:new n};if(t===-1)return s;let c,l,u;for(r.lastIndex=t;l=r.exec(e);){if(l.index!==t)throw TypeError(`invalid parameter format`);t+=l[0].length,c=l[1].toLowerCase(),u=l[2],u[0]===`"`&&(u=u.slice(1,u.length-1),i.test(u)&&(u=u.replace(i,`$1`))),s.parameters[c]=u}if(t!==e.length)throw TypeError(`invalid parameter format`);return s}function c(e){if(typeof e!=`string`)return o;let t=e.indexOf(`;`),s=t===-1?e.trim():e.slice(0,t).trim();if(a.test(s)===!1)return o;let c={type:s.toLowerCase(),parameters:new n};if(t===-1)return c;let l,u,d;for(r.lastIndex=t;u=r.exec(e);){if(u.index!==t)return o;t+=u[0].length,l=u[1].toLowerCase(),d=u[2],d[0]===`"`&&(d=d.slice(1,d.length-1),i.test(d)&&(d=d.replace(i,`$1`))),c.parameters[l]=d}return t===e.length?c:o}t.exports.default={parse:s,safeParse:c},t.exports.parse=s,t.exports.safeParse=c,t.exports.defaultContentType=o}))(),1);const G=new WeakMap;let Fe=0;function K(e){let t=typeof e,n=e&&e.constructor,r=n===Date;if(Object(e)===e&&!r&&n!=RegExp){let t=G.get(e);if(t)return t;t=++Fe+`~`,G.set(e,t);let r;if(n===Array){for(t=`@`,r=0;r<e.length;r++)t+=K(e[r])+`,`;G.set(e,t)}else if(n===Object){t=`#`;let n=Object.keys(e).sort();for(;(r=n.pop())!==void 0;)e[r]!==void 0&&(t+=r+`:`+K(e[r])+`,`);G.set(e,t)}return t}return r?e.toJSON():t===`symbol`?e.toString():t===`string`?JSON.stringify(e):``+e}var Ie=K;function q(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(e){return/%[0-9A-Fa-f]/.test(e)||(e=encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`)),e}).join(``)}function J(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return`%`+e.charCodeAt(0).toString(16).toUpperCase()})}function Y(e,t,n){return t=e===`+`||e===`#`?q(t):J(t),n?J(n)+`=`+t:t}function X(e){return e!=null}function Z(e){return e===`;`||e===`&`||e===`?`}function Le(e,t,n,r){var i=e[n],a=[];if(X(i)&&i!==``)if(typeof i==`string`||typeof i==`number`||typeof i==`boolean`)i=i.toString(),r&&r!==`*`&&(i=i.substring(0,parseInt(r,10))),a.push(Y(t,i,Z(t)?n:null));else if(r===`*`)Array.isArray(i)?i.filter(X).forEach(function(e){a.push(Y(t,e,Z(t)?n:null))}):Object.keys(i).forEach(function(e){X(i[e])&&a.push(Y(t,i[e],e))});else{var o=[];Array.isArray(i)?i.filter(X).forEach(function(e){o.push(Y(t,e))}):Object.keys(i).forEach(function(e){X(i[e])&&(o.push(J(e)),o.push(Y(t,i[e].toString())))}),Z(t)?a.push(J(n)+`=`+o.join(`,`)):o.length!==0&&a.push(o.join(`,`))}else t===`;`?X(i)&&a.push(J(n)):i===``&&(t===`&`||t===`?`)?a.push(J(n)+`=`):i===``&&a.push(``);return a}function Re(e){var t=[`+`,`#`,`.`,`/`,`;`,`?`,`&`];return{expand:function(n){return e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(e,r,i){if(r){var a=null,o=[];if(t.indexOf(r.charAt(0))!==-1&&(a=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(e){var t=/([^:\*]*)(?::(\d+)|(\*))?/.exec(e);o.push.apply(o,Le(n,a,t[1],t[2]||t[3]))}),a&&a!==`+`){var s=`,`;return a===`?`?s=`&`:a!==`#`&&(s=a),(o.length===0?``:a)+o.join(s)}else return o.join(`,`)}else return q(i)})}}}const ze=(e,t)=>(n,r={},i=e=>e)=>global.fetch(i(new URL(n.toString(),e)),Object.assign({},t,r)),Q=(e,t)=>t===`application/json`||t.endsWith(`+json`)?e.json():t.startsWith(`text/`)||t===`application/xml`||t===`application/xhtml+xml`||t.endsWith(`+xml`)||t===`application/javascript`||t===`application/ecmascript`||t===`application/x-www-form-urlencoded`||t===`application/yaml`?e.text():t.startsWith(`image/`)||t.startsWith(`audio/`)||t.startsWith(`video/`)||t===`application/pdf`||t===`application/octet-stream`?e.blob():e.text(),Be=(e=new Map)=>(t,n)=>{let r=Ie([t,n].filter(Boolean));if(e.has(r))return e.get(r);let i=typeof n==`object`&&n?Re(t).expand(n):t;return e.set(r,i),i},$=(t,n)=>{let r=Object.keys(t);return r.length===0?{}:r.map((r,i)=>{let a=t[r];if(a){let t=e.safeParse(a,n[i],{abortEarly:!0});if(t.success)return t.output;throw Error(e.summarize(t.issues))}else throw Error(`Parameter "${r}" in argument ${i} is missing a schema.`)})},Ve=(e,t,n=(e,t)=>{let n=t.headers.get(`content-type`);return Q(t,typeof n==`string`?W.default.safeParse(n).type:``)})=>Object.fromEntries(Object.entries(e).map(([e,r])=>[e,async(...e)=>n(r,await t(r,Object.fromEntries(Object.keys(r.parameters).map((t,n)=>[t,e[n]]))))])),He=({baseUrl:t=`https://api.are.na`,requestInit:n={},accessToken:r,operations:i=Te,ignoreValidation:a=!1}={})=>{r&&(n.headers??={},n.headers=new Headers(n.headers),n.headers.set(`Authorization`,`Bearer ${r}`));let o=ze(new URL(t),n),s=Be(new Map),c=Ve(i,(e,t)=>{let n=s(e.path,typeof t.path==`object`?t.path:{}),r=Object.assign({},t.query??{},t.formData??{});return o(n,{method:e.method,body:`body`in t?JSON.stringify(t.body):void 0},r?e=>{if(typeof r==`object`)for(let t in r){let n=r[t];e.searchParams.set(t,typeof n==`string`?n:String(n))}return e}:void 0)},async(t,n)=>{let r=n.status.toString(),i=n.headers.get(`content-type`),o=typeof i==`string`?W.default.safeParse(i).type:``,s=await Q(n,o);return a?s:(async()=>{let n=t.response[r]??t.response.default;if(!n)throw Error(`No response schema defined for status ${r} in operation ${t.method.toUpperCase()} ${t.path}`);let i=n[o];if(!i)throw Error(`No response schema found for media "${o}" in operation ${t.method.toUpperCase()} ${t.path}`);return e.parseAsync(i,s,{abortEarly:!0}).catch(t=>e.isValiError(t)?e.summarize(t.issues):t)})()}),l=Pe(i);return Object.fromEntries(Object.entries(l).map(([e,t])=>[e,(...e)=>{let n=a?e:$(t.parameters,e);return`operations`in t?Object.fromEntries(Object.entries(t.operations).map(([e,t])=>[e,(...e)=>c[t.id](...n.concat(a?e:$(t.parameters,e)))])):c[t.id](...n)}]))};export{He as createArena};
|
|
1
|
+
import*as e from"valibot";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e));const u=e.object({error:e.string(),code:e.pipe(e.number(),e.integer()),details:e.optional(e.object({message:e.optional(e.string())}))}),d=e.object({href:e.pipe(e.string(),e.url())}),f=e.object({markdown:e.string(),html:e.string(),plain:e.string()}),p=e.object({id:e.pipe(e.number(),e.integer()),type:e.literal(`User`),name:e.string(),slug:e.string(),avatar:e.union([e.pipe(e.string(),e.url()),e.null_()]),initials:e.string()}),ee=e.object({remove:e.boolean()}),m=e.object({id:e.pipe(e.number(),e.integer()),type:e.literal(`Group`),name:e.string(),slug:e.string(),avatar:e.union([e.pipe(e.string(),e.url()),e.null_()]),initials:e.string()}),h=e.object({channels:e.pipe(e.number(),e.integer()),followers:e.pipe(e.number(),e.integer()),following:e.pipe(e.number(),e.integer())}),g=e.object({channels:e.pipe(e.number(),e.integer()),users:e.pipe(e.number(),e.integer())}),te=e.picklist([`guest`,`free`,`premium`,`supporter`]),ne=e.picklist([`processing`,`available`,`failed`]),re=e.picklist([`public`,`private`,`orphan`]),ie=e.picklist([`available`,`deleted`]);e.picklist([`ALL`,`OWN`,`EXCLUDE_OWN`]),e.picklist([`User`,`Channel`,`Group`]),e.picklist([`Block`,`Channel`]);const ae=e.picklist([`Text`,`Image`,`Link`,`Attachment`,`Embed`,`Channel`,`Block`]),oe=e.picklist([`All`,`Text`,`Image`,`Link`,`Attachment`,`Embed`,`Channel`,`Block`,`User`,`Group`]),se=e.picklist(`aac.ai.aiff.avi.avif.bmp.csv.doc.docx.eps.epub.fla.gif.h264.heic.heif.ind.indd.jpeg.jpg.key.kml.kmz.latex.m4a.ma.mb.mid.midi.mov.mp3.mp4.mp4v.mpeg.mpg.mpg4.numbers.oga.ogg.ogv.otf.pages.pdf.pgp.png.ppt.pptx.psd.svg.swa.swf.tex.texi.texinfo.tfm.tif.tiff.torrent.ttc.ttf.txt.wav.webm.webp.wma.xls.xlsx.xlt`.split(`.`)),ce=e.picklist([`created_at_desc`,`created_at_asc`]),le=e.picklist([`position_asc`,`position_desc`,`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`]),ue=e.picklist([`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`]);e.picklist([`all`,`my`,`following`]),e.picklist([`score_desc`,`created_at_desc`,`created_at_asc`,`updated_at_desc`,`updated_at_asc`,`name_asc`,`name_desc`,`connections_count_desc`,`random`]);const de=e.picklist([`public`,`private`,`closed`]);e.picklist([`insert_at`,`move_to_top`,`move_to_bottom`,`move_up`,`move_down`]);const _=e.object({manage:e.boolean(),comment:e.boolean(),connect:e.boolean()}),fe=e.object({name:e.string(),url:e.pipe(e.string(),e.url())}),v=e.object({src:e.pipe(e.string(),e.url()),src_2x:e.pipe(e.string(),e.url()),width:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),height:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()]))}),y=e.object({url:e.optional(e.union([e.pipe(e.string(),e.url()),e.null_()])),type:e.optional(e.union([e.string(),e.null_()])),title:e.optional(e.union([e.string(),e.null_()])),author_name:e.optional(e.union([e.string(),e.null_()])),author_url:e.optional(e.union([e.pipe(e.string(),e.url()),e.null_()])),source_url:e.optional(e.union([e.pipe(e.string(),e.url()),e.null_()])),width:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),height:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),html:e.optional(e.union([e.string(),e.null_()])),thumbnail_url:e.optional(e.union([e.pipe(e.string(),e.url()),e.null_()]))}),pe=e.object({filename:e.optional(e.union([e.string(),e.null_()])),content_type:e.optional(e.union([e.string(),e.null_()])),file_size:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),file_extension:e.optional(e.union([e.string(),e.null_()])),updated_at:e.optional(e.union([e.pipe(e.string(),e.isoTimestamp()),e.null_()])),url:e.pipe(e.string(),e.url())}),me=e.object({add_to:e.boolean(),update:e.boolean(),destroy:e.boolean(),manage_collaborators:e.boolean()}),he=e.object({blocks:e.pipe(e.number(),e.integer()),channels:e.pipe(e.number(),e.integer()),contents:e.pipe(e.number(),e.integer()),collaborators:e.pipe(e.number(),e.integer())}),b=e.object({current_page:e.pipe(e.number(),e.integer()),next_page:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),prev_page:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),per_page:e.pipe(e.number(),e.integer()),total_pages:e.pipe(e.number(),e.integer()),total_count:e.pipe(e.number(),e.integer()),has_more_pages:e.boolean()}),x=e.object({status:e.literal(`ok`)}),S=e.objectWithRest({self:d},d),C=e.object({id:e.pipe(e.number(),e.integer()),position:e.pipe(e.number(),e.integer()),pinned:e.boolean(),connected_at:e.pipe(e.string(),e.isoTimestamp()),connected_by:e.union([p,e.null_()])}),ge=e.union([p,m]),w=e.object({error:e.object({type:e.string(),message:e.string(),tier:te,limit:e.pipe(e.number(),e.integer()),limit_window:e.optional(e.string()),retry_after:e.pipe(e.number(),e.integer()),current_status:e.optional(e.object({tier:e.optional(e.string()),limits:e.optional(e.object({})),upgrade_path:e.optional(e.object({current:e.optional(e.string()),recommended:e.optional(e.string()),benefits:e.optional(e.array(e.string())),action:e.optional(e.string())}))})),suggestions:e.array(e.string()),headers_note:e.optional(e.string())})}),T=e.object({url:e.pipe(e.string(),e.url()),title:e.optional(e.union([e.string(),e.null_()])),provider:e.optional(e.union([fe,e.null_()]))}),E=e.object({alt_text:e.optional(e.union([e.string(),e.null_()])),blurhash:e.optional(e.union([e.string(),e.null_()])),width:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),height:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),aspect_ratio:e.optional(e.union([e.number(),e.null_()])),content_type:e.optional(e.string()),filename:e.optional(e.string()),file_size:e.optional(e.union([e.pipe(e.number(),e.integer()),e.null_()])),updated_at:e.optional(e.pipe(e.string(),e.isoTimestamp())),small:v,medium:v,large:v,square:v}),D=e.object({meta:b}),O=e.intersect([p,e.object({created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),bio:e.optional(e.union([f,e.null_()])),counts:h,_links:S})]),k=e.intersect([m,e.object({bio:e.optional(e.union([f,e.null_()])),created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),user:p,counts:g,_links:S})]),A=e.object({id:e.pipe(e.number(),e.integer()),type:e.literal(`Comment`),body:e.optional(e.union([f,e.null_()])),created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),user:p,_links:S}),j=e.intersect([C,e.object({can:ee,_links:S})]),M=e.object({id:e.pipe(e.number(),e.integer()),type:e.literal(`Channel`),slug:e.string(),title:e.string(),description:e.optional(e.union([f,e.null_()])),state:ie,visibility:de,created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),owner:ge,counts:he,_links:S,connection:e.optional(e.union([C,e.null_()])),can:e.optional(e.union([me,e.null_()]))}),N=e.object({id:e.pipe(e.number(),e.integer()),base_type:e.literal(`Block`),title:e.optional(e.union([e.string(),e.null_()])),description:e.optional(e.union([f,e.null_()])),state:ne,visibility:re,comment_count:e.pipe(e.number(),e.integer()),created_at:e.pipe(e.string(),e.isoTimestamp()),updated_at:e.pipe(e.string(),e.isoTimestamp()),user:p,source:e.optional(e.union([T,e.null_()])),_links:S,connection:e.optional(e.union([C,e.null_()])),can:e.optional(e.union([_,e.null_()]))}),_e=e.object({data:e.array(O)}),ve=e.object({data:e.array(A)}),ye=e.object({data:e.array(M)}),P=e.object({data:e.array(e.union([O,M,k]))}),F=e.intersect([N,e.object({type:e.literal(`Text`),content:f})]),I=e.intersect([N,e.object({type:e.literal(`Image`),image:E})]),L=e.intersect([N,e.object({type:e.literal(`Link`),image:e.optional(e.union([E,e.null_()])),content:e.optional(e.union([f,e.null_()]))})]),R=e.intersect([N,e.object({type:e.literal(`Attachment`),attachment:pe,image:e.optional(e.union([E,e.null_()]))})]),z=e.intersect([N,e.object({type:e.literal(`Embed`),embed:y,image:e.optional(e.union([E,e.null_()]))})]),B=e.intersect([N,e.object({type:e.literal(`PendingBlock`)})]),V=e.intersect([_e,D]),be=e.intersect([ve,D]),H=e.intersect([ye,D]),xe=e.intersect([P,D]),Se=e.object({data:e.array(e.union([F,I,L,R,z,M]))}),Ce=e.object({data:e.array(e.union([F,I,L,R,z,M,O,k]))}),U=e.union([F,I,L,R,z,B]),W=e.intersect([Se,D]),we=e.intersect([Ce,D]),Te={createOAuthToken:{path:`/v3/oauth/token`,method:`post`,tags:[`Authentication`],parameters:{formData:e.object({grant_type:e.picklist([`authorization_code`,`client_credentials`]),client_id:e.optional(e.string()),client_secret:e.optional(e.string()),code:e.optional(e.string()),redirect_uri:e.optional(e.pipe(e.string(),e.url())),code_verifier:e.optional(e.string())})},response:{200:{"application/json":e.object({access_token:e.string(),token_type:e.literal(`Bearer`),scope:e.string(),created_at:e.pipe(e.number(),e.integer())})},400:{"application/json":e.object({error:e.optional(e.picklist([`invalid_request`,`invalid_client`,`invalid_grant`,`unauthorized_client`,`unsupported_grant_type`])),error_description:e.optional(e.string())})},401:{"application/json":e.object({error:e.optional(e.string()),error_description:e.optional(e.string())})}}},getOpenapiSpec:{path:`/v3/openapi`,method:`get`,tags:[`System`],parameters:{},response:{200:{"application/yaml":e.string()},404:{"application/json":u}}},getOpenapiSpecJson:{path:`/v3/openapi.json`,method:`get`,tags:[`System`],parameters:{},response:{200:{"application/json":e.object({})},404:{"application/json":u}}},getPing:{path:`/v3/ping`,method:`get`,tags:[`System`],parameters:{},response:{200:{"application/json":x},429:{"application/json":w}}},createBlock:{path:`/v3/blocks`,method:`post`,tags:[`Blocks`],parameters:{body:e.object({value:e.string(),channel_ids:e.pipe(e.array(e.pipe(e.number(),e.integer())),e.minLength(1),e.maxLength(6)),title:e.optional(e.string()),description:e.optional(e.string()),original_source_url:e.optional(e.pipe(e.string(),e.url())),original_source_title:e.optional(e.string()),alt_text:e.optional(e.string()),insert_at:e.optional(e.pipe(e.number(),e.integer()))})},response:{201:{"application/json":U},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getBlock:{path:`/v3/blocks/{id}`,method:`get`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())})},response:{200:{"application/json":U},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},updateBlock:{path:`/v3/blocks/{id}`,method:`put`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())}),body:e.object({title:e.optional(e.string()),description:e.optional(e.string()),content:e.optional(e.string()),alt_text:e.optional(e.string())})},response:{200:{"application/json":U},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},422:{"application/json":u},429:{"application/json":w}}},getBlockConnections:{path:`/v3/blocks/{id}/connections`,method:`get`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`])),filter:e.optional(e.picklist([`ALL`,`OWN`,`EXCLUDE_OWN`]))})},response:{200:{"application/json":H},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getBlockComments:{path:`/v3/blocks/{id}/comments`,method:`get`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":be},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},createBlockComment:{path:`/v3/blocks/{id}/comments`,method:`post`,tags:[`Blocks`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())}),body:e.object({body:e.string()})},response:{201:{"application/json":A},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},422:{"application/json":u},429:{"application/json":w}}},deleteComment:{path:`/v3/comments/{id}`,method:`delete`,tags:[`Comments`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())})},response:{204:{},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},createChannel:{path:`/v3/channels`,method:`post`,tags:[`Channels`],parameters:{body:e.object({title:e.string(),visibility:e.optional(e.picklist([`public`,`private`,`closed`])),description:e.optional(e.string()),group_id:e.optional(e.pipe(e.number(),e.integer()))})},response:{201:{"application/json":M},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},422:{"application/json":u},429:{"application/json":w}}},getChannel:{path:`/v3/channels/{id}`,method:`get`,tags:[`Channels`],parameters:{path:e.object({id:e.string()})},response:{200:{"application/json":M},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},updateChannel:{path:`/v3/channels/{id}`,method:`put`,tags:[`Channels`],parameters:{path:e.object({id:e.string()}),body:e.object({title:e.optional(e.string()),visibility:e.optional(e.picklist([`public`,`private`,`closed`])),description:e.optional(e.union([e.string(),e.null_()]))})},response:{200:{"application/json":M},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},422:{"application/json":u},429:{"application/json":w}}},deleteChannel:{path:`/v3/channels/{id}`,method:`delete`,tags:[`Channels`],parameters:{path:e.object({id:e.string()})},response:{204:{},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},createConnection:{path:`/v3/connections`,method:`post`,tags:[`Connections`],parameters:{body:e.object({connectable_id:e.pipe(e.number(),e.integer()),connectable_type:e.picklist([`Block`,`Channel`]),channel_ids:e.pipe(e.array(e.union([e.pipe(e.number(),e.integer()),e.string()])),e.minLength(1)),position:e.optional(e.pipe(e.number(),e.integer()))})},response:{201:{"application/json":e.object({data:e.optional(e.array(j))})},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},422:{"application/json":u},429:{"application/json":w}}},getConnection:{path:`/v3/connections/{id}`,method:`get`,tags:[`Connections`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())})},response:{200:{"application/json":j},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},deleteConnection:{path:`/v3/connections/{id}`,method:`delete`,tags:[`Connections`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())})},response:{204:{},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},moveConnection:{path:`/v3/connections/{id}/move`,method:`post`,tags:[`Connections`],parameters:{path:e.object({id:e.pipe(e.number(),e.integer())}),body:e.object({movement:e.optional(e.picklist([`insert_at`,`move_to_top`,`move_to_bottom`,`move_up`,`move_down`])),position:e.optional(e.pipe(e.number(),e.integer()))})},response:{200:{"application/json":j},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},422:{"application/json":u},429:{"application/json":w}}},getChannelContents:{path:`/v3/channels/{id}/contents`,method:`get`,tags:[`Channels`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`position_asc`,`position_desc`,`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`])),user_id:e.optional(e.pipe(e.number(),e.integer()))})},response:{200:{"application/json":W},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getChannelConnections:{path:`/v3/channels/{id}/connections`,method:`get`,tags:[`Channels`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":H},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getChannelFollowers:{path:`/v3/channels/{id}/followers`,method:`get`,tags:[`Channels`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":V},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getCurrentUser:{path:`/v3/me`,method:`get`,tags:[`Users`],parameters:{},response:{200:{"application/json":O},401:{"application/json":u},429:{"application/json":w}}},getUser:{path:`/v3/users/{id}`,method:`get`,tags:[`Users`],parameters:{path:e.object({id:e.string()})},response:{200:{"application/json":O},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getUserContents:{path:`/v3/users/{id}/contents`,method:`get`,tags:[`Users`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`])),type:e.optional(e.picklist([`Text`,`Image`,`Link`,`Attachment`,`Embed`,`Channel`,`Block`]))})},response:{200:{"application/json":W},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getUserFollowers:{path:`/v3/users/{id}/followers`,method:`get`,tags:[`Users`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":V},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getUserFollowing:{path:`/v3/users/{id}/following`,method:`get`,tags:[`Users`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`])),type:e.optional(e.picklist([`User`,`Channel`,`Group`]))})},response:{200:{"application/json":xe},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getGroup:{path:`/v3/groups/{id}`,method:`get`,tags:[`Groups`],parameters:{path:e.object({id:e.string()})},response:{200:{"application/json":k},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getGroupContents:{path:`/v3/groups/{id}/contents`,method:`get`,tags:[`Groups`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_asc`,`created_at_desc`,`updated_at_asc`,`updated_at_desc`])),type:e.optional(e.picklist([`Text`,`Image`,`Link`,`Attachment`,`Embed`,`Channel`,`Block`]))})},response:{200:{"application/json":W},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},getGroupFollowers:{path:`/v3/groups/{id}/followers`,method:`get`,tags:[`Groups`],parameters:{path:e.object({id:e.string()}),query:e.object({page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100))),sort:e.optional(e.picklist([`created_at_desc`,`created_at_asc`]))})},response:{200:{"application/json":V},401:{"application/json":u},403:{"application/json":u},404:{"application/json":u},429:{"application/json":w}}},search:{path:`/v3/search`,method:`get`,tags:[`Search`],parameters:{query:e.object({query:e.optional(e.string()),type:e.optional(e.array(oe)),scope:e.optional(e.picklist([`all`,`my`,`following`])),user_id:e.optional(e.pipe(e.number(),e.integer())),group_id:e.optional(e.pipe(e.number(),e.integer())),channel_id:e.optional(e.pipe(e.number(),e.integer())),ext:e.optional(e.array(se)),sort:e.optional(e.picklist([`score_desc`,`created_at_desc`,`created_at_asc`,`updated_at_desc`,`updated_at_asc`,`name_asc`,`name_desc`,`connections_count_desc`,`random`])),after:e.optional(e.pipe(e.string(),e.isoDateTime())),seed:e.optional(e.pipe(e.number(),e.integer())),page:e.optional(e.pipe(e.number(),e.minValue(1))),per:e.optional(e.pipe(e.number(),e.minValue(1),e.maxValue(100)))})},response:{200:{"application/json":we},400:{"application/json":u},401:{"application/json":u},403:{"application/json":u},429:{"application/json":w}}}},Ee=e=>{let t=[],n=``;for(let r of e)r===r.toUpperCase()&&r!==r.toLowerCase()?(n&&t.push(n),n=r):n+=r;return n&&t.push(n),t},G=(e,t)=>{let n=t.toUpperCase();if(e.slice(0,t.length).toUpperCase()===n){let n=e.slice(t.length);return n.charAt(0).toLowerCase()+n.slice(1)}return e.charAt(0).toLowerCase()+e.slice(1)},K=e=>Ee(e).map(e=>e.toLowerCase()),De=(e,t,n)=>{let r=Ee(e),i=r.findIndex(e=>e.toLowerCase()===t);if(i===-1)return n;let a=r.slice(0,i),o=r.slice(i+1),s=a[0];if(s)return s.toLowerCase()+a.slice(1).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);let c=o[0];return c?c.toLowerCase()+o.slice(1).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``):n},Oe=e=>{let t=e.split(`/`),n=``;for(let e of t){if(e.startsWith(`{`)&&e.endsWith(`}`))return n+=(n?`/`:``)+e,n;n+=(n?`/`:``)+e}return n},ke=(e,t)=>Oe(e)===Oe(t),Ae=e=>Object.keys(e.parameters).length>0,je=e=>Object.keys(e.parameters).length,Me=(e,t)=>e.some(e=>t.includes(e)),Ne=(e,t)=>{let n=Object.keys(e.parameters),r=Object.keys(t.parameters);return n.some(e=>r.includes(e))},Pe=(e,t,n)=>{let r=e[t];if(!r)return[];let i=[];for(let[t,a]of Object.entries(e))Ae(a)&&K(G(t,a.method)).includes(n)&&Me(r.tags,a.tags)&&ke(r.path,a.path)&&i.push(a);return i},Fe=(e,t,n)=>{let r=e[t];if(!r)return!1;let i=Pe(e,t,n).filter(e=>e!==r);if(i.length===0)return!1;let a=je(r),o=i.filter(e=>je(e)>a);if(o.length===0)return!0;for(let e of o)if(!Ne(r,e))return!1;return!0},Ie=e=>{if(e.length===0)return[];let t=e[0];if(!t)return[];let n=new Set(Object.keys(t.parameters));for(let t=1;t<e.length;t++){let r=e[t];if(!r)continue;let i=new Set(Object.keys(r.parameters));n=new Set([...n].filter(e=>i.has(e)))}return Array.from(n)},Le=e=>{let t=Ie(e),n={};for(let r of t)for(let t of e){let e=t.parameters[r];if(e){n[r]=e;break}}return n},Re=(e,t,n)=>{let r={};for(let[n,i]of Object.entries(e.parameters))t.includes(n)||(r[n]=i);return{...e,id:n,parameters:r}},ze=e=>{let t={},n=new Set,r=new Set;for(let[t,n]of Object.entries(e)){let e=G(t,n.method);for(let t of K(e))r.add(t)}for(let i of r){let r=[];for(let[t,n]of Object.entries(e)){if(!Ae(n))continue;let a=G(t,n.method);K(a).includes(i)&&Fe(e,t,i)&&r.push({key:t,op:n,processedKey:a})}if(r.length>0){let e=Le(r.map(e=>e.op)),a=Object.keys(e),o={};for(let{key:e,op:t,processedKey:s}of r){let r=De(s,i,t.method);o[r]=Re(t,a,e),n.add(e)}t[i]={parameters:e,operations:o}}}for(let[r,i]of Object.entries(e)){if(n.has(r))continue;let e=G(r,i.method);t[e]={...i,id:r}}return t};var Be=l(s(((e,t)=>{let n=function(){};n.prototype=Object.create(null);let r=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,i=/\\([\v\u0020-\u00ff])/gu,a=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,o={type:``,parameters:new n};Object.freeze(o.parameters),Object.freeze(o);function s(e){if(typeof e!=`string`)throw TypeError(`argument header is required and must be a string`);let t=e.indexOf(`;`),o=t===-1?e.trim():e.slice(0,t).trim();if(a.test(o)===!1)throw TypeError(`invalid media type`);let s={type:o.toLowerCase(),parameters:new n};if(t===-1)return s;let c,l,u;for(r.lastIndex=t;l=r.exec(e);){if(l.index!==t)throw TypeError(`invalid parameter format`);t+=l[0].length,c=l[1].toLowerCase(),u=l[2],u[0]===`"`&&(u=u.slice(1,u.length-1),i.test(u)&&(u=u.replace(i,`$1`))),s.parameters[c]=u}if(t!==e.length)throw TypeError(`invalid parameter format`);return s}function c(e){if(typeof e!=`string`)return o;let t=e.indexOf(`;`),s=t===-1?e.trim():e.slice(0,t).trim();if(a.test(s)===!1)return o;let c={type:s.toLowerCase(),parameters:new n};if(t===-1)return c;let l,u,d;for(r.lastIndex=t;u=r.exec(e);){if(u.index!==t)return o;t+=u[0].length,l=u[1].toLowerCase(),d=u[2],d[0]===`"`&&(d=d.slice(1,d.length-1),i.test(d)&&(d=d.replace(i,`$1`))),c.parameters[l]=d}return t===e.length?c:o}t.exports.default={parse:s,safeParse:c},t.exports.parse=s,t.exports.safeParse=c,t.exports.defaultContentType=o}))(),1);const q=new WeakMap;let Ve=0;function J(e){let t=typeof e,n=e&&e.constructor,r=n===Date;if(Object(e)===e&&!r&&n!=RegExp){let t=q.get(e);if(t)return t;t=++Ve+`~`,q.set(e,t);let r;if(n===Array){for(t=`@`,r=0;r<e.length;r++)t+=J(e[r])+`,`;q.set(e,t)}else if(n===Object){t=`#`;let n=Object.keys(e).sort();for(;(r=n.pop())!==void 0;)e[r]!==void 0&&(t+=r+`:`+J(e[r])+`,`);q.set(e,t)}return t}return r?e.toJSON():t===`symbol`?e.toString():t===`string`?JSON.stringify(e):``+e}function Y(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(e){return/%[0-9A-Fa-f]/.test(e)||(e=encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`)),e}).join(``)}function X(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return`%`+e.charCodeAt(0).toString(16).toUpperCase()})}function Z(e,t,n){return t=e===`+`||e===`#`?Y(t):X(t),n?X(n)+`=`+t:t}function Q(e){return e!=null}function $(e){return e===`;`||e===`&`||e===`?`}function He(e,t,n,r){var i=e[n],a=[];if(Q(i)&&i!==``)if(typeof i==`string`||typeof i==`number`||typeof i==`boolean`)i=i.toString(),r&&r!==`*`&&(i=i.substring(0,parseInt(r,10))),a.push(Z(t,i,$(t)?n:null));else if(r===`*`)Array.isArray(i)?i.filter(Q).forEach(function(e){a.push(Z(t,e,$(t)?n:null))}):Object.keys(i).forEach(function(e){Q(i[e])&&a.push(Z(t,i[e],e))});else{var o=[];Array.isArray(i)?i.filter(Q).forEach(function(e){o.push(Z(t,e))}):Object.keys(i).forEach(function(e){Q(i[e])&&(o.push(X(e)),o.push(Z(t,i[e].toString())))}),$(t)?a.push(X(n)+`=`+o.join(`,`)):o.length!==0&&a.push(o.join(`,`))}else t===`;`?Q(i)&&a.push(X(n)):i===``&&(t===`&`||t===`?`)?a.push(X(n)+`=`):i===``&&a.push(``);return a}function Ue(e){var t=[`+`,`#`,`.`,`/`,`;`,`?`,`&`];return{expand:function(n){return e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(e,r,i){if(r){var a=null,o=[];if(t.indexOf(r.charAt(0))!==-1&&(a=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(e){var t=/([^:\*]*)(?::(\d+)|(\*))?/.exec(e);o.push.apply(o,He(n,a,t[1],t[2]||t[3]))}),a&&a!==`+`){var s=`,`;return a===`?`?s=`&`:a!==`#`&&(s=a),(o.length===0?``:a)+o.join(s)}else return o.join(`,`)}else return Y(i)})}}}const We=(e,t)=>(n,r={},i=e=>e)=>global.fetch(i(new URL(n.toString(),e)),Object.assign({},t,r,r?.headers&&t?.headers?{headers:Je(t?.headers??{},r?.headers??{})}:{})),Ge=(e,t)=>t===`application/json`||t.endsWith(`+json`)?e.json():t.startsWith(`text/`)||t===`application/xml`||t===`application/xhtml+xml`||t.endsWith(`+xml`)||t===`application/javascript`||t===`application/ecmascript`||t===`application/x-www-form-urlencoded`||t===`application/yaml`?e.text():t.startsWith(`image/`)||t.startsWith(`audio/`)||t.startsWith(`video/`)||t===`application/pdf`||t===`application/octet-stream`?e.blob():e.text(),Ke=(e=new Map)=>(t,n)=>{let r=J([t,n].filter(Boolean));if(e.has(r))return e.get(r);let i=typeof n==`object`&&n?Ue(t).expand(n):t;return e.set(r,i),i},qe=(t,n)=>{let r=Object.keys(t);return r.length===0?[]:r.map((r,i)=>{let a=t[r];if(a){let t=e.safeParse(a,n[i],{abortEarly:!0});if(t.success)return t.output;throw Error(e.summarize(t.issues))}else throw Error(`Parameter "${r}" in argument ${i} is missing a schema.`)})},Je=(...e)=>{function t(e){return typeof e==`object`&&!!e}let n={};for(let r of e){if(!t(r))throw TypeError(`All arguments must be of type object`);let e=new Headers(r);for(let[t,r]of e.entries())r===void 0||r===`undefined`?delete n[t]:n[t]=r}return new Headers(n)},Ye=(e,t,n=(e,t)=>{let n=t.headers.get(`content-type`);return Ge(t,typeof n==`string`?Be.default.safeParse(n).type:``)})=>Object.fromEntries(Object.entries(e).map(([e,r])=>[e,async(...e)=>n(r,await t(r,Object.fromEntries(Object.keys(r.parameters).map((t,n)=>[t,e[n]]))))])),Xe=({baseUrl:t=`https://api.are.na`,requestInit:n={},accessToken:r,operations:i=Te,ignoreValidation:a=!1,plain:o}={})=>{r&&(n.headers??={},n.headers=new Headers(n.headers),n.headers.set(`Authorization`,`Bearer ${r}`));let s=We(new URL(t),n),c=Ke(new Map),l=Ye(i,(e,t)=>{let n=c(e.path,typeof t.path==`object`?t.path:{}),r=Object.assign({},t.query??{},t.formData??{});return s(n,{method:e.method,body:`body`in t?JSON.stringify(t.body):void 0,headers:e.method===`post`||e.method===`put`?{"Content-Type":`application/json`}:void 0},r?e=>{if(typeof r==`object`)for(let t in r){let n=r[t];e.searchParams.set(t,typeof n==`string`?n:String(n))}return e}:void 0)},async(t,n)=>{let r=n.status.toString(),i=n.headers.get(`content-type`),o=typeof i==`string`?Be.default.safeParse(i).type:``,s=await Ge(n,o);return a?s:(async()=>{let n=t.response[r]??t.response.default;if(!n)throw Error(`No response schema defined for status ${r} in operation ${t.method.toUpperCase()} ${t.path}`);let i=n[o];if(!i)throw Error(`No response schema found for media "${o}" in operation ${t.method.toUpperCase()} ${t.path}`);return e.parseAsync(i,s,{abortEarly:!0}).catch(t=>e.isValiError(t)?e.summarize(t.issues):t)})()});if(o)return l;let u=ze(i);return Object.fromEntries(Object.entries(u).map(([e,t])=>[e,(...e)=>{let n=a?e:qe(t.parameters,e);return`operations`in t?Object.fromEntries(Object.entries(t.operations).map(([e,t])=>[e,(...e)=>l[t.id](...n.concat(a?e:qe(t.parameters,e)))])):l[t.id](...n)}]))},Ze=t=>e.is(u,t),Qe=t=>e.is(w,t),$e=t=>e.is(d,t),et=t=>e.is(f,t),tt=t=>e.is(p,t),nt=t=>e.is(ee,t),rt=t=>e.is(m,t),it=t=>e.is(h,t),at=t=>e.is(g,t),ot=t=>e.is(ae,t),st=t=>e.is(oe,t),ct=t=>e.is(se,t),lt=t=>e.is(ce,t),ut=t=>e.is(le,t),dt=t=>e.is(ue,t),ft=t=>e.is(de,t),pt=t=>e.is(_,t),mt=t=>e.is(fe,t),ht=t=>e.is(v,t),gt=t=>e.is(y,t),_t=t=>e.is(pe,t),vt=t=>e.is(me,t),yt=t=>e.is(he,t),bt=t=>e.is(b,t),xt=t=>e.is(x,t),St=t=>e.is(S,t),Ct=t=>e.is(C,t),wt=t=>e.is(ge,t),Tt=t=>e.is(T,t),Et=t=>e.is(E,t),Dt=t=>e.is(D,t),Ot=t=>e.is(O,t),kt=t=>e.is(k,t),At=t=>e.is(A,t),jt=t=>e.is(j,t),Mt=t=>e.is(M,t),Nt=t=>e.is(N,t),Pt=t=>e.is(_e,t),Ft=t=>e.is(ve,t),It=t=>e.is(ye,t),Lt=t=>e.is(P,t),Rt=t=>e.is(F,t),zt=t=>e.is(I,t),Bt=t=>e.is(L,t),Vt=t=>e.is(R,t),Ht=t=>e.is(z,t),Ut=t=>e.is(B,t),Wt=t=>e.is(Se,t),Gt=t=>e.is(Ce,t),Kt=t=>e.is(U,t),qt=t=>e.is(W,t),Jt=t=>e.is(we,t);export{Xe as createArena,Vt as isAttachmentBlock,Nt as isBaseBlockProperties,Kt as isBlock,pt as isBlockAbilities,_t as isBlockAttachment,gt as isBlockEmbed,Et as isBlockImage,mt as isBlockProvider,Tt as isBlockSource,Mt as isChannel,vt as isChannelAbilities,ut as isChannelContentSort,yt as isChannelCounts,It as isChannelList,wt as isChannelOwner,ft as isChannelVisibility,At as isComment,Ft as isCommentList,Wt as isConnectableList,qt as isConnectableListResponse,jt as isConnection,nt as isConnectionAbilities,lt as isConnectionSort,dt as isContentSort,ot as isContentTypeFilter,Ht as isEmbedBlock,Ct as isEmbeddedConnection,rt as isEmbeddedGroup,tt as isEmbeddedUser,Ze as isError,Gt as isEverythingList,Jt as isEverythingListResponse,ct as isFileExtension,Lt as isFollowableList,kt as isGroup,at as isGroupCounts,zt as isImageBlock,ht as isImageVersion,$e as isLink,Bt as isLinkBlock,St as isLinks,et as isMarkdownContent,Dt as isPaginatedResponse,bt as isPaginationMeta,Ut as isPendingBlock,xt as isPingResponse,Qe as isRateLimitError,st as isSearchTypeFilter,Rt as isTextBlock,Ot as isUser,it as isUserCounts,Pt as isUserList};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "an.era",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.4",
|
|
4
4
|
"description": "Interfacing for Are.na API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"are.na"
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"fast-content-type-parse": "^3.0.0",
|
|
40
|
-
"publint": "^0.3.17",
|
|
41
40
|
"stable-hash": "^0.0.6",
|
|
42
41
|
"url-template": "^3.1.1"
|
|
43
42
|
}
|