octopian-configuration-apis 1.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 (49) hide show
  1. package/README.md +104 -0
  2. package/package.json +18 -0
  3. package/src/CoreServices/configurationServices.js +1501 -0
  4. package/src/CoreServices/darAlBerServices.js +239 -0
  5. package/src/config.js +22 -0
  6. package/src/index.d.ts +908 -0
  7. package/src/index.js +101 -0
  8. package/src/modals/input-modals/CreateNewCorrespondenceInput.ts +7 -0
  9. package/src/modals/input-modals/GetAssetBlazorViewInput.ts +4 -0
  10. package/src/modals/input-modals/GetAssetListInput.ts +8 -0
  11. package/src/modals/input-modals/GetAttributeTypesInput.ts +6 -0
  12. package/src/modals/input-modals/GetDABAssetsInput.ts +4 -0
  13. package/src/modals/input-modals/GetDocumentTypesInput.ts +6 -0
  14. package/src/modals/input-modals/GetInteractorListInput.ts +5 -0
  15. package/src/modals/input-modals/GetItemListInput.ts +8 -0
  16. package/src/modals/input-modals/GetPositionsInput.ts +6 -0
  17. package/src/modals/input-modals/GetRoleListByPermissionInput.ts +13 -0
  18. package/src/modals/input-modals/GetServiceAttributeListInput.ts +8 -0
  19. package/src/modals/input-modals/GetServiceCategoryInput.ts +6 -0
  20. package/src/modals/input-modals/GetServiceListInput.ts +10 -0
  21. package/src/modals/input-modals/GetServiceStepListInput.ts +8 -0
  22. package/src/modals/input-modals/GetServiceSubCategoryInput.ts +7 -0
  23. package/src/modals/input-modals/GetStepTypesInput.ts +7 -0
  24. package/src/modals/input-modals/LoginUserInput.ts +8 -0
  25. package/src/modals/input-modals/MaintainAttributeListInput.ts +6 -0
  26. package/src/modals/input-modals/MaintainAttributeTypeInput.ts +142 -0
  27. package/src/modals/input-modals/MaintainSubCategoryInput.ts +6 -0
  28. package/src/modals/output-modals/BaseResponse.ts +13 -0
  29. package/src/modals/output-modals/GetAssetBlazorViewOutput.ts +11 -0
  30. package/src/modals/output-modals/GetAssetListOutput.ts +92 -0
  31. package/src/modals/output-modals/GetAttributeTypesOutput.ts +37 -0
  32. package/src/modals/output-modals/GetDefaultConfigurationOutput.ts +273 -0
  33. package/src/modals/output-modals/GetDocumentTypesOutput.ts +23 -0
  34. package/src/modals/output-modals/GetInteractorListOutput.ts +81 -0
  35. package/src/modals/output-modals/GetInteractorTypeListOutput.ts +59 -0
  36. package/src/modals/output-modals/GetItemListOutput.ts +92 -0
  37. package/src/modals/output-modals/GetPositionsOutput.ts +10 -0
  38. package/src/modals/output-modals/GetRoleListByPermissionOutput.ts +18 -0
  39. package/src/modals/output-modals/GetServiceAttributeListOutput.ts +95 -0
  40. package/src/modals/output-modals/GetServiceCategoryOutput.ts +62 -0
  41. package/src/modals/output-modals/GetServiceListOutput.ts +183 -0
  42. package/src/modals/output-modals/GetServiceStepListOutput.ts +163 -0
  43. package/src/modals/output-modals/GetServiceSubCategoryOuput.ts +71 -0
  44. package/src/modals/output-modals/GetStepTypesOutput.ts +7 -0
  45. package/src/modals/output-modals/GetUnitListOutput.ts +27 -0
  46. package/src/modals/output-modals/LoginUserOutput.ts +8 -0
  47. package/src/sdkUtilities.js +22 -0
  48. package/src/web-services/apiConstants.js +99 -0
  49. package/src/web-services/apiHandler.js +154 -0
