complexqa_frontend_core 1.0.9 → 1.0.10

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.
Files changed (51) hide show
  1. package/package.json +3 -3
  2. package/publish/api/api_abstract_element_class.js +426 -0
  3. package/publish/api/functional_api.js +18 -0
  4. package/publish/api/index.js +114 -0
  5. package/publish/api/project_api.js +17 -0
  6. package/publish/api/service_api.js +20 -0
  7. package/publish/api/team_member_api.js +18 -0
  8. package/publish/api/test_case_api.js +18 -0
  9. package/publish/api/test_case_step_api.js +18 -0
  10. package/publish/api/test_plan_api.js +18 -0
  11. package/publish/api/test_run_api.js +13 -0
  12. package/publish/api/test_run_result_api.js +18 -0
  13. package/publish/api/test_suite_api.js +18 -0
  14. package/publish/exceptions/ApiException.js +69 -0
  15. package/publish/index.js +50 -0
  16. package/publish/services/UserService.js +129 -0
  17. package/publish/services/abstractService.js +36 -0
  18. package/publish/services/mock_data/MockUserService.js +30 -0
  19. package/publish/services/serviceTranslate.js +98 -0
  20. package/publish/types/family_elements/0_familyGeneralElement.js +439 -0
  21. package/publish/types/family_elements/mock_data/abstract_mock_data.js +13 -0
  22. package/publish/types/family_elements/mock_data/mock_data_typeProject.js +88 -0
  23. package/publish/types/family_elements/typeActionLog.js +9 -0
  24. package/publish/types/family_elements/typeFunctional.js +96 -0
  25. package/publish/types/family_elements/typeFunctionalGroup.js +95 -0
  26. package/publish/types/family_elements/typeMilestone.js +93 -0
  27. package/publish/types/family_elements/typeProject.js +114 -0
  28. package/publish/types/family_elements/typeProjectDocument.js +80 -0
  29. package/publish/types/family_elements/typeProjectTestAccount.js +59 -0
  30. package/publish/types/family_elements/typeProjectTestData.js +43 -0
  31. package/publish/types/family_elements/typeProjectUserRole.js +55 -0
  32. package/publish/types/family_elements/typeTask.js +78 -0
  33. package/publish/types/family_elements/typeTeam.js +105 -0
  34. package/publish/types/family_elements/typeTeamMember.js +58 -0
  35. package/publish/types/family_elements/typeTeamUserRole.js +56 -0
  36. package/publish/types/family_elements/typeTestCase.js +98 -0
  37. package/publish/types/family_elements/typeTestCaseStep.js +87 -0
  38. package/publish/types/family_elements/typeTestPlan.js +35 -0
  39. package/publish/types/family_elements/typeTestRun.js +56 -0
  40. package/publish/types/family_elements/typeTestRunResult.js +72 -0
  41. package/publish/types/family_elements/typeTestSuite.js +75 -0
  42. package/publish/types/family_elements/typeUser.js +56 -0
  43. package/publish/types/family_service/familyService.js +8 -0
  44. package/publish/types/family_service/typeAppConfiguration.js +39 -0
  45. package/publish/types/family_service/typeFOR.js +36 -0
  46. package/publish/types/family_service/typeFilter.js +38 -0
  47. package/publish/types/family_service/typeFunctionCallback.js +40 -0
  48. package/publish/types/family_service/typeNotification.js +36 -0
  49. package/publish/types/family_service/typeTableColumn.js +37 -0
  50. package/publish/types/family_service/typeTableConfiguration.js +56 -0
  51. package/publish/utils/utils.js +190 -0
