@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2022] [Shedrach Uzoukwu]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export * from "./sources";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Methods that exist on the StoreHandler Class
|
|
5
|
+
*/
|
|
6
|
+
declare class ManaStore {
|
|
7
|
+
/**
|
|
8
|
+
* retrieves a value from the store
|
|
9
|
+
* @param k The key of the KV Pair
|
|
10
|
+
*/
|
|
11
|
+
get(k: string): Promise<unknown | null>;
|
|
12
|
+
/**
|
|
13
|
+
* sets a value to the store
|
|
14
|
+
* @param k The Key of the Pair
|
|
15
|
+
* @param v The Value of the pair
|
|
16
|
+
*/
|
|
17
|
+
set(k: string, v: any): Promise<void>;
|
|
18
|
+
remove(k: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* @param k The key of the KV Pair
|
|
21
|
+
* @returns null if the value is not stored but will throw an error if the corresponding value is not a string
|
|
22
|
+
*/
|
|
23
|
+
string(k: string): Promise<string | null>;
|
|
24
|
+
/**
|
|
25
|
+
* @param k The key of the KV Pair
|
|
26
|
+
* @returns null if the value is not stored but will throw an error if the corresponding value is not a boolean
|
|
27
|
+
*/
|
|
28
|
+
boolean(k: string): Promise<boolean | null>;
|
|
29
|
+
/**
|
|
30
|
+
* @param k The key of the KV Pair
|
|
31
|
+
* @returns null if the value is not stored but will throw an error if the corresponding value is not a number
|
|
32
|
+
*/
|
|
33
|
+
number(k: string): Promise<number | null>;
|
|
34
|
+
/**
|
|
35
|
+
* @param k The key of the KV Pair
|
|
36
|
+
* @returns null if the value is not stored but will throw an error if the corresponding value is not an array in which each element is a string
|
|
37
|
+
*/
|
|
38
|
+
stringArray(k: string): Promise<string[] | null>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Globally Available Stores.
|
|
42
|
+
* Multiple Instances can be created for either class as they all post to the same message handler BTS
|
|
43
|
+
*/
|
|
44
|
+
declare global {
|
|
45
|
+
/**
|
|
46
|
+
* Stores Key-Value pairs as a JSON String in the iOS KeyChain
|
|
47
|
+
*/
|
|
48
|
+
const SecureStore: ManaStore;
|
|
49
|
+
/**
|
|
50
|
+
* Stores Key-Value pairs as a JSON String in the local database
|
|
51
|
+
*/
|
|
52
|
+
const ObjectStore: ManaStore;
|
|
53
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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("./sources"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Content, Chapter, ChapterData, SourceInfo, Property } from "../../types";
|
|
2
|
+
import { DirectoryHandler, ManaSource } from "../Source";
|
|
3
|
+
export type SourceConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* When `true`, Mana will disable being able to view more titles of a provided tags
|
|
6
|
+
*/
|
|
7
|
+
readonly disableTagNavigation?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* When `true`, Mana will not check for updates on this source
|
|
10
|
+
*/
|
|
11
|
+
readonly disableUpdateChecks?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* This should be a url Mana will navigate to, if not defined Mana will use the provided source website
|
|
14
|
+
*/
|
|
15
|
+
readonly cloudflareResolutionURL?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Indicates whether a user can create multiple instances of this Source. Defaults to false
|
|
18
|
+
*/
|
|
19
|
+
readonly allowsMultipleInstances?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* These are the domains on which the Source can handle deep links on
|
|
22
|
+
*/
|
|
23
|
+
readonly owningLinks?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* This indicates that this Source will require the user to sign in to access it's content
|
|
26
|
+
*/
|
|
27
|
+
readonly requiresAuthenticationToAccessContent?: boolean;
|
|
28
|
+
};
|
|
29
|
+
interface SourceCore extends ManaSource {
|
|
30
|
+
info: SourceInfo;
|
|
31
|
+
config?: SourceConfig;
|
|
32
|
+
}
|
|
33
|
+
export interface ContentSource extends SourceCore, DirectoryHandler {
|
|
34
|
+
/**
|
|
35
|
+
* Gets the titles information from the source
|
|
36
|
+
*/
|
|
37
|
+
getContent(contentId: string): Promise<Content>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the chapters of the specified content.
|
|
40
|
+
*/
|
|
41
|
+
getChapters(contentId: string): Promise<Chapter[]>;
|
|
42
|
+
getChapterData(contentId: string, chapterId: string, chapter?: Chapter): Promise<ChapterData>;
|
|
43
|
+
/**
|
|
44
|
+
* Called to get tags available on the source
|
|
45
|
+
*/
|
|
46
|
+
getTags?(): Promise<Property[]>;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ChapterEventHandler {
|
|
2
|
+
/**
|
|
3
|
+
* Called when the "Mark" state of a chapter/chapters changes, manually or as a result of syncing
|
|
4
|
+
*/
|
|
5
|
+
onChaptersMarked(contentId: string, chapterIds: string[], completed: boolean): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Called when a chapter is read/completed by the user.
|
|
8
|
+
*
|
|
9
|
+
* Is only called as a result of completing a chapter in the reader
|
|
10
|
+
*/
|
|
11
|
+
onChapterRead(contentId: string, chapterId: string): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* This method allows the progress to be synced on a per page basis
|
|
14
|
+
*/
|
|
15
|
+
onPageRead?(contentId: string, chapterId: string, page: number): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ContentEventHandler {
|
|
2
|
+
/**
|
|
3
|
+
* Called when contents for this source is added to the users library.
|
|
4
|
+
* @param ids The Content IDS of titles added to the library
|
|
5
|
+
*/
|
|
6
|
+
onContentsAddedToLibrary(ids: string[]): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Called when content is removed from a users library.
|
|
9
|
+
* @param ids The content ids of the titles removed from the users library.
|
|
10
|
+
*/
|
|
11
|
+
onContentsRemovedFromLibrary(ids: string[]): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContextMenuGroup, Highlight } from "../../../types";
|
|
2
|
+
export interface ContextMenuHandler {
|
|
3
|
+
/**
|
|
4
|
+
* If Implemented suwatte will call this method to refetch the updated state of a highlight after an action is performed
|
|
5
|
+
*/
|
|
6
|
+
getHighlight?(highlight: Highlight): Promise<Highlight>;
|
|
7
|
+
getContextActions(highlight: Highlight): Promise<ContextMenuGroup[]>;
|
|
8
|
+
didTriggerContextAction(highlight: Highlight, actionID: string): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GroupedUpdateResponse } from "../../../types";
|
|
2
|
+
export interface GroupedUpdatesProvider {
|
|
3
|
+
/**
|
|
4
|
+
* When implemented Mana will call this method to fetch titles that have been updated.
|
|
5
|
+
* @param ids The of titles to update
|
|
6
|
+
* @param date The date indicating the last time Mana checked for updates on this source
|
|
7
|
+
*/
|
|
8
|
+
getGroupedUpdates(ids: string[], date: Date): Promise<GroupedUpdateResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BooleanState } from "../../../types";
|
|
2
|
+
export type CGRect = {
|
|
3
|
+
size: {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
origin: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type CGSize = {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
export type RedrawInstruction = {
|
|
17
|
+
source: CGRect;
|
|
18
|
+
destination: CGRect;
|
|
19
|
+
};
|
|
20
|
+
export type RedrawWithSizeCommand = {
|
|
21
|
+
size: CGSize;
|
|
22
|
+
commands: RedrawInstruction[];
|
|
23
|
+
};
|
|
24
|
+
export interface ImageRedrawHandler {
|
|
25
|
+
shouldRedrawImage(url: string): Promise<BooleanState>;
|
|
26
|
+
redrawImageWithSize(size: CGSize): Promise<RedrawWithSizeCommand>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UpSyncedContent, DownSyncedContent } from "../../../types";
|
|
2
|
+
export interface LibrarySyncHandler {
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param library Called to sync the users's in-app library with the current library state of the source
|
|
6
|
+
*/
|
|
7
|
+
syncUserLibrary(library: UpSyncedContent[]): Promise<DownSyncedContent[]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./ContentEvent"), exports);
|
|
18
|
+
__exportStar(require("./ChapterEvent"), exports);
|
|
19
|
+
__exportStar(require("./ProgressSync"), exports);
|
|
20
|
+
__exportStar(require("./LibrarySync"), exports);
|
|
21
|
+
__exportStar(require("./ContextMenuHandler"), exports);
|
|
22
|
+
__exportStar(require("./GroupedUpdateProvider"), exports);
|
|
23
|
+
__exportStar(require("./ImageRedrawHandler"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./handlers"), exports);
|
|
18
|
+
__exportStar(require("./ContentSource"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DirectoryHandler } from "..";
|
|
2
|
+
import { FullTrackItem } from "../../types";
|
|
3
|
+
export interface AdvancedTracker extends DirectoryHandler {
|
|
4
|
+
/**
|
|
5
|
+
* This is called to get the info required to prepare a "profile page" for the title
|
|
6
|
+
*/
|
|
7
|
+
getFullInformation(id: string): Promise<FullTrackItem>;
|
|
8
|
+
toggleFavorite?(state: boolean): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Form, Highlight, SourceInfo, TrackProgressUpdate, TrackStatus } from "../../types";
|
|
2
|
+
import { ManaSource } from "../Source";
|
|
3
|
+
export type TrackerConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* These are keys to which sources providing the tracker id can link to, if this is not defined, Mana will use the Source's id
|
|
6
|
+
*/
|
|
7
|
+
readonly linkKeys?: string[];
|
|
8
|
+
readonly owningLinks?: string[];
|
|
9
|
+
};
|
|
10
|
+
export interface TrackerCore extends ManaSource {
|
|
11
|
+
readonly info: SourceInfo;
|
|
12
|
+
readonly config?: TrackerConfig;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This Source handles the implementation of tracking websites such as anilist, mal & kitsu
|
|
16
|
+
*/
|
|
17
|
+
export interface ContentTracker extends TrackerCore {
|
|
18
|
+
/**
|
|
19
|
+
* Called when the user reads a chapter later than what is currently tracked
|
|
20
|
+
* @param id The ID of the title read
|
|
21
|
+
* @param progress the updated reading progress
|
|
22
|
+
*/
|
|
23
|
+
didUpdateLastReadChapter(id: string, progress: TrackProgressUpdate): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Called when a user wants to link contents to your tracker.
|
|
26
|
+
* @param titles An array containing all the provided names of an entry.
|
|
27
|
+
*/
|
|
28
|
+
getResultsForTitles(titles: string[]): Promise<Highlight[]>;
|
|
29
|
+
/**
|
|
30
|
+
* A tracker item with the current entry for a title
|
|
31
|
+
* @param id The ID of the title being queried
|
|
32
|
+
*/
|
|
33
|
+
getTrackItem(id: string): Promise<Highlight>;
|
|
34
|
+
didUpdateStatus(id: string, status: TrackStatus): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Called when the user wants to start tracking a previously untracked entry
|
|
37
|
+
*/
|
|
38
|
+
beginTracking(id: string, status: TrackStatus): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Builds the form for updating the user's track state for a title
|
|
41
|
+
*/
|
|
42
|
+
getEntryForm(id: string): Promise<Form>;
|
|
43
|
+
/**
|
|
44
|
+
* Called when a user submits and updated entry form.
|
|
45
|
+
* * The form will ONLY contain KV pairs of properties that have been updated
|
|
46
|
+
* * The value of a property will be `null` if the user removes the property.
|
|
47
|
+
* * `Date` values will be returned as an ISO8601 formatted string
|
|
48
|
+
*/
|
|
49
|
+
didSubmitEntryForm(id: string, form: any): Promise<void>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./ContentTracker"), exports);
|
|
18
|
+
__exportStar(require("./AdvancedTracker"), exports);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BasicURL, BooleanState, User } from "../../../types";
|
|
2
|
+
export declare enum BasicAuthenticationUIIdentifier {
|
|
3
|
+
EMAIL = 0,
|
|
4
|
+
USERNAME = 1
|
|
5
|
+
}
|
|
6
|
+
export type SourceAuthenticatable = {
|
|
7
|
+
getAuthenticatedUser(): Promise<User | null>;
|
|
8
|
+
handleUserSignOut(): Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export type WebViewAuthenticatable = SourceAuthenticatable & {
|
|
11
|
+
/**
|
|
12
|
+
* HTTP Request to be made in the WebView
|
|
13
|
+
*/
|
|
14
|
+
getWebAuthRequestURL(): Promise<BasicURL>;
|
|
15
|
+
/**
|
|
16
|
+
* Handle Cookies received from the webview
|
|
17
|
+
* @param name The name of the received cookie
|
|
18
|
+
* @return A boolean value indicating whether the user has been successfully logged in
|
|
19
|
+
*/
|
|
20
|
+
didReceiveSessionCookieFromWebAuthResponse(name: string): Promise<BooleanState>;
|
|
21
|
+
};
|
|
22
|
+
export type BasicAuthenticatable = SourceAuthenticatable & {
|
|
23
|
+
/**
|
|
24
|
+
* Used to decide if Mana shows login with "username" & password or "email" and password.
|
|
25
|
+
*/
|
|
26
|
+
readonly BasicAuthUIIdentifier: BasicAuthenticationUIIdentifier;
|
|
27
|
+
/**
|
|
28
|
+
* Handle basic identifier-password authentication
|
|
29
|
+
*/
|
|
30
|
+
handleBasicAuth(identifier: string, password: string): Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
export type OAuthAuthenticatable = SourceAuthenticatable & {
|
|
33
|
+
getOAuthRequestURL(): Promise<BasicURL>;
|
|
34
|
+
handleOAuthCallback(response: string): Promise<void>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasicAuthenticationUIIdentifier = void 0;
|
|
4
|
+
var BasicAuthenticationUIIdentifier;
|
|
5
|
+
(function (BasicAuthenticationUIIdentifier) {
|
|
6
|
+
BasicAuthenticationUIIdentifier[BasicAuthenticationUIIdentifier["EMAIL"] = 0] = "EMAIL";
|
|
7
|
+
BasicAuthenticationUIIdentifier[BasicAuthenticationUIIdentifier["USERNAME"] = 1] = "USERNAME";
|
|
8
|
+
})(BasicAuthenticationUIIdentifier || (exports.BasicAuthenticationUIIdentifier = BasicAuthenticationUIIdentifier = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DirectoryRequest, PagedResult, DirectoryConfig } from "../../../types";
|
|
2
|
+
export interface DirectoryHandler {
|
|
3
|
+
/**
|
|
4
|
+
* Fetches items/results for a directory request.
|
|
5
|
+
*/
|
|
6
|
+
getDirectory(request: DirectoryRequest): Promise<PagedResult>;
|
|
7
|
+
/**
|
|
8
|
+
* Fetches the required directory config for a request
|
|
9
|
+
*
|
|
10
|
+
* Mana will cache the response for each Configuration Key upon first resolution as the Configuration is not intended to be dynamic.
|
|
11
|
+
* @param configID The Configuration key defined by the pre-provided {@link DirectoryRequest}. Will be undefined or null to use the default configuration
|
|
12
|
+
*/
|
|
13
|
+
getDirectoryConfig(configID?: string): Promise<DirectoryConfig>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NetworkRequest } from "../../../types";
|
|
2
|
+
export interface ImageRequestHandler {
|
|
3
|
+
/**
|
|
4
|
+
* Called to override the default get request for fetching images.
|
|
5
|
+
* @param imageURL The URL of the image being requested
|
|
6
|
+
*/
|
|
7
|
+
willRequestImage(imageURL: string): Promise<NetworkRequest>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PageLink, PageSection, ResolvedPageSection } from "../../../types";
|
|
2
|
+
/**
|
|
3
|
+
* The PageLinkResolver intent allows custom pages to be shown rather than the default director view
|
|
4
|
+
*/
|
|
5
|
+
export interface PageLinkResolver {
|
|
6
|
+
/**
|
|
7
|
+
* Provides Sections for a page
|
|
8
|
+
* @param link The Link To be Resolved
|
|
9
|
+
*/
|
|
10
|
+
getSectionsForPage(link: PageLink): Promise<PageSection[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Called After sections have been fetched but before they are resolved, the value returned will be passed into the `resolvePageSection` method
|
|
13
|
+
* @param link
|
|
14
|
+
*/
|
|
15
|
+
resolvePageSection(link: PageLink, sectionID: string): Promise<ResolvedPageSection>;
|
|
16
|
+
willResolveSectionsForPage?(link: PageLink): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./Preferences"), exports);
|
|
19
|
+
__exportStar(require("./ImageRequest"), exports);
|
|
20
|
+
__exportStar(require("./DirectoryHandler"), exports);
|
|
21
|
+
__exportStar(require("./PageProvider"), exports);
|
|
22
|
+
__exportStar(require("./Setup"), exports);
|
|
23
|
+
__exportStar(require("./PageResolver"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DeepLinkContext, SourceInfo } from "../../types";
|
|
2
|
+
export * from "./extensions";
|
|
3
|
+
export declare enum SourceEnvironment {
|
|
4
|
+
SOURCE = 0,
|
|
5
|
+
TRACKER = 1
|
|
6
|
+
}
|
|
7
|
+
export interface ManaSource {
|
|
8
|
+
readonly info: SourceInfo;
|
|
9
|
+
onEnvironmentLoaded?(): Promise<void>;
|
|
10
|
+
handleURL?(url: string): Promise<DeepLinkContext | null>;
|
|
11
|
+
}
|