@techextensor/tab-sdk 0.0.0

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 (50) hide show
  1. package/.editorconfig +16 -0
  2. package/.vscode/extensions.json +6 -0
  3. package/.vscode/launch.json +20 -0
  4. package/.vscode/tasks.json +42 -0
  5. package/README.md +27 -0
  6. package/documents/LibraryCreationGuide.md +82 -0
  7. package/documents/Method Access/analytics.md +6 -0
  8. package/documents/Method Access/app.md +22 -0
  9. package/documents/Method Access/auth.md +14 -0
  10. package/documents/Method Access/crud.md +17 -0
  11. package/documents/Method Access/file.md +5 -0
  12. package/documents/Method Access/form.md +14 -0
  13. package/documents/Method Access/http.md +4 -0
  14. package/documents/Method Access/metadata-utils.md +62 -0
  15. package/documents/Method Access/release.md +5 -0
  16. package/documents/Method Access/report.md +6 -0
  17. package/documents/Method Access/store.md +75 -0
  18. package/documents/Method Access/transition.md +5 -0
  19. package/documents/Method Access/translator.md +16 -0
  20. package/documents/Method Access/ui-actions.md +22 -0
  21. package/nx.json +35 -0
  22. package/package.json +46 -0
  23. package/projects/tab-sdk/README.md +24 -0
  24. package/projects/tab-sdk/ng-package.json +7 -0
  25. package/projects/tab-sdk/package.json +19 -0
  26. package/projects/tab-sdk/project.json +37 -0
  27. package/projects/tab-sdk/src/lib/app/analytics.service.ts +54 -0
  28. package/projects/tab-sdk/src/lib/app/app.service.ts +188 -0
  29. package/projects/tab-sdk/src/lib/app/file.service.ts +92 -0
  30. package/projects/tab-sdk/src/lib/app/release.service.ts +38 -0
  31. package/projects/tab-sdk/src/lib/app/report.service.ts +51 -0
  32. package/projects/tab-sdk/src/lib/app/translator.service.ts +80 -0
  33. package/projects/tab-sdk/src/lib/auth/auth.service.ts +119 -0
  34. package/projects/tab-sdk/src/lib/crud/crud.service.ts +187 -0
  35. package/projects/tab-sdk/src/lib/enum/store.enum.ts +4 -0
  36. package/projects/tab-sdk/src/lib/enum/ui.enum.ts +11 -0
  37. package/projects/tab-sdk/src/lib/http/http.service.ts +63 -0
  38. package/projects/tab-sdk/src/lib/interface/http.interface.ts +8 -0
  39. package/projects/tab-sdk/src/lib/interface/ui.interface.ts +28 -0
  40. package/projects/tab-sdk/src/lib/store/store.service.ts +831 -0
  41. package/projects/tab-sdk/src/lib/tab-sdk.service.ts +84 -0
  42. package/projects/tab-sdk/src/lib/ui/form.service.ts +92 -0
  43. package/projects/tab-sdk/src/lib/ui/ui.service.ts +404 -0
  44. package/projects/tab-sdk/src/lib/util/util.service.ts +53 -0
  45. package/projects/tab-sdk/src/lib/workflow/transition.service.ts +40 -0
  46. package/projects/tab-sdk/src/public-api.ts +10 -0
  47. package/projects/tab-sdk/tsconfig.lib.json +15 -0
  48. package/projects/tab-sdk/tsconfig.lib.prod.json +11 -0
  49. package/projects/tab-sdk/tsconfig.spec.json +15 -0
  50. package/tsconfig.json +37 -0