@@ -0,0 +1,239 @@
1
+ import { GetAssetList, GetInteractorTypeList, GetUnitList,GetInteractorList,GetAssetBlazorViewList } from "./configurationServices";
2
+
3
+ export async function GetEnglishNewsList(Input, AuthToken = null, Timeout = 30000) {
4
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
5
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "NewsFeed");
6
+ if (!InteractorType) {
7
+ return {
8
+ StatusCode: 400,
9
+ Result: "InteractorType not found"
10
+ }
11
+ }
12
+ let AssetsList = await GetAssetBlazorViewList({
13
+ interactorTypeId: InteractorType.InteractorTypeId,
14
+ deploymentEnvironment: null
15
+ })
16
+ let News = AssetsList.Result.find(x => x.Alias == "LatestNewsEnglish");
17
+ if (!News) {
18
+ return {
19
+ StatusCode: 400,
20
+ Result: "News not found"
21
+ }
22
+ }
23
+ let NewsAssets = await GetAssetList({
24
+ AssetId: -12345,
25
+ AssetSubGroupId: News.ObjectId,
26
+ ShortcutAssetId: -12345,
27
+ AssetGroupId: -12345,
28
+ PageIndex: Input.PageIndex,
29
+ PageSize: Input.PageSize
30
+ })
31
+ return NewsAssets;
32
+ }
33
+
34
+ export async function GetArabicNewsList(Input, AuthToken = null, Timeout = 30000) {
35
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
36
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "NewsFeed");
37
+ if (!InteractorType) {
38
+ return {
39
+ StatusCode: 400,
40
+ Result: "InteractorType not found"
41
+ }
42
+ }
43
+ let AssetsList = await GetAssetBlazorViewList({
44
+ interactorTypeId: InteractorType.InteractorTypeId,
45
+ deploymentEnvironment: null
46
+ })
47
+ let News = AssetsList.Result.find(x => x.Alias == "LatestNewsEnglish");
48
+ if (!News) {
49
+ return {
50
+ StatusCode: 400,
51
+ Result: "News not found"
52
+ }
53
+ }
54
+ let NewsAssets = await GetAssetList({
55
+ AssetId: -12345,
56
+ AssetSubGroupId: News.ObjectId,
57
+ ShortcutAssetId: -12345,
58
+ AssetGroupId: -12345,
59
+ PageIndex: Input.PageIndex,
60
+ PageSize: Input.PageSize
61
+ })
62
+ return NewsAssets;
63
+ }
64
+
65
+ export async function GetGeneralDonationsList(Input, AuthToken = null, Timeout = 30000) {
66
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
67
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "Donations");
68
+ if (!InteractorType) {
69
+ return {
70
+ StatusCode: 400,
71
+ Result: "InteractorType not found"
72
+ }
73
+ }
74
+ let AssetsList = await GetAssetBlazorViewList({
75
+ interactorTypeId: InteractorType.InteractorTypeId,
76
+ deploymentEnvironment: null
77
+ })
78
+ let GeneralDonations = AssetsList.Result.find(x => x.Alias == "GeneralDonations");
79
+ if (!GeneralDonations) {
80
+ return {
81
+ StatusCode: 400,
82
+ Result: "News not found"
83
+ }
84
+ }
85
+ let GeneralDonationsAssets = await GetAssetList({
86
+ AssetId: -12345,
87
+ AssetSubGroupId: GeneralDonations.ObjectId,
88
+ ShortcutAssetId: -12345,
89
+ AssetGroupId: -12345,
90
+ PageIndex: Input.PageIndex,
91
+ PageSize: Input.PageSize
92
+ })
93
+ return GeneralDonationsAssets;
94
+ }
95
+
96
+ export async function GetQuickDonationsList(Input, AuthToken = null, Timeout = 30000) {
97
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
98
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "Donations");
99
+ if (!InteractorType) {
100
+ return {
101
+ StatusCode: 400,
102
+ Result: "InteractorType not found"
103
+ }
104
+ }
105
+ let AssetsList = await GetAssetBlazorViewList({
106
+ interactorTypeId: InteractorType.InteractorTypeId,
107
+ deploymentEnvironment: null
108
+ })
109
+ let QuickDonations = AssetsList.Result.find(x => x.Alias == "QuickDonations");
110
+ if (!QuickDonations) {
111
+ return {
112
+ StatusCode: 400,
113
+ Result: "News not found"
114
+ }
115
+ }
116
+ let QuickDonationsAssets = await GetAssetList({
117
+ AssetId: -12345,
118
+ AssetSubGroupId: QuickDonations.ObjectId,
119
+ ShortcutAssetId: -12345,
120
+ AssetGroupId: -12345,
121
+ PageIndex: Input.PageIndex,
122
+ PageSize: Input.PageSize
123
+ })
124
+ return QuickDonationsAssets;
125
+ }
126
+
127
+ export async function GetCampaignsList(Input, AuthToken = null, Timeout = 30000) {
128
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
129
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "StaticPages");
130
+ if (!InteractorType) {
131
+ return {
132
+ StatusCode: 400,
133
+ Result: "InteractorType not found"
134
+ }
135
+ }
136
+ let AssetsList = await GetAssetBlazorViewList({
137
+ interactorTypeId: InteractorType.InteractorTypeId,
138
+ deploymentEnvironment: null
139
+ })
140
+ let MainStepper = AssetsList.Result.find(x => x.Alias == "MainStepper");
141
+ if (!MainStepper) {
142
+ return {
143
+ StatusCode: 400,
144
+ Result: "News not found"
145
+ }
146
+ }
147
+ let MainStepperAssets = await GetAssetList({
148
+ AssetId: -12345,
149
+ AssetSubGroupId: MainStepper.ObjectId,
150
+ ShortcutAssetId: -12345,
151
+ AssetGroupId: -12345,
152
+ PageIndex: Input.PageIndex,
153
+ PageSize: Input.PageSize
154
+ })
155
+ return MainStepperAssets;
156
+ }
157
+
158
+ export async function GetBranchesList(Input, AuthToken = null, Timeout = 30000) {
159
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
160
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "StaticPages");
161
+ if (!InteractorType) {
162
+ return {
163
+ StatusCode: 400,
164
+ Result: "InteractorType not found"
165
+ }
166
+ }
167
+ let AssetsList = await GetAssetBlazorViewList({
168
+ interactorTypeId: InteractorType.InteractorTypeId,
169
+ deploymentEnvironment: null
170
+ })
171
+ let Branches = AssetsList.Result.find(x => x.Alias == "OurBranches");
172
+ if (!Branches) {
173
+ return {
174
+ StatusCode: 400,
175
+ Result: "News not found"
176
+ }
177
+ }
178
+ let BranchesAssets = await GetAssetList({
179
+ AssetId: -12345,
180
+ AssetSubGroupId: Branches.ObjectId,
181
+ ShortcutAssetId: -12345,
182
+ AssetGroupId: -12345,
183
+ PageIndex: Input.PageIndex,
184
+ PageSize: Input.PageSize
185
+ })
186
+ return BranchesAssets;
187
+ }
188
+
189
+ export async function GetBanksAccountsList(Input, AuthToken = null, Timeout = 30000) {
190
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
191
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "StaticPages");
192
+ if (!InteractorType) {
193
+ return {
194
+ StatusCode: 400,
195
+ Result: "InteractorType not found"
196
+ }
197
+ }
198
+ let AssetsList = await GetAssetBlazorViewList({
199
+ interactorTypeId: InteractorType.InteractorTypeId,
200
+ deploymentEnvironment: null
201
+ })
202
+ let BankAccounts = AssetsList.Result.find(x => x.Alias == "BankAccounts");
203
+ if (!BankAccounts) {
204
+ return {
205
+ StatusCode: 400,
206
+ Result: "News not found"
207
+ }
208
+ }
209
+ let BankAccountsAssets = await GetAssetList({
210
+ AssetId: -12345,
211
+ AssetSubGroupId: BankAccounts.ObjectId,
212
+ ShortcutAssetId: -12345,
213
+ AssetGroupId: -12345,
214
+ PageIndex: Input.PageIndex,
215
+ PageSize: Input.PageSize
216
+ })
217
+ return BankAccountsAssets;
218
+ }
219
+
220
+ export async function GetInteractorsList(Input, AuthToken = null, Timeout = 30000) {
221
+ let InteractorTypes = await GetInteractorTypeList(-12345,AuthToken,Timeout)
222
+ let InteractorType = InteractorTypes.Result.find(x => x.Alias == "Donator");
223
+ if (!InteractorType) {
224
+ return {
225
+ StatusCode: 400,
226
+ Result: "InteractorType not found"
227
+ }
228
+ }
229
+ let UnitsList = await GetUnitList(InteractorType.InteractorTypeId,AuthToken,Timeout)
230
+ let Unit = UnitsList?.Result?.[0];
231
+ if (!Unit) {
232
+ return {
233
+ StatusCode: 400,
234
+ Result: "Unit not found"
235
+ }
236
+ }
237
+ let InteractorsList = await GetInteractorList({unitId: Unit.UnitId,pageIndex: Input.PageIndex,pageSize: Input.PageSize},AuthToken,Timeout)
238
+ return InteractorsList;
239
+ }
package/src/config.js ADDED
@@ -0,0 +1,22 @@
1
+ // config.js
2
+ class Config {
3
+ constructor() {
4
+ this.settings = {};
5
+ }
6
+
7
+ setConfig(APIKey, DomainName) {
8
+ this.settings["APIKey"] = APIKey;
9
+ this.settings["DomainName"] = DomainName;
10
+ this.settings["Token"] = null;
11
+
12
+ }
13
+ setToken(AuthToken) {
14
+ this.settings["Token"] = AuthToken;
15
+ }
16
+ getConfig(key) {
17
+ return key ? this.settings[key] : this.settings;
18
+ }
19
+ }
20
+
21
+ // Export a single instance of the Config class
22
+ module.exports = new Config();