@amp-labs/react 1.1.0 → 1.2.0
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/build/generated-sources/api/src/apis/AllowedDomainApi.d.ts +79 -0
- package/build/generated-sources/api/src/apis/AllowedDomainApi.js +101 -0
- package/build/generated-sources/api/src/apis/ConnectionApi.d.ts +82 -0
- package/build/generated-sources/api/src/apis/ConnectionApi.js +107 -0
- package/build/generated-sources/api/src/apis/ConsumerApi.d.ts +52 -0
- package/build/generated-sources/api/src/apis/ConsumerApi.js +75 -0
- package/build/generated-sources/api/src/apis/DestinationApi.d.ts +78 -0
- package/build/generated-sources/api/src/apis/DestinationApi.js +102 -0
- package/build/generated-sources/api/src/apis/GroupApi.d.ts +52 -0
- package/build/generated-sources/api/src/apis/GroupApi.js +75 -0
- package/build/generated-sources/api/src/apis/InstallationApi.d.ts +168 -0
- package/build/generated-sources/api/src/apis/InstallationApi.js +205 -0
- package/build/generated-sources/api/src/apis/IntegrationApi.d.ts +128 -0
- package/build/generated-sources/api/src/apis/IntegrationApi.js +154 -0
- package/build/generated-sources/api/src/apis/OAuthApi.d.ts +76 -0
- package/build/generated-sources/api/src/apis/OAuthApi.js +102 -0
- package/build/generated-sources/api/src/apis/OperationApi.d.ts +80 -0
- package/build/generated-sources/api/src/apis/OperationApi.js +104 -0
- package/build/generated-sources/api/src/apis/OperationLogApi.d.ts +55 -0
- package/build/generated-sources/api/src/apis/OperationLogApi.js +76 -0
- package/build/generated-sources/api/src/apis/ProjectApi.d.ts +124 -0
- package/build/generated-sources/api/src/apis/ProjectApi.js +148 -0
- package/build/generated-sources/api/src/apis/ProjectMembershipApi.d.ts +126 -0
- package/build/generated-sources/api/src/apis/ProjectMembershipApi.js +154 -0
- package/build/generated-sources/api/src/apis/ProviderAppApi.d.ts +130 -0
- package/build/generated-sources/api/src/apis/ProviderAppApi.js +158 -0
- package/build/generated-sources/api/src/apis/RevisionApi.d.ts +87 -0
- package/build/generated-sources/api/src/apis/RevisionApi.js +113 -0
- package/build/generated-sources/api/src/apis/UploadURLApi.d.ts +46 -0
- package/build/generated-sources/api/src/apis/UploadURLApi.js +68 -0
- package/build/generated-sources/api/src/apis/index.d.ts +15 -1
- package/build/generated-sources/api/src/apis/index.js +15 -1
- package/build/generated-sources/api/src/models/Destination.d.ts +44 -0
- package/build/generated-sources/api/src/models/Destination.js +57 -0
- package/build/generated-sources/api/src/models/DestinationMetadata.d.ts +39 -0
- package/build/generated-sources/api/src/models/{CreateDestinationRequestMetadata.js → DestinationMetadata.js} +11 -11
- package/build/generated-sources/api/src/models/OperationLog.d.ts +43 -0
- package/build/generated-sources/api/src/models/OperationLog.js +56 -0
- package/build/generated-sources/api/src/models/ProviderApp.d.ts +6 -0
- package/build/generated-sources/api/src/models/ProviderApp.js +2 -0
- package/build/generated-sources/api/src/models/index.d.ts +3 -2
- package/build/generated-sources/api/src/models/index.js +3 -2
- package/build/src/assets/TrashIcon.js +3 -1
- package/build/src/components/Configure/InstallIntegration.d.ts +4 -1
- package/build/src/components/Configure/InstallIntegration.js +10 -23
- package/build/src/components/Configure/actions/onSaveReadCreateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/{onSaveCreate.js → onSaveReadCreateInstallation.js} +7 -6
- package/build/src/components/Configure/actions/onSaveReadUpdateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/{onSaveUpdate.js → onSaveReadUpdateInstallation.js} +13 -8
- package/build/src/components/Configure/actions/write/generateConfigWriteObjects.d.ts +26 -0
- package/build/src/components/Configure/actions/write/generateConfigWriteObjects.js +41 -0
- package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.js +85 -0
- package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.js +60 -0
- package/build/src/components/Configure/{ConfigureInstallationBase.d.ts → content/ConfigureInstallationBase.d.ts} +2 -1
- package/build/src/components/Configure/content/ConfigureInstallationBase.js +36 -0
- package/build/src/components/Configure/content/CreateInstallation.js +83 -0
- package/build/src/components/Configure/content/InstallationContent.d.ts +1 -0
- package/build/src/components/Configure/content/InstallationContent.js +20 -0
- package/build/src/components/Configure/{UninstallContent.js → content/UninstallContent.js} +10 -9
- package/build/src/components/Configure/{UpdateInstallation.d.ts → content/UpdateInstallation.d.ts} +1 -1
- package/build/src/components/Configure/{UpdateInstallation.js → content/UpdateInstallation.js} +42 -28
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/FieldMapping.d.ts +1 -1
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/FieldMapping.js +4 -7
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/RequiredFieldMappings.js +10 -11
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/setFieldMapping.d.ts +1 -1
- package/build/src/components/Configure/content/fields/FieldMappings/setFieldMapping.js +21 -0
- package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.js +9 -14
- package/build/src/components/Configure/{fields → content/fields}/OptionalFields/setOptionalField.d.ts +1 -1
- package/build/src/components/Configure/content/fields/OptionalFields/setOptionalField.js +27 -0
- package/build/src/components/Configure/content/fields/ReadFields.d.ts +1 -0
- package/build/src/components/Configure/content/fields/ReadFields.js +11 -0
- package/build/src/components/Configure/content/fields/RequiredFields.js +23 -0
- package/build/src/components/Configure/content/fields/WriteFields/WriteFields.d.ts +1 -0
- package/build/src/components/Configure/content/fields/WriteFields/WriteFields.js +22 -0
- package/build/src/components/Configure/content/fields/WriteFields/index.d.ts +2 -0
- package/build/src/components/Configure/content/fields/WriteFields/index.js +5 -0
- package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.d.ts +3 -0
- package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.js +32 -0
- package/build/src/components/Configure/content/useMutateInstallation.d.ts +23 -0
- package/build/src/components/Configure/content/useMutateInstallation.js +47 -0
- package/build/src/components/Configure/content/useSelectedConfigureState.d.ts +72 -0
- package/build/src/components/Configure/content/useSelectedConfigureState.js +24 -0
- package/build/src/components/Configure/{ProtectedConnectionLayout.d.ts → layout/ProtectedConnectionLayout.d.ts} +2 -1
- package/build/src/components/Configure/{ProtectedConnectionLayout.js → layout/ProtectedConnectionLayout.js} +13 -13
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/NavObjectItem.d.ts +1 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/NavObjectItem.js +3 -3
- package/build/src/components/Configure/nav/ObjectManagementNav/OtherTab.d.ts +7 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/OtherTab.js +11 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/UninstallInstallation.d.ts +1 -1
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/UninstallInstallation.js +2 -2
- package/build/src/components/Configure/nav/ObjectManagementNav/constant.d.ts +1 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/constant.js +4 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/index.d.ts +1 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/index.js +61 -0
- package/build/src/components/Configure/state/ConfigurationStateProvider.d.ts +70 -42
- package/build/src/components/Configure/state/ConfigurationStateProvider.js +39 -17
- package/build/src/components/Configure/state/HydratedRevisionContext.js +11 -9
- package/build/src/components/Configure/state/utils.d.ts +2 -2
- package/build/src/components/Configure/state/utils.js +44 -19
- package/build/src/components/Configure/types.d.ts +22 -6
- package/build/src/components/Configure/utils.d.ts +3 -2
- package/build/src/components/Configure/utils.js +25 -5
- package/build/src/components/Connect/ConnectProvider.d.ts +3 -1
- package/build/src/components/Connect/ConnectProvider.js +6 -12
- package/build/src/components/Connect/ConnectedSuccessBox.d.ts +5 -0
- package/build/src/components/Connect/ConnectedSuccessBox.js +13 -0
- package/build/src/components/Connect/useConnectionHandler.d.ts +10 -0
- package/build/src/components/Connect/useConnectionHandler.js +24 -0
- package/build/src/components/ErrorTextBox.js +11 -0
- package/build/src/components/Oauth/NoSubdomainEntry/LandingContent.d.ts +8 -0
- package/build/src/components/Oauth/{Hubspot/HubspotLandingContent.js → NoSubdomainEntry/LandingContent.js} +5 -4
- package/build/src/components/Oauth/NoSubdomainEntry/NoSubdomainOauthFlow.d.ts +16 -0
- package/build/src/components/Oauth/{Hubspot/HubspotOauthFlow.js → NoSubdomainEntry/NoSubdomainOauthFlow.js} +14 -14
- package/build/src/components/{Connect → Oauth}/OAuthPopup.js +8 -10
- package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.js +5 -5
- package/build/src/components/Oauth/fetchOAuthCallbackURL.d.ts +1 -1
- package/build/src/components/Oauth/fetchOAuthCallbackURL.js +3 -4
- package/build/src/components/RedirectHandler/RedirectHandler.d.ts +15 -0
- package/build/src/components/RedirectHandler/RedirectHandler.js +31 -0
- package/build/src/components/RedirectHandler/index.d.ts +1 -0
- package/build/src/components/RedirectHandler/index.js +5 -0
- package/build/src/{components/AmpersandProvider/AmpersandProvider.js → context/AmpersandContextProvider/AmpersandContextProvider.js} +6 -6
- package/build/src/context/AmpersandContextProvider/index.d.ts +1 -0
- package/build/src/{components/AmpersandProvider → context/AmpersandContextProvider}/index.js +1 -1
- package/build/src/context/{ConnectionsContext.js → ConnectionsContextProvider.js} +11 -10
- package/build/src/context/{InstallIntegrationContext.d.ts → InstallIntegrationContextProvider.d.ts} +7 -2
- package/build/src/context/{InstallIntegrationContext.js → InstallIntegrationContextProvider.js} +29 -14
- package/build/src/context/{IntegrationListContext.js → IntegrationListContextProvider.js} +4 -4
- package/build/src/context/{ProjectContext.js → ProjectContextProvider.js} +4 -4
- package/build/src/hooks/useIsIntegrationInstalled.js +7 -7
- package/build/src/index.d.ts +1 -2
- package/build/src/index.js +1 -2
- package/build/src/public/index.d.ts +7 -0
- package/build/src/{components → public}/index.js +7 -3
- package/build/src/services/ApiService.d.ts +27 -0
- package/build/src/services/ApiService.js +34 -0
- package/build/src/services/api.d.ts +5 -4
- package/build/src/services/api.js +11 -6
- package/package.json +2 -2
- package/build/generated-sources/api/src/apis/DefaultApi.d.ts +0 -930
- package/build/generated-sources/api/src/apis/DefaultApi.js +0 -1019
- package/build/generated-sources/api/src/models/CreateDestinationRequest.d.ts +0 -44
- package/build/generated-sources/api/src/models/CreateDestinationRequest.js +0 -57
- package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.d.ts +0 -39
- package/build/src/components/AmpersandProvider/index.d.ts +0 -1
- package/build/src/components/CenteredTextBox/CenteredTextBox.d.ts +0 -5
- package/build/src/components/CenteredTextBox/CenteredTextBox.js +0 -8
- package/build/src/components/Configure/ConfigureInstallationBase.js +0 -29
- package/build/src/components/Configure/CreateInstallation.js +0 -70
- package/build/src/components/Configure/ErrorTextBox.js +0 -9
- package/build/src/components/Configure/ObjectManagementNav/index.js +0 -53
- package/build/src/components/Configure/actions/onSaveCreate.d.ts +0 -3
- package/build/src/components/Configure/actions/onSaveUpdate.d.ts +0 -3
- package/build/src/components/Configure/fields/FieldMappings/setFieldMapping.js +0 -18
- package/build/src/components/Configure/fields/OptionalFields/setOptionalField.js +0 -21
- package/build/src/components/Configure/fields/RequiredFields.js +0 -27
- package/build/src/components/Oauth/Hubspot/HubspotLandingContent.d.ts +0 -7
- package/build/src/components/Oauth/Hubspot/HubspotOauthFlow.d.ts +0 -15
- package/build/src/components/index.d.ts +0 -3
- /package/build/src/components/Configure/{CreateInstallation.d.ts → content/CreateInstallation.d.ts} +0 -0
- /package/build/src/components/Configure/{UninstallContent.d.ts → content/UninstallContent.d.ts} +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldHeader.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldHeader.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/RequiredFieldMappings.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/index.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/index.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/index.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/index.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/RequiredFields.d.ts +0 -0
- /package/build/src/components/{Configure/ErrorTextBox.d.ts → ErrorTextBox.d.ts} +0 -0
- /package/build/src/components/{Connect → Oauth}/OAuthPopup.d.ts +0 -0
- /package/build/src/{components/AmpersandProvider/AmpersandProvider.d.ts → context/AmpersandContextProvider/AmpersandContextProvider.d.ts} +0 -0
- /package/build/src/context/{ApiKeyProvider.d.ts → ApiKeyContextProvider.d.ts} +0 -0
- /package/build/src/context/{ApiKeyProvider.js → ApiKeyContextProvider.js} +0 -0
- /package/build/src/context/{ConnectionsContext.d.ts → ConnectionsContextProvider.d.ts} +0 -0
- /package/build/src/context/{IntegrationListContext.d.ts → IntegrationListContextProvider.d.ts} +0 -0
- /package/build/src/context/{ProjectContext.d.ts → ProjectContextProvider.d.ts} +0 -0
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
* Do not edit the class manually.
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.DestinationMetadataToJSON = exports.DestinationMetadataFromJSONTyped = exports.DestinationMetadataFromJSON = exports.instanceOfDestinationMetadata = void 0;
|
|
17
17
|
const runtime_1 = require("../runtime");
|
|
18
18
|
/**
|
|
19
|
-
* Check if a given object implements the
|
|
19
|
+
* Check if a given object implements the DestinationMetadata interface.
|
|
20
20
|
*/
|
|
21
|
-
function
|
|
21
|
+
function instanceOfDestinationMetadata(value) {
|
|
22
22
|
let isInstance = true;
|
|
23
23
|
return isInstance;
|
|
24
24
|
}
|
|
25
|
-
exports.
|
|
26
|
-
function
|
|
27
|
-
return
|
|
25
|
+
exports.instanceOfDestinationMetadata = instanceOfDestinationMetadata;
|
|
26
|
+
function DestinationMetadataFromJSON(json) {
|
|
27
|
+
return DestinationMetadataFromJSONTyped(json, false);
|
|
28
28
|
}
|
|
29
|
-
exports.
|
|
30
|
-
function
|
|
29
|
+
exports.DestinationMetadataFromJSON = DestinationMetadataFromJSON;
|
|
30
|
+
function DestinationMetadataFromJSONTyped(json, ignoreDiscriminator) {
|
|
31
31
|
if ((json === undefined) || (json === null)) {
|
|
32
32
|
return json;
|
|
33
33
|
}
|
|
@@ -36,8 +36,8 @@ function CreateDestinationRequestMetadataFromJSONTyped(json, ignoreDiscriminator
|
|
|
36
36
|
'headers': !(0, runtime_1.exists)(json, 'headers') ? undefined : json['headers'],
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
exports.
|
|
40
|
-
function
|
|
39
|
+
exports.DestinationMetadataFromJSONTyped = DestinationMetadataFromJSONTyped;
|
|
40
|
+
function DestinationMetadataToJSON(value) {
|
|
41
41
|
if (value === undefined) {
|
|
42
42
|
return undefined;
|
|
43
43
|
}
|
|
@@ -49,4 +49,4 @@ function CreateDestinationRequestMetadataToJSON(value) {
|
|
|
49
49
|
'headers': value.headers,
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
exports.
|
|
52
|
+
exports.DestinationMetadataToJSON = DestinationMetadataToJSON;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ampersand public API
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface OperationLog
|
|
16
|
+
*/
|
|
17
|
+
export interface OperationLog {
|
|
18
|
+
/**
|
|
19
|
+
* The time the log was created.
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof OperationLog
|
|
22
|
+
*/
|
|
23
|
+
timestamp: string;
|
|
24
|
+
/**
|
|
25
|
+
* The log message.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof OperationLog
|
|
28
|
+
*/
|
|
29
|
+
message: string;
|
|
30
|
+
/**
|
|
31
|
+
* The severity of the log.
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof OperationLog
|
|
34
|
+
*/
|
|
35
|
+
severity: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check if a given object implements the OperationLog interface.
|
|
39
|
+
*/
|
|
40
|
+
export declare function instanceOfOperationLog(value: object): boolean;
|
|
41
|
+
export declare function OperationLogFromJSON(json: any): OperationLog;
|
|
42
|
+
export declare function OperationLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): OperationLog;
|
|
43
|
+
export declare function OperationLogToJSON(value?: OperationLog | null): any;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Ampersand public API
|
|
6
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.OperationLogToJSON = exports.OperationLogFromJSONTyped = exports.OperationLogFromJSON = exports.instanceOfOperationLog = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a given object implements the OperationLog interface.
|
|
19
|
+
*/
|
|
20
|
+
function instanceOfOperationLog(value) {
|
|
21
|
+
let isInstance = true;
|
|
22
|
+
isInstance = isInstance && "timestamp" in value;
|
|
23
|
+
isInstance = isInstance && "message" in value;
|
|
24
|
+
isInstance = isInstance && "severity" in value;
|
|
25
|
+
return isInstance;
|
|
26
|
+
}
|
|
27
|
+
exports.instanceOfOperationLog = instanceOfOperationLog;
|
|
28
|
+
function OperationLogFromJSON(json) {
|
|
29
|
+
return OperationLogFromJSONTyped(json, false);
|
|
30
|
+
}
|
|
31
|
+
exports.OperationLogFromJSON = OperationLogFromJSON;
|
|
32
|
+
function OperationLogFromJSONTyped(json, ignoreDiscriminator) {
|
|
33
|
+
if ((json === undefined) || (json === null)) {
|
|
34
|
+
return json;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
'timestamp': json['timestamp'],
|
|
38
|
+
'message': json['message'],
|
|
39
|
+
'severity': json['severity'],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
exports.OperationLogFromJSONTyped = OperationLogFromJSONTyped;
|
|
43
|
+
function OperationLogToJSON(value) {
|
|
44
|
+
if (value === undefined) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
if (value === null) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
'timestamp': value.timestamp,
|
|
52
|
+
'message': value.message,
|
|
53
|
+
'severity': value.severity,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
exports.OperationLogToJSON = OperationLogToJSON;
|
|
@@ -45,6 +45,12 @@ export interface ProviderApp {
|
|
|
45
45
|
* @memberof ProviderApp
|
|
46
46
|
*/
|
|
47
47
|
clientId: string;
|
|
48
|
+
/**
|
|
49
|
+
* The OAuth scopes for this app.
|
|
50
|
+
* @type {Array<string>}
|
|
51
|
+
* @memberof ProviderApp
|
|
52
|
+
*/
|
|
53
|
+
scopes?: Array<string>;
|
|
48
54
|
/**
|
|
49
55
|
* The time the provider app was created.
|
|
50
56
|
* @type {Date}
|
|
@@ -42,6 +42,7 @@ function ProviderAppFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
42
42
|
'externalRef': !(0, runtime_1.exists)(json, 'externalRef') ? undefined : json['externalRef'],
|
|
43
43
|
'provider': json['provider'],
|
|
44
44
|
'clientId': json['clientId'],
|
|
45
|
+
'scopes': !(0, runtime_1.exists)(json, 'scopes') ? undefined : json['scopes'],
|
|
45
46
|
'createTime': (new Date(json['createTime'])),
|
|
46
47
|
'updateTime': !(0, runtime_1.exists)(json, 'updateTime') ? undefined : (new Date(json['updateTime'])),
|
|
47
48
|
};
|
|
@@ -60,6 +61,7 @@ function ProviderAppToJSON(value) {
|
|
|
60
61
|
'externalRef': value.externalRef,
|
|
61
62
|
'provider': value.provider,
|
|
62
63
|
'clientId': value.clientId,
|
|
64
|
+
'scopes': value.scopes,
|
|
63
65
|
'createTime': (value.createTime.toISOString()),
|
|
64
66
|
'updateTime': value.updateTime === undefined ? undefined : (value.updateTime.toISOString()),
|
|
65
67
|
};
|
|
@@ -10,8 +10,6 @@ export * from './ConfigContentAllOf';
|
|
|
10
10
|
export * from './Connection';
|
|
11
11
|
export * from './Consumer';
|
|
12
12
|
export * from './CreateConsumerRequest';
|
|
13
|
-
export * from './CreateDestinationRequest';
|
|
14
|
-
export * from './CreateDestinationRequestMetadata';
|
|
15
13
|
export * from './CreateGroupRequest';
|
|
16
14
|
export * from './CreateInstallationRequest';
|
|
17
15
|
export * from './CreateInstallationRequestConfig';
|
|
@@ -19,6 +17,8 @@ export * from './CreateIntegrationRequest';
|
|
|
19
17
|
export * from './CreateIntegrationRequestLatestRevision';
|
|
20
18
|
export * from './CreateProjectRequest';
|
|
21
19
|
export * from './CreateProviderAppRequest';
|
|
20
|
+
export * from './Destination';
|
|
21
|
+
export * from './DestinationMetadata';
|
|
22
22
|
export * from './Group';
|
|
23
23
|
export * from './HydratedIntegration';
|
|
24
24
|
export * from './HydratedIntegrationField';
|
|
@@ -44,6 +44,7 @@ export * from './IntegrationWriteObject';
|
|
|
44
44
|
export * from './OauthConnectRequest';
|
|
45
45
|
export * from './Operation';
|
|
46
46
|
export * from './OperationError';
|
|
47
|
+
export * from './OperationLog';
|
|
47
48
|
export * from './OptionalFieldsAutoOption';
|
|
48
49
|
export * from './Project';
|
|
49
50
|
export * from './ProjectMembership';
|
|
@@ -28,8 +28,6 @@ __exportStar(require("./ConfigContentAllOf"), exports);
|
|
|
28
28
|
__exportStar(require("./Connection"), exports);
|
|
29
29
|
__exportStar(require("./Consumer"), exports);
|
|
30
30
|
__exportStar(require("./CreateConsumerRequest"), exports);
|
|
31
|
-
__exportStar(require("./CreateDestinationRequest"), exports);
|
|
32
|
-
__exportStar(require("./CreateDestinationRequestMetadata"), exports);
|
|
33
31
|
__exportStar(require("./CreateGroupRequest"), exports);
|
|
34
32
|
__exportStar(require("./CreateInstallationRequest"), exports);
|
|
35
33
|
__exportStar(require("./CreateInstallationRequestConfig"), exports);
|
|
@@ -37,6 +35,8 @@ __exportStar(require("./CreateIntegrationRequest"), exports);
|
|
|
37
35
|
__exportStar(require("./CreateIntegrationRequestLatestRevision"), exports);
|
|
38
36
|
__exportStar(require("./CreateProjectRequest"), exports);
|
|
39
37
|
__exportStar(require("./CreateProviderAppRequest"), exports);
|
|
38
|
+
__exportStar(require("./Destination"), exports);
|
|
39
|
+
__exportStar(require("./DestinationMetadata"), exports);
|
|
40
40
|
__exportStar(require("./Group"), exports);
|
|
41
41
|
__exportStar(require("./HydratedIntegration"), exports);
|
|
42
42
|
__exportStar(require("./HydratedIntegrationField"), exports);
|
|
@@ -62,6 +62,7 @@ __exportStar(require("./IntegrationWriteObject"), exports);
|
|
|
62
62
|
__exportStar(require("./OauthConnectRequest"), exports);
|
|
63
63
|
__exportStar(require("./Operation"), exports);
|
|
64
64
|
__exportStar(require("./OperationError"), exports);
|
|
65
|
+
__exportStar(require("./OperationLog"), exports);
|
|
65
66
|
__exportStar(require("./OptionalFieldsAutoOption"), exports);
|
|
66
67
|
__exportStar(require("./Project"), exports);
|
|
67
68
|
__exportStar(require("./ProjectMembership"), exports);
|
|
@@ -4,6 +4,8 @@ exports.TrashIcon = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
// red.800 trash icon
|
|
6
6
|
function TrashIcon() {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.25 4.5H3.75H15.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", {
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.25 4.5H3.75H15.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", {
|
|
8
|
+
// eslint-disable-next-line max-len
|
|
9
|
+
d: "M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M7.5 8.25V12.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.5 8.25V12.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
8
10
|
}
|
|
9
11
|
exports.TrashIcon = TrashIcon;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Config } from '../../services/api';
|
|
1
2
|
interface InstallIntegrationProps {
|
|
2
3
|
integration: string;
|
|
3
4
|
consumerRef: string;
|
|
4
5
|
consumerName?: string;
|
|
5
6
|
groupRef: string;
|
|
6
7
|
groupName?: string;
|
|
8
|
+
onInstallSuccess?: (installationId: string, config: Config) => void;
|
|
9
|
+
onUpdateSuccess?: (installationId: string, config: Config) => void;
|
|
7
10
|
}
|
|
8
|
-
export declare function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, }: InstallIntegrationProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, onInstallSuccess, onUpdateSuccess, }: InstallIntegrationProps): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -2,38 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InstallIntegration = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const ConnectionsContextProvider_1 = require("../../context/ConnectionsContextProvider");
|
|
6
6
|
const ErrorContextProvider_1 = require("../../context/ErrorContextProvider");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const InstallIntegrationContextProvider_1 = require("../../context/InstallIntegrationContextProvider");
|
|
8
|
+
const ProjectContextProvider_1 = require("../../context/ProjectContextProvider");
|
|
9
|
+
const ErrorTextBox_1 = require("../ErrorTextBox");
|
|
10
|
+
const InstallationContent_1 = require("./content/InstallationContent");
|
|
11
|
+
const ProtectedConnectionLayout_1 = require("./layout/ProtectedConnectionLayout");
|
|
12
|
+
const ObjectManagementNav_1 = require("./nav/ObjectManagementNav");
|
|
9
13
|
const ConfigurationStateProvider_1 = require("./state/ConfigurationStateProvider");
|
|
10
14
|
const HydratedRevisionContext_1 = require("./state/HydratedRevisionContext");
|
|
11
|
-
|
|
12
|
-
const ErrorTextBox_1 = require("./ErrorTextBox");
|
|
13
|
-
const ObjectManagementNav_1 = require("./ObjectManagementNav");
|
|
14
|
-
const ProtectedConnectionLayout_1 = require("./ProtectedConnectionLayout");
|
|
15
|
-
const UpdateInstallation_1 = require("./UpdateInstallation");
|
|
16
|
-
// todo : add the install integration provider to supply these properties
|
|
17
|
-
function InstallationContent() {
|
|
18
|
-
const { integrationObj, installation } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
19
|
-
if (!integrationObj) {
|
|
20
|
-
return (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: "We can't load the integration" });
|
|
21
|
-
}
|
|
22
|
-
return installation && integrationObj ? (
|
|
23
|
-
// If installation exists, render update installation flow
|
|
24
|
-
(0, jsx_runtime_1.jsx)(UpdateInstallation_1.UpdateInstallation, { installation: installation, integrationObj: integrationObj })) : (
|
|
25
|
-
// No installation, render create installation flow
|
|
26
|
-
(0, jsx_runtime_1.jsx)(CreateInstallation_1.CreateInstallation, {}));
|
|
27
|
-
}
|
|
28
|
-
function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, }) {
|
|
15
|
+
function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, onInstallSuccess, onUpdateSuccess, }) {
|
|
29
16
|
var _a;
|
|
30
|
-
const { projectId } = (0,
|
|
17
|
+
const { projectId } = (0, ProjectContextProvider_1.useProject)();
|
|
31
18
|
const { errorState } = (0, ErrorContextProvider_1.useErrorState)();
|
|
32
19
|
if ((_a = errorState[ErrorContextProvider_1.ErrorBoundary.INTEGRATION_LIST]) === null || _a === void 0 ? void 0 : _a.apiError) {
|
|
33
20
|
return (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: "Something went wrong, couldn't find integration information" });
|
|
34
21
|
}
|
|
35
22
|
return (
|
|
36
23
|
// install integration provider provides all props, integrationObj and installation
|
|
37
|
-
(0, jsx_runtime_1.jsx)(
|
|
24
|
+
(0, jsx_runtime_1.jsx)(InstallIntegrationContextProvider_1.InstallIntegrationProvider, { integration: integration, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, onInstallSuccess: onInstallSuccess, onUpdateSuccess: onUpdateSuccess, children: (0, jsx_runtime_1.jsx)(ConnectionsContextProvider_1.ConnectionsProvider, { groupRef: groupRef, children: (0, jsx_runtime_1.jsx)(ProtectedConnectionLayout_1.ProtectedConnectionLayout, { consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, children: (0, jsx_runtime_1.jsx)(HydratedRevisionContext_1.HydratedRevisionProvider, { projectId: projectId, children: (0, jsx_runtime_1.jsx)(ConfigurationStateProvider_1.ConfigurationProvider, { children: (0, jsx_runtime_1.jsx)(ObjectManagementNav_1.ObjectManagementNav, { children: (0, jsx_runtime_1.jsx)(InstallationContent_1.InstallationContent, {}) }) }) }) }) }) }));
|
|
38
25
|
}
|
|
39
26
|
exports.InstallIntegration = InstallIntegration;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Config, HydratedRevision, Installation } from '../../../services/api';
|
|
2
|
+
import { ConfigureState } from '../types';
|
|
3
|
+
export declare const onSaveReadCreateInstallation: (projectId: string, integrationId: string, groupRef: string, consumerRef: string, connectionId: string, objectName: string, apiKey: string, hydratedRevision: HydratedRevision, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, onInstallSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
|
package/build/src/components/Configure/actions/{onSaveCreate.js → onSaveReadCreateInstallation.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.onSaveReadCreateInstallation = void 0;
|
|
4
4
|
const api_1 = require("../../../services/api");
|
|
5
5
|
const utils_1 = require("../state/utils");
|
|
6
6
|
/**
|
|
@@ -29,7 +29,7 @@ const getObjectFromHydratedRevision = (hydratedRevision, objectName) => {
|
|
|
29
29
|
* @param consumerRef
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
const
|
|
32
|
+
const generateCreateReadConfigFromConfigureState = (configureState, objectName, hydratedRevision, consumerRef) => {
|
|
33
33
|
const selectedFields = (0, utils_1.generateSelectedFieldsFromConfigureState)(configureState);
|
|
34
34
|
const selectedFieldMappings = (0, utils_1.generateSelectedFieldMappingsFromConfigureState)(configureState);
|
|
35
35
|
const obj = getObjectFromHydratedRevision(hydratedRevision, objectName);
|
|
@@ -58,8 +58,8 @@ const generateCreateConfigFromConfigureState = (configureState, objectName, hydr
|
|
|
58
58
|
};
|
|
59
59
|
return createConfigObj;
|
|
60
60
|
};
|
|
61
|
-
const
|
|
62
|
-
const createConfig =
|
|
61
|
+
const onSaveReadCreateInstallation = (projectId, integrationId, groupRef, consumerRef, connectionId, objectName, apiKey, hydratedRevision, configureState, setInstallation, onInstallSuccess) => {
|
|
62
|
+
const createConfig = generateCreateReadConfigFromConfigureState(configureState, objectName, hydratedRevision, consumerRef);
|
|
63
63
|
if (!createConfig) {
|
|
64
64
|
console.error('Error when generating createConfig from configureState');
|
|
65
65
|
return Promise.resolve(null);
|
|
@@ -73,7 +73,7 @@ const onSaveCreate = (projectId, integrationId, groupRef, consumerRef, connectio
|
|
|
73
73
|
config: createConfig,
|
|
74
74
|
},
|
|
75
75
|
};
|
|
76
|
-
return (0, api_1.api)().createInstallation(createInstallationRequest, {
|
|
76
|
+
return (0, api_1.api)().installationApi.createInstallation(createInstallationRequest, {
|
|
77
77
|
headers: {
|
|
78
78
|
'X-Api-Key': apiKey,
|
|
79
79
|
'Content-Type': 'application/json',
|
|
@@ -82,9 +82,10 @@ const onSaveCreate = (projectId, integrationId, groupRef, consumerRef, connectio
|
|
|
82
82
|
.then((installation) => {
|
|
83
83
|
// update local installation state
|
|
84
84
|
setInstallation(installation);
|
|
85
|
+
onInstallSuccess === null || onInstallSuccess === void 0 ? void 0 : onInstallSuccess(installation.id, installation.config);
|
|
85
86
|
})
|
|
86
87
|
.catch((err) => {
|
|
87
88
|
console.error('ERROR: ', err);
|
|
88
89
|
});
|
|
89
90
|
};
|
|
90
|
-
exports.
|
|
91
|
+
exports.onSaveReadCreateInstallation = onSaveReadCreateInstallation;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Config, HydratedIntegrationObject, Installation } from '../../../services/api';
|
|
2
|
+
import { ConfigureState } from '../types';
|
|
3
|
+
export declare const onSaveReadUpdateInstallation: (projectId: string, integrationId: string, installationId: string, selectedObjectName: string, apiKey: string, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, hydratedObject: HydratedIntegrationObject, onUpdateSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
|
package/build/src/components/Configure/actions/{onSaveUpdate.js → onSaveReadUpdateInstallation.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.onSaveReadUpdateInstallation = void 0;
|
|
4
4
|
const api_1 = require("../../../services/api");
|
|
5
5
|
const utils_1 = require("../state/utils");
|
|
6
6
|
/**
|
|
@@ -19,7 +19,7 @@ const utils_1 = require("../state/utils");
|
|
|
19
19
|
* @param schedule
|
|
20
20
|
* @returns
|
|
21
21
|
*/
|
|
22
|
-
const
|
|
22
|
+
const generateUpdateReadConfigFromConfigureState = (configureState, objectName, hydratedObject, schedule) => {
|
|
23
23
|
const selectedFields = (0, utils_1.generateSelectedFieldsFromConfigureState)(configureState);
|
|
24
24
|
const selectedFieldMappings = (0, utils_1.generateSelectedFieldMappingsFromConfigureState)(configureState);
|
|
25
25
|
// config request object type needs to be fixed
|
|
@@ -41,10 +41,14 @@ const generateUpdateConfigFromConfigureState = (configureState, objectName, hydr
|
|
|
41
41
|
};
|
|
42
42
|
return updateConfigObject;
|
|
43
43
|
};
|
|
44
|
-
const
|
|
44
|
+
const onSaveReadUpdateInstallation = (projectId, integrationId, installationId, selectedObjectName, apiKey, configureState, setInstallation, hydratedObject, onUpdateSuccess) => {
|
|
45
45
|
// get configuration state
|
|
46
46
|
// transform configuration state to update shape
|
|
47
|
-
const updateConfig =
|
|
47
|
+
const updateConfig = generateUpdateReadConfigFromConfigureState(configureState, selectedObjectName || '', hydratedObject, hydratedObject.schedule);
|
|
48
|
+
if (!updateConfig) {
|
|
49
|
+
console.error('Error when generating updateConfig from configureState');
|
|
50
|
+
return Promise.resolve(null);
|
|
51
|
+
}
|
|
48
52
|
const updateInstallationRequest = {
|
|
49
53
|
projectId,
|
|
50
54
|
installationId,
|
|
@@ -59,16 +63,17 @@ const onSaveUpdate = (projectId, integrationId, installationId, selectedObjectNa
|
|
|
59
63
|
},
|
|
60
64
|
};
|
|
61
65
|
// call api.updateInstallation
|
|
62
|
-
return (0, api_1.api)().updateInstallation(updateInstallationRequest, {
|
|
66
|
+
return (0, api_1.api)().installationApi.updateInstallation(updateInstallationRequest, {
|
|
63
67
|
headers: {
|
|
64
68
|
'X-Api-Key': apiKey,
|
|
65
69
|
'Content-Type': 'application/json',
|
|
66
70
|
},
|
|
67
|
-
}).then((
|
|
71
|
+
}).then((installation) => {
|
|
68
72
|
// update local installation state
|
|
69
|
-
setInstallation(
|
|
73
|
+
setInstallation(installation);
|
|
74
|
+
onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess(installation.id, installation.config);
|
|
70
75
|
}).catch((err) => {
|
|
71
76
|
console.error('ERROR: ', err);
|
|
72
77
|
});
|
|
73
78
|
};
|
|
74
|
-
exports.
|
|
79
|
+
exports.onSaveReadUpdateInstallation = onSaveReadUpdateInstallation;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigureState } from '../../types';
|
|
2
|
+
type WriteObject = {
|
|
3
|
+
objectName: string;
|
|
4
|
+
};
|
|
5
|
+
type WriteObjects = {
|
|
6
|
+
[objectName: string]: WriteObject;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* example type
|
|
10
|
+
* "objects":
|
|
11
|
+
* {
|
|
12
|
+
objects: {
|
|
13
|
+
account: {
|
|
14
|
+
objectName: 'account',
|
|
15
|
+
},
|
|
16
|
+
contact: {
|
|
17
|
+
objectName: 'contact',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
* @param writeObjects
|
|
22
|
+
* @param configureState
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare const generateConfigWriteObjects: (configureState: ConfigureState) => WriteObjects;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateConfigWriteObjects = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* example type
|
|
6
|
+
* "objects":
|
|
7
|
+
* {
|
|
8
|
+
objects: {
|
|
9
|
+
account: {
|
|
10
|
+
objectName: 'account',
|
|
11
|
+
},
|
|
12
|
+
contact: {
|
|
13
|
+
objectName: 'contact',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
* @param writeObjects
|
|
18
|
+
* @param configureState
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
const generateConfigWriteObjects = (configureState) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const configWriteObjects = {}; // `any` is listed type in generated SDK
|
|
24
|
+
const configStateWriteObjects = (_a = configureState.write) === null || _a === void 0 ? void 0 : _a.writeObjects;
|
|
25
|
+
const selected = (_b = configureState.write) === null || _b === void 0 ? void 0 : _b.selectedNonConfigurableWriteFields;
|
|
26
|
+
const selectedKeys = selected ? Object.keys(selected) : [];
|
|
27
|
+
if (configStateWriteObjects) {
|
|
28
|
+
configStateWriteObjects.forEach((configStateWriteObject) => {
|
|
29
|
+
const obj = configStateWriteObject.objectName;
|
|
30
|
+
// object exists in config form
|
|
31
|
+
if (selectedKeys.includes(obj)) {
|
|
32
|
+
// insert objectName into configWriteObjects
|
|
33
|
+
configWriteObjects[obj] = {
|
|
34
|
+
objectName: obj,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return configWriteObjects;
|
|
40
|
+
};
|
|
41
|
+
exports.generateConfigWriteObjects = generateConfigWriteObjects;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Config, HydratedRevision, Installation } from '../../../../services/api';
|
|
2
|
+
import { ConfigureState } from '../../types';
|
|
3
|
+
export declare const onSaveWriteCreateInstallation: (projectId: string, integrationId: string, groupRef: string, consumerRef: string, connectionId: string, apiKey: string, hydratedRevision: HydratedRevision, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, onInstallSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onSaveWriteCreateInstallation = void 0;
|
|
4
|
+
const api_1 = require("../../../../services/api");
|
|
5
|
+
const generateConfigWriteObjects_1 = require("./generateConfigWriteObjects");
|
|
6
|
+
/**
|
|
7
|
+
* gets write objects from hydratedRevision
|
|
8
|
+
* @param hydratedRevision
|
|
9
|
+
* @param objectName
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
const getWriteObjectsFromHydratedRevision = (hydratedRevision) => {
|
|
13
|
+
const writeAction = hydratedRevision.content.write;
|
|
14
|
+
return writeAction === null || writeAction === void 0 ? void 0 : writeAction.objects;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* given a configureState, objectName, hyrdatedRevision, and consumerRef
|
|
18
|
+
* generate the config object that is need for update installation request.
|
|
19
|
+
*
|
|
20
|
+
* 1. get required fields from configureState
|
|
21
|
+
* 2. get optional fields from configureState
|
|
22
|
+
* 3. merge required fields and optional fields into selectedFields
|
|
23
|
+
* 4. get required custom map fields from configureState
|
|
24
|
+
* 5. generate create config object
|
|
25
|
+
* @param configureState
|
|
26
|
+
* @param objectName
|
|
27
|
+
* @param hydratedRevision
|
|
28
|
+
* @param consumerRef
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
const generateCreateWriteConfigFromConfigureState = (configureState, hydratedRevision, consumerRef) => {
|
|
32
|
+
const writeObjects = getWriteObjectsFromHydratedRevision(hydratedRevision);
|
|
33
|
+
if (!writeObjects) {
|
|
34
|
+
console.error('Error when getting write objects from hydratedRevision');
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const configWriteObjects = (0, generateConfigWriteObjects_1.generateConfigWriteObjects)(configureState);
|
|
38
|
+
// create config request object
|
|
39
|
+
const createConfigObj = {
|
|
40
|
+
revisionId: hydratedRevision.id,
|
|
41
|
+
createdBy: `consumer:${consumerRef}`,
|
|
42
|
+
content: {
|
|
43
|
+
provider: hydratedRevision.content.provider,
|
|
44
|
+
// need empty read.standardObjects for update read
|
|
45
|
+
read: {
|
|
46
|
+
standardObjects: {},
|
|
47
|
+
},
|
|
48
|
+
write: {
|
|
49
|
+
objects: configWriteObjects,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
return createConfigObj;
|
|
54
|
+
};
|
|
55
|
+
const onSaveWriteCreateInstallation = (projectId, integrationId, groupRef, consumerRef, connectionId, apiKey, hydratedRevision, configureState, setInstallation, onInstallSuccess) => {
|
|
56
|
+
const createConfig = generateCreateWriteConfigFromConfigureState(configureState, hydratedRevision, consumerRef);
|
|
57
|
+
if (!createConfig) {
|
|
58
|
+
console.error('Error when generating createConfig from configureState');
|
|
59
|
+
return Promise.resolve(null);
|
|
60
|
+
}
|
|
61
|
+
const createInstallationRequest = {
|
|
62
|
+
projectId,
|
|
63
|
+
integrationId,
|
|
64
|
+
installation: {
|
|
65
|
+
groupRef,
|
|
66
|
+
connectionId,
|
|
67
|
+
config: createConfig,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
return (0, api_1.api)().installationApi.createInstallation(createInstallationRequest, {
|
|
71
|
+
headers: {
|
|
72
|
+
'X-Api-Key': apiKey,
|
|
73
|
+
'Content-Type': 'application/json',
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
.then((installation) => {
|
|
77
|
+
// update local installation state
|
|
78
|
+
setInstallation(installation);
|
|
79
|
+
onInstallSuccess === null || onInstallSuccess === void 0 ? void 0 : onInstallSuccess(installation.id, installation.config);
|
|
80
|
+
})
|
|
81
|
+
.catch((err) => {
|
|
82
|
+
console.error('ERROR: ', err);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
exports.onSaveWriteCreateInstallation = onSaveWriteCreateInstallation;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Config, Installation } from '../../../../services/api';
|
|
2
|
+
import { ConfigureState } from '../../types';
|
|
3
|
+
export declare const onSaveWriteUpdateInstallation: (projectId: string, integrationId: string, installationId: string, apiKey: string, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, onUpdateSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
|