@mana-app/types 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +8 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +18 -0
- package/dist/sources/ContentSource/ContentSource.d.ts +48 -0
- package/dist/sources/ContentSource/ContentSource.js +2 -0
- package/dist/sources/ContentSource/handlers/ChapterEvent.d.ts +16 -0
- package/dist/sources/ContentSource/handlers/ChapterEvent.js +2 -0
- package/dist/sources/ContentSource/handlers/ContentEvent.d.ts +12 -0
- package/dist/sources/ContentSource/handlers/ContentEvent.js +2 -0
- package/dist/sources/ContentSource/handlers/ContextMenuHandler.d.ts +9 -0
- package/dist/sources/ContentSource/handlers/ContextMenuHandler.js +2 -0
- package/dist/sources/ContentSource/handlers/GroupedUpdateProvider.d.ts +9 -0
- package/dist/sources/ContentSource/handlers/GroupedUpdateProvider.js +2 -0
- package/dist/sources/ContentSource/handlers/ImageRedrawHandler.d.ts +27 -0
- package/dist/sources/ContentSource/handlers/ImageRedrawHandler.js +2 -0
- package/dist/sources/ContentSource/handlers/LibrarySync.d.ts +8 -0
- package/dist/sources/ContentSource/handlers/LibrarySync.js +2 -0
- package/dist/sources/ContentSource/handlers/ProgressSync.d.ts +4 -0
- package/dist/sources/ContentSource/handlers/ProgressSync.js +2 -0
- package/dist/sources/ContentSource/handlers/index.d.ts +7 -0
- package/dist/sources/ContentSource/handlers/index.js +23 -0
- package/dist/sources/ContentSource/index.d.ts +2 -0
- package/dist/sources/ContentSource/index.js +18 -0
- package/dist/sources/ContentTracker/AdvancedTracker.d.ts +9 -0
- package/dist/sources/ContentTracker/AdvancedTracker.js +2 -0
- package/dist/sources/ContentTracker/ContentTracker.d.ts +50 -0
- package/dist/sources/ContentTracker/ContentTracker.js +2 -0
- package/dist/sources/ContentTracker/index.d.ts +2 -0
- package/dist/sources/ContentTracker/index.js +18 -0
- package/dist/sources/Source/extensions/Authentication.d.ts +35 -0
- package/dist/sources/Source/extensions/Authentication.js +8 -0
- package/dist/sources/Source/extensions/DirectoryHandler.d.ts +14 -0
- package/dist/sources/Source/extensions/DirectoryHandler.js +2 -0
- package/dist/sources/Source/extensions/ImageRequest.d.ts +8 -0
- package/dist/sources/Source/extensions/ImageRequest.js +2 -0
- package/dist/sources/Source/extensions/PageProvider.d.ts +7 -0
- package/dist/sources/Source/extensions/PageProvider.js +2 -0
- package/dist/sources/Source/extensions/PageResolver.d.ts +17 -0
- package/dist/sources/Source/extensions/PageResolver.js +2 -0
- package/dist/sources/Source/extensions/Preferences.d.ts +4 -0
- package/dist/sources/Source/extensions/Preferences.js +2 -0
- package/dist/sources/Source/extensions/Setup.d.ts +6 -0
- package/dist/sources/Source/extensions/Setup.js +2 -0
- package/dist/sources/Source/extensions/index.d.ts +7 -0
- package/dist/sources/Source/extensions/index.js +23 -0
- package/dist/sources/Source/index.d.ts +11 -0
- package/dist/sources/Source/index.js +23 -0
- package/dist/sources/index.d.ts +3 -0
- package/dist/sources/index.js +19 -0
- package/dist/types/UI/Form.d.ts +5 -0
- package/dist/types/UI/Form.js +2 -0
- package/dist/types/UI/UIDefinitions.d.ts +29 -0
- package/dist/types/UI/UIDefinitions.js +3 -0
- package/dist/types/UI/UIElementBuilders.d.ts +9 -0
- package/dist/types/UI/UIElementBuilders.js +18 -0
- package/dist/types/UI/UIElements.d.ts +31 -0
- package/dist/types/UI/UIElements.js +13 -0
- package/dist/types/UI/index.d.ts +4 -0
- package/dist/types/UI/index.js +20 -0
- package/dist/types/content/BaseItem.d.ts +26 -0
- package/dist/types/content/BaseItem.js +2 -0
- package/dist/types/content/BooleanState.d.ts +3 -0
- package/dist/types/content/BooleanState.js +2 -0
- package/dist/types/content/Chapter.d.ts +62 -0
- package/dist/types/content/Chapter.js +14 -0
- package/dist/types/content/ChapterData.d.ts +16 -0
- package/dist/types/content/ChapterData.js +2 -0
- package/dist/types/content/Collection.d.ts +24 -0
- package/dist/types/content/Collection.js +2 -0
- package/dist/types/content/Content.d.ts +59 -0
- package/dist/types/content/Content.js +2 -0
- package/dist/types/content/ContentProgressState.d.ts +13 -0
- package/dist/types/content/ContentProgressState.js +2 -0
- package/dist/types/content/ContextMenu.d.ts +14 -0
- package/dist/types/content/ContextMenu.js +2 -0
- package/dist/types/content/DeepLinkContext.d.ts +8 -0
- package/dist/types/content/DeepLinkContext.js +2 -0
- package/dist/types/content/Enums.d.ts +22 -0
- package/dist/types/content/Enums.js +29 -0
- package/dist/types/content/GroupedUpdatesResponse.d.ts +7 -0
- package/dist/types/content/GroupedUpdatesResponse.js +2 -0
- package/dist/types/content/Highlight.d.ts +36 -0
- package/dist/types/content/Highlight.js +2 -0
- package/dist/types/content/Property.d.ts +27 -0
- package/dist/types/content/Property.js +2 -0
- package/dist/types/content/Provider.d.ts +32 -0
- package/dist/types/content/Provider.js +10 -0
- package/dist/types/content/ReaderContext.d.ts +28 -0
- package/dist/types/content/ReaderContext.js +2 -0
- package/dist/types/content/index.d.ts +14 -0
- package/dist/types/content/index.js +30 -0
- package/dist/types/core/Authentication.d.ts +48 -0
- package/dist/types/core/Authentication.js +10 -0
- package/dist/types/core/ContextProvider.d.ts +6 -0
- package/dist/types/core/ContextProvider.js +2 -0
- package/dist/types/core/PagedResult.d.ts +17 -0
- package/dist/types/core/PagedResult.js +2 -0
- package/dist/types/core/SourceInfo.d.ts +81 -0
- package/dist/types/core/SourceInfo.js +21 -0
- package/dist/types/core/index.d.ts +8 -0
- package/dist/types/core/index.js +20 -0
- package/dist/types/directory/DirectoryConfig.d.ts +31 -0
- package/dist/types/directory/DirectoryConfig.js +2 -0
- package/dist/types/directory/DirectoryFilter.d.ts +53 -0
- package/dist/types/directory/DirectoryFilter.js +30 -0
- package/dist/types/directory/DirectoryRequest.d.ts +37 -0
- package/dist/types/directory/DirectoryRequest.js +2 -0
- package/dist/types/directory/index.d.ts +3 -0
- package/dist/types/directory/index.js +19 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.js +26 -0
- package/dist/types/networking/Builder.d.ts +88 -0
- package/dist/types/networking/Builder.js +120 -0
- package/dist/types/networking/Client.d.ts +35 -0
- package/dist/types/networking/Client.js +2 -0
- package/dist/types/networking/Error.d.ts +13 -0
- package/dist/types/networking/Error.js +2 -0
- package/dist/types/networking/Request.d.ts +62 -0
- package/dist/types/networking/Request.js +16 -0
- package/dist/types/networking/Response.d.ts +7 -0
- package/dist/types/networking/Response.js +2 -0
- package/dist/types/networking/Transformer.d.ts +5 -0
- package/dist/types/networking/Transformer.js +2 -0
- package/dist/types/networking/index.d.ts +6 -0
- package/dist/types/networking/index.js +22 -0
- package/dist/types/page/index.d.ts +58 -0
- package/dist/types/page/index.js +14 -0
- package/dist/types/tracker/index.d.ts +43 -0
- package/dist/types/tracker/index.js +12 -0
- package/package.json +35 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderLinkType = void 0;
|
|
4
|
+
var ProviderLinkType;
|
|
5
|
+
(function (ProviderLinkType) {
|
|
6
|
+
ProviderLinkType[ProviderLinkType["WEBSITE"] = 0] = "WEBSITE";
|
|
7
|
+
ProviderLinkType[ProviderLinkType["TWITTER"] = 1] = "TWITTER";
|
|
8
|
+
ProviderLinkType[ProviderLinkType["DISCORD"] = 2] = "DISCORD";
|
|
9
|
+
ProviderLinkType[ProviderLinkType["PATREON"] = 3] = "PATREON";
|
|
10
|
+
})(ProviderLinkType || (exports.ProviderLinkType = ProviderLinkType = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Chapter } from "./Chapter";
|
|
2
|
+
import { ReadingMode } from "./Enums";
|
|
3
|
+
import { Highlight } from "./Highlight";
|
|
4
|
+
/**
|
|
5
|
+
* This is the context provided to the reader to treat a highlight as a comic
|
|
6
|
+
*/
|
|
7
|
+
export type ReaderContext = {
|
|
8
|
+
/**
|
|
9
|
+
* The content being read, NOTE that this must be provided and the contentID should match the contentID of the content being read not the chapter
|
|
10
|
+
*/
|
|
11
|
+
content: Highlight;
|
|
12
|
+
/**
|
|
13
|
+
* This is the Chapter ID of the chapter to be opened
|
|
14
|
+
*/
|
|
15
|
+
target: string;
|
|
16
|
+
/**
|
|
17
|
+
* The List of chapters available for this "Content"
|
|
18
|
+
*/
|
|
19
|
+
chapters: Chapter[];
|
|
20
|
+
/**
|
|
21
|
+
* The page to open. The first page will return 1, second returns 2, etc
|
|
22
|
+
*/
|
|
23
|
+
requestedPage?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The Reading mode to open the reader to
|
|
26
|
+
*/
|
|
27
|
+
readingMode?: ReadingMode;
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./Content";
|
|
2
|
+
export * from "./Highlight";
|
|
3
|
+
export * from "./Chapter";
|
|
4
|
+
export * from "./ChapterData";
|
|
5
|
+
export * from "./Property";
|
|
6
|
+
export * from "./Collection";
|
|
7
|
+
export * from "./Provider";
|
|
8
|
+
export * from "./Enums";
|
|
9
|
+
export * from "./ReaderContext";
|
|
10
|
+
export * from "./ContextMenu";
|
|
11
|
+
export * from "./DeepLinkContext";
|
|
12
|
+
export * from "./BooleanState";
|
|
13
|
+
export * from "./ContentProgressState";
|
|
14
|
+
export * from "./GroupedUpdatesResponse";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Content"), exports);
|
|
18
|
+
__exportStar(require("./Highlight"), exports);
|
|
19
|
+
__exportStar(require("./Chapter"), exports);
|
|
20
|
+
__exportStar(require("./ChapterData"), exports);
|
|
21
|
+
__exportStar(require("./Property"), exports);
|
|
22
|
+
__exportStar(require("./Collection"), exports);
|
|
23
|
+
__exportStar(require("./Provider"), exports);
|
|
24
|
+
__exportStar(require("./Enums"), exports);
|
|
25
|
+
__exportStar(require("./ReaderContext"), exports);
|
|
26
|
+
__exportStar(require("./ContextMenu"), exports);
|
|
27
|
+
__exportStar(require("./DeepLinkContext"), exports);
|
|
28
|
+
__exportStar(require("./BooleanState"), exports);
|
|
29
|
+
__exportStar(require("./ContentProgressState"), exports);
|
|
30
|
+
__exportStar(require("./GroupedUpdatesResponse"), exports);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare enum AuthMethod {
|
|
2
|
+
USERNAME_PW = 0,
|
|
3
|
+
EMAIL_PW = 1,
|
|
4
|
+
WEB = 2,
|
|
5
|
+
OAUTH = 3
|
|
6
|
+
}
|
|
7
|
+
export type User = {
|
|
8
|
+
/**
|
|
9
|
+
* The users handle
|
|
10
|
+
*/
|
|
11
|
+
handle: string;
|
|
12
|
+
/**
|
|
13
|
+
* The Users's Display Name
|
|
14
|
+
*/
|
|
15
|
+
displayName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The users Avatar / Profile Picture
|
|
18
|
+
*/
|
|
19
|
+
avatar?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The banner image of the profile
|
|
22
|
+
*/
|
|
23
|
+
bannerImage?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Additional Information about the user to be displayed
|
|
26
|
+
*/
|
|
27
|
+
info?: string[];
|
|
28
|
+
};
|
|
29
|
+
export type UpSyncedContent = {
|
|
30
|
+
/**
|
|
31
|
+
* The ID of the Title to be synced
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
};
|
|
35
|
+
export type DownSyncedContent = {
|
|
36
|
+
/**
|
|
37
|
+
* The ID of the content
|
|
38
|
+
*/
|
|
39
|
+
id: string;
|
|
40
|
+
/**
|
|
41
|
+
* The Title of the content
|
|
42
|
+
*/
|
|
43
|
+
title: string;
|
|
44
|
+
/**
|
|
45
|
+
* The Cover/Thumbnail URL of the Title Synced
|
|
46
|
+
*/
|
|
47
|
+
cover: string;
|
|
48
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthMethod = void 0;
|
|
4
|
+
var AuthMethod;
|
|
5
|
+
(function (AuthMethod) {
|
|
6
|
+
AuthMethod[AuthMethod["USERNAME_PW"] = 0] = "USERNAME_PW";
|
|
7
|
+
AuthMethod[AuthMethod["EMAIL_PW"] = 1] = "EMAIL_PW";
|
|
8
|
+
AuthMethod[AuthMethod["WEB"] = 2] = "WEB";
|
|
9
|
+
AuthMethod[AuthMethod["OAUTH"] = 3] = "OAUTH";
|
|
10
|
+
})(AuthMethod || (exports.AuthMethod = AuthMethod = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Highlight } from "../content";
|
|
2
|
+
export type PagedResult = {
|
|
3
|
+
/**
|
|
4
|
+
* The results on this page
|
|
5
|
+
*/
|
|
6
|
+
results: Highlight[];
|
|
7
|
+
/**
|
|
8
|
+
* Boolean Indicating whether this is the last available page.
|
|
9
|
+
*
|
|
10
|
+
* If this value is true or the results count is 0, Suwatte will stop making subsequent pagination requests
|
|
11
|
+
*/
|
|
12
|
+
isLastPage: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The Total Results Count
|
|
15
|
+
*/
|
|
16
|
+
totalResultCount?: number;
|
|
17
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare enum CatalogRating {
|
|
2
|
+
/**
|
|
3
|
+
* Catalog does not contain ANY SUGGESTIVE OR NSFW content
|
|
4
|
+
*/
|
|
5
|
+
SAFE = 0,
|
|
6
|
+
/**
|
|
7
|
+
* Catalog may contain SUGGESTIVE OR NSFW content,
|
|
8
|
+
* Sources must hide NSFW content by default,
|
|
9
|
+
* users will be required to verify they are of age to view NSFW content
|
|
10
|
+
*/
|
|
11
|
+
MIXED = 1,
|
|
12
|
+
/**
|
|
13
|
+
* Catalog contains MAINLY SUGGESTIVE OR NSFW content,
|
|
14
|
+
* users will be required to verify they are of age to view NSFW content
|
|
15
|
+
*/
|
|
16
|
+
NSFW = 2
|
|
17
|
+
}
|
|
18
|
+
export interface SourceDeveloper {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly website?: string;
|
|
21
|
+
readonly github?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SourceBadge {
|
|
24
|
+
readonly label: string;
|
|
25
|
+
readonly textColor: string;
|
|
26
|
+
readonly backgroundColor: string;
|
|
27
|
+
}
|
|
28
|
+
export type SourceInfo = {
|
|
29
|
+
/**
|
|
30
|
+
* The ID of this Source. It should be unique.
|
|
31
|
+
*
|
|
32
|
+
* Sources with the same ID will be treated as the same.
|
|
33
|
+
*/
|
|
34
|
+
readonly id: string;
|
|
35
|
+
/**
|
|
36
|
+
* The Name of this Source, Typically the name of the Source
|
|
37
|
+
*/
|
|
38
|
+
readonly name: string;
|
|
39
|
+
/**
|
|
40
|
+
* The Description of this Source
|
|
41
|
+
*/
|
|
42
|
+
readonly description?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The Developers of this Source
|
|
45
|
+
*/
|
|
46
|
+
readonly developers: SourceDeveloper[];
|
|
47
|
+
/**
|
|
48
|
+
* The Semantic Version of the Source
|
|
49
|
+
*/
|
|
50
|
+
readonly version: string;
|
|
51
|
+
/**
|
|
52
|
+
* The general content rating of titles on this Source
|
|
53
|
+
*/
|
|
54
|
+
readonly rating?: CatalogRating;
|
|
55
|
+
/**
|
|
56
|
+
* This Minimum App Version This Source Supports.
|
|
57
|
+
*/
|
|
58
|
+
readonly minSupportedAppVersion?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The filename of the sources cover image within the assets folder.
|
|
61
|
+
*
|
|
62
|
+
* You may also use urls pointing to an image here.
|
|
63
|
+
*
|
|
64
|
+
* Example with source named JollyComics
|
|
65
|
+
* * With jc.png file within the assets folder will have `thumbnail` set to `jc.png`
|
|
66
|
+
* * Alternatively if JollyComics has an icon image at `https://jollycomics.com/thumbnail.png`, you can set `thumbnail` to the specified URL.
|
|
67
|
+
*/
|
|
68
|
+
readonly thumbnail?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The Websites URL
|
|
71
|
+
*/
|
|
72
|
+
readonly website?: string;
|
|
73
|
+
/**
|
|
74
|
+
* List of languages codes this source has chapters in ISO-631 Format
|
|
75
|
+
*/
|
|
76
|
+
readonly supportedLanguages?: string[];
|
|
77
|
+
/**
|
|
78
|
+
* List of badges this source has
|
|
79
|
+
*/
|
|
80
|
+
readonly badges?: SourceBadge[];
|
|
81
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CatalogRating = void 0;
|
|
4
|
+
var CatalogRating;
|
|
5
|
+
(function (CatalogRating) {
|
|
6
|
+
/**
|
|
7
|
+
* Catalog does not contain ANY SUGGESTIVE OR NSFW content
|
|
8
|
+
*/
|
|
9
|
+
CatalogRating[CatalogRating["SAFE"] = 0] = "SAFE";
|
|
10
|
+
/**
|
|
11
|
+
* Catalog may contain SUGGESTIVE OR NSFW content,
|
|
12
|
+
* Sources must hide NSFW content by default,
|
|
13
|
+
* users will be required to verify they are of age to view NSFW content
|
|
14
|
+
*/
|
|
15
|
+
CatalogRating[CatalogRating["MIXED"] = 1] = "MIXED";
|
|
16
|
+
/**
|
|
17
|
+
* Catalog contains MAINLY SUGGESTIVE OR NSFW content,
|
|
18
|
+
* users will be required to verify they are of age to view NSFW content
|
|
19
|
+
*/
|
|
20
|
+
CatalogRating[CatalogRating["NSFW"] = 2] = "NSFW";
|
|
21
|
+
})(CatalogRating || (exports.CatalogRating = CatalogRating = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Authentication"), exports);
|
|
18
|
+
__exportStar(require("./SourceInfo"), exports);
|
|
19
|
+
__exportStar(require("./PagedResult"), exports);
|
|
20
|
+
__exportStar(require("./ContextProvider"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Option } from "../core";
|
|
2
|
+
import { DirectoryFilter } from "./DirectoryFilter";
|
|
3
|
+
import { SortSelection } from "./DirectoryRequest";
|
|
4
|
+
export type DirectoryConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* Filters available
|
|
7
|
+
*/
|
|
8
|
+
filters?: DirectoryFilter[];
|
|
9
|
+
/**
|
|
10
|
+
* Sort Options
|
|
11
|
+
*/
|
|
12
|
+
sort?: {
|
|
13
|
+
/**
|
|
14
|
+
* Options Available
|
|
15
|
+
*/
|
|
16
|
+
options: Option[];
|
|
17
|
+
default?: SortSelection;
|
|
18
|
+
/**
|
|
19
|
+
* Indicates whether the sort order can be configured as ascending or descending
|
|
20
|
+
*/
|
|
21
|
+
canChangeOrder?: boolean;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Lists are similar to pages but are predefined.
|
|
25
|
+
*/
|
|
26
|
+
lists?: Option[];
|
|
27
|
+
/**
|
|
28
|
+
* If set to true, suwatte will display the search bar. Defaults to true
|
|
29
|
+
*/
|
|
30
|
+
searchable?: boolean;
|
|
31
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Option } from "../core";
|
|
2
|
+
export declare enum FilterType {
|
|
3
|
+
/**
|
|
4
|
+
* This Represents the filter as a toggle switch, the value returned in the directory request will be a `boolean`
|
|
5
|
+
*/
|
|
6
|
+
TOGGLE = 0,
|
|
7
|
+
/**
|
|
8
|
+
* This represents the filter as a picker, the value returned will be the `key` of the selected option as a `string`
|
|
9
|
+
*/
|
|
10
|
+
SELECT = 1,
|
|
11
|
+
/**
|
|
12
|
+
* This Represents the filter as a multi-picker, the value returned will the the keys of the selected options as an array of strings
|
|
13
|
+
*/
|
|
14
|
+
MULTISELECT = 2,
|
|
15
|
+
/**
|
|
16
|
+
* This Represents the filter as a multi-picker,the value returned will be of type {@link ExcludableMultiSelectProp}
|
|
17
|
+
*/
|
|
18
|
+
EXCLUDABLE_MULTISELECT = 3,
|
|
19
|
+
/**
|
|
20
|
+
* This will represent the filter as a textfield, the value returned will be a string
|
|
21
|
+
*/
|
|
22
|
+
TEXT = 4,
|
|
23
|
+
/**
|
|
24
|
+
* This is a basic filter that will only display the title or subtitle, it will not return any value in the populated `DirectoryRequest`
|
|
25
|
+
*/
|
|
26
|
+
INFO = 5
|
|
27
|
+
}
|
|
28
|
+
export type DirectoryFilter = {
|
|
29
|
+
/**
|
|
30
|
+
* The ID of the filter
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* The Title of the Filter
|
|
35
|
+
*/
|
|
36
|
+
title: string;
|
|
37
|
+
/**
|
|
38
|
+
* The subtitle of the filter
|
|
39
|
+
*/
|
|
40
|
+
subtitle?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The Filter Type
|
|
43
|
+
*/
|
|
44
|
+
type: FilterType;
|
|
45
|
+
/**
|
|
46
|
+
* The Filter's Options if the filter type is SELECT,MULTISELECT,EXCLUDABLE_SELECT
|
|
47
|
+
*/
|
|
48
|
+
options?: Option[];
|
|
49
|
+
};
|
|
50
|
+
export type ExcludableMultiSelectProp = {
|
|
51
|
+
included: string[];
|
|
52
|
+
excluded: string[];
|
|
53
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterType = void 0;
|
|
4
|
+
var FilterType;
|
|
5
|
+
(function (FilterType) {
|
|
6
|
+
/**
|
|
7
|
+
* This Represents the filter as a toggle switch, the value returned in the directory request will be a `boolean`
|
|
8
|
+
*/
|
|
9
|
+
FilterType[FilterType["TOGGLE"] = 0] = "TOGGLE";
|
|
10
|
+
/**
|
|
11
|
+
* This represents the filter as a picker, the value returned will be the `key` of the selected option as a `string`
|
|
12
|
+
*/
|
|
13
|
+
FilterType[FilterType["SELECT"] = 1] = "SELECT";
|
|
14
|
+
/**
|
|
15
|
+
* This Represents the filter as a multi-picker, the value returned will the the keys of the selected options as an array of strings
|
|
16
|
+
*/
|
|
17
|
+
FilterType[FilterType["MULTISELECT"] = 2] = "MULTISELECT";
|
|
18
|
+
/**
|
|
19
|
+
* This Represents the filter as a multi-picker,the value returned will be of type {@link ExcludableMultiSelectProp}
|
|
20
|
+
*/
|
|
21
|
+
FilterType[FilterType["EXCLUDABLE_MULTISELECT"] = 3] = "EXCLUDABLE_MULTISELECT";
|
|
22
|
+
/**
|
|
23
|
+
* This will represent the filter as a textfield, the value returned will be a string
|
|
24
|
+
*/
|
|
25
|
+
FilterType[FilterType["TEXT"] = 4] = "TEXT";
|
|
26
|
+
/**
|
|
27
|
+
* This is a basic filter that will only display the title or subtitle, it will not return any value in the populated `DirectoryRequest`
|
|
28
|
+
*/
|
|
29
|
+
FilterType[FilterType["INFO"] = 5] = "INFO";
|
|
30
|
+
})(FilterType || (exports.FilterType = FilterType = {}));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ContextProvider } from "../core";
|
|
2
|
+
import { ExcludableMultiSelectProp } from "./DirectoryFilter";
|
|
3
|
+
export type FilterPrimitives = string | string[] | boolean | number | ExcludableMultiSelectProp;
|
|
4
|
+
export type DirectoryRequest<T extends Record<string, FilterPrimitives> = any> = ContextProvider & {
|
|
5
|
+
/**
|
|
6
|
+
* The Keywords the User would like to search
|
|
7
|
+
*/
|
|
8
|
+
query?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The Page Number of the current search
|
|
11
|
+
*/
|
|
12
|
+
page: number;
|
|
13
|
+
listId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The User Selected Sort ID
|
|
16
|
+
*/
|
|
17
|
+
sort?: SortSelection;
|
|
18
|
+
/**
|
|
19
|
+
* The populated filters with their mapped corresponding type
|
|
20
|
+
*/
|
|
21
|
+
filters?: T;
|
|
22
|
+
/**
|
|
23
|
+
* When a user wants to view the entries in a single tag, this property will be populated with the tags identifier
|
|
24
|
+
*/
|
|
25
|
+
tag?: {
|
|
26
|
+
tagId: string;
|
|
27
|
+
propertyId: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Define the Configuration Suwatte should pass
|
|
31
|
+
*/
|
|
32
|
+
configID?: string;
|
|
33
|
+
};
|
|
34
|
+
export type SortSelection = {
|
|
35
|
+
id: string;
|
|
36
|
+
ascending?: boolean;
|
|
37
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DirectoryConfig"), exports);
|
|
18
|
+
__exportStar(require("./DirectoryRequest"), exports);
|
|
19
|
+
__exportStar(require("./DirectoryFilter"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./core";
|
|
2
|
+
export * from "./content";
|
|
3
|
+
export * from "./networking";
|
|
4
|
+
export * from "./UI";
|
|
5
|
+
export * from "./tracker";
|
|
6
|
+
export * from "./directory";
|
|
7
|
+
export * from "./page";
|
|
8
|
+
export type Only<T, U> = {
|
|
9
|
+
[P in keyof T]: T[P];
|
|
10
|
+
} & {
|
|
11
|
+
[P in keyof U]?: never;
|
|
12
|
+
};
|
|
13
|
+
export type Either<T, U> = Only<T, U> | Only<U, T>;
|
|
14
|
+
export declare const Generate: <T>(v: T) => T;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Generate = void 0;
|
|
18
|
+
__exportStar(require("./core"), exports);
|
|
19
|
+
__exportStar(require("./content"), exports);
|
|
20
|
+
__exportStar(require("./networking"), exports);
|
|
21
|
+
__exportStar(require("./UI"), exports);
|
|
22
|
+
__exportStar(require("./tracker"), exports);
|
|
23
|
+
__exportStar(require("./directory"), exports);
|
|
24
|
+
__exportStar(require("./page"), exports);
|
|
25
|
+
const Generate = (v) => v;
|
|
26
|
+
exports.Generate = Generate;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Cookie } from "./Request";
|
|
2
|
+
import { NetworkRequestTransformer, NetworkResponseTransformer } from "./Transformer";
|
|
3
|
+
/**
|
|
4
|
+
* NetworkClientBuilder is a builder class used for creating and configuring instances of NetworkClient.
|
|
5
|
+
* The builder allows you to configure various aspects of the NetworkClient, such as rate limits,
|
|
6
|
+
* request/response transformers (interceptors), headers, cookies, timeout, status validator, and more.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NetworkClientBuilder {
|
|
9
|
+
private requestTransformers;
|
|
10
|
+
private responseTransformers;
|
|
11
|
+
private headers;
|
|
12
|
+
private cookies;
|
|
13
|
+
private timeout?;
|
|
14
|
+
private requestsPerSecond?;
|
|
15
|
+
private statusValidator?;
|
|
16
|
+
private maxRetries?;
|
|
17
|
+
/**
|
|
18
|
+
* Sets the rate limit for the NetworkClient.
|
|
19
|
+
*
|
|
20
|
+
* @param requests - The maximum number of requests to make per interval.
|
|
21
|
+
* @param interval - The length of the rate limiting interval in seconds.
|
|
22
|
+
* @returns The builder, to allow for method chaining.
|
|
23
|
+
*/
|
|
24
|
+
setRateLimit(requests: number, interval: number): NetworkClientBuilder;
|
|
25
|
+
/**
|
|
26
|
+
* Adds a request interceptor to the NetworkClient.
|
|
27
|
+
*
|
|
28
|
+
* @param transformer - The interceptor to add. This should be a function that takes a request and modifies it in some way.
|
|
29
|
+
* @returns The builder, to allow for method chaining.
|
|
30
|
+
*/
|
|
31
|
+
addRequestInterceptor(transformer: NetworkRequestTransformer): NetworkClientBuilder;
|
|
32
|
+
/**
|
|
33
|
+
* Adds a response interceptor to the NetworkClient.
|
|
34
|
+
*
|
|
35
|
+
* @param transformer - The interceptor to add. This should be a function that takes a response and modifies it in some way.
|
|
36
|
+
* @returns The builder, to allow for method chaining.
|
|
37
|
+
*/
|
|
38
|
+
addResponseInterceptor(transformer: NetworkResponseTransformer): NetworkClientBuilder;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the authorization token for the NetworkClient.
|
|
41
|
+
*
|
|
42
|
+
* @param token - The token to be included in the Authorization header of every request.
|
|
43
|
+
* @returns The builder, to allow for method chaining.
|
|
44
|
+
*/
|
|
45
|
+
setAuthorizationToken(token: string): NetworkClientBuilder;
|
|
46
|
+
/**
|
|
47
|
+
* Sets the status validator for the NetworkClient.
|
|
48
|
+
*
|
|
49
|
+
* @param validator - A function that takes a status code and returns true if it is considered successful.
|
|
50
|
+
* @returns The builder, to allow for method chaining.
|
|
51
|
+
*/
|
|
52
|
+
setStatusValidator(validator: (s: number) => boolean): NetworkClientBuilder;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the timeout for requests made by the NetworkClient.
|
|
55
|
+
*
|
|
56
|
+
* @param timeout - The maximum time to wait for a request to complete, in milliseconds.
|
|
57
|
+
* @returns The builder, to allow for method chaining.
|
|
58
|
+
*/
|
|
59
|
+
setTimeout(timeout: number): NetworkClientBuilder;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the maximum number of retries for this request by the NetworkClient.
|
|
62
|
+
*
|
|
63
|
+
* @param retries - The maximum number of retries for this request
|
|
64
|
+
* @returns The builder, to allow for method chaining.
|
|
65
|
+
*/
|
|
66
|
+
setMaxRetries(retries: number): NetworkClientBuilder;
|
|
67
|
+
/**
|
|
68
|
+
* Sets a header for the NetworkClient.
|
|
69
|
+
*
|
|
70
|
+
* @param key - The name of the header
|
|
71
|
+
* @param value - The value of the header
|
|
72
|
+
* @returns The builder, to allow for method chaining.
|
|
73
|
+
*/
|
|
74
|
+
addHeader(key: string, value: string): NetworkClientBuilder;
|
|
75
|
+
/**
|
|
76
|
+
* Sets a cookie for the NetworkClient.
|
|
77
|
+
*
|
|
78
|
+
* @param cookie - The cookie to be included in every request.
|
|
79
|
+
* @returns The builder, to allow for method chaining.
|
|
80
|
+
*/
|
|
81
|
+
addCookie(cookie: Cookie): NetworkClientBuilder;
|
|
82
|
+
/**
|
|
83
|
+
* Builds a NetworkClient using the parameters set on the builder.
|
|
84
|
+
*
|
|
85
|
+
* @returns A NetworkClient with the configured parameters.
|
|
86
|
+
*/
|
|
87
|
+
build(): NetworkClient;
|
|
88
|
+
}
|