@coscine/api-connection
Advanced tools
Comparing version 1.16.0 to 1.17.0
@@ -109,22 +109,13 @@ var axios = require('axios'); | ||
var axios$2 = require('axios'); | ||
function getDataSourceApiUrl() { | ||
return ('https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.File/DataSource/'); | ||
function getBlobApiUrl() { | ||
return ('https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.Blob/Blob/'); | ||
} | ||
var DataSourceApi = /** @class */ (function () { | ||
function DataSourceApi() { | ||
var BlobApi = /** @class */ (function () { | ||
function BlobApi() { | ||
} | ||
DataSourceApi.getDataSourceFolder = function (resourceId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
BlobApi.downloadObject = function (resourceId, path, name, catchHandler) { | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.downloadDataSourceFile = function (resourceId, path, name, catchHandler) { | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), { | ||
.get(getBlobApiUrl() + resourceId + '/' + encodeURIComponent(path), { | ||
responseType: 'blob' | ||
@@ -136,6 +127,7 @@ }) | ||
FileSaver_min.saveAs(response.data, name); | ||
window.location.hash = window.location.hash.substring(0, window.location.hash.lastIndexOf('/')); | ||
}) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.getDataSource = function (resourceId, path, thenHandler, catchHandler) { | ||
BlobApi.deleteObject = function (resourceId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -145,22 +137,13 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$2 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.delete(getBlobApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.delete = function (resourceId, path, thenHandler, catchHandler) { | ||
BlobApi.uploadObject = function (resourceId, path, mimetype, data, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2 | ||
.delete(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.Upload = function (resourceId, path, mimetype, data, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), | ||
url: getBlobApiUrl() + resourceId + '/' + encodeURIComponent(path), | ||
headers: { | ||
@@ -174,27 +157,12 @@ 'Content-Type': mimetype | ||
}; | ||
DataSourceApi.Update = function (resourceId, path, mimetype, data, thenHandler, catchHandler) { | ||
BlobApi.isResourceValid = function (body, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path) + '/update', | ||
headers: { | ||
'Content-Type': mimetype | ||
}, | ||
data: data | ||
}) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.isValidDataSource = function (body, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2 | ||
.post(getDataSourceApiUrl() + 'validate', body) | ||
.post(getBlobApiUrl() + 'validate', body) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.getQuota = function (resourceId, thenHandler, catchHandler) { | ||
BlobApi.getQuota = function (resourceId, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -204,7 +172,7 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$2 | ||
.get(getDataSourceApiUrl() + resourceId + '/quota') | ||
.get(getBlobApiUrl() + resourceId + '/quota') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return DataSourceApi; | ||
return BlobApi; | ||
}()); | ||
@@ -276,3 +244,3 @@ | ||
} | ||
MetadataApi.getMetadataForFile = function (resourceId, filename, version, thenHandler, catchHandler) { | ||
MetadataApi.getProfiles = function (thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -282,38 +250,16 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$6 | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/filename/' + | ||
encodeURIComponent(filename) + | ||
'/ver/' + | ||
version) | ||
.get(getMetadataApiUrl() + 'profiles/') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.storeMetadataForFile = function (resourceId, filename, version, body, thenHandler, catchHandler) { | ||
MetadataApi.getProfile = function (profile, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
// remove empty nodes | ||
for (var node in body) { | ||
var property = body[node]; | ||
if (property.length === 0 || | ||
property[0].value === undefined || | ||
property[0].value === null || | ||
property[0].value.trim() === '') { | ||
delete body[node]; | ||
} | ||
} | ||
return axios$6 | ||
.put(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/filename/' + | ||
encodeURIComponent(filename) + | ||
'/ver/' + | ||
version, body) | ||
.get(getMetadataApiUrl() + 'profiles/' + encodeURIComponent(profile)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getApplicationProfile = function (projectId, applicationProfileId, thenHandler, catchHandler) { | ||
MetadataApi.getProfileComplete = function (profile, resourceId, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -323,11 +269,7 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$6 | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
projectId + | ||
'/ap/' + | ||
encodeURIComponent(encodeURIComponent(applicationProfileId))) | ||
.get(getMetadataApiUrl() + 'profiles/' + encodeURIComponent(profile) + '/' + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getApplicationProfileComplete = function (resourceId, applicationProfileId, thenHandler, catchHandler) { | ||
MetadataApi.getVocabularies = function (thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -337,11 +279,7 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$6 | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/apc/' + | ||
encodeURIComponent(encodeURIComponent(applicationProfileId))) | ||
.get(getMetadataApiUrl() + 'vocabularies/') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.listAllApplicationProfiles = function (projectId, thenHandler, catchHandler) { | ||
MetadataApi.getVocabulary = function (path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -351,15 +289,6 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$6 | ||
.get(getMetadataApiUrl() + 'project/' + projectId + '/aplist/') | ||
.get(getMetadataApiUrl() + 'vocabularies/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getVocabulary = function (projectId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$6 | ||
.get(getMetadataApiUrl() + 'vocabulary/' + projectId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getClassInstances = function (projectId, className, thenHandler, catchHandler) { | ||
@@ -791,2 +720,40 @@ if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
var axios$h = require('axios'); | ||
function getTreeApiUrl() { | ||
return ('https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.Tree/Tree/'); | ||
} | ||
var TreeApi = /** @class */ (function () { | ||
function TreeApi() { | ||
} | ||
TreeApi.getMetadata = function (resourceId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
.get(getTreeApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
TreeApi.storeMetadataForFile = function (resourceId, path, body, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
// remove empty nodes | ||
for (var node in body) { | ||
var property = body[node]; | ||
if (property.length === 0 || | ||
property[0].value === undefined || | ||
property[0].value === null || | ||
property[0].value.trim() === '') { | ||
delete body[node]; | ||
} | ||
} | ||
return axios$h | ||
.put(getTreeApiUrl() + resourceId + '/' + encodeURIComponent(path), body) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return TreeApi; | ||
}()); | ||
var axios$i = require('axios'); | ||
function getUserApiUrl() { | ||
@@ -802,3 +769,3 @@ return 'https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.User/User/'; | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
return axios$i | ||
.get(getUserApiUrl() + 'query/' + query + '/project/' + parentId + '/') | ||
@@ -812,3 +779,3 @@ .then(thenHandler) | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
return axios$i | ||
.get(getUserApiUrl() + 'user') | ||
@@ -822,3 +789,3 @@ .then(thenHandler) | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
return axios$i | ||
.post(getUserApiUrl() + 'user', body) | ||
@@ -832,3 +799,3 @@ .then(thenHandler) | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
return axios$i | ||
.get(getUserApiUrl() + 'mergeToken/' + provider) | ||
@@ -841,3 +808,3 @@ .then(thenHandler) | ||
var axios$i = require('axios'); | ||
var axios$j = require('axios'); | ||
function getVisibilityApiUrl() { | ||
@@ -853,3 +820,3 @@ return ('https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.Project/Visibility/'); | ||
apiConnectionBasic.setHeader(); | ||
return axios$i | ||
return axios$j | ||
.get(getVisibilityApiUrl()) | ||
@@ -862,3 +829,3 @@ .then(thenHandler) | ||
export { ActivatedFeaturesApi, DataSourceApi, DisciplineApi, LanguageApi, LicenseApi, MetadataApi, OrganizationApi, ProjectApi, ProjectRoleApi, ResourceApi, ResourceTypeApi, RoleApi, SearchApi, SubProjectApi, TOSApi, TitleApi, UserApi, VisibilityApi }; | ||
export { ActivatedFeaturesApi, BlobApi, DisciplineApi, LanguageApi, LicenseApi, MetadataApi, OrganizationApi, ProjectApi, ProjectRoleApi, ResourceApi, ResourceTypeApi, RoleApi, SearchApi, SubProjectApi, TOSApi, TitleApi, TreeApi, UserApi, VisibilityApi }; | ||
//# sourceMappingURL=api-connection.es5.js.map |
@@ -115,22 +115,13 @@ (function (global, factory) { | ||
var axios$2 = require('axios'); | ||
function getDataSourceApiUrl() { | ||
return ('https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.File/DataSource/'); | ||
function getBlobApiUrl() { | ||
return ('https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.Blob/Blob/'); | ||
} | ||
var DataSourceApi = /** @class */ (function () { | ||
function DataSourceApi() { | ||
var BlobApi = /** @class */ (function () { | ||
function BlobApi() { | ||
} | ||
DataSourceApi.getDataSourceFolder = function (resourceId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
BlobApi.downloadObject = function (resourceId, path, name, catchHandler) { | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.downloadDataSourceFile = function (resourceId, path, name, catchHandler) { | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), { | ||
.get(getBlobApiUrl() + resourceId + '/' + encodeURIComponent(path), { | ||
responseType: 'blob' | ||
@@ -142,6 +133,7 @@ }) | ||
FileSaver_min.saveAs(response.data, name); | ||
window.location.hash = window.location.hash.substring(0, window.location.hash.lastIndexOf('/')); | ||
}) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.getDataSource = function (resourceId, path, thenHandler, catchHandler) { | ||
BlobApi.deleteObject = function (resourceId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -151,22 +143,13 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$2 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.delete(getBlobApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.delete = function (resourceId, path, thenHandler, catchHandler) { | ||
BlobApi.uploadObject = function (resourceId, path, mimetype, data, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2 | ||
.delete(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.Upload = function (resourceId, path, mimetype, data, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), | ||
url: getBlobApiUrl() + resourceId + '/' + encodeURIComponent(path), | ||
headers: { | ||
@@ -180,27 +163,12 @@ 'Content-Type': mimetype | ||
}; | ||
DataSourceApi.Update = function (resourceId, path, mimetype, data, thenHandler, catchHandler) { | ||
BlobApi.isResourceValid = function (body, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path) + '/update', | ||
headers: { | ||
'Content-Type': mimetype | ||
}, | ||
data: data | ||
}) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.isValidDataSource = function (body, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$2 | ||
.post(getDataSourceApiUrl() + 'validate', body) | ||
.post(getBlobApiUrl() + 'validate', body) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.getQuota = function (resourceId, thenHandler, catchHandler) { | ||
BlobApi.getQuota = function (resourceId, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -210,7 +178,7 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$2 | ||
.get(getDataSourceApiUrl() + resourceId + '/quota') | ||
.get(getBlobApiUrl() + resourceId + '/quota') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return DataSourceApi; | ||
return BlobApi; | ||
}()); | ||
@@ -282,3 +250,3 @@ | ||
} | ||
MetadataApi.getMetadataForFile = function (resourceId, filename, version, thenHandler, catchHandler) { | ||
MetadataApi.getProfiles = function (thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -288,38 +256,16 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$6 | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/filename/' + | ||
encodeURIComponent(filename) + | ||
'/ver/' + | ||
version) | ||
.get(getMetadataApiUrl() + 'profiles/') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.storeMetadataForFile = function (resourceId, filename, version, body, thenHandler, catchHandler) { | ||
MetadataApi.getProfile = function (profile, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
// remove empty nodes | ||
for (var node in body) { | ||
var property = body[node]; | ||
if (property.length === 0 || | ||
property[0].value === undefined || | ||
property[0].value === null || | ||
property[0].value.trim() === '') { | ||
delete body[node]; | ||
} | ||
} | ||
return axios$6 | ||
.put(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/filename/' + | ||
encodeURIComponent(filename) + | ||
'/ver/' + | ||
version, body) | ||
.get(getMetadataApiUrl() + 'profiles/' + encodeURIComponent(profile)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getApplicationProfile = function (projectId, applicationProfileId, thenHandler, catchHandler) { | ||
MetadataApi.getProfileComplete = function (profile, resourceId, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -329,11 +275,7 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$6 | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
projectId + | ||
'/ap/' + | ||
encodeURIComponent(encodeURIComponent(applicationProfileId))) | ||
.get(getMetadataApiUrl() + 'profiles/' + encodeURIComponent(profile) + '/' + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getApplicationProfileComplete = function (resourceId, applicationProfileId, thenHandler, catchHandler) { | ||
MetadataApi.getVocabularies = function (thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -343,11 +285,7 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$6 | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/apc/' + | ||
encodeURIComponent(encodeURIComponent(applicationProfileId))) | ||
.get(getMetadataApiUrl() + 'vocabularies/') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.listAllApplicationProfiles = function (projectId, thenHandler, catchHandler) { | ||
MetadataApi.getVocabulary = function (path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
@@ -357,15 +295,6 @@ if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
return axios$6 | ||
.get(getMetadataApiUrl() + 'project/' + projectId + '/aplist/') | ||
.get(getMetadataApiUrl() + 'vocabularies/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getVocabulary = function (projectId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$6 | ||
.get(getMetadataApiUrl() + 'vocabulary/' + projectId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getClassInstances = function (projectId, className, thenHandler, catchHandler) { | ||
@@ -797,2 +726,40 @@ if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
var axios$h = require('axios'); | ||
function getTreeApiUrl() { | ||
return ('https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.Tree/Tree/'); | ||
} | ||
var TreeApi = /** @class */ (function () { | ||
function TreeApi() { | ||
} | ||
TreeApi.getMetadata = function (resourceId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
.get(getTreeApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
TreeApi.storeMetadataForFile = function (resourceId, path, body, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = apiConnectionBasic.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = apiConnectionBasic.defaultOnCatch; } | ||
apiConnectionBasic.setHeader(); | ||
// remove empty nodes | ||
for (var node in body) { | ||
var property = body[node]; | ||
if (property.length === 0 || | ||
property[0].value === undefined || | ||
property[0].value === null || | ||
property[0].value.trim() === '') { | ||
delete body[node]; | ||
} | ||
} | ||
return axios$h | ||
.put(getTreeApiUrl() + resourceId + '/' + encodeURIComponent(path), body) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return TreeApi; | ||
}()); | ||
var axios$i = require('axios'); | ||
function getUserApiUrl() { | ||
@@ -808,3 +775,3 @@ return 'https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.User/User/'; | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
return axios$i | ||
.get(getUserApiUrl() + 'query/' + query + '/project/' + parentId + '/') | ||
@@ -818,3 +785,3 @@ .then(thenHandler) | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
return axios$i | ||
.get(getUserApiUrl() + 'user') | ||
@@ -828,3 +795,3 @@ .then(thenHandler) | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
return axios$i | ||
.post(getUserApiUrl() + 'user', body) | ||
@@ -838,3 +805,3 @@ .then(thenHandler) | ||
apiConnectionBasic.setHeader(); | ||
return axios$h | ||
return axios$i | ||
.get(getUserApiUrl() + 'mergeToken/' + provider) | ||
@@ -847,3 +814,3 @@ .then(thenHandler) | ||
var axios$i = require('axios'); | ||
var axios$j = require('axios'); | ||
function getVisibilityApiUrl() { | ||
@@ -859,3 +826,3 @@ return ('https://' + apiConnectionBasic.getHostName() + '/coscine/api/Coscine.Api.Project/Visibility/'); | ||
apiConnectionBasic.setHeader(); | ||
return axios$i | ||
return axios$j | ||
.get(getVisibilityApiUrl()) | ||
@@ -869,3 +836,3 @@ .then(thenHandler) | ||
exports.ActivatedFeaturesApi = ActivatedFeaturesApi; | ||
exports.DataSourceApi = DataSourceApi; | ||
exports.BlobApi = BlobApi; | ||
exports.DisciplineApi = DisciplineApi; | ||
@@ -885,2 +852,3 @@ exports.LanguageApi = LanguageApi; | ||
exports.TitleApi = TitleApi; | ||
exports.TreeApi = TreeApi; | ||
exports.UserApi = UserApi; | ||
@@ -887,0 +855,0 @@ exports.VisibilityApi = VisibilityApi; |
@@ -5,4 +5,4 @@ "use strict"; | ||
Object.defineProperty(exports, "ActivatedFeaturesApi", { enumerable: true, get: function () { return activatedFeatures_api_1.ActivatedFeaturesApi; } }); | ||
var datasource_api_1 = require("./requests/datasource-api"); | ||
Object.defineProperty(exports, "DataSourceApi", { enumerable: true, get: function () { return datasource_api_1.DataSourceApi; } }); | ||
var blob_api_1 = require("./requests/blob-api"); | ||
Object.defineProperty(exports, "BlobApi", { enumerable: true, get: function () { return blob_api_1.BlobApi; } }); | ||
var discipline_api_1 = require("./requests/discipline-api"); | ||
@@ -36,2 +36,4 @@ Object.defineProperty(exports, "DisciplineApi", { enumerable: true, get: function () { return discipline_api_1.DisciplineApi; } }); | ||
Object.defineProperty(exports, "TOSApi", { enumerable: true, get: function () { return tos_api_1.TOSApi; } }); | ||
var tree_api_1 = require("./requests/tree-api"); | ||
Object.defineProperty(exports, "TreeApi", { enumerable: true, get: function () { return tree_api_1.TreeApi; } }); | ||
var user_api_1 = require("./requests/user-api"); | ||
@@ -38,0 +40,0 @@ Object.defineProperty(exports, "UserApi", { enumerable: true, get: function () { return user_api_1.UserApi; } }); |
@@ -12,3 +12,3 @@ "use strict"; | ||
} | ||
MetadataApi.getMetadataForFile = function (resourceId, filename, version, thenHandler, catchHandler) { | ||
MetadataApi.getProfiles = function (thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = api_connection_basic_1.default.defaultThenHandler; } | ||
@@ -18,38 +18,16 @@ if (catchHandler === void 0) { catchHandler = api_connection_basic_1.default.defaultOnCatch; } | ||
return axios | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/filename/' + | ||
encodeURIComponent(filename) + | ||
'/ver/' + | ||
version) | ||
.get(getMetadataApiUrl() + 'profiles/') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.storeMetadataForFile = function (resourceId, filename, version, body, thenHandler, catchHandler) { | ||
MetadataApi.getProfile = function (profile, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = api_connection_basic_1.default.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = api_connection_basic_1.default.defaultOnCatch; } | ||
api_connection_basic_1.default.setHeader(); | ||
// remove empty nodes | ||
for (var node in body) { | ||
var property = body[node]; | ||
if (property.length === 0 || | ||
property[0].value === undefined || | ||
property[0].value === null || | ||
property[0].value.trim() === '') { | ||
delete body[node]; | ||
} | ||
} | ||
return axios | ||
.put(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/filename/' + | ||
encodeURIComponent(filename) + | ||
'/ver/' + | ||
version, body) | ||
.get(getMetadataApiUrl() + 'profiles/' + encodeURIComponent(profile)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getApplicationProfile = function (projectId, applicationProfileId, thenHandler, catchHandler) { | ||
MetadataApi.getProfileComplete = function (profile, resourceId, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = api_connection_basic_1.default.defaultThenHandler; } | ||
@@ -59,11 +37,7 @@ if (catchHandler === void 0) { catchHandler = api_connection_basic_1.default.defaultOnCatch; } | ||
return axios | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
projectId + | ||
'/ap/' + | ||
encodeURIComponent(encodeURIComponent(applicationProfileId))) | ||
.get(getMetadataApiUrl() + 'profiles/' + encodeURIComponent(profile) + '/' + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getApplicationProfileComplete = function (resourceId, applicationProfileId, thenHandler, catchHandler) { | ||
MetadataApi.getVocabularies = function (thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = api_connection_basic_1.default.defaultThenHandler; } | ||
@@ -73,11 +47,7 @@ if (catchHandler === void 0) { catchHandler = api_connection_basic_1.default.defaultOnCatch; } | ||
return axios | ||
.get(getMetadataApiUrl() + | ||
'resource/' + | ||
resourceId + | ||
'/apc/' + | ||
encodeURIComponent(encodeURIComponent(applicationProfileId))) | ||
.get(getMetadataApiUrl() + 'vocabularies/') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.listAllApplicationProfiles = function (projectId, thenHandler, catchHandler) { | ||
MetadataApi.getVocabulary = function (path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = api_connection_basic_1.default.defaultThenHandler; } | ||
@@ -87,15 +57,6 @@ if (catchHandler === void 0) { catchHandler = api_connection_basic_1.default.defaultOnCatch; } | ||
return axios | ||
.get(getMetadataApiUrl() + 'project/' + projectId + '/aplist/') | ||
.get(getMetadataApiUrl() + 'vocabularies/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getVocabulary = function (projectId, path, thenHandler, catchHandler) { | ||
if (thenHandler === void 0) { thenHandler = api_connection_basic_1.default.defaultThenHandler; } | ||
if (catchHandler === void 0) { catchHandler = api_connection_basic_1.default.defaultOnCatch; } | ||
api_connection_basic_1.default.setHeader(); | ||
return axios | ||
.get(getMetadataApiUrl() + 'vocabulary/' + projectId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
MetadataApi.getClassInstances = function (projectId, className, thenHandler, catchHandler) { | ||
@@ -102,0 +63,0 @@ if (thenHandler === void 0) { thenHandler = api_connection_basic_1.default.defaultThenHandler; } |
export { ActivatedFeaturesApi } from './requests/activatedFeatures-api'; | ||
export { DataSourceApi } from './requests/datasource-api'; | ||
export { BlobApi } from './requests/blob-api'; | ||
export { DisciplineApi } from './requests/discipline-api'; | ||
@@ -17,3 +17,4 @@ export { LanguageApi } from './requests/language-api'; | ||
export { TOSApi } from './requests/tos-api'; | ||
export { TreeApi } from './requests/tree-api'; | ||
export { UserApi } from './requests/user-api'; | ||
export { VisibilityApi } from './requests/visibility-api'; |
export declare class MetadataApi { | ||
static getMetadataForFile(resourceId: string, filename: string, version: string, thenHandler?: any, catchHandler?: any): any; | ||
static storeMetadataForFile(resourceId: string, filename: string, version: string, body: { | ||
[index: string]: Array<{ | ||
value: any; | ||
}>; | ||
}, thenHandler?: any, catchHandler?: any): any; | ||
static getApplicationProfile(projectId: string, applicationProfileId: string, thenHandler?: any, catchHandler?: any): any; | ||
static getApplicationProfileComplete(resourceId: string, applicationProfileId: string, thenHandler?: any, catchHandler?: any): any; | ||
static listAllApplicationProfiles(projectId: string, thenHandler?: any, catchHandler?: any): any; | ||
static getVocabulary(projectId: string, path: string, thenHandler?: any, catchHandler?: any): any; | ||
static getProfiles(thenHandler?: any, catchHandler?: any): any; | ||
static getProfile(profile: string, thenHandler?: any, catchHandler?: any): any; | ||
static getProfileComplete(profile: string, resourceId: string, thenHandler?: any, catchHandler?: any): any; | ||
static getVocabularies(thenHandler?: any, catchHandler?: any): any; | ||
static getVocabulary(path: string, thenHandler?: any, catchHandler?: any): any; | ||
static getClassInstances(projectId: string, className: string, thenHandler?: any, catchHandler?: any): any; | ||
} |
{ | ||
"name": "@coscine/api-connection", | ||
"version": "1.16.0", | ||
"version": "1.17.0", | ||
"description": "This library provides methods to connect to CoScInE Apis with JavaScript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
71
339421
2666