@mana-app/types 0.0.20 → 0.0.21

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.
@@ -1,4 +1,4 @@
1
- import { ContextProvider } from "../core";
1
+ import { ContextProvider, Pair } from "../core";
2
2
  import { Linkable } from "../page";
3
3
  import { TrackEntry } from "../tracker";
4
4
  import { BaseItem } from "./BaseItem";
@@ -12,7 +12,7 @@ export type Highlight = BaseItem & ContextProvider & {
12
12
  /**
13
13
  * Additional Info that may be displayed with this content
14
14
  */
15
- info?: Record<string, string>;
15
+ info?: Pair[];
16
16
  /**
17
17
  * Badge to be displayed with the tile
18
18
  */
@@ -6,3 +6,7 @@ export type Option = {
6
6
  id: string;
7
7
  title: string;
8
8
  };
9
+ export type Pair = {
10
+ key: string;
11
+ value: string;
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mana-app/types",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -1,14 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +0,0 @@
1
- import { DirectoryRequest } from "../directory";
2
- import { Highlight } from "./Highlight";
3
- export type HighlightCollection = {
4
- /**
5
- * The ID of the Collection
6
- */
7
- id: string;
8
- /**
9
- * The Title of the Collection
10
- */
11
- title: string;
12
- /**
13
- * The Subtitle of the Collection.
14
- */
15
- subtitle?: string;
16
- /**
17
- * The Highlights/Titles to be displayed within this collection
18
- */
19
- highlights: Highlight[];
20
- /**
21
- * The Directory Request to be made to view more results from this collection
22
- */
23
- request?: DirectoryRequest;
24
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,31 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,53 +0,0 @@
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
- };
@@ -1,30 +0,0 @@
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 = {}));
@@ -1,37 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export * from "./DirectoryConfig";
2
- export * from "./DirectoryRequest";
3
- export * from "./DirectoryFilter";
@@ -1,19 +0,0 @@
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);