@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,241 @@
1
+ import { getErrorWithReasonErrorMessage } from "../../fetcher/index.js";
2
+ import { RevenueOrganization } from "../../store/index.js";
3
+ export const buildRevenueOrganizationApi = ({ fetcher, }) => {
4
+ async function getAllocation(uuid) {
5
+ const result = await fetcher.fetch({
6
+ method: "get",
7
+ endpoint: `revenueOrganization/allocations/${uuid}`,
8
+ });
9
+ return result;
10
+ }
11
+ async function listAllocations(payload) {
12
+ const result = await fetcher.fetch({
13
+ method: "get",
14
+ endpoint: "revenueOrganization/allocations/list",
15
+ params: payload,
16
+ });
17
+ return result;
18
+ }
19
+ async function removeAllocation(uuid) {
20
+ try {
21
+ await fetcher.fetch({
22
+ method: "delete",
23
+ endpoint: `revenueOrganization/allocations/${uuid}`,
24
+ });
25
+ }
26
+ catch (error) {
27
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodRemoveAllocationErrorReason, {
28
+ allocationNotFound: "Allocation not found.",
29
+ });
30
+ }
31
+ }
32
+ async function createCapacity(payload) {
33
+ try {
34
+ const result = await fetcher.fetch({
35
+ method: "post",
36
+ endpoint: `revenueOrganization/capacities`,
37
+ payload,
38
+ });
39
+ return result;
40
+ }
41
+ catch (error) {
42
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodCreateCapacityErrorReason, {
43
+ emptyFilter: "Filter cannot be empty.",
44
+ invalidIdColumnSlug: "Invalid ID column.",
45
+ invalidTimeColumnSlug: "Invalid Time column.",
46
+ invalidFilter: "Invalid filter.",
47
+ });
48
+ }
49
+ }
50
+ async function getCapacity(uuid) {
51
+ const result = await fetcher.fetch({
52
+ method: "get",
53
+ endpoint: `revenueOrganization/capacities/${uuid}`,
54
+ });
55
+ return result;
56
+ }
57
+ async function allCapacities() {
58
+ const result = await fetcher.fetch({
59
+ method: "get",
60
+ endpoint: "revenueOrganization/capacities/list",
61
+ });
62
+ return result;
63
+ }
64
+ async function removeCapacity(uuid) {
65
+ try {
66
+ await fetcher.fetch({
67
+ method: "delete",
68
+ endpoint: `revenueOrganization/capacities/${uuid}`,
69
+ });
70
+ }
71
+ catch (error) {
72
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodRemoveCapacityErrorReason, {
73
+ capacityNotFound: "Capacity not found.",
74
+ });
75
+ }
76
+ }
77
+ async function updateCapacity(payload) {
78
+ const { uuid, ...other } = payload;
79
+ try {
80
+ const result = await fetcher.fetch({
81
+ method: "put",
82
+ endpoint: `revenueOrganization/capacities/${uuid}`,
83
+ payload: other,
84
+ });
85
+ return result;
86
+ }
87
+ catch (error) {
88
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodUpdateCapacityErrorReason, {
89
+ capacityNotFound: "Capacity not found.",
90
+ emptyFilter: "Filter cannot be empty.",
91
+ invalidIdColumnSlug: "Invalid ID column.",
92
+ invalidTimeColumnSlug: "Invalid Time column.",
93
+ invalidFilter: "Invalid filter.",
94
+ });
95
+ }
96
+ }
97
+ async function syncMembers(payload) {
98
+ await fetcher.fetch({
99
+ method: "post",
100
+ endpoint: `revenueOrganization/members/sync`,
101
+ payload,
102
+ });
103
+ }
104
+ async function archiveMember(uuid) {
105
+ try {
106
+ const result = await fetcher.fetch({
107
+ method: "post",
108
+ endpoint: `revenueOrganization/members/${uuid}/archive`,
109
+ });
110
+ return result;
111
+ }
112
+ catch (error) {
113
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodArchiveMemberErrorReason, {
114
+ memberNotFound: "Member not found.",
115
+ });
116
+ }
117
+ }
118
+ async function getMember(uuid) {
119
+ const result = await fetcher.fetch({
120
+ method: "get",
121
+ endpoint: `revenueOrganization/members/${uuid}`,
122
+ });
123
+ return result;
124
+ }
125
+ async function allMembers() {
126
+ const result = await fetcher.fetch({
127
+ method: "get",
128
+ endpoint: "revenueOrganization/members/list",
129
+ });
130
+ return result;
131
+ }
132
+ async function unarchiveMember(uuid) {
133
+ try {
134
+ const result = await fetcher.fetch({
135
+ method: "post",
136
+ endpoint: `revenueOrganization/members/${uuid}/unarchive`,
137
+ });
138
+ return result;
139
+ }
140
+ catch (error) {
141
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodUnarchiveMemberErrorReason, {
142
+ memberNotFound: "Member not found.",
143
+ });
144
+ }
145
+ }
146
+ async function updateMember(payload) {
147
+ try {
148
+ const result = await fetcher.fetch({
149
+ method: "put",
150
+ endpoint: `revenueOrganization/members/${payload.uuid}`,
151
+ payload: { meta: payload.meta },
152
+ });
153
+ return result;
154
+ }
155
+ catch (error) {
156
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodUpdateMemberErrorReason, {
157
+ memberNotFound: "Member not found.",
158
+ });
159
+ }
160
+ }
161
+ async function createTerritory(payload) {
162
+ const result = await fetcher.fetch({
163
+ method: "post",
164
+ endpoint: `revenueOrganization/territories`,
165
+ payload,
166
+ });
167
+ return result;
168
+ }
169
+ async function getTerritory(uuid) {
170
+ const result = await fetcher.fetch({
171
+ method: "get",
172
+ endpoint: `revenueOrganization/territories/${uuid}`,
173
+ });
174
+ return result;
175
+ }
176
+ async function allTerritories() {
177
+ const result = await fetcher.fetch({
178
+ method: "get",
179
+ endpoint: "revenueOrganization/territories/list",
180
+ });
181
+ return result;
182
+ }
183
+ async function removeTerritory(uuid) {
184
+ try {
185
+ await fetcher.fetch({
186
+ method: "delete",
187
+ endpoint: `revenueOrganization/territories/${uuid}`,
188
+ });
189
+ }
190
+ catch (error) {
191
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodRemoveTerritoryErrorReason, {
192
+ territoryNotFound: "Territory not found.",
193
+ });
194
+ }
195
+ }
196
+ async function updateTerritory(payload) {
197
+ const { uuid, ...other } = payload;
198
+ try {
199
+ const result = await fetcher.fetch({
200
+ method: "put",
201
+ endpoint: `revenueOrganization/territories/${uuid}`,
202
+ payload: other,
203
+ });
204
+ return result;
205
+ }
206
+ catch (error) {
207
+ throw getErrorWithReasonErrorMessage(error, RevenueOrganization.Api.zodUpdateTerritoryErrorReason, {
208
+ territoryNotFound: "Territory not found.",
209
+ });
210
+ }
211
+ }
212
+ return {
213
+ allocation: {
214
+ get: getAllocation,
215
+ list: listAllocations,
216
+ remove: removeAllocation,
217
+ },
218
+ capacity: {
219
+ create: createCapacity,
220
+ get: getCapacity,
221
+ all: allCapacities,
222
+ remove: removeCapacity,
223
+ update: updateCapacity,
224
+ },
225
+ member: {
226
+ sync: syncMembers,
227
+ archive: archiveMember,
228
+ get: getMember,
229
+ all: allMembers,
230
+ unarchive: unarchiveMember,
231
+ update: updateMember,
232
+ },
233
+ territory: {
234
+ create: createTerritory,
235
+ get: getTerritory,
236
+ all: allTerritories,
237
+ remove: removeTerritory,
238
+ update: updateTerritory,
239
+ },
240
+ };
241
+ };
@@ -0,0 +1,28 @@
1
+ import type { Fetcher } from "../../fetcher/index.js";
2
+ import { Segmentation } from "../../store/index.js";
3
+ interface SegmentationApiDependencies {
4
+ fetcher: Fetcher;
5
+ }
6
+ export interface SegmentationApi {
7
+ segment: {
8
+ create: (payload: Segmentation.Api.CreateSegmentPayload) => Promise<Segmentation.Api.CreateSegmentResult>;
9
+ download: (payload: Segmentation.Api.DownloadSegmentPayload) => Promise<Segmentation.Api.DownloadSegmentResult>;
10
+ fetch: (payload: Segmentation.Api.FetchSegmentPayload) => Promise<Segmentation.Api.FetchSegmentResult>;
11
+ get: (uuid: string) => Promise<Segmentation.Api.GetSegmentResult>;
12
+ all: () => Promise<Segmentation.Api.AllSegmentsResult>;
13
+ remove: (uuid: string) => Promise<void>;
14
+ update: (payload: Segmentation.Api.UpdateSegmentPayload) => Promise<Segmentation.Api.UpdateSegmentResult>;
15
+ };
16
+ change: {
17
+ download: (payload: Segmentation.Api.DownloadChangePayload) => Promise<Segmentation.Api.DownloadChangeResult>;
18
+ get: (uuid: string) => Promise<Segmentation.Api.GetChangeResult>;
19
+ list: (payload: Segmentation.Api.ListChangesPayload) => Promise<Segmentation.Api.ListChangesResult>;
20
+ fetch: (payload: Segmentation.Api.FetchChangePayload) => Promise<Segmentation.Api.FetchChangeResult>;
21
+ };
22
+ record: {
23
+ fetch: (payload: Segmentation.Api.FetchRecordPayload) => Promise<Segmentation.Api.FetchRecordResult>;
24
+ };
25
+ }
26
+ export declare const buildSegmentationApi: ({ fetcher, }: SegmentationApiDependencies) => SegmentationApi;
27
+ export {};
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/segmentation/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,UAAU,2BAA2B;IACnC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE;QACP,MAAM,EAAE,CACN,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,oBAAoB,KAC3C,OAAO,CAA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D,CAAC;IACF,MAAM,EAAE;QACN,KAAK,EAAE,CACL,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,kBAAkB,KACzC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;KAClD,CAAC;CACH;AAED,eAAO,MAAM,oBAAoB,iBAE9B,2BAA2B,KAAG,eAiPhC,CAAC"}
@@ -0,0 +1,188 @@
1
+ import { nullToUndefined } from "cargo-utils";
2
+ import { getErrorWithReasonErrorMessage } from "../../fetcher/index.js";
3
+ import { Segmentation } from "../../store/index.js";
4
+ export const buildSegmentationApi = ({ fetcher, }) => {
5
+ async function createSegment(payload) {
6
+ try {
7
+ const result = await fetcher.fetch({
8
+ method: "post",
9
+ endpoint: "/segmentation/segments",
10
+ payload,
11
+ });
12
+ return result;
13
+ }
14
+ catch (error) {
15
+ throw getErrorWithReasonErrorMessage(error, Segmentation.Api.zodCreateSegmentErrorReason, {
16
+ invalidFilter: "Invalid filter.",
17
+ });
18
+ }
19
+ }
20
+ async function downloadSegment(payload) {
21
+ try {
22
+ const result = await fetcher.fetch({
23
+ method: "post",
24
+ endpoint: "/segmentation/segments/download",
25
+ payload,
26
+ });
27
+ return result;
28
+ }
29
+ catch (error) {
30
+ throw getErrorWithReasonErrorMessage(error, Segmentation.Api.zodDownloadSegmentErrorReason, {
31
+ invalidFilter: "Invalid filter.",
32
+ failedToDownloadRecordsFromClient: "Failed to download records.",
33
+ });
34
+ }
35
+ }
36
+ async function fetchSegment(payload) {
37
+ try {
38
+ const result = await fetcher.fetch({
39
+ method: "post",
40
+ endpoint: "/segmentation/segments/fetch",
41
+ payload,
42
+ });
43
+ return result;
44
+ }
45
+ catch (error) {
46
+ throw getErrorWithReasonErrorMessage(error, Segmentation.Api.zodFetchSegmentErrorReason, {
47
+ invalidFilter: "Invalid filter.",
48
+ });
49
+ }
50
+ }
51
+ async function getSegment(uuid) {
52
+ const result = await fetcher.fetch({
53
+ method: "get",
54
+ endpoint: `/segmentation/segments/${uuid}`,
55
+ });
56
+ return result;
57
+ }
58
+ async function allSegments() {
59
+ const result = await fetcher.fetch({
60
+ method: "get",
61
+ endpoint: `/segmentation/segments/list`,
62
+ });
63
+ return result;
64
+ }
65
+ async function removeSegment(uuid) {
66
+ try {
67
+ await fetcher.fetch({
68
+ method: "delete",
69
+ endpoint: `/segmentation/segments/${uuid}`,
70
+ payload: {}, // can be removed ?
71
+ });
72
+ }
73
+ catch (error) {
74
+ throw getErrorWithReasonErrorMessage(error, Segmentation.Api.zodRemoveSegmentErrorReason, {
75
+ segmentLinkedToWorkflow: "Segment is linked to a workflow.",
76
+ segmentAlreadyRemoved: "Segment is already removed",
77
+ segmentNotFound: "Segment not found.",
78
+ });
79
+ }
80
+ }
81
+ async function updateSegment(payload) {
82
+ const { uuid, ...other } = payload;
83
+ try {
84
+ const result = await fetcher.fetch({
85
+ method: "put",
86
+ endpoint: `/segmentation/segments/${uuid}`,
87
+ payload: other,
88
+ });
89
+ return result;
90
+ }
91
+ catch (error) {
92
+ throw getErrorWithReasonErrorMessage(error, Segmentation.Api.zodUpdateSegmentErrorReason, {
93
+ segmentNotFound: "Segment not found.",
94
+ invalidFilter: "Invalid filter.",
95
+ segmentLinkedToWorkflow: "Segment is linked to a workflow.",
96
+ });
97
+ }
98
+ }
99
+ async function downloadChange(payload) {
100
+ const { uuid, ...other } = payload;
101
+ try {
102
+ const result = await fetcher.fetch({
103
+ method: "post",
104
+ endpoint: `/segmentation/changes/${uuid}/download`,
105
+ payload: other,
106
+ });
107
+ return result;
108
+ }
109
+ catch (error) {
110
+ throw getErrorWithReasonErrorMessage(error, Segmentation.Api.zodDownloadChangeErrorReason, {
111
+ changeNotFound: "Change not found.",
112
+ segmentNotFound: "Segment not found.",
113
+ failedToDownloadRecordsFromClient: "Failed to download records.",
114
+ });
115
+ }
116
+ }
117
+ async function fetchChange(payload) {
118
+ const { uuid, ...other } = payload;
119
+ try {
120
+ const result = await fetcher.fetch({
121
+ method: "post",
122
+ endpoint: `/segmentation/changes/${uuid}/fetch`,
123
+ payload: other,
124
+ });
125
+ return result;
126
+ }
127
+ catch (error) {
128
+ throw getErrorWithReasonErrorMessage(error, Segmentation.Api.zodFetchChangeErrorReason, {
129
+ changeNotFound: "Change not found.",
130
+ segmentNotFound: "Segment not found.",
131
+ });
132
+ }
133
+ }
134
+ async function getChange(uuid) {
135
+ const result = await fetcher.fetch({
136
+ method: "get",
137
+ endpoint: `/segmentation/changes/${uuid}`,
138
+ });
139
+ return result;
140
+ }
141
+ async function listChanges(payload) {
142
+ const result = await fetcher.fetch({
143
+ method: "get",
144
+ endpoint: "/segmentation/changes/list",
145
+ params: payload,
146
+ });
147
+ return result;
148
+ }
149
+ async function fetchRecord(payload) {
150
+ try {
151
+ const result = await fetcher.fetch({
152
+ method: "post",
153
+ endpoint: "/segmentation/records/fetch",
154
+ payload,
155
+ replaceNullByUndefined: false,
156
+ });
157
+ return {
158
+ ...nullToUndefined(result),
159
+ records: result.records,
160
+ };
161
+ }
162
+ catch (error) {
163
+ throw getErrorWithReasonErrorMessage(error, Segmentation.Api.zodFetchRecordErrorReason, {
164
+ invalidFilter: "Invalid filter.",
165
+ });
166
+ }
167
+ }
168
+ return {
169
+ segment: {
170
+ create: createSegment,
171
+ download: downloadSegment,
172
+ fetch: fetchSegment,
173
+ get: getSegment,
174
+ remove: removeSegment,
175
+ update: updateSegment,
176
+ all: allSegments,
177
+ },
178
+ change: {
179
+ download: downloadChange,
180
+ get: getChange,
181
+ list: listChanges,
182
+ fetch: fetchChange,
183
+ },
184
+ record: {
185
+ fetch: fetchRecord,
186
+ },
187
+ };
188
+ };
@@ -0,0 +1,45 @@
1
+ import type { Fetcher } from "../../fetcher/index.js";
2
+ import { Storage } from "../../store/index.js";
3
+ interface StorageApiDependencies {
4
+ fetcher: Fetcher;
5
+ }
6
+ export interface StorageApi {
7
+ column: {
8
+ create: (payload: Storage.Api.CreateColumnPayload) => Promise<void>;
9
+ update: (payload: Storage.Api.UpdateColumnPayload) => Promise<void>;
10
+ remove: (payload: Storage.Api.RemoveColumnPayload) => Promise<void>;
11
+ reorder: (payload: Storage.Api.ReorderColumnPayload) => Promise<void>;
12
+ existsBySlug: (payload: Storage.Api.ModelColumnExistsBySlugPayload) => Promise<Storage.Api.ModelColumnExistsBySlugResult>;
13
+ autocomplete: (payload: Storage.Api.ModelColumnAutocompletePayload) => Promise<Storage.Api.ModelColumnAutocompleteResult>;
14
+ };
15
+ dataset: {
16
+ create: (payload: Storage.Api.CreateDatasetPayload) => Promise<Storage.Api.CreateDatasetResult>;
17
+ all: () => Promise<Storage.Api.AllDatasetResult>;
18
+ get: (uuid: string) => Promise<Storage.Api.GetDatasetResult>;
19
+ };
20
+ model: {
21
+ all: () => Promise<Storage.Api.AllModelResult>;
22
+ create: (payload: Storage.Api.CreateModelPayload) => Promise<Storage.Api.CreateModelResult>;
23
+ update: (payload: Storage.Api.UpdateModelPayload) => Promise<Storage.Api.UpdateModelResult>;
24
+ remove: (uuid: string) => Promise<void>;
25
+ sync: (uuid: string) => Promise<Storage.Api.SyncModelResult>;
26
+ existsBySlug: (payload: Storage.Api.ModelExistsBySlugPayload) => Promise<Storage.Api.ModelExistsBySlugResult>;
27
+ preview: (payload: Storage.Api.PreviewModelPayload) => Promise<Storage.Api.PreviewModelResult>;
28
+ previewCount: (payload: Storage.Api.PreviewCountModelPayload) => Promise<Storage.Api.PreviewCountModelResult>;
29
+ };
30
+ relationship: {
31
+ all: () => Promise<Storage.Api.AllRelationshipsResult>;
32
+ set: (kind: Storage.Api.SetRelationshipsPayload) => Promise<Storage.Api.SetRelationshipsResult>;
33
+ };
34
+ run: {
35
+ create: (payload: Storage.Api.CreateRunPayload) => Promise<Storage.Api.CreateRunResult>;
36
+ list: (payload: Storage.Api.ListRunsPayload) => Promise<Storage.Api.ListRunsResult>;
37
+ cancel: (uuid: string) => Promise<void>;
38
+ };
39
+ record: {
40
+ list: (payload: Storage.Api.ListRecordsPayload) => Promise<Storage.Api.ListRecordsResult>;
41
+ };
42
+ }
43
+ export declare const buildStorageApi: ({ fetcher, }: StorageApiDependencies) => StorageApi;
44
+ export {};
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE;QACN,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACpE,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACpE,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACpE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACtE,YAAY,EAAE,CACZ,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,8BAA8B,KAChD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QACxD,YAAY,EAAE,CACZ,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,8BAA8B,KAChD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;KACzD,CAAC;IACF,OAAO,EAAE;QACP,MAAM,EAAE,CACN,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,KACtC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CA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