@@ -0,0 +1,187 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { APISelectQuery, CommonApiResponse, DeletePayload, GetPayload, InsertPayload, UpdatePayload, ImprotDataPayload, RcordHistoryPayload, SearchDataPayload, TabCrudService, TabGetService } from '@techextensor/tab-core-utility';
3
+ import { firstValueFrom } from 'rxjs';
4
+
5
+ @Injectable({
6
+ providedIn: 'root'
7
+ })
8
+ export class CrudService {
9
+ private readonly _tabCrudService: TabCrudService = inject(TabCrudService);
10
+ private readonly _tabGetService: TabGetService = inject(TabGetService);
11
+
12
+ /**
13
+ * Retrieves a record from the database using the provided payload.
14
+ *
15
+ * @param payload - The payload containing information to retrieve the record.
16
+ * @param headers - Optional headers to pass to the server.
17
+ * @returns A promise that resolves to a common API response containing the retrieved record.
18
+ */
19
+ async executeDsq(payload: GetPayload, headers?: any): Promise<CommonApiResponse> {
20
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
21
+ const response = await firstValueFrom(
22
+ this._tabCrudService.get(payload, headers)
23
+ );
24
+
25
+ // Return the response from the server
26
+ return response;
27
+ }
28
+
29
+ /**
30
+ * Inserts a record into the database using the provided payload.
31
+ *
32
+ * @param payload - The payload containing information to insert the record.
33
+ * @param headers - Optional headers to pass to the server.
34
+ * @returns A promise that resolves to a common API response containing the inserted record.
35
+ */
36
+ async insert(payload: InsertPayload, headers?: any): Promise<CommonApiResponse> {
37
+ const response = await firstValueFrom(
38
+ // Call the insert method of the TabCrudService and pass the payload and headers
39
+ this._tabCrudService.insert(payload, headers)
40
+ );
41
+
42
+ // Return the response from the server
43
+ return response;
44
+ }
45
+
46
+ /**
47
+ * Updates a record in the database using the provided payload.
48
+ *
49
+ * @param payload - The payload containing information to update the record.
50
+ * @param headers - Optional headers to pass to the server.
51
+ * @returns A promise that resolves to a common API response containing the updated record.
52
+ */
53
+ async update(payload: UpdatePayload, headers?: any): Promise<CommonApiResponse> {
54
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
55
+ const response = await firstValueFrom(
56
+ this._tabCrudService.update(payload, headers)
57
+ );
58
+
59
+ // Return the response from the server
60
+ return response;
61
+ }
62
+
63
+ /**
64
+ * Deletes a record from the database using the provided payload.
65
+ *
66
+ * @param payload - The payload containing information to delete the record.
67
+ * @param headers - Optional headers to pass to the server.
68
+ * @returns A promise that resolves to a common API response containing the deleted record.
69
+ */
70
+ async delete(payload: DeletePayload, headers?: any): Promise<CommonApiResponse> {
71
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
72
+ const response = await firstValueFrom(
73
+ // Call the delete method of the TabCrudService and pass the payload and headers
74
+ this._tabCrudService.delete(payload, headers)
75
+ );
76
+
77
+ // Return the response from the server
78
+ return response;
79
+ }
80
+
81
+ /**
82
+ * Executes a stored procedure using the provided payload.
83
+ *
84
+ * @param sp - The name of the stored procedure to execute.
85
+ * @param headers - Optional headers to pass to the server.
86
+ * @returns A promise that resolves to a common API response containing the result of executing the stored procedure.
87
+ */
88
+ async executeSp(sp: string, headers?: any): Promise<CommonApiResponse> {
89
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
90
+ const response = await firstValueFrom(
91
+ // Call the executeSp method of the TabCrudService and pass the name of the stored procedure and headers
92
+ this._tabCrudService.executeSp(sp, headers)
93
+ );
94
+
95
+ // Return the response from the server
96
+ return response;
97
+ }
98
+
99
+ /**
100
+ * Executes a select query using the provided select query ID.
101
+ *
102
+ * @param selectQueryId - The ID of the select query to execute.
103
+ * @param parameters - Optional parameters to pass to the select query.
104
+ * @returns A promise that resolves to a common API response containing the result of executing the select query.
105
+ */
106
+ async executeSelectQuery(selectQueryId: string, parameters?: any): Promise<CommonApiResponse> {
107
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
108
+ const response = await firstValueFrom(
109
+ // Call the executeSelectQueryById method of the TabGetService and pass the ID of the select query and parameters
110
+ this._tabGetService.executeSelectQueryById(selectQueryId, parameters)
111
+ );
112
+
113
+ // Return the response from the server
114
+ return response;
115
+ }
116
+
117
+ /**
118
+ * Executes a select query using the provided select query data.
119
+ *
120
+ * @param data - The select query data.
121
+ * @param parameters - Optional parameters to pass to the select query.
122
+ * @returns A promise that resolves to a common API response containing the result of executing the select query.
123
+ */
124
+ async executeSelectExecutor(data: APISelectQuery, parameters?: any): Promise<CommonApiResponse> {
125
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
126
+ const response = await firstValueFrom(
127
+ // Call the selectExecutor method of the TabGetService and pass the select query data and parameters
128
+ this._tabGetService.selectExecutor(data, parameters)
129
+ );
130
+
131
+ // Return the response from the server
132
+ return response;
133
+ }
134
+
135
+ /**
136
+ * Gets the search data using the provided search query and limit.
137
+ *
138
+ * @param searchQuery - The search query to search for.
139
+ * @param limit - The number of records to limit the results to.
140
+ * @param parameters - Optional parameters to pass to the search query.
141
+ * @returns A promise that resolves to a common API response containing the search data.
142
+ */
143
+ async getSearchData(payload: SearchDataPayload, parameters?: any): Promise<CommonApiResponse> {
144
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
145
+ const response = await firstValueFrom(
146
+ // Call the getSearchData method of the TabGetService and pass the search query and limit
147
+ this._tabGetService.getSearchData(payload, parameters)
148
+ );
149
+
150
+ // Return the response from the server
151
+ return response;
152
+ }
153
+
154
+ /**
155
+ * Retrieves the history of records for a specified app object.
156
+ *
157
+ * @param appObjectId - The ID of the app object to retrieve the record history for.
158
+ * @param recordIds - An array of record IDs to retrieve the history for.
159
+ * @returns A promise that resolves to a common API response containing the record history.
160
+ */
161
+ async getRecordHistory(payload: RcordHistoryPayload): Promise<CommonApiResponse> {
162
+ // Use the firstValueFrom RxJs operator to wait for the observable to complete
163
+ const response = await firstValueFrom(
164
+ // Call the getHistory method of the TabGetService and pass the app object ID and record IDs
165
+ this._tabGetService.getHistory(payload)
166
+ );
167
+
168
+ // Return the response from the server
169
+ return response;
170
+ }
171
+
172
+ /**
173
+ * Imports data into the database.
174
+ *
175
+ * @param data - The data to import.
176
+ * @returns A promise that resolves to a common API response containing the result of importing the data.
177
+ */
178
+ async import(payload: ImprotDataPayload): Promise<any> {
179
+ const response = await firstValueFrom(
180
+ // Call the pmjayImport method of the TabGetService and pass the data to import
181
+ this._tabGetService.pmjayImport(payload)
182
+ );
183
+
184
+ // Return the response from the server
185
+ return response;
186
+ }
187
+ }
@@ -0,0 +1,4 @@
1
+ export enum StorageType {
2
+ Local = 'local',
3
+ Session = 'session'
4
+ }
@@ -0,0 +1,11 @@
1
+ export enum ScreenDisplayMode {
2
+ Sidebar = 'sidebar',
3
+ Popup = 'popup',
4
+ SameTab = 'sameTab',
5
+ NewTab = 'newTab',
6
+ }
7
+
8
+ export enum NavigationType {
9
+ NavigateToUrl = 'navigateToUrl',
10
+ NavigateToSubdomain = 'navigateToSubdomain'
11
+ }
@@ -0,0 +1,63 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { HttpExecuteRequestPayload, TabGetService } from '@techextensor/tab-core-utility';
3
+ import { firstValueFrom } from 'rxjs';
4
+ import { TabSdk } from '../tab-sdk.service';
5
+ import { RequestStatus } from '../interface/http.interface';
6
+
7
+ @Injectable({
8
+ providedIn: 'root'
9
+ })
10
+ export class HttpService {
11
+ private readonly _tabGetService: TabGetService = inject(TabGetService);
12
+
13
+ /**
14
+ * Executes an HTTP request using the provided payload.
15
+ *
16
+ * @param payload - The payload containing information to execute the HTTP request.
17
+ * @returns A promise that resolves to the response from the server.
18
+ */
19
+ async executeRequest(payload: HttpExecuteRequestPayload): Promise<any> {
20
+ // Await the response from the executeHttpRequest method of the TabGetService
21
+ const response = await firstValueFrom(
22
+ this._tabGetService.executeHttpRequest(payload)
23
+ );
24
+
25
+ // Return the response from the server
26
+ return response;
27
+ }
28
+
29
+ /**
30
+ * Generates an HTTP request for the given data source query name.
31
+ *
32
+ * @param dataSourceQueryName - The name of the data source query for which to generate the HTTP request.
33
+ * @returns A promise that resolves to the generated HTTP request.
34
+ */
35
+ async generateRequest(dataSourceQueryName: string): Promise<any> {
36
+ // Await the response from the generateHttpRequest method of the TabGetService
37
+ const response = await firstValueFrom(
38
+ this._tabGetService.generateHttpRequest(dataSourceQueryName)
39
+ );
40
+
41
+ // Return the generated HTTP request
42
+ return response;
43
+ }
44
+
45
+ /**
46
+ * Sets the request status for the given URL.
47
+ *
48
+ * @param status - The request status to set.
49
+ */
50
+ setRequestStatus(status: RequestStatus): void {
51
+ TabSdk.util?.setLatestStatus(status);
52
+ }
53
+
54
+ /**
55
+ * Gets the request status for the given URL.
56
+ *
57
+ * @param url - The URL for which to get the request status.
58
+ * @returns The request status for the given URL.
59
+ */
60
+ getRequestStatus(url: string): RequestStatus | undefined {
61
+ return TabSdk.util?.getLatestStatus(url);
62
+ }
63
+ }
@@ -0,0 +1,8 @@
1
+ export interface RequestStatus {
2
+ url: string;
3
+ status: string;
4
+ statusCode: number;
5
+ executionTime: number;
6
+ error?: string;
7
+ size: string;
8
+ }
@@ -0,0 +1,28 @@
1
+ import { ScreenDisplayMode } from "../enum/ui.enum";
2
+
3
+ export interface BaseScreenOptions {
4
+ screenId: string;
5
+ reqtokens?: any;
6
+ submission?: any;
7
+ title?: string;
8
+ width?: string | number;
9
+ height?: string | number;
10
+ customClass?: string;
11
+ refresher?: (data: any) => void;
12
+ closer?: (data: any) => void;
13
+ }
14
+
15
+ export interface ScreenOpenOptions extends BaseScreenOptions {
16
+ mode: ScreenDisplayMode;
17
+ }
18
+
19
+ export interface NavigationOptions {
20
+ screenId: string;
21
+ reqtokens?: Record<string, any>;
22
+ }
23
+
24
+ export interface NavigateToSubdomainOptions {
25
+ subDomain: string;
26
+ appCode: string;
27
+ url?: string;
28
+ }