@@ -0,0 +1,18 @@
1
+ import { ApiAbstractElementClass } from "./api_abstract_element_class";
2
+ import { typeTestRunResult } from "../types/family_elements/typeTestRunResult";
3
+
4
+
5
+ /**
6
+ *
7
+ * @version v.0.1 (24/11/2024)
8
+ */
9
+ export class TestRunResultApi extends ApiAbstractElementClass
10
+ {
11
+ module_prefix = 'test_run_result';
12
+
13
+ constructor(options)
14
+ {
15
+ super(options);
16
+ this.set_element_class_instance(typeTestRunResult);
17
+ }
18
+ }
@@ -0,0 +1,18 @@
1
+ import { ApiAbstractElementClass } from "./api_abstract_element_class";
2
+ import { typeTestSuite } from "../types/family_elements/typeTestSuite";
3
+
4
+
5
+ /**
6
+ *
7
+ * @version v.0.1 (24/11/2024)
8
+ */
9
+ export class TestSuiteApi extends ApiAbstractElementClass
10
+ {
11
+ module_prefix = 'test_suite';
12
+
13
+ constructor(options)
14
+ {
15
+ super(options);
16
+ this.set_element_class_instance(typeTestSuite);
17
+ }
18
+ }
@@ -0,0 +1,69 @@
1
+ export class ApiException extends Error
2
+ {
3
+ /**
4
+ * Сообщение об ошибке
5
+ * @type {string}
6
+ */
7
+ #message = '';
8
+ /**
9
+ * Нативная ошибка
10
+ * @type {null|Error}
11
+ */
12
+ #error = null;
13
+
14
+
15
+ api_response = null;
16
+ api_code = null;
17
+ api_result = null;
18
+ api_error = null;
19
+
20
+
21
+ constructor(options)
22
+ {
23
+ super();
24
+
25
+ if (options.message)
26
+ {
27
+ this.#message = options.message;
28
+ }
29
+
30
+ if (options.error instanceof Error)
31
+ {
32
+ this.#error = options.error;
33
+ }
34
+
35
+
36
+ if (options?.api_response)
37
+ {
38
+ this.api_response = options?.api_response;
39
+ }
40
+
41
+ if (options?.api_code)
42
+ {
43
+ this.api_code = options?.api_code;
44
+ }
45
+
46
+ if (options?.api_result)
47
+ {
48
+ this.api_result = options?.api_result;
49
+ }
50
+
51
+ if (options?.api_error)
52
+ {
53
+ this.api_error = options?.api_error;
54
+ }
55
+ }
56
+
57
+
58
+ get_message()
59
+ {
60
+ if (this.#error instanceof Error)
61
+ {
62
+ return this.#error.message;
63
+ }
64
+ else
65
+ {
66
+ return this.#message;
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,50 @@
1
+ import { serviceTranslate } from "./services/serviceTranslate";
2
+
3
+ export { typeFilter } from './types/family_service/typeFilter.js';
4
+ export { typeFOR } from './types/family_service/typeFOR.js';
5
+ export { typeProject } from './types/family_elements/typeProject.js';
6
+ export { typeTestCase } from './types/family_elements/typeTestCase.js';
7
+ export { typeTestCaseStep } from './types/family_elements/typeTestCaseStep.js';
8
+
9
+ export { Api } from './api'
10
+
11
+
12
+ /**
13
+ *
14
+ * @version v.0.1 (21/06/2025)
15
+ */
16
+ export class App
17
+ {
18
+
19
+ init_options = false;
20
+
21
+ /**
22
+ *
23
+ * @version v.0.1 (25/06/2024)
24
+ */
25
+ constructor(init_options)
26
+ {
27
+
28
+ if (this.constructor._instance)
29
+ {
30
+ return this.constructor._instance;
31
+ }
32
+
33
+ this.init_options = init_options;
34
+ this.constructor._instance = this;
35
+
36
+ this.#bootstrap();
37
+
38
+ return this.constructor._instance;
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @version v.0.1 (25/06/2024)
44
+ */
45
+ #bootstrap()
46
+ {
47
+ this.service = {};
48
+ this.service.translate = new serviceTranslate();
49
+ }
50
+ }
@@ -0,0 +1,129 @@
1
+ import { abstractService } from "./abstractService";
2
+ import { MockUserService } from "./mock_data/MockUserService";
3
+
4
+ /**
5
+ *
6
+ * @version v.1.0 (18/11/2024)
7
+ */
8
+ export class UserService extends abstractService
9
+ {
10
+
11
+ static current_user_id = false;
12
+ static user_name = false;
13
+ static current_team_id = false;
14
+ static current_team_slug = false;
15
+ static user_teams = false;
16
+ static roles = [ 'guest' ];
17
+ static current_language = 'en';
18
+ static csrf_token = false;
19
+
20
+
21
+ /**
22
+ *
23
+ *
24
+ * @version v.1.0 (18/11/2024)
25
+ *
26
+ * @param init_options
27
+ * @returns {*}
28
+ */
29
+ constructor(init_options = false)
30
+ {
31
+ super();
32
+ if (this.constructor._instance)
33
+ {
34
+ return this.constructor._instance;
35
+ }
36
+
37
+ this.init_options = init_options;
38
+
39
+ this.constructor._instance = this;
40
+ }
41
+
42
+ static mock()
43
+ {
44
+ MockUserService.mock_attributes.map((row) =>
45
+ {
46
+ UserService[ row.key ] = row.value;
47
+ });
48
+ }
49
+
50
+ static get_csrf_token()
51
+ {
52
+ return UserService.csrf_token;
53
+ }
54
+
55
+ static set_csrf_token(csrf_token)
56
+ {
57
+ UserService.csrf_token = csrf_token;
58
+ }
59
+
60
+ static get_current_user_id()
61
+ {
62
+ return UserService.current_user_id;
63
+ }
64
+
65
+ static set_current_user_id(current_user_id)
66
+ {
67
+ UserService.current_user_id = current_user_id;
68
+ }
69
+
70
+ static get_current_team_slug()
71
+ {
72
+ return UserService.current_team_slug;
73
+ }
74
+
75
+ static set_current_team_slug(current_team_slug)
76
+ {
77
+ UserService.current_team_slug = current_team_slug;
78
+ }
79
+
80
+ static get_user_name()
81
+ {
82
+ return UserService.user_name;
83
+ }
84
+
85
+ static set_user_name(user_name)
86
+ {
87
+ UserService.user_name = user_name;
88
+ }
89
+
90
+ static get_current_team_id()
91
+ {
92
+ return UserService.current_team_id;
93
+ }
94
+
95
+ static set_current_team_id(current_team_id)
96
+ {
97
+ UserService.current_team_id = current_team_id;
98
+ }
99
+
100
+ static get_user_teams()
101
+ {
102
+ return UserService.user_teams;
103
+ }
104
+
105
+ static set_user_teams(user_teams)
106
+ {
107
+ UserService.user_teams = user_teams;
108
+ }
109
+
110
+ static get_roles()
111
+ {
112
+ return UserService.roles;
113
+ }
114
+
115
+ static get_roles(roles)
116
+ {
117
+ UserService.roles = roles;
118
+ }
119
+
120
+ static get_current_language()
121
+ {
122
+ return UserService.current_language;
123
+ }
124
+
125
+ static set_current_language(current_language)
126
+ {
127
+ UserService.current_language = current_language;
128
+ }
129
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ *
3
+ * @version v.0.1 (25/06/2024)
4
+ */
5
+ export class abstractService
6
+ {
7
+ init_options = false;
8
+
9
+
10
+ /**
11
+ *
12
+ * @param init_options
13
+ */
14
+ constructor(init_options = false)
15
+ {
16
+ /*if (this.constructor._instance)
17
+ {
18
+ return this.constructor._instance;
19
+ }
20
+
21
+ this.init_options = init_options;
22
+
23
+ this.constructor._instance = this;*/
24
+ }
25
+
26
+
27
+ static mock()
28
+ {
29
+
30
+ }
31
+
32
+ /*#bootstrap()
33
+ {
34
+
35
+ }*/
36
+ }
@@ -0,0 +1,30 @@
1
+ export class MockUserService
2
+ {
3
+ static mock_attributes = [ {
4
+ key : 'current_user_id',
5
+ value: 999999
6
+ }, {
7
+ key : 'user_name',
8
+ value: 'Local User Name'
9
+ }, {
10
+ key : 'current_team_id',
11
+ value: 99999999
12
+ }, {
13
+ key : 'current_team_slug',
14
+ value: 'mock_team'
15
+ }, {
16
+ key : 'user_teams',
17
+ value: [ 'mock_team' ]
18
+ }, {
19
+ key : 'roles',
20
+ value: [ 'guest' ]
21
+ }, {
22
+ key : 'current_language',
23
+ value: 'en'
24
+ }, {
25
+ key : 'csrf_token',
26
+ value: 'as89as98asd098asd98'
27
+ },
28
+ ];
29
+
30
+ }
@@ -0,0 +1,98 @@
1
+ import { abstractService } from "./abstractService";
2
+ import i18next from 'i18next';
3
+ import { Api } from "../api";
4
+
5
+ /**
6
+ *
7
+ * @version v.0.1 (25/06/2024)
8
+ */
9
+ export class serviceTranslate extends abstractService
10
+ {
11
+ #language = 'en';
12
+ #available_language = [ 'ru', 'en' ];
13
+ #dictionary = false; // может сделать сторадж отдельно и static ?
14
+ #vendor_instance;
15
+
16
+
17
+ /**
18
+ *
19
+ * @version v.0.1 (25/06/2024)
20
+ * @param {?object} init_options
21
+ * @returns {serviceTranslate}
22
+ */
23
+ constructor(init_options = false)
24
+ {
25
+ super(init_options);
26
+
27
+ if (init_options?.language)
28
+ {
29
+ if (in_array(init_options?.language, this.#available_language))
30
+ {
31
+ this.#language = init_options?.language;
32
+ }
33
+ else
34
+ {
35
+ echo({ init_options });
36
+ throw new Error('Unsupported language');
37
+ }
38
+ }
39
+
40
+ if (this.constructor._instance)
41
+ {
42
+ return this.constructor._instance;
43
+ }
44
+
45
+ this.init_options = init_options;
46
+ this.constructor._instance = this;
47
+
48
+ this.#bootstrap();
49
+
50
+ return this.constructor._instance;
51
+ }
52
+
53
+
54
+ /**
55
+ *
56
+ * @version v.0.1 (25/06/2024)
57
+ * @param api_response
58
+ */
59
+ #api_response_parser(api_response)
60
+ {
61
+
62
+ // заготовка
63
+ return api_response;
64
+ }
65
+
66
+
67
+ /**
68
+ *
69
+ * @version v.0.1 (25/06/2024)
70
+ */
71
+ async #bootstrap()
72
+ {
73
+ this.#dictionary = await Api.service.translate_get_dictionaries();
74
+
75
+ let normalize_response = this.#api_response_parser(this.#dictionary);
76
+
77
+
78
+ await i18next.init({
79
+ lng : this.#language,
80
+ debug : false,
81
+ resources: normalize_response
82
+ });
83
+
84
+ this.#vendor_instance = i18next;
85
+ }
86
+
87
+
88
+ /**
89
+ *
90
+ * @version v.0.1 (25/06/2024)
91
+ * @param group
92
+ * @param key
93
+ */
94
+ get(group, key)
95
+ {
96
+ return this.#vendor_instance.t(group + '.' + key);
97
+ }
98
+ }