@infosel-sdk/markets 1.2.0 → 1.2.4

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 (130) hide show
  1. package/CHANGELOG.md +94 -1
  2. package/package.json +2 -2
  3. package/src/__tests__/__mocks__/core/auth-provider.mock.d.ts +28 -0
  4. package/src/__tests__/__mocks__/core/auth-provider.mock.js +23 -1
  5. package/src/__tests__/__mocks__/core/auth-provider.mock.js.map +1 -1
  6. package/src/__tests__/__mocks__/core/sdk-manager.mock.d.ts +52 -0
  7. package/src/__tests__/__mocks__/core/sdk-manager.mock.js +13 -1
  8. package/src/__tests__/__mocks__/core/sdk-manager.mock.js.map +1 -1
  9. package/src/__tests__/e2e/config/auth.config.js +1 -1
  10. package/src/__tests__/e2e/config/auth.config.js.map +1 -1
  11. package/src/__tests__/utils/mock-repository.js +1 -0
  12. package/src/__tests__/utils/mock-repository.js.map +1 -1
  13. package/src/__tests__/utils/test-helpers.d.ts +9 -0
  14. package/src/__tests__/utils/test-helpers.js +41 -1
  15. package/src/__tests__/utils/test-helpers.js.map +1 -1
  16. package/src/data/datasources/markets_datasource_impl.d.ts +13 -0
  17. package/src/data/datasources/markets_datasource_impl.js +528 -17
  18. package/src/data/datasources/markets_datasource_impl.js.map +1 -1
  19. package/src/data/di/infosel_markets_component.d.ts +20 -0
  20. package/src/data/di/infosel_markets_component.js +62 -0
  21. package/src/data/di/infosel_markets_component.js.map +1 -1
  22. package/src/data/mappers/markets_mapper.js +98 -6
  23. package/src/data/mappers/markets_mapper.js.map +1 -1
  24. package/src/data/models/get_user_workspaces_response_model.d.ts +2 -0
  25. package/src/data/models/instrument_fields_model.d.ts +10 -0
  26. package/src/data/models/search_instrument_model.d.ts +29 -0
  27. package/src/data/models/search_instrument_model.js +3 -0
  28. package/src/data/models/search_instrument_model.js.map +1 -0
  29. package/src/data/models/user_widgets_response_model.d.ts +7 -0
  30. package/src/data/models/user_widgets_response_model.js +3 -0
  31. package/src/data/models/user_widgets_response_model.js.map +1 -0
  32. package/src/data/models/widget_brokerage_concentration_configuration.d.ts +4 -0
  33. package/src/data/models/widget_brokerage_concentration_configuration.js +3 -0
  34. package/src/data/models/widget_brokerage_concentration_configuration.js.map +1 -0
  35. package/src/data/models/widget_brokerage_participation_configuration.d.ts +10 -0
  36. package/src/data/models/widget_brokerage_participation_configuration.js +3 -0
  37. package/src/data/models/widget_brokerage_participation_configuration.js.map +1 -0
  38. package/src/data/models/widget_brokerage_trades_configuration.d.ts +11 -0
  39. package/src/data/models/widget_brokerage_trades_configuration.js +3 -0
  40. package/src/data/models/widget_brokerage_trades_configuration.js.map +1 -0
  41. package/src/data/models/widget_chart_configuration_model.d.ts +4 -0
  42. package/src/data/models/widget_chart_configuration_model.js +3 -0
  43. package/src/data/models/widget_chart_configuration_model.js.map +1 -0
  44. package/src/data/models/widget_decreed_search_configuration.d.ts +10 -0
  45. package/src/data/models/widget_decreed_search_configuration.js +3 -0
  46. package/src/data/models/widget_decreed_search_configuration.js.map +1 -0
  47. package/src/data/models/widget_dynamic_table_configuration.d.ts +14 -0
  48. package/src/data/models/widget_dynamic_table_configuration.js +3 -0
  49. package/src/data/models/widget_dynamic_table_configuration.js.map +1 -0
  50. package/src/data/models/widget_indices_components_configuration.d.ts +7 -0
  51. package/src/data/models/widget_indices_components_configuration.js +3 -0
  52. package/src/data/models/widget_indices_components_configuration.js.map +1 -0
  53. package/src/data/models/widget_market_total_configuration.d.ts +4 -0
  54. package/src/data/models/widget_market_total_configuration.js +3 -0
  55. package/src/data/models/widget_market_total_configuration.js.map +1 -0
  56. package/src/data/models/widget_model.d.ts +18 -0
  57. package/src/data/models/widget_size_model.d.ts +5 -0
  58. package/src/data/models/widget_traded_packages_configuration.d.ts +4 -0
  59. package/src/data/models/widget_traded_packages_configuration.js +3 -0
  60. package/src/data/models/widget_traded_packages_configuration.js.map +1 -0
  61. package/src/data/repositories/markets_repository_impl.d.ts +13 -0
  62. package/src/data/repositories/markets_repository_impl.js +21 -0
  63. package/src/data/repositories/markets_repository_impl.js.map +1 -1
  64. package/src/domain/datasources/markets_datasource.d.ts +13 -0
  65. package/src/domain/di/markets_component.d.ts +13 -0
  66. package/src/domain/entities/chart_configuration.d.ts +5 -0
  67. package/src/domain/entities/chart_configuration.js +3 -0
  68. package/src/domain/entities/chart_configuration.js.map +1 -0
  69. package/src/domain/entities/create_widget_request.d.ts +32 -6
  70. package/src/domain/entities/duplicate_widget_request.d.ts +5 -0
  71. package/src/domain/entities/duplicate_widget_request.js +3 -0
  72. package/src/domain/entities/duplicate_widget_request.js.map +1 -0
  73. package/src/domain/entities/duplicate_workspace_request.d.ts +5 -0
  74. package/src/domain/entities/duplicate_workspace_request.js +3 -0
  75. package/src/domain/entities/duplicate_workspace_request.js.map +1 -0
  76. package/src/domain/entities/get_user_widgets_request.d.ts +3 -0
  77. package/src/domain/entities/get_user_widgets_request.js +3 -0
  78. package/src/domain/entities/get_user_widgets_request.js.map +1 -0
  79. package/src/domain/entities/index.d.ts +8 -0
  80. package/src/domain/entities/index.js +8 -0
  81. package/src/domain/entities/index.js.map +1 -1
  82. package/src/domain/entities/instrument_fields.d.ts +10 -0
  83. package/src/domain/entities/news_configuration.d.ts +8 -0
  84. package/src/domain/entities/news_configuration.js +3 -0
  85. package/src/domain/entities/news_configuration.js.map +1 -0
  86. package/src/domain/entities/search_instruments_request.d.ts +3 -1
  87. package/src/domain/entities/search_result_item.d.ts +26 -0
  88. package/src/domain/entities/update_widget_chart_request.d.ts +4 -0
  89. package/src/domain/entities/update_widget_chart_request.js +3 -0
  90. package/src/domain/entities/update_widget_chart_request.js.map +1 -0
  91. package/src/domain/entities/update_workspace_request.d.ts +19 -0
  92. package/src/domain/entities/update_workspace_request.js +3 -0
  93. package/src/domain/entities/update_workspace_request.js.map +1 -0
  94. package/src/domain/entities/user_widgets.d.ts +5 -0
  95. package/src/domain/entities/user_widgets.js +3 -0
  96. package/src/domain/entities/user_widgets.js.map +1 -0
  97. package/src/domain/entities/widget.d.ts +84 -1
  98. package/src/domain/entities/widget_layout_config.d.ts +15 -0
  99. package/src/domain/entities/widget_layout_config.js +3 -0
  100. package/src/domain/entities/widget_layout_config.js.map +1 -0
  101. package/src/domain/entities/widget_size_config.d.ts +6 -0
  102. package/src/domain/entities/widget_size_config.js +3 -0
  103. package/src/domain/entities/widget_size_config.js.map +1 -0
  104. package/src/domain/entities/workspace.d.ts +9 -0
  105. package/src/domain/repositories/markets_repository.d.ts +13 -0
  106. package/src/domain/use_cases/create_widget_use_case.js +12 -2
  107. package/src/domain/use_cases/create_widget_use_case.js.map +1 -1
  108. package/src/domain/use_cases/duplicate_widget_use_case.d.ts +8 -0
  109. package/src/domain/use_cases/duplicate_widget_use_case.js +15 -0
  110. package/src/domain/use_cases/duplicate_widget_use_case.js.map +1 -0
  111. package/src/domain/use_cases/duplicate_workspace_use_case.d.ts +8 -0
  112. package/src/domain/use_cases/duplicate_workspace_use_case.js +15 -0
  113. package/src/domain/use_cases/duplicate_workspace_use_case.js.map +1 -0
  114. package/src/domain/use_cases/get_instrument_multiple_fields_use_case.d.ts +7 -0
  115. package/src/domain/use_cases/get_instrument_multiple_fields_use_case.js +15 -0
  116. package/src/domain/use_cases/get_instrument_multiple_fields_use_case.js.map +1 -0
  117. package/src/domain/use_cases/get_user_widgets_use_case.d.ts +9 -0
  118. package/src/domain/use_cases/get_user_widgets_use_case.js +22 -0
  119. package/src/domain/use_cases/get_user_widgets_use_case.js.map +1 -0
  120. package/src/domain/use_cases/get_workspaces_by_project_id_use_case.d.ts +9 -0
  121. package/src/domain/use_cases/get_workspaces_by_project_id_use_case.js +19 -0
  122. package/src/domain/use_cases/get_workspaces_by_project_id_use_case.js.map +1 -0
  123. package/src/domain/use_cases/search_instruments_use_case.js +0 -3
  124. package/src/domain/use_cases/search_instruments_use_case.js.map +1 -1
  125. package/src/domain/use_cases/update_widget_chart_use_case.d.ts +7 -0
  126. package/src/domain/use_cases/update_widget_chart_use_case.js +15 -0
  127. package/src/domain/use_cases/update_widget_chart_use_case.js.map +1 -0
  128. package/src/domain/use_cases/update_workspace_use_case.d.ts +8 -0
  129. package/src/domain/use_cases/update_workspace_use_case.js +15 -0
  130. package/src/domain/use_cases/update_workspace_use_case.js.map +1 -0
