@stackfactor/client-api 1.1.264 → 1.1.265
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/cjs/lib/integrations/knowledgeBaseSourceConnectors.d.ts +42 -6
- package/dist/cjs/lib/integrations/knowledgeBaseSourceConnectors.d.ts.map +1 -1
- package/dist/cjs/lib/integrations/knowledgeBaseSourceConnectors.js +41 -7
- package/dist/cjs/lib/integrations/knowledgeBaseSourceConnectors.js.map +1 -1
- package/dist/esm/lib/integrations/knowledgeBaseSourceConnectors.d.ts +42 -6
- package/dist/esm/lib/integrations/knowledgeBaseSourceConnectors.d.ts.map +1 -1
- package/dist/esm/lib/integrations/knowledgeBaseSourceConnectors.js +39 -6
- package/dist/esm/lib/integrations/knowledgeBaseSourceConnectors.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,10 +20,24 @@ export interface SourceConnectorAuthentication {
|
|
|
20
20
|
isDefault: boolean;
|
|
21
21
|
fields: SourceConnectorAuthenticationField[];
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/** One comparison a field supports, as the connector declares it. */
|
|
24
|
+
export interface SourceConnectorFilterOperator {
|
|
25
|
+
/** Shown in the operator dropdown, e.g. "On or before". */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Sent back when the filter is applied, e.g. "onOrBefore". */
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A field a source may be narrowed by. `type` is "string" | "number" | "date".
|
|
32
|
+
*
|
|
33
|
+
* `operators` is per FIELD, not per type: they follow what the source's own query
|
|
34
|
+
* language allows, so a Confluence text field offers `contains` while a Graph one
|
|
35
|
+
* does not. Never assume a fixed set from `type`.
|
|
36
|
+
*/
|
|
24
37
|
export interface SourceConnectorFilter {
|
|
25
38
|
field: string;
|
|
26
39
|
type: string;
|
|
40
|
+
operators: SourceConnectorFilterOperator[];
|
|
27
41
|
}
|
|
28
42
|
/** What a connector accepts — the response of `getConfiguration`. */
|
|
29
43
|
export interface SourceConnectorConfiguration {
|
|
@@ -56,17 +70,39 @@ export interface SourceConnectorStats {
|
|
|
56
70
|
export declare const getConfiguration: (connectionId: string, authToken: string) => Promise<object>;
|
|
57
71
|
/**
|
|
58
72
|
* Ask a connector how the user should be walked through linking their account at
|
|
59
|
-
* the source. Returns the guidance to follow
|
|
60
|
-
* state
|
|
73
|
+
* the source. Returns the guidance to follow — an authorization URL, and the
|
|
74
|
+
* single-use `state` the backend minted for this attempt. This STARTS the flow.
|
|
61
75
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
76
|
+
* The connector decides WHICH scheme applies, which is why the caller asks rather
|
|
77
|
+
* than tells. But the caller must supply `redirectUri`: the connector answers the
|
|
78
|
+
* same way wherever the platform is running, and providers match that value by
|
|
79
|
+
* exact string.
|
|
64
80
|
* POST /api/v1/exceed/knowledgebasesourceconnectors/:id/authentication-flow
|
|
65
81
|
* @param {String} connectionId The connection id (an `integrationId` from `knowledgeBase.listSourceConnectors`)
|
|
82
|
+
* @param {String} redirectUri Where the browser will return, e.g. `${origin}/callback`
|
|
66
83
|
* @param {String} authToken Authentication token
|
|
67
84
|
* @returns {Promise<object>}
|
|
68
85
|
*/
|
|
69
|
-
export declare const initiateAuthenticationFlow: (connectionId: string, authToken: string) => Promise<object>;
|
|
86
|
+
export declare const initiateAuthenticationFlow: (connectionId: string, redirectUri: string, authToken: string) => Promise<object>;
|
|
87
|
+
/**
|
|
88
|
+
* Finish linking an account: exchange the authorization code the provider
|
|
89
|
+
* returned for the connection itself.
|
|
90
|
+
*
|
|
91
|
+
* Call this the moment the callback reports back. The code is single-use and
|
|
92
|
+
* expires within minutes, so holding it until the source is saved would fail at
|
|
93
|
+
* exactly the point the user commits.
|
|
94
|
+
*
|
|
95
|
+
* What comes back is a HANDLE, never the credentials — those stay server-side
|
|
96
|
+
* until a source exists to own them, and are then written to the vault. Pass the
|
|
97
|
+
* handle as `authenticationHandle` when creating the source.
|
|
98
|
+
* POST /api/v1/exceed/knowledgebasesourceconnectors/:id/authentication-flow/complete
|
|
99
|
+
* @param {String} connectionId The connection id
|
|
100
|
+
* @param {String} code The authorization code from the provider
|
|
101
|
+
* @param {String} state The state echoed back, as minted by `initiateAuthenticationFlow`
|
|
102
|
+
* @param {String} authToken Authentication token
|
|
103
|
+
* @returns {Promise<object>} `{ handle, displayName }`
|
|
104
|
+
*/
|
|
105
|
+
export declare const completeAuthenticationFlow: (connectionId: string, code: string, state: string, authToken: string) => Promise<object>;
|
|
70
106
|
/**
|
|
71
107
|
* Ask a connector how much content the supplied credentials can reach — the
|
|
72
108
|
* volume preview shown before a source is created.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledgeBaseSourceConnectors.d.ts","sourceRoot":"","sources":["../../../../src/lib/integrations/knowledgeBaseSourceConnectors.ts"],"names":[],"mappings":"AAsBA,2FAA2F;AAC3F,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,2DAA2D;AAC3D,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,kCAAkC,EAAE,CAAC;CAC9C;AAED,
|
|
1
|
+
{"version":3,"file":"knowledgeBaseSourceConnectors.d.ts","sourceRoot":"","sources":["../../../../src/lib/integrations/knowledgeBaseSourceConnectors.ts"],"names":[],"mappings":"AAsBA,2FAA2F;AAC3F,MAAM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QG;AACH,eAAO,MAAM,gBAAgB,GAC3B,cAAc,MAAM,EACpB,WAAW,MAAM,KAChB,OAAO,CAAC,MAAM,CAchB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,GACrC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,WAAW,MAAM,KAChB,OAAO,CAAC,MAAM,CAehB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,0BAA0B,GACrC,cAAc,MAAM,EACpB,MAAM,MAAM,EACZ,OAAO,MAAM,EACb,WAAW,MAAM,KAChB,OAAO,CAAC,MAAM,CAehB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,GACnB,cAAc,MAAM,EACpB,gBAAgB,MAAM,EACtB,WAAW,MAAM,EACjB,UAAS,MAAM,GAAG,IAAW,KAC5B,OAAO,CAAC,MAAM,CAehB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStats = exports.initiateAuthenticationFlow = exports.getConfiguration = void 0;
|
|
3
|
+
exports.getStats = exports.completeAuthenticationFlow = exports.initiateAuthenticationFlow = exports.getConfiguration = void 0;
|
|
4
4
|
const axiosClient_js_1 = require("../axiosClient.js");
|
|
5
5
|
/**
|
|
6
6
|
* Ask a connector to describe its own contract: the authentication methods it
|
|
@@ -26,19 +26,22 @@ const getConfiguration = (connectionId, authToken) => {
|
|
|
26
26
|
exports.getConfiguration = getConfiguration;
|
|
27
27
|
/**
|
|
28
28
|
* Ask a connector how the user should be walked through linking their account at
|
|
29
|
-
* the source. Returns the guidance to follow
|
|
30
|
-
* state
|
|
29
|
+
* the source. Returns the guidance to follow — an authorization URL, and the
|
|
30
|
+
* single-use `state` the backend minted for this attempt. This STARTS the flow.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* The connector decides WHICH scheme applies, which is why the caller asks rather
|
|
33
|
+
* than tells. But the caller must supply `redirectUri`: the connector answers the
|
|
34
|
+
* same way wherever the platform is running, and providers match that value by
|
|
35
|
+
* exact string.
|
|
34
36
|
* POST /api/v1/exceed/knowledgebasesourceconnectors/:id/authentication-flow
|
|
35
37
|
* @param {String} connectionId The connection id (an `integrationId` from `knowledgeBase.listSourceConnectors`)
|
|
38
|
+
* @param {String} redirectUri Where the browser will return, e.g. `${origin}/callback`
|
|
36
39
|
* @param {String} authToken Authentication token
|
|
37
40
|
* @returns {Promise<object>}
|
|
38
41
|
*/
|
|
39
|
-
const initiateAuthenticationFlow = (connectionId, authToken) => {
|
|
42
|
+
const initiateAuthenticationFlow = (connectionId, redirectUri, authToken) => {
|
|
40
43
|
return new Promise((resolve, reject) => {
|
|
41
|
-
const request = axiosClient_js_1.client.post(`/api/v1/exceed/knowledgebasesourceconnectors/${connectionId}/authentication-flow`, {}, { headers: { authorization: authToken } });
|
|
44
|
+
const request = axiosClient_js_1.client.post(`/api/v1/exceed/knowledgebasesourceconnectors/${connectionId}/authentication-flow`, { redirectUri }, { headers: { authorization: authToken } });
|
|
42
45
|
request
|
|
43
46
|
.then((response) => {
|
|
44
47
|
resolve(response.data);
|
|
@@ -49,6 +52,37 @@ const initiateAuthenticationFlow = (connectionId, authToken) => {
|
|
|
49
52
|
});
|
|
50
53
|
};
|
|
51
54
|
exports.initiateAuthenticationFlow = initiateAuthenticationFlow;
|
|
55
|
+
/**
|
|
56
|
+
* Finish linking an account: exchange the authorization code the provider
|
|
57
|
+
* returned for the connection itself.
|
|
58
|
+
*
|
|
59
|
+
* Call this the moment the callback reports back. The code is single-use and
|
|
60
|
+
* expires within minutes, so holding it until the source is saved would fail at
|
|
61
|
+
* exactly the point the user commits.
|
|
62
|
+
*
|
|
63
|
+
* What comes back is a HANDLE, never the credentials — those stay server-side
|
|
64
|
+
* until a source exists to own them, and are then written to the vault. Pass the
|
|
65
|
+
* handle as `authenticationHandle` when creating the source.
|
|
66
|
+
* POST /api/v1/exceed/knowledgebasesourceconnectors/:id/authentication-flow/complete
|
|
67
|
+
* @param {String} connectionId The connection id
|
|
68
|
+
* @param {String} code The authorization code from the provider
|
|
69
|
+
* @param {String} state The state echoed back, as minted by `initiateAuthenticationFlow`
|
|
70
|
+
* @param {String} authToken Authentication token
|
|
71
|
+
* @returns {Promise<object>} `{ handle, displayName }`
|
|
72
|
+
*/
|
|
73
|
+
const completeAuthenticationFlow = (connectionId, code, state, authToken) => {
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
const request = axiosClient_js_1.client.post(`/api/v1/exceed/knowledgebasesourceconnectors/${connectionId}/authentication-flow/complete`, { code, state }, { headers: { authorization: authToken } });
|
|
76
|
+
request
|
|
77
|
+
.then((response) => {
|
|
78
|
+
resolve(response.data);
|
|
79
|
+
})
|
|
80
|
+
.catch((error) => {
|
|
81
|
+
reject(error);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
exports.completeAuthenticationFlow = completeAuthenticationFlow;
|
|
52
86
|
/**
|
|
53
87
|
* Ask a connector how much content the supplied credentials can reach — the
|
|
54
88
|
* volume preview shown before a source is created.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledgeBaseSourceConnectors.js","sourceRoot":"","sources":["../../../../src/lib/integrations/knowledgeBaseSourceConnectors.ts"],"names":[],"mappings":";;;AACA,sDAA2C;
|
|
1
|
+
{"version":3,"file":"knowledgeBaseSourceConnectors.js","sourceRoot":"","sources":["../../../../src/lib/integrations/knowledgeBaseSourceConnectors.ts"],"names":[],"mappings":";;;AACA,sDAA2C;AAwF3C;;;;;;;;GAQG;AACI,MAAM,gBAAgB,GAAG,CAC9B,YAAoB,EACpB,SAAiB,EACA,EAAE;IACnB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,uBAAM,CAAC,GAAG,CACxB,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Authentication {
|
|
|
20
20
|
isDefault: boolean;
|
|
21
21
|
fields: SourceConnectorAuthenticationField[];
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/** One comparison a field supports, as the connector declares it. */
|
|
24
|
+
export interface SourceConnectorFilterOperator {
|
|
25
|
+
/** Shown in the operator dropdown, e.g. "On or before". */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Sent back when the filter is applied, e.g. "onOrBefore". */
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A field a source may be narrowed by. `type` is "string" | "number" | "date".
|
|
32
|
+
*
|
|
33
|
+
* `operators` is per FIELD, not per type: they follow what the source's own query
|
|
34
|
+
* language allows, so a Confluence text field offers `contains` while a Graph one
|
|
35
|
+
* does not. Never assume a fixed set from `type`.
|
|
36
|
+
*/
|
|
24
37
|
export interface SourceConnectorFilter {
|
|
25
38
|
field: string;
|
|
26
39
|
type: string;
|
|
40
|
+
operators: SourceConnectorFilterOperator[];
|
|
27
41
|
}
|
|
28
42
|
/** What a connector accepts — the response of `getConfiguration`. */
|
|
29
43
|
export interface SourceConnectorConfiguration {
|
|
@@ -56,17 +70,39 @@ export interface SourceConnectorStats {
|
|
|
56
70
|
export declare const getConfiguration: (connectionId: string, authToken: string) => Promise<object>;
|
|
57
71
|
/**
|
|
58
72
|
* Ask a connector how the user should be walked through linking their account at
|
|
59
|
-
* the source. Returns the guidance to follow
|
|
60
|
-
* state
|
|
73
|
+
* the source. Returns the guidance to follow — an authorization URL, and the
|
|
74
|
+
* single-use `state` the backend minted for this attempt. This STARTS the flow.
|
|
61
75
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
76
|
+
* The connector decides WHICH scheme applies, which is why the caller asks rather
|
|
77
|
+
* than tells. But the caller must supply `redirectUri`: the connector answers the
|
|
78
|
+
* same way wherever the platform is running, and providers match that value by
|
|
79
|
+
* exact string.
|
|
64
80
|
* POST /api/v1/exceed/knowledgebasesourceconnectors/:id/authentication-flow
|
|
65
81
|
* @param {String} connectionId The connection id (an `integrationId` from `knowledgeBase.listSourceConnectors`)
|
|
82
|
+
* @param {String} redirectUri Where the browser will return, e.g. `${origin}/callback`
|
|
66
83
|
* @param {String} authToken Authentication token
|
|
67
84
|
* @returns {Promise<object>}
|
|
68
85
|
*/
|
|
69
|
-
export declare const initiateAuthenticationFlow: (connectionId: string, authToken: string) => Promise<object>;
|
|
86
|
+
export declare const initiateAuthenticationFlow: (connectionId: string, redirectUri: string, authToken: string) => Promise<object>;
|
|
87
|
+
/**
|
|
88
|
+
* Finish linking an account: exchange the authorization code the provider
|
|
89
|
+
* returned for the connection itself.
|
|
90
|
+
*
|
|
91
|
+
* Call this the moment the callback reports back. The code is single-use and
|
|
92
|
+
* expires within minutes, so holding it until the source is saved would fail at
|
|
93
|
+
* exactly the point the user commits.
|
|
94
|
+
*
|
|
95
|
+
* What comes back is a HANDLE, never the credentials — those stay server-side
|
|
96
|
+
* until a source exists to own them, and are then written to the vault. Pass the
|
|
97
|
+
* handle as `authenticationHandle` when creating the source.
|
|
98
|
+
* POST /api/v1/exceed/knowledgebasesourceconnectors/:id/authentication-flow/complete
|
|
99
|
+
* @param {String} connectionId The connection id
|
|
100
|
+
* @param {String} code The authorization code from the provider
|
|
101
|
+
* @param {String} state The state echoed back, as minted by `initiateAuthenticationFlow`
|
|
102
|
+
* @param {String} authToken Authentication token
|
|
103
|
+
* @returns {Promise<object>} `{ handle, displayName }`
|
|
104
|
+
*/
|
|
105
|
+
export declare const completeAuthenticationFlow: (connectionId: string, code: string, state: string, authToken: string) => Promise<object>;
|
|
70
106
|
/**
|
|
71
107
|
* Ask a connector how much content the supplied credentials can reach — the
|
|
72
108
|
* volume preview shown before a source is created.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledgeBaseSourceConnectors.d.ts","sourceRoot":"","sources":["../../../../src/lib/integrations/knowledgeBaseSourceConnectors.ts"],"names":[],"mappings":"AAsBA,2FAA2F;AAC3F,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,2DAA2D;AAC3D,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,kCAAkC,EAAE,CAAC;CAC9C;AAED,
|
|
1
|
+
{"version":3,"file":"knowledgeBaseSourceConnectors.d.ts","sourceRoot":"","sources":["../../../../src/lib/integrations/knowledgeBaseSourceConnectors.ts"],"names":[],"mappings":"AAsBA,2FAA2F;AAC3F,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,2DAA2D;AAC3D,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,kCAAkC,EAAE,CAAC;CAC9C;AAED,qEAAqE;AACrE,MAAM,WAAW,6BAA6B;IAC5C,2DAA2D;IAC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MAAM,CAehB,CAAC"}
|
|
@@ -22,19 +22,52 @@ export const getConfiguration = (connectionId, authToken) => {
|
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* Ask a connector how the user should be walked through linking their account at
|
|
25
|
-
* the source. Returns the guidance to follow
|
|
26
|
-
* state
|
|
25
|
+
* the source. Returns the guidance to follow — an authorization URL, and the
|
|
26
|
+
* single-use `state` the backend minted for this attempt. This STARTS the flow.
|
|
27
27
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* The connector decides WHICH scheme applies, which is why the caller asks rather
|
|
29
|
+
* than tells. But the caller must supply `redirectUri`: the connector answers the
|
|
30
|
+
* same way wherever the platform is running, and providers match that value by
|
|
31
|
+
* exact string.
|
|
30
32
|
* POST /api/v1/exceed/knowledgebasesourceconnectors/:id/authentication-flow
|
|
31
33
|
* @param {String} connectionId The connection id (an `integrationId` from `knowledgeBase.listSourceConnectors`)
|
|
34
|
+
* @param {String} redirectUri Where the browser will return, e.g. `${origin}/callback`
|
|
32
35
|
* @param {String} authToken Authentication token
|
|
33
36
|
* @returns {Promise<object>}
|
|
34
37
|
*/
|
|
35
|
-
export const initiateAuthenticationFlow = (connectionId, authToken) => {
|
|
38
|
+
export const initiateAuthenticationFlow = (connectionId, redirectUri, authToken) => {
|
|
36
39
|
return new Promise((resolve, reject) => {
|
|
37
|
-
const request = client.post(`/api/v1/exceed/knowledgebasesourceconnectors/${connectionId}/authentication-flow`, {}, { headers: { authorization: authToken } });
|
|
40
|
+
const request = client.post(`/api/v1/exceed/knowledgebasesourceconnectors/${connectionId}/authentication-flow`, { redirectUri }, { headers: { authorization: authToken } });
|
|
41
|
+
request
|
|
42
|
+
.then((response) => {
|
|
43
|
+
resolve(response.data);
|
|
44
|
+
})
|
|
45
|
+
.catch((error) => {
|
|
46
|
+
reject(error);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Finish linking an account: exchange the authorization code the provider
|
|
52
|
+
* returned for the connection itself.
|
|
53
|
+
*
|
|
54
|
+
* Call this the moment the callback reports back. The code is single-use and
|
|
55
|
+
* expires within minutes, so holding it until the source is saved would fail at
|
|
56
|
+
* exactly the point the user commits.
|
|
57
|
+
*
|
|
58
|
+
* What comes back is a HANDLE, never the credentials — those stay server-side
|
|
59
|
+
* until a source exists to own them, and are then written to the vault. Pass the
|
|
60
|
+
* handle as `authenticationHandle` when creating the source.
|
|
61
|
+
* POST /api/v1/exceed/knowledgebasesourceconnectors/:id/authentication-flow/complete
|
|
62
|
+
* @param {String} connectionId The connection id
|
|
63
|
+
* @param {String} code The authorization code from the provider
|
|
64
|
+
* @param {String} state The state echoed back, as minted by `initiateAuthenticationFlow`
|
|
65
|
+
* @param {String} authToken Authentication token
|
|
66
|
+
* @returns {Promise<object>} `{ handle, displayName }`
|
|
67
|
+
*/
|
|
68
|
+
export const completeAuthenticationFlow = (connectionId, code, state, authToken) => {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
const request = client.post(`/api/v1/exceed/knowledgebasesourceconnectors/${connectionId}/authentication-flow/complete`, { code, state }, { headers: { authorization: authToken } });
|
|
38
71
|
request
|
|
39
72
|
.then((response) => {
|
|
40
73
|
resolve(response.data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledgeBaseSourceConnectors.js","sourceRoot":"","sources":["../../../../src/lib/integrations/knowledgeBaseSourceConnectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"knowledgeBaseSourceConnectors.js","sourceRoot":"","sources":["../../../../src/lib/integrations/knowledgeBaseSourceConnectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAwF3C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,YAAoB,EACpB,SAAiB,EACA,EAAE;IAC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