@cargo-ai/api 1.0.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.
Files changed (95) hide show
  1. package/build/src/api/ai/index.d.ts +78 -0
  2. package/build/src/api/ai/index.d.ts.map +1 -0
  3. package/build/src/api/ai/index.js +530 -0
  4. package/build/src/api/billing/index.d.ts +25 -0
  5. package/build/src/api/billing/index.d.ts.map +1 -0
  6. package/build/src/api/billing/index.js +155 -0
  7. package/build/src/api/connection/index.d.ts +28 -0
  8. package/build/src/api/connection/index.d.ts.map +1 -0
  9. package/build/src/api/connection/index.js +172 -0
  10. package/build/src/api/expression/index.d.ts +26 -0
  11. package/build/src/api/expression/index.d.ts.map +1 -0
  12. package/build/src/api/expression/index.js +115 -0
  13. package/build/src/api/index.d.ts +72 -0
  14. package/build/src/api/index.d.ts.map +1 -0
  15. package/build/src/api/index.js +51 -0
  16. package/build/src/api/orchestration/index.d.ts +66 -0
  17. package/build/src/api/orchestration/index.d.ts.map +1 -0
  18. package/build/src/api/orchestration/index.js +625 -0
  19. package/build/src/api/revenueOrganization/index.d.ts +37 -0
  20. package/build/src/api/revenueOrganization/index.d.ts.map +1 -0
  21. package/build/src/api/revenueOrganization/index.js +241 -0
  22. package/build/src/api/segmentation/index.d.ts +28 -0
  23. package/build/src/api/segmentation/index.d.ts.map +1 -0
  24. package/build/src/api/segmentation/index.js +188 -0
  25. package/build/src/api/storage/index.d.ts +45 -0
  26. package/build/src/api/storage/index.d.ts.map +1 -0
  27. package/build/src/api/storage/index.js +402 -0
  28. package/build/src/api/systemOfRecordIntegration/index.d.ts +29 -0
  29. package/build/src/api/systemOfRecordIntegration/index.d.ts.map +1 -0
  30. package/build/src/api/systemOfRecordIntegration/index.js +151 -0
  31. package/build/src/api/userManagement/index.d.ts +14 -0
  32. package/build/src/api/userManagement/index.d.ts.map +1 -0
  33. package/build/src/api/userManagement/index.js +33 -0
  34. package/build/src/api/workspaceManagement/index.d.ts +43 -0
  35. package/build/src/api/workspaceManagement/index.d.ts.map +1 -0
  36. package/build/src/api/workspaceManagement/index.js +283 -0
  37. package/build/src/client.d.ts +5 -0
  38. package/build/src/client.d.ts.map +1 -0
  39. package/build/src/client.js +24 -0
  40. package/build/src/fetcher/client.d.ts +7 -0
  41. package/build/src/fetcher/client.d.ts.map +1 -0
  42. package/build/src/fetcher/client.js +9 -0
  43. package/build/src/fetcher/error.d.ts +101 -0
  44. package/build/src/fetcher/error.d.ts.map +1 -0
  45. package/build/src/fetcher/error.js +184 -0
  46. package/build/src/fetcher/fetcher.d.ts +12 -0
  47. package/build/src/fetcher/fetcher.d.ts.map +1 -0
  48. package/build/src/fetcher/fetcher.js +1 -0
  49. package/build/src/fetcher/index.d.ts +34 -0
  50. package/build/src/fetcher/index.d.ts.map +1 -0
  51. package/build/src/fetcher/index.js +78 -0
  52. package/build/src/index.d.ts +5 -0
  53. package/build/src/index.d.ts.map +1 -0
  54. package/build/src/index.js +3 -0
  55. package/build/src/store/ai.d.ts +481 -0
  56. package/build/src/store/ai.d.ts.map +1 -0
  57. package/build/src/store/ai.js +112 -0
  58. package/build/src/store/billing.d.ts +140 -0
  59. package/build/src/store/billing.d.ts.map +1 -0
  60. package/build/src/store/billing.js +62 -0
  61. package/build/src/store/connection.d.ts +183 -0
  62. package/build/src/store/connection.d.ts.map +1 -0
  63. package/build/src/store/connection.js +88 -0
  64. package/build/src/store/expression.d.ts +112 -0
  65. package/build/src/store/expression.d.ts.map +1 -0
  66. package/build/src/store/expression.js +27 -0
  67. package/build/src/store/index.d.ts +14 -0
  68. package/build/src/store/index.d.ts.map +1 -0
  69. package/build/src/store/index.js +25 -0
  70. package/build/src/store/orchestration.d.ts +942 -0
  71. package/build/src/store/orchestration.d.ts.map +1 -0
  72. package/build/src/store/orchestration.js +217 -0
  73. package/build/src/store/revenueOrganization.d.ts +201 -0
  74. package/build/src/store/revenueOrganization.d.ts.map +1 -0
  75. package/build/src/store/revenueOrganization.js +68 -0
  76. package/build/src/store/segmentation.d.ts +566 -0
  77. package/build/src/store/segmentation.d.ts.map +1 -0
  78. package/build/src/store/segmentation.js +103 -0
  79. package/build/src/store/storage.d.ts +1096 -0
  80. package/build/src/store/storage.d.ts.map +1 -0
  81. package/build/src/store/storage.js +174 -0
  82. package/build/src/store/systemOfRecordIntegration.d.ts +122 -0
  83. package/build/src/store/systemOfRecordIntegration.d.ts.map +1 -0
  84. package/build/src/store/systemOfRecordIntegration.js +53 -0
  85. package/build/src/store/userManagement.d.ts +34 -0
  86. package/build/src/store/userManagement.d.ts.map +1 -0
  87. package/build/src/store/userManagement.js +22 -0
  88. package/build/src/store/workspaceManagement.d.ts +215 -0
  89. package/build/src/store/workspaceManagement.d.ts.map +1 -0
  90. package/build/src/store/workspaceManagement.js +103 -0
  91. package/build/src/types.d.ts +6 -0
  92. package/build/src/types.d.ts.map +1 -0
  93. package/build/src/types.js +1 -0
  94. package/build/tsconfig.tsbuildinfo +1 -0
  95. package/package.json +45 -0
