@telia-ace/knowledge-data-client-flamingo 1.1.119 → 1.1.120-rc.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/create-serviceclient.d.ts +2 -0
- package/data-client.d.ts +93 -0
- package/index.d.ts +4 -0
- package/legacy-conversion.d.ts +71 -0
- package/package.json +1 -1
- package/plugin.d.ts +2 -0
package/data-client.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ServiceClient } from '@telia-ace/knowledge-serviceclient';
|
|
2
|
+
import { Container, EventManager } from '@webprovisions/platform';
|
|
3
|
+
export type Subscriber = (...args: any[]) => void;
|
|
4
|
+
export declare enum DataType {
|
|
5
|
+
Guide = "guide",
|
|
6
|
+
Guides = "guides",
|
|
7
|
+
GuidesByCategory = "guides-by-category",
|
|
8
|
+
RowNotifications = "row-notices",
|
|
9
|
+
NotificationLists = "notification-lists",
|
|
10
|
+
GuideCategories = "guide-categories",
|
|
11
|
+
ContactMethodCategories = "contact-method-categories",
|
|
12
|
+
ContactMethod = "contact-method",
|
|
13
|
+
ContactMethods = "contact-methods",
|
|
14
|
+
Tags = "tags",
|
|
15
|
+
TagsOnGuides = "tagsonguides"
|
|
16
|
+
}
|
|
17
|
+
export type DataError = {
|
|
18
|
+
status: number;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
export declare enum ServiceClientQueryType {
|
|
22
|
+
Match = "match",
|
|
23
|
+
Categories = "categories",
|
|
24
|
+
Guide = "guide",
|
|
25
|
+
Contacts = "contacts",
|
|
26
|
+
ContactMethod = "contact-method",
|
|
27
|
+
MatchByCategory = "match-by-category",
|
|
28
|
+
Tags = "tags",
|
|
29
|
+
TagsOnGuides = "tagsonguides",
|
|
30
|
+
Notifications = "notifications"
|
|
31
|
+
}
|
|
32
|
+
export declare enum FeedbackType {
|
|
33
|
+
Positive = "Positive",
|
|
34
|
+
Negative = "Negative"
|
|
35
|
+
}
|
|
36
|
+
export type QueryParameters = {
|
|
37
|
+
guideId?: string | number;
|
|
38
|
+
categories?: string | number | string[] | number[];
|
|
39
|
+
tagId?: string | number;
|
|
40
|
+
connection?: string;
|
|
41
|
+
contactMethodCategoryId?: string | number;
|
|
42
|
+
contactMethodId?: string | number;
|
|
43
|
+
searchPhrase?: string | number;
|
|
44
|
+
take?: string | number;
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
expandCategories?: 'none' | 'children' | 'descendants';
|
|
47
|
+
sorting?: SortingType;
|
|
48
|
+
guideIds?: string[];
|
|
49
|
+
};
|
|
50
|
+
export declare enum SortingType {
|
|
51
|
+
POPULARITY_DESCENDING = "popularity-descending",
|
|
52
|
+
ALPHABETIC_ASCENDING = "alphabetic-ascending",
|
|
53
|
+
ALPHABETIC_DESCENDING = "alphabetic-descending",
|
|
54
|
+
MODIFIED_ASCENDING = "modified-ascending",
|
|
55
|
+
MODIFIED_DESCENDING = "modified-descending",
|
|
56
|
+
PUBLISHED_ASCENDING = "published-ascending",
|
|
57
|
+
PUBLISHED_DESCENDING = "published-descending"
|
|
58
|
+
}
|
|
59
|
+
export type Query = {
|
|
60
|
+
params: QueryParameters;
|
|
61
|
+
resolved: boolean;
|
|
62
|
+
loading: boolean;
|
|
63
|
+
error?: DataError;
|
|
64
|
+
data: any;
|
|
65
|
+
resolvers: {
|
|
66
|
+
resolve: (data: any) => void;
|
|
67
|
+
reject: (data: any) => void;
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
70
|
+
export declare const determineServiceClientQueryType: (type: DataType) => ServiceClientQueryType;
|
|
71
|
+
export default class DataClient {
|
|
72
|
+
private container;
|
|
73
|
+
private matchingClient;
|
|
74
|
+
private queries;
|
|
75
|
+
events: EventManager;
|
|
76
|
+
constructor(container: Container, matchingClient: ServiceClient);
|
|
77
|
+
static getInstance(container: Container, key?: string): Promise<DataClient>;
|
|
78
|
+
private getUnresolvedQueries;
|
|
79
|
+
fetch(type: DataType, params: QueryParameters, options?: {
|
|
80
|
+
noCache: boolean;
|
|
81
|
+
}): Promise<any>;
|
|
82
|
+
read(type: DataType, options: {
|
|
83
|
+
select?: (data: any) => any;
|
|
84
|
+
}): any[];
|
|
85
|
+
feedback(id: string, connection: string, feedback: FeedbackType): Promise<any>;
|
|
86
|
+
private setLoadingStatus;
|
|
87
|
+
private runQuery;
|
|
88
|
+
handleResponse(data: any | undefined, type: ServiceClientQueryType, params: QueryParameters, error?: DataError): void;
|
|
89
|
+
private fetchAllUnresolvedQueries;
|
|
90
|
+
private track;
|
|
91
|
+
static create(container: Container): Promise<DataClient>;
|
|
92
|
+
getClient(): ServiceClient;
|
|
93
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { DataError, ServiceClientQueryType } from './data-client';
|
|
2
|
+
type Category = any;
|
|
3
|
+
type DialogItem = any;
|
|
4
|
+
type Guide = any;
|
|
5
|
+
type Notification = any;
|
|
6
|
+
type NotificationList = any;
|
|
7
|
+
type Tag = any;
|
|
8
|
+
type ContactMethod = any;
|
|
9
|
+
export type MatchResult = {
|
|
10
|
+
guides: Guide[];
|
|
11
|
+
matches: number;
|
|
12
|
+
topNotifications: Notification[];
|
|
13
|
+
middleNotifications: Notification[];
|
|
14
|
+
bottomNotifications: Notification[];
|
|
15
|
+
notificationLists: NotificationList[];
|
|
16
|
+
tags: Tag[];
|
|
17
|
+
byCategory: {
|
|
18
|
+
id: string;
|
|
19
|
+
guides: Guide[];
|
|
20
|
+
matches: number;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
export type TagsResult = Tag[];
|
|
24
|
+
export type CategoriesResult = {
|
|
25
|
+
categories: Category[];
|
|
26
|
+
matches: number;
|
|
27
|
+
};
|
|
28
|
+
export type NotificationResults = Pick<MatchResult, 'topNotifications' | 'middleNotifications' | 'bottomNotifications' | 'notificationLists'>;
|
|
29
|
+
export type GuideResult = {
|
|
30
|
+
guide: {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
body: string;
|
|
34
|
+
modified: string;
|
|
35
|
+
modifiedBy: string | null;
|
|
36
|
+
publishedBy: string | null;
|
|
37
|
+
published: string;
|
|
38
|
+
connection: string;
|
|
39
|
+
categories: number[];
|
|
40
|
+
hasHandover: boolean;
|
|
41
|
+
allowFeedback: boolean;
|
|
42
|
+
seoMetaDescription: string | null;
|
|
43
|
+
seoAllowIndex: boolean | null;
|
|
44
|
+
perspective: string | null;
|
|
45
|
+
perspectives: {
|
|
46
|
+
[key: string]: string;
|
|
47
|
+
};
|
|
48
|
+
translations?: {
|
|
49
|
+
[key: string]: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
related: Guide[];
|
|
53
|
+
dialog: DialogItem[];
|
|
54
|
+
contactMethods: ContactMethod[];
|
|
55
|
+
tags: Tag[];
|
|
56
|
+
error?: DataError;
|
|
57
|
+
};
|
|
58
|
+
export type ContactsResult = {
|
|
59
|
+
categories: Category[];
|
|
60
|
+
contactMethods: ContactMethod[];
|
|
61
|
+
topNotifications: Notification[];
|
|
62
|
+
middleNotifications: Notification[];
|
|
63
|
+
bottomNotifications: Notification[];
|
|
64
|
+
notificationLists: NotificationList[];
|
|
65
|
+
};
|
|
66
|
+
export type SubmissionResult = {
|
|
67
|
+
contactMethod?: ContactMethod;
|
|
68
|
+
valid: boolean;
|
|
69
|
+
};
|
|
70
|
+
export declare const formatLegacyData: (type: ServiceClientQueryType, data: any) => any;
|
|
71
|
+
export {};
|
package/package.json
CHANGED
package/plugin.d.ts
ADDED