@@ -25,6 +25,8 @@ class MarketsDatasourceImpl {
25
25
  id
26
26
  name
27
27
  order
28
+ createdAt
29
+ updatedAt
28
30
  widgets {
29
31
  id
30
32
  name
@@ -45,6 +47,9 @@ class MarketsDatasourceImpl {
45
47
  const workspaces = (model.workspaces || []).map(workspace => ({
46
48
  id: workspace.id || '-',
47
49
  name: workspace.name || '-',
50
+ order: workspace.order || 0,
51
+ createdAt: workspace.createdAt || '-',
52
+ updatedAt: workspace.updatedAt || '-',
48
53
  }));
49
54
  const widgets = this.mapper.mapWidgets(model.widgets || []);
50
55
  return {
@@ -55,6 +60,50 @@ class MarketsDatasourceImpl {
55
60
  };
56
61
  });
57
62
  }
63
+ getUserWidgets(request) {
64
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
65
+ const query = `
66
+ query user ($id: String!) {
67
+ user (id: $id) {
68
+ id
69
+ widgets {
70
+ id
71
+ name
72
+ type
73
+ tableColumns {
74
+ id
75
+ field
76
+ description
77
+ visible
78
+ active
79
+ format
80
+ }
81
+ instruments {
82
+ symbol
83
+ uniqueKey
84
+ }
85
+ chartConfiguration {
86
+ id
87
+ globalConfiguration
88
+ }
89
+ }
90
+ }
91
+ }
92
+ `;
93
+ const response = yield this.graphQlClient.query(query, {
94
+ id: request.id,
95
+ });
96
+ const model = response.user;
97
+ if (!model) {
98
+ throw new core_1.SdkError(core_1.SdkErrorType.USER_NOT_EXIST);
99
+ }
100
+ const widgets = this.mapper.mapWidgets(model.widgets || []);
101
+ return {
102
+ id: model.id || '-',
103
+ widgets,
104
+ };
105
+ });
106
+ }
58
107
  createWorkspace(request) {
59
108
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
60
109
  const query = `
@@ -73,6 +122,56 @@ class MarketsDatasourceImpl {
73
122
  return { id: (model === null || model === void 0 ? void 0 : model.id) || '-', name: (model === null || model === void 0 ? void 0 : model.name) || '-' };
74
123
  });
75
124
  }
125
+ updateWorkspace(request) {
126
+ var _a;
127
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
128
+ const mutation = `
129
+ mutation updateWorkspace ($updateWorkspaceInput: UpdateWorkspaceInput!, $whereInput: WhereWorkspaceInput!) {
130
+ updateWorkspace (updateWorkspaceInput: $updateWorkspaceInput, whereInput: $whereInput) {
131
+ id
132
+ name
133
+ order
134
+ widgets {
135
+ id
136
+ sizes {
137
+ id
138
+ x
139
+ y
140
+ }
141
+ }
142
+ }
143
+ }
144
+ `;
145
+ const response = yield this.graphQlClient.mutate(mutation, {
146
+ updateWorkspaceInput: {
147
+ name: request.name,
148
+ order: request.order,
149
+ sizes: request.sizes,
150
+ },
151
+ whereInput: {
152
+ id: request.id,
153
+ },
154
+ });
155
+ const model = response.updateWorkspace;
156
+ if (!model) {
157
+ throw new core_1.SdkError(core_1.SdkErrorType.UNABLE_TO_UPDATE_WORKSPACE);
158
+ }
159
+ return {
160
+ id: model.id || '-',
161
+ name: model.name || '-',
162
+ order: model.order,
163
+ widgets: (_a = model.widgets) === null || _a === void 0 ? void 0 : _a.map(widget => {
164
+ var _a;
165
+ return ({
166
+ id: widget.id || '-',
167
+ size: {
168
+ id: ((_a = widget.size) === null || _a === void 0 ? void 0 : _a.id) || '-',
169
+ },
170
+ });
171
+ }),
172
+ };
173
+ });
174
+ }
76
175
  deleteWorkspace(request) {
77
176
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
78
177
  const mutation = `
@@ -88,6 +187,29 @@ class MarketsDatasourceImpl {
88
187
  return request.id;
89
188
  });
