@adobe/pdftools-extract-node-sdk
Version:
The Document Services PDF Tools Extract Node.js SDK provides APIs for extracting elements and renditions from PDF
103 lines (94 loc) • 3.76 kB
JavaScript
/*
* Copyright 2019 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it. If you have received this file from a source other than Adobe,
* then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
const projectJson = require('./../../../package.json');
const customErrorMessages = {
// Custom IMS error messages
imsInvalidTokenGenericErrorMessage: 'Either your certificate for PDF Tools API credentials has expired or an ' +
'invalid Organization_ID/Account_ID has been used in credentials. Please visit Adobe IO ' +
'Console(http://console.adobe.io/) to update your public certificate to use the same credentials or to check ' +
'the value of Organization Id or Account ID.',
imsCertificateExpiredErrorMessage: 'Your certificate for PDF Tools API credentials might have expired. ' +
'Please visit Adobe IO Console(http://console.adobe.io/) to update your public certificate to use the same ' +
'credentials.',
// Service usage exception error messages
serviceUsageLimitReachedErrorMessage: 'Service usage limit has been reached. Please retry after sometime.',
integrationServiceUsageLimitReachedErrorMessage: 'Service usage limit has been reached for the integration. ' +
'Please retry after sometime.',
// Quota specific exception error messages
quotaExhaustedErrorMessage: 'Free trial quota exhausted. Please visit (www.adobe.com/go/pdftoolsapi_err_quota) to ' +
'upgrade to paid credentials.',
quotaUnavailableErrorMessage: 'Quota for this operation is not available. Please visit ' +
'(www.adobe.com/go/pdftoolsapi_home) to start using free trial quota.'
};
const defaultConfig = {
logFileName: 'config/pdftools-sdk-log4js-config.json',
tempFolderName: 'pdfServicesSdkResult',
globalApiKey: 'AdobeDCPlatformExtractNodeJSKey',
http: {
connectTimeout: 10000,
readTimeout: 20000
},
v2PredictUri: "https://senseicore-ue1.adobe.io/services/v2/predict",
opsCreateUri: "https://cpf-ue1.adobe.io/ops/:create",
imsBaseUri:"https://ims-na1.adobelogin.com",
claim : "/s/ent_documentcloud_sdk",
jwt: {
baseUri: 'https://ims-na1.adobelogin.com',
uriSuffix: 'ims/exchange/jwt/',
audienceSuffix: 'c/'
},
appInfo: `${projectJson.name}-${projectJson.version}`,
specialHttpErrorCodes: {
503: 'ServiceUnavailable:The Gateway servers are up, but overloaded with requests. Try again later.',
// eslint-disable-next-line max-len
504: 'Gateway Timeout:The Gateway servers are up, but the request could not be serviced due to some failure within our stack. Try again later.',
502: 'BadGateway:Bad gateway',
413: 'RequestEntityTooLarge:Request entity too large'
},
apiGatewayErrorCodes: {
429: {
'429001': {
errorMessage: customErrorMessages.serviceUsageLimitReachedErrorMessage
},
'429002': {
errorMessage: customErrorMessages.integrationServiceUsageLimitReachedErrorMessage
}
}
},
cpfErrorCodes: {
429: {
'429001': {
errorMessage: customErrorMessages.quotaExhaustedErrorMessage
},
'429002': {
errorMessage: customErrorMessages.quotaUnavailableErrorMessage
}
}
},
imsErrorCodes: {
400: {
'invalid_token': {
imsInvalidTokenGenericErrorMessage: customErrorMessages.imsInvalidTokenGenericErrorMessage,
imsCertificateExpiredErrorMessage: customErrorMessages.imsCertificateExpiredErrorMessage
}
}
},
v2Services: {
v2PredictUri: 'https://senseicore-stage-ue1.adobe.io/services/v2/predict'
},
cpfServices: {
opsCreateUri: 'https://cpf-ue1.adobe.io/ops/:create'
},
operationName:{
extractPdf: 'Extract PDF Operation'
}
};
module.exports = defaultConfig;