synapse-react-client 3.1.18 → 3.1.19
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/containers/CopyToClipboardString.d.ts +11 -0
- package/dist/containers/CopyToClipboardString.js +30 -0
- package/dist/containers/CopyToClipboardString.js.map +1 -0
- package/dist/containers/FilePreview/HtmlPreview/HtmlPreview.js +2 -2
- package/dist/containers/FilePreview/HtmlPreview/HtmlPreview.js.map +1 -1
- package/dist/containers/FullWidthAlert.d.ts +1 -1
- package/dist/containers/TermsAndConditions.d.ts +1 -0
- package/dist/containers/TermsAndConditions.js +12 -6
- package/dist/containers/TermsAndConditions.js.map +1 -1
- package/dist/containers/access_requirements/AddConditionsForUseButton.d.ts +6 -0
- package/dist/containers/access_requirements/AddConditionsForUseButton.js +41 -0
- package/dist/containers/access_requirements/AddConditionsForUseButton.js.map +1 -0
- package/dist/containers/access_requirements/ImposeRestrictionDialog.d.ts +7 -0
- package/dist/containers/access_requirements/ImposeRestrictionDialog.js +67 -0
- package/dist/containers/access_requirements/ImposeRestrictionDialog.js.map +1 -0
- package/dist/containers/entity/metadata/MetadataTable.js +8 -11
- package/dist/containers/entity/metadata/MetadataTable.js.map +1 -1
- package/dist/containers/entity/page/title_bar/EntityPageTitleBar.d.ts +13 -0
- package/dist/containers/entity/page/title_bar/EntityPageTitleBar.js +51 -0
- package/dist/containers/entity/page/title_bar/EntityPageTitleBar.js.map +1 -0
- package/dist/containers/entity/page/title_bar/EntityTitleBarVersionInfo.d.ts +16 -0
- package/dist/containers/entity/page/title_bar/EntityTitleBarVersionInfo.js +64 -0
- package/dist/containers/entity/page/title_bar/EntityTitleBarVersionInfo.js.map +1 -0
- package/dist/containers/entity/page/title_bar/TitleBarProperties.d.ts +10 -0
- package/dist/containers/entity/page/title_bar/TitleBarProperties.js +58 -0
- package/dist/containers/entity/page/title_bar/TitleBarProperties.js.map +1 -0
- package/dist/containers/entity/page/title_bar/useGetEntityTitleBarProperties.d.ts +13 -0
- package/dist/containers/entity/page/title_bar/useGetEntityTitleBarProperties.js +136 -0
- package/dist/containers/entity/page/title_bar/useGetEntityTitleBarProperties.js.map +1 -0
- package/dist/containers/favorites/FavoriteButton.d.ts +9 -0
- package/dist/containers/favorites/FavoriteButton.js +42 -0
- package/dist/containers/favorites/FavoriteButton.js.map +1 -0
- package/dist/containers/utils/ConditionalWrapper.d.ts +9 -0
- package/dist/containers/utils/ConditionalWrapper.js +10 -0
- package/dist/containers/utils/ConditionalWrapper.js.map +1 -0
- package/dist/containers/widgets/RadioGroup.d.ts +6 -6
- package/dist/containers/widgets/RadioGroup.js +6 -6
- package/dist/containers/widgets/RadioGroup.js.map +1 -1
- package/dist/umd/synapse-react-client.development.js +8930 -7896
- package/dist/umd/synapse-react-client.development.js.map +4 -4
- package/dist/umd/synapse-react-client.production.min.js +74 -74
- package/dist/umd.index.d.ts +2 -0
- package/dist/umd.index.js +2 -0
- package/dist/umd.index.js.map +1 -1
- package/dist/utils/APIConstants.d.ts +2 -0
- package/dist/utils/APIConstants.js +3 -1
- package/dist/utils/APIConstants.js.map +1 -1
- package/dist/utils/SynapseClient.d.ts +22 -1
- package/dist/utils/SynapseClient.js +36 -1
- package/dist/utils/SynapseClient.js.map +1 -1
- package/dist/utils/functions/FileHandleUtils.d.ts +25 -2
- package/dist/utils/functions/FileHandleUtils.js +95 -5
- package/dist/utils/functions/FileHandleUtils.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/doi/useDOI.d.ts +4 -0
- package/dist/utils/hooks/SynapseAPI/doi/useDOI.js +15 -0
- package/dist/utils/hooks/SynapseAPI/doi/useDOI.js.map +1 -0
- package/dist/utils/hooks/SynapseAPI/file/useUploadDestination.d.ts +4 -0
- package/dist/utils/hooks/SynapseAPI/file/useUploadDestination.js +13 -0
- package/dist/utils/hooks/SynapseAPI/file/useUploadDestination.js.map +1 -0
- package/dist/utils/synapseTypes/File/UploadDestination.d.ts +102 -0
- package/dist/utils/synapseTypes/File/UploadDestination.js +21 -0
- package/dist/utils/synapseTypes/File/UploadDestination.js.map +1 -0
- package/package.json +1 -1
- package/dist/containers/FilePreview/HtmlPreview/SanitizedWarning.d.ts +0 -5
- package/dist/containers/FilePreview/HtmlPreview/SanitizedWarning.js +0 -28
- package/dist/containers/FilePreview/HtmlPreview/SanitizedWarning.js.map +0 -1
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getUploadDestinationString = exports.getDataFileHandle = exports.getStorageLocationName = exports.getFileHandleStorageInfo = void 0;
|
|
4
4
|
var synapseTypes_1 = require("../synapseTypes");
|
|
5
|
+
var UploadDestination_1 = require("../synapseTypes/File/UploadDestination");
|
|
6
|
+
var SYNAPSE_STORAGE = 'Synapse Storage';
|
|
7
|
+
var SYNAPSE_STORAGE_LOCATION_ID = 1;
|
|
8
|
+
/**
|
|
9
|
+
* Returns storage location information for a particular file handle, where the format of the information depends on the type of file handle.
|
|
10
|
+
* @param fileHandle
|
|
11
|
+
*/
|
|
12
|
+
function getFileHandleStorageInfo(fileHandle) {
|
|
13
|
+
switch (fileHandle.concreteType) {
|
|
14
|
+
case synapseTypes_1.EXTERNAL_OBJECT_STORE_FILE_HANDLE_CONCRETE_TYPE_VALUE:
|
|
15
|
+
return {
|
|
16
|
+
endpoint: fileHandle.endpointUrl,
|
|
17
|
+
bucket: fileHandle.bucket,
|
|
18
|
+
fileKey: fileHandle.fileKey,
|
|
19
|
+
};
|
|
20
|
+
case synapseTypes_1.PROXY_FILE_HANDLE_CONCRETE_TYPE_VALUE:
|
|
21
|
+
case synapseTypes_1.EXTERNAL_FILE_HANDLE_CONCRETE_TYPE_VALUE:
|
|
22
|
+
return { url: getStorageLocationName(fileHandle) };
|
|
23
|
+
case synapseTypes_1.S3_FILE_HANDLE_CONCRETE_TYPE_VALUE:
|
|
24
|
+
case synapseTypes_1.GOOGLE_CLOUD_FILE_HANDLE_CONCRETE_TYPE_VALUE:
|
|
25
|
+
return {
|
|
26
|
+
location: getStorageLocationName(fileHandle),
|
|
27
|
+
};
|
|
28
|
+
default:
|
|
29
|
+
throw new Error("Couldn't determine location name for file handle: ".concat(JSON.stringify(fileHandle)));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.getFileHandleStorageInfo = getFileHandleStorageInfo;
|
|
5
33
|
/**
|
|
6
34
|
* Gets the friendly name of a bucket/storage location using the file handle.
|
|
7
35
|
*
|
|
8
36
|
* @param fileHandle
|
|
9
37
|
* @returns
|
|
10
38
|
*/
|
|
11
|
-
function
|
|
39
|
+
function getStorageLocationName(fileHandle) {
|
|
12
40
|
switch (fileHandle.concreteType) {
|
|
13
41
|
case synapseTypes_1.PROXY_FILE_HANDLE_CONCRETE_TYPE_VALUE:
|
|
14
42
|
return fileHandle.filePath;
|
|
@@ -17,8 +45,10 @@ function getLocationName(fileHandle) {
|
|
|
17
45
|
case synapseTypes_1.EXTERNAL_FILE_HANDLE_CONCRETE_TYPE_VALUE:
|
|
18
46
|
return fileHandle.externalURL;
|
|
19
47
|
case synapseTypes_1.S3_FILE_HANDLE_CONCRETE_TYPE_VALUE:
|
|
20
|
-
|
|
21
|
-
|
|
48
|
+
// Uploads to Synapse Storage often do not get their storage location field back-filled,
|
|
49
|
+
// so null also indicates a Synapse-Stored file
|
|
50
|
+
if ([null, SYNAPSE_STORAGE_LOCATION_ID].includes(fileHandle.storageLocationId)) {
|
|
51
|
+
return SYNAPSE_STORAGE;
|
|
22
52
|
}
|
|
23
53
|
else {
|
|
24
54
|
return "s3://".concat(fileHandle.bucketName);
|
|
@@ -29,5 +59,65 @@ function getLocationName(fileHandle) {
|
|
|
29
59
|
throw new Error("Couldn't determine location name for file handle: ".concat(JSON.stringify(fileHandle)));
|
|
30
60
|
}
|
|
31
61
|
}
|
|
32
|
-
exports.
|
|
62
|
+
exports.getStorageLocationName = getStorageLocationName;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the data file handle from an entity bundle.
|
|
65
|
+
* Returns undefined if the entity does not have a data file handle that is visible to the caller.
|
|
66
|
+
* @param entityBundle
|
|
67
|
+
*/
|
|
68
|
+
function getDataFileHandle(entityBundle) {
|
|
69
|
+
var dataFileHandle = undefined;
|
|
70
|
+
if (entityBundle.entityType === synapseTypes_1.EntityType.FILE) {
|
|
71
|
+
dataFileHandle = entityBundle.fileHandles.filter(function (fh) { return fh.id === entityBundle.entity.dataFileHandleId; })[0];
|
|
72
|
+
}
|
|
73
|
+
return dataFileHandle;
|
|
74
|
+
}
|
|
75
|
+
exports.getDataFileHandle = getDataFileHandle;
|
|
76
|
+
function getUploadDestinationString(uploadDestination) {
|
|
77
|
+
var uploadDestinationString = null;
|
|
78
|
+
if (uploadDestination) {
|
|
79
|
+
switch (uploadDestination.concreteType) {
|
|
80
|
+
case 'org.sagebionetworks.repo.model.file.S3UploadDestination':
|
|
81
|
+
uploadDestinationString = SYNAPSE_STORAGE;
|
|
82
|
+
break;
|
|
83
|
+
case 'org.sagebionetworks.repo.model.file.ExternalUploadDestination':
|
|
84
|
+
uploadDestinationString = uploadDestination.url;
|
|
85
|
+
if (uploadDestination.uploadType === UploadDestination_1.UploadType.SFTP) {
|
|
86
|
+
var indexOfLastSlash = uploadDestinationString.lastIndexOf('/');
|
|
87
|
+
if (indexOfLastSlash) {
|
|
88
|
+
uploadDestinationString = uploadDestinationString.substring(0, indexOfLastSlash);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case 'org.sagebionetworks.repo.model.file.ExternalS3UploadDestination':
|
|
93
|
+
uploadDestinationString =
|
|
94
|
+
's3://' +
|
|
95
|
+
uploadDestination.bucket +
|
|
96
|
+
'/';
|
|
97
|
+
if (uploadDestination.baseKey != null) {
|
|
98
|
+
uploadDestinationString += uploadDestination.baseKey;
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case 'org.sagebionetworks.repo.model.file.ExternalGoogleCloudUploadDestination':
|
|
102
|
+
uploadDestinationString =
|
|
103
|
+
'gs://' +
|
|
104
|
+
uploadDestination.bucket +
|
|
105
|
+
'/';
|
|
106
|
+
if (uploadDestination.baseKey !=
|
|
107
|
+
null) {
|
|
108
|
+
uploadDestinationString += uploadDestination.baseKey;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case 'org.sagebionetworks.repo.model.file.ExternalObjectStoreUploadDestination':
|
|
112
|
+
uploadDestinationString =
|
|
113
|
+
uploadDestination
|
|
114
|
+
.endpointUrl +
|
|
115
|
+
'/' +
|
|
116
|
+
uploadDestination.bucket;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return uploadDestinationString;
|
|
121
|
+
}
|
|
122
|
+
exports.getUploadDestinationString = getUploadDestinationString;
|
|
33
123
|
//# sourceMappingURL=FileHandleUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileHandleUtils.js","sourceRoot":"","sources":["../../../src/lib/utils/functions/FileHandleUtils.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"FileHandleUtils.js","sourceRoot":"","sources":["../../../src/lib/utils/functions/FileHandleUtils.ts"],"names":[],"mappings":";;;AAAA,gDAewB;AACxB,4EAO+C;AAE/C,IAAM,eAAe,GAAG,iBAAiB,CAAA;AACzC,IAAM,2BAA2B,GAAG,CAAC,CAAA;AAWrC;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,UAAsB;IAEtB,QAAQ,UAAU,CAAC,YAAY,EAAE;QAC/B,KAAK,oEAAqD;YACxD,OAAO;gBACL,QAAQ,EAAG,UAA4C,CAAC,WAAW;gBACnE,MAAM,EAAG,UAA4C,CAAC,MAAM;gBAC5D,OAAO,EAAG,UAA4C,CAAC,OAAO;aAC/D,CAAA;QACH,KAAK,oDAAqC,CAAC;QAC3C,KAAK,uDAAwC;YAC3C,OAAO,EAAE,GAAG,EAAE,sBAAsB,CAAC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AuB,CAAA;AAChC,CAAC;AA5DD,gEA4DC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DoiAssociation } from '../../../synapseTypes';
|
|
2
|
+
import { UseQueryOptions } from 'react-query';
|
|
3
|
+
import { SynapseClientError } from '../../../SynapseClientError';
|
|
4
|
+
export declare function useGetDOIAssociation(objectId: string, versionNumber?: number, objectType?: string, options?: UseQueryOptions<DoiAssociation | null, SynapseClientError>): import("react-query").UseQueryResult<DoiAssociation | null, SynapseClientError>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGetDOIAssociation = void 0;
|
|
4
|
+
var react_query_1 = require("react-query");
|
|
5
|
+
var SynapseContext_1 = require("../../../SynapseContext");
|
|
6
|
+
var index_1 = require("../../../index");
|
|
7
|
+
function useGetDOIAssociation(objectId, versionNumber, objectType, options) {
|
|
8
|
+
if (objectType === void 0) { objectType = 'ENTITY'; }
|
|
9
|
+
var accessToken = (0, SynapseContext_1.useSynapseContext)().accessToken;
|
|
10
|
+
return (0, react_query_1.useQuery)(['doi', 'association', objectType, objectId, versionNumber], function () {
|
|
11
|
+
return index_1.SynapseClient.getDOIAssociation(accessToken, objectId, versionNumber, objectType);
|
|
12
|
+
}, options);
|
|
13
|
+
}
|
|
14
|
+
exports.useGetDOIAssociation = useGetDOIAssociation;
|
|
15
|
+
//# sourceMappingURL=useDOI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDOI.js","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/SynapseAPI/doi/useDOI.ts"],"names":[],"mappings":";;;AACA,2CAAuD;AAEvD,0DAA2D;AAC3D,wCAA8C;AAE9C,SAAgB,oBAAoB,CAClC,QAAgB,EAChB,aAAsB,EACtB,UAAqB,EACrB,OAAoE;IADpE,2BAAA,EAAA,qBAAqB;IAGb,IAAA,WAAW,GAAK,IAAA,kCAAiB,GAAE,YAAxB,CAAwB;IAC3C,OAAO,IAAA,sBAAQ,EACb,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC,EAC3D;QACE,OAAA,qBAAa,CAAC,iBAAiB,CAC7B,WAAW,EACX,QAAQ,EACR,aAAa,EACb,UAAU,CACX;IALD,CAKC,EACH,OAAO,CACR,CAAA;AACH,CAAC;AAlBD,oDAkBC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UseQueryOptions } from 'react-query';
|
|
2
|
+
import { SynapseClientError } from '../../../SynapseClientError';
|
|
3
|
+
import { UploadDestination } from '../../../synapseTypes/File/UploadDestination';
|
|
4
|
+
export declare function useGetDefaultUploadDestination(containerEntityId: string, options?: UseQueryOptions<UploadDestination, SynapseClientError>): import("react-query").UseQueryResult<UploadDestination, SynapseClientError>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGetDefaultUploadDestination = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_query_1 = require("react-query");
|
|
6
|
+
var SynapseContext_1 = require("../../../SynapseContext");
|
|
7
|
+
var SynapseClient_1 = require("../../../SynapseClient");
|
|
8
|
+
function useGetDefaultUploadDestination(containerEntityId, options) {
|
|
9
|
+
var accessToken = (0, SynapseContext_1.useSynapseContext)().accessToken;
|
|
10
|
+
return (0, react_query_1.useQuery)(['uploadDestination', 'default', containerEntityId], function () { return (0, SynapseClient_1.getDefaultUploadDestination)(containerEntityId, accessToken); }, tslib_1.__assign({}, options));
|
|
11
|
+
}
|
|
12
|
+
exports.useGetDefaultUploadDestination = useGetDefaultUploadDestination;
|
|
13
|
+
//# sourceMappingURL=useUploadDestination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUploadDestination.js","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/SynapseAPI/file/useUploadDestination.ts"],"names":[],"mappings":";;;;AAAA,2CAAuD;AAEvD,0DAA2D;AAE3D,wDAAoE;AAEpE,SAAgB,8BAA8B,CAC5C,iBAAyB,EACzB,OAAgE;IAExD,IAAA,WAAW,GAAK,IAAA,kCAAiB,GAAE,YAAxB,CAAwB;IAE3C,OAAO,IAAA,sBAAQ,EACb,CAAC,mBAAmB,EAAE,SAAS,EAAE,iBAAiB,CAAC,EACnD,cAAM,OAAA,IAAA,2CAA2B,EAAC,iBAAiB,EAAE,WAAW,CAAC,EAA3D,CAA2D,uBAE5D,OAAO,EAEb,CAAA;AACH,CAAC;AAbD,wEAaC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The upload destination contains information to start an upload of a file generated according to the underlying StorageLocationSetting.
|
|
3
|
+
*
|
|
4
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/UploadDestination.html
|
|
5
|
+
*/
|
|
6
|
+
export interface UploadDestination {
|
|
7
|
+
concreteType: ExternalObjectStoreUploadDestination['concreteType'] | ExternalUploadDestination['concreteType'] | BaseKeyUploadDestination['concreteType'];
|
|
8
|
+
storageLocationId: number;
|
|
9
|
+
uploadType: UploadType;
|
|
10
|
+
banner: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The upload destination contains information necessary to start an upload to an S3 bucket not managed by Synapse.
|
|
14
|
+
* This destination is mapped from an ExternalObjectStorageLocationSetting.
|
|
15
|
+
*
|
|
16
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/ExternalObjectStoreUploadDestination.html
|
|
17
|
+
*/
|
|
18
|
+
export interface ExternalObjectStoreUploadDestination extends UploadDestination {
|
|
19
|
+
concreteType: 'org.sagebionetworks.repo.model.file.ExternalObjectStoreUploadDestination';
|
|
20
|
+
endpointUrl: string;
|
|
21
|
+
bucket: string;
|
|
22
|
+
keyPrefixUUID: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* This upload destination contains information to start an upload to an SFTP or HTTPS destination. The destination is
|
|
26
|
+
* mapped from an ExternalStorageLocationSetting.
|
|
27
|
+
*
|
|
28
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/ExternalUploadDestination.html
|
|
29
|
+
*/
|
|
30
|
+
export interface ExternalUploadDestination extends UploadDestination {
|
|
31
|
+
concreteType: 'org.sagebionetworks.repo.model.file.ExternalUploadDestination';
|
|
32
|
+
url: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An upload destination with an optional base key.
|
|
36
|
+
*
|
|
37
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/BaseKeyUploadDestination.html
|
|
38
|
+
*/
|
|
39
|
+
export interface BaseKeyUploadDestination extends UploadDestination {
|
|
40
|
+
concreteType: StsUploadDestination['concreteType'] | ExternalGoogleCloudUploadDestination['concreteType'];
|
|
41
|
+
baseKey: string;
|
|
42
|
+
}
|
|
43
|
+
declare const EXTERNAL_GOOGLE_CLOUD_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE = "org.sagebionetworks.repo.model.file.ExternalGoogleCloudUploadDestination";
|
|
44
|
+
export declare type EXTERNAL_GOOGLE_CLOUD_UPLOAD_DESTINATION_CONCRETE_TYPE = typeof EXTERNAL_GOOGLE_CLOUD_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE;
|
|
45
|
+
/**
|
|
46
|
+
* This upload destination contains information to start an upload to an external Google Cloud Storage bucket connected
|
|
47
|
+
* with synapse. The destination is mapped from an ExternalGoogleCloudStorageLocationSetting.
|
|
48
|
+
*
|
|
49
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/ExternalGoogleCloudUploadDestination.html
|
|
50
|
+
*/
|
|
51
|
+
export interface ExternalGoogleCloudUploadDestination extends BaseKeyUploadDestination {
|
|
52
|
+
concreteType: EXTERNAL_GOOGLE_CLOUD_UPLOAD_DESTINATION_CONCRETE_TYPE;
|
|
53
|
+
bucket: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* An StsUploadDestination provides settings to enable Synapse to call AWS Security Token Service (STS) to get temporary
|
|
57
|
+
* AWS credentials
|
|
58
|
+
*
|
|
59
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/StsUploadDestination.html
|
|
60
|
+
*/
|
|
61
|
+
export interface StsUploadDestination extends BaseKeyUploadDestination {
|
|
62
|
+
concreteType: S3_UPLOAD_DESTINATION_CONCRETE_TYPE | EXTERNAL_S3_UPLOAD_DESTINATION_CONCRETE_TYPE;
|
|
63
|
+
stsEnabled: boolean;
|
|
64
|
+
}
|
|
65
|
+
declare const EXTERNAL_S3_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE = "org.sagebionetworks.repo.model.file.ExternalS3UploadDestination";
|
|
66
|
+
export declare type EXTERNAL_S3_UPLOAD_DESTINATION_CONCRETE_TYPE = typeof EXTERNAL_S3_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE;
|
|
67
|
+
/**
|
|
68
|
+
* This upload destination contains information to start an upload to an external external S3 bucket connected with
|
|
69
|
+
* Synapse. The destination is mapped from an ExternalS3StorageLocationSetting.
|
|
70
|
+
*
|
|
71
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/ExternalS3UploadDestination.html
|
|
72
|
+
*/
|
|
73
|
+
export interface ExternalS3UploadDestination extends StsUploadDestination {
|
|
74
|
+
concreteType: EXTERNAL_S3_UPLOAD_DESTINATION_CONCRETE_TYPE;
|
|
75
|
+
endpointUrl: string;
|
|
76
|
+
bucket: string;
|
|
77
|
+
}
|
|
78
|
+
declare const S3_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE = "org.sagebionetworks.repo.model.file.S3UploadDestination";
|
|
79
|
+
export declare type S3_UPLOAD_DESTINATION_CONCRETE_TYPE = typeof S3_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE;
|
|
80
|
+
/**
|
|
81
|
+
* The upload destination contains information to start an upload to the default Synapse storage location that exists on
|
|
82
|
+
* Amazon S3. This destination is mapped from an S3StorageLocationSetting.
|
|
83
|
+
*
|
|
84
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/S3UploadDestination.html
|
|
85
|
+
*/
|
|
86
|
+
export interface S3UploadDestination extends StsUploadDestination {
|
|
87
|
+
concreteType: S3_UPLOAD_DESTINATION_CONCRETE_TYPE;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The enumeration of possible upload types.
|
|
91
|
+
*
|
|
92
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/UploadType.html
|
|
93
|
+
*/
|
|
94
|
+
export declare enum UploadType {
|
|
95
|
+
S3 = "S3",
|
|
96
|
+
GOOGLECLOUDSTORAGE = "GOOGLECLOUDSTORAGE",
|
|
97
|
+
SFTP = "SFTP",
|
|
98
|
+
HTTPS = "HTTPS",
|
|
99
|
+
PROXYLOCAL = "PROXYLOCAL",
|
|
100
|
+
NONE = "NONE"
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UploadType = void 0;
|
|
4
|
+
var EXTERNAL_GOOGLE_CLOUD_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE = 'org.sagebionetworks.repo.model.file.ExternalGoogleCloudUploadDestination';
|
|
5
|
+
var EXTERNAL_S3_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE = 'org.sagebionetworks.repo.model.file.ExternalS3UploadDestination';
|
|
6
|
+
var S3_UPLOAD_DESTINATION_CONCRETE_TYPE_VALUE = 'org.sagebionetworks.repo.model.file.S3UploadDestination';
|
|
7
|
+
/**
|
|
8
|
+
* The enumeration of possible upload types.
|
|
9
|
+
*
|
|
10
|
+
* https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/UploadType.html
|
|
11
|
+
*/
|
|
12
|
+
var UploadType;
|
|
13
|
+
(function (UploadType) {
|
|
14
|
+
UploadType["S3"] = "S3";
|
|
15
|
+
UploadType["GOOGLECLOUDSTORAGE"] = "GOOGLECLOUDSTORAGE";
|
|
16
|
+
UploadType["SFTP"] = "SFTP";
|
|
17
|
+
UploadType["HTTPS"] = "HTTPS";
|
|
18
|
+
UploadType["PROXYLOCAL"] = "PROXYLOCAL";
|
|
19
|
+
UploadType["NONE"] = "NONE";
|
|
20
|
+
})(UploadType = exports.UploadType || (exports.UploadType = {}));
|
|
21
|
+
//# sourceMappingURL=UploadDestination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadDestination.js","sourceRoot":"","sources":["../../../../src/lib/utils/synapseTypes/File/UploadDestination.ts"],"names":[],"mappings":";;;AA6DA,IAAM,4DAA4D,GAChE,0EAA0E,CAAA;AA+B5E,IAAM,kDAAkD,GACtD,iEAAiE,CAAA;AAkBnE,IAAM,yCAAyC,GAC7C,yDAAyD,CAAA;AAc3D;;;;GAIG;AACH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,uBAAS,CAAA;IACT,uDAAyC,CAAA;IACzC,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,uCAAyB,CAAA;IACzB,2BAAa,CAAA;AACf,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB"}
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SanitizedWarning = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
var react_bootstrap_1 = require("react-bootstrap");
|
|
7
|
-
var WarningModal_1 = tslib_1.__importDefault(require("../../synapse_form_wrapper/WarningModal"));
|
|
8
|
-
function openRawHtmlInNewWindow(rawHtml) {
|
|
9
|
-
var newWindow = window.open('', '');
|
|
10
|
-
newWindow === null || newWindow === void 0 ? void 0 : newWindow.document.write(rawHtml);
|
|
11
|
-
// close document, to run scripts inside html string
|
|
12
|
-
newWindow === null || newWindow === void 0 ? void 0 : newWindow.document.close();
|
|
13
|
-
}
|
|
14
|
-
function SanitizedWarning(props) {
|
|
15
|
-
var rawHtml = props.rawHtml;
|
|
16
|
-
var _a = (0, react_1.useState)(false), showModal = _a[0], setShowModal = _a[1];
|
|
17
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
18
|
-
react_1.default.createElement(WarningModal_1.default, { title: 'Open Untrusted Content in New Window?', modalBody: 'Click "OK" to leave this page and open this content in a new window; this enables additional functionality, but should only be done if you trust the content.', show: showModal, confirmButtonText: 'OK', confirmButtonVariant: 'sds-primary', onConfirm: function () {
|
|
19
|
-
openRawHtmlInNewWindow(rawHtml);
|
|
20
|
-
setShowModal(false);
|
|
21
|
-
}, onCancel: function () { return setShowModal(false); } }),
|
|
22
|
-
react_1.default.createElement(react_bootstrap_1.Alert, { variant: "info", dismissible: false, show: true, transition: false },
|
|
23
|
-
"Limited rendering only.",
|
|
24
|
-
' ',
|
|
25
|
-
react_1.default.createElement("a", { onClick: function () { return setShowModal(true); } }, "External view available."))));
|
|
26
|
-
}
|
|
27
|
-
exports.SanitizedWarning = SanitizedWarning;
|
|
28
|
-
//# sourceMappingURL=SanitizedWarning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SanitizedWarning.js","sourceRoot":"","sources":["../../../../src/lib/containers/FilePreview/HtmlPreview/SanitizedWarning.tsx"],"names":[],"mappings":";;;;AAAA,qDAAuC;AACvC,mDAAuC;AACvC,iGAAkE;AAMlE,SAAS,sBAAsB,CAAC,OAAe;IAC7C,IAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IACrC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ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