@@ -0,0 +1,402 @@
1
+ import { getErrorWithReasonErrorMessage } from "../../fetcher/index.js";
2
+ import { Storage } from "../../store/index.js";
3
+ export const buildStorageApi = ({ fetcher, }) => {
4
+ async function createColumn(payload) {
5
+ try {
6
+ await fetcher.fetch({
7
+ method: "post",
8
+ endpoint: `/storage/columns`,
9
+ payload,
10
+ });
11
+ }
12
+ catch (error) {
13
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodCreateColumnErrorReason, {
14
+ modelNotFound: "Model not found.",
15
+ datasetNotFound: "Dataset not found.",
16
+ duplicateSlug: "Column slug is already used.",
17
+ aiExpressionNotAllowed: "AI expression is not allowed.",
18
+ invalidRelationship: "Invalid relationship.",
19
+ });
20
+ }
21
+ }
22
+ async function updateColumn(payload) {
23
+ try {
24
+ await fetcher.fetch({
25
+ method: "put",
26
+ endpoint: `/storage/columns`,
27
+ payload,
28
+ });
29
+ }
30
+ catch (error) {
31
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodUpdateColumnErrorReason, {
32
+ modelNotFound: "Model not found.",
33
+ datasetNotFound: "Dataset not found.",
34
+ columnNotFound: "Column not found.",
35
+ aiExpressionNotAllowed: "AI expression is not allowed.",
36
+ invalidRelationship: "Invalid relationship.",
37
+ });
38
+ }
39
+ }
40
+ async function removeColumn(payload) {
41
+ try {
42
+ await fetcher.fetch({
43
+ method: "delete",
44
+ endpoint: `/storage/columns`,
45
+ payload,
46
+ });
47
+ }
48
+ catch (error) {
49
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodRemoveColumnErrorReason, {
50
+ modelNotFound: "Model not found.",
51
+ datasetNotFound: "Dataset not found.",
52
+ columnNotFound: "Column not found.",
53
+ });
54
+ }
55
+ }
56
+ async function reorderColumn(payload) {
57
+ try {
58
+ await fetcher.fetch({
59
+ method: "put",
60
+ endpoint: `/storage/columns/reorder`,
61
+ payload,
62
+ });
63
+ }
64
+ catch (error) {
65
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodReorderColumnErrorReason, {
66
+ modelNotFound: "Model not found.",
67
+ columnNotFound: "Column not found.",
68
+ invalidIndex: "Invalid index.",
69
+ });
70
+ }
71
+ }
72
+ async function columnExistsBySlug(payload) {
73
+ const { modelUuid, columnSlug } = payload;
74
+ const result = await fetcher.fetch({
75
+ method: "get",
76
+ endpoint: `storage/columns/existsBySlug`,
77
+ params: { slug: columnSlug, modelUuid },
78
+ });
79
+ return result;
80
+ }
81
+ async function columnAutocomplete(payload) {
82
+ const { modelUuid, column } = payload;
83
+ try {
84
+ const result = await fetcher.fetch({
85
+ method: "post",
86
+ endpoint: `/storage/columns/autocomplete`,
87
+ payload: { modelUuid, column },
88
+ });
89
+ return result;
90
+ }
91
+ catch (error) {
92
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodModelColumnAutocompleteErrorReason, {
93
+ modelNotFound: "Model not found.",
94
+ datasetNotFound: "Dataset not found.",
95
+ });
96
+ }
97
+ }
98
+ async function createDataset(payload) {
99
+ try {
100
+ const result = await fetcher.fetch({
101
+ method: "post",
102
+ endpoint: "/storage/datasets",
103
+ payload,
104
+ });
105
+ return result;
106
+ }
107
+ catch (error) {
108
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodCreateDatasetErrorReason, {
109
+ connectorNotFound: "Connector not found.",
110
+ integrationNotFound: "Integration not found.",
111
+ duplicateSlug: "Slug is already used.",
112
+ });
113
+ }
114
+ }
115
+ async function allDatasets() {
116
+ const result = await fetcher.fetch({
117
+ method: "get",
118
+ endpoint: "/storage/datasets/list",
119
+ payload: {},
120
+ });
121
+ return result;
122
+ }
123
+ async function getDataset(uuid) {
124
+ const result = await fetcher.fetch({
125
+ method: "get",
126
+ endpoint: `/storage/datasets/${uuid}`,
127
+ payload: {},
128
+ });
129
+ return result;
130
+ }
131
+ async function allModels() {
132
+ const result = await fetcher.fetch({
133
+ method: "get",
134
+ endpoint: "/storage/models/list",
135
+ payload: {},
136
+ });
137
+ return result;
138
+ }
139
+ async function createModel(payload) {
140
+ try {
141
+ const result = await fetcher.fetch({
142
+ method: "post",
143
+ endpoint: "storage/models",
144
+ payload,
145
+ });
146
+ return result;
147
+ }
148
+ catch (error) {
149
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodCreateModelErrorReason, {
150
+ duplicateSlug: "Slug is already used.",
151
+ connectorNotFound: "Connector not found.",
152
+ datasetNotFound: "Dataset not found.",
153
+ datasetNotCompatible: "Dataset is not compatible.",
154
+ integrationNotCompatible: "Integration not compatible.",
155
+ integrationNotFound: "Integration not found.",
156
+ invalidConfig: "Configuration is not valid.",
157
+ failedToSchedule: "Failed to schedule.",
158
+ });
159
+ }
160
+ }
161
+ async function updateModel(payload) {
162
+ const { uuid, ...other } = payload;
163
+ try {
164
+ const result = await fetcher.fetch({
165
+ method: "put",
166
+ endpoint: `storage/models/${uuid}`,
167
+ payload: other,
168
+ });
169
+ return result;
170
+ }
171
+ catch (error) {
172
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodUpdateModelErrorReason, {
173
+ modelNotFound: "Model not found.",
174
+ datasetNotFound: "Dataset not found.",
175
+ datasetNotCompatible: "Dataset is not compatible.",
176
+ connectorNotFound: "Connector not found.",
177
+ integrationNotFound: "Integration not found.",
178
+ invalidConfig: "Configuration is not valid.",
179
+ failedToSchedule: "Failed to schedule.",
180
+ });
181
+ }
182
+ }
183
+ async function syncModel(uuid) {
184
+ try {
185
+ const result = await fetcher.fetch({
186
+ method: "post",
187
+ endpoint: `storage/models/${uuid}/sync`,
188
+ });
189
+ return result;
190
+ }
191
+ catch (error) {
192
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodSyncModelErrorReason, {
193
+ modelNotFound: "Model not found.",
194
+ datasetNotFound: "Dataset not found.",
195
+ connectorNotFound: "Connector not found.",
196
+ integrationNotFound: "Integration not found.",
197
+ alreadySyncing: "Already syncing.",
198
+ failedToSyncFromClient: "Failed to sync.",
199
+ });
200
+ }
201
+ }
202
+ async function removeModel(uuid) {
203
+ try {
204
+ await fetcher.fetch({
205
+ method: "delete",
206
+ endpoint: `/storage/models/${uuid}`,
207
+ payload: {},
208
+ });
209
+ }
210
+ catch (error) {
211
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodRemoveModelErrorReason, {
212
+ modelNotFound: "Model not found.",
213
+ datasetNotFound: "Dataset not found.",
214
+ datasetNotCompatible: "Dataset is not compatible.",
215
+ hasSegments: "Model has related segments.",
216
+ hasWorkflows: "Model has related workflows.",
217
+ connectorNotFound: "Connector not found.",
218
+ integrationNotFound: "Integration not found.",
219
+ invalidConfig: "Configuration is not valid.",
220
+ });
221
+ }
222
+ }
223
+ async function modelExistsBySlug(payload) {
224
+ const { slug, datasetUuid } = payload;
225
+ const result = await fetcher.fetch({
226
+ method: "get",
227
+ endpoint: `storage/models/existsBySlug`,
228
+ params: { slug, datasetUuid },
229
+ });
230
+ return result;
231
+ }
232
+ async function allRelationships() {
233
+ const result = await fetcher.fetch({
234
+ method: "get",
235
+ endpoint: "/storage/relationships/list",
236
+ });
237
+ return result;
238
+ }
239
+ async function setRelationships(payload) {
240
+ try {
241
+ const result = await fetcher.fetch({
242
+ method: "post",
243
+ endpoint: "/storage/relationships",
244
+ payload,
245
+ });
246
+ return result;
247
+ }
248
+ catch (error) {
249
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodSetRelationshipsErrorReason, {
250
+ datasetNotFound: "Dataset not found.",
251
+ datasetNotCompatible: "Dataset is not compatible.",
252
+ invalidRelationships: "Invalid relationships.",
253
+ });
254
+ }
255
+ }
256
+ async function createRun(payload) {
257
+ try {
258
+ const result = await fetcher.fetch({
259
+ method: "post",
260
+ endpoint: "/storage/runs",
261
+ payload,
262
+ });
263
+ return result;
264
+ }
265
+ catch (error) {
266
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodCreateRunErrorReason, {
267
+ modelNotFound: "Model not found.",
268
+ datasetNotFound: "Dataset not found.",
269
+ integrationNotFound: "Integration not found.",
270
+ connectorNotFound: "Connector not found.",
271
+ modelNotCompatible: "Model is not compatible.",
272
+ alreadyRunning: "Run already running.",
273
+ upToDate: "Up to date.",
274
+ modelIsPaused: "Model is paused.",
275
+ notEnoughCredits: "Not enough credits.",
276
+ });
277
+ }
278
+ }
279
+ async function listRuns(payload) {
280
+ const result = await fetcher.fetch({
281
+ method: "get",
282
+ endpoint: "/storage/runs/list",
283
+ params: payload,
284
+ });
285
+ return result;
286
+ }
287
+ async function cancelRun(uuid) {
288
+ try {
289
+ await fetcher.fetch({
290
+ method: "post",
291
+ endpoint: `/storage/runs/${uuid}/cancel`,
292
+ });
293
+ }
294
+ catch (error) {
295
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodCancelRunErrorReason, {
296
+ runNotFound: "Run not found.",
297
+ runAlreadyFinished: "Run already finished.",
298
+ });
299
+ }
300
+ }
301
+ async function previewModel(payload) {
302
+ try {
303
+ const result = await fetcher.fetch({
304
+ method: "post",
305
+ endpoint: "/storage/models/preview",
306
+ payload,
307
+ });
308
+ return result;
309
+ }
310
+ catch (error) {
311
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodPreviewModelErrorReason, {
312
+ datasetNotFound: "Dataset not found.",
313
+ datasetNotCompatible: "Dataset is not compatible.",
314
+ connectorNotFound: "Connector not found.",
315
+ integrationNotFound: "Integration not found.",
316
+ integrationNotCompatible: "Integration not compatible.",
317
+ invalidConfig: "Configuration is not valid.",
318
+ });
319
+ }
320
+ }
321
+ async function previewCountModel(payload) {
322
+ try {
323
+ const result = await fetcher.fetch({
324
+ method: "post",
325
+ endpoint: "/storage/models/previewCount",
326
+ payload,
327
+ });
328
+ return result;
329
+ }
330
+ catch (error) {
331
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodPreviewCountModelErrorReason, {
332
+ datasetNotFound: "Dataset not found.",
333
+ datasetNotCompatible: "Dataset is not compatible.",
334
+ connectorNotFound: "Connector not found.",
335
+ integrationNotFound: "Integration not found.",
336
+ integrationNotCompatible: "Integration not compatible.",
337
+ invalidConfig: "Configuration is not valid.",
338
+ });
339
+ }
340
+ }
341
+ async function listRecords(payload) {
342
+ try {
343
+ const result = await fetcher.fetch({
344
+ method: "get",
345
+ endpoint: "/storage/records/list",
346
+ params: payload,
347
+ });
348
+ return result;
349
+ }
350
+ catch (error) {
351
+ throw getErrorWithReasonErrorMessage(error, Storage.Api.zodListRecordsErrorReason, {
352
+ modelNotFound: "Model not found.",
353
+ datasetNotFound: "Dataset not found.",
354
+ datasetNotCompatible: "Dataset is not compatible.",
355
+ connectorNotFound: "Connector not found.",
356
+ integrationNotFound: "Integration not found.",
357
+ incompatibleWithFetching: "Incompatible with fetching.",
358
+ incompatibleWithQuery: "Incompatible with command.",
359
+ incompatibleWithRecordAction: "Incompatible with record action.",
360
+ integrationNotCompatible: "Integration not compatible",
361
+ invalidConfig: "Configuration is not valid.",
362
+ });
363
+ }
364
+ }
365
+ return {
366
+ column: {
367
+ create: createColumn,
368
+ update: updateColumn,
369
+ remove: removeColumn,
370
+ reorder: reorderColumn,
371
+ existsBySlug: columnExistsBySlug,
372
+ autocomplete: columnAutocomplete,
373
+ },
374
+ dataset: {
375
+ create: createDataset,
376
+ all: allDatasets,
377
+ get: getDataset,
378
+ },
379
+ model: {
380
+ all: allModels,
381
+ create: createModel,
382
+ update: updateModel,
383
+ sync: syncModel,
384
+ remove: removeModel,
385
+ existsBySlug: modelExistsBySlug,
386
+ preview: previewModel,
387
+ previewCount: previewCountModel,
388
+ },
389
+ relationship: {
390
+ all: allRelationships,
391
+ set: setRelationships,
392
+ },
393
+ run: {
394
+ create: createRun,
395
+ list: listRuns,
396
+ cancel: cancelRun,
397
+ },
398
+ record: {
399
+ list: listRecords,
400
+ },
401
+ };
402
+ };
@@ -0,0 +1,29 @@
1
+ import type { Fetcher } from "../../fetcher/index.js";
2
+ import { SystemOfRecordIntegration } from "../../store/index.js";
3
+ interface SystemOfRecordIntegrationApiDependencies {
4
+ fetcher: Fetcher;
5
+ }
6
+ export interface SystemOfRecordIntegrationApi {
7
+ systemOfRecord: {
8
+ create: (payload: SystemOfRecordIntegration.Api.CreateSystemOfRecordPayload) => Promise<SystemOfRecordIntegration.Api.CreateSystemOfRecordResult>;
9
+ get: (uuid: string) => Promise<SystemOfRecordIntegration.Api.GetSystemOfRecordResult>;
10
+ update: (payload: SystemOfRecordIntegration.Api.UpdateSystemOfRecordPayload) => Promise<SystemOfRecordIntegration.Api.UpdateSystemOfRecordResult>;
11
+ remove: (uuid: string) => Promise<SystemOfRecordIntegration.Api.RemoveSystemOfRecordResult>;
12
+ all: () => Promise<SystemOfRecordIntegration.Api.ListSystemOfRecordsResult>;
13
+ migrate: (payload: SystemOfRecordIntegration.Api.MigratePayload) => Promise<void>;
14
+ cutover: (payload: SystemOfRecordIntegration.Api.CutoverPayload) => Promise<void>;
15
+ };
16
+ client: {
17
+ getDocumentation: (slug: string) => Promise<string>;
18
+ query: (command: string) => Promise<SystemOfRecordIntegration.Api.QueryResult>;
19
+ download: (payload: SystemOfRecordIntegration.Api.DownloadPayload) => Promise<SystemOfRecordIntegration.Api.DownloadResult>;
20
+ fetch: (payload: SystemOfRecordIntegration.Api.FetchPayload) => Promise<SystemOfRecordIntegration.Api.FetchResult>;
21
+ };
22
+ log: {
23
+ list: (payload: SystemOfRecordIntegration.Api.ListLogsPayload) => Promise<SystemOfRecordIntegration.Api.ListLogsResult>;
24
+ getMetrics: (payload: SystemOfRecordIntegration.Api.GetMetricsLogsPayload) => Promise<SystemOfRecordIntegration.Api.GetMetricsLogsResult>;
25
+ };
26
+ }
27
+ export declare const buildSystemOfRecordIntegrationApi: ({ fetcher, }: SystemOfRecordIntegrationApiDependencies) => SystemOfRecordIntegrationApi;
28
+ export {};
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/systemOfRecordIntegration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,UAAU,wCAAwC;IAChD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE;QACd,MAAM,EAAE,CACN,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC,2BAA2B,KAC/D,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACvE,GAAG,EAAE,CACH,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACpE,MAAM,EAAE,CACN,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC,2BAA2B,KAC/D,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACvE,MAAM,EAAE,CACN,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACvE,GAAG,EAAE,MAAM,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QAC5E,OAAO,EAAE,CACP,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC,cAAc,KAClD,OAAO,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,EAAE,CACP,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC,cAAc,KAClD,OAAO,CAAC,IAAI,CAAC,CAAC;KACpB,CAAC;IACF,MAAM,EAAE;QACN,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QACpD,KAAK,EAAE,CACL,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACxD,QAAQ,EAAE,CACR,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC,eAAe,KACnD,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC3D,KAAK,EAAE,CACL,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC,YAAY,KAChD,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;KACzD,CAAC;IACF,GAAG,EAAE;QACH,IAAI,EAAE,CACJ,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC,eAAe,KACnD,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC3D,UAAU,EAAE,CACV,OAAO,EAAE,yBAAyB,CAAC,GAAG,CAAC,qBAAqB,KACzD,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;KAClE,CAAC;CACH;AAED,eAAO,MAAM,iCAAiC,iBAE3C,wCAAwC,KAAG,4BA+N7C,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { getErrorWithReasonErrorMessage } from "../../fetcher/index.js";
2
+ import { SystemOfRecordIntegration } from "../../store/index.js";
3
+ export const buildSystemOfRecordIntegrationApi = ({ fetcher, }) => {
4
+ async function createSystemOfRecord(payload) {
5
+ try {
6
+ const result = await fetcher.fetch({
7
+ method: "post",
8
+ endpoint: "/systemOfRecordIntegration/systemOfRecords",
9
+ payload,
10
+ });
11
+ return result;
12
+ }
13
+ catch (error) {
14
+ throw getErrorWithReasonErrorMessage(error, SystemOfRecordIntegration.Api.zodCreateSystemOfRecordErrorReason, {
15
+ systemOfRecordAlreadyUsedByAnotherWorkspace: "This system of records is already used by another workspace.",
16
+ missingPermissions: "Some permissions are missing. Please verify on the documentation that you allowed the necessary permissions.",
17
+ });
18
+ }
19
+ }
20
+ async function getSystemOfRecord(uuid) {
21
+ try {
22
+ const result = await fetcher.fetch({
23
+ method: "get",
24
+ endpoint: `/systemOfRecordIntegration/systemOfRecords/${uuid}`,
25
+ });
26
+ return result;
27
+ }
28
+ catch (error) {
29
+ throw getErrorWithReasonErrorMessage(error, SystemOfRecordIntegration.Api.zodUpdateSystemOfRecordErrorReason, {
30
+ systemOfRecordNotFound: "System of record not found",
31
+ });
32
+ }
33
+ }
34
+ async function updateSystemOfRecord(payload) {
35
+ const { uuid, ...other } = payload;
36
+ try {
37
+ const result = await fetcher.fetch({
38
+ method: "put",
39
+ endpoint: `/systemOfRecordIntegration/systemOfRecords/${uuid}`,
40
+ payload: other,
41
+ });
42
+ return result;
43
+ }
44
+ catch (error) {
45
+ throw getErrorWithReasonErrorMessage(error, SystemOfRecordIntegration.Api.zodUpdateSystemOfRecordErrorReason, {
46
+ systemOfRecordNotFound: "System of record not found",
47
+ });
48
+ }
49
+ }
50
+ async function removeSystemOfRecord(uuid) {
51
+ try {
52
+ const result = await fetcher.fetch({
53
+ method: "delete",
54
+ endpoint: `/systemOfRecordIntegration/systemOfRecords/${uuid}`,
55
+ });
56
+ return result;
57
+ }
58
+ catch (error) {
59
+ throw getErrorWithReasonErrorMessage(error, SystemOfRecordIntegration.Api.zodRemoveSystemOfRecordErrorReason, {
60
+ systemOfRecordNotFound: "System of record not found",
61
+ });
62
+ }
63
+ }
64
+ async function allSystemOfRecords() {
65
+ const result = await fetcher.fetch({
66
+ method: "get",
67
+ endpoint: "/systemOfRecordIntegration/systemOfRecords",
68
+ });
69
+ return result;
70
+ }
71
+ async function migrateSystemOfRecord(payload) {
72
+ await fetcher.fetch({
73
+ method: "post",
74
+ endpoint: `/systemOfRecordIntegration/systemOfRecords/${payload.uuid}/migrate`,
75
+ });
76
+ }
77
+ async function cutoverSystemOfRecord(payload) {
78
+ await fetcher.fetch({
79
+ method: "post",
80
+ endpoint: `/systemOfRecordIntegration/systemOfRecords/${payload.uuid}/cutover`,
81
+ });
82
+ }
83
+ async function query(command) {
84
+ const result = await fetcher.fetch({
85
+ method: "post",
86
+ endpoint: `/systemOfRecordIntegration/clients/query`,
87
+ payload: { command },
88
+ });
89
+ return result;
90
+ }
91
+ async function download(payload) {
92
+ const result = await fetcher.fetch({
93
+ method: "post",
94
+ endpoint: `/systemOfRecordIntegration/clients/download`,
95
+ payload,
96
+ });
97
+ return result;
98
+ }
99
+ async function fetch(payload) {
100
+ const result = await fetcher.fetch({
101
+ method: "post",
102
+ endpoint: "/systemOfRecordIntegration/clients/fetch",
103
+ payload,
104
+ });
105
+ return result;
106
+ }
107
+ async function getDocumentation(slug) {
108
+ const result = await fetcher.fetch({
109
+ method: "get",
110
+ endpoint: `systemOfRecordIntegration/clients/${slug}/documentation`,
111
+ });
112
+ return result.replaceAll("./", `${fetcher.baseUrl}/v1/systemOfRecordIntegration/clients/${slug}/documentation/`);
113
+ }
114
+ async function listLogs(payload) {
115
+ const result = await fetcher.fetch({
116
+ method: "get",
117
+ endpoint: "/systemOfRecordIntegration/logs/list",
118
+ params: payload,
119
+ });
120
+ return result;
121
+ }
122
+ async function getLogsMetrics(payload) {
123
+ const result = await fetcher.fetch({
124
+ method: "get",
125
+ endpoint: "/systemOfRecordIntegration/logs/metrics",
126
+ params: payload,
127
+ });
128
+ return result;
129
+ }
130
+ return {
131
+ systemOfRecord: {
132
+ get: getSystemOfRecord,
133
+ create: createSystemOfRecord,
134
+ update: updateSystemOfRecord,
135
+ remove: removeSystemOfRecord,
136
+ all: allSystemOfRecords,
137
+ migrate: migrateSystemOfRecord,
138
+ cutover: cutoverSystemOfRecord,
139
+ },
140
+ client: {
141
+ getDocumentation,
142
+ query,
143
+ download,
144
+ fetch,
145
+ },
146
+ log: {
147
+ list: listLogs,
148
+ getMetrics: getLogsMetrics,
149
+ },
150
+ };
151
+ };
@@ -0,0 +1,14 @@
1
+ import type { Fetcher } from "../../fetcher/index.js";
2
+ import { UserManagement } from "../../store/index.js";
3
+ interface UserManagementApiDependencies {
4
+ fetcher: Fetcher;
5
+ }
6
+ export interface UserManagementApi {
7
+ user: {
8
+ getCurrent: () => Promise<UserManagement.Api.GetCurrentUserResult>;
9
+ update: (payload: UserManagement.Api.UpdateCurrentUserPayload) => Promise<void>;
10
+ };
11
+ }
12
+ export declare const buildUserManagementApi: ({ fetcher, }: UserManagementApiDependencies) => UserManagementApi;
13
+ export {};
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/userManagement/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,UAAU,6BAA6B;IACrC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACnE,MAAM,EAAE,CACN,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,wBAAwB,KACjD,OAAO,CAAC,IAAI,CAAC,CAAC;KACpB,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB,iBAEhC,6BAA6B,KAAG,iBAwClC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { getErrorWithReasonErrorMessage } from "../../fetcher/index.js";
2
+ import { UserManagement } from "../../store/index.js";
3
+ export const buildUserManagementApi = ({ fetcher, }) => {
4
+ async function getCurrentUser() {
5
+ const result = await fetcher.fetch({
6
+ method: "get",
7
+ endpoint: "/userManagement/users/current",
8
+ withoutWorkspace: true,
9
+ });
10
+ return result;
11
+ }
12
+ async function updateUser(payload) {
13
+ try {
14
+ await fetcher.fetch({
15
+ method: "put",
16
+ endpoint: "/userManagement/users/current",
17
+ payload,
18
+ withoutWorkspace: true,
19
+ });
20
+ }
21
+ catch (error) {
22
+ throw getErrorWithReasonErrorMessage(error, UserManagement.Api.zodUpdateUserErrorReason, {
23
+ userNotFound: "User not found.",
24
+ });
25
+ }
26
+ }
27
+ return {
28
+ user: {
29
+ getCurrent: getCurrentUser,
30
+ update: updateUser,
31
+ },
32
+ };
33
+ };
@@ -0,0 +1,43 @@
1
+ import type { Fetcher } from "../../fetcher/index.js";
2
+ import { WorkspaceManagement } from "../../store/index.js";
3
+ interface WorkspaceManagementApiDependencies {
4
+ fetcher: Fetcher;
5
+ }
6
+ export interface WorkspaceManagementApi {
7
+ workspace: {
8
+ all: (payload: WorkspaceManagement.Api.AllWorkspacesPayload) => Promise<WorkspaceManagement.Api.AllWorkspacesResult>;
9
+ create: (payload: WorkspaceManagement.Api.CreateWorkspacePayload) => Promise<WorkspaceManagement.Api.CreateWorkspaceResult>;
10
+ update: (payload: WorkspaceManagement.Api.UpdateWorkspacePayload) => Promise<WorkspaceManagement.Api.UpdateWorkspaceResult>;
11
+ };
12
+ file: {
13
+ upload: (payload: WorkspaceManagement.Api.UploadFilePayload) => Promise<void>;
14
+ listColumns: (payload: WorkspaceManagement.Api.ListFileColumnsPayload) => Promise<WorkspaceManagement.Api.ListFileColumnsResult>;
15
+ };
16
+ user: {
17
+ create: (payload: WorkspaceManagement.Api.CreateUserPayload) => Promise<void>;
18
+ all: (payload: WorkspaceManagement.Api.AllUsersPayload) => Promise<WorkspaceManagement.Api.AllUsersResult>;
19
+ getCurrent: () => Promise<WorkspaceManagement.Api.GetCurrentUserResult>;
20
+ remove: (payload: WorkspaceManagement.Api.RemoveUserPayload) => Promise<void>;
21
+ update: (payload: WorkspaceManagement.Api.UpdateWorkspaceUserPayload) => Promise<void>;
22
+ upsertPermission: (payload: WorkspaceManagement.Api.UpsertUserPermissionPayload) => Promise<void>;
23
+ removePermission: (payload: WorkspaceManagement.Api.RemoveUserPermissionPayload) => Promise<void>;
24
+ };
25
+ token: {
26
+ create: (payload: WorkspaceManagement.Api.CreateTokenPayload) => Promise<WorkspaceManagement.Api.CreateTokenResult>;
27
+ all: () => Promise<WorkspaceManagement.Api.AllTokensResult>;
28
+ remove: (uuid: string) => Promise<void>;
29
+ };
30
+ role: {
31
+ all: () => Promise<WorkspaceManagement.Api.AllRolesResult>;
32
+ };
33
+ folder: {
34
+ get: (uuid: string) => Promise<WorkspaceManagement.Api.GetFolderResult>;
35
+ all: () => Promise<WorkspaceManagement.Api.ListFoldersResult>;
36
+ create: (payload: WorkspaceManagement.Api.CreateFolderPayload) => Promise<WorkspaceManagement.Api.CreateFolderResult>;
37
+ update: (payload: WorkspaceManagement.Api.UpdateFolderPayload) => Promise<WorkspaceManagement.Api.UpdateFolderResult>;
38
+ remove: (uuid: string) => Promise<void>;
39
+ };
40
+ }
41
+ export declare const buildWorkspaceManagementApi: ({ fetcher, }: WorkspaceManagementApiDependencies) => WorkspaceManagementApi;
42
+ export {};
43
+ //# sourceMappingURL=index.d.ts.map