-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbs-data-feed-dm.d.ts
More file actions
228 lines (216 loc) · 7.51 KB
/
bs-data-feed-dm.d.ts
File metadata and controls
228 lines (216 loc) · 7.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/* tslint:disable:quotemark max-line-length trailing-comma */
import {BsnTextFeedProperties} from './bscore';
export {};
export enum DfDmErrorType {
unknownError = 0,
unexpectedError = 1,
invalidParameters = 2,
invalidDataFeed = 3,
emptyFieldName = 4,
duplicateFieldName = 5
}
export class DfDmError extends Error {
name: string;
type: DfDmErrorType;
action?: DfDmBaseAction;
constructor(type: DfDmErrorType, reason?: string, action?: DfDmBaseAction);
attachAction(action: DfDmBaseAction): void;
}
export function DfDmIsDfDmError(error: Error): error is DfDmError;
export const DfDmIdNone = "0";
export type DfDmId = string;
export interface DfDmState {
dataFeed: DfDmDataFeed;
fields: DfDmFieldsState;
modifiedTime: string;
}
export interface DfDmDataFeed {
id: string;
name: string;
lastModifiedDate: Date;
}
export interface DfDmFieldsState {
fieldsOrder: DfDmId[];
fieldsTitleById: DfDmFieldsTitleMap;
fieldsValue: DfDmFieldsValueMap;
}
export interface DfDmFieldsTitleMap {
[id: string]: string;
}
export interface DfDmFieldsValueMap {
[id: string]: DfDmFieldObject;
}
export interface DfDmFieldObject {
id: DfDmId;
value: string;
enableValidityDate: boolean;
validityStartDate: Date | null;
validityEndDate: Date | null;
}
export interface DfDmFieldEntity {
id: DfDmId;
title: string;
value: string;
enableValidityDate: boolean;
validityStartDate: Date | null;
validityEndDate: Date | null;
}
export interface DfDmIdParam {
id: string;
}
export function dfDmCheckForInvalidDfDmState(state: DfDmState): DfDmError | null;
export function dfDmCheckForEmptyFieldName(state: DfDmState): DfDmError | null;
export function dfDmCheckForDuplicateFieldName(state: DfDmState): DfDmError | null;
/**
* When save and create live data feed on BSN, client should call this selector to get base state.
* This state converts all time to UTC with the same time value.
*/
export const dfDmGetBaseStateForUniversalTimeZone: (state: any) => DfDmState;
export const dfDmFilterBaseState: (state: any) => DfDmState;
export const dfDmGetBaseState: (state: any) => DfDmState;
export const dfDmGetDataFeedState: (state: DfDmState) => DfDmDataFeed;
export function dfDmGetDataFeedName(state: DfDmState): string;
export const dfDmGetFieldsState: (state: DfDmState) => DfDmFieldsState;
export function dfDmGetFieldsOrder(state: DfDmState): string[];
export function dfDmGetFieldsTitleMap(state: DfDmState): DfDmFieldsTitleMap;
export function dfDmGetFieldsValueMap(state: DfDmState): DfDmFieldsValueMap;
export function dfDmGetFieldTitleById(state: DfDmState, props: DfDmIdParam): string | null;
export function dfDmGetFieldValueObjectById(state: DfDmState, props: DfDmIdParam): DfDmFieldObject | null;
export function dfDmGetFieldValueEntityById(state: DfDmState, props: DfDmIdParam): DfDmFieldEntity | null;
/**
* This returns all DfDmFieldEntity.
*
* @param {DfDmState} state
* @returns {DfDmFieldEntity[]}
*/
export function dfDmGetAllFieldValueEntities(state: DfDmState): DfDmFieldEntity[];
export const dfDmGetModifiedTimeState: (state: DfDmState) => string;
/**
* Return dataFeed last modified time.
* Nearly an alias for dfDmGetModifiedTimeState() - was add for compatibility reasons.
*
* @param {DfDmState} state
* @returns {Date}
*/
export function dfDmGetDataFeedLastModifiedTime(state: DfDmState): Date;
import { Reducer } from 'redux';
export type DfDmReducer = Reducer<DfDmState>;
export const dfDmReducer: Reducer<DfDmState>;
import { Action, Dispatch } from 'redux';
export type DfDmDispatch = Dispatch<DfDmState>;
export interface DfDmBaseAction extends Action {
type: string;
payload: {};
error?: boolean;
meta?: {};
}
export interface DfDmAction<T> extends DfDmBaseAction {
payload: T;
}
export type DfDmThunkAction<T> = (dispatch: DfDmDispatch, getState: () => DfDmState, extraArgument: undefined) => DfDmAction<T>;
/**
* When a component will unmount, this action can help clean bspl reducer.
* @returns {DfDmClearStateAction}
*/
export function dfDmClearStateAction(): DfDmClearStateAction;
export interface DfDmClearStateAction extends Action {
type: string;
payload: null;
}
export interface DfDmBatchAction extends Action {
type: string;
payload: DfDmBaseAction[];
}
/**
* Get DfDmState object from a enclosing parent state.
* This function depends on the assumption that:
* 1. If the parent state contains a DfDmState object, the property name for that object will
* be either 'bsdfdm' or 'bsdatafeed.
* 2. If the parent state does not contain a property with either of these names,
* the parent state is itself a DfDmState.
*
* @param state {any} - parent state
* @returns {DfDmState} - returned DfDmState object
*/
export function dfDmFilterDfDmState(state: any): DfDmState;
export interface DataFeedParams {
id: string;
name: string;
lastModifiedDate?: Date;
}
export type DataFeedAction = DfDmAction<DataFeedParams>;
/**
* Create a new data feed.
*
* @param {string} name
* @returns {DataFeedAction}
*/
export function dfDmNewDataFeed(name: string): DataFeedAction;
/**
* Update data feed properties. Currently, data feed only has name as properties.
*
* @param {DataFeedParams} params
* @returns {DataFeedAction}
*/
export function dfDmUpdateDataFeedProperties(params: DataFeedParams): DataFeedAction;
export interface OpenDataFeedParams {
newState: DfDmState;
}
export type OpenDataFeedAction = DfDmAction<OpenDataFeedParams>;
/**
* Open an exist data feed.
*
* @param {DfDmState} newState
* @returns {OpenDataFeedAction}
*/
export function dfDmOpenDataFeed(newState: DfDmState): OpenDataFeedAction;
export type UpdateFeedModifiedTimeAction = DfDmAction<Date>;
/**
* Open an exist data feed from BSN.
*
* @param {DfDmState} newState
* @returns {DfDmThunkAction<DataFeedParams>}
*/
export function dfDmLoadDateFeedFromBsn(assetData: BsnTextFeedProperties, feedName: string): DfDmThunkAction<DataFeedParams>;
/**
*
* Open an exist data feed with validation.
*
* @param {DfDmState} newState
* @returns {DfDmThunkAction<OpenDataFeedParams>}
*/
export function dfDmVerifyAndOpenDataFeed(newState: DfDmState): DfDmThunkAction<OpenDataFeedParams>;
export interface AddNewFieldActionParams {
title: string;
fieldObject: DfDmFieldObject;
}
export type AddNewFieldAction = DfDmAction<AddNewFieldActionParams>;
export function dfDmAddNewField(title?: string): AddNewFieldAction;
export interface UpdateFieldTitleActionParams {
id: DfDmId;
title: string;
}
export type UpdateFieldTitleAction = DfDmAction<UpdateFieldTitleActionParams>;
export function dfDmUpdateFieldName(id: string, title: string): UpdateFieldTitleAction;
export interface UpdateFieldValueActionParams {
id: DfDmId;
value?: string;
enableValidityDate?: boolean;
validityStartDate?: Date;
validityEndDate?: Date;
}
export type UpdateFieldValueAction = DfDmAction<UpdateFieldValueActionParams>;
export function dfDmUpdateFieldValue(params: UpdateFieldValueActionParams): UpdateFieldValueAction;
export interface UpdateFieldOrderParams {
nameIds: DfDmId[];
index: number;
}
export type UpdateFieldOrderAction = DfDmAction<UpdateFieldOrderParams>;
export function dfDmUpdateFieldOrder(params: UpdateFieldOrderParams): UpdateFieldOrderAction;
export interface DeleteFieldActionParams {
nameIds: DfDmId[];
}
export type DeleteFieldAction = DfDmAction<DeleteFieldActionParams>;
export function dfDmDeleteField(id: string | string[]): DeleteFieldAction;
/** @private */
export const modifyingActionTypesArray: string[];