90
189
  }
190
+ duplicateWorkspace(request) {
191
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
192
+ const mutation = `
193
+ mutation DUPLICATE_WORKSPACE($duplicateWorkspaceInput: DuplicateWorkspaceInput!) {
194
+ duplicateWorkspace(duplicateWorkspaceInput: $duplicateWorkspaceInput) {
195
+ id
196
+ name
197
+ }
198
+ }
199
+ `;
200
+ const response = yield this.graphQlClient.mutate(mutation, {
201
+ duplicateWorkspaceInput: {
202
+ workspaceId: request.workspaceId,
203
+ userId: request.userId,
204
+ },
205
+ });
206
+ const model = response.duplicateWorkspace;
207
+ if (!model) {
208
+ throw new core_1.SdkError(core_1.SdkErrorType.UNABLE_TO_DUPLICATE_WORKSPACE);
209
+ }
210
+ return { id: (model === null || model === void 0 ? void 0 : model.id) || '-', name: (model === null || model === void 0 ? void 0 : model.name) || '-' };
211
+ });
212
+ }
91
213
  createWidget(request) {
92
214
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
93
215
  const mutation = `
@@ -103,19 +225,186 @@ class MarketsDatasourceImpl {
103
225
  }
104
226
  }
105
227
  `;
228
+ // Build the input object dynamically based on optional fields
229
+ const input = {
230
+ type: request.type,
231
+ name: request.name,
232
+ };
233
+ // Add userId OR workspaceId based on what's provided
234
+ if (request.userId) {
235
+ input['userId'] = request.userId;
236
+ }
237
+ else if (request.workspaceId) {
238
+ input['workspaceId'] = request.workspaceId;
239
+ }
240
+ // Add instruments only if provided
241
+ if (request.instruments && request.instruments.length > 0) {
242
+ input['instruments'] = {
243
+ create: request.instruments.map(node => ({
244
+ node,
245
+ })),
246
+ };
247
+ }
248
+ // Add newsConfiguration if provided
249
+ if (request.type === 'NEWS_LIST' && request.newsConfiguration) {
250
+ input['newsConfiguration'] = {
251
+ create: {
252
+ node: request.newsConfiguration,
253
+ },
254
+ };
255
+ }
256
+ // Add dynamicTableConfiguration if provided
257
+ if (request.type === 'DYNAMIC_TABLE' && request.dynamicTableConfiguration) {
258
+ input['dynamicTableConfiguration'] = {
259
+ create: {
260
+ node: request.dynamicTableConfiguration,
261
+ },
262
+ };
263
+ }
264
+ // Add sizes if provided
265
+ if (request.sizes) {
266
+ input['sizes'] = request.sizes;
267
+ }
268
+ // Add layout if provided
269
+ if (request.layout) {
270
+ input['layout'] = request.layout;
271
+ }
272
+ // Add chartConfiguration if provided
273
+ if (request.type === 'CHART' && request.chartConfiguration) {
274
+ input['chartConfiguration'] = {
275
+ create: {
276
+ node: request.chartConfiguration,
277
+ },
278
+ };
279
+ }
106
280
  const response = yield this.graphQlClient.mutate(mutation, {
107
- input: {
281
+ input,
282
+ });
283
+ const model = response.createWidget;
284
+ if (!model) {
285
+ throw new core_1.SdkError(core_1.SdkErrorType.UNABLE_TO_CREATE_WIDGET);
286
+ }
287
+ return this.mapper.mapWidget(model);
288
+ });
289
+ }
290
+ duplicateWidget(request) {
291
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
292
+ const mutation = `
293
+ mutation($duplicateWidgetInput: DuplicateWidgetInput!) {
294
+ duplicateWidget(duplicateWidgetInput: $duplicateWidgetInput) {
295
+ id
296
+ name
297
+ type
298
+ layout {
299
+ x
300
+ y
301
+ draggable
302
+ resizable
303
+ }
304
+ tableColumns {
305
+ id
306
+ field
307
+ description
308
+ visible
309
+ active
310
+ format
311
+ }
312
+ size {
313
+ id
314
+ width
315
+ height
316
+ minWidth
317
+ minHeight
318
+ maxWidth
319
+ maxHeight
320
+ x
321
+ y
322
+ draggable
323
+ resizable
324
+ }
325
+ tickerConfiguration {
326
+ id
327
+ position
328
+ size
329
+ visible
330
+ speed
331
+ }
332
+ dynamicTableConfiguration {
333
+ id
334
+ period
335
+ instrumentLimit
336
+ field
337
+ condition
338
+ marketTypeId
339
+ valueTypeIds
340
+ exchangeId
341
+ hasActivity
342
+ scope
343
+ isFiltered
344
+ isYields
345
+ operatingCompany
346
+ }
347
+ instruments {
348
+ symbol
349
+ uniqueKey
350
+ }
351
+ chartConfiguration {
352
+ id
353
+ globalConfiguration
354
+ }
355
+ marketTotalConfiguration {
356
+ id
357
+ scope
358
+ }
359
+ tradedPackagesConfiguration {
360
+ id
361
+ scope
362
+ }
363
+ brokerageTradesConfiguration {
364
+ id
365
+ scope
366
+ }
367
+ brokerageConcentrationConfiguration {
368
+ id
369
+ scope
370
+ }
371
+ brokerageParticipationConfiguration {
372
+ id
373
+ broker
374
+ instrumentType
375
+ crosses
376
+ purchases
377
+ sales
378
+ totals
379
+ symbol
380
+ }
381
+ decreedRightsSearcherConfiguration {
382
+ id
383
+ scope
384
+ endDate
385
+ issuer
386
+ limit
387
+ offset
388
+ startDate
389
+ type
390
+ }
391
+ indicesComponentsConfiguration {
392
+ id
393
+ scope
394
+ component
395
+ sector
396
+ type
397
+ }
398
+ }
399
+ }
400
+ `;
401
+ const response = yield this.graphQlClient.mutate(mutation, {
402
+ duplicateWidgetInput: {
108
403
  workspaceId: request.workspaceId,
109
- type: request.type,
110
- name: request.name,
111
- instruments: {
112
- create: request.instruments.map(node => ({
113
- node,
114
- })),
115
- },
404
+ widgetId: request.widgetId,
116
405
  },
117
406
  });
118
- const model = response.createWidget;
407
+ const model = response.duplicateWidget;
119
408
  if (!model) {
120
409
  throw new core_1.SdkError(core_1.SdkErrorType.UNABLE_TO_CREATE_WIDGET);
121
410
  }
@@ -156,6 +445,29 @@ class MarketsDatasourceImpl {
156
445
  return this.mapper.mapInstruments(models);
157
446
  });
