dyo-tools 0.3.2 → 0.4.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/{dist/constants.d.ts → constants.d.ts} +1 -0
- package/constants.d.ts.map +1 -0
- package/constants.js +67 -0
- package/constants.js.map +1 -0
- package/core/DTAction.d.ts +12 -0
- package/core/DTAction.d.ts.map +1 -0
- package/{dist/core → core}/DTAction.js +3 -6
- package/core/DTAction.js.map +1 -0
- package/{dist/core → core}/DTBunch.d.ts +8 -5
- package/core/DTBunch.d.ts.map +1 -0
- package/{dist/core → core}/DTBunch.js +53 -19
- package/core/DTBunch.js.map +1 -0
- package/core/DTComponent.d.ts +31 -0
- package/core/DTComponent.d.ts.map +1 -0
- package/{dist/core → core}/DTComponent.js +23 -10
- package/core/DTComponent.js.map +1 -0
- package/core/DTComponentPhysical.d.ts +16 -0
- package/core/DTComponentPhysical.d.ts.map +1 -0
- package/core/DTComponentPhysical.js +37 -0
- package/core/DTComponentPhysical.js.map +1 -0
- package/core/DTComponentWithMeta.d.ts +12 -0
- package/core/DTComponentWithMeta.d.ts.map +1 -0
- package/core/DTComponentWithMeta.js +46 -0
- package/core/DTComponentWithMeta.js.map +1 -0
- package/core/DTElement.d.ts +15 -0
- package/core/DTElement.d.ts.map +1 -0
- package/{dist/core → core}/DTElement.js +8 -9
- package/core/DTElement.js.map +1 -0
- package/core/DTError.d.ts +14 -0
- package/core/DTError.d.ts.map +1 -0
- package/{dist/core → core}/DTError.js +1 -5
- package/core/DTError.js.map +1 -0
- package/core/DTManager.d.ts +36 -0
- package/core/DTManager.d.ts.map +1 -0
- package/{dist/core → core}/DTManager.js +84 -26
- package/core/DTManager.js.map +1 -0
- package/core/DTMaster.d.ts +27 -0
- package/core/DTMaster.d.ts.map +1 -0
- package/{dist/core → core}/DTMaster.js +48 -31
- package/core/DTMaster.js.map +1 -0
- package/core/DTModule.d.ts +17 -0
- package/core/DTModule.d.ts.map +1 -0
- package/{dist/core → core}/DTModule.js +6 -6
- package/core/DTModule.js.map +1 -0
- package/{src/index.ts → index.d.ts} +14 -17
- package/index.d.ts.map +1 -0
- package/{dist/index.d.ts → index.js} +1 -0
- package/index.js.map +1 -0
- package/{dist/libs → libs}/DYOFinder.d.ts +1 -0
- package/libs/DYOFinder.d.ts.map +1 -0
- package/{dist/libs → libs}/DYOFinder.js +10 -14
- package/libs/DYOFinder.js.map +1 -0
- package/libs/dix/DIXModule.module.d.ts +8 -0
- package/libs/dix/DIXModule.module.d.ts.map +1 -0
- package/libs/dix/DIXModule.module.js +73 -0
- package/libs/player/DTPlayer.element.d.ts +6 -0
- package/libs/player/DTPlayer.element.d.ts.map +1 -0
- package/libs/player/DTPlayer.element.js +7 -0
- package/libs/player/DTPlayer.element.js.map +1 -0
- package/libs/player/DTPlayer.manager.d.ts +12 -0
- package/libs/player/DTPlayer.manager.d.ts.map +1 -0
- package/libs/player/DTPlayer.manager.js +35 -0
- package/libs/player/DTPlayer.manager.js.map +1 -0
- package/package.json +9 -47
- package/tsconfig.dev.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/{dist/types → types}/core.d.ts +40 -12
- package/types/core.d.ts.map +1 -0
- package/{dist/types → types}/core.js +2 -6
- package/types/core.js.map +1 -0
- package/{src/types/index.ts → types/index.d.ts} +3 -2
- package/types/index.d.ts.map +1 -0
- package/types/index.js.map +1 -0
- package/{dist/types → types}/player.d.ts +1 -1
- package/types/player.d.ts.map +1 -0
- package/types/player.js +1 -0
- package/.c8rc.json +0 -4
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -47
- package/Makefile +0 -34
- package/README.md +0 -0
- package/babel.config.js +0 -1
- package/cucumber-report.html +0 -48
- package/dist/constants.js +0 -63
- package/dist/constants.js.map +0 -1
- package/dist/core/DTAction.d.ts +0 -10
- package/dist/core/DTAction.js.map +0 -1
- package/dist/core/DTBunch.js.map +0 -1
- package/dist/core/DTComponent.d.ts +0 -28
- package/dist/core/DTComponent.js.map +0 -1
- package/dist/core/DTComponentPhysical.d.ts +0 -13
- package/dist/core/DTComponentPhysical.js +0 -22
- package/dist/core/DTComponentPhysical.js.map +0 -1
- package/dist/core/DTComponentWithMeta.d.ts +0 -9
- package/dist/core/DTComponentWithMeta.js +0 -32
- package/dist/core/DTComponentWithMeta.js.map +0 -1
- package/dist/core/DTElement.d.ts +0 -13
- package/dist/core/DTElement.js.map +0 -1
- package/dist/core/DTError.d.ts +0 -13
- package/dist/core/DTError.js.map +0 -1
- package/dist/core/DTManager.d.ts +0 -33
- package/dist/core/DTManager.js.map +0 -1
- package/dist/core/DTMaster.d.ts +0 -24
- package/dist/core/DTMaster.js.map +0 -1
- package/dist/core/DTModule.d.ts +0 -14
- package/dist/core/DTModule.js.map +0 -1
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/libs/DYOFinder.js.map +0 -1
- package/dist/libs/player/DTPlayer.element.d.ts +0 -5
- package/dist/libs/player/DTPlayer.element.js +0 -11
- package/dist/libs/player/DTPlayer.element.js.map +0 -1
- package/dist/libs/player/DTPlayer.manager.d.ts +0 -11
- package/dist/libs/player/DTPlayer.manager.js +0 -42
- package/dist/libs/player/DTPlayer.manager.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/core.js.map +0 -1
- package/dist/types/index.js +0 -19
- package/dist/types/index.js.map +0 -1
- package/dist/types/player.js +0 -3
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -29
- package/docs/assets/main.js +0 -59
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1414
- package/docs/classes/core_DTAction.DYOToolsAction.html +0 -89
- package/docs/classes/core_DTBunch.DYOToolsBunch.html +0 -254
- package/docs/classes/core_DTComponent.DYOToolsComponent.html +0 -76
- package/docs/classes/core_DTComponentPhysical.DYOToolsComponentPhysical.html +0 -110
- package/docs/classes/core_DTComponentWithMeta.DYOToolsComponentWithMeta.html +0 -96
- package/docs/classes/core_DTElement.DYOToolsElement.html +0 -135
- package/docs/classes/core_DTError.DYOToolsError.html +0 -37
- package/docs/classes/core_DTManager.DYOToolsManager.html +0 -237
- package/docs/classes/core_DTMaster.DYOToolsMaster.html +0 -150
- package/docs/classes/core_DTModule.DYOToolsModule.html +0 -92
- package/docs/classes/libs_DYOFinder.DYOFinder.html +0 -34
- package/docs/classes/libs_player_DTPlayer_element.DYOToolsPlayer.html +0 -134
- package/docs/classes/libs_player_DTPlayer_manager.DYOToolsPlayerManager.html +0 -243
- package/docs/enums/types_core.FilterOperatorType.html +0 -10
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -1
- package/docs/interfaces/types_core.DTBunchFilters.html +0 -6
- package/docs/interfaces/types_core.DTBunchOptions.html +0 -19
- package/docs/interfaces/types_core.DTBunchToObject.html +0 -7
- package/docs/interfaces/types_core.DTComponentOptions.html +0 -5
- package/docs/interfaces/types_core.DTComponentToObject.html +0 -4
- package/docs/interfaces/types_core.DTElementToObject.html +0 -7
- package/docs/interfaces/types_core.DTManagerFilters.html +0 -6
- package/docs/interfaces/types_core.DTManagerOptions.html +0 -8
- package/docs/interfaces/types_core.DTManagerToObject.html +0 -5
- package/docs/interfaces/types_core.DTMasterToObject.html +0 -8
- package/docs/interfaces/types_core.DTModuleToObject.html +0 -6
- package/docs/interfaces/types_core.DYOFinderConfigurationPropDefault.html +0 -4
- package/docs/interfaces/types_core.DYOFinderConfigurationPropObjectSearch.html +0 -4
- package/docs/interfaces/types_core.DYOFinderFilterOperatorAdvanced.html +0 -5
- package/docs/interfaces/types_core.DYOFinderFilterOperatorBase.html +0 -5
- package/docs/interfaces/types_player.DTPlayerManagerSimpleConfiguration.html +0 -3
- package/docs/modules/constants.html +0 -6
- package/docs/modules/core_DTAction.html +0 -2
- package/docs/modules/core_DTBunch.html +0 -2
- package/docs/modules/core_DTComponent.html +0 -2
- package/docs/modules/core_DTComponentPhysical.html +0 -2
- package/docs/modules/core_DTComponentWithMeta.html +0 -2
- package/docs/modules/core_DTElement.html +0 -2
- package/docs/modules/core_DTError.html +0 -2
- package/docs/modules/core_DTManager.html +0 -2
- package/docs/modules/core_DTMaster.html +0 -2
- package/docs/modules/core_DTModule.html +0 -2
- package/docs/modules/libs_DYOFinder.html +0 -2
- package/docs/modules/libs_player_DTPlayer_element.html +0 -2
- package/docs/modules/libs_player_DTPlayer_manager.html +0 -2
- package/docs/modules/types.html +0 -29
- package/docs/modules/types_core.html +0 -28
- package/docs/modules/types_player.html +0 -2
- package/docs/types/types_core.DTAcceptedMetaData.html +0 -2
- package/docs/types/types_core.DTManagerItemType.html +0 -1
- package/docs/types/types_core.DTManagerItemsType.html +0 -2
- package/docs/types/types_core.DYOFinderComponentType.html +0 -1
- package/docs/types/types_core.DYOFinderConfiguration.html +0 -2
- package/docs/types/types_core.DYOFinderConfigurationProp.html +0 -1
- package/docs/types/types_core.DYOFinderFilterOperator.html +0 -1
- package/docs/types/types_core.DYOFinderFilterOperatorArgument.html +0 -1
- package/docs/types/types_core.DYOFinderFilters.html +0 -1
- package/docs/types/types_core.StandardPrimitiveType.html +0 -2
- package/docs/types/types_core.StandardPrimitiveTypeWithArray.html +0 -1
- package/docs/variables/constants.bunchDefaultOptions.html +0 -2
- package/docs/variables/constants.componentBunchDefaultFinderConfiguration.html +0 -1
- package/docs/variables/constants.componentManagerDefaultFinderConfiguration.html +0 -1
- package/docs/variables/constants.componentPhysicalDefaultFinderConfiguration.html +0 -1
- package/docs/variables/constants.managerDefaultOptions.html +0 -2
- package/jest.config.js +0 -6
- package/src/constants.ts +0 -85
- package/src/core/DTAction.ts +0 -52
- package/src/core/DTBunch.ts +0 -467
- package/src/core/DTComponent.ts +0 -225
- package/src/core/DTComponentPhysical.ts +0 -54
- package/src/core/DTComponentWithMeta.ts +0 -65
- package/src/core/DTElement.ts +0 -102
- package/src/core/DTError.ts +0 -78
- package/src/core/DTManager.ts +0 -465
- package/src/core/DTMaster.ts +0 -318
- package/src/core/DTModule.ts +0 -90
- package/src/libs/DYOFinder.ts +0 -175
- package/src/libs/player/DTPlayer.element.ts +0 -9
- package/src/libs/player/DTPlayer.manager.ts +0 -84
- package/src/types/core.ts +0 -169
- package/src/types/player.ts +0 -6
- package/test/core/DTAction.double.ts +0 -78
- package/test/core/DTAction.spec.ts +0 -76
- package/test/core/DTBunch.double.ts +0 -261
- package/test/core/DTBunch.spec.ts +0 -910
- package/test/core/DTComponent.double.ts +0 -164
- package/test/core/DTComponent.spec.ts +0 -295
- package/test/core/DTComponentPhysical.double.ts +0 -76
- package/test/core/DTComponentPhysical.spec.ts +0 -78
- package/test/core/DTComponentWithMeta.double.ts +0 -115
- package/test/core/DTComponentWithMeta.spec.ts +0 -124
- package/test/core/DTElement.double.ts +0 -163
- package/test/core/DTElement.spec.ts +0 -146
- package/test/core/DTError.double.ts +0 -92
- package/test/core/DTError.spec.ts +0 -89
- package/test/core/DTManager.double.ts +0 -216
- package/test/core/DTManager.spec.ts +0 -965
- package/test/core/DTMaster.double.ts +0 -141
- package/test/core/DTMaster.spec.ts +0 -584
- package/test/core/DTModule.double.ts +0 -80
- package/test/core/DTModule.spec.ts +0 -138
- package/test/core/copy.spec.ts +0 -243
- package/test/libs/DYOFinder.double.ts +0 -152
- package/test/libs/DYOFinder.spec.ts +0 -194
- package/test/libs/player/DTPlayer.element.double.ts +0 -55
- package/test/libs/player/DTPlayer.element.spec.ts +0 -28
- package/test/libs/player/DTPlayer.manager.double.ts +0 -92
- package/test/libs/player/DTPlayer.manager.spec.ts +0 -178
- package/tsconfig.dev.json +0 -22
- package/tsconfig.json +0 -21
- /package/{dist/types/index.d.ts → types/index.js} +0 -0
- /package/{dist/types → types}/player.js.map +0 -0
package/src/types/core.ts
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { DTBunch, DTComponent } from '../index';
|
|
2
|
-
import DYOToolsElement from '../core/DTElement';
|
|
3
|
-
|
|
4
|
-
/** Constants Enum * */
|
|
5
|
-
export enum FilterOperatorType {
|
|
6
|
-
EQ = '$eq',
|
|
7
|
-
IN = '$in',
|
|
8
|
-
NIN = '$nin',
|
|
9
|
-
NE = '$ne',
|
|
10
|
-
LTE = '$lte',
|
|
11
|
-
GTE = '$gte',
|
|
12
|
-
CONTAINS = '$contains',
|
|
13
|
-
NCONTAINS = '$ncontains',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** Common Types * */
|
|
17
|
-
export type StandardPrimitiveType = string | number | boolean | null | undefined;
|
|
18
|
-
export type StandardPrimitiveTypeWithArray = string | number | boolean | Array<string | number | boolean> | null | undefined;
|
|
19
|
-
|
|
20
|
-
/** DYO Finder interfaces * */
|
|
21
|
-
export type DYOFinderConfiguration = Record<string, DYOFinderConfigurationProp>;
|
|
22
|
-
export type DYOFinderComponentType = DTComponent & {
|
|
23
|
-
getAll: () => DTComponent[],
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export interface DYOFinderConfigurationPropDefault {
|
|
27
|
-
operators: FilterOperatorType[],
|
|
28
|
-
getValue: (item: DTComponent, ctx?: DTComponent) => StandardPrimitiveType,
|
|
29
|
-
objectSearch: false,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface DYOFinderConfigurationPropObjectSearch {
|
|
33
|
-
operators: FilterOperatorType[],
|
|
34
|
-
getValue: (item: DTComponent, ctx?: DTComponent) => Record<string, StandardPrimitiveTypeWithArray>,
|
|
35
|
-
objectSearch: true,
|
|
36
|
-
}
|
|
37
|
-
export type DYOFinderConfigurationProp = DYOFinderConfigurationPropDefault | DYOFinderConfigurationPropObjectSearch;
|
|
38
|
-
|
|
39
|
-
export interface DYOFinderFilterOperatorBase {
|
|
40
|
-
[FilterOperatorType.EQ]: StandardPrimitiveType
|
|
41
|
-
[FilterOperatorType.IN]: Array<StandardPrimitiveType>
|
|
42
|
-
[FilterOperatorType.NIN]: Array<StandardPrimitiveType>
|
|
43
|
-
[FilterOperatorType.NE]: StandardPrimitiveType
|
|
44
|
-
}
|
|
45
|
-
export interface DYOFinderFilterOperatorAdvanced {
|
|
46
|
-
[FilterOperatorType.LTE]: number
|
|
47
|
-
[FilterOperatorType.GTE]: number
|
|
48
|
-
[FilterOperatorType.CONTAINS]: StandardPrimitiveType
|
|
49
|
-
[FilterOperatorType.NCONTAINS]: StandardPrimitiveType
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type DYOFinderFilterOperator = DYOFinderFilterOperatorBase & DYOFinderFilterOperatorAdvanced;
|
|
53
|
-
export type DYOFinderFilterOperatorArgument = Partial<DYOFinderFilterOperator | Record<string, Partial<DYOFinderFilterOperator>>>;
|
|
54
|
-
export type DYOFinderFilters = Record<string, DYOFinderFilterOperatorArgument>;
|
|
55
|
-
|
|
56
|
-
/** DTComponent interfaces * */
|
|
57
|
-
/**
|
|
58
|
-
* DTComponent default options configuration.
|
|
59
|
-
*/
|
|
60
|
-
export interface DTComponentOptions {
|
|
61
|
-
/**
|
|
62
|
-
* Default *false*. If *true*, no exception is thrown when an error occurred, a new DTError instance is
|
|
63
|
-
* added to the _errors property array instead. If *false*, throw the exception with a DTError instance.
|
|
64
|
-
*/
|
|
65
|
-
errors: boolean
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface DTComponentToObject {
|
|
69
|
-
id: string
|
|
70
|
-
key: string
|
|
71
|
-
type: string
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** DTComponentWithMeta interfaces * */
|
|
75
|
-
export type DTAcceptedMetaData = Record<
|
|
76
|
-
string,
|
|
77
|
-
StandardPrimitiveTypeWithArray
|
|
78
|
-
>;
|
|
79
|
-
|
|
80
|
-
/** DTElement interfaces * */
|
|
81
|
-
export interface DTElementToObject<IComponentMeta> extends DTComponentToObject {
|
|
82
|
-
owner?: string
|
|
83
|
-
meta?: Partial<IComponentMeta>
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** DTBunch interfaces * */
|
|
87
|
-
/**
|
|
88
|
-
* DTBunch option configuration.
|
|
89
|
-
*/
|
|
90
|
-
export interface DTBunchOptions extends DTComponentOptions {
|
|
91
|
-
/**
|
|
92
|
-
* Default *false*. If *true*, an error occurred when adding a new DTElement with the same key of an
|
|
93
|
-
* existing element into the bunch.
|
|
94
|
-
*/
|
|
95
|
-
uniqueKey: boolean
|
|
96
|
-
/**
|
|
97
|
-
* Default *false*. If *true*, when a new DTElement is added at existing index (using **addAtIndex**
|
|
98
|
-
* or **addManyAtIndex** method), this component replaces the old one. If *false*, this component is added at the specified
|
|
99
|
-
* index and other existing component are reindexed with the following index.
|
|
100
|
-
*/
|
|
101
|
-
replaceIndex: boolean
|
|
102
|
-
/**
|
|
103
|
-
* Default *false*. If *true*, when a new DTElement is added, the owner of this element becomes
|
|
104
|
-
* automatically the current bunch owner.
|
|
105
|
-
*/
|
|
106
|
-
inheritOwner: boolean
|
|
107
|
-
/**
|
|
108
|
-
* Default *false*. If *true*, the container is not changed when a new DTElement is added.
|
|
109
|
-
* If *false*, when a new DTElement is added, the container of this element becomes automatically the current bunch instance
|
|
110
|
-
* and the element is removed from the old container Component (if defined).
|
|
111
|
-
*/
|
|
112
|
-
virtualContainer: boolean
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface DTBunchToObject<IComponentMeta> extends DTComponentToObject {
|
|
116
|
-
items: Array<DTElementToObject<DTAcceptedMetaData>>
|
|
117
|
-
owner?: string
|
|
118
|
-
meta?: Partial<IComponentMeta>
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface DTBunchFilters {
|
|
122
|
-
id: Partial<DYOFinderFilterOperatorBase>
|
|
123
|
-
key: Partial<DYOFinderFilterOperatorBase>
|
|
124
|
-
container: Partial<DYOFinderFilterOperatorBase>
|
|
125
|
-
owner: Partial<DYOFinderFilterOperatorBase>
|
|
126
|
-
meta: Record<string, Partial<DYOFinderFilterOperatorBase & DYOFinderFilterOperatorAdvanced>>
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/** DTManager interfaces * */
|
|
130
|
-
export type DTManagerItemsType<IBunchItem extends DYOToolsElement<DTAcceptedMetaData>> = Record<string, DTManagerItemType<IBunchItem>>;
|
|
131
|
-
export type DTManagerItemType<IBunchItem extends DYOToolsElement<DTAcceptedMetaData>> = {
|
|
132
|
-
scope: string,
|
|
133
|
-
item: DTBunch<IBunchItem>,
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export interface DTManagerFilters extends DYOFinderFilters {
|
|
137
|
-
id: Partial<DYOFinderFilterOperatorBase>
|
|
138
|
-
key: Partial<DYOFinderFilterOperatorBase>
|
|
139
|
-
owner: Partial<DYOFinderFilterOperatorBase>
|
|
140
|
-
scope: Partial<DYOFinderFilterOperatorBase>
|
|
141
|
-
meta: Record<string, Partial<DYOFinderFilterOperatorBase & DYOFinderFilterOperatorAdvanced>>
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* DTManager option configuration.
|
|
146
|
-
*/
|
|
147
|
-
export interface DTManagerOptions extends DTComponentOptions {
|
|
148
|
-
/**
|
|
149
|
-
* Default *false*. If *true*, when a bunch instance is removed from the Manager _items, the process performs also
|
|
150
|
-
* a removal from the Manager Library of all DTElement instances of the bunch.
|
|
151
|
-
*/
|
|
152
|
-
libraryDeletion: boolean,
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface DTManagerToObject extends DTComponentToObject {
|
|
156
|
-
items: Array<DTBunchToObject<DTAcceptedMetaData> & { scope: string }>
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/** DTModule interfaces * */
|
|
160
|
-
export interface DTModuleToObject extends DTComponentToObject {
|
|
161
|
-
enabled: boolean
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/** DTMaster interfaces * */
|
|
165
|
-
export interface DTMasterToObject extends DTComponentToObject {
|
|
166
|
-
managers: Array<DTManagerToObject>,
|
|
167
|
-
actions: Array<DTComponentToObject>,
|
|
168
|
-
modules: Array<DTModuleToObject>,
|
|
169
|
-
}
|
package/src/types/player.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {DTAction} from "../../src";
|
|
2
|
-
import {DTComponentToObject} from "../../src/types";
|
|
3
|
-
|
|
4
|
-
/** ****************** STUB PROPERTIES CONSTANTS
|
|
5
|
-
* Fixed properties to use with double classes, avoid auto generated and easy checking on test
|
|
6
|
-
* **** */
|
|
7
|
-
export const IDTest = 'DTAction-id-1234567';
|
|
8
|
-
export const KeyTest = 'DTAction-key-1234567';
|
|
9
|
-
|
|
10
|
-
// Specific Manager constants
|
|
11
|
-
export const action1IDTest = `${IDTest}_1`;
|
|
12
|
-
export const action1KeyTest = `${KeyTest}_1`;
|
|
13
|
-
|
|
14
|
-
export const action1ToObject: DTComponentToObject = {
|
|
15
|
-
id: action1IDTest,
|
|
16
|
-
key: action1KeyTest,
|
|
17
|
-
type: 'action'
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/******************** STUB ABSTRACT IMPLEMENTATION
|
|
21
|
-
* Implementation of abstract component class for tests
|
|
22
|
-
* *****/
|
|
23
|
-
export class DTActionImpl extends DTAction<string> {
|
|
24
|
-
async execute(payload: string): Promise<void> {
|
|
25
|
-
throw `${this._key} : ${payload}`;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** ****************** HELPER TEST CLASS
|
|
30
|
-
* Helper test class, inherits the main component
|
|
31
|
-
* Providing methods to property access and other facilities, in order to avoid using class methods
|
|
32
|
-
* **** */
|
|
33
|
-
export class DTActionTest extends DTActionImpl {
|
|
34
|
-
th_get_id(): string {
|
|
35
|
-
return this._id;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
th_set_id(id: string): void {
|
|
39
|
-
this._id = id;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
th_get_key(): string {
|
|
43
|
-
return this._key;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
th_set_key(key: string): void {
|
|
47
|
-
this._key = key;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
th_get_componentType(): string {
|
|
51
|
-
return this._componentType;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/** ****************** STUB CLASS
|
|
57
|
-
* Stub class, for using in other component
|
|
58
|
-
* **** */
|
|
59
|
-
export class DTActionStub extends DTActionTest {
|
|
60
|
-
constructor() {
|
|
61
|
-
super();
|
|
62
|
-
this._id = IDTest;
|
|
63
|
-
this._key = KeyTest;
|
|
64
|
-
this._errors = [];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
getId(): string {
|
|
68
|
-
return IDTest;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
getKey(): string {
|
|
72
|
-
return KeyTest;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** ****************** HELPER METHODS
|
|
77
|
-
* Additional helper methods to use with testing
|
|
78
|
-
* **** */
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {DTComponent, DTAction} from "../../src";
|
|
2
|
-
import {mockOverriddenMethods} from "./DTComponent.double";
|
|
3
|
-
import {afterEach, beforeEach, describe, expect, jest, test} from "@jest/globals";
|
|
4
|
-
import {DTActionTest, IDTest, KeyTest} from "./DTAction.double";
|
|
5
|
-
|
|
6
|
-
/** ****************** MOCK DEPENDENCIES
|
|
7
|
-
* Dependencies used by the component are mocked with Jest
|
|
8
|
-
* **** */
|
|
9
|
-
jest.mock('../../src/core/DTComponent');
|
|
10
|
-
jest.mock('../../src/core/DTError');
|
|
11
|
-
// Add specific mock for inherited methods to have a basic implementation
|
|
12
|
-
mockOverriddenMethods(DTComponent);
|
|
13
|
-
|
|
14
|
-
/** *********************** TESTS SUITES ****************************** */
|
|
15
|
-
describe('class DYOToolsAction', () => {
|
|
16
|
-
let actionTest: DTActionTest;
|
|
17
|
-
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
actionTest = new DTActionTest();
|
|
20
|
-
actionTest.th_set_id(IDTest);
|
|
21
|
-
actionTest.th_set_key(KeyTest);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
afterEach(() => {
|
|
25
|
-
jest.resetAllMocks();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('inheritance', () => {
|
|
29
|
-
test('check good inheritance for class', () => {
|
|
30
|
-
expect(DTAction.prototype instanceof DTComponent).toBeTruthy();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('_componentType', () => {
|
|
35
|
-
test('componentType must be "action"', () => {
|
|
36
|
-
expect(actionTest.th_get_componentType()).toBe('action');
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
describe('getMaster', () => {
|
|
41
|
-
test('call get context with master accessor', () => {
|
|
42
|
-
actionTest.getMaster();
|
|
43
|
-
|
|
44
|
-
expect((actionTest.getContext as any).mock.calls.length).toBe(1);
|
|
45
|
-
expect((actionTest.getContext as any).mock.calls[0][0]).toBe('master');
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('execute', () => {
|
|
50
|
-
test('throw payload in test implementation', async () => {
|
|
51
|
-
const payload = `execute action`;
|
|
52
|
-
const expectedPayload = `${KeyTest} : execute action`;
|
|
53
|
-
|
|
54
|
-
await expect(actionTest.execute(payload)).rejects.toBe(expectedPayload);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('toString', () => {
|
|
59
|
-
test('string output standard', () => {
|
|
60
|
-
const toStringAction = actionTest.toString();
|
|
61
|
-
|
|
62
|
-
expect(toStringAction).toBe(`Component ${KeyTest} - Type: Action`);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('toObject', () => {
|
|
67
|
-
test('toObject output standard', () => {
|
|
68
|
-
const toObjectAction: any = actionTest.toObject();
|
|
69
|
-
|
|
70
|
-
expect(Object.keys(toObjectAction)).toStrictEqual(['id', 'key', 'type']);
|
|
71
|
-
expect(toObjectAction.id).toBe(IDTest);
|
|
72
|
-
expect(toObjectAction.key).toBe(KeyTest);
|
|
73
|
-
expect(toObjectAction.type).toBe('action');
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import {DTBunch, DTComponent} from '../../src';
|
|
2
|
-
import {bunchDefaultOptions as DTBunchDefaultOptions} from '../../src/constants';
|
|
3
|
-
import {
|
|
4
|
-
HaileiMetaData,
|
|
5
|
-
IldressMetaData,
|
|
6
|
-
IMetaDataTest,
|
|
7
|
-
MaydenaMetaData,
|
|
8
|
-
MeldrineMetaData,
|
|
9
|
-
YssaliaMetaData,
|
|
10
|
-
} from './DTComponentWithMeta.double';
|
|
11
|
-
import DYOToolsElement from '../../src/core/DTElement';
|
|
12
|
-
import {DTBunchOptions, DTElementToObject} from '../../src/types';
|
|
13
|
-
import {
|
|
14
|
-
HaileiIdTest,
|
|
15
|
-
HaileiKeyTest,
|
|
16
|
-
HaileiToObjectTest,
|
|
17
|
-
IldressIdTest,
|
|
18
|
-
IldressKeyTest,
|
|
19
|
-
IldressToObjectTest,
|
|
20
|
-
MaydenaIdTest,
|
|
21
|
-
MaydenaKeyTest,
|
|
22
|
-
MaydenaToObjectTest,
|
|
23
|
-
MeldrineIdTest,
|
|
24
|
-
MeldrineKeyTest,
|
|
25
|
-
MeldrineToObjectTest,
|
|
26
|
-
YssaliaIdTest,
|
|
27
|
-
YssaliaKeyTest,
|
|
28
|
-
YssaliaToObjectTest,
|
|
29
|
-
} from './DTElement.double';
|
|
30
|
-
import {DTErrorStub} from './DTError.double';
|
|
31
|
-
import DYOFinder from '../../src/libs/DYOFinder';
|
|
32
|
-
import Mocked = jest.Mocked;
|
|
33
|
-
|
|
34
|
-
/** ****************** STUB PROPERTIES CONSTANTS
|
|
35
|
-
* Fixed properties to use with double classes, avoid auto generated and easy checking on test
|
|
36
|
-
* **** */
|
|
37
|
-
// Global Bunch constants
|
|
38
|
-
export const IDTest = 'DTBunch-id-1234567';
|
|
39
|
-
export const IDTestLibrary = 'DTBunch-id-library-1234567';
|
|
40
|
-
export const KeyTest = 'DTBunch-key-1234567';
|
|
41
|
-
export const defaultOptions: DTBunchOptions = DTBunchDefaultOptions;
|
|
42
|
-
|
|
43
|
-
// Specific Bunch constants
|
|
44
|
-
export const bunch1IdTest = `${IDTest}_1`;
|
|
45
|
-
export const bunch1toObjectTest = {
|
|
46
|
-
id: bunch1IdTest, key: 'bunch1-key-test', type: 'bunch', items: [HaileiToObjectTest],
|
|
47
|
-
};
|
|
48
|
-
export const bunch2IdTest = `${IDTest}_2`;
|
|
49
|
-
export const bunch2toObjectTest = {
|
|
50
|
-
id: bunch2IdTest, key: 'bunch2-key-test', type: 'bunch', items: [],
|
|
51
|
-
};
|
|
52
|
-
export const bunch3IdTest = `${IDTest}_3`;
|
|
53
|
-
export const bunch3toObjectTest = {
|
|
54
|
-
id: bunch3IdTest, key: 'bunch3-key-test', type: 'bunch', items: [],
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/** ****************** HELPER TEST CLASS
|
|
58
|
-
* Helper test class, inherits the main component
|
|
59
|
-
* Providing methods to property access and other facilities, in order to avoid using class methods
|
|
60
|
-
* **** */
|
|
61
|
-
export class DTBunchTest extends DTBunch<Mocked<DYOToolsElement<IMetaDataTest>>, IMetaDataTest> {
|
|
62
|
-
th_get_id(): string {
|
|
63
|
-
return this._id;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
th_set_id(id: string): void {
|
|
67
|
-
this._id = id;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
th_get_key(): string {
|
|
71
|
-
return this._key;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
th_set_key(key: string): void {
|
|
75
|
-
this._key = key;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
th_get_componentType(): string {
|
|
79
|
-
return this._componentType;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
th_get_context(): DTComponent | undefined {
|
|
83
|
-
return this._context;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
th_set_context(context: DTComponent): void {
|
|
87
|
-
this._context = context;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
th_get_items(): Mocked<DYOToolsElement<IMetaDataTest>>[] {
|
|
91
|
-
return this._items;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
th_set_items(items: Mocked<DYOToolsElement<IMetaDataTest>>[]): void {
|
|
95
|
-
this._items = items;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
th_set_errors(errors: Array<DTErrorStub>): void {
|
|
99
|
-
this._errors = errors;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
th_get_options(): any {
|
|
103
|
-
return this._options;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
th_set_options(options: any): void {
|
|
107
|
-
this._options = {
|
|
108
|
-
...this._options,
|
|
109
|
-
...options,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
th_get_owner(): string {
|
|
114
|
-
return this._owner;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
th_set_owner(owner: string): void {
|
|
118
|
-
this._owner = owner;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
th_set_meta(meta: IMetaDataTest): void {
|
|
122
|
-
this._meta = meta;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
th_get_finder(): DYOFinder {
|
|
126
|
-
return this._finder;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** ****************** STUB CLASS
|
|
131
|
-
* Stub class, for using in other component
|
|
132
|
-
* **** */
|
|
133
|
-
export class DTBunchStub extends DTBunchTest {
|
|
134
|
-
constructor(items: Array<Mocked<DYOToolsElement<IMetaDataTest>>> = []) {
|
|
135
|
-
super();
|
|
136
|
-
this._id = IDTest;
|
|
137
|
-
this._key = KeyTest;
|
|
138
|
-
this._errors = [];
|
|
139
|
-
this._items = items;
|
|
140
|
-
this._options = DTBunchDefaultOptions;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
getId(): string {
|
|
144
|
-
return IDTest;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
getKey(): string {
|
|
148
|
-
return KeyTest;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
getAll(): Array<Mocked<DYOToolsElement<IMetaDataTest>>> {
|
|
152
|
-
return this._items;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
getAllKeys(): string[] {
|
|
156
|
-
return this._items.map((item: DYOToolsElement<IMetaDataTest>) => item.getKey());
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Specific Stub Library for Manager
|
|
161
|
-
export class DTBunchStubLibrary extends DTBunchStub {
|
|
162
|
-
constructor(items: Array<Mocked<DYOToolsElement<IMetaDataTest>>> = []) {
|
|
163
|
-
super(items);
|
|
164
|
-
this._id = IDTestLibrary;
|
|
165
|
-
this._key = 'library';
|
|
166
|
-
this._errors = [];
|
|
167
|
-
this._items = items;
|
|
168
|
-
this._options = {
|
|
169
|
-
...DTBunchDefaultOptions,
|
|
170
|
-
virtualContainer: true,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
getId(): string {
|
|
175
|
-
return IDTestLibrary;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
getKey(): string {
|
|
179
|
-
return 'library';
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
get(id: string): Mocked<DYOToolsElement<IMetaDataTest>> | undefined {
|
|
183
|
-
const itemFiltered = this._items.filter((item: Mocked<DYOToolsElement<IMetaDataTest>>) => item.getId() === id);
|
|
184
|
-
return itemFiltered.length > 0 ? itemFiltered[0] : undefined;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/** ****************** HELPER METHODS
|
|
189
|
-
* Additional helper methods to use with testing
|
|
190
|
-
* **** */
|
|
191
|
-
|
|
192
|
-
// Function to generate Mocked DTElement collection
|
|
193
|
-
// Warning : DYOToolsElement class must be MOCKED to use this !
|
|
194
|
-
export const generateMockedElements = (numberElements: number): Array<Mocked<DYOToolsElement<IMetaDataTest>>> => {
|
|
195
|
-
const mockedElements = [];
|
|
196
|
-
const mockedData: Array<{ id: string, key: string, meta: IMetaDataTest, toObject: DTElementToObject<IMetaDataTest> }> = [
|
|
197
|
-
{
|
|
198
|
-
id: HaileiIdTest,
|
|
199
|
-
key: HaileiKeyTest,
|
|
200
|
-
meta: HaileiMetaData,
|
|
201
|
-
toObject: HaileiToObjectTest,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
id: MeldrineIdTest,
|
|
205
|
-
key: MeldrineKeyTest,
|
|
206
|
-
meta: MeldrineMetaData,
|
|
207
|
-
toObject: MeldrineToObjectTest,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
id: MaydenaIdTest,
|
|
211
|
-
key: MaydenaKeyTest,
|
|
212
|
-
meta: MaydenaMetaData,
|
|
213
|
-
toObject: MaydenaToObjectTest,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
id: IldressIdTest,
|
|
217
|
-
key: IldressKeyTest,
|
|
218
|
-
meta: IldressMetaData,
|
|
219
|
-
toObject: IldressToObjectTest,
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
id: YssaliaIdTest,
|
|
223
|
-
key: YssaliaKeyTest,
|
|
224
|
-
meta: YssaliaMetaData,
|
|
225
|
-
toObject: YssaliaToObjectTest,
|
|
226
|
-
},
|
|
227
|
-
];
|
|
228
|
-
|
|
229
|
-
for (let i = 0; i < numberElements; i++) {
|
|
230
|
-
const mockedElement = new DYOToolsElement() as Mocked<DYOToolsElement<IMetaDataTest>>;
|
|
231
|
-
const selectedMock = i % 5;
|
|
232
|
-
|
|
233
|
-
mockedElement.getId.mockReturnValue(`${mockedData[selectedMock].id}-${i}`);
|
|
234
|
-
mockedElement.getKey.mockReturnValue(mockedData[selectedMock].key);
|
|
235
|
-
mockedElement.getManyMeta.mockReturnValue(mockedData[selectedMock].meta);
|
|
236
|
-
mockedElement.setContext.mockImplementation(function (context) {
|
|
237
|
-
this._context = context;
|
|
238
|
-
});
|
|
239
|
-
mockedElement.getContext.mockImplementation(function () {
|
|
240
|
-
return this._context;
|
|
241
|
-
});
|
|
242
|
-
mockedElement.setOwner.mockImplementation(function (owner) {
|
|
243
|
-
this._owner = owner;
|
|
244
|
-
});
|
|
245
|
-
mockedElement.getOwner.mockImplementation(function () {
|
|
246
|
-
return this._owner;
|
|
247
|
-
});
|
|
248
|
-
mockedElement.setContainer.mockImplementation(function (container) {
|
|
249
|
-
this._container = container;
|
|
250
|
-
});
|
|
251
|
-
mockedElement.getContainer.mockImplementation(function () {
|
|
252
|
-
return this._container;
|
|
253
|
-
});
|
|
254
|
-
mockedElement.copy.mockReturnValue(mockedElement);
|
|
255
|
-
mockedElement.toObject.mockReturnValue(mockedData[selectedMock].toObject);
|
|
256
|
-
|
|
257
|
-
mockedElements.push(mockedElement);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return mockedElements;
|
|
261
|
-
};
|