@unito/integrations-platform-client 1.0.0 → 1.0.2
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.
- package/dist/src/addons.d.ts +91 -3
- package/dist/src/addons.js +100 -2
- package/dist/src/api.d.ts +24 -0
- package/dist/src/index.cjs +142 -47
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +0 -2
- package/package.json +4 -4
package/dist/src/addons.d.ts
CHANGED
|
@@ -1,23 +1,54 @@
|
|
|
1
1
|
import * as IntegrationApi from '@unito/integration-api';
|
|
2
2
|
import * as Oazapfts from '@oazapfts/runtime';
|
|
3
|
+
import { HttpError } from '@oazapfts/runtime';
|
|
4
|
+
export { HttpError };
|
|
5
|
+
import { Error } from './api.js';
|
|
3
6
|
/**
|
|
7
|
+
* Provides a type guard for ItemResponse.
|
|
8
|
+
*
|
|
4
9
|
* Return true if object has the shape of an item, false otherwise.
|
|
5
10
|
* @param object
|
|
6
11
|
*/
|
|
7
12
|
export declare function isItemResponse(object: unknown): object is Response<IntegrationApi.Item>;
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
14
|
+
* Provides a type guard for ItemSummaryResponse.
|
|
15
|
+
*
|
|
16
|
+
* Return true if object has the shape of an item summary, false otherwise.
|
|
10
17
|
* @param object
|
|
11
18
|
*/
|
|
12
19
|
export declare function isItemSummaryResponse(object: unknown): object is Response<IntegrationApi.ItemSummary>;
|
|
13
20
|
/**
|
|
21
|
+
* Provides a type guard for CollectionResponse.
|
|
22
|
+
*
|
|
14
23
|
* Return true if object has the shape of a collection, false otherwise.
|
|
15
24
|
* @param object
|
|
16
25
|
*/
|
|
17
26
|
export declare function isCollectionResponse(object: unknown): object is Response<IntegrationApi.Collection>;
|
|
27
|
+
/**
|
|
28
|
+
* Provides a type guard for ErrorResponse.
|
|
29
|
+
*
|
|
30
|
+
* Return true if object has the shape of an error response, false otherwise.
|
|
31
|
+
* @param object
|
|
32
|
+
*/
|
|
18
33
|
export declare function isErrorResponse(object: unknown): object is ErrorResponse;
|
|
19
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Opt-in optimistic mode.
|
|
36
|
+
*
|
|
37
|
+
* Returns the typed response's data if it's a success, otherwise throws an HttpError.
|
|
38
|
+
*
|
|
39
|
+
* @param response received from the Integrations Platform Client
|
|
40
|
+
* @returns the response's data, typed, if it's a success
|
|
41
|
+
*/
|
|
42
|
+
export declare function optimistic<T>(asyncResponse: Promise<Response<T> | ErrorResponse>): Promise<T>;
|
|
43
|
+
type Response<T> = ({
|
|
20
44
|
status: 200;
|
|
45
|
+
} | {
|
|
46
|
+
status: 201;
|
|
47
|
+
} | {
|
|
48
|
+
status: 202;
|
|
49
|
+
} | {
|
|
50
|
+
status: 204;
|
|
51
|
+
}) & {
|
|
21
52
|
data: T;
|
|
22
53
|
headers: Headers;
|
|
23
54
|
};
|
|
@@ -43,24 +74,81 @@ type ErrorResponse = ({
|
|
|
43
74
|
data: Error;
|
|
44
75
|
headers: Headers;
|
|
45
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Wrapper of getProxyGraph that returns a typed response containing an Item upon success.
|
|
79
|
+
*
|
|
80
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
81
|
+
* @param path The path to the item to fetch
|
|
82
|
+
* @param headers The headers to include in the request
|
|
83
|
+
* @param opts Additional options
|
|
84
|
+
* @returns A successful response containing an Item, or an ErrorResponse
|
|
85
|
+
*/
|
|
46
86
|
export declare function getProxyGraphItem(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
47
87
|
xUnitoCorrelationId?: string;
|
|
48
88
|
xUnitoAdditionalLoggingContext?: string;
|
|
49
89
|
}, opts?: Oazapfts.RequestOpts): Promise<Response<IntegrationApi.Item> | ErrorResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Wrapper of getProxyGraph that returns a typed response containing a Collection upon success.
|
|
92
|
+
*
|
|
93
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
94
|
+
* @param path The path to the item to fetch
|
|
95
|
+
* @param headers The headers to include in the request
|
|
96
|
+
* @param opts Additional options
|
|
97
|
+
* @returns A successful response containing an Collection, or an ErrorResponse
|
|
98
|
+
*/
|
|
50
99
|
export declare function getProxyGraphCollection(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
51
100
|
xUnitoCorrelationId?: string;
|
|
52
101
|
xUnitoAdditionalLoggingContext?: string;
|
|
53
102
|
}, opts?: Oazapfts.RequestOpts): Promise<Response<IntegrationApi.Collection> | ErrorResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Wrapper of patchProxyGraph that returns a typed response containing the updated Item upon success.
|
|
105
|
+
*
|
|
106
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
107
|
+
* @param path The path to the item to fetch
|
|
108
|
+
* @param headers The headers to include in the request
|
|
109
|
+
* @param opts Additional options
|
|
110
|
+
* @returns A successful response containing an Item, or an ErrorResponse
|
|
111
|
+
*/
|
|
54
112
|
export declare function patchProxyGraphItem(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
55
113
|
xUnitoCorrelationId?: string;
|
|
56
114
|
xUnitoAdditionalLoggingContext?: string;
|
|
57
115
|
}, opts?: Oazapfts.RequestOpts): Promise<Response<IntegrationApi.Item> | ErrorResponse>;
|
|
116
|
+
/**
|
|
117
|
+
* Wrapper of postProxyGraph that returns a typed response containing the created ItemSummary upon success.
|
|
118
|
+
*
|
|
119
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
120
|
+
* @param path The path to the item to fetch
|
|
121
|
+
* @param headers The headers to include in the request
|
|
122
|
+
* @param opts Additional options
|
|
123
|
+
* @returns A successful response containing an ItemSummary, or an ErrorResponse
|
|
124
|
+
*/
|
|
58
125
|
export declare function postProxyGraphCollection(xUnitoCredentialId: string, path: string, body?: object, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
59
126
|
xUnitoCorrelationId?: string;
|
|
60
127
|
xUnitoAdditionalLoggingContext?: string;
|
|
61
128
|
}, opts?: Oazapfts.RequestOpts): Promise<Response<IntegrationApi.ItemSummary> | ErrorResponse>;
|
|
129
|
+
/**
|
|
130
|
+
* Wrapper of deleteProxyGraph added for uniformity, doesn't provide much typing help.
|
|
131
|
+
*
|
|
132
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
133
|
+
* @param path The path to the item to fetch
|
|
134
|
+
* @param headers The headers to include in the request
|
|
135
|
+
* @param opts Additional options
|
|
136
|
+
*/
|
|
62
137
|
export declare function deleteProxyGraphItem(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, }?: {
|
|
63
138
|
xUnitoCorrelationId?: string;
|
|
64
139
|
xUnitoAdditionalLoggingContext?: string;
|
|
65
140
|
}, opts?: Oazapfts.RequestOpts): Promise<void>;
|
|
66
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Call an integration's graph and returns the fetch response directly to enable streaming of the body as it comes in.
|
|
143
|
+
*
|
|
144
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
145
|
+
* @param path The path to the item to fetch
|
|
146
|
+
* @param headers Base headers to add to the request
|
|
147
|
+
* @param additionalHeaders Additional headers to add to the request
|
|
148
|
+
* @returns fetch's response
|
|
149
|
+
*/
|
|
150
|
+
export declare function fetchProxyGraph(xUnitoCredentialId: string, path: string, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, accept, }?: {
|
|
151
|
+
xUnitoCorrelationId?: string;
|
|
152
|
+
xUnitoAdditionalLoggingContext?: string;
|
|
153
|
+
accept?: string;
|
|
154
|
+
}, init?: RequestInit): Promise<globalThis.Response>;
|
package/dist/src/addons.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// MANUAL ADDONS
|
|
2
|
-
import
|
|
2
|
+
import * as Oazapfts from '@oazapfts/runtime';
|
|
3
|
+
import * as QS from '@oazapfts/runtime/query';
|
|
4
|
+
import { HttpError } from '@oazapfts/runtime';
|
|
5
|
+
export { HttpError };
|
|
6
|
+
import { defaults, getProxyGraph, patchProxyGraph, postProxyGraph, deleteProxyGraph } from './api.js';
|
|
7
|
+
const oazapfts = Oazapfts.runtime(defaults);
|
|
3
8
|
/**
|
|
9
|
+
* Provides a type guard for ItemResponse.
|
|
10
|
+
*
|
|
4
11
|
* Return true if object has the shape of an item, false otherwise.
|
|
5
12
|
* @param object
|
|
6
13
|
*/
|
|
@@ -9,7 +16,9 @@ export function isItemResponse(object) {
|
|
|
9
16
|
return !!object && !!data && typeof data === 'object' && 'fields' in data && 'relations' in data;
|
|
10
17
|
}
|
|
11
18
|
/**
|
|
12
|
-
*
|
|
19
|
+
* Provides a type guard for ItemSummaryResponse.
|
|
20
|
+
*
|
|
21
|
+
* Return true if object has the shape of an item summary, false otherwise.
|
|
13
22
|
* @param object
|
|
14
23
|
*/
|
|
15
24
|
export function isItemSummaryResponse(object) {
|
|
@@ -17,6 +26,8 @@ export function isItemSummaryResponse(object) {
|
|
|
17
26
|
return !!object && !!data && typeof data === 'object' && 'path' in data;
|
|
18
27
|
}
|
|
19
28
|
/**
|
|
29
|
+
* Provides a type guard for CollectionResponse.
|
|
30
|
+
*
|
|
20
31
|
* Return true if object has the shape of a collection, false otherwise.
|
|
21
32
|
* @param object
|
|
22
33
|
*/
|
|
@@ -24,10 +35,40 @@ export function isCollectionResponse(object) {
|
|
|
24
35
|
const data = object.data;
|
|
25
36
|
return !!object && !!data && typeof data === 'object' && 'info' in data && 'data' in data && Array.isArray(data.data);
|
|
26
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Provides a type guard for ErrorResponse.
|
|
40
|
+
*
|
|
41
|
+
* Return true if object has the shape of an error response, false otherwise.
|
|
42
|
+
* @param object
|
|
43
|
+
*/
|
|
27
44
|
export function isErrorResponse(object) {
|
|
28
45
|
const status = object.status;
|
|
29
46
|
return !!object && typeof object === 'object' && status && status >= 400 && 'data' in object && 'headers' in object;
|
|
30
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Opt-in optimistic mode.
|
|
50
|
+
*
|
|
51
|
+
* Returns the typed response's data if it's a success, otherwise throws an HttpError.
|
|
52
|
+
*
|
|
53
|
+
* @param response received from the Integrations Platform Client
|
|
54
|
+
* @returns the response's data, typed, if it's a success
|
|
55
|
+
*/
|
|
56
|
+
export async function optimistic(asyncResponse) {
|
|
57
|
+
const response = await asyncResponse;
|
|
58
|
+
if (isErrorResponse(response)) {
|
|
59
|
+
throw new HttpError(response.status, response.data, response.headers);
|
|
60
|
+
}
|
|
61
|
+
return response.data;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Wrapper of getProxyGraph that returns a typed response containing an Item upon success.
|
|
65
|
+
*
|
|
66
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
67
|
+
* @param path The path to the item to fetch
|
|
68
|
+
* @param headers The headers to include in the request
|
|
69
|
+
* @param opts Additional options
|
|
70
|
+
* @returns A successful response containing an Item, or an ErrorResponse
|
|
71
|
+
*/
|
|
31
72
|
export async function getProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
32
73
|
const response = await getProxyGraph(xUnitoCredentialId, path, {
|
|
33
74
|
xUnitoCorrelationId,
|
|
@@ -40,6 +81,15 @@ export async function getProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrel
|
|
|
40
81
|
throw new Error(`Response does not match expected Item shape`);
|
|
41
82
|
}
|
|
42
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Wrapper of getProxyGraph that returns a typed response containing a Collection upon success.
|
|
86
|
+
*
|
|
87
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
88
|
+
* @param path The path to the item to fetch
|
|
89
|
+
* @param headers The headers to include in the request
|
|
90
|
+
* @param opts Additional options
|
|
91
|
+
* @returns A successful response containing an Collection, or an ErrorResponse
|
|
92
|
+
*/
|
|
43
93
|
export async function getProxyGraphCollection(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
44
94
|
const response = await getProxyGraph(xUnitoCredentialId, path, {
|
|
45
95
|
xUnitoCorrelationId,
|
|
@@ -52,6 +102,15 @@ export async function getProxyGraphCollection(xUnitoCredentialId, path, { xUnito
|
|
|
52
102
|
throw new Error(`Response does not match expected Collection shape`);
|
|
53
103
|
}
|
|
54
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Wrapper of patchProxyGraph that returns a typed response containing the updated Item upon success.
|
|
107
|
+
*
|
|
108
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
109
|
+
* @param path The path to the item to fetch
|
|
110
|
+
* @param headers The headers to include in the request
|
|
111
|
+
* @param opts Additional options
|
|
112
|
+
* @returns A successful response containing an Item, or an ErrorResponse
|
|
113
|
+
*/
|
|
55
114
|
export async function patchProxyGraphItem(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
56
115
|
const response = await patchProxyGraph(xUnitoCredentialId, path, body, {
|
|
57
116
|
xUnitoCorrelationId,
|
|
@@ -64,6 +123,15 @@ export async function patchProxyGraphItem(xUnitoCredentialId, path, body, { xUni
|
|
|
64
123
|
throw new Error(`Response does not match expected Item shape`);
|
|
65
124
|
}
|
|
66
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Wrapper of postProxyGraph that returns a typed response containing the created ItemSummary upon success.
|
|
128
|
+
*
|
|
129
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
130
|
+
* @param path The path to the item to fetch
|
|
131
|
+
* @param headers The headers to include in the request
|
|
132
|
+
* @param opts Additional options
|
|
133
|
+
* @returns A successful response containing an ItemSummary, or an ErrorResponse
|
|
134
|
+
*/
|
|
67
135
|
export async function postProxyGraphCollection(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
68
136
|
const response = await postProxyGraph(xUnitoCredentialId, path, body, {
|
|
69
137
|
xUnitoCorrelationId,
|
|
@@ -76,9 +144,39 @@ export async function postProxyGraphCollection(xUnitoCredentialId, path, body, {
|
|
|
76
144
|
throw new Error(`Response does not match expected ItemSummary shape`);
|
|
77
145
|
}
|
|
78
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Wrapper of deleteProxyGraph added for uniformity, doesn't provide much typing help.
|
|
149
|
+
*
|
|
150
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
151
|
+
* @param path The path to the item to fetch
|
|
152
|
+
* @param headers The headers to include in the request
|
|
153
|
+
* @param opts Additional options
|
|
154
|
+
*/
|
|
79
155
|
export async function deleteProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
80
156
|
await deleteProxyGraph(xUnitoCredentialId, path, {
|
|
81
157
|
xUnitoCorrelationId,
|
|
82
158
|
xUnitoAdditionalLoggingContext,
|
|
83
159
|
}, opts);
|
|
84
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Call an integration's graph and returns the fetch response directly to enable streaming of the body as it comes in.
|
|
163
|
+
*
|
|
164
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
165
|
+
* @param path The path to the item to fetch
|
|
166
|
+
* @param headers Base headers to add to the request
|
|
167
|
+
* @param additionalHeaders Additional headers to add to the request
|
|
168
|
+
* @returns fetch's response
|
|
169
|
+
*/
|
|
170
|
+
export async function fetchProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, accept, } = {}, init) {
|
|
171
|
+
return fetch(`${defaults.baseUrl}/proxy/graph${QS.query(QS.explode({ path }))}`, {
|
|
172
|
+
...(init ?? {}),
|
|
173
|
+
headers: oazapfts.mergeHeaders({
|
|
174
|
+
...defaults.headers,
|
|
175
|
+
...(init?.headers ?? {}),
|
|
176
|
+
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
177
|
+
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
178
|
+
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
179
|
+
Accept: accept,
|
|
180
|
+
}),
|
|
181
|
+
});
|
|
182
|
+
}
|
package/dist/src/api.d.ts
CHANGED
|
@@ -906,9 +906,15 @@ export declare function getProxyMe(xUnitoCredentialId: string, { xUnitoCorrelati
|
|
|
906
906
|
} | {
|
|
907
907
|
status: 404;
|
|
908
908
|
data: Error;
|
|
909
|
+
} | {
|
|
910
|
+
status: 410;
|
|
911
|
+
data: Error;
|
|
909
912
|
} | {
|
|
910
913
|
status: 422;
|
|
911
914
|
data: Error;
|
|
915
|
+
} | {
|
|
916
|
+
status: 423;
|
|
917
|
+
data: Error;
|
|
912
918
|
} | {
|
|
913
919
|
status: 500;
|
|
914
920
|
data: Error;
|
|
@@ -939,9 +945,15 @@ export declare function updateWebhookSubscription(xUnitoCredentialId: string, bo
|
|
|
939
945
|
} | {
|
|
940
946
|
status: 404;
|
|
941
947
|
data: Error;
|
|
948
|
+
} | {
|
|
949
|
+
status: 410;
|
|
950
|
+
data: Error;
|
|
942
951
|
} | {
|
|
943
952
|
status: 422;
|
|
944
953
|
data: Error;
|
|
954
|
+
} | {
|
|
955
|
+
status: 423;
|
|
956
|
+
data: Error;
|
|
945
957
|
} | {
|
|
946
958
|
status: 500;
|
|
947
959
|
data: Error;
|
|
@@ -977,6 +989,9 @@ export declare function getProxyGraph(xUnitoCredentialId: string, path: string,
|
|
|
977
989
|
} | {
|
|
978
990
|
status: 422;
|
|
979
991
|
data: Error;
|
|
992
|
+
} | {
|
|
993
|
+
status: 423;
|
|
994
|
+
data: Error;
|
|
980
995
|
} | {
|
|
981
996
|
status: 500;
|
|
982
997
|
data: Error;
|
|
@@ -1012,6 +1027,9 @@ export declare function patchProxyGraph(xUnitoCredentialId: string, path: string
|
|
|
1012
1027
|
} | {
|
|
1013
1028
|
status: 422;
|
|
1014
1029
|
data: Error;
|
|
1030
|
+
} | {
|
|
1031
|
+
status: 423;
|
|
1032
|
+
data: Error;
|
|
1015
1033
|
} | {
|
|
1016
1034
|
status: 500;
|
|
1017
1035
|
data: Error;
|
|
@@ -1047,6 +1065,9 @@ export declare function postProxyGraph(xUnitoCredentialId: string, path: string,
|
|
|
1047
1065
|
} | {
|
|
1048
1066
|
status: 422;
|
|
1049
1067
|
data: Error;
|
|
1068
|
+
} | {
|
|
1069
|
+
status: 423;
|
|
1070
|
+
data: Error;
|
|
1050
1071
|
} | {
|
|
1051
1072
|
status: 500;
|
|
1052
1073
|
data: Error;
|
|
@@ -1081,6 +1102,9 @@ export declare function deleteProxyGraph(xUnitoCredentialId: string, path: strin
|
|
|
1081
1102
|
} | {
|
|
1082
1103
|
status: 422;
|
|
1083
1104
|
data: Error;
|
|
1105
|
+
} | {
|
|
1106
|
+
status: 423;
|
|
1107
|
+
data: Error;
|
|
1084
1108
|
} | {
|
|
1085
1109
|
status: 500;
|
|
1086
1110
|
data: Error;
|
package/dist/src/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@ const defaults = {
|
|
|
33
33
|
headers: {},
|
|
34
34
|
baseUrl: 'http://localhost:9000',
|
|
35
35
|
};
|
|
36
|
-
const oazapfts = Oazapfts__namespace.runtime(defaults);
|
|
36
|
+
const oazapfts$1 = Oazapfts__namespace.runtime(defaults);
|
|
37
37
|
const servers = {
|
|
38
38
|
local: 'http://localhost:9000',
|
|
39
39
|
staging: 'https://staging-integrations-platform.unito.io',
|
|
@@ -43,7 +43,7 @@ const servers = {
|
|
|
43
43
|
* Get all the integrations
|
|
44
44
|
*/
|
|
45
45
|
function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts) {
|
|
46
|
-
return oazapfts.fetchJson(`/integrations${QS__namespace.query(QS__namespace.explode({
|
|
46
|
+
return oazapfts$1.fetchJson(`/integrations${QS__namespace.query(QS__namespace.explode({
|
|
47
47
|
pagination,
|
|
48
48
|
unitoOrganizationId,
|
|
49
49
|
search,
|
|
@@ -55,7 +55,7 @@ function getIntegrations({ pagination, unitoOrganizationId, search, } = {}, opts
|
|
|
55
55
|
* Create an integration
|
|
56
56
|
*/
|
|
57
57
|
function createIntegration(body, opts) {
|
|
58
|
-
return oazapfts.fetchJson('/integrations', oazapfts.json({
|
|
58
|
+
return oazapfts$1.fetchJson('/integrations', oazapfts$1.json({
|
|
59
59
|
...opts,
|
|
60
60
|
method: 'POST',
|
|
61
61
|
body,
|
|
@@ -65,7 +65,7 @@ function createIntegration(body, opts) {
|
|
|
65
65
|
* Publish an integration
|
|
66
66
|
*/
|
|
67
67
|
function publishIntegration(body, opts) {
|
|
68
|
-
return oazapfts.fetchJson('/integrations/publish', oazapfts.multipart({
|
|
68
|
+
return oazapfts$1.fetchJson('/integrations/publish', oazapfts$1.multipart({
|
|
69
69
|
...opts,
|
|
70
70
|
method: 'POST',
|
|
71
71
|
body,
|
|
@@ -75,7 +75,7 @@ function publishIntegration(body, opts) {
|
|
|
75
75
|
* Find an integration by exact name
|
|
76
76
|
*/
|
|
77
77
|
function getIntegrationByName(integrationName, opts) {
|
|
78
|
-
return oazapfts.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
|
|
78
|
+
return oazapfts$1.fetchJson(`/integrations/find/${encodeURIComponent(integrationName)}`, {
|
|
79
79
|
...opts,
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -83,7 +83,7 @@ function getIntegrationByName(integrationName, opts) {
|
|
|
83
83
|
* Invite a user to an integration
|
|
84
84
|
*/
|
|
85
85
|
function inviteUser(integrationId, body, opts) {
|
|
86
|
-
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts.json({
|
|
86
|
+
return oazapfts$1.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/users/invite`, oazapfts$1.json({
|
|
87
87
|
...opts,
|
|
88
88
|
method: 'POST',
|
|
89
89
|
body,
|
|
@@ -93,7 +93,7 @@ function inviteUser(integrationId, body, opts) {
|
|
|
93
93
|
* Invite a unito organization to an integration
|
|
94
94
|
*/
|
|
95
95
|
function inviteOrganization(integrationId, body, opts) {
|
|
96
|
-
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/organizations/invite`, oazapfts.json({
|
|
96
|
+
return oazapfts$1.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/organizations/invite`, oazapfts$1.json({
|
|
97
97
|
...opts,
|
|
98
98
|
method: 'POST',
|
|
99
99
|
body,
|
|
@@ -103,7 +103,7 @@ function inviteOrganization(integrationId, body, opts) {
|
|
|
103
103
|
* Get an integration
|
|
104
104
|
*/
|
|
105
105
|
function getIntegrationById(integrationId, opts) {
|
|
106
|
-
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
|
|
106
|
+
return oazapfts$1.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, {
|
|
107
107
|
...opts,
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -111,7 +111,7 @@ function getIntegrationById(integrationId, opts) {
|
|
|
111
111
|
* Update an integration
|
|
112
112
|
*/
|
|
113
113
|
function updateIntegration(integrationId, body, opts) {
|
|
114
|
-
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts.json({
|
|
114
|
+
return oazapfts$1.fetchJson(`/integrations/${encodeURIComponent(integrationId)}`, oazapfts$1.json({
|
|
115
115
|
...opts,
|
|
116
116
|
method: 'PATCH',
|
|
117
117
|
body,
|
|
@@ -121,7 +121,7 @@ function updateIntegration(integrationId, body, opts) {
|
|
|
121
121
|
* Delete an integration
|
|
122
122
|
*/
|
|
123
123
|
function deleteIntegration(integrationId, name, opts) {
|
|
124
|
-
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS__namespace.query(QS__namespace.explode({
|
|
124
|
+
return oazapfts$1.fetchJson(`/integrations/${encodeURIComponent(integrationId)}${QS__namespace.query(QS__namespace.explode({
|
|
125
125
|
name,
|
|
126
126
|
}))}`, {
|
|
127
127
|
...opts,
|
|
@@ -132,7 +132,7 @@ function deleteIntegration(integrationId, name, opts) {
|
|
|
132
132
|
* Get the events associated with this integration.
|
|
133
133
|
*/
|
|
134
134
|
function getIntegrationEvents(integrationId, { search, $from, limit, } = {}, opts) {
|
|
135
|
-
return oazapfts.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events${QS__namespace.query(QS__namespace.explode({
|
|
135
|
+
return oazapfts$1.fetchJson(`/integrations/${encodeURIComponent(integrationId)}/events${QS__namespace.query(QS__namespace.explode({
|
|
136
136
|
search,
|
|
137
137
|
from: $from,
|
|
138
138
|
limit,
|
|
@@ -144,7 +144,7 @@ function getIntegrationEvents(integrationId, { search, $from, limit, } = {}, opt
|
|
|
144
144
|
* Get the logo of the integration, in SVG format.
|
|
145
145
|
*/
|
|
146
146
|
function getIntegrationLogo(integrationName, opts) {
|
|
147
|
-
return oazapfts.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
|
|
147
|
+
return oazapfts$1.fetchJson(`/public/${encodeURIComponent(integrationName)}/logo.svg`, {
|
|
148
148
|
...opts,
|
|
149
149
|
});
|
|
150
150
|
}
|
|
@@ -152,7 +152,7 @@ function getIntegrationLogo(integrationName, opts) {
|
|
|
152
152
|
* Get all the credentials
|
|
153
153
|
*/
|
|
154
154
|
function getCredentials({ pagination, filters, } = {}, opts) {
|
|
155
|
-
return oazapfts.fetchJson(`/credentials${QS__namespace.query(QS__namespace.explode({
|
|
155
|
+
return oazapfts$1.fetchJson(`/credentials${QS__namespace.query(QS__namespace.explode({
|
|
156
156
|
pagination,
|
|
157
157
|
filters,
|
|
158
158
|
}))}`, {
|
|
@@ -163,7 +163,7 @@ function getCredentials({ pagination, filters, } = {}, opts) {
|
|
|
163
163
|
* Create a credential
|
|
164
164
|
*/
|
|
165
165
|
function createCredential(body, opts) {
|
|
166
|
-
return oazapfts.fetchJson('/credentials', oazapfts.json({
|
|
166
|
+
return oazapfts$1.fetchJson('/credentials', oazapfts$1.json({
|
|
167
167
|
...opts,
|
|
168
168
|
method: 'POST',
|
|
169
169
|
body,
|
|
@@ -173,7 +173,7 @@ function createCredential(body, opts) {
|
|
|
173
173
|
* Get a credential
|
|
174
174
|
*/
|
|
175
175
|
function getCredentialById(credentialId, opts) {
|
|
176
|
-
return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
|
|
176
|
+
return oazapfts$1.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
|
|
177
177
|
...opts,
|
|
178
178
|
});
|
|
179
179
|
}
|
|
@@ -181,7 +181,7 @@ function getCredentialById(credentialId, opts) {
|
|
|
181
181
|
* Update a credential
|
|
182
182
|
*/
|
|
183
183
|
function updateCredential(credentialId, body, opts) {
|
|
184
|
-
return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts.json({
|
|
184
|
+
return oazapfts$1.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, oazapfts$1.json({
|
|
185
185
|
...opts,
|
|
186
186
|
method: 'PATCH',
|
|
187
187
|
body,
|
|
@@ -191,7 +191,7 @@ function updateCredential(credentialId, body, opts) {
|
|
|
191
191
|
* Delete a credential
|
|
192
192
|
*/
|
|
193
193
|
function deleteCredential(credentialId, opts) {
|
|
194
|
-
return oazapfts.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
|
|
194
|
+
return oazapfts$1.fetchJson(`/credentials/${encodeURIComponent(credentialId)}`, {
|
|
195
195
|
...opts,
|
|
196
196
|
method: 'DELETE',
|
|
197
197
|
});
|
|
@@ -200,9 +200,9 @@ function deleteCredential(credentialId, opts) {
|
|
|
200
200
|
* Returns the credentialAccount either from the integration's /me endpoint, if available, or the credential's latestCredentialAccount
|
|
201
201
|
*/
|
|
202
202
|
function getCredentialAccount(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
203
|
-
return oazapfts.fetchJson('/credentialAccount', {
|
|
203
|
+
return oazapfts$1.fetchJson('/credentialAccount', {
|
|
204
204
|
...opts,
|
|
205
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
205
|
+
headers: oazapfts$1.mergeHeaders(opts?.headers, {
|
|
206
206
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
207
207
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
208
208
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
@@ -213,7 +213,7 @@ function getCredentialAccount(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoA
|
|
|
213
213
|
* Used by the frontend to send analytics data
|
|
214
214
|
*/
|
|
215
215
|
function postTrack(body, opts) {
|
|
216
|
-
return oazapfts.fetchJson('/track', oazapfts.json({
|
|
216
|
+
return oazapfts$1.fetchJson('/track', oazapfts$1.json({
|
|
217
217
|
...opts,
|
|
218
218
|
method: 'POST',
|
|
219
219
|
body,
|
|
@@ -223,7 +223,7 @@ function postTrack(body, opts) {
|
|
|
223
223
|
* Encrypt data
|
|
224
224
|
*/
|
|
225
225
|
function encryptData(body, opts) {
|
|
226
|
-
return oazapfts.fetchJson('/encryptions/encrypt', oazapfts.json({
|
|
226
|
+
return oazapfts$1.fetchJson('/encryptions/encrypt', oazapfts$1.json({
|
|
227
227
|
...opts,
|
|
228
228
|
method: 'POST',
|
|
229
229
|
body,
|
|
@@ -233,7 +233,7 @@ function encryptData(body, opts) {
|
|
|
233
233
|
* Decrypt data
|
|
234
234
|
*/
|
|
235
235
|
function decryptData(body, opts) {
|
|
236
|
-
return oazapfts.fetchJson('/encryptions/decrypt', oazapfts.json({
|
|
236
|
+
return oazapfts$1.fetchJson('/encryptions/decrypt', oazapfts$1.json({
|
|
237
237
|
...opts,
|
|
238
238
|
method: 'POST',
|
|
239
239
|
body,
|
|
@@ -243,7 +243,7 @@ function decryptData(body, opts) {
|
|
|
243
243
|
* Decrypt and encrypt data
|
|
244
244
|
*/
|
|
245
245
|
function reencryptData(body, opts) {
|
|
246
|
-
return oazapfts.fetchJson('/encryptions/reencrypt', oazapfts.json({
|
|
246
|
+
return oazapfts$1.fetchJson('/encryptions/reencrypt', oazapfts$1.json({
|
|
247
247
|
...opts,
|
|
248
248
|
method: 'POST',
|
|
249
249
|
body,
|
|
@@ -253,7 +253,7 @@ function reencryptData(body, opts) {
|
|
|
253
253
|
* Get my profile
|
|
254
254
|
*/
|
|
255
255
|
function getProfile(opts) {
|
|
256
|
-
return oazapfts.fetchJson('/profile', {
|
|
256
|
+
return oazapfts$1.fetchJson('/profile', {
|
|
257
257
|
...opts,
|
|
258
258
|
});
|
|
259
259
|
}
|
|
@@ -261,7 +261,7 @@ function getProfile(opts) {
|
|
|
261
261
|
* Update my profile
|
|
262
262
|
*/
|
|
263
263
|
function updateProfile(body, opts) {
|
|
264
|
-
return oazapfts.fetchJson('/profile', oazapfts.json({
|
|
264
|
+
return oazapfts$1.fetchJson('/profile', oazapfts$1.json({
|
|
265
265
|
...opts,
|
|
266
266
|
method: 'PATCH',
|
|
267
267
|
body,
|
|
@@ -271,9 +271,9 @@ function updateProfile(body, opts) {
|
|
|
271
271
|
* Call an integration's me
|
|
272
272
|
*/
|
|
273
273
|
function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
274
|
-
return oazapfts.fetchJson('/proxy/me', {
|
|
274
|
+
return oazapfts$1.fetchJson('/proxy/me', {
|
|
275
275
|
...opts,
|
|
276
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
276
|
+
headers: oazapfts$1.mergeHeaders(opts?.headers, {
|
|
277
277
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
278
278
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
279
279
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
@@ -284,11 +284,11 @@ function getProxyMe(xUnitoCredentialId, { xUnitoCorrelationId, xUnitoAdditionalL
|
|
|
284
284
|
* Update a webhook subscription
|
|
285
285
|
*/
|
|
286
286
|
function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
287
|
-
return oazapfts.fetchJson('/proxy/webhooks/subscriptions', oazapfts.json({
|
|
287
|
+
return oazapfts$1.fetchJson('/proxy/webhooks/subscriptions', oazapfts$1.json({
|
|
288
288
|
...opts,
|
|
289
289
|
method: 'PUT',
|
|
290
290
|
body,
|
|
291
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
291
|
+
headers: oazapfts$1.mergeHeaders(opts?.headers, {
|
|
292
292
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
293
293
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
294
294
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
@@ -299,11 +299,11 @@ function updateWebhookSubscription(xUnitoCredentialId, body, { xUnitoCorrelation
|
|
|
299
299
|
* Call an integration's graph
|
|
300
300
|
*/
|
|
301
301
|
function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, accept, } = {}, opts) {
|
|
302
|
-
return oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
302
|
+
return oazapfts$1.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
303
303
|
path,
|
|
304
304
|
}))}`, {
|
|
305
305
|
...opts,
|
|
306
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
306
|
+
headers: oazapfts$1.mergeHeaders(opts?.headers, {
|
|
307
307
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
308
308
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
309
309
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
@@ -315,13 +315,13 @@ function getProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAd
|
|
|
315
315
|
* Call an integration's graph
|
|
316
316
|
*/
|
|
317
317
|
function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, contentType, } = {}, opts) {
|
|
318
|
-
return oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
318
|
+
return oazapfts$1.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
319
319
|
path,
|
|
320
|
-
}))}`, oazapfts.json({
|
|
320
|
+
}))}`, oazapfts$1.json({
|
|
321
321
|
...opts,
|
|
322
322
|
method: 'PATCH',
|
|
323
323
|
body,
|
|
324
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
324
|
+
headers: oazapfts$1.mergeHeaders(opts?.headers, {
|
|
325
325
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
326
326
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
327
327
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
@@ -333,13 +333,13 @@ function patchProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId,
|
|
|
333
333
|
* Call an integration's graph
|
|
334
334
|
*/
|
|
335
335
|
function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, contentType, } = {}, opts) {
|
|
336
|
-
return oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
336
|
+
return oazapfts$1.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
337
337
|
path,
|
|
338
|
-
}))}`, oazapfts.json({
|
|
338
|
+
}))}`, oazapfts$1.json({
|
|
339
339
|
...opts,
|
|
340
340
|
method: 'POST',
|
|
341
341
|
body,
|
|
342
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
342
|
+
headers: oazapfts$1.mergeHeaders(opts?.headers, {
|
|
343
343
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
344
344
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
345
345
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
@@ -351,12 +351,12 @@ function postProxyGraph(xUnitoCredentialId, path, body, { xUnitoCorrelationId, x
|
|
|
351
351
|
* Call an integration's graph
|
|
352
352
|
*/
|
|
353
353
|
function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
354
|
-
return oazapfts.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
354
|
+
return oazapfts$1.fetchJson(`/proxy/graph${QS__namespace.query(QS__namespace.explode({
|
|
355
355
|
path,
|
|
356
356
|
}))}`, {
|
|
357
357
|
...opts,
|
|
358
358
|
method: 'DELETE',
|
|
359
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
359
|
+
headers: oazapfts$1.mergeHeaders(opts?.headers, {
|
|
360
360
|
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
361
361
|
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
362
362
|
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
@@ -367,7 +367,7 @@ function deleteProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnit
|
|
|
367
367
|
* Get all the users
|
|
368
368
|
*/
|
|
369
369
|
function getUsers({ pagination, } = {}, opts) {
|
|
370
|
-
return oazapfts.fetchJson(`/users${QS__namespace.query(QS__namespace.explode({
|
|
370
|
+
return oazapfts$1.fetchJson(`/users${QS__namespace.query(QS__namespace.explode({
|
|
371
371
|
pagination,
|
|
372
372
|
}))}`, {
|
|
373
373
|
...opts,
|
|
@@ -377,7 +377,7 @@ function getUsers({ pagination, } = {}, opts) {
|
|
|
377
377
|
* Create a user
|
|
378
378
|
*/
|
|
379
379
|
function createUser(body, opts) {
|
|
380
|
-
return oazapfts.fetchJson('/users', oazapfts.json({
|
|
380
|
+
return oazapfts$1.fetchJson('/users', oazapfts$1.json({
|
|
381
381
|
...opts,
|
|
382
382
|
method: 'POST',
|
|
383
383
|
body,
|
|
@@ -387,7 +387,7 @@ function createUser(body, opts) {
|
|
|
387
387
|
* Get a user
|
|
388
388
|
*/
|
|
389
389
|
function getUserById(userId, opts) {
|
|
390
|
-
return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, {
|
|
390
|
+
return oazapfts$1.fetchJson(`/users/${encodeURIComponent(userId)}`, {
|
|
391
391
|
...opts,
|
|
392
392
|
});
|
|
393
393
|
}
|
|
@@ -395,7 +395,7 @@ function getUserById(userId, opts) {
|
|
|
395
395
|
* Update a user
|
|
396
396
|
*/
|
|
397
397
|
function updateUser(userId, body, opts) {
|
|
398
|
-
return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts.json({
|
|
398
|
+
return oazapfts$1.fetchJson(`/users/${encodeURIComponent(userId)}`, oazapfts$1.json({
|
|
399
399
|
...opts,
|
|
400
400
|
method: 'PATCH',
|
|
401
401
|
body,
|
|
@@ -405,7 +405,7 @@ function updateUser(userId, body, opts) {
|
|
|
405
405
|
* Regenerate the api key of a user
|
|
406
406
|
*/
|
|
407
407
|
function regenerateApiKey(userId, opts) {
|
|
408
|
-
return oazapfts.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
|
|
408
|
+
return oazapfts$1.fetchJson(`/users/${encodeURIComponent(userId)}/apiKey`, {
|
|
409
409
|
...opts,
|
|
410
410
|
method: 'POST',
|
|
411
411
|
});
|
|
@@ -414,13 +414,16 @@ function regenerateApiKey(userId, opts) {
|
|
|
414
414
|
* Get a user by its email address
|
|
415
415
|
*/
|
|
416
416
|
function getUserByEmail(email, opts) {
|
|
417
|
-
return oazapfts.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
|
|
417
|
+
return oazapfts$1.fetchJson(`/users/find/${encodeURIComponent(email)}`, {
|
|
418
418
|
...opts,
|
|
419
419
|
});
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
// MANUAL ADDONS
|
|
423
|
+
const oazapfts = Oazapfts__namespace.runtime(defaults);
|
|
423
424
|
/**
|
|
425
|
+
* Provides a type guard for ItemResponse.
|
|
426
|
+
*
|
|
424
427
|
* Return true if object has the shape of an item, false otherwise.
|
|
425
428
|
* @param object
|
|
426
429
|
*/
|
|
@@ -429,7 +432,9 @@ function isItemResponse(object) {
|
|
|
429
432
|
return !!object && !!data && typeof data === 'object' && 'fields' in data && 'relations' in data;
|
|
430
433
|
}
|
|
431
434
|
/**
|
|
432
|
-
*
|
|
435
|
+
* Provides a type guard for ItemSummaryResponse.
|
|
436
|
+
*
|
|
437
|
+
* Return true if object has the shape of an item summary, false otherwise.
|
|
433
438
|
* @param object
|
|
434
439
|
*/
|
|
435
440
|
function isItemSummaryResponse(object) {
|
|
@@ -437,6 +442,8 @@ function isItemSummaryResponse(object) {
|
|
|
437
442
|
return !!object && !!data && typeof data === 'object' && 'path' in data;
|
|
438
443
|
}
|
|
439
444
|
/**
|
|
445
|
+
* Provides a type guard for CollectionResponse.
|
|
446
|
+
*
|
|
440
447
|
* Return true if object has the shape of a collection, false otherwise.
|
|
441
448
|
* @param object
|
|
442
449
|
*/
|
|
@@ -444,10 +451,40 @@ function isCollectionResponse(object) {
|
|
|
444
451
|
const data = object.data;
|
|
445
452
|
return !!object && !!data && typeof data === 'object' && 'info' in data && 'data' in data && Array.isArray(data.data);
|
|
446
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* Provides a type guard for ErrorResponse.
|
|
456
|
+
*
|
|
457
|
+
* Return true if object has the shape of an error response, false otherwise.
|
|
458
|
+
* @param object
|
|
459
|
+
*/
|
|
447
460
|
function isErrorResponse(object) {
|
|
448
461
|
const status = object.status;
|
|
449
462
|
return !!object && typeof object === 'object' && status && status >= 400 && 'data' in object && 'headers' in object;
|
|
450
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Opt-in optimistic mode.
|
|
466
|
+
*
|
|
467
|
+
* Returns the typed response's data if it's a success, otherwise throws an HttpError.
|
|
468
|
+
*
|
|
469
|
+
* @param response received from the Integrations Platform Client
|
|
470
|
+
* @returns the response's data, typed, if it's a success
|
|
471
|
+
*/
|
|
472
|
+
async function optimistic(asyncResponse) {
|
|
473
|
+
const response = await asyncResponse;
|
|
474
|
+
if (isErrorResponse(response)) {
|
|
475
|
+
throw new Oazapfts.HttpError(response.status, response.data, response.headers);
|
|
476
|
+
}
|
|
477
|
+
return response.data;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Wrapper of getProxyGraph that returns a typed response containing an Item upon success.
|
|
481
|
+
*
|
|
482
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
483
|
+
* @param path The path to the item to fetch
|
|
484
|
+
* @param headers The headers to include in the request
|
|
485
|
+
* @param opts Additional options
|
|
486
|
+
* @returns A successful response containing an Item, or an ErrorResponse
|
|
487
|
+
*/
|
|
451
488
|
async function getProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
452
489
|
const response = await getProxyGraph(xUnitoCredentialId, path, {
|
|
453
490
|
xUnitoCorrelationId,
|
|
@@ -460,6 +497,15 @@ async function getProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId
|
|
|
460
497
|
throw new Error(`Response does not match expected Item shape`);
|
|
461
498
|
}
|
|
462
499
|
}
|
|
500
|
+
/**
|
|
501
|
+
* Wrapper of getProxyGraph that returns a typed response containing a Collection upon success.
|
|
502
|
+
*
|
|
503
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
504
|
+
* @param path The path to the item to fetch
|
|
505
|
+
* @param headers The headers to include in the request
|
|
506
|
+
* @param opts Additional options
|
|
507
|
+
* @returns A successful response containing an Collection, or an ErrorResponse
|
|
508
|
+
*/
|
|
463
509
|
async function getProxyGraphCollection(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
464
510
|
const response = await getProxyGraph(xUnitoCredentialId, path, {
|
|
465
511
|
xUnitoCorrelationId,
|
|
@@ -472,6 +518,15 @@ async function getProxyGraphCollection(xUnitoCredentialId, path, { xUnitoCorrela
|
|
|
472
518
|
throw new Error(`Response does not match expected Collection shape`);
|
|
473
519
|
}
|
|
474
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Wrapper of patchProxyGraph that returns a typed response containing the updated Item upon success.
|
|
523
|
+
*
|
|
524
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
525
|
+
* @param path The path to the item to fetch
|
|
526
|
+
* @param headers The headers to include in the request
|
|
527
|
+
* @param opts Additional options
|
|
528
|
+
* @returns A successful response containing an Item, or an ErrorResponse
|
|
529
|
+
*/
|
|
475
530
|
async function patchProxyGraphItem(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
476
531
|
const response = await patchProxyGraph(xUnitoCredentialId, path, body, {
|
|
477
532
|
xUnitoCorrelationId,
|
|
@@ -484,6 +539,15 @@ async function patchProxyGraphItem(xUnitoCredentialId, path, body, { xUnitoCorre
|
|
|
484
539
|
throw new Error(`Response does not match expected Item shape`);
|
|
485
540
|
}
|
|
486
541
|
}
|
|
542
|
+
/**
|
|
543
|
+
* Wrapper of postProxyGraph that returns a typed response containing the created ItemSummary upon success.
|
|
544
|
+
*
|
|
545
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
546
|
+
* @param path The path to the item to fetch
|
|
547
|
+
* @param headers The headers to include in the request
|
|
548
|
+
* @param opts Additional options
|
|
549
|
+
* @returns A successful response containing an ItemSummary, or an ErrorResponse
|
|
550
|
+
*/
|
|
487
551
|
async function postProxyGraphCollection(xUnitoCredentialId, path, body, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
488
552
|
const response = await postProxyGraph(xUnitoCredentialId, path, body, {
|
|
489
553
|
xUnitoCorrelationId,
|
|
@@ -496,12 +560,42 @@ async function postProxyGraphCollection(xUnitoCredentialId, path, body, { xUnito
|
|
|
496
560
|
throw new Error(`Response does not match expected ItemSummary shape`);
|
|
497
561
|
}
|
|
498
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* Wrapper of deleteProxyGraph added for uniformity, doesn't provide much typing help.
|
|
565
|
+
*
|
|
566
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
567
|
+
* @param path The path to the item to fetch
|
|
568
|
+
* @param headers The headers to include in the request
|
|
569
|
+
* @param opts Additional options
|
|
570
|
+
*/
|
|
499
571
|
async function deleteProxyGraphItem(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, } = {}, opts) {
|
|
500
572
|
await deleteProxyGraph(xUnitoCredentialId, path, {
|
|
501
573
|
xUnitoCorrelationId,
|
|
502
574
|
xUnitoAdditionalLoggingContext,
|
|
503
575
|
}, opts);
|
|
504
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* Call an integration's graph and returns the fetch response directly to enable streaming of the body as it comes in.
|
|
579
|
+
*
|
|
580
|
+
* @param xUnitoCredentialId The credential ID to use for the request
|
|
581
|
+
* @param path The path to the item to fetch
|
|
582
|
+
* @param headers Base headers to add to the request
|
|
583
|
+
* @param additionalHeaders Additional headers to add to the request
|
|
584
|
+
* @returns fetch's response
|
|
585
|
+
*/
|
|
586
|
+
async function fetchProxyGraph(xUnitoCredentialId, path, { xUnitoCorrelationId, xUnitoAdditionalLoggingContext, accept, } = {}, init) {
|
|
587
|
+
return fetch(`${defaults.baseUrl}/proxy/graph${QS__namespace.query(QS__namespace.explode({ path }))}`, {
|
|
588
|
+
...(init ?? {}),
|
|
589
|
+
headers: oazapfts.mergeHeaders({
|
|
590
|
+
...defaults.headers,
|
|
591
|
+
...(init?.headers ?? {}),
|
|
592
|
+
'X-Unito-Credential-Id': xUnitoCredentialId,
|
|
593
|
+
'X-Unito-Correlation-Id': xUnitoCorrelationId,
|
|
594
|
+
'X-Unito-Additional-Logging-Context': xUnitoAdditionalLoggingContext,
|
|
595
|
+
Accept: accept,
|
|
596
|
+
}),
|
|
597
|
+
});
|
|
598
|
+
}
|
|
505
599
|
|
|
506
600
|
Object.defineProperty(exports, "HttpError", {
|
|
507
601
|
enumerable: true,
|
|
@@ -517,6 +611,7 @@ exports.deleteIntegration = deleteIntegration;
|
|
|
517
611
|
exports.deleteProxyGraph = deleteProxyGraph;
|
|
518
612
|
exports.deleteProxyGraphItem = deleteProxyGraphItem;
|
|
519
613
|
exports.encryptData = encryptData;
|
|
614
|
+
exports.fetchProxyGraph = fetchProxyGraph;
|
|
520
615
|
exports.getCredentialAccount = getCredentialAccount;
|
|
521
616
|
exports.getCredentialById = getCredentialById;
|
|
522
617
|
exports.getCredentials = getCredentials;
|
|
@@ -539,6 +634,7 @@ exports.isCollectionResponse = isCollectionResponse;
|
|
|
539
634
|
exports.isErrorResponse = isErrorResponse;
|
|
540
635
|
exports.isItemResponse = isItemResponse;
|
|
541
636
|
exports.isItemSummaryResponse = isItemSummaryResponse;
|
|
637
|
+
exports.optimistic = optimistic;
|
|
542
638
|
exports.patchProxyGraph = patchProxyGraph;
|
|
543
639
|
exports.patchProxyGraphItem = patchProxyGraphItem;
|
|
544
640
|
exports.postProxyGraph = postProxyGraph;
|
|
@@ -553,4 +649,3 @@ exports.updateIntegration = updateIntegration;
|
|
|
553
649
|
exports.updateProfile = updateProfile;
|
|
554
650
|
exports.updateUser = updateUser;
|
|
555
651
|
exports.updateWebhookSubscription = updateWebhookSubscription;
|
|
556
|
-
module.exports.default = api;
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unito/integrations-platform-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "The Unito Integrations Platform Client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dist/src/**/*"
|
|
16
16
|
],
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=20",
|
|
19
19
|
"npm": ">=9.5.0"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"prepare": "npm run compile",
|
|
24
24
|
"lint": "eslint --fix src test --ext .ts && prettier --write src test",
|
|
25
25
|
"compile:esm": "tsc",
|
|
26
|
-
"compile:cjs": "rollup dist/src/index.js --file dist/src/index.cjs --format cjs --no-freeze
|
|
26
|
+
"compile:cjs": "rollup dist/src/index.js --file dist/src/index.cjs --format cjs --no-freeze",
|
|
27
27
|
"compile": "rm -rf dist && npm run compile:esm && npm run compile:cjs",
|
|
28
28
|
"test": "NODE_ENV=test node --loader ts-node/esm --test ./test/*.test.ts",
|
|
29
29
|
"test:debug": "NODE_ENV=test node --loader ts-node/esm --inspect-brk --test ./test/*.test.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "LicenseRef-LICENSE",
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/node": "
|
|
38
|
+
"@types/node": "20.x",
|
|
39
39
|
"@types/sinon": "17.x",
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "7.x",
|
|
41
41
|
"@typescript-eslint/parser": "7.x",
|