158
447
  }
448
+ updateWidgetChart(request) {
449
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
450
+ const mutation = `
451
+ mutation UPDATE_CHART($id: String!, $chartConfiguration: String!) {
452
+ updateChartConfiguration(
453
+ updateChartConfigurationInput: { globalConfiguration: $chartConfiguration }
454
+ whereInput: { id: $id }
455
+ ) {
456
+ id
457
+ }
458
+ }
459
+ `;
460
+ const response = yield this.graphQlClient.mutate(mutation, {
461
+ id: request.id,
462
+ chartConfiguration: request.chartConfiguration,
463
+ });
464
+ const model = response.updateChartConfiguration;
465
+ if (!model) {
466
+ throw new core_1.SdkError(core_1.SdkErrorType.UNABLE_TO_CREATE_WIDGET);
467
+ }
468
+ return model.id || request.id;
469
+ });
470
+ }
159
471
  deleteWidget(request) {
160
472
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
161
473
  const MUTATION = `
@@ -246,6 +558,10 @@ class MarketsDatasourceImpl {
246
558
  minHeight
247
559
  maxWidth
248
560
  maxHeight
561
+ x
562
+ y
563
+ draggable
564
+ resizable
249
565
  }
250
566
  tickerConfiguration {
251
567
  id
@@ -254,6 +570,60 @@ class MarketsDatasourceImpl {
254
570
  visible
255
571
  speed
256
572
  }
573
+ tradedPackagesConfiguration {
574
+ id
575
+ scope
576
+ }
577
+ brokerageTradesConfiguration {
578
+ id
579
+ scope
580
+ }
581
+ brokerageConcentrationConfiguration {
582
+ id
583
+ scope
584
+ }
585
+ brokerageParticipationConfiguration {
586
+ id
587
+ broker
588
+ instrumentType
589
+ crosses
590
+ purchases
591
+ sales
592
+ totals
593
+ symbol
594
+ }
595
+ decreedRightsSearcherConfiguration {
596
+ id
597
+ scope
598
+ endDate
599
+ issuer
600
+ limit
601
+ offset
602
+ startDate
603
+ type
604
+ }
605
+ dynamicTableConfiguration {
606
+ id
607
+ period
608
+ instrumentLimit
609
+ field
610
+ condition
611
+ marketTypeId
612
+ valueTypeIds
613
+ exchangeId
614
+ scope
615
+ hasActivity
616
+ isFiltered
617
+ operatingCompany
618
+ isYields
619
+ }
620
+ indicesComponentsConfiguration {
621
+ id
622
+ scope
623
+ component
624
+ sector
625
+ type
626
+ }
257
627
  instruments (
258
628
  options: ${((_b = (_a = request.params) === null || _a === void 0 ? void 0 : _a.instruments) === null || _b === void 0 ? void 0 : _b.options)
259
629
  ? (0, core_1.queryfy)((_d = (_c = request.params) === null || _c === void 0 ? void 0 : _c.instruments) === null || _d === void 0 ? void 0 : _d.options)
@@ -316,6 +686,10 @@ class MarketsDatasourceImpl {
316
686
  minHeight
317
687
  maxWidth
318
688
  maxHeight
689
+ x
690
+ y
691
+ draggable
692
+ resizable
319
693
  }
320
694
  tickerConfiguration {
321
695
  id
@@ -324,12 +698,74 @@ class MarketsDatasourceImpl {
324
698
  visible
325
699
  speed
326
700
  }
701
+ dynamicTableConfiguration {
702
+ id
703
+ period
704
+ instrumentLimit
705
+ field
706
+ condition
707
+ marketTypeId
708
+ valueTypeIds
709
+ exchangeId
710
+ hasActivity
711
+ scope
712
+ isFiltered
713
+ operatingCompany
714
+ isYields
715
+ }
716
+ decreedRightsSearcherConfiguration {
717
+ id
718
+ scope
719
+ endDate
720
+ issuer
721
+ limit
722
+ offset
723
+ startDate
724
+ type
725
+ }
327
726
  instruments {
328
727
  symbol
329
728
  uniqueKey
330
729
  }
331
- }
730
+ chartConfiguration {
731
+ id
732
+ globalConfiguration
733
+ }
734
+ marketTotalConfiguration {
735
+ id
736
+ scope
737
+ }
738
+ tradedPackagesConfiguration {
739
+ id
740
+ scope
741
+ }
742
+ brokerageTradesConfiguration {
743
+ id
744
+ scope
745
+ }
746
+ brokerageConcentrationConfiguration {
747
+ id
748
+ scope
749
+ }
750
+ brokerageParticipationConfiguration {
751
+ id
752
+ broker
753
+ instrumentType
754
+ crosses
755
+ purchases
756
+ sales
757
+ totals
758
+ symbol
759
+ }
760
+ indicesComponentsConfiguration {
761
+ id
762
+ scope
763
+ component
764
+ sector
765
+ type
766
+ }
332
767
  }
768
+ }
333
769
  }
334
770
  `;
335
771
  const response = yield this.graphQlClient.query(query, {
@@ -535,8 +971,21 @@ class MarketsDatasourceImpl {
535
971
  return this.mapper.mapInstrumentFields(model);
536
972
  });
537
973
  }
974
+ getInstrumentMultipleFields(request) {
975
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
976
+ const response = yield this.marketsHttpClient.get('/instruments/last', {
977
+ params: { instrumentKey: request },
978
+ });
979
+ const models = response.data || [];
980
+ if (models.length <= 0) {
981
+ throw new core_1.SdkError(core_1.SdkErrorType.INSTRUMENT_NOT_FOUND);
982
+ }
983
+ const mappedModels = models.map(model => this.mapper.mapInstrumentFields(model));
984
+ return mappedModels;
985
+ });
986
+ }
538
987
  searchInstruments(request) {
539
- var _a, _b, _c;
988
+ var _a, _b, _c, _d;
540
989
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
541
990
  const params = Object.fromEntries(Object.entries({
542
991
  limit: request.limit,
@@ -544,19 +993,50 @@ class MarketsDatasourceImpl {
544
993
  marketTypeIds: (_a = request.marketTypeIds) === null || _a === void 0 ? void 0 : _a.join(','),
545
994
  valueTypeIds: (_b = request.valueTypeIds) === null || _b === void 0 ? void 0 : _b.join(','),
546
995
  exchangeIds: (_c = request.exchangeIds) === null || _c === void 0 ? void 0 : _c.join(','),
996
+ fields: (_d = request.fields) === null || _d === void 0 ? void 0 : _d.join(','),
997
+ startsWith: request.startsWith,
547
998
  }).filter(([_, value]) => value !== undefined));
548
999
  const response = yield this.marketsHttpClient.get('/instruments', {
549
1000
  params,
550
1001
  });
551
1002
  const models = response.data || [];
552
1003
  return models
553
- .map(model => ({
554
- name: model.name || '-',
555
- instrument: {
556
- instrumentKey: model.instrumentKey || '-',
1004
+ .map(model => {
1005
+ var _a, _b, _c;
1006
+ return ({
1007
+ name: model.name || '-',
1008
+ instrument: {
1009
+ instrumentKey: model.instrumentKey || '-',
1010
+ symbol: model.symbol || '-',
1011
+ },
1012
+ id: model.id || -1,
1013
+ marketTypeId: model.marketTypeId || -1,
1014
+ valueTypeId: model.valueTypeId || -1,
1015
+ exchangeId: model.exchangeId || -1,
557
1016
  symbol: model.symbol || '-',
558
- },
559
- }))
1017
+ issuer: model.issuer || '-',
1018
+ series: model.series || '-',
1019
+ isTrading: model.isTrading || false,
1020
+ instrumentKey: model.instrumentKey || '-',
1021
+ exchangeValueType: model.exchangeValueType || -1,
1022
+ isin: model.isin || '-',
1023
+ active: model.active || false,
1024
+ displaySymbol: model.displaySymbol || '-',
1025
+ keywords: model.keywords || '-',
1026
+ index: model.index || '-',
1027
+ assetClass: {
1028
+ name: ((_a = model.assetClass) === null || _a === void 0 ? void 0 : _a.name) || '-',
1029
+ },
1030
+ created_at: model.created_at || '-',
1031
+ exchange: {
1032
+ name: ((_b = model.exchange) === null || _b === void 0 ? void 0 : _b.name) || '-',
1033
+ },
1034
+ sectors: ((_c = model.sectors) === null || _c === void 0 ? void 0 : _c.map(sector => ({
1035
+ type: sector.type || '-',
1036
+ name: sector.name || '-',
1037
+ }))) || [],
1038
+ });
1039
+ })
560
1040
  .sort((a, b) => {
561
1041
  const symbolA = a.instrument.symbol;
562
1042
  const symbolB = b.instrument.symbol;
@@ -699,6 +1179,37 @@ class MarketsDatasourceImpl {
699
1179
  };
700
1180
  });
701
1181
  }
1182
+ getWorkspacesByProjectId(request) {
1183
+ var _a;
1184
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
1185
+ const query = `
1186
+ query($id: String!) {
1187
+ project(id: $id) {
1188
+ id
1189
+ name
1190
+ client
1191
+ workspaces {
1192
+ id
1193
+ name
1194
+ createdAt
1195
+ updatedAt
1196
+ widgets {
1197
+ id
1198
+ name
1199
+ type
1200
+ }
1201
+ }
1202
+ }
1203
+ }
1204
+ `;
1205
+ const response = yield this.graphQlClient.query(query, {
1206
+ id: request.projectId,
1207
+ });
1208
+ const models = ((_a = response === null || response === void 0 ? void 0 : response.project) === null || _a === void 0 ? void 0 : _a.workspaces) || [];
1209
+ const { workspaces, widgets, instruments } = this.getMapperWorkspaces(models);
1210
+ return { workspaces, widgets, instruments };
1211
+ });
1212
+ }
702
1213
  }
703
1214
  exports.default = MarketsDatasourceImpl;
704
1215
  //# sourceMappingURL=markets_datasource_